From e7a31194edbad61f9106776a0037be6168a822b4 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 4 May 2023 15:47:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E6=97=B6=E8=8E=B7=E5=8F=96=20?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=94=A8=E6=88=B7=E4=B8=8B=E4=B8=80=E4=B8=AA?= =?UTF-8?q?taskId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TodoCenterController.java | 8 +++ .../pmapi/todocenter/manage/TodoCenterManage.java | 61 +++++++++++++++------- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java index b2bd213..972e963 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/controller/TodoCenterController.java @@ -40,6 +40,14 @@ public class TodoCenterController { private final TodoCenterManage todoCenterManage; /** + * 实时取当前操作人 某个工作流的下一个操作taskId + */ + @GetMapping("/todo/taskId/{instanceId}") + public String todoTaskId(@PathVariable String instanceId){ + return todoCenterManage.todoTaskId(instanceId); + } + + /** * 待办中心-待我处理项目列表查询 * @param param * @return diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 7b17a49..75e590c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -388,26 +388,6 @@ public class TodoCenterManage { } /** - * 寻找下一个审核task - * @param instance - * @return - */ - private String findNextTaskId(HistoricProcessInstance instance,String employeeCode) { - List userTasks = runtimeService.createActivityInstanceQuery() - .activityType("userTask") - .processInstanceId(instance.getId()) - .taskAssignee(employeeCode) - .orderByActivityInstanceStartTime() - .desc() - .unfinished() - .list(); - if(CollUtil.isEmpty(userTasks)){ - return "处理成功"; - } - return userTasks.get(0).getTaskId(); - } - - /** * 调用IRS接口,获取盖章后的pdf文件,上传到OSS,并保存文件ID到项目库中 * @param req * @param declaredProject @@ -1223,4 +1203,45 @@ public class TodoCenterManage { } return todoNumVo; } + + /** + * 寻找下一个审核task + * @param instance + * @return + */ + private String findNextTaskId(HistoricProcessInstance instance,String employeeCode) { + List userTasks = runtimeService.createActivityInstanceQuery() + .activityType("userTask") + .processInstanceId(instance.getId()) + .taskAssignee(employeeCode) + .orderByActivityInstanceStartTime() + .asc() + .unfinished() + .list(); + if(CollUtil.isEmpty(userTasks)){ + return "处理成功"; + } + return userTasks.get(0).getTaskId(); + } + + /** + * 取当前用户的下一个taskId + * @param instanceId + * @return + */ + public String todoTaskId(String instanceId) { + String employeeCode = LoginUserUtil.loginUserDetail().getEmployeeCode(); + List userTasks = runtimeService.createActivityInstanceQuery() + .activityType("userTask") + .processInstanceId(instanceId) + .taskAssignee(employeeCode) + .orderByActivityInstanceStartTime() + .asc() + .unfinished() + .list(); + if(CollUtil.isEmpty(userTasks)){ + return null; + } + return userTasks.get(0).getTaskId(); + } }