修改工作流数据结构。

This commit is contained in:
dengqichen 2024-12-11 17:26:46 +08:00
parent 40e2aba12c
commit b5861a1bfe

View File

@ -203,94 +203,221 @@ name="复杂业务流程" isExecutable="true"><startEvent id="start1" name="开
-- 初始化工作流节点定义数据 -- 初始化工作流节点定义数据
-- -------------------------------------------------------------------------------------- -- --------------------------------------------------------------------------------------
-- Shell任务节点定义 -- 事件节点
INSERT INTO workflow_node_definition (id, create_time, create_by, update_time, update_by, type, name, description, category, flowable_config, graph_config, form_config, order_num, enabled) INSERT INTO workflow_node_definition (type, name, description, category, flowable_config, graph_config, form_config, order_num, enabled, create_time, create_by, update_time, update_by, version, deleted)
VALUES ( VALUES
1, -- 开始事件
NOW(), ('startEvent', '开始事件', '流程的开始节点', 'EVENT',
'system', '{}',
NOW(), '{
'system', "shape": "circle",
'shell', "width": 40,
'Shell脚本', "height": 40,
'Shell脚本执行节点用于执行Shell命令或脚本', "ports": {
'TASK', "groups": {
'{ "top": {"position": "top", "attrs": {"circle": {"r": 4, "magnet": true}}},
"type": "object", "right": {"position": "right", "attrs": {"circle": {"r": 4, "magnet": true}}},
"required": ["type", "implementation", "fields"], "bottom": {"position": "bottom", "attrs": {"circle": {"r": 4, "magnet": true}}},
"properties": { "left": {"position": "left", "attrs": {"circle": {"r": 4, "magnet": true}}}
"type": {
"type": "string",
"enum": ["shell"],
"description": "任务类型"
},
"implementation": {
"type": "string",
"const": "$${shellTaskDelegate}",
"description": "任务实现类"
},
"fields": {
"type": "object",
"required": ["script", "workDir"],
"properties": {
"script": {
"type": "string",
"description": "要执行的Shell脚本内容"
},
"workDir": {
"type": "string",
"description": "脚本执行的工作目录"
},
"env": {
"type": "object",
"description": "环境变量",
"additionalProperties": {
"type": "string"
}
}
}
}
} }
}', },
'{ "attrs": {
"type": "object", "body": {"fill": "#ffffff", "stroke": "#333333", "strokeWidth": 2},
"required": ["shape"], "label": {"text": "开始", "fill": "#333333"}
"properties": { }
"shape": { }',
"type": "string", '{
"const": "serviceTask", "properties": [
"description": "节点形状" {"name": "id", "label": "节点标识", "type": "string", "required": true},
} {"name": "name", "label": "节点名称", "type": "string", "required": true}
]
}',
10, true, NOW(), 'system', NOW(), 'system', 1, false),
-- 结束事件
('endEvent', '结束事件', '流程的结束节点', 'EVENT',
'{}',
'{
"shape": "circle",
"width": 40,
"height": 40,
"ports": {
"groups": {
"top": {"position": "top", "attrs": {"circle": {"r": 4, "magnet": true}}},
"right": {"position": "right", "attrs": {"circle": {"r": 4, "magnet": true}}},
"bottom": {"position": "bottom", "attrs": {"circle": {"r": 4, "magnet": true}}},
"left": {"position": "left", "attrs": {"circle": {"r": 4, "magnet": true}}}
} }
}', },
'{ "attrs": {
"type": "object", "body": {"fill": "#ffffff", "stroke": "#333333", "strokeWidth": 4},
"required": ["items"], "label": {"text": "结束", "fill": "#333333"}
"properties": { }
"items": { }',
"type": "array", '{
"items": { "properties": [
"type": "object", {"name": "id", "label": "节点标识", "type": "string", "required": true},
"required": ["id", "type", "label"], {"name": "name", "label": "节点名称", "type": "string", "required": true}
"properties": { ]
"id": { }',
"type": "string" 20, true, NOW(), 'system', NOW(), 'system', 1, false),
},
"type": { -- 任务节点
"type": "string", -- 用户任务
"enum": ["input", "textarea", "select"] ('userTask', '用户任务', '需要人工处理的任务节点', 'TASK',
}, '{
"label": { "assignee": "$${assignee}",
"type": "string" "candidateUsers": "$${candidateUsers}",
}, "candidateGroups": "$${candidateGroups}"
"required": { }',
"type": "boolean" '{
} "shape": "rect",
} "width": 120,
} "height": 60,
} "ports": {
"groups": {
"top": {"position": "top", "attrs": {"circle": {"r": 4, "magnet": true}}},
"right": {"position": "right", "attrs": {"circle": {"r": 4, "magnet": true}}},
"bottom": {"position": "bottom", "attrs": {"circle": {"r": 4, "magnet": true}}},
"left": {"position": "left", "attrs": {"circle": {"r": 4, "magnet": true}}}
} }
}', },
10, "attrs": {
TRUE "body": {"fill": "#ffffff", "stroke": "#333333", "strokeWidth": 2},
); "label": {"text": "用户任务", "fill": "#333333"}
}
}',
'{
"properties": [
{"name": "id", "label": "节点标识", "type": "string", "required": true},
{"name": "name", "label": "节点名称", "type": "string", "required": true},
{"name": "assignee", "label": "处理人", "type": "string"},
{"name": "candidateUsers", "label": "候选用户", "type": "string"},
{"name": "candidateGroups", "label": "候选组", "type": "string"},
{"name": "dueDate", "label": "到期时间", "type": "date"}
]
}',
30, true, NOW(), 'system', NOW(), 'system', 1, false),
-- 服务任务
('serviceTask', '服务任务', '自动执行的系统服务任务', 'TASK',
'{
"class": "com.example.ServiceTaskDelegate"
}',
'{
"shape": "rect",
"width": 120,
"height": 60,
"ports": {
"groups": {
"top": {"position": "top", "attrs": {"circle": {"r": 4, "magnet": true}}},
"right": {"position": "right", "attrs": {"circle": {"r": 4, "magnet": true}}},
"bottom": {"position": "bottom", "attrs": {"circle": {"r": 4, "magnet": true}}},
"left": {"position": "left", "attrs": {"circle": {"r": 4, "magnet": true}}}
}
},
"attrs": {
"body": {"fill": "#ffffff", "stroke": "#333333", "strokeWidth": 2},
"label": {"text": "服务任务", "fill": "#333333"}
}
}',
'{
"properties": [
{"name": "id", "label": "节点标识", "type": "string", "required": true},
{"name": "name", "label": "节点名称", "type": "string", "required": true},
{"name": "class", "label": "实现类", "type": "string", "required": true},
{"name": "async", "label": "异步执行", "type": "boolean"}
]
}',
40, true, NOW(), 'system', NOW(), 'system', 1, false),
-- Shell任务
('shellTask', 'Shell任务', '执行Shell命令或脚本的任务节点', 'TASK',
'{
"class": "com.qqchen.deploy.backend.workflow.delegate.ShellTaskDelegate"
}',
'{
"shape": "rect",
"width": 120,
"height": 60,
"ports": {
"groups": {
"top": {"position": "top", "attrs": {"circle": {"r": 4, "magnet": true}}},
"right": {"position": "right", "attrs": {"circle": {"r": 4, "magnet": true}}},
"bottom": {"position": "bottom", "attrs": {"circle": {"r": 4, "magnet": true}}},
"left": {"position": "left", "attrs": {"circle": {"r": 4, "magnet": true}}}
}
},
"attrs": {
"body": {"fill": "#ffffff", "stroke": "#333333", "strokeWidth": 2},
"label": {"text": "Shell任务", "fill": "#333333"}
}
}',
'{
"properties": [
{"name": "id", "label": "节点标识", "type": "string", "required": true},
{"name": "name", "label": "节点名称", "type": "string", "required": true},
{"name": "script", "label": "脚本内容", "type": "textarea", "required": true},
{"name": "workDir", "label": "工作目录", "type": "string", "required": true},
{"name": "async", "label": "异步执行", "type": "boolean"}
]
}',
50, true, NOW(), 'system', NOW(), 'system', 1, false),
-- 网关节点
-- 排他网关
('exclusiveGateway', '排他网关', '基于条件的分支网关,只会选择一个分支执行', 'GATEWAY',
'{}',
'{
"shape": "diamond",
"width": 60,
"height": 60,
"ports": {
"groups": {
"top": {"position": "top", "attrs": {"circle": {"r": 4, "magnet": true}}},
"right": {"position": "right", "attrs": {"circle": {"r": 4, "magnet": true}}},
"bottom": {"position": "bottom", "attrs": {"circle": {"r": 4, "magnet": true}}},
"left": {"position": "left", "attrs": {"circle": {"r": 4, "magnet": true}}}
}
},
"attrs": {
"body": {"fill": "#ffffff", "stroke": "#333333", "strokeWidth": 2},
"label": {"text": "×", "fill": "#333333", "fontSize": 40}
}
}',
'{
"properties": [
{"name": "id", "label": "节点标识", "type": "string", "required": true},
{"name": "name", "label": "网关名称", "type": "string", "required": true},
{"name": "defaultFlow", "label": "默认路径", "type": "string"}
]
}',
60, true, NOW(), 'system', NOW(), 'system', 1, false),
-- 并行网关
('parallelGateway', '并行网关', '并行执行所有分支', 'GATEWAY',
'{}',
'{
"shape": "diamond",
"width": 60,
"height": 60,
"ports": {
"groups": {
"top": {"position": "top", "attrs": {"circle": {"r": 4, "magnet": true}}},
"right": {"position": "right", "attrs": {"circle": {"r": 4, "magnet": true}}},
"bottom": {"position": "bottom", "attrs": {"circle": {"r": 4, "magnet": true}}},
"left": {"position": "left", "attrs": {"circle": {"r": 4, "magnet": true}}}
}
},
"attrs": {
"body": {"fill": "#ffffff", "stroke": "#333333", "strokeWidth": 2},
"label": {"text": "+", "fill": "#333333", "fontSize": 40}
}
}',
'{
"properties": [
{"name": "id", "label": "节点标识", "type": "string", "required": true},
{"name": "name", "label": "网关名称", "type": "string", "required": true}
]
}',
70, true, NOW(), 'system', NOW(), 'system', 1, false);