feat(REQ-2924) - 测试回退功能
This commit is contained in:
parent
155537c130
commit
ddc4bd64da
@ -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<Void> 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<Void> 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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user