增加formily json schema生成
This commit is contained in:
parent
79c9804dbd
commit
f8dc82b7a9
@ -62,8 +62,6 @@ public class WorkflowDefinitionDTO extends BaseDTO {
|
|||||||
private WorkflowDefinitionStatusEnums status;
|
private WorkflowDefinitionStatusEnums status;
|
||||||
|
|
||||||
|
|
||||||
private JsonNode localVariablesSchema;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程描述
|
* 流程描述
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 工作流边
|
* 工作流边
|
||||||
|
*
|
||||||
* @author cascade
|
* @author cascade
|
||||||
* @date 2024-12-11
|
* @date 2024-12-11
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import com.qqchen.deploy.backend.workflow.enums.NodeTypeEnums;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工作流节点数据传输对象
|
* 工作流节点数据传输对象
|
||||||
*
|
*
|
||||||
@ -14,36 +16,20 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class WorkflowDefinitionGraphNode {
|
public class WorkflowDefinitionGraphNode {
|
||||||
|
|
||||||
/**
|
|
||||||
* 节点ID
|
|
||||||
*/
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 节点Code
|
|
||||||
*/
|
|
||||||
private String nodeCode;
|
private String nodeCode;
|
||||||
|
|
||||||
/**
|
|
||||||
* 节点类型
|
|
||||||
*/
|
|
||||||
private NodeTypeEnums nodeType;
|
private NodeTypeEnums nodeType;
|
||||||
|
|
||||||
/**
|
|
||||||
* 节点名称
|
|
||||||
*/
|
|
||||||
private String nodeName;
|
private String nodeName;
|
||||||
|
|
||||||
@Schema(description = "节点UI")
|
private Map<String, Object> position;
|
||||||
private JsonNode uiVariables;
|
|
||||||
|
|
||||||
@Schema(description = "节点属性")
|
private Map<String, String> configs;
|
||||||
private JsonNode panelVariables;
|
|
||||||
|
|
||||||
@Schema(description = "节点环境变量")
|
private Map<String, String> inputMapping;
|
||||||
private JsonNode localVariables;
|
|
||||||
|
|
||||||
@Schema(description = "节点表单 JSON SCHEMA")
|
private Map<String, String> outputMapping;
|
||||||
private JsonNode formVariablesSchema;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public class BpmnConverter {
|
|||||||
* 创建并初始化BPMN模型
|
* 创建并初始化BPMN模型
|
||||||
*
|
*
|
||||||
* @param processKey 流程定义的唯一标识
|
* @param processKey 流程定义的唯一标识
|
||||||
* @param bpmnModel BPMN模型对象
|
* @param bpmnModel BPMN模型对象
|
||||||
* @return 初始化后的Process对象
|
* @return 初始化后的Process对象
|
||||||
*/
|
*/
|
||||||
private Process createAndInitializeBpmnModel(String processKey, BpmnModel bpmnModel) {
|
private Process createAndInitializeBpmnModel(String processKey, BpmnModel bpmnModel) {
|
||||||
@ -99,7 +99,7 @@ public class BpmnConverter {
|
|||||||
/**
|
/**
|
||||||
* 转换工作流节点为BPMN节点
|
* 转换工作流节点为BPMN节点
|
||||||
*
|
*
|
||||||
* @param nodes 工作流定义节点列表
|
* @param nodes 工作流定义节点列表
|
||||||
* @param process 流程定义对象
|
* @param process 流程定义对象
|
||||||
* @return 节点ID映射关系
|
* @return 节点ID映射关系
|
||||||
*/
|
*/
|
||||||
@ -119,8 +119,8 @@ public class BpmnConverter {
|
|||||||
/**
|
/**
|
||||||
* 转换单个工作流节点为BPMN节点
|
* 转换单个工作流节点为BPMN节点
|
||||||
*
|
*
|
||||||
* @param node 工作流节点定义
|
* @param node 工作流节点定义
|
||||||
* @param process 流程定义对象
|
* @param process 流程定义对象
|
||||||
* @param idMapping 节点ID映射关系
|
* @param idMapping 节点ID映射关系
|
||||||
*/
|
*/
|
||||||
private void convertSingleNode(WorkflowDefinitionGraphNode node, Process process, Map<String, String> idMapping) {
|
private void convertSingleNode(WorkflowDefinitionGraphNode node, Process process, Map<String, String> idMapping) {
|
||||||
@ -225,17 +225,17 @@ public class BpmnConverter {
|
|||||||
/**
|
/**
|
||||||
* 配置服务任务节点
|
* 配置服务任务节点
|
||||||
*
|
*
|
||||||
* @param serviceTask 服务任务节点
|
* @param serviceTask 服务任务节点
|
||||||
* @param node 工作流节点定义
|
* @param node 工作流节点定义
|
||||||
* @param process 当前流程
|
* @param process 当前流程
|
||||||
* @param extensionElements 扩展元素
|
* @param extensionElements 扩展元素
|
||||||
*/
|
*/
|
||||||
private void configureServiceTask(ServiceTask serviceTask, WorkflowDefinitionGraphNode node, Process process, Map<String, List<ExtensionElement>> extensionElements) {
|
private void configureServiceTask(ServiceTask serviceTask, WorkflowDefinitionGraphNode node, Process process, Map<String, List<ExtensionElement>> extensionElements) {
|
||||||
if (node.getPanelVariables() != null && node.getPanelVariables().has("delegate")) {
|
// if (node.getPanelVariables() != null && node.getPanelVariables().has("delegate")) {
|
||||||
String delegate = node.getPanelVariables().get("delegate").asText();
|
// String delegate = node.getPanelVariables().get("delegate").asText();
|
||||||
serviceTask.setImplementationType("delegateExpression");
|
// serviceTask.setImplementationType("delegateExpression");
|
||||||
serviceTask.setImplementation(delegate);
|
// serviceTask.setImplementation(delegate);
|
||||||
}
|
// }
|
||||||
|
|
||||||
addExecutionVariables(extensionElements, node);
|
addExecutionVariables(extensionElements, node);
|
||||||
addRetryStrategy(extensionElements);
|
addRetryStrategy(extensionElements);
|
||||||
@ -246,7 +246,7 @@ public class BpmnConverter {
|
|||||||
/**
|
/**
|
||||||
* 创建扩展属性
|
* 创建扩展属性
|
||||||
*
|
*
|
||||||
* @param name 属性名
|
* @param name 属性名
|
||||||
* @param value 属性值
|
* @param value 属性值
|
||||||
* @return 扩展属性
|
* @return 扩展属性
|
||||||
*/
|
*/
|
||||||
@ -261,35 +261,35 @@ public class BpmnConverter {
|
|||||||
* 添加执行实例级变量
|
* 添加执行实例级变量
|
||||||
*
|
*
|
||||||
* @param extensionElements 扩展元素
|
* @param extensionElements 扩展元素
|
||||||
* @param node 工作流节点定义
|
* @param node 工作流节点定义
|
||||||
*/
|
*/
|
||||||
private void addExecutionVariables(Map<String, List<ExtensionElement>> extensionElements, WorkflowDefinitionGraphNode node) {
|
private void addExecutionVariables(Map<String, List<ExtensionElement>> extensionElements, WorkflowDefinitionGraphNode node) {
|
||||||
// 添加panelVariables变量
|
// 添加panelVariables变量
|
||||||
if (node.getPanelVariables() != null) {
|
// if (node.getPanelVariables() != null) {
|
||||||
ExtensionElement fieldElement = new ExtensionElement();
|
// ExtensionElement fieldElement = new ExtensionElement();
|
||||||
fieldElement.setName("field");
|
// fieldElement.setName("field");
|
||||||
fieldElement.setNamespace("http://flowable.org/bpmn");
|
// fieldElement.setNamespace("http://flowable.org/bpmn");
|
||||||
fieldElement.setNamespacePrefix("flowable");
|
// fieldElement.setNamespacePrefix("flowable");
|
||||||
|
//
|
||||||
// 创建field的子元素string
|
// // 创建field的子元素string
|
||||||
ExtensionElement stringElement = new ExtensionElement();
|
// ExtensionElement stringElement = new ExtensionElement();
|
||||||
stringElement.setName("string");
|
// stringElement.setName("string");
|
||||||
stringElement.setNamespace("http://flowable.org/bpmn");
|
// stringElement.setNamespace("http://flowable.org/bpmn");
|
||||||
stringElement.setNamespacePrefix("flowable");
|
// stringElement.setNamespacePrefix("flowable");
|
||||||
// 直接设置JSON内容,不使用CDATA
|
// // 直接设置JSON内容,不使用CDATA
|
||||||
stringElement.setElementText(node.getPanelVariables().toString());
|
// stringElement.setElementText(node.getPanelVariables().toString());
|
||||||
|
//
|
||||||
// 设置field的name属性
|
// // 设置field的name属性
|
||||||
Map<String, List<ExtensionAttribute>> fieldAttributes = new HashMap<>();
|
// Map<String, List<ExtensionAttribute>> fieldAttributes = new HashMap<>();
|
||||||
fieldAttributes.put("name", Collections.singletonList(createAttribute("name", "panelVariables")));
|
// fieldAttributes.put("name", Collections.singletonList(createAttribute("name", "panelVariables")));
|
||||||
fieldElement.setAttributes(fieldAttributes);
|
// fieldElement.setAttributes(fieldAttributes);
|
||||||
|
//
|
||||||
// 添加string子元素到field
|
// // 添加string子元素到field
|
||||||
fieldElement.addChildElement(stringElement);
|
// fieldElement.addChildElement(stringElement);
|
||||||
|
//
|
||||||
// 添加field到extensionElements
|
// // 添加field到extensionElements
|
||||||
extensionElements.computeIfAbsent("field", k -> new ArrayList<>()).add(fieldElement);
|
// extensionElements.computeIfAbsent("field", k -> new ArrayList<>()).add(fieldElement);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 添加localVariables变量
|
// 添加localVariables变量
|
||||||
// if (node.getLocalVariables() != null) {
|
// if (node.getLocalVariables() != null) {
|
||||||
@ -339,7 +339,7 @@ public class BpmnConverter {
|
|||||||
/**
|
/**
|
||||||
* 创建执行监听器扩展元素
|
* 创建执行监听器扩展元素
|
||||||
*
|
*
|
||||||
* @param event 事件类型(start/end)
|
* @param event 事件类型(start/end)
|
||||||
* @param delegateExpression 委托表达式
|
* @param delegateExpression 委托表达式
|
||||||
* @return 配置好的监听器扩展元素
|
* @return 配置好的监听器扩展元素
|
||||||
*/
|
*/
|
||||||
@ -372,8 +372,8 @@ public class BpmnConverter {
|
|||||||
* 为活动节点添加错误边界事件和错误结束事件
|
* 为活动节点添加错误边界事件和错误结束事件
|
||||||
* 当节点执行失败时,会触发错误边界事件,并流转到错误结束事件
|
* 当节点执行失败时,会触发错误边界事件,并流转到错误结束事件
|
||||||
*
|
*
|
||||||
* @param process BPMN流程定义
|
* @param process BPMN流程定义
|
||||||
* @param activity 需要添加错误处理的活动节点
|
* @param activity 需要添加错误处理的活动节点
|
||||||
*/
|
*/
|
||||||
private void addErrorBoundaryEventHandler(Process process, Activity activity) {
|
private void addErrorBoundaryEventHandler(Process process, Activity activity) {
|
||||||
BoundaryEvent boundaryEvent = createErrorBoundaryEvent(activity);
|
BoundaryEvent boundaryEvent = createErrorBoundaryEvent(activity);
|
||||||
@ -448,45 +448,46 @@ public class BpmnConverter {
|
|||||||
/**
|
/**
|
||||||
* 创建网关节点
|
* 创建网关节点
|
||||||
*
|
*
|
||||||
* @param node 工作流节点定义
|
* @param node 工作流节点定义
|
||||||
* @param validId 有效的节点ID
|
* @param validId 有效的节点ID
|
||||||
* @return 创建的网关节点
|
* @return 创建的网关节点
|
||||||
*/
|
*/
|
||||||
private Gateway createGatewayElement(WorkflowDefinitionGraphNode node, String validId) {
|
private Gateway createGatewayElement(WorkflowDefinitionGraphNode node, String validId) {
|
||||||
if (node.getPanelVariables() == null) {
|
// if (node.getPanelVariables() == null) {
|
||||||
throw new IllegalArgumentException("Gateway node must have panel variables");
|
// throw new IllegalArgumentException("Gateway node must have panel variables");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
String gatewayTypeCode = node.getPanelVariables().get("gatewayType").asText();
|
// String gatewayTypeCode = node.getPanelVariables().get("gatewayType").asText();
|
||||||
GatewayTypeEnums gatewayType = GatewayTypeEnums.fromCode(gatewayTypeCode);
|
// GatewayTypeEnums gatewayType = GatewayTypeEnums.fromCode(gatewayTypeCode);
|
||||||
|
//
|
||||||
Gateway gateway;
|
// Gateway gateway;
|
||||||
switch (gatewayType) {
|
// switch (gatewayType) {
|
||||||
case EXCLUSIVE_GATEWAY:
|
// case EXCLUSIVE_GATEWAY:
|
||||||
gateway = new ExclusiveGateway();
|
// gateway = new ExclusiveGateway();
|
||||||
break;
|
// break;
|
||||||
case PARALLEL_GATEWAY:
|
// case PARALLEL_GATEWAY:
|
||||||
gateway = new ParallelGateway();
|
// gateway = new ParallelGateway();
|
||||||
break;
|
// break;
|
||||||
case INCLUSIVE_GATEWAY:
|
// case INCLUSIVE_GATEWAY:
|
||||||
gateway = new InclusiveGateway();
|
// gateway = new InclusiveGateway();
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
throw new IllegalArgumentException("Unsupported gateway type: " + gatewayType);
|
// throw new IllegalArgumentException("Unsupported gateway type: " + gatewayType);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
gateway.setId(validId);
|
// gateway.setId(validId);
|
||||||
gateway.setName(node.getNodeName());
|
// gateway.setName(node.getNodeName());
|
||||||
|
//
|
||||||
return gateway;
|
// return gateway;
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换连线为顺序流
|
* 转换连线为顺序流
|
||||||
*
|
*
|
||||||
* @param edges 工作流定义边集合
|
* @param edges 工作流定义边集合
|
||||||
* @param idMapping 节点ID映射
|
* @param idMapping 节点ID映射
|
||||||
* @param process 流程定义
|
* @param process 流程定义
|
||||||
*/
|
*/
|
||||||
private void convertEdgesToSequenceFlows(List<WorkflowDefinitionGraphEdge> edges, Map<String, String> idMapping, Process process) {
|
private void convertEdgesToSequenceFlows(List<WorkflowDefinitionGraphEdge> edges, Map<String, String> idMapping, Process process) {
|
||||||
for (WorkflowDefinitionGraphEdge edge : edges) {
|
for (WorkflowDefinitionGraphEdge edge : edges) {
|
||||||
|
|||||||
@ -2,9 +2,9 @@ server:
|
|||||||
port: 8080
|
port: 8080
|
||||||
spring:
|
spring:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://localhost:3306/deploy-ease-platform?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true&createDatabaseIfNotExist=true
|
url: jdbc:mysql://172.22.222.111:3306/deploy-ease-platform?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true&createDatabaseIfNotExist=true
|
||||||
username: root
|
username: deploy-ease-platform
|
||||||
password: root
|
password: Qichen5210523
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
hikari:
|
hikari:
|
||||||
# 连接池最大连接数
|
# 连接池最大连接数
|
||||||
|
|||||||
@ -607,253 +607,163 @@ INSERT INTO workflow_definition (
|
|||||||
-- --------------------------------------------------------------------------------------
|
-- --------------------------------------------------------------------------------------
|
||||||
-- 初始化工作流节点定义数据
|
-- 初始化工作流节点定义数据
|
||||||
-- --------------------------------------------------------------------------------------
|
-- --------------------------------------------------------------------------------------
|
||||||
# INSERT INTO workflow_node_definition (id, create_time, create_by, update_time, update_by, type, name, description, category, graph_config, enabled)
|
-- 初始化工作流节点定义数据
|
||||||
# VALUES
|
INSERT INTO workflow_node_definition (
|
||||||
# (1, NOW(),
|
node_type, node_code, node_name, description, category,
|
||||||
# 'system',
|
ui_variables, panel_variables_schema, local_variables_schema,
|
||||||
# NOW(),
|
form_variables_schema, enabled,
|
||||||
# 'system', 'START_EVENT', '开始节点', '工作流的起点', 'EVENT', '{
|
create_time, create_by, update_time, update_by, version, deleted
|
||||||
# "code": "START_EVENT",
|
) VALUES
|
||||||
# "name": "开始节点",
|
-- 开始节点
|
||||||
# "description": "工作流的起点",
|
(
|
||||||
# "details": {
|
'START_EVENT', 'START_EVENT', '开始节点', '工作流的起点', 'EVENT',
|
||||||
# "description": "标记流程的开始位置,可以定义流程启动条件和初始化流程变量",
|
'{
|
||||||
# "features": ["标记流程的开始位置", "定义流程启动条件", "初始化流程变量"],
|
"shape": "circle",
|
||||||
# "scenarios": ["用户手动启动流程", "定时触发流程", "外部系统调用启动"]
|
"size": {"width": 40, "height": 40},
|
||||||
# },
|
"style": {
|
||||||
# "configSchema": {
|
"fill": "#e8f7ff",
|
||||||
# "type": "object",
|
"stroke": "#1890ff",
|
||||||
# "properties": {
|
"strokeWidth": 2,
|
||||||
# "code": {"type": "string", "title": "节点Code", "description": "工作流节点的Code"},
|
"icon": "play-circle",
|
||||||
# "name": {"type": "string", "title": "节点名称", "description": "工作流节点的显示名称"},
|
"iconColor": "#1890ff"
|
||||||
# "description": {"type": "string", "title": "节点描述", "description": "工作流节点的详细描述"}
|
},
|
||||||
# },
|
"ports": {
|
||||||
# "required": ["code", "name"]
|
"groups": {
|
||||||
# },
|
"out": {
|
||||||
# "uiSchema": {
|
"position": "right",
|
||||||
# "shape": "circle",
|
"attrs": {
|
||||||
# "size": {"width": 40, "height": 40},
|
"circle": {"r": 4, "fill": "#ffffff", "stroke": "#1890ff"}
|
||||||
# "style": {
|
}
|
||||||
# "fill": "#e8f7ff",
|
}
|
||||||
# "stroke": "#1890ff",
|
}
|
||||||
# "strokeWidth": 2,
|
}
|
||||||
# "icon": "play-circle",
|
}',
|
||||||
# "iconColor": "#1890ff"
|
'{
|
||||||
# },
|
"type": "object",
|
||||||
# "ports": {
|
"properties": {
|
||||||
# "groups": {
|
"code": {"type": "string", "title": "节点Code"},
|
||||||
# "out": {
|
"name": {"type": "string", "title": "节点名称"},
|
||||||
# "position": "right",
|
"description": {"type": "string", "title": "节点描述"}
|
||||||
# "attrs": {
|
},
|
||||||
# "circle": {
|
"required": ["code", "name"]
|
||||||
# "r": 4,
|
}',
|
||||||
# "fill": "#ffffff",
|
'{}',
|
||||||
# "stroke": "#1890ff"
|
'{"formItems": []}',
|
||||||
# }
|
1,
|
||||||
# }
|
NOW(), 'system', NOW(), 'system', 1, 0
|
||||||
# }
|
),
|
||||||
# }
|
-- 结束节点
|
||||||
# }
|
(
|
||||||
# }
|
'END_EVENT', 'END_EVENT', '结束节点', '工作流的终点', 'EVENT',
|
||||||
# }', 1);
|
'{
|
||||||
# INSERT INTO workflow_node_definition (id, create_time, create_by, update_time, update_by, type, name, description, category, graph_config, enabled)
|
"shape": "circle",
|
||||||
# VALUES
|
"size": {"width": 40, "height": 40},
|
||||||
# (2, NOW(),
|
"style": {
|
||||||
# 'system',
|
"fill": "#fff1f0",
|
||||||
# NOW(),
|
"stroke": "#ff4d4f",
|
||||||
# 'system', 'END_EVENT', '结束节点', '工作流的终点', 'EVENT', '{
|
"strokeWidth": 2,
|
||||||
# "code": "END_EVENT",
|
"icon": "stop",
|
||||||
# "name": "结束节点",
|
"iconColor": "#ff4d4f"
|
||||||
# "description": "工作流的终点",
|
},
|
||||||
# "details": {
|
"ports": {
|
||||||
# "description": "标记流程的结束位置,可以定义流程结束时的清理操作和设置返回值",
|
"groups": {
|
||||||
# "features": ["标记流程的结束位置", "定义结束时清理操作", "设置流程结果和返回值"],
|
"in": {
|
||||||
# "scenarios": ["流程正常结束", "流程异常终止", "需要返回处理结果"]
|
"position": "left",
|
||||||
# },
|
"attrs": {
|
||||||
# "configSchema": {
|
"circle": {"r": 4, "fill": "#ffffff", "stroke": "#1890ff"}
|
||||||
# "type": "object",
|
}
|
||||||
# "properties": {
|
}
|
||||||
# "code": {"type": "string", "title": "节点Code", "description": "工作流节点的Code"},
|
}
|
||||||
# "name": {"type": "string", "title": "节点名称", "description": "工作流节点的显示名称"},
|
}
|
||||||
# "description": {"type": "string", "title": "节点描述", "description": "工作流节点的详细描述"}
|
}',
|
||||||
# },
|
'{
|
||||||
# "required": ["code", "name"]
|
"type": "object",
|
||||||
# },
|
"properties": {
|
||||||
# "uiSchema": {
|
"code": {"type": "string", "title": "节点Code"},
|
||||||
# "shape": "circle",
|
"name": {"type": "string", "title": "节点名称"},
|
||||||
# "size": {"width": 40, "height": 40},
|
"description": {"type": "string", "title": "节点描述"}
|
||||||
# "style": {
|
},
|
||||||
# "fill": "#fff1f0",
|
"required": ["code", "name"]
|
||||||
# "stroke": "#ff4d4f",
|
}',
|
||||||
# "strokeWidth": 2,
|
'{}',
|
||||||
# "icon": "stop",
|
'{"formItems": []}',
|
||||||
# "iconColor": "#ff4d4f"
|
1,
|
||||||
# },
|
NOW(), 'system', NOW(), 'system', 1, 0
|
||||||
# "ports": {
|
),
|
||||||
# "groups": {
|
-- 脚本任务节点
|
||||||
# "in": {
|
(
|
||||||
# "position": "left",
|
'SCRIPT_TASK', 'SCRIPT_TASK', '脚本任务', '脚本执行任务', 'TASK',
|
||||||
# "attrs": {
|
'{
|
||||||
# "circle": {
|
"shape": "rect",
|
||||||
# "r": 4,
|
"size": {"width": 120, "height": 60},
|
||||||
# "fill": "#ffffff",
|
"style": {
|
||||||
# "stroke": "#1890ff"
|
"fill": "#ffffff",
|
||||||
# }
|
"stroke": "#1890ff",
|
||||||
# }
|
"strokeWidth": 2,
|
||||||
# }
|
"icon": "code",
|
||||||
# }
|
"iconColor": "#1890ff"
|
||||||
# }
|
},
|
||||||
# }
|
"ports": {
|
||||||
# }', 1);
|
"groups": {
|
||||||
#
|
"in": {
|
||||||
# INSERT INTO workflow_node_definition (id, create_time, create_by, update_time, update_by, type, name, description, category, graph_config, enabled)
|
"position": "left",
|
||||||
# VALUES
|
"attrs": {
|
||||||
# (5, NOW(),
|
"circle": {"r": 4, "fill": "#ffffff", "stroke": "#1890ff"}
|
||||||
# 'system',
|
}
|
||||||
# NOW(),
|
},
|
||||||
# 'system', 'SCRIPT_TASK', '脚本任务', '脚本执行任务', 'TASK', '{
|
"out": {
|
||||||
# "code": "SCRIPT_TASK",
|
"position": "right",
|
||||||
# "name": "脚本任务",
|
"attrs": {
|
||||||
# "details": {
|
"circle": {"r": 4, "fill": "#ffffff", "stroke": "#1890ff"}
|
||||||
# "description": "脚本执行任务",
|
}
|
||||||
# "features": [],
|
}
|
||||||
# "scenarios": []
|
}
|
||||||
# },
|
}
|
||||||
# "configSchema": {
|
}',
|
||||||
# "type": "object",
|
'{
|
||||||
# "properties": {
|
"type": "object",
|
||||||
# "code": {
|
"properties": {
|
||||||
# "type": "string",
|
"code": {"type": "string", "title": "节点Code"},
|
||||||
# "title": "节点Code",
|
"name": {"type": "string", "title": "节点名称"},
|
||||||
# "description": "工作流节点的Code"
|
"description": {"type": "string", "title": "节点描述"},
|
||||||
# },
|
"script": {
|
||||||
# "name": {
|
"type": "string",
|
||||||
# "type": "string",
|
"title": "脚本内容",
|
||||||
# "title": "节点名称",
|
"format": "textarea",
|
||||||
# "description": "工作流节点的显示名称"
|
"description": "需要执行的脚本内容"
|
||||||
# },
|
},
|
||||||
# "description": {
|
"language": {
|
||||||
# "type": "string",
|
"type": "string",
|
||||||
# "title": "节点描述",
|
"title": "脚本语言",
|
||||||
# "description": "工作流节点的详细描述"
|
"default": "shell",
|
||||||
# },
|
"enum": ["shell", "python", "javascript"],
|
||||||
# "script": {
|
"enumNames": ["Shell脚本", "Python脚本", "JavaScript脚本"]
|
||||||
# "type": "string",
|
},
|
||||||
# "title": "脚本内容",
|
"interpreter": {
|
||||||
# "description": "需要执行的脚本内容,例如:\\n#!/bin/bash\\necho \\\"开始执行脚本\\\"\\nls -la\\necho \\\"脚本执行完成\\\"",
|
"type": "string",
|
||||||
# "format": "textarea"
|
"title": "解释器路径",
|
||||||
# },
|
"description": "脚本解释器的路径,例如:/bin/bash"
|
||||||
# "language": {
|
},
|
||||||
# "type": "string",
|
"workingDirectory": {
|
||||||
# "title": "脚本语言",
|
"type": "string",
|
||||||
# "description": "脚本语言类型",
|
"title": "工作目录",
|
||||||
# "default": "shell",
|
"default": "/tmp"
|
||||||
# "enum": [
|
},
|
||||||
# "shell",
|
"delegate": {
|
||||||
# "python",
|
"type": "string",
|
||||||
# "javascript",
|
"title": "执行委派者",
|
||||||
# "groovy"
|
"default": "${shellTaskDelegate}"
|
||||||
# ],
|
}
|
||||||
# "enumNames": [
|
},
|
||||||
# "Shell脚本 (已支持)",
|
"required": ["code", "name", "script", "language", "delegate"]
|
||||||
# "Python脚本 (开发中)",
|
}',
|
||||||
# "JavaScript脚本 (开发中)",
|
'{
|
||||||
# "Groovy脚本 (开发中)"
|
"environment": {"type": "object", "additionalProperties": {"type": "string"}}
|
||||||
# ]
|
}',
|
||||||
# },
|
'{"formItems": []}',
|
||||||
# "interpreter": {
|
1,
|
||||||
# "type": "string",
|
NOW(), 'system', NOW(), 'system', 1, 0
|
||||||
# "title": "解释器路径",
|
);
|
||||||
# "description": "脚本解释器的路径,例如:/bin/bash, /usr/bin/python3"
|
|
||||||
# },
|
|
||||||
# "workingDirectory": {
|
|
||||||
# "type": "string",
|
|
||||||
# "title": "工作目录",
|
|
||||||
# "description": "脚本执行的工作目录",
|
|
||||||
# "default": "/tmp"
|
|
||||||
# },
|
|
||||||
# "environment": {
|
|
||||||
# "type": "object",
|
|
||||||
# "title": "环境变量",
|
|
||||||
# "description": "脚本执行时的环境变量",
|
|
||||||
# "additionalProperties": {
|
|
||||||
# "type": "string"
|
|
||||||
# }
|
|
||||||
# },
|
|
||||||
# "successExitCode": {
|
|
||||||
# "type": "integer",
|
|
||||||
# "title": "成功退出码",
|
|
||||||
# "description": "脚本执行成功时的退出码",
|
|
||||||
# "default": 0
|
|
||||||
# },
|
|
||||||
# "supportedLanguages": {
|
|
||||||
# "type": "array",
|
|
||||||
# "title": "支持的脚本语言",
|
|
||||||
# "enum": [
|
|
||||||
# "shell",
|
|
||||||
# "python",
|
|
||||||
# "javascript",
|
|
||||||
# "groovy"
|
|
||||||
# ],
|
|
||||||
# "items": {
|
|
||||||
# "type": "string"
|
|
||||||
# }
|
|
||||||
# },
|
|
||||||
# "delegate": {
|
|
||||||
# "type": "string",
|
|
||||||
# "title": "执行委派者",
|
|
||||||
# "description": "执行委派者",
|
|
||||||
# "default": "${shellTaskDelegate}"
|
|
||||||
# }
|
|
||||||
# },
|
|
||||||
# "required": [
|
|
||||||
# "code",
|
|
||||||
# "name",
|
|
||||||
# "script",
|
|
||||||
# "language",
|
|
||||||
# "interpreter",
|
|
||||||
# "delegate"
|
|
||||||
# ]
|
|
||||||
# },
|
|
||||||
# "uiSchema": {
|
|
||||||
# "shape": "rect",
|
|
||||||
# "size": {
|
|
||||||
# "width": 120,
|
|
||||||
# "height": 60
|
|
||||||
# },
|
|
||||||
# "style": {
|
|
||||||
# "fill": "#ffffff",
|
|
||||||
# "stroke": "#1890ff",
|
|
||||||
# "strokeWidth": 2,
|
|
||||||
# "icon": "code",
|
|
||||||
# "iconColor": "#1890ff"
|
|
||||||
# },
|
|
||||||
# "ports": {
|
|
||||||
# "groups": {
|
|
||||||
# "in": {
|
|
||||||
# "position": "left",
|
|
||||||
# "attrs": {
|
|
||||||
# "circle": {
|
|
||||||
# "r": 4,
|
|
||||||
# "fill": "#ffffff",
|
|
||||||
# "stroke": "#1890ff"
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# },
|
|
||||||
# "out": {
|
|
||||||
# "position": "right",
|
|
||||||
# "attrs": {
|
|
||||||
# "circle": {
|
|
||||||
# "r": 4,
|
|
||||||
# "fill": "#ffffff",
|
|
||||||
# "stroke": "#1890ff"
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# }', 1);
|
|
||||||
|
|
||||||
-- --------------------------------------------------------------------------------------
|
-- --------------------------------------------------------------------------------------
|
||||||
-- 初始化项目管理数据
|
-- 初始化项目管理数据
|
||||||
|
|||||||
155
backend/workflow_node_definition_fix.sql
Normal file
155
backend/workflow_node_definition_fix.sql
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
-- =====================================================
|
||||||
|
-- 修复 workflow_node_definition 表的初始化数据
|
||||||
|
-- =====================================================
|
||||||
|
|
||||||
|
-- 删除注释,添加正确的节点定义数据
|
||||||
|
INSERT INTO workflow_node_definition (
|
||||||
|
node_type, node_code, node_name, description, category,
|
||||||
|
ui_variables, panel_variables_schema, local_variables_schema,
|
||||||
|
form_variables_schema, enabled,
|
||||||
|
create_time, create_by, update_time, update_by, version, deleted
|
||||||
|
) VALUES
|
||||||
|
-- 开始节点
|
||||||
|
(
|
||||||
|
'START_EVENT', 'START_EVENT', '开始节点', '工作流的起点', 'EVENT',
|
||||||
|
'{
|
||||||
|
"shape": "circle",
|
||||||
|
"size": {"width": 40, "height": 40},
|
||||||
|
"style": {
|
||||||
|
"fill": "#e8f7ff",
|
||||||
|
"stroke": "#1890ff",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"icon": "play-circle",
|
||||||
|
"iconColor": "#1890ff"
|
||||||
|
},
|
||||||
|
"ports": {
|
||||||
|
"groups": {
|
||||||
|
"out": {
|
||||||
|
"position": "right",
|
||||||
|
"attrs": {
|
||||||
|
"circle": {"r": 4, "fill": "#ffffff", "stroke": "#1890ff"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}',
|
||||||
|
'{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"code": {"type": "string", "title": "节点Code"},
|
||||||
|
"name": {"type": "string", "title": "节点名称"},
|
||||||
|
"description": {"type": "string", "title": "节点描述"}
|
||||||
|
},
|
||||||
|
"required": ["code", "name"]
|
||||||
|
}',
|
||||||
|
'{}',
|
||||||
|
'{"formItems": []}',
|
||||||
|
1,
|
||||||
|
NOW(), 'system', NOW(), 'system', 1, 0
|
||||||
|
),
|
||||||
|
-- 结束节点
|
||||||
|
(
|
||||||
|
'END_EVENT', 'END_EVENT', '结束节点', '工作流的终点', 'EVENT',
|
||||||
|
'{
|
||||||
|
"shape": "circle",
|
||||||
|
"size": {"width": 40, "height": 40},
|
||||||
|
"style": {
|
||||||
|
"fill": "#fff1f0",
|
||||||
|
"stroke": "#ff4d4f",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"icon": "stop",
|
||||||
|
"iconColor": "#ff4d4f"
|
||||||
|
},
|
||||||
|
"ports": {
|
||||||
|
"groups": {
|
||||||
|
"in": {
|
||||||
|
"position": "left",
|
||||||
|
"attrs": {
|
||||||
|
"circle": {"r": 4, "fill": "#ffffff", "stroke": "#1890ff"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}',
|
||||||
|
'{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"code": {"type": "string", "title": "节点Code"},
|
||||||
|
"name": {"type": "string", "title": "节点名称"},
|
||||||
|
"description": {"type": "string", "title": "节点描述"}
|
||||||
|
},
|
||||||
|
"required": ["code", "name"]
|
||||||
|
}',
|
||||||
|
'{}',
|
||||||
|
'{"formItems": []}',
|
||||||
|
1,
|
||||||
|
NOW(), 'system', NOW(), 'system', 1, 0
|
||||||
|
),
|
||||||
|
-- 脚本任务节点
|
||||||
|
(
|
||||||
|
'SCRIPT_TASK', 'SCRIPT_TASK', '脚本任务', '脚本执行任务', 'TASK',
|
||||||
|
'{
|
||||||
|
"shape": "rect",
|
||||||
|
"size": {"width": 120, "height": 60},
|
||||||
|
"style": {
|
||||||
|
"fill": "#ffffff",
|
||||||
|
"stroke": "#1890ff",
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"icon": "code",
|
||||||
|
"iconColor": "#1890ff"
|
||||||
|
},
|
||||||
|
"ports": {
|
||||||
|
"groups": {
|
||||||
|
"in": {
|
||||||
|
"position": "left",
|
||||||
|
"attrs": {
|
||||||
|
"circle": {"r": 4, "fill": "#ffffff", "stroke": "#1890ff"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"out": {
|
||||||
|
"position": "right",
|
||||||
|
"attrs": {
|
||||||
|
"circle": {"r": 4, "fill": "#ffffff", "stroke": "#1890ff"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}',
|
||||||
|
'{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"code": {"type": "string", "title": "节点Code"},
|
||||||
|
"name": {"type": "string", "title": "节点名称"},
|
||||||
|
"description": {"type": "string", "title": "节点描述"},
|
||||||
|
"script": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "脚本内容",
|
||||||
|
"format": "textarea"
|
||||||
|
},
|
||||||
|
"language": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "脚本语言",
|
||||||
|
"default": "shell",
|
||||||
|
"enum": ["shell", "python", "javascript"],
|
||||||
|
"enumNames": ["Shell脚本", "Python脚本", "JavaScript脚本"]
|
||||||
|
},
|
||||||
|
"workingDirectory": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "工作目录",
|
||||||
|
"default": "/tmp"
|
||||||
|
},
|
||||||
|
"delegate": {
|
||||||
|
"type": "string",
|
||||||
|
"title": "执行委派者",
|
||||||
|
"default": "${shellTaskDelegate}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["code", "name", "script", "language", "delegate"]
|
||||||
|
}',
|
||||||
|
'{
|
||||||
|
"environment": {"type": "object", "additionalProperties": {"type": "string"}}
|
||||||
|
}',
|
||||||
|
'{"formItems": []}',
|
||||||
|
1,
|
||||||
|
NOW(), 'system', NOW(), 'system', 1, 0
|
||||||
|
);
|
||||||
Loading…
Reference in New Issue
Block a user