|
|
|
@ -69,7 +69,6 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
|
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
|
|
|
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
|
|
|
|
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
|
|
|
|
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.START_USER_NODE_ID;
|
|
|
|
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.START_USER_NODE_ID;
|
|
|
|
//import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.*;
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.*;
|
|
|
|
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.*;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -604,11 +603,13 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|
|
|
bpmnModel, reqVO.getNextAssignees(), instance);
|
|
|
|
bpmnModel, reqVO.getNextAssignees(), instance);
|
|
|
|
runtimeService.setVariables(task.getProcessInstanceId(), variables);
|
|
|
|
runtimeService.setVariables(task.getProcessInstanceId(), variables);
|
|
|
|
|
|
|
|
|
|
|
|
// 5. 移除辅助预测的流程变量,这些变量在回退操作中设置
|
|
|
|
// 5. 如果当前节点 Id 存在于需要预测的流程节点中,从中移除。 流程变量在回退操作中设置
|
|
|
|
// todo @jason:可以直接 + 拼接哈
|
|
|
|
Object needSimulateTaskIds = runtimeService.getVariable(task.getProcessInstanceId(), BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_TASK_IDS);
|
|
|
|
String simulateVariableName = StrUtil.concat(false,
|
|
|
|
Set<String> needSimulateTaskIdsByReturn = Convert.toSet(String.class, needSimulateTaskIds);
|
|
|
|
BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_PREFIX, task.getTaskDefinitionKey());
|
|
|
|
if (needSimulateTaskIdsByReturn.contains(task.getTaskDefinitionKey())) {
|
|
|
|
runtimeService.removeVariable(task.getProcessInstanceId(), simulateVariableName);
|
|
|
|
needSimulateTaskIdsByReturn.remove(task.getTaskDefinitionKey());
|
|
|
|
|
|
|
|
runtimeService.setVariable(task.getProcessInstanceId(), BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_TASK_IDS, needSimulateTaskIdsByReturn);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 6. 调用 BPM complete 去完成任务
|
|
|
|
// 6. 调用 BPM complete 去完成任务
|
|
|
|
taskService.complete(task.getId(), variables, true);
|
|
|
|
taskService.complete(task.getId(), variables, true);
|
|
|
|
@ -937,11 +938,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 3. 构建需要预测的任务流程变量
|
|
|
|
// 3. 构建需要预测的任务流程变量
|
|
|
|
// TODO @jason:【驳回预测相关】是不是搞成一个变量,里面是 set 更简洁一点呀?
|
|
|
|
|
|
|
|
Set<String> needSimulateTaskDefinitionKeys = getNeedSimulateTaskDefinitionKeys(bpmnModel, currentTask, targetElement);
|
|
|
|
Set<String> needSimulateTaskDefinitionKeys = getNeedSimulateTaskDefinitionKeys(bpmnModel, currentTask, targetElement);
|
|
|
|
Map<String, Object> needSimulateVariables = convertMap(needSimulateTaskDefinitionKeys,
|
|
|
|
|
|
|
|
key -> StrUtil.concat(false, BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_PREFIX, key), item -> Boolean.TRUE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 4. 执行驳回
|
|
|
|
// 4. 执行驳回
|
|
|
|
// 使用 moveExecutionsToSingleActivityId 替换 moveActivityIdsToSingleActivityId 原因:
|
|
|
|
// 使用 moveExecutionsToSingleActivityId 替换 moveActivityIdsToSingleActivityId 原因:
|
|
|
|
@ -949,12 +946,11 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|
|
|
runtimeService.createChangeActivityStateBuilder()
|
|
|
|
runtimeService.createChangeActivityStateBuilder()
|
|
|
|
.processInstanceId(currentTask.getProcessInstanceId())
|
|
|
|
.processInstanceId(currentTask.getProcessInstanceId())
|
|
|
|
.moveExecutionsToSingleActivityId(runExecutionIds, reqVO.getTargetTaskDefinitionKey())
|
|
|
|
.moveExecutionsToSingleActivityId(runExecutionIds, reqVO.getTargetTaskDefinitionKey())
|
|
|
|
// 设置需要预测的任务流程变量,用于辅助预测
|
|
|
|
// 设置需要预测的任务 ids 的流程变量,用于辅助预测
|
|
|
|
.processVariables(needSimulateVariables)
|
|
|
|
.processVariable(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_NEED_SIMULATE_TASK_IDS, needSimulateTaskDefinitionKeys)
|
|
|
|
// 设置流程变量(local)节点退回标记, 用于退回到节点,不执行 BpmUserTaskAssignStartUserHandlerTypeEnum 策略,导致自动通过
|
|
|
|
// 设置流程变量(local)节点退回标记, 用于退回到节点,不执行 BpmUserTaskAssignStartUserHandlerTypeEnum 策略,导致自动通过
|
|
|
|
.localVariable(reqVO.getTargetTaskDefinitionKey(),
|
|
|
|
.localVariable(reqVO.getTargetTaskDefinitionKey(),
|
|
|
|
String.format(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG, reqVO.getTargetTaskDefinitionKey()),
|
|
|
|
String.format(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG, reqVO.getTargetTaskDefinitionKey()), Boolean.TRUE)
|
|
|
|
Boolean.TRUE)
|
|
|
|
|
|
|
|
.changeState();
|
|
|
|
.changeState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|