update - 自动通过/驳回接口,设置任务操作状态

This commit is contained in:
wangli 2024-01-10 09:56:23 +08:00
parent df872bfaf6
commit 0722995947

View File

@ -28,6 +28,9 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_TENANT
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_END_USER_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_END_USER_NAME;
import static cn.axzo.workflow.common.constant.BpmnConstants.INTERNAL_PROCESS_TYPE_REJECT; 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.APPROVED;
import static cn.axzo.workflow.common.enums.BpmnProcessInstanceResultEnum.REJECTED;
import static cn.axzo.workflow.core.common.enums.BpmnProcessTaskResultEnum.REJECTION_AUTO_COMPLETED; import static cn.axzo.workflow.core.common.enums.BpmnProcessTaskResultEnum.REJECTION_AUTO_COMPLETED;
/** /**
@ -104,6 +107,7 @@ public class AutoOperatorEventListener implements BpmnTaskEventListener, Ordered
} }
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), COMMENT_TYPE_OPERATION_DESC taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), COMMENT_TYPE_OPERATION_DESC
, "自动驳回"); , "自动驳回");
delegateTask.setTransientVariable(TASK_COMPLETE_OPERATION_TYPE + delegateTask.getId(), REJECTED.getStatus());
Map<String, Object> variables = new HashMap<>(); Map<String, Object> variables = new HashMap<>();
variables.put(INTERNAL_END_TENANT_ID, delegateTask.getTenantId()); variables.put(INTERNAL_END_TENANT_ID, delegateTask.getTenantId());
variables.put(INTERNAL_END_USER_NAME, "系统"); variables.put(INTERNAL_END_USER_NAME, "系统");
@ -133,6 +137,7 @@ public class AutoOperatorEventListener implements BpmnTaskEventListener, Ordered
} }
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), COMMENT_TYPE_OPERATION_DESC, taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), COMMENT_TYPE_OPERATION_DESC,
"自动通过"); "自动通过");
delegateTask.setTransientVariable(TASK_COMPLETE_OPERATION_TYPE + delegateTask.getId(), APPROVED.getStatus());
taskService.complete(delegateTask.getId(), runtimeService.getVariables(delegateTask.getExecutionId())); taskService.complete(delegateTask.getId(), runtimeService.getVariables(delegateTask.getExecutionId()));
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("AutoOperatorEventListener#autoPass...end: {}", delegateTask.getTaskDefinitionKey()); log.debug("AutoOperatorEventListener#autoPass...end: {}", delegateTask.getTaskDefinitionKey());