From 0765f481ffcb13cdce660265fcbb2bcfea44f736 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 17 Jan 2022 23:53:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=2095%=20-=20=E6=8E=A5=E5=85=A5=E4=BB=BB=E5=8A=A1=E7=9A=84?= =?UTF-8?q?=E8=BD=AC=E6=B4=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/task/BpmTaskController.java | 7 ++ .../vo/task/BpmTaskUpdateAssigneeReqVO.java | 25 ++++++ .../bpm/service/task/BpmTaskService.java | 10 ++- .../service/task/impl/BpmTaskServiceImpl.java | 17 +++- yudao-admin-ui/src/api/bpm/task.js | 8 ++ .../src/views/bpm/processInstance/detail.vue | 78 +++++++++++++++++-- 6 files changed, 138 insertions(+), 7 deletions(-) create mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/vo/task/BpmTaskUpdateAssigneeReqVO.java diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/BpmTaskController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/BpmTaskController.java index 324fda596..5f4640a3d 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/BpmTaskController.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/BpmTaskController.java @@ -57,6 +57,13 @@ public class BpmTaskController { return success(true); } + @PutMapping("/update-assignee") + @ApiOperation(value = "更新任务的负责人", notes = "用于【流程详情】的【转派】按钮") + public CommonResult updateTaskAssignee(@Valid @RequestBody BpmTaskUpdateAssigneeReqVO reqVO) { + taskService.updateTaskAssignee(getLoginUserId(), reqVO); + return success(true); + } + @GetMapping("/historic-list-by-process-instance-id") @ApiOperation(value = "获得指定流程实例的任务列表", notes = "包括完成的、未完成的") @ApiImplicitParam(name = "processInstanceId", value = "流程实例的编号", required = true, dataTypeClass = String.class) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/vo/task/BpmTaskUpdateAssigneeReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/vo/task/BpmTaskUpdateAssigneeReqVO.java new file mode 100644 index 000000000..0ad6fbedc --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/task/vo/task/BpmTaskUpdateAssigneeReqVO.java @@ -0,0 +1,25 @@ +package cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import net.bytebuddy.implementation.bind.annotation.Empty; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +@ApiModel("流程任务的更新负责人的 Request VO") +@Data +public class BpmTaskUpdateAssigneeReqVO { + + @ApiModelProperty(value = "任务编号", required = true, example = "1024") + @NotEmpty(message = "任务编号不能为空") + private String id; + + @ApiModelProperty(value = "新审批人的用户编号", required = true, example = "2048") + @NotNull(message = "新审批人的用户编号不能为空") + private Long assigneeUserId; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/BpmTaskService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/BpmTaskService.java index 971e4c510..61568c8da 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/BpmTaskService.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/BpmTaskService.java @@ -69,13 +69,21 @@ public interface BpmTaskService { */ PageResult getDoneTaskPage(Long userId, BpmTaskDonePageReqVO pageReqVO); + /** + * 将流程任务分配给指定用户 + * + * @param userId 用户编号 + * @param reqVO 分配请求 + */ + void updateTaskAssignee(Long userId, BpmTaskUpdateAssigneeReqVO reqVO); + /** * 将流程任务分配给指定用户 * * @param id 流程任务编号 * @param userId 用户编号 */ - void updateTaskAssign(String id, Long userId); + void updateTaskAssignee(String id, Long userId); /** * 通过任务 diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java index 933b43c3f..e329ab7e3 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java @@ -195,7 +195,22 @@ public class BpmTaskServiceImpl implements BpmTaskService { } @Override - public void updateTaskAssign(String id, Long userId) { + public void updateTaskAssignee(Long userId, BpmTaskUpdateAssigneeReqVO reqVO) { + // 校验任务存在 + Task task = getTask(reqVO.getId()); + if (task == null) { + throw exception(TASK_COMPLETE_FAIL_NOT_EXISTS); + } + if (!ActivitiUtils.equals(task.getAssignee(), userId)) { + throw exception(TASK_COMPLETE_FAIL_ASSIGN_NOT_SELF); + } + + // 更新负责人 + updateTaskAssignee(task.getId(), reqVO.getAssigneeUserId()); + } + + @Override + public void updateTaskAssignee(String id, Long userId) { taskService.setAssignee(id, String.valueOf(userId)); } diff --git a/yudao-admin-ui/src/api/bpm/task.js b/yudao-admin-ui/src/api/bpm/task.js index 650186e96..4e2ce65c4 100644 --- a/yudao-admin-ui/src/api/bpm/task.js +++ b/yudao-admin-ui/src/api/bpm/task.js @@ -40,6 +40,14 @@ export function rejectTask(data) { }) } +export function updateTaskAssignee(data) { + return request({ + url: '/bpm/task/update-assignee', + method: 'PUT', + data: data + }) +} + export function getHistoricTaskListByProcessInstanceId(processInstanceId) { return request({ url: '/bpm/task/historic-list-by-process-instance-id?processInstanceId=' + processInstanceId, diff --git a/yudao-admin-ui/src/views/bpm/processInstance/detail.vue b/yudao-admin-ui/src/views/bpm/processInstance/detail.vue index 9b2ac8277..6222f30ac 100644 --- a/yudao-admin-ui/src/views/bpm/processInstance/detail.vue +++ b/yudao-admin-ui/src/views/bpm/processInstance/detail.vue @@ -21,7 +21,7 @@
通过 不通过 - + 转办 委派 退回
@@ -75,18 +75,34 @@ + + + + + + + + + + + +