update - 终止/驳回/取消,将审批建议返回填入审批实例的删除原因中

This commit is contained in:
wangli 2024-03-19 19:03:17 +08:00
parent 476e3d6cca
commit 07229db287
4 changed files with 12 additions and 7 deletions

View File

@ -90,7 +90,7 @@ public class CustomAbortProcessInstanceCmd implements Command<Void>, Serializabl
runtimeService.setVariables(instance.getId(), variables);
CommandContextUtil.getAgenda(commandContext).planOperation(new DeleteProcessInstanceOperation(commandContext,
processInstanceId, extAxHiTaskInstService));
processInstanceId, extAxHiTaskInstService, reason));
// 添加自定义的节点,用于展示最后的操作
Task task = createVirtualTask(commandContext, extAxHiTaskInstService, processInstanceId,

View File

@ -90,7 +90,7 @@ public class CustomCancelProcessInstanceCmd implements Command<Void>, Serializab
runtimeService.setVariables(instance.getId(), variables);
CommandContextUtil.getAgenda(commandContext).planOperation(new DeleteProcessInstanceOperation(commandContext,
processInstanceId, extAxHiTaskInstService));
processInstanceId, extAxHiTaskInstService, reason));
// 添加自定义的节点,用于展示最后的操作
Task task = createVirtualTask(commandContext, extAxHiTaskInstService, processInstanceId,

View File

@ -71,11 +71,12 @@ public class CustomRejectionTaskCmd implements Command<Void>, Serializable {
batchAddAttachment(commandContext, task.getProcessInstanceId(), task.getId(), attachmentList, approver);
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
finishProcessInstance(commandContext, runtimeService, task);
finishProcessInstance(commandContext, runtimeService, task, advice);
return null;
}
private void finishProcessInstance(CommandContext commandContext, RuntimeService runtimeService, Task task) {
private void finishProcessInstance(CommandContext commandContext, RuntimeService runtimeService, Task task,
String reason) {
Map<String, Object> variables = new HashMap<>();
variables.put(INTERNAL_END_TENANT_ID, approver.getTenantId());
variables.put(INTERNAL_END_USER_NAME, approver.getAssignerName());
@ -84,6 +85,6 @@ public class CustomRejectionTaskCmd implements Command<Void>, Serializable {
runtimeService.setVariables(task.getProcessInstanceId(), variables);
CommandContextUtil.getAgenda(commandContext)
.planOperation(new DeleteProcessInstanceOperation(commandContext, task.getProcessInstanceId(),
extAxHiTaskInstService));
extAxHiTaskInstService, reason));
}
}

View File

@ -25,12 +25,14 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.HIDDEN_ASSIGNEE_ID;
public class DeleteProcessInstanceOperation extends AbstractOperation {
private final String processInstanceId;
private final ExtAxHiTaskInstService extAxHiTaskInstService;
private final String reason;
public DeleteProcessInstanceOperation(CommandContext commandContext, String processInstanceId,
ExtAxHiTaskInstService extAxHiTaskInstService) {
ExtAxHiTaskInstService extAxHiTaskInstService, String reason) {
super(commandContext, null);
this.processInstanceId = processInstanceId;
this.extAxHiTaskInstService = extAxHiTaskInstService;
this.reason = reason;
}
@Override
@ -54,6 +56,8 @@ public class DeleteProcessInstanceOperation extends AbstractOperation {
}
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
runtimeService.deleteProcessInstance(processInstanceId, HIDDEN_ASSIGNEE_ID);
// runtimeService.deleteProcessInstance(processInstanceId, HIDDEN_ASSIGNEE_ID);
// 将结束流程实例的原因记录下来
runtimeService.deleteProcessInstance(processInstanceId, reason);
}
}