From 79047843dfe542b6015b042205444e311e5f97b8 Mon Sep 17 00:00:00 2001 From: wangli <274027703@qq.com> Date: Mon, 4 Dec 2023 20:23:09 +0800 Subject: [PATCH] =?UTF-8?q?update=20-=20=E8=B0=83=E6=95=B4=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=A8=A1=E5=9E=8B=E7=9A=84=E5=8F=82=E6=95=B0=E5=AE=9A?= =?UTF-8?q?=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/utils/BpmnJsonConverterUtil.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/common/utils/BpmnJsonConverterUtil.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/common/utils/BpmnJsonConverterUtil.java index 7a8722353..d91e8ddc2 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/common/utils/BpmnJsonConverterUtil.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/common/utils/BpmnJsonConverterUtil.java @@ -379,7 +379,7 @@ public final class BpmnJsonConverterUtil { * @return 创建的节点的 ID */ private static List create(BpmnJsonNode bpmnJsonNode, Process mainProcess, - BpmnModel bpmnModel, String... preNodeIds) { + BpmnModel bpmnModel, String... preNodeIds) { FLAT_NODE_MAP.put(bpmnJsonNode.getId(), bpmnJsonNode); // 设置来源节点 bpmnJsonNode.setIncoming(Lists.newArrayList(preNodeIds)); @@ -446,23 +446,26 @@ public final class BpmnJsonConverterUtil { // branch == node_condition BpmnJsonNode nextJsonNode = Objects.isNull(branch.getChildren()) ? bpmnJsonNode.getChildren() : branch.getChildren(); - nextJsonNode.setIncoming(Lists.newArrayList(gateway.getId())); + if (Objects.nonNull(nextJsonNode)) { - // 将 node_condition 放入计算节点的上级属性中,方便顺序流转换器对条件进行处理 - nextJsonNode.setPreJsonNode(branch); - SequenceFlow sequenceFlow = (SequenceFlow) convertJsonToElement(SequenceFlow.class, nextJsonNode, - mainProcess); - mainProcess.addFlowElement(sequenceFlow); + nextJsonNode.setIncoming(Lists.newArrayList(gateway.getId())); - // 设置网关默认流 - if (Objects.nonNull(branch.getProperty()) && Boolean.TRUE.equals(branch.getProperty().getDefaultBranch())) { - // 如果是默认流, 以防止前端输入错误, 强制置空 - sequenceFlow.setConditionExpression(null); - gateway.setDefaultFlow(sequenceFlow.getId()); - } + // 将 node_condition 放入计算节点的上级属性中,方便顺序流转换器对条件进行处理 + nextJsonNode.setPreJsonNode(branch); + SequenceFlow sequenceFlow = (SequenceFlow) convertJsonToElement(SequenceFlow.class, nextJsonNode, + mainProcess); + mainProcess.addFlowElement(sequenceFlow); - if (Objects.nonNull(branch.getChildren()) && StringUtils.hasLength(branch.getChildren().getId())) { - branchLastNodeIds.addAll(create(branch.getChildren(), mainProcess, bpmnModel)); + // 设置网关默认流 + if (Objects.nonNull(branch.getProperty()) && Boolean.TRUE.equals(branch.getProperty().getDefaultBranch())) { + // 如果是默认流, 以防止前端输入错误, 强制置空 + sequenceFlow.setConditionExpression(null); + gateway.setDefaultFlow(sequenceFlow.getId()); + } + + if (Objects.nonNull(branch.getChildren()) && StringUtils.hasLength(branch.getChildren().getId())) { + branchLastNodeIds.addAll(create(branch.getChildren(), mainProcess, bpmnModel)); + } } } }