From df936deecaf6bc1db9d40d0ae1c8dec84524bd08 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Sun, 7 Apr 2024 15:37:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BF=E9=92=89=E9=92=89=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1-=E5=B9=B6=E8=A1=8C=E7=BD=91=E5=85=B3?= =?UTF-8?q?=E7=9A=84=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enums/definition/BpmSimpleModelNodeType.java | 7 +++++-- .../flowable/core/util/BpmnModelUtils.java | 14 +++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmSimpleModelNodeType.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmSimpleModelNodeType.java index 4e26d02d9..af8ce3d6f 100644 --- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmSimpleModelNodeType.java +++ b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmSimpleModelNodeType.java @@ -19,10 +19,12 @@ public enum BpmSimpleModelNodeType implements IntArrayValuable { // TODO @jaosn:-1、0、1、4、-2 是前端已经定义好的么?感觉未来可以考虑搞成和 BPMN 尽量一致的单词哈;类似 usertask 用户审批; START_EVENT_NODE(0, "开始节点"), - APPROVE_USER_NODE (1, "审批人节点"), + APPROVE_USER_NODE(1, "审批人节点"), // 抄送人节点、对应 BPMN 的 ScriptTask. 使用ScriptTask 原因。好像 ServiceTask 自定义属性不能写入 XML SCRIPT_TASK_NODE(2, "抄送人节点"), EXCLUSIVE_GATEWAY_NODE(4, "排他网关"), + PARALLEL_GATEWAY_FORK_NODE(5, "并行网关分叉节点"), + PARALLEL_GATEWAY_JOIN_NODE(6, "并行网关聚合节点"), END_EVENT_NODE(-2, "结束节点"); public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmSimpleModelNodeType::getType).toArray(); @@ -32,7 +34,8 @@ public enum BpmSimpleModelNodeType implements IntArrayValuable { public static boolean isGatewayNode(Integer type) { // TODO 后续增加并行网关的支持 - return Objects.equals(EXCLUSIVE_GATEWAY_NODE.getType(), type); + return Objects.equals(EXCLUSIVE_GATEWAY_NODE.getType(), type) + || Objects.equals(PARALLEL_GATEWAY_FORK_NODE.getType(), type); } public static BpmSimpleModelNodeType valueOf(Integer type) { diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java index 03745adce..c68908acf 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java @@ -385,12 +385,14 @@ public class BpmnModelUtils { switch (nodeType) { case START_EVENT_NODE: case APPROVE_USER_NODE: - case SCRIPT_TASK_NODE: { + case SCRIPT_TASK_NODE: + case PARALLEL_GATEWAY_JOIN_NODE:{ addBpmnSequenceFlowElement(mainProcess, node.getId(), childNode.getId(), null, null); // 递归调用后续节点 addBpmnSequenceFlow(mainProcess, childNode, endId); break; } + case PARALLEL_GATEWAY_FORK_NODE: case EXCLUSIVE_GATEWAY_NODE: { String gateWayEndId = (childNode == null || childNode.getId() == null) ? BpmnModelConstants.END_EVENT_ID : childNode.getId(); List conditionNodes = node.getConditionNodes(); @@ -449,6 +451,10 @@ public class BpmnModelUtils { case EXCLUSIVE_GATEWAY_NODE: addBpmnExclusiveGatewayNode(mainProcess, simpleModelNode); break; + case PARALLEL_GATEWAY_FORK_NODE: + case PARALLEL_GATEWAY_JOIN_NODE: + addBpmnParallelGatewayNode(mainProcess, simpleModelNode); + break; default: { // TODO 其它节点类型的实现 } @@ -472,6 +478,12 @@ public class BpmnModelUtils { } } + private static void addBpmnParallelGatewayNode(Process mainProcess, BpmSimpleModelNodeVO node) { + ParallelGateway parallelGateway = new ParallelGateway(); + parallelGateway.setId(node.getId()); + mainProcess.addFlowElement(parallelGateway); + } + private static void addBpmnScriptTaSskNode(Process mainProcess, BpmSimpleModelNodeVO node) { ScriptTask scriptTask = new ScriptTask(); scriptTask.setId(node.getId());