update - 调整审批人为空时,自动通过和拒绝处理策略

This commit is contained in:
wangli 2023-12-01 00:07:54 +08:00
parent 699c476bf2
commit 3cfcb8a3f2

View File

@ -30,7 +30,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import static cn.axzo.workflow.common.constant.BpmnConstants.BPM_ALLOW_AUTO_REJECTION;
import static cn.axzo.workflow.common.constant.BpmnConstants.BPM_ALLOW_SKIP_USER_TASK;
import static cn.axzo.workflow.common.constant.BpmnConstants.FLOW_SERVER_VERSION_121;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_TASK_RELATION_ASSIGNEE_LIST_INFO;
@ -66,6 +65,7 @@ public class EngineExecutionStartListener implements ExecutionListener {
private String processInstanceId;
@Value("#{${workflow.assignee.map:{}}}")
private Map<String, String> assigneeMap;
@Override
public void notify(DelegateExecution execution) {
log.info("execution Start: {}", JSON.toJSONString(execution));
@ -128,20 +128,20 @@ public class EngineExecutionStartListener implements ExecutionListener {
if (!CollectionUtils.isEmpty(assigners)) {
return;
}
Optional<ApproverEmptyHandleTypeEnum> approverEmptyHandleType = getApproverEmptyHandleType(userTask);
approverEmptyHandleType.ifPresent(type -> {
getApproverEmptyHandleType(userTask).ifPresent(type -> {
switch (type) {
// 自动通过和拒绝, 统一由 cn.axzo.workflow.server.controller.listener.task.AutoOperatorEventListener 来处理
case autoPassed:
// 自动通过的默认引擎参数必须设置为 true
execution.setTransientVariable(BpmnConstants.FLOWABLE_SKIP_EXPRESSION_ENABLE, true);
// execution.setTransientVariable(BpmnConstants.FLOWABLE_SKIP_EXPRESSION_ENABLE, true);
// 设置当前 UserTask 使用的 skip 表达式
execution.setTransientVariable(BPM_ALLOW_SKIP_USER_TASK, true);
break;
// execution.setTransientVariable(BPM_ALLOW_SKIP_USER_TASK, true);
// break;
case autoRejection:
execution.setTransientVariable(BPM_ALLOW_AUTO_REJECTION, true);
// execution.setTransientVariable(BPM_ALLOW_AUTO_REJECTION, true);
break;
case transferToAdmin:
approverSelect(ApproverEmptyHandleTypeEnum.transferToAdmin.getType(), userTask , execution);
approverSelect(ApproverEmptyHandleTypeEnum.transferToAdmin.getType(), userTask, execution);
break;
default:
break;