feat(REQ-4418) - 调整新版配置中的最后操作人获取的问题

This commit is contained in:
wangli 2025-08-29 15:15:05 +08:00
parent d36a53b7fe
commit d4ca0dc538
5 changed files with 27 additions and 8 deletions

View File

@ -24,12 +24,21 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.*; import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_INSTANCE_CANCEL_FAIL_NOT_EXISTS;
import static cn.axzo.workflow.common.constant.BpmnConstants.*; import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_INSTANCE_CANT_ABORT;
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_INSTANCE_NOT_EXISTS;
import static cn.axzo.workflow.common.constant.BpmnConstants.CLOSE_PROCESS_ASSIGNER;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_DELETE_PROCESS_FLAG;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_PROCESS_DELETE_REASON;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_PROCESS_TYPE_ABORT;
import static cn.axzo.workflow.common.constant.BpmnConstants.TASK_ASSIGNEE_SKIP_FLAT;
import static cn.axzo.workflow.common.constant.BpmnConstants.TASK_COMPLETE_OPERATION_TYPE;
import static cn.axzo.workflow.common.enums.BpmnFlowNodeType.NODE_ABORT; import static cn.axzo.workflow.common.enums.BpmnFlowNodeType.NODE_ABORT;
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.ABORTED; import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.ABORTED;
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.CANCELLED; import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.CANCELLED;
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.*; import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.batchAddAttachment;
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.completeVirtualTask;
import static cn.axzo.workflow.core.engine.cmd.helper.CustomTaskHelper.createVirtualTask;
/** /**
* 自定义的中止流程实例的命令实现 * 自定义的中止流程实例的命令实现
@ -119,7 +128,9 @@ public class CustomAbortProcessInstanceCmd extends AbstractCommand<Void> impleme
batchAddAttachment(commandContext, task.getProcessInstanceId(), task, attachmentList, assigner); batchAddAttachment(commandContext, task.getProcessInstanceId(), task, attachmentList, assigner);
completeVirtualTask(commandContext, task); completeVirtualTask(commandContext, task);
runtimeService.setVariable(processInstanceId, CLOSE_PROCESS_ASSIGNER, assigner); if (Objects.nonNull(assigner)) {
runtimeService.setVariable(processInstanceId, CLOSE_PROCESS_ASSIGNER, assigner);
}
return null; return null;
} }

View File

@ -161,7 +161,9 @@ public class CustomApproveTaskCmd extends AbstractCommand<Void> implements Seria
resetApproverNode(task.getProcessInstanceId()); resetApproverNode(task.getProcessInstanceId());
runtimeService.setVariable(task.getProcessInstanceId(), CLOSE_PROCESS_ASSIGNER, approver); if (Objects.nonNull(approver)) {
runtimeService.setVariable(task.getProcessInstanceId(), CLOSE_PROCESS_ASSIGNER, approver);
}
executeSynchronous(task, taskService, runtimeService); executeSynchronous(task, taskService, runtimeService);
return null; return null;

View File

@ -180,7 +180,9 @@ public class CustomApproveTaskWithFormCmd extends AbstractCommand<Void> implemen
resetApproverNode(task.getProcessInstanceId()); resetApproverNode(task.getProcessInstanceId());
runtimeService.setVariable(task.getProcessInstanceId(), CLOSE_PROCESS_ASSIGNER, approver); if (Objects.nonNull(approver)) {
runtimeService.setVariable(task.getProcessInstanceId(), CLOSE_PROCESS_ASSIGNER, approver);
}
executeSynchronous(task, taskService, runtimeService, commandContext, historicTaskInstance.getTenantId()); executeSynchronous(task, taskService, runtimeService, commandContext, historicTaskInstance.getTenantId());
return null; return null;

View File

@ -140,7 +140,9 @@ public class CustomCancelProcessInstanceCmd extends AbstractCommand<Void> implem
completeVirtualTask(commandContext, task); completeVirtualTask(commandContext, task);
runtimeService.setVariable(task.getProcessInstanceId(), CLOSE_PROCESS_ASSIGNER, initiator); if (Objects.nonNull(initiator)) {
runtimeService.setVariable(task.getProcessInstanceId(), CLOSE_PROCESS_ASSIGNER, initiator);
}
return null; return null;
} }

View File

@ -125,7 +125,9 @@ public class CustomRejectionTaskCmd extends AbstractCommand<Void> implements Ser
variables.put(INTERNAL_DELETE_PROCESS_FLAG, INTERNAL_PROCESS_TYPE_REJECT); variables.put(INTERNAL_DELETE_PROCESS_FLAG, INTERNAL_PROCESS_TYPE_REJECT);
variables.put(INTERNAL_PROCESS_DELETE_REASON, reason); variables.put(INTERNAL_PROCESS_DELETE_REASON, reason);
runtimeService.setVariables(task.getProcessInstanceId(), variables); runtimeService.setVariables(task.getProcessInstanceId(), variables);
runtimeService.setVariable(task.getProcessInstanceId(), CLOSE_PROCESS_ASSIGNER, approver); if (Objects.nonNull(approver)) {
runtimeService.setVariable(task.getProcessInstanceId(), CLOSE_PROCESS_ASSIGNER, approver);
}
CommandContextUtil.getAgenda(commandContext) CommandContextUtil.getAgenda(commandContext)
.planOperation(new DeleteProcessInstanceOperation(commandContext, task.getProcessInstanceId(), .planOperation(new DeleteProcessInstanceOperation(commandContext, task.getProcessInstanceId(),
extAxHiTaskInstService, REJECTED)); extAxHiTaskInstService, REJECTED));