From de041a42164898af38e5a63c57745093ebb03fd7 Mon Sep 17 00:00:00 2001 From: gavin2lee Date: Tue, 18 May 2021 10:09:35 +0800 Subject: [PATCH] #48 proceed user task --- .../taskman/controller/TaskManagementController.java | 8 ++++---- ...ssingTasksReqDto.java => ProceedTasksReqDto.java} | 4 ++-- .../com/webank/taskman/service/TaskInfoService.java | 4 ++-- .../taskman/service/impl/TaskInfoServiceImpl.java | 12 +++++++----- 4 files changed, 15 insertions(+), 13 deletions(-) rename taskman-core/src/main/java/com/webank/taskman/dto/req/{ProcessingTasksReqDto.java => ProceedTasksReqDto.java} (91%) diff --git a/taskman-core/src/main/java/com/webank/taskman/controller/TaskManagementController.java b/taskman-core/src/main/java/com/webank/taskman/controller/TaskManagementController.java index 1e37cc6d..719f7337 100644 --- a/taskman-core/src/main/java/com/webank/taskman/controller/TaskManagementController.java +++ b/taskman-core/src/main/java/com/webank/taskman/controller/TaskManagementController.java @@ -16,7 +16,7 @@ import com.webank.taskman.base.LocalPageableQueryResult; import com.webank.taskman.commons.AuthenticationContextHolder; import com.webank.taskman.dto.TaskInfoDto; -import com.webank.taskman.dto.req.ProcessingTasksReqDto; +import com.webank.taskman.dto.req.ProceedTasksReqDto; import com.webank.taskman.dto.req.TaskInfoQueryReqDto; import com.webank.taskman.dto.req.TemplateQueryReqDto; import com.webank.taskman.dto.req.TaskTemplateSaveReqDto; @@ -134,9 +134,9 @@ public JsonResponse getTaskInfoInstance(@RequestParam("requestId") String reques * @param req * @return */ - @PostMapping("/processing") - public JsonResponse taskInfoProcessing(@Valid @RequestBody ProcessingTasksReqDto req) { - return taskInfoService.taskInfoProcessing(req); + @PostMapping("/proceed") + public JsonResponse taskInfoProcessing(@Valid @RequestBody ProceedTasksReqDto req) { + return taskInfoService.proceedUserTask(req); } } diff --git a/taskman-core/src/main/java/com/webank/taskman/dto/req/ProcessingTasksReqDto.java b/taskman-core/src/main/java/com/webank/taskman/dto/req/ProceedTasksReqDto.java similarity index 91% rename from taskman-core/src/main/java/com/webank/taskman/dto/req/ProcessingTasksReqDto.java rename to taskman-core/src/main/java/com/webank/taskman/dto/req/ProceedTasksReqDto.java index a47c771e..21ee8c2d 100644 --- a/taskman-core/src/main/java/com/webank/taskman/dto/req/ProcessingTasksReqDto.java +++ b/taskman-core/src/main/java/com/webank/taskman/dto/req/ProceedTasksReqDto.java @@ -3,7 +3,7 @@ import java.util.List; -public class ProcessingTasksReqDto { +public class ProceedTasksReqDto { public static final String RESULT_SUCCESSFUL="Successful/Approved"; public static final String RESULT_FAILED="Failed/Rejected"; @@ -35,7 +35,7 @@ public String getResultMessage() { return resultMessage; } - public ProcessingTasksReqDto setResultMessage(String resultMessage) { + public ProceedTasksReqDto setResultMessage(String resultMessage) { this.resultMessage = resultMessage; return this; } diff --git a/taskman-core/src/main/java/com/webank/taskman/service/TaskInfoService.java b/taskman-core/src/main/java/com/webank/taskman/service/TaskInfoService.java index 3c793c4b..9732e419 100644 --- a/taskman-core/src/main/java/com/webank/taskman/service/TaskInfoService.java +++ b/taskman-core/src/main/java/com/webank/taskman/service/TaskInfoService.java @@ -7,7 +7,7 @@ import com.webank.taskman.domain.TaskInfo; import com.webank.taskman.dto.TaskInfoDto; import com.webank.taskman.dto.platform.CoreCancelTaskDto; -import com.webank.taskman.dto.req.ProcessingTasksReqDto; +import com.webank.taskman.dto.req.ProceedTasksReqDto; import com.webank.taskman.dto.req.TaskInfoQueryReqDto; import com.webank.taskman.dto.resp.RequestInfoInstanceResqDto; import com.webank.taskman.dto.resp.TaskInfoRespDto; @@ -23,7 +23,7 @@ public interface TaskInfoService extends IService { // CommonResponseDto createTask(PlatformTaskCreationReqDto req); - JsonResponse taskInfoProcessing(ProcessingTasksReqDto ptr); + JsonResponse proceedUserTask(ProceedTasksReqDto ptr); CommonPlatformResponseDto cancelTask(CoreCancelTaskDto req); diff --git a/taskman-core/src/main/java/com/webank/taskman/service/impl/TaskInfoServiceImpl.java b/taskman-core/src/main/java/com/webank/taskman/service/impl/TaskInfoServiceImpl.java index 4a4172cf..f10d21ab 100644 --- a/taskman-core/src/main/java/com/webank/taskman/service/impl/TaskInfoServiceImpl.java +++ b/taskman-core/src/main/java/com/webank/taskman/service/impl/TaskInfoServiceImpl.java @@ -30,7 +30,7 @@ import com.webank.taskman.domain.TaskInfo; import com.webank.taskman.dto.TaskInfoDto; import com.webank.taskman.dto.platform.CoreCancelTaskDto; -import com.webank.taskman.dto.req.ProcessingTasksReqDto; +import com.webank.taskman.dto.req.ProceedTasksReqDto; import com.webank.taskman.dto.req.TaskInfoQueryReqDto; import com.webank.taskman.dto.resp.FormInfoResqDto; import com.webank.taskman.dto.resp.RequestInfoInstanceResqDto; @@ -96,8 +96,7 @@ public LocalPageableQueryResult selectTaskInfo(Integer page, Intege } @Override - @Transactional - public JsonResponse taskInfoProcessing(ProcessingTasksReqDto req) { + public JsonResponse proceedUserTask(ProceedTasksReqDto req) { TaskInfo taskInfo = getBaseMapper().selectById(req.getRecordId()); String currentUsername = AuthenticationContextHolder.getCurrentUsername(); if (!currentUsername.equals(taskInfo.getReporter())) { @@ -106,7 +105,10 @@ public JsonResponse taskInfoProcessing(ProcessingTasksReqDto req) { if (!"already_received".equals(taskInfo.getStatus())) { throw new TaskmanRuntimeException("Processing failed. The current task is not claimed"); } - callbackByTaskInfo(req, taskInfo); + + //TODO + asyncProceedUserTask(); +// callbackByTaskInfo(req, taskInfo); // List formItemInfos = // formItemInfoConverter.toEntityByReq(req.getFormItemInfoList()); // formInfoService.saveFormInfoAndItems(formItemInfos, @@ -151,7 +153,7 @@ private String convertTaskFormValueDtoToJson(TaskFormValueDto taskFormValueDto) } } - private void callbackByTaskInfo(ProcessingTasksReqDto req, TaskInfo taskInfo) { + private void callbackByTaskInfo(ProceedTasksReqDto req, TaskInfo taskInfo) { // CallbackRequestDto callbackRequest = new CallbackRequestDto(); // CallbackRequestResultDataDto callbackRequestResultDataDto = new // CallbackRequestResultDataDto();