update - 处理审批日志中的 NodeMode, 在推测时,确认哪些节点是异常节点
This commit is contained in:
parent
e961f254e0
commit
1281307686
@ -8,6 +8,7 @@ public enum BpmnFlowNodeMode {
|
||||
AUTO_PASSED("AUTO_PASSED", "自动通过"),
|
||||
AUTO_REJECTED("AUTO_REJECTED", "自动拒绝"),
|
||||
BUSINESS_BIZ_SPECIFY("BUSINESS_BIZ_SPECIFY", "业务指定审批人"),
|
||||
EXCEPTIONAL("EXCEPTIONAL", "异常"),
|
||||
;
|
||||
|
||||
private String type;
|
||||
|
||||
@ -54,7 +54,8 @@ public class CustomForecastUserTaskAssigneeCmd implements Command<List<BpmnTaskD
|
||||
|
||||
// 如果没找到审批人,加载管理员
|
||||
if (CollectionUtils.isEmpty(forecastAssigners)) {
|
||||
log.info("流程实例: {}, UserTask{}: 未找到审批人, 开始查找兜底配置!", processInstanceId, userTask.getId());
|
||||
log.info("流程实例: {} 推测审批人时, UserTask{}: 未找到审批人, 开始根据'审批人为空'时的兜底配置进行计算!", processInstanceId,
|
||||
userTask.getId());
|
||||
BpmnMetaParserHelper.getApproverEmptyHandleType(userTask).ifPresent(type -> {
|
||||
switch (type) {
|
||||
case transferToAdmin:
|
||||
@ -71,6 +72,8 @@ public class CustomForecastUserTaskAssigneeCmd implements Command<List<BpmnTaskD
|
||||
}
|
||||
});
|
||||
}
|
||||
log.info("流程实例: {} , UserTask: {}推测的最终审批人为: {}", processInstanceId, userTask.getId(),
|
||||
JSON.toJSONString(forecastAssigners));
|
||||
return forecastAssigners;
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,6 @@ import cn.axzo.workflow.common.model.response.bpmn.process.HistoricProcessInstan
|
||||
import cn.axzo.workflow.common.model.response.bpmn.process.ProcessNodeDetailVO;
|
||||
import cn.axzo.workflow.core.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.core.common.utils.BpmnCollectionUtils;
|
||||
import cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomAbortProcessInstanceCmd;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomCancelProcessInstanceCmd;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomForecastUserTaskAssigneeCmd;
|
||||
@ -80,6 +79,7 @@ import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.AND;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.AUTO_PASSED;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.AUTO_REJECTED;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.BUSINESS_BIZ_SPECIFY;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.EXCEPTIONAL;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.GENERAL;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeMode.OR;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeType.NODE_BUSINESS;
|
||||
@ -91,6 +91,8 @@ import static cn.axzo.workflow.core.common.code.BpmnProcessDefinitionRespCode.PR
|
||||
import static cn.axzo.workflow.core.common.code.BpmnProcessDefinitionRespCode.PROCESS_DEFINITION_IS_SUSPENDED;
|
||||
import static cn.axzo.workflow.core.common.code.BpmnProcessDefinitionRespCode.PROCESS_DEFINITION_KEY_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getApprovalMethod;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getButtonConfig;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getNodeType;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnNativeQueryUtil.countSql;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnNativeQueryUtil.sqlConnectors;
|
||||
|
||||
@ -560,8 +562,7 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
flowElements.stream().filter(i -> (i instanceof UserTask || i instanceof ReceiveTask || i instanceof ServiceTask))
|
||||
.forEach(i -> {
|
||||
ProcessNodeDetailVO node = new ProcessNodeDetailVO();
|
||||
BpmnMetaParserHelper.getButtonConfig(bpmnModel.getMainProcess(), i.getId())
|
||||
.ifPresent(node::setButtonConf);
|
||||
getButtonConfig(bpmnModel.getMainProcess(), i.getId()).ifPresent(node::setButtonConf);
|
||||
if (i instanceof UserTask) {
|
||||
UserTask userTask = (UserTask) i;
|
||||
node.setId(userTask.getId())
|
||||
@ -569,12 +570,12 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
.setFormKey(userTask.getFormKey())
|
||||
.setNodeMode(GENERAL);//兜底设置
|
||||
// 获取最原始节点类型, 部分节点会根据功能更变运行时的节点类型,在这里统一获取变更前的原类型
|
||||
BpmnMetaParserHelper.getNodeType(i).ifPresent(node::setNodeType);
|
||||
getNodeType(i).ifPresent(node::setNodeType);
|
||||
if (Objects.equals(NODE_STARTER.getType(), i.getId())) {
|
||||
node.setNodeType(NODE_STARTER);
|
||||
}
|
||||
|
||||
// 处理一些特殊节点模式
|
||||
// 处理一些特殊的节点模式
|
||||
getApprovalMethod(userTask).ifPresent(approvalMethod -> {
|
||||
switch (approvalMethod) {
|
||||
case autoPassed:
|
||||
@ -586,6 +587,9 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
case bizSpecify:
|
||||
node.setNodeMode(BUSINESS_BIZ_SPECIFY);
|
||||
break;
|
||||
case nobody:
|
||||
node.setNodeMode(GENERAL);
|
||||
break;
|
||||
default:
|
||||
if (userTask.getBehavior() instanceof MultiInstanceActivityBehavior) {
|
||||
MultiInstanceActivityBehavior behavior =
|
||||
@ -598,16 +602,21 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
} else {
|
||||
node.setNodeMode(BpmnFlowNodeMode.GENERAL);
|
||||
}
|
||||
|
||||
// 推测当前节点的审批人,并且如果审批人为空,也会根据审批人为空的策略去找人
|
||||
List<BpmnTaskDelegateAssigner> forecastAssigners =
|
||||
springProcessEngineConfiguration.getCommandExecutor()
|
||||
.execute(new CustomForecastUserTaskAssigneeCmd(processInstanceId,
|
||||
userTask,
|
||||
engineExecutionStartListener));
|
||||
node.setForecastAssigners(forecastAssigners);
|
||||
if (CollectionUtils.isEmpty(forecastAssigners)) {
|
||||
node.setNodeMode(EXCEPTIONAL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// 推测当前节点的审批人
|
||||
List<BpmnTaskDelegateAssigner> forecastAssigners =
|
||||
springProcessEngineConfiguration.getCommandExecutor()
|
||||
.execute(new CustomForecastUserTaskAssigneeCmd(processInstanceId, userTask,
|
||||
engineExecutionStartListener));
|
||||
node.setForecastAssigners(forecastAssigners);
|
||||
} else if (i instanceof ReceiveTask) {
|
||||
ReceiveTask receiveTask = (ReceiveTask) i;
|
||||
node.setId(receiveTask.getId())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user