增加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 JsonNode localVariablesSchema;
|
||||
|
||||
/**
|
||||
* 流程描述
|
||||
*/
|
||||
|
||||
@ -7,6 +7,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工作流边
|
||||
*
|
||||
* @author cascade
|
||||
* @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 lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工作流节点数据传输对象
|
||||
*
|
||||
@ -14,36 +16,20 @@ import lombok.Data;
|
||||
@Data
|
||||
public class WorkflowDefinitionGraphNode {
|
||||
|
||||
/**
|
||||
* 节点ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 节点Code
|
||||
*/
|
||||
private String nodeCode;
|
||||
|
||||
/**
|
||||
* 节点类型
|
||||
*/
|
||||
private NodeTypeEnums nodeType;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
private String nodeName;
|
||||
|
||||
@Schema(description = "节点UI")
|
||||
private JsonNode uiVariables;
|
||||
private Map<String, Object> position;
|
||||
|
||||
@Schema(description = "节点属性")
|
||||
private JsonNode panelVariables;
|
||||
private Map<String, String> configs;
|
||||
|
||||
@Schema(description = "节点环境变量")
|
||||
private JsonNode localVariables;
|
||||
private Map<String, String> inputMapping;
|
||||
|
||||
@Schema(description = "节点表单 JSON SCHEMA")
|
||||
private JsonNode formVariablesSchema;
|
||||
private Map<String, String> outputMapping;
|
||||
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ public class BpmnConverter {
|
||||
* 创建并初始化BPMN模型
|
||||
*
|
||||
* @param processKey 流程定义的唯一标识
|
||||
* @param bpmnModel BPMN模型对象
|
||||
* @param bpmnModel BPMN模型对象
|
||||
* @return 初始化后的Process对象
|
||||
*/
|
||||
private Process createAndInitializeBpmnModel(String processKey, BpmnModel bpmnModel) {
|
||||
@ -99,7 +99,7 @@ public class BpmnConverter {
|
||||
/**
|
||||
* 转换工作流节点为BPMN节点
|
||||
*
|
||||
* @param nodes 工作流定义节点列表
|
||||
* @param nodes 工作流定义节点列表
|
||||
* @param process 流程定义对象
|
||||
* @return 节点ID映射关系
|
||||
*/
|
||||
@ -119,8 +119,8 @@ public class BpmnConverter {
|
||||
/**
|
||||
* 转换单个工作流节点为BPMN节点
|
||||
*
|
||||
* @param node 工作流节点定义
|
||||
* @param process 流程定义对象
|
||||
* @param node 工作流节点定义
|
||||
* @param process 流程定义对象
|
||||
* @param idMapping 节点ID映射关系
|
||||
*/
|
||||
private void convertSingleNode(WorkflowDefinitionGraphNode node, Process process, Map<String, String> idMapping) {
|
||||
@ -225,17 +225,17 @@ public class BpmnConverter {
|
||||
/**
|
||||
* 配置服务任务节点
|
||||
*
|
||||
* @param serviceTask 服务任务节点
|
||||
* @param node 工作流节点定义
|
||||
* @param process 当前流程
|
||||
* @param serviceTask 服务任务节点
|
||||
* @param node 工作流节点定义
|
||||
* @param process 当前流程
|
||||
* @param extensionElements 扩展元素
|
||||
*/
|
||||
private void configureServiceTask(ServiceTask serviceTask, WorkflowDefinitionGraphNode node, Process process, Map<String, List<ExtensionElement>> extensionElements) {
|
||||
if (node.getPanelVariables() != null && node.getPanelVariables().has("delegate")) {
|
||||
String delegate = node.getPanelVariables().get("delegate").asText();
|
||||
serviceTask.setImplementationType("delegateExpression");
|
||||
serviceTask.setImplementation(delegate);
|
||||
}
|
||||
// if (node.getPanelVariables() != null && node.getPanelVariables().has("delegate")) {
|
||||
// String delegate = node.getPanelVariables().get("delegate").asText();
|
||||
// serviceTask.setImplementationType("delegateExpression");
|
||||
// serviceTask.setImplementation(delegate);
|
||||
// }
|
||||
|
||||
addExecutionVariables(extensionElements, node);
|
||||
addRetryStrategy(extensionElements);
|
||||
@ -246,7 +246,7 @@ public class BpmnConverter {
|
||||
/**
|
||||
* 创建扩展属性
|
||||
*
|
||||
* @param name 属性名
|
||||
* @param name 属性名
|
||||
* @param value 属性值
|
||||
* @return 扩展属性
|
||||
*/
|
||||
@ -261,35 +261,35 @@ public class BpmnConverter {
|
||||
* 添加执行实例级变量
|
||||
*
|
||||
* @param extensionElements 扩展元素
|
||||
* @param node 工作流节点定义
|
||||
* @param node 工作流节点定义
|
||||
*/
|
||||
private void addExecutionVariables(Map<String, List<ExtensionElement>> extensionElements, WorkflowDefinitionGraphNode node) {
|
||||
// 添加panelVariables变量
|
||||
if (node.getPanelVariables() != null) {
|
||||
ExtensionElement fieldElement = new ExtensionElement();
|
||||
fieldElement.setName("field");
|
||||
fieldElement.setNamespace("http://flowable.org/bpmn");
|
||||
fieldElement.setNamespacePrefix("flowable");
|
||||
|
||||
// 创建field的子元素string
|
||||
ExtensionElement stringElement = new ExtensionElement();
|
||||
stringElement.setName("string");
|
||||
stringElement.setNamespace("http://flowable.org/bpmn");
|
||||
stringElement.setNamespacePrefix("flowable");
|
||||
// 直接设置JSON内容,不使用CDATA
|
||||
stringElement.setElementText(node.getPanelVariables().toString());
|
||||
|
||||
// 设置field的name属性
|
||||
Map<String, List<ExtensionAttribute>> fieldAttributes = new HashMap<>();
|
||||
fieldAttributes.put("name", Collections.singletonList(createAttribute("name", "panelVariables")));
|
||||
fieldElement.setAttributes(fieldAttributes);
|
||||
|
||||
// 添加string子元素到field
|
||||
fieldElement.addChildElement(stringElement);
|
||||
|
||||
// 添加field到extensionElements
|
||||
extensionElements.computeIfAbsent("field", k -> new ArrayList<>()).add(fieldElement);
|
||||
}
|
||||
// if (node.getPanelVariables() != null) {
|
||||
// ExtensionElement fieldElement = new ExtensionElement();
|
||||
// fieldElement.setName("field");
|
||||
// fieldElement.setNamespace("http://flowable.org/bpmn");
|
||||
// fieldElement.setNamespacePrefix("flowable");
|
||||
//
|
||||
// // 创建field的子元素string
|
||||
// ExtensionElement stringElement = new ExtensionElement();
|
||||
// stringElement.setName("string");
|
||||
// stringElement.setNamespace("http://flowable.org/bpmn");
|
||||
// stringElement.setNamespacePrefix("flowable");
|
||||
// // 直接设置JSON内容,不使用CDATA
|
||||
// stringElement.setElementText(node.getPanelVariables().toString());
|
||||
//
|
||||
// // 设置field的name属性
|
||||
// Map<String, List<ExtensionAttribute>> fieldAttributes = new HashMap<>();
|
||||
// fieldAttributes.put("name", Collections.singletonList(createAttribute("name", "panelVariables")));
|
||||
// fieldElement.setAttributes(fieldAttributes);
|
||||
//
|
||||
// // 添加string子元素到field
|
||||
// fieldElement.addChildElement(stringElement);
|
||||
//
|
||||
// // 添加field到extensionElements
|
||||
// extensionElements.computeIfAbsent("field", k -> new ArrayList<>()).add(fieldElement);
|
||||
// }
|
||||
|
||||
// 添加localVariables变量
|
||||
// if (node.getLocalVariables() != null) {
|
||||
@ -339,7 +339,7 @@ public class BpmnConverter {
|
||||
/**
|
||||
* 创建执行监听器扩展元素
|
||||
*
|
||||
* @param event 事件类型(start/end)
|
||||
* @param event 事件类型(start/end)
|
||||
* @param delegateExpression 委托表达式
|
||||
* @return 配置好的监听器扩展元素
|
||||
*/
|
||||
@ -372,8 +372,8 @@ public class BpmnConverter {
|
||||
* 为活动节点添加错误边界事件和错误结束事件
|
||||
* 当节点执行失败时,会触发错误边界事件,并流转到错误结束事件
|
||||
*
|
||||
* @param process BPMN流程定义
|
||||
* @param activity 需要添加错误处理的活动节点
|
||||
* @param process BPMN流程定义
|
||||
* @param activity 需要添加错误处理的活动节点
|
||||
*/
|
||||
private void addErrorBoundaryEventHandler(Process process, Activity activity) {
|
||||
BoundaryEvent boundaryEvent = createErrorBoundaryEvent(activity);
|
||||
@ -448,45 +448,46 @@ public class BpmnConverter {
|
||||
/**
|
||||
* 创建网关节点
|
||||
*
|
||||
* @param node 工作流节点定义
|
||||
* @param node 工作流节点定义
|
||||
* @param validId 有效的节点ID
|
||||
* @return 创建的网关节点
|
||||
*/
|
||||
private Gateway createGatewayElement(WorkflowDefinitionGraphNode node, String validId) {
|
||||
if (node.getPanelVariables() == null) {
|
||||
throw new IllegalArgumentException("Gateway node must have panel variables");
|
||||
}
|
||||
|
||||
String gatewayTypeCode = node.getPanelVariables().get("gatewayType").asText();
|
||||
GatewayTypeEnums gatewayType = GatewayTypeEnums.fromCode(gatewayTypeCode);
|
||||
|
||||
Gateway gateway;
|
||||
switch (gatewayType) {
|
||||
case EXCLUSIVE_GATEWAY:
|
||||
gateway = new ExclusiveGateway();
|
||||
break;
|
||||
case PARALLEL_GATEWAY:
|
||||
gateway = new ParallelGateway();
|
||||
break;
|
||||
case INCLUSIVE_GATEWAY:
|
||||
gateway = new InclusiveGateway();
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unsupported gateway type: " + gatewayType);
|
||||
}
|
||||
|
||||
gateway.setId(validId);
|
||||
gateway.setName(node.getNodeName());
|
||||
|
||||
return gateway;
|
||||
// if (node.getPanelVariables() == null) {
|
||||
// throw new IllegalArgumentException("Gateway node must have panel variables");
|
||||
// }
|
||||
//
|
||||
// String gatewayTypeCode = node.getPanelVariables().get("gatewayType").asText();
|
||||
// GatewayTypeEnums gatewayType = GatewayTypeEnums.fromCode(gatewayTypeCode);
|
||||
//
|
||||
// Gateway gateway;
|
||||
// switch (gatewayType) {
|
||||
// case EXCLUSIVE_GATEWAY:
|
||||
// gateway = new ExclusiveGateway();
|
||||
// break;
|
||||
// case PARALLEL_GATEWAY:
|
||||
// gateway = new ParallelGateway();
|
||||
// break;
|
||||
// case INCLUSIVE_GATEWAY:
|
||||
// gateway = new InclusiveGateway();
|
||||
// break;
|
||||
// default:
|
||||
// throw new IllegalArgumentException("Unsupported gateway type: " + gatewayType);
|
||||
// }
|
||||
//
|
||||
// gateway.setId(validId);
|
||||
// gateway.setName(node.getNodeName());
|
||||
//
|
||||
// return gateway;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换连线为顺序流
|
||||
*
|
||||
* @param edges 工作流定义边集合
|
||||
* @param edges 工作流定义边集合
|
||||
* @param idMapping 节点ID映射
|
||||
* @param process 流程定义
|
||||
* @param process 流程定义
|
||||
*/
|
||||
private void convertEdgesToSequenceFlows(List<WorkflowDefinitionGraphEdge> edges, Map<String, String> idMapping, Process process) {
|
||||
for (WorkflowDefinitionGraphEdge edge : edges) {
|
||||
|
||||
@ -2,9 +2,9 @@ server:
|
||||
port: 8080
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/deploy-ease-platform?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true&createDatabaseIfNotExist=true
|
||||
username: root
|
||||
password: root
|
||||
url: jdbc:mysql://172.22.222.111:3306/deploy-ease-platform?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true&createDatabaseIfNotExist=true
|
||||
username: deploy-ease-platform
|
||||
password: Qichen5210523
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
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
|
||||
# (1, NOW(),
|
||||
# 'system',
|
||||
# NOW(),
|
||||
# 'system', 'START_EVENT', '开始节点', '工作流的起点', 'EVENT', '{
|
||||
# "code": "START_EVENT",
|
||||
# "name": "开始节点",
|
||||
# "description": "工作流的起点",
|
||||
# "details": {
|
||||
# "description": "标记流程的开始位置,可以定义流程启动条件和初始化流程变量",
|
||||
# "features": ["标记流程的开始位置", "定义流程启动条件", "初始化流程变量"],
|
||||
# "scenarios": ["用户手动启动流程", "定时触发流程", "外部系统调用启动"]
|
||||
# },
|
||||
# "configSchema": {
|
||||
# "type": "object",
|
||||
# "properties": {
|
||||
# "code": {"type": "string", "title": "节点Code", "description": "工作流节点的Code"},
|
||||
# "name": {"type": "string", "title": "节点名称", "description": "工作流节点的显示名称"},
|
||||
# "description": {"type": "string", "title": "节点描述", "description": "工作流节点的详细描述"}
|
||||
# },
|
||||
# "required": ["code", "name"]
|
||||
# },
|
||||
# "uiSchema": {
|
||||
# "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"
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }', 1);
|
||||
# INSERT INTO workflow_node_definition (id, create_time, create_by, update_time, update_by, type, name, description, category, graph_config, enabled)
|
||||
# VALUES
|
||||
# (2, NOW(),
|
||||
# 'system',
|
||||
# NOW(),
|
||||
# 'system', 'END_EVENT', '结束节点', '工作流的终点', 'EVENT', '{
|
||||
# "code": "END_EVENT",
|
||||
# "name": "结束节点",
|
||||
# "description": "工作流的终点",
|
||||
# "details": {
|
||||
# "description": "标记流程的结束位置,可以定义流程结束时的清理操作和设置返回值",
|
||||
# "features": ["标记流程的结束位置", "定义结束时清理操作", "设置流程结果和返回值"],
|
||||
# "scenarios": ["流程正常结束", "流程异常终止", "需要返回处理结果"]
|
||||
# },
|
||||
# "configSchema": {
|
||||
# "type": "object",
|
||||
# "properties": {
|
||||
# "code": {"type": "string", "title": "节点Code", "description": "工作流节点的Code"},
|
||||
# "name": {"type": "string", "title": "节点名称", "description": "工作流节点的显示名称"},
|
||||
# "description": {"type": "string", "title": "节点描述", "description": "工作流节点的详细描述"}
|
||||
# },
|
||||
# "required": ["code", "name"]
|
||||
# },
|
||||
# "uiSchema": {
|
||||
# "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"
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# }', 1);
|
||||
#
|
||||
# INSERT INTO workflow_node_definition (id, create_time, create_by, update_time, update_by, type, name, description, category, graph_config, enabled)
|
||||
# VALUES
|
||||
# (5, NOW(),
|
||||
# 'system',
|
||||
# NOW(),
|
||||
# 'system', 'SCRIPT_TASK', '脚本任务', '脚本执行任务', 'TASK', '{
|
||||
# "code": "SCRIPT_TASK",
|
||||
# "name": "脚本任务",
|
||||
# "details": {
|
||||
# "description": "脚本执行任务",
|
||||
# "features": [],
|
||||
# "scenarios": []
|
||||
# },
|
||||
# "configSchema": {
|
||||
# "type": "object",
|
||||
# "properties": {
|
||||
# "code": {
|
||||
# "type": "string",
|
||||
# "title": "节点Code",
|
||||
# "description": "工作流节点的Code"
|
||||
# },
|
||||
# "name": {
|
||||
# "type": "string",
|
||||
# "title": "节点名称",
|
||||
# "description": "工作流节点的显示名称"
|
||||
# },
|
||||
# "description": {
|
||||
# "type": "string",
|
||||
# "title": "节点描述",
|
||||
# "description": "工作流节点的详细描述"
|
||||
# },
|
||||
# "script": {
|
||||
# "type": "string",
|
||||
# "title": "脚本内容",
|
||||
# "description": "需要执行的脚本内容,例如:\\n#!/bin/bash\\necho \\\"开始执行脚本\\\"\\nls -la\\necho \\\"脚本执行完成\\\"",
|
||||
# "format": "textarea"
|
||||
# },
|
||||
# "language": {
|
||||
# "type": "string",
|
||||
# "title": "脚本语言",
|
||||
# "description": "脚本语言类型",
|
||||
# "default": "shell",
|
||||
# "enum": [
|
||||
# "shell",
|
||||
# "python",
|
||||
# "javascript",
|
||||
# "groovy"
|
||||
# ],
|
||||
# "enumNames": [
|
||||
# "Shell脚本 (已支持)",
|
||||
# "Python脚本 (开发中)",
|
||||
# "JavaScript脚本 (开发中)",
|
||||
# "Groovy脚本 (开发中)"
|
||||
# ]
|
||||
# },
|
||||
# "interpreter": {
|
||||
# "type": "string",
|
||||
# "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);
|
||||
-- 初始化工作流节点定义数据
|
||||
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",
|
||||
"description": "需要执行的脚本内容"
|
||||
},
|
||||
"language": {
|
||||
"type": "string",
|
||||
"title": "脚本语言",
|
||||
"default": "shell",
|
||||
"enum": ["shell", "python", "javascript"],
|
||||
"enumNames": ["Shell脚本", "Python脚本", "JavaScript脚本"]
|
||||
},
|
||||
"interpreter": {
|
||||
"type": "string",
|
||||
"title": "解释器路径",
|
||||
"description": "脚本解释器的路径,例如:/bin/bash"
|
||||
},
|
||||
"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
|
||||
);
|
||||
|
||||
-- --------------------------------------------------------------------------------------
|
||||
-- 初始化项目管理数据
|
||||
|
||||
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