Commit d41cce94cd1d6c7cc515b3c1023676d3584a3244

Authored by smallNorthLee
1 parent 33ab9616

feat:审批通过时,查询下一个执行节点,校验流程执行正确与否

yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java
... ... @@ -856,6 +856,10 @@ public class BpmnModelUtils {
856 856 if (targetElement == null) {
857 857 continue;
858 858 }
  859 + // 如果是结束节点,直接返回
  860 + if (targetElement instanceof EndEvent) {
  861 + break;
  862 + }
859 863 // 情况一:处理不同类型的网关
860 864 if (targetElement instanceof Gateway) {
861 865 Gateway gateway = (Gateway) targetElement;
... ...
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
... ... @@ -595,8 +595,11 @@ public class BpmTaskServiceImpl implements BpmTaskService {
595 595 if (CollUtil.isNotEmpty(allNextAssignees)) {
596 596 // 获取实例中的全部节点数据,避免后续节点的审批人被覆盖
597 597 hisProcessVariables.putAll(allNextAssignees);
  598 + // 设置流程变量,审批人自选
598 599 newVariables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_APPROVE_USER_SELECT_ASSIGNEES, hisProcessVariables);
599   - runtimeService.setVariables(processInstance.getProcessInstanceId(), variables);
  600 + // 设置流程变量,发起人自选,后续的节点或者回退后再或者驳回重新发起的场景可能存在发起人自选或者审批人自选,所以中两个变量值要保持一致,否则会查询不到审批人
  601 + newVariables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES, hisProcessVariables);
  602 + runtimeService.setVariables(processInstance.getProcessInstanceId(), newVariables);
600 603 }
601 604 return newVariables;
602 605 }
... ...