Merge branch 'feature/hiddenLogAutoSkip' into pre
This commit is contained in:
commit
9e9fe65255
@ -13,6 +13,7 @@ import cn.hutool.json.JSONUtil;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
import org.flowable.bpmn.model.FlowElement;
|
import org.flowable.bpmn.model.FlowElement;
|
||||||
|
import org.flowable.bpmn.model.Process;
|
||||||
import org.flowable.bpmn.model.ReceiveTask;
|
import org.flowable.bpmn.model.ReceiveTask;
|
||||||
import org.flowable.bpmn.model.ServiceTask;
|
import org.flowable.bpmn.model.ServiceTask;
|
||||||
import org.flowable.bpmn.model.UserTask;
|
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.delegate.DelegateExecution;
|
||||||
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||||
import org.flowable.engine.impl.util.CommandContextUtil;
|
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.Execution;
|
||||||
import org.flowable.engine.runtime.ProcessInstance;
|
import org.flowable.engine.runtime.ProcessInstance;
|
||||||
import org.flowable.job.service.JobHandler;
|
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.getApprovalMethod;
|
||||||
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getApproverEmptyHandleType;
|
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.getApproverSpecify;
|
||||||
|
import static cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper.getCategoryVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查节点配置是否合法
|
* 检查节点配置是否合法
|
||||||
@ -77,7 +80,9 @@ public class NextActivityConfigCheckJobHandler extends AbstractJobHandler implem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
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) {
|
} catch (Exception e) {
|
||||||
// 有任何异常,则通过钉钉告警
|
// 有任何异常,则通过钉钉告警
|
||||||
log.warn("NextActivityConfigCheckJobHandler msg: {}", e.getMessage(), 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<>("");
|
AtomicReference<String> checkActivityId = new AtomicReference<>("");
|
||||||
ListUtils.emptyIfNull(flowElements).stream()
|
ListUtils.emptyIfNull(flowElements).stream()
|
||||||
.filter(i -> i instanceof UserTask || i instanceof ReceiveTask || i instanceof ServiceTask)
|
.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));
|
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;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -155,9 +161,10 @@ public class NextActivityConfigCheckJobHandler extends AbstractJobHandler implem
|
|||||||
* @param assigners 节点计算的待审批人集合, 可能为空
|
* @param assigners 节点计算的待审批人集合, 可能为空
|
||||||
* @param flowElement 当前节点
|
* @param flowElement 当前节点
|
||||||
* @param execution 当前执行实例
|
* @param execution 当前执行实例
|
||||||
|
* @param categoryVersion
|
||||||
*/
|
*/
|
||||||
private void emptyAssigneeHandle(List<BpmnTaskDelegateAssigner> assigners, FlowElement flowElement,
|
private void emptyAssigneeHandle(List<BpmnTaskDelegateAssigner> assigners, FlowElement flowElement,
|
||||||
DelegateExecution execution) {
|
DelegateExecution execution, Integer categoryVersion) {
|
||||||
// 审批人为空并且当前节点设置了自动跳过条件
|
// 审批人为空并且当前节点设置了自动跳过条件
|
||||||
if (!CollectionUtils.isEmpty(assigners)) {
|
if (!CollectionUtils.isEmpty(assigners)) {
|
||||||
return;
|
return;
|
||||||
@ -171,11 +178,13 @@ public class NextActivityConfigCheckJobHandler extends AbstractJobHandler implem
|
|||||||
break;
|
break;
|
||||||
case transferToAdmin:
|
case transferToAdmin:
|
||||||
try {
|
try {
|
||||||
|
if (categoryVersion < 2) {
|
||||||
assigners.addAll(approverSelect(ApproverEmptyHandleTypeEnum.transferToAdmin.getType(), flowElement,
|
assigners.addAll(approverSelect(ApproverEmptyHandleTypeEnum.transferToAdmin.getType(), flowElement,
|
||||||
execution, true));
|
execution, true));
|
||||||
if (CollectionUtils.isEmpty(assigners)) {
|
if (CollectionUtils.isEmpty(assigners)) {
|
||||||
throw new IllegalArgumentException("审批人为空后转交管理员仍然为空");
|
throw new IllegalArgumentException("审批人为空后转交管理员仍然为空");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (e instanceof IllegalArgumentException) {
|
if (e instanceof IllegalArgumentException) {
|
||||||
throw new RuntimeException(e.getMessage());
|
throw new RuntimeException(e.getMessage());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user