add - 业务节点"不设置"审批人的审批日志处理
This commit is contained in:
parent
0d42431e9e
commit
8943c9b087
@ -2,7 +2,7 @@ package cn.axzo.workflow.core.engine.behavior;
|
||||
|
||||
import cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum;
|
||||
import cn.axzo.workflow.core.engine.event.ReceiveTaskExtInstCreateEventImpl;
|
||||
import cn.axzo.workflow.core.service.ExtAxHiTaskInstService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.bpmn.model.ReceiveTask;
|
||||
import org.flowable.common.engine.api.delegate.event.FlowableEventDispatcher;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
||||
@ -12,17 +12,20 @@ import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.flowable.engine.impl.persistence.entity.ExecutionEntity;
|
||||
import org.flowable.engine.impl.util.CommandContextUtil;
|
||||
import org.flowable.engine.impl.util.TaskHelper;
|
||||
import org.flowable.task.api.Task;
|
||||
import org.flowable.task.service.TaskService;
|
||||
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 自定义 ReceiveTask 行为
|
||||
*
|
||||
* @author wangli
|
||||
* @since 2023/11/23 14:41
|
||||
*/
|
||||
@Slf4j
|
||||
public class CustomReceiveTaskActivityBehavior extends ReceiveTaskActivityBehavior {
|
||||
private ExtAxHiTaskInstService hiTaskInstService;
|
||||
protected ReceiveTask receiveTask;
|
||||
|
||||
public CustomReceiveTaskActivityBehavior(ReceiveTask receiveTask) {
|
||||
@ -43,16 +46,26 @@ public class CustomReceiveTaskActivityBehavior extends ReceiveTaskActivityBehavi
|
||||
task.setPropagatedStageInstanceId(execution.getPropagatedStageInstanceId());
|
||||
task.setName(receiveTask.getName());
|
||||
TaskHelper.insertTask(task, (ExecutionEntity) execution, false, false);
|
||||
|
||||
FlowableEventDispatcher eventDispatcher = processEngineConfiguration.getEventDispatcher();
|
||||
|
||||
eventDispatcher.dispatchEvent(new ReceiveTaskExtInstCreateEventImpl(execution.getProcessInstanceId(),
|
||||
receiveTask.getId(), task.getId(), BpmnProcessInstanceResultEnum.APPROVED),
|
||||
processEngineConfiguration.getEngineCfgKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void leave(DelegateExecution execution) {
|
||||
CommandContext commandContext = CommandContextUtil.getCommandContext();
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration =
|
||||
CommandContextUtil.getProcessEngineConfiguration(commandContext);
|
||||
FlowableEventDispatcher eventDispatcher = processEngineConfiguration.getEventDispatcher();
|
||||
|
||||
org.flowable.engine.TaskService taskService = processEngineConfiguration.getTaskService();
|
||||
Task task = taskService.createTaskQuery().executionId(execution.getId())
|
||||
.taskDefinitionKey(execution.getCurrentActivityId()).singleResult();
|
||||
if (Objects.nonNull(task)) {
|
||||
eventDispatcher.dispatchEvent(new ReceiveTaskExtInstCreateEventImpl(execution.getProcessInstanceId(),
|
||||
receiveTask.getId(), task.getId(), BpmnProcessInstanceResultEnum.APPROVED),
|
||||
processEngineConfiguration.getEngineCfgKey());
|
||||
} else {
|
||||
log.warn("task is null, executionId: {}, activityId: {}", execution.getId(),
|
||||
execution.getCurrentActivityId());
|
||||
}
|
||||
super.leave(execution);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user