update - 否定行为结束审批时,提供删除原因的展示
This commit is contained in:
parent
219c199bba
commit
28c15e730a
@ -24,6 +24,8 @@ public interface BpmnConstants {
|
||||
String INTERNAL_PROCESS_TYPE_REJECT = "[_INTERNAL_PROCESS_TYPE_REJECT_]";
|
||||
String INTERNAL_PROCESS_TYPE_ABORT = "[_INTERNAL_PROCESS_TYPE_ABORT_]";
|
||||
String INTERNAL_SPECIFY_NEXT_APPROVER = "[_INTERNAL_SPECIFY_NEXT_APPROVER_]";
|
||||
// 取消/驳回/终止时,记录原因
|
||||
String INTERNAL_PROCESS_DELETE_REASON = "[_INTERNAL_PROCESS_DELETE_REASON_]";
|
||||
String BIZ_ORG_RELATION = "[_BIZ_ORG_RELATION_]";
|
||||
String PENDING_TEMPLATE_VARIABLE = "[_PENDING_VARIABLES]";
|
||||
String INTERNAL_PROCESS_AGENT = "[_INTERNAL_PROCESS_AGENT]";
|
||||
|
||||
@ -25,6 +25,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_DELETE_PRO
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_TENANT_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_USER_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_USER_NAME;
|
||||
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;
|
||||
@ -86,11 +87,12 @@ public class CustomAbortProcessInstanceCmd implements Command<Void>, Serializabl
|
||||
variables.put(INTERNAL_END_USER_ID, "system");
|
||||
variables.put(INTERNAL_END_USER_NAME, "系统");
|
||||
variables.put(INTERNAL_DELETE_PROCESS_FLAG, INTERNAL_PROCESS_TYPE_ABORT);
|
||||
variables.put(INTERNAL_PROCESS_DELETE_REASON, reason);
|
||||
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
|
||||
runtimeService.setVariables(instance.getId(), variables);
|
||||
|
||||
CommandContextUtil.getAgenda(commandContext).planOperation(new DeleteProcessInstanceOperation(commandContext,
|
||||
processInstanceId, extAxHiTaskInstService, reason));
|
||||
processInstanceId, extAxHiTaskInstService));
|
||||
|
||||
// 添加自定义的节点,用于展示最后的操作
|
||||
Task task = createVirtualTask(commandContext, extAxHiTaskInstService, processInstanceId,
|
||||
|
||||
@ -22,6 +22,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_DELETE_PRO
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_TENANT_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_USER_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_USER_NAME;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_PROCESS_DELETE_REASON;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_PROCESS_TYPE_CANCEL;
|
||||
import static cn.axzo.workflow.common.enums.BpmnFlowNodeType.NODE_CANCEL;
|
||||
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.ABORTED;
|
||||
@ -86,11 +87,12 @@ public class CustomCancelProcessInstanceCmd implements Command<Void>, Serializab
|
||||
variables.put(INTERNAL_END_USER_ID, initiator.buildAssigneeId());
|
||||
variables.put(INTERNAL_END_USER_NAME, initiator.getAssignerName());
|
||||
variables.put(INTERNAL_DELETE_PROCESS_FLAG, INTERNAL_PROCESS_TYPE_CANCEL);
|
||||
variables.put(INTERNAL_PROCESS_DELETE_REASON, reason);
|
||||
RuntimeService runtimeService = processEngineConfiguration.getRuntimeService();
|
||||
runtimeService.setVariables(instance.getId(), variables);
|
||||
|
||||
CommandContextUtil.getAgenda(commandContext).planOperation(new DeleteProcessInstanceOperation(commandContext,
|
||||
processInstanceId, extAxHiTaskInstService, reason));
|
||||
processInstanceId, extAxHiTaskInstService));
|
||||
|
||||
// 添加自定义的节点,用于展示最后的操作
|
||||
Task task = createVirtualTask(commandContext, extAxHiTaskInstService, processInstanceId,
|
||||
|
||||
@ -25,6 +25,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_DELETE_PRO
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_TENANT_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_USER_ID;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_USER_NAME;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_PROCESS_DELETE_REASON;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_PROCESS_TYPE_REJECT;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.TASK_COMPLETE_OPERATION_TYPE;
|
||||
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.REJECTED;
|
||||
@ -89,9 +90,10 @@ public class CustomRejectionTaskCmd implements Command<Void>, Serializable {
|
||||
variables.put(INTERNAL_END_USER_NAME, approver.getAssignerName());
|
||||
variables.put(INTERNAL_END_USER_ID, approver.buildAssigneeId());
|
||||
variables.put(INTERNAL_DELETE_PROCESS_FLAG, INTERNAL_PROCESS_TYPE_REJECT);
|
||||
variables.put(INTERNAL_PROCESS_DELETE_REASON, reason);
|
||||
runtimeService.setVariables(task.getProcessInstanceId(), variables);
|
||||
CommandContextUtil.getAgenda(commandContext)
|
||||
.planOperation(new DeleteProcessInstanceOperation(commandContext, task.getProcessInstanceId(),
|
||||
extAxHiTaskInstService, reason));
|
||||
extAxHiTaskInstService));
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,14 +25,12 @@ 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, String reason) {
|
||||
ExtAxHiTaskInstService extAxHiTaskInstService) {
|
||||
super(commandContext, null);
|
||||
this.processInstanceId = processInstanceId;
|
||||
this.extAxHiTaskInstService = extAxHiTaskInstService;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -56,8 +54,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);
|
||||
// runtimeService.deleteProcessInstance(processInstanceId, reason);
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ import java.util.Objects;
|
||||
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.FLOW_SERVER_VERSION_121;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_INITIATOR;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_PROCESS_DELETE_REASON;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.WORKFLOW_ENGINE_VERSION;
|
||||
import static cn.axzo.workflow.common.enums.ProcessInstanceEventEnum.PROCESS_INSTANCE_ABORTED;
|
||||
import static cn.axzo.workflow.common.enums.ProcessInstanceEventEnum.PROCESS_INSTANCE_CANCELLED;
|
||||
@ -149,14 +150,10 @@ public class RocketMqBpmnProcessEventListener implements BpmnProcessEventListene
|
||||
.setStartTime(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getStartTime())
|
||||
.setTenantId(((FlowableProcessCancelledEventImpl) event).getExecution().getTenantId())
|
||||
.setBusinessKey(((FlowableProcessCancelledEventImpl) event).getExecution().getProcessInstanceBusinessKey())
|
||||
.setBusinessProcessInstanceName(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getName())
|
||||
.setReason(String.valueOf(event.getCause()));
|
||||
.setBusinessProcessInstanceName(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getName());
|
||||
BpmnMetaParserHelper.getNoticeConfig(mainProcess).ifPresent(dto::setNoticeConf);
|
||||
String version = (String) runtimeService.getVariable(event.getProcessInstanceId(), WORKFLOW_ENGINE_VERSION);
|
||||
if (Objects.isNull(version)) {
|
||||
version = FLOW_SERVER_VERSION_121;
|
||||
}
|
||||
dto.setWorkflowEngineVersion(version);
|
||||
setProcessDeleteReason(event, dto);
|
||||
setWorkflowEngineVersion(event, dto);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_CANCELLED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onCancelled...end: {}", event.getProcessInstanceId());
|
||||
@ -190,14 +187,10 @@ public class RocketMqBpmnProcessEventListener implements BpmnProcessEventListene
|
||||
.setStartTime(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getStartTime())
|
||||
.setTenantId(((FlowableProcessCancelledEventImpl) event).getExecution().getTenantId())
|
||||
.setBusinessKey(((FlowableProcessCancelledEventImpl) event).getExecution().getProcessInstanceBusinessKey())
|
||||
.setBusinessProcessInstanceName(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getName())
|
||||
.setReason(String.valueOf(event.getCause()));
|
||||
.setBusinessProcessInstanceName(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getName());
|
||||
BpmnMetaParserHelper.getNoticeConfig(mainProcess).ifPresent(dto::setNoticeConf);
|
||||
String version = (String) runtimeService.getVariable(event.getProcessInstanceId(), WORKFLOW_ENGINE_VERSION);
|
||||
if (Objects.isNull(version)) {
|
||||
version = FLOW_SERVER_VERSION_121;
|
||||
}
|
||||
dto.setWorkflowEngineVersion(version);
|
||||
setProcessDeleteReason(event, dto);
|
||||
setWorkflowEngineVersion(event, dto);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_REJECTED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onRejected...end: {}", event.getProcessInstanceId());
|
||||
@ -226,18 +219,27 @@ public class RocketMqBpmnProcessEventListener implements BpmnProcessEventListene
|
||||
.setStartTime(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getStartTime())
|
||||
.setTenantId(((FlowableProcessCancelledEventImpl) event).getExecution().getTenantId())
|
||||
.setBusinessKey(((FlowableProcessCancelledEventImpl) event).getExecution().getProcessInstanceBusinessKey())
|
||||
.setBusinessProcessInstanceName(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getName())
|
||||
.setReason(String.valueOf(event.getCause()));
|
||||
.setBusinessProcessInstanceName(((ExecutionEntityImpl) ((FlowableProcessCancelledEventImpl) event).getExecution()).getName());
|
||||
BpmnMetaParserHelper.getNoticeConfig(mainProcess).ifPresent(dto::setNoticeConf);
|
||||
setProcessDeleteReason(event, dto);
|
||||
setWorkflowEngineVersion(event, dto);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_ABORTED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onAborted...end: {}", event.getProcessInstanceId());
|
||||
}
|
||||
}
|
||||
|
||||
private void setProcessDeleteReason(FlowableCancelledEvent event, ProcessInstanceDTO dto) {
|
||||
String processDeleteReason = (String) runtimeService.getVariable(event.getProcessInstanceId(), INTERNAL_PROCESS_DELETE_REASON);
|
||||
dto.setReason(processDeleteReason);
|
||||
}
|
||||
|
||||
private void setWorkflowEngineVersion(FlowableCancelledEvent event, ProcessInstanceDTO dto) {
|
||||
String version = (String) runtimeService.getVariable(event.getProcessInstanceId(), WORKFLOW_ENGINE_VERSION);
|
||||
if (Objects.isNull(version)) {
|
||||
version = FLOW_SERVER_VERSION_121;
|
||||
}
|
||||
dto.setWorkflowEngineVersion(version);
|
||||
sendMessageQueue(dto, PROCESS_INSTANCE_ABORTED);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("MessagePushProcessEventListener#onAborted...end: {}", event.getProcessInstanceId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user