From 7c448aed9f9af52b46645d489371867d02065931 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期一, 03 六月 2024 16:44:20 +0800
Subject: [PATCH] update 优化 通用接口用法
---
ruoyi-modules/ruoyi-workflow/src/main/java/org/dromara/workflow/utils/WorkflowUtils.java | 13 +++++++------
1 files 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 62b1a6e..385bd23 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 @@
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 @@
* @param taskId 浠诲姟id
*/
public static ParticipantVo getCurrentTaskParticipant(String taskId) {
+ UserService userService = SpringUtils.getBean(UserService.class);
ParticipantVo participantVo = new ParticipantVo();
List<HistoricIdentityLink> linksForTask = PROCESS_ENGINE.getHistoryService().getHistoricIdentityLinksForTask(taskId);
Task task = QueryUtils.taskQuery().taskId(taskId).singleResult();
@@ -134,10 +134,10 @@
List<HistoricIdentityLink> groupList = StreamUtils.filter(linksForTask, e -> StringUtils.isNotBlank(e.getGroupId()));
if (CollUtil.isNotEmpty(groupList)) {
List<Long> groupIds = StreamUtils.toList(groupList, e -> Long.valueOf(e.getGroupId()));
- List<Long> userIds = USER_SERVICE.selectUserIdsByRoleIds(groupIds);
+ List<Long> userIds = userService.selectUserIdsByRoleIds(groupIds);
if (CollUtil.isNotEmpty(userIds)) {
participantVo.setGroupIds(groupIds);
- List<UserDTO> userList = USER_SERVICE.selectListByIds(userIds);
+ List<UserDTO> userList = userService.selectListByIds(userIds);
if (CollUtil.isNotEmpty(userList)) {
List<Long> userIdList = StreamUtils.toList(userList, UserDTO::getUserId);
List<String> nickNames = StreamUtils.toList(userList, UserDTO::getNickName);
@@ -156,7 +156,7 @@
}
}
- List<UserDTO> userList = USER_SERVICE.selectListByIds(userIdList);
+ List<UserDTO> userList = userService.selectListByIds(userIdList);
if (CollUtil.isNotEmpty(userList)) {
List<Long> userIds = StreamUtils.toList(userList, UserDTO::getUserId);
List<String> nickNames = StreamUtils.toList(userList, UserDTO::getNickName);
@@ -235,6 +235,7 @@
* @param message 娑堟伅鍐呭锛屼负绌哄垯鍙戦�侀粯璁ら厤缃殑娑堟伅鍐呭
*/
public static void sendMessage(List<Task> list, String name, List<String> messageType, String message) {
+ UserService userService = SpringUtils.getBean(UserService.class);
Set<Long> userIds = new HashSet<>();
if (StringUtils.isBlank(message)) {
message = "鏈夋柊鐨勩��" + name + "銆戝崟鎹凡缁忔彁浜よ嚦鎮ㄧ殑寰呭姙锛岃鎮ㄥ強鏃跺鐞嗐��";
@@ -242,7 +243,7 @@
for (Task t : list) {
ParticipantVo taskParticipant = WorkflowUtils.getCurrentTaskParticipant(t.getId());
if (CollUtil.isNotEmpty(taskParticipant.getGroupIds())) {
- List<Long> userIdList = USER_SERVICE.selectUserIdsByRoleIds(taskParticipant.getGroupIds());
+ List<Long> userIdList = userService.selectUserIdsByRoleIds(taskParticipant.getGroupIds());
if (CollUtil.isNotEmpty(userIdList)) {
userIds.addAll(userIdList);
}
@@ -253,7 +254,7 @@
}
}
if (CollUtil.isNotEmpty(userIds)) {
- List<UserDTO> userList = USER_SERVICE.selectListByIds(new ArrayList<>(userIds));
+ List<UserDTO> userList = userService.selectListByIds(new ArrayList<>(userIds));
for (String code : messageType) {
MessageTypeEnum messageTypeEnum = MessageTypeEnum.getByCode(code);
if (ObjectUtil.isNotEmpty(messageTypeEnum)) {
--
Gitblit v1.9.3