From 629bf284959cafbdb8f8e454759faa250b6219bb Mon Sep 17 00:00:00 2001 From: lizhixian <18210040298@163.com> Date: Fri, 21 Mar 2025 14:08:24 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E6=8E=A5=E5=8F=A3=EF=BC=8C=E6=A0=A1=E9=AA=8C=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E8=A7=84=E5=88=99=E4=B8=BA=E5=8F=91=E8=B5=B7=E4=BA=BA?= =?UTF-8?q?=E8=87=AA=E9=80=89=E6=97=B6=EF=BC=8C=E5=85=88=E4=BB=8E=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E5=8F=98=E9=87=8F=E4=B8=AD=E6=9F=A5=E8=AF=A2=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E4=BA=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bpm/service/task/BpmTaskServiceImpl.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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 c0098f706e..9eb25323ee 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 @@ -613,16 +613,17 @@ public class BpmTaskServiceImpl implements BpmTaskService { Integer candidateStrategy = parseCandidateStrategy(nextFlowNode); // 2.1 情况一:如果节点中的审批人策略为 发起人自选 if (ObjUtil.equals(candidateStrategy, BpmTaskCandidateStrategyEnum.START_USER_SELECT.getStrategy())) { - // 如果节点存在,但未配置审批人 - List assignees = nextAssignees != null ? nextAssignees.get(nextFlowNode.getId()) : null; - if (CollUtil.isEmpty(assignees)) { - throw exception(PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_CONFIG, nextFlowNode.getName()); - } + // 先从历史中获取审批人,在发起人会把所有的审批人保存到历史中,这里从历史中获取 processVariables = FlowableUtils.getStartUserSelectAssignees(processInstance.getProcessVariables()); // 特殊:如果当前节点已经存在审批人,则不允许覆盖 if (processVariables != null && CollUtil.isNotEmpty(processVariables.get(nextFlowNode.getId()))) { continue; } + // 如果节点存在,但未配置审批人 + List assignees = nextAssignees != null ? nextAssignees.get(nextFlowNode.getId()) : null; + if (CollUtil.isEmpty(assignees)) { + throw exception(PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_CONFIG, nextFlowNode.getName()); + } // 设置 PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES if (processVariables == null) { processVariables = new HashMap<>(); @@ -632,12 +633,13 @@ public class BpmTaskServiceImpl implements BpmTaskService { } // 2.2 情况二:如果节点中的审批人策略为 审批人,在审批时选择下一个节点的审批人,并且该节点的审批人为空 if (ObjUtil.equals(candidateStrategy, BpmTaskCandidateStrategyEnum.APPROVE_USER_SELECT.getStrategy())) { + // 获取审批人自选的历史变量 + processVariables = FlowableUtils.getApproveUserSelectAssignees(processInstance.getProcessVariables()); // 如果节点存在,但未配置审批人 List assignees = nextAssignees != null ? nextAssignees.get(nextFlowNode.getId()) : null; if (CollUtil.isEmpty(assignees)) { throw exception(PROCESS_INSTANCE_APPROVE_USER_SELECT_ASSIGNEES_NOT_CONFIG, nextFlowNode.getName()); } - processVariables = FlowableUtils.getApproveUserSelectAssignees(processInstance.getProcessVariables()); if (processVariables == null) { processVariables = new HashMap<>(); }