fix - 调整因为修复自动过审卡节点导致MQ 事件无法正确发出的问题

This commit is contained in:
wangli 2024-08-08 16:50:13 +08:00
parent f5b8f66a39
commit 4935e3f8d2
2 changed files with 14 additions and 8 deletions

View File

@ -110,7 +110,9 @@ public class CustomApproveTaskCmd extends AbstractCommand<Void> implements Seria
List<BpmnFlowNodeType> nodeTypes) { List<BpmnFlowNodeType> nodeTypes) {
this.taskId = taskId; this.taskId = taskId;
this.advice = advice; this.advice = advice;
this.operationDesc = operationDesc; if (StringUtils.hasText(operationDesc)) {
this.operationDesc = operationDesc;
}
this.attachmentList = attachmentList; this.attachmentList = attachmentList;
this.approver = approver; this.approver = approver;
this.nextApprover = nextApprover; this.nextApprover = nextApprover;

View File

@ -1,19 +1,17 @@
package cn.axzo.workflow.core.engine.tx.listener; package cn.axzo.workflow.core.engine.tx.listener;
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskAuditDTO;
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner; import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner;
import cn.axzo.workflow.core.engine.cmd.CustomApproveTaskCmd; import cn.axzo.workflow.core.engine.cmd.CustomApproveTaskAsyncCmd;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.flowable.common.engine.impl.cfg.TransactionListener; import org.flowable.common.engine.impl.cfg.TransactionListener;
import org.flowable.common.engine.impl.interceptor.CommandConfig;
import org.flowable.common.engine.impl.interceptor.CommandContext; import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.common.engine.impl.interceptor.CommandExecutor; import org.flowable.common.engine.impl.interceptor.CommandExecutor;
import org.flowable.engine.ProcessEngineConfiguration; import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.RuntimeService; import org.flowable.engine.RuntimeService;
import org.flowable.task.service.delegate.DelegateTask; import org.flowable.task.service.delegate.DelegateTask;
import java.util.Collections;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_TASK_RELATION_ASSIGNEE_INFO; import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_TASK_RELATION_ASSIGNEE_INFO;
/** /**
@ -47,9 +45,15 @@ public class AutoPassTransactionListener implements TransactionListener {
BpmnTaskDelegateAssigner assigner = BpmnTaskDelegateAssigner.toObjectCompatible( BpmnTaskDelegateAssigner assigner = BpmnTaskDelegateAssigner.toObjectCompatible(
runtimeService.getVariable(delegateTask.getProcessInstanceId(), INTERNAL_TASK_RELATION_ASSIGNEE_INFO + delegateTask.getId())); runtimeService.getVariable(delegateTask.getProcessInstanceId(), INTERNAL_TASK_RELATION_ASSIGNEE_INFO + delegateTask.getId()));
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor(); CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
CommandConfig commandConfig = new CommandConfig().transactionRequiresNew();
commandExecutor.execute(commandConfig, new CustomApproveTaskCmd(delegateTask.getId(), advice, "自动通过", BpmnTaskAuditDTO pass = new BpmnTaskAuditDTO();
Collections.emptyList(), assigner, null)); pass.setTaskId(delegateTask.getId());
pass.setAdvice(advice);
pass.setApprover(assigner);
commandExecutor.execute(new CustomApproveTaskAsyncCmd(pass));
// commandExecutor.execute(commandConfig, new CustomApproveTaskCmd(delegateTask.getId(), advice, "自动通过",
// Collections.emptyList(), assigner, null));
log.info("exec auto pass transaction listener end"); log.info("exec auto pass transaction listener end");
} }