diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/cmd/CustomBackTaskCmd.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/cmd/CustomBackTaskCmd.java index 2535978b0..6acc44fa0 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/cmd/CustomBackTaskCmd.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/engine/cmd/CustomBackTaskCmd.java @@ -12,7 +12,6 @@ import org.flowable.engine.impl.util.CommandContextUtil; import org.flowable.task.api.history.HistoricTaskInstance; import org.flowable.task.api.history.HistoricTaskInstanceQuery; import org.flowable.task.service.impl.persistence.entity.TaskEntity; -import org.springframework.util.StringUtils; import java.io.Serializable; import java.util.Collections; @@ -68,24 +67,20 @@ public class CustomBackTaskCmd extends AbstractCommand implements Serializ @Override public Void execute(CommandContext commandContext) { ProcessEngineConfigurationImpl processEngineConfiguration = - CommandContextUtil.getProcessEngineConfiguration(commandContext); + CommandContextUtil.getProcessEngineConfiguration(commandContext); HistoricTaskInstanceQuery taskQuery = - processEngineConfiguration.getHistoryService().createHistoricTaskInstanceQuery(); + processEngineConfiguration.getHistoryService().createHistoricTaskInstanceQuery(); TaskService taskService = processEngineConfiguration.getTaskService(); HistoricTaskInstance historicTaskInstance = taskQuery.taskId(dto.getTaskId()).singleResult(); TaskEntity task = (TaskEntity) taskService.createTaskQuery().taskId(dto.getTaskId()).singleResult(); validTask(historicTaskInstance, task, dto.getApprover(), dto.getNodeTypes()); - if (StringUtils.hasLength(dto.getAdvice())) { - Authentication.setAuthenticatedUserId(dto.getApprover().buildAssigneeId()); - addComment(commandContext, task, COMMENT_TYPE_ADVICE, dto.getAdvice()); - Authentication.setAuthenticatedUserId(null); - } batchAddAttachment(commandContext, task.getProcessInstanceId(), dto.getTaskId(), dto.getAttachmentList(), dto.getApprover()); - Authentication.setAuthenticatedUserId(Objects.nonNull(dto.getApprover()) ? dto.getApprover().buildAssigneeId() : null); + Authentication.setAuthenticatedUserId(dto.getApprover().buildAssigneeId()); + addComment(commandContext, task, COMMENT_TYPE_ADVICE, dto.getAdvice()); addComment(commandContext, task, COMMENT_TYPE_OPERATION_DESC, operationDesc); Authentication.setAuthenticatedUserId(null); @@ -93,9 +88,9 @@ public class CustomBackTaskCmd extends AbstractCommand implements Serializ task.setTransientVariable(TASK_COMPLETE_OPERATION_TYPE + dto.getTaskId(), BACKED.getStatus()); runtimeService.createChangeActivityStateBuilder() - .processInstanceId(task.getProcessInstanceId()) - .moveActivityIdsToSingleActivityId(Collections.singletonList(task.getTaskDefinitionKey()), dto.getToActivityId()) - .changeState(); + .processInstanceId(task.getProcessInstanceId()) + .moveActivityIdsToSingleActivityId(Collections.singletonList(task.getTaskDefinitionKey()), dto.getToActivityId()) + .changeState(); return null; }