Commit dace9cfed56fe01db443d787e605ac4026c20235

Authored by jason
1 parent 27235016

perf: [BPM 工作流] 驳回预测 review 修改

yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java
... ... @@ -72,7 +72,6 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
72 72 import static cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmApprovalDetailRespVO.ActivityNode;
73 73 import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
74 74 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.START_USER_NODE_ID;
75   -import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_TASK_IDS;
76 75 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseNodeType;
77 76 import static java.util.Arrays.asList;
78 77 import static java.util.Collections.singletonList;
... ... @@ -223,7 +222,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
223 222 // 3.2 获取由于退回操作,需要预测的节点。从流程变量中获取,回退操作会设置这些变量
224 223 Set<String> needSimulateTaskDefKeysByReturn = new HashSet<>();
225 224 if (StrUtil.isNotEmpty(reqVO.getProcessInstanceId())) {
226   - Object needSimulateTaskIds = runtimeService.getVariable(reqVO.getProcessInstanceId(), PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_TASK_IDS);
  225 + Object needSimulateTaskIds = runtimeService.getVariable(reqVO.getProcessInstanceId(), BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_TASK_IDS);
227 226 needSimulateTaskDefKeysByReturn.addAll(Convert.toSet(String.class, needSimulateTaskIds));
228 227 }
229 228 // 移除运行中的节点,运行中的节点无需预测
... ...
yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
... ... @@ -69,7 +69,6 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
69 69 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
70 70 import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
71 71 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.START_USER_NODE_ID;
72   -import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.*;
73 72 import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.*;
74 73  
75 74 /**
... ... @@ -602,11 +601,11 @@ public class BpmTaskServiceImpl implements BpmTaskService {
602 601 runtimeService.setVariables(task.getProcessInstanceId(), variables);
603 602  
604 603 // 5. 如果当前节点 Id 存在于需要预测的流程节点中,从中移除。 流程变量在回退操作中设置
605   - Object needSimulateTaskIds = runtimeService.getVariable(task.getProcessInstanceId(), PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_TASK_IDS);
  604 + Object needSimulateTaskIds = runtimeService.getVariable(task.getProcessInstanceId(), BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_TASK_IDS);
606 605 Set<String> needSimulateTaskIdsByReturn = Convert.toSet(String.class, needSimulateTaskIds);
607 606 if (needSimulateTaskIdsByReturn.contains(task.getTaskDefinitionKey())) {
608 607 needSimulateTaskIdsByReturn.remove(task.getTaskDefinitionKey());
609   - runtimeService.setVariable(task.getProcessInstanceId(), PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_TASK_IDS, needSimulateTaskIdsByReturn);
  608 + runtimeService.setVariable(task.getProcessInstanceId(), BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_TASK_IDS, needSimulateTaskIdsByReturn);
610 609 }
611 610  
612 611 // 6. 调用 BPM complete 去完成任务
... ... @@ -945,10 +944,10 @@ public class BpmTaskServiceImpl implements BpmTaskService {
945 944 .processInstanceId(currentTask.getProcessInstanceId())
946 945 .moveExecutionsToSingleActivityId(runExecutionIds, reqVO.getTargetTaskDefinitionKey())
947 946 // 设置需要预测的任务 ids 的流程变量,用于辅助预测
948   - .processVariable(PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_TASK_IDS, needSimulateTaskDefinitionKeys)
  947 + .processVariable(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_TASK_IDS, needSimulateTaskDefinitionKeys)
949 948 // 设置流程变量(local)节点退回标记, 用于退回到节点,不执行 BpmUserTaskAssignStartUserHandlerTypeEnum 策略,导致自动通过
950 949 .localVariable(reqVO.getTargetTaskDefinitionKey(),
951   - String.format(PROCESS_INSTANCE_VARIABLE_RETURN_FLAG, reqVO.getTargetTaskDefinitionKey()), Boolean.TRUE)
  950 + String.format(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG, reqVO.getTargetTaskDefinitionKey()), Boolean.TRUE)
952 951 .changeState();
953 952 }
954 953  
... ... @@ -1492,9 +1491,9 @@ public class BpmTaskServiceImpl implements BpmTaskService {
1492 1491 FlowElement userTaskElement = BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey());
1493 1492 // 判断是否为退回或者驳回:如果是退回或者驳回不走这个策略(使用 local variable)
1494 1493 Boolean returnTaskFlag = runtimeService.getVariableLocal(task.getExecutionId(),
1495   - String.format(PROCESS_INSTANCE_VARIABLE_RETURN_FLAG, task.getTaskDefinitionKey()), Boolean.class);
  1494 + String.format(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG, task.getTaskDefinitionKey()), Boolean.class);
1496 1495 Boolean skipStartUserNodeFlag = Convert.toBool(runtimeService.getVariable(processInstance.getProcessInstanceId(),
1497   - PROCESS_INSTANCE_VARIABLE_SKIP_START_USER_NODE, String.class));
  1496 + BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_SKIP_START_USER_NODE, String.class));
1498 1497 if (userTaskElement.getId().equals(START_USER_NODE_ID)
1499 1498 && (skipStartUserNodeFlag == null // 目的:一般是“主流程”,发起人节点,自动通过审核
1500 1499 || BooleanUtil.isTrue(skipStartUserNodeFlag)) // 目的:一般是“子流程”,发起人节点,按配置自动通过审核
... ...