diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java index 502511753b..5910ea1700 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.simple; import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.module.bpm.enums.definition.*; import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.Valid; @@ -79,12 +78,6 @@ public class BpmSimpleModelNodeVO { @Schema(description = "操作按钮设置", example = "[]") private List buttonsSetting; // 用于审批节点 - // TODO @jason:看看是不是可以简化;@芋艿: 暂时先放着。不知道后面是否会用到 - /** - * 附加节点 Id, 该节点不从前端传入。 由程序生成. 由于当个节点无法完成功能。 需要附加节点来完成。 - */ - @JsonIgnore - private String attachNodeId; /** * 审批节点拒绝处理 */ diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java index ec440cf08e..0069bdb295 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java @@ -68,7 +68,7 @@ public class SimpleModelUtils { EndEvent endEvent = BpmnModelUtils.getEndEvent(bpmnModel); traverseNodeToBuildSequenceFlow(process, startNode, endEvent.getId()); - // 3. 自动布局 + // 4. 自动布局 new BpmnAutoLayout(bpmnModel).execute(); return bpmnModel; } @@ -146,30 +146,16 @@ public class SimpleModelUtils { */ private static void traverseNormalNodeToBuildSequenceFlow(Process process, BpmSimpleModelNodeVO node, String targetNodeId) { BpmSimpleModelNodeVO childNode = node.getChildNode(); + boolean isChildNodeValid = isValidNode(childNode); // 情况一:有“子”节点,则建立连线 - if (isValidNode(childNode)) { - // TODO @jason:attachNodeId 是不是可以删除啦 - if (StrUtil.isNotEmpty(node.getAttachNodeId())) { - // 2.1.1.2 如果有附加节点. 需要先建立和附加节点的连线。再建立附加节点和目标节点的连线 - List sequenceFlows = buildAttachNodeSequenceFlow(node.getId(), node.getAttachNodeId(), childNode.getId()); - sequenceFlows.forEach(process::addFlowElement); - } else { - SequenceFlow sequenceFlow = buildBpmnSequenceFlow(node.getId(), childNode.getId()); - process.addFlowElement(sequenceFlow); - } + // 情况二:没有“子节点”,则直接跟 targetNodeId 建立连线。例如说,结束节点、条件分支(分支节点的孩子节点或聚合节点)的最后一个节点 + String finalTargetNodeId = isChildNodeValid? childNode.getId() : targetNodeId; + SequenceFlow sequenceFlow = buildBpmnSequenceFlow(node.getId(), finalTargetNodeId); + process.addFlowElement(sequenceFlow); - // 因为有子节点,递归调用后续子节点 + // 因为有子节点,递归调用后续子节点 + if (isChildNodeValid) { traverseNodeToBuildSequenceFlow(process, childNode, targetNodeId); - } else { - // 情况二:没有“子节点”,则直接跟 targetNodeId 建立连线。例如说,结束节点、条件分支(分支节点的孩子节点或聚合节点)的最后一个节点 - // TODO @jason:attachNodeId 是不是可以删除啦 - if (StrUtil.isNotEmpty(node.getAttachNodeId())) { - List sequenceFlows = buildAttachNodeSequenceFlow(node.getId(), node.getAttachNodeId(), targetNodeId); - sequenceFlows.forEach(process::addFlowElement); - } else { - SequenceFlow sequenceFlow = buildBpmnSequenceFlow(node.getId(), targetNodeId); - process.addFlowElement(sequenceFlow); - } } } @@ -230,19 +216,6 @@ public class SimpleModelUtils { traverseNodeToBuildSequenceFlow(process, childNode, targetNodeId); } - /** - * 构建有附加节点的连线 - * - * @param nodeId 当前节点 Id - * @param attachNodeId 附属节点 Id - * @param targetNodeId 目标节点 Id - */ - private static List buildAttachNodeSequenceFlow(String nodeId, String attachNodeId, String targetNodeId) { - SequenceFlow sequenceFlow = buildBpmnSequenceFlow(nodeId, attachNodeId, null, null, null); - SequenceFlow attachSequenceFlow = buildBpmnSequenceFlow(attachNodeId, targetNodeId, null, null, null); - return CollUtil.newArrayList(sequenceFlow, attachSequenceFlow); - } - private static SequenceFlow buildBpmnSequenceFlow(String sourceId, String targetId) { return buildBpmnSequenceFlow(sourceId, targetId, null, null, null); }