Commit 672a5ef538c2374a142e919ebd40ed3fcb4a2eaf
1 parent
1e2b5625
review: 代码审查
Showing
1 changed file
with
16 additions
and
15 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
| ... | ... | @@ -564,6 +564,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { |
| 564 | 564 | FlowElement flowElement = bpmnModel.getFlowElement(taskDefinitionKey); |
| 565 | 565 | // 2. 获取下一个将要执行的节点集合 |
| 566 | 566 | List<FlowNode> nextFlowNodes = getNextFlowNodes(flowElement, bpmnModel, variables); |
| 567 | + Map<String, List<Long>> processVariables = new HashMap<>(); | |
| 567 | 568 | // 3. 循环下一个将要执行的节点集合 |
| 568 | 569 | for (FlowNode nextFlowNode : nextFlowNodes) { |
| 569 | 570 | // 3.1 获取下一个将要执行节点中的审批人策略 |
| ... | ... | @@ -574,35 +575,35 @@ public class BpmTaskServiceImpl implements BpmTaskService { |
| 574 | 575 | } |
| 575 | 576 | // 3.3 获取节点中的审批人 |
| 576 | 577 | List<Long> assignees = nextAssignees.get(nextFlowNode.getId()); |
| 577 | - // 3.3 如果节点中的审批人策略为 发起人自选 | |
| 578 | + // 3.4 流程变量 | |
| 579 | + // 3.5 如果节点中的审批人策略为 发起人自选 | |
| 578 | 580 | if (ObjUtil.equals(candidateStrategy, BpmTaskCandidateStrategyEnum.START_USER_SELECT.getStrategy())) { |
| 579 | - Map<String, List<Long>> hisProcessVariables = FlowableUtils.getStartUserSelectAssignees(processInstance.getProcessVariables()); | |
| 580 | - List<Long> startUserSelectAssignee = hisProcessVariables.get(nextFlowNode.getId()); | |
| 581 | + processVariables = FlowableUtils.getStartUserSelectAssignees(processInstance.getProcessVariables()); | |
| 582 | + if(processVariables == null){ | |
| 583 | + processVariables = new HashMap<>(); | |
| 584 | + } | |
| 585 | + List<Long> startUserSelectAssignee = processVariables.get(nextFlowNode.getId()); | |
| 581 | 586 | // 如果当前节点已经存在审批人,则不允许覆盖 |
| 582 | 587 | if (CollUtil.isNotEmpty(startUserSelectAssignee)) { |
| 583 | 588 | continue; |
| 584 | 589 | } |
| 585 | - // 判断节点的审批人是否配置,节点存在,但未配置审批人 | |
| 590 | + // 如果节点存在,但未配置审批人 | |
| 586 | 591 | if (CollUtil.isEmpty(assignees)){ |
| 587 | 592 | throw exception(PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_CONFIG, nextFlowNode.getName()); |
| 588 | 593 | } |
| 589 | 594 | // 校验通过的全部节点和审批人 |
| 590 | - hisProcessVariables.put(nextFlowNode.getId(), assignees); | |
| 591 | - variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES, hisProcessVariables); | |
| 595 | + processVariables.put(nextFlowNode.getId(), assignees); | |
| 596 | + variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES, processVariables); | |
| 592 | 597 | } |
| 593 | - // 3.4 如果节点中的审批人策略为 审批人,在审批时选择下一个节点的审批人,并且该节点的审批人为空 | |
| 598 | + // 3.6 如果节点中的审批人策略为 审批人,在审批时选择下一个节点的审批人,并且该节点的审批人为空 | |
| 594 | 599 | if (ObjUtil.equals(candidateStrategy, BpmTaskCandidateStrategyEnum.APPROVE_USER_SELECT.getStrategy())){ |
| 595 | - // 判断节点的审批人是否配置,节点存在,但未配置审批人 | |
| 600 | + // 如果节点存在,但未配置审批人 | |
| 596 | 601 | if (CollUtil.isEmpty(assignees)) { |
| 597 | 602 | throw exception(PROCESS_INSTANCE_APPROVE_USER_SELECT_ASSIGNEES_NOT_CONFIG, nextFlowNode.getName()); |
| 598 | 603 | } |
| 599 | - Map<String, List<Long>> hisProcessVariables = FlowableUtils.getApproveUserSelectAssignees(processInstance.getProcessVariables()); | |
| 600 | - if (hisProcessVariables == null) { | |
| 601 | - hisProcessVariables = new HashMap<>(); | |
| 602 | - // 校验通过的全部节点和审批人 | |
| 603 | - hisProcessVariables.put(nextFlowNode.getId(), assignees); | |
| 604 | - } | |
| 605 | - variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_APPROVE_USER_SELECT_ASSIGNEES, hisProcessVariables); | |
| 604 | + // 校验通过的全部节点和审批人 | |
| 605 | + processVariables.put(nextFlowNode.getId(), assignees); | |
| 606 | + variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_APPROVE_USER_SELECT_ASSIGNEES, processVariables); | |
| 606 | 607 | } |
| 607 | 608 | } |
| 608 | 609 | return variables; | ... | ... |