From 7c448aed9f9af52b46645d489371867d02065931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Mon, 3 Jun 2024 16:44:20 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E6=8E=A5=E5=8F=A3=E7=94=A8=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/dromara/workflow/utils/WorkflowUtils.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/utils/WorkflowUtils.java b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/utils/WorkflowUtils.java index 62b1a6e89..385bd23a2 100644 --- a/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/utils/WorkflowUtils.java +++ b/ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/utils/WorkflowUtils.java @@ -49,7 +49,6 @@ import java.util.*; public class WorkflowUtils { private static final ProcessEngine PROCESS_ENGINE = SpringUtils.getBean(ProcessEngine.class); - private static final UserService USER_SERVICE = SpringUtils.getBean(UserService.class); private static final ActHiTaskinstMapper ACT_HI_TASKINST_MAPPER = SpringUtils.getBean(ActHiTaskinstMapper.class); /** @@ -127,6 +126,7 @@ public class WorkflowUtils { * @param taskId 任务id */ public static ParticipantVo getCurrentTaskParticipant(String taskId) { + UserService userService = SpringUtils.getBean(UserService.class); ParticipantVo participantVo = new ParticipantVo(); List linksForTask = PROCESS_ENGINE.getHistoryService().getHistoricIdentityLinksForTask(taskId); Task task = QueryUtils.taskQuery().taskId(taskId).singleResult(); @@ -134,10 +134,10 @@ public class WorkflowUtils { List groupList = StreamUtils.filter(linksForTask, e -> StringUtils.isNotBlank(e.getGroupId())); if (CollUtil.isNotEmpty(groupList)) { List groupIds = StreamUtils.toList(groupList, e -> Long.valueOf(e.getGroupId())); - List userIds = USER_SERVICE.selectUserIdsByRoleIds(groupIds); + List userIds = userService.selectUserIdsByRoleIds(groupIds); if (CollUtil.isNotEmpty(userIds)) { participantVo.setGroupIds(groupIds); - List userList = USER_SERVICE.selectListByIds(userIds); + List userList = userService.selectListByIds(userIds); if (CollUtil.isNotEmpty(userList)) { List userIdList = StreamUtils.toList(userList, UserDTO::getUserId); List nickNames = StreamUtils.toList(userList, UserDTO::getNickName); @@ -156,7 +156,7 @@ public class WorkflowUtils { } } - List userList = USER_SERVICE.selectListByIds(userIdList); + List userList = userService.selectListByIds(userIdList); if (CollUtil.isNotEmpty(userList)) { List userIds = StreamUtils.toList(userList, UserDTO::getUserId); List nickNames = StreamUtils.toList(userList, UserDTO::getNickName); @@ -235,6 +235,7 @@ public class WorkflowUtils { * @param message 消息内容,为空则发送默认配置的消息内容 */ public static void sendMessage(List list, String name, List messageType, String message) { + UserService userService = SpringUtils.getBean(UserService.class); Set userIds = new HashSet<>(); if (StringUtils.isBlank(message)) { message = "有新的【" + name + "】单据已经提交至您的待办,请您及时处理。"; @@ -242,7 +243,7 @@ public class WorkflowUtils { for (Task t : list) { ParticipantVo taskParticipant = WorkflowUtils.getCurrentTaskParticipant(t.getId()); if (CollUtil.isNotEmpty(taskParticipant.getGroupIds())) { - List userIdList = USER_SERVICE.selectUserIdsByRoleIds(taskParticipant.getGroupIds()); + List userIdList = userService.selectUserIdsByRoleIds(taskParticipant.getGroupIds()); if (CollUtil.isNotEmpty(userIdList)) { userIds.addAll(userIdList); } @@ -253,7 +254,7 @@ public class WorkflowUtils { } } if (CollUtil.isNotEmpty(userIds)) { - List userList = USER_SERVICE.selectListByIds(new ArrayList<>(userIds)); + List userList = userService.selectListByIds(new ArrayList<>(userIds)); for (String code : messageType) { MessageTypeEnum messageTypeEnum = MessageTypeEnum.getByCode(code); if (ObjectUtil.isNotEmpty(messageTypeEnum)) {