From 494b80d1ebae4099d719f671a4cdfe91313f5f16 Mon Sep 17 00:00:00 2001 From: lizhixian <18210040298@163.com> Date: Tue, 11 Mar 2025 17:34:13 +0800 Subject: [PATCH] =?UTF-8?q?review:=20=E4=BC=98=E5=8C=96=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E6=A0=A1=E9=AA=8C=E9=80=89=E6=8B=A9=E7=9A=84?= =?UTF-8?q?=E4=B8=8B=E4=B8=80=E4=B8=AA=E8=8A=82=E7=82=B9=E7=9A=84=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E4=BA=BA=EF=BC=8C=E6=98=AF=E5=90=A6=E5=90=88=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flowable/core/util/BpmnModelUtils.java | 13 ++++++++++--- .../framework/flowable/core/util/FlowableUtils.java | 6 +++--- .../module/bpm/service/task/BpmTaskServiceImpl.java | 8 ++++++-- 3 files changed, 19 insertions(+), 8 deletions(-) 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 af5b0852f6..c471826306 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 @@ -907,9 +907,16 @@ public class BpmnModelUtils { * @return 符合条件的路径 */ private static SequenceFlow findMatchSequenceFlowByExclusiveGateway(Gateway gateway, Map variables) { - SequenceFlow matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(), - flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId()) - && (evalConditionExpress(variables, flow.getConditionExpression()))); + // TODO 表单无可编辑字段时variables为空,流程走向会出现问题,比如流程审批过程中无需要修改的字段值, + SequenceFlow matchSequenceFlow; + if (CollUtil.isNotEmpty(variables)){ + matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(), + flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId()) + && (evalConditionExpress(variables, flow.getConditionExpression()))); + }else { + matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(), + flow -> ObjUtil.notEqual(gateway.getDefaultFlow(), flow.getId())); + } if (matchSequenceFlow == null) { matchSequenceFlow = CollUtil.findOne(gateway.getOutgoingFlows(), flow -> ObjUtil.equal(gateway.getDefaultFlow(), flow.getId())); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/FlowableUtils.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/FlowableUtils.java index 4178638b5a..fe83495e35 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/FlowableUtils.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/FlowableUtils.java @@ -194,7 +194,7 @@ public class FlowableUtils { @SuppressWarnings("unchecked") public static Map> getStartUserSelectAssignees(Map processVariables) { if (processVariables == null) { - return new HashMap<>(); + return null; } return (Map>) processVariables.get( BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES); @@ -214,12 +214,12 @@ public class FlowableUtils { * 获得流程实例的审批用户选择的下一个节点的审批人 Map * * @param processVariables 流程变量 - * @return 审批用户选择的下一个节点的审批人Map + * @return 审批用户选择的下一个节点的审批人Map Map */ @SuppressWarnings("unchecked") public static Map> getApproveUserSelectAssignees(Map processVariables) { if (processVariables == null) { - return new HashMap<>(); + return null; } return (Map>) processVariables.get( BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_APPROVE_USER_SELECT_ASSIGNEES); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java index 09eea1e52c..0bfd6b0c6c 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java @@ -600,7 +600,9 @@ public class BpmTaskServiceImpl implements BpmTaskService { throw exception(PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_CONFIG, nextFlowNode.getName()); } processVariables = FlowableUtils.getStartUserSelectAssignees(processInstance.getProcessVariables()); - if (CollUtil.isNotEmpty(processVariables)) { + if (processVariables == null){ + processVariables = new HashMap<>(); + }else { List startUserSelectAssignee = processVariables.get(nextFlowNode.getId()); // 特殊:如果当前节点已经存在审批人,则不允许覆盖 if (CollUtil.isNotEmpty(startUserSelectAssignee)) { @@ -619,7 +621,9 @@ public class BpmTaskServiceImpl implements BpmTaskService { throw exception(PROCESS_INSTANCE_APPROVE_USER_SELECT_ASSIGNEES_NOT_CONFIG, nextFlowNode.getName()); } processVariables = FlowableUtils.getApproveUserSelectAssignees(processInstance.getProcessVariables()); - if (CollUtil.isNotEmpty(processVariables)) { + if (processVariables == null){ + processVariables = new HashMap<>(); + }else { List approveUserSelectAssignee = processVariables.get(nextFlowNode.getId()); // 特殊:如果当前节点已经存在审批人,则不允许覆盖 if (CollUtil.isNotEmpty(approveUserSelectAssignee)) {