Merge branch 'feature/hiddenLogAutoSkip'
This commit is contained in:
commit
c7da1a43dc
@ -13,6 +13,7 @@ import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.flowable.bpmn.model.FlowElement;
|
||||
import org.flowable.bpmn.model.Process;
|
||||
import org.flowable.bpmn.model.ReceiveTask;
|
||||
import org.flowable.bpmn.model.ServiceTask;
|
||||
import org.flowable.bpmn.model.UserTask;
|
||||
@ -22,6 +23,7 @@ import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.delegate.DelegateExecution;
|
||||
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.flowable.engine.impl.util.CommandContextUtil;
|
||||
import org.flowable.engine.impl.util.ProcessDefinitionUtil;
|
||||
import org.flowable.engine.runtime.Execution;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.job.service.JobHandler;
|
||||
@ -38,6 +40,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getApprovalMethod;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getApproverEmptyHandleType;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getApproverSpecify;
|
||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getCategoryVersion;
|
||||
|
||||
/**
|
||||
* 检查节点配置是否合法
|
||||
@ -77,7 +80,9 @@ public class NextActivityConfigCheckJobHandler extends AbstractJobHandler implem
|
||||
return;
|
||||
}
|
||||
try {
|
||||
doCheck(job, flowElements, processEngineConfiguration);
|
||||
Process mainProcess = ProcessDefinitionUtil.getBpmnModel(processInstance.getProcessDefinitionId()).getMainProcess();
|
||||
Optional<Integer> categoryVersion = getCategoryVersion(mainProcess);
|
||||
doCheck(job, flowElements, processEngineConfiguration, categoryVersion.get());
|
||||
} catch (Exception e) {
|
||||
// 有任何异常,则通过钉钉告警
|
||||
log.warn("NextActivityConfigCheckJobHandler msg: {}", e.getMessage(), e);
|
||||
@ -97,7 +102,7 @@ public class NextActivityConfigCheckJobHandler extends AbstractJobHandler implem
|
||||
}
|
||||
}
|
||||
|
||||
private void doCheck(JobEntity job, List<FlowElement> flowElements, ProcessEngineConfigurationImpl processEngineConfiguration) {
|
||||
private void doCheck(JobEntity job, List<FlowElement> flowElements, ProcessEngineConfigurationImpl processEngineConfiguration, Integer categoryVersion) {
|
||||
AtomicReference<String> checkActivityId = new AtomicReference<>("");
|
||||
ListUtils.emptyIfNull(flowElements).stream()
|
||||
.filter(i -> i instanceof UserTask || i instanceof ReceiveTask || i instanceof ServiceTask)
|
||||
@ -123,8 +128,9 @@ public class NextActivityConfigCheckJobHandler extends AbstractJobHandler implem
|
||||
assigners.addAll(approverSelect(specify.getType(), flowElement, (DelegateExecution) executions.get(0), true));
|
||||
});
|
||||
|
||||
|
||||
// 审批候选人为空时的兜底
|
||||
emptyAssigneeHandle(assigners, flowElement, (DelegateExecution) executions.get(0));
|
||||
emptyAssigneeHandle(assigners, flowElement, (DelegateExecution) executions.get(0), categoryVersion);
|
||||
break;
|
||||
}
|
||||
});
|
||||
@ -152,12 +158,13 @@ public class NextActivityConfigCheckJobHandler extends AbstractJobHandler implem
|
||||
/**
|
||||
* 计算节点的待审批人为空时, 执行模型配置中的审批人为空时的处理方式
|
||||
*
|
||||
* @param assigners 节点计算的待审批人集合, 可能为空
|
||||
* @param flowElement 当前节点
|
||||
* @param execution 当前执行实例
|
||||
* @param assigners 节点计算的待审批人集合, 可能为空
|
||||
* @param flowElement 当前节点
|
||||
* @param execution 当前执行实例
|
||||
* @param categoryVersion
|
||||
*/
|
||||
private void emptyAssigneeHandle(List<BpmnTaskDelegateAssigner> assigners, FlowElement flowElement,
|
||||
DelegateExecution execution) {
|
||||
DelegateExecution execution, Integer categoryVersion) {
|
||||
// 审批人为空并且当前节点设置了自动跳过条件
|
||||
if (!CollectionUtils.isEmpty(assigners)) {
|
||||
return;
|
||||
@ -171,10 +178,12 @@ public class NextActivityConfigCheckJobHandler extends AbstractJobHandler implem
|
||||
break;
|
||||
case transferToAdmin:
|
||||
try {
|
||||
assigners.addAll(approverSelect(ApproverEmptyHandleTypeEnum.transferToAdmin.getType(), flowElement,
|
||||
execution, true));
|
||||
if (CollectionUtils.isEmpty(assigners)) {
|
||||
throw new IllegalArgumentException("审批人为空后转交管理员仍然为空");
|
||||
if (categoryVersion < 2) {
|
||||
assigners.addAll(approverSelect(ApproverEmptyHandleTypeEnum.transferToAdmin.getType(), flowElement,
|
||||
execution, true));
|
||||
if (CollectionUtils.isEmpty(assigners)) {
|
||||
throw new IllegalArgumentException("审批人为空后转交管理员仍然为空");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e instanceof IllegalArgumentException) {
|
||||
|
||||
@ -1701,16 +1701,10 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
build.setOperationDesc("系统处理");
|
||||
break;
|
||||
case autoPassed:
|
||||
build.setOperationDesc("无需审批人,自动同意");
|
||||
break;
|
||||
case autoRejection:
|
||||
build.setOperationDesc("无需审批人,自动驳回");
|
||||
break;
|
||||
case autoPassed_empty:
|
||||
build.setOperationDesc("未找到审批人,自动同意");
|
||||
break;
|
||||
case autoRejection_empty:
|
||||
build.setOperationDesc("未找到审批人,自动驳回");
|
||||
build.setOperationDesc("待审批");
|
||||
break;
|
||||
case transferToAdmin:
|
||||
build.setOperationDesc("找不到审批人且转交管理员失败,自动中止");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user