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

This commit is contained in:
wangli 2024-08-08 10:45:15 +08:00
parent 57603aa158
commit aba60920c8
4 changed files with 14 additions and 14 deletions

View File

@ -38,7 +38,7 @@ public class CustomRetryInterceptor extends AbstractCommandInterceptor {
try {
// try to execute the command
log.info("assignableFrom result: {}", AbstractCommand.class.isAssignableFrom(command.getClass()));
log.debug("assignableFrom result: {}", AbstractCommand.class.isAssignableFrom(command.getClass()));
if (AbstractCommand.class.isAssignableFrom(command.getClass())) {
// 如果在以后,重试三次也不能解决的话, 可以利用这里的拿到的参数,重新自动构造CMD,并执行.
log.info("Executing command params: {} traceId:{} ", TraceUtil.traceId(),

View File

@ -43,7 +43,7 @@ public class AutoPassTransactionListener implements TransactionListener {
log.info("exec auto pass transaction listener start, processInstanceId: {}, taskId: {}", delegateTask.getProcessInstanceId(), delegateTask.getId());
// 必须开启新的事务
CommandConfig commandConfig = new CommandConfig(false, TransactionPropagation.REQUIRES_NEW);
CommandConfig commandConfig = new CommandConfig(false, TransactionPropagation.REQUIRED);
CommandExecutor commandExecutor = commandContext.getCommandExecutor();
BpmnTaskDelegateAssigner assigner = BpmnTaskDelegateAssigner.toObjectCompatible(commandExecutor.execute(getVariableCmd()));
commandExecutor.execute(commandConfig, new CustomApproveTaskCmd(delegateTask.getId(), advice, "自动通过",

View File

@ -35,7 +35,7 @@ public class AutoRejectTransactionListener implements TransactionListener {
delegateTask.getProcessInstanceId(), delegateTask.getId());
// 必须开启新的事务
CommandConfig commandConfig = new CommandConfig(false, TransactionPropagation.REQUIRES_NEW);
CommandConfig commandConfig = new CommandConfig(false, TransactionPropagation.REQUIRED);
BpmnTaskAuditDTO taskAudit = new BpmnTaskAuditDTO();
taskAudit.setTaskId(delegateTask.getId());
taskAudit.setApprover(new BpmnTaskDelegateAssigner("系统", "system", delegateTask.getTenantId()));

View File

@ -85,7 +85,7 @@ public class AutoOperatorEvent_101_Listener extends AbstractBpmnEventListener<Ta
boolean exists = checkApproverService.checkApproverExists(delegateTask, userTask, mainProcess, getContext());
log.info("是否需要自动过程判断 exists:{},processInstId:{},taskDefinitionKey:{}", exists, delegateTask.getProcessInstanceId(), delegateTask.getTaskDefinitionKey());
if (exists) {
autoPass(delegateTask, "同一审批人,自动过审");
autoPass(delegateTask, TransactionState.COMMITTED, "同一审批人,自动过审");
}
}
// 检测节点自身配置是否有自动操作
@ -138,10 +138,10 @@ public class AutoOperatorEvent_101_Listener extends AbstractBpmnEventListener<Ta
.ifPresent(approverEmptyHandleTypeEnum -> {
switch (approverEmptyHandleTypeEnum) {
case autoPassed:
autoPass(delegateTask);
autoPass(delegateTask, TransactionState.COMMITTING);
break;
case autoRejection:
autoReject(delegateTask);
autoReject(delegateTask, TransactionState.COMMITTING);
break;
case autoSkipped:
// autoReject(delegateTask);
@ -165,10 +165,10 @@ public class AutoOperatorEvent_101_Listener extends AbstractBpmnEventListener<Ta
.ifPresent(approvalMethodEnum -> {
switch (approvalMethodEnum) {
case autoPassed:
autoPass(delegateTask);
autoPass(delegateTask, TransactionState.COMMITTING);
break;
case autoRejection:
autoReject(delegateTask);
autoReject(delegateTask, TransactionState.COMMITTING);
break;
case bizSpecify:
break;
@ -186,8 +186,8 @@ public class AutoOperatorEvent_101_Listener extends AbstractBpmnEventListener<Ta
*
* @param delegateTask 自动操作的任务
*/
private void autoReject(DelegateTask delegateTask) {
Context.getTransactionContext().addTransactionListener(TransactionState.COMMITTED, new AutoRejectTransactionListener(delegateTask, extAxHiTaskInstService));
private void autoReject(DelegateTask delegateTask, TransactionState transactionState) {
Context.getTransactionContext().addTransactionListener(transactionState, new AutoRejectTransactionListener(delegateTask, extAxHiTaskInstService));
}
/**
@ -198,8 +198,8 @@ public class AutoOperatorEvent_101_Listener extends AbstractBpmnEventListener<Ta
* @param delegateTask 自动操作的任务
* @param advice 添加自动操作任务时的额外意见
*/
private void autoPass(DelegateTask delegateTask, @Nullable String advice) {
Context.getTransactionContext().addTransactionListener(TransactionState.COMMITTED, new AutoPassTransactionListener(delegateTask, advice));
private void autoPass(DelegateTask delegateTask, TransactionState transactionState, @Nullable String advice) {
Context.getTransactionContext().addTransactionListener(transactionState, new AutoPassTransactionListener(delegateTask, advice));
}
/**
@ -207,8 +207,8 @@ public class AutoOperatorEvent_101_Listener extends AbstractBpmnEventListener<Ta
*
* @param delegateTask 自动操作的任务
*/
private void autoPass(DelegateTask delegateTask) {
autoPass(delegateTask, null);
private void autoPass(DelegateTask delegateTask, TransactionState transactionState) {
autoPass(delegateTask, transactionState, null);
}
}