From 45d90d1e7ba86286e998d1ac4d2cba8e98cd059b Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期一, 12 一月 2026 20:52:30 +0800
Subject: [PATCH] feat: 优化内存

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskDispatchSyncUtilService.java |   41 +++++++++++++++++++++++++++++------------
 1 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskDispatchSyncUtilService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskDispatchSyncUtilService.java
index 46d91b1..9c3c5d5 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskDispatchSyncUtilService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskDispatchSyncUtilService.java
@@ -15,6 +15,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 @Slf4j
@@ -322,9 +323,10 @@
             // 鑾峰彇浠诲姟鐨勬墽琛屼汉鍛樹俊鎭垪琛紙鍖呭惈瑙掕壊绫诲瀷锛� //TODO 濡傛灉鏈変袱涓徃鏈哄氨瑕� 璁剧疆銆�Entourage_1鍜孍ntourage_2
             //涓や釜鎶ゅ+灏辫璁剧疆 Entourage_4鍜孍ntourage_6
             //涓や釜鍖荤敓瑕佽缃� Entourage_3鍜孍ntourage_5
-            List<TaskCreateVO.AssigneeInfo> assignees = getTaskAssignees(task.getTaskId());
 
-            if (assignees == null || assignees.isEmpty()) {
+            List<TaskCreateVO.AssigneeInfo> assignees = getTaskAssignees(task.getTaskId());
+            log.info("浠诲姟鐨勬墽琛屼汉鍛�:{}",assignees.stream().map(TaskCreateVO.AssigneeInfo::getUserName).collect(Collectors.joining(",")));
+            if (assignees.isEmpty()) {
                 log.warn("浠诲姟鏃犳墽琛屼汉鍛橈紝浠诲姟ID: {}", task.getTaskId());
                 // 璁剧疆榛樿绌哄��
                 params.put("EntourageLeadID", "");
@@ -342,13 +344,16 @@
             String driverOaId = "";      // 鍙告満鐨凮A_UserID
             String doctorOaId = "";      // 鍖荤敓鐨凮A_UserID
             String nurseOaId = "";       // 鎶ゅ+鐨凮A_UserID
+            String driverOaId2="";
+            String nurseOaId2="";
+            String doctorOaId2="";
 
             // 閬嶅巻鎵ц浜哄憳锛屾牴鎹鑹茬被鍨嬪垎閰嶅埌瀵瑰簲鐨凟ntourage鍙傛暟
             for (int i = 0; i < assignees.size(); i++) {
                 TaskCreateVO.AssigneeInfo assignee = assignees.get(i);
                 Long userId = assignee.getUserId();
                 String userType = assignee.getUserType(); // 鐩存帴浣跨敤鍓嶇浼犻�掔殑瑙掕壊绫诲瀷
-
+                log.info("浜哄憳鍚屾,鐢ㄦ埛ID:{},绫诲瀷锛歿}",userId,userType);
                 if (userId == null) {
                     continue;
                 }
@@ -361,11 +366,15 @@
                 }
 
                 String oaUserId = user.getOaUserId().toString();
-
+                log.info("浜哄憳鍚屾 22222,鐢ㄦ埛ID:{},绫诲瀷锛歿}",userId,userType);
                 // 鏍规嵁鐢ㄦ埛绫诲瀷鍒嗛厤鍒板搴旂殑Entourage鍙傛暟
                 if ("driver".equals(userType)) {
-                    if (driverOaId.isEmpty()) {
-                        driverOaId = oaUserId;
+                        if(driverOaId.isEmpty()){
+                            driverOaId = oaUserId;
+                        }
+                        if(driverOaId2.isEmpty()){
+                            driverOaId2 = oaUserId;
+                        }
                         if(params.get("Entourage_1")==null) {
                             params.put("Entourage_1", oaUserId);
                         }else{
@@ -375,10 +384,14 @@
                         if (i == 0 && leadEntourageId.isEmpty()) {
                             leadEntourageId = "1"; // 鍙告満瀵瑰簲Entourage_1
                         }
-                    }
+
                 } else if ("doctor".equals(userType)) {
                     if (doctorOaId.isEmpty()) {
                         doctorOaId = oaUserId;
+                    }
+                    if(doctorOaId2.isEmpty()){
+                        doctorOaId2 = oaUserId;
+                    }
                         if(params.get("Entourage_3")==null) {
                             params.put("Entourage_3", oaUserId);
                         }else{
@@ -388,10 +401,14 @@
                         if (i == 0 && leadEntourageId.isEmpty()) {
                             leadEntourageId = "3"; // 鍖荤敓瀵瑰簲Entourage_3
                         }
-                    }
+
                 } else if ("nurse".equals(userType)) {
                     if (nurseOaId.isEmpty()) {
                         nurseOaId = oaUserId;
+                    }
+                    if(nurseOaId2.isEmpty()){
+                        nurseOaId2 = oaUserId;
+                    }
                         if(params.get("Entourage_4")==null) {
                             params.put("Entourage_4", oaUserId);
                         }else{
@@ -401,7 +418,7 @@
                         if (i == 0 && leadEntourageId.isEmpty()) {
                             leadEntourageId = "4"; // 鎶ゅ+瀵瑰簲Entourage_4
                         }
-                    }
+
                 }
             }
 
@@ -410,9 +427,9 @@
 //            params.put("Entourage_1", driverOaId);  // 鍙告満
 //            params.put("Entourage_3", doctorOaId);  // 鍖荤敓
 //            params.put("Entourage_4", nurseOaId);   // 鎶ゅ+
-
-//            log.info("浠诲姟鎵ц浜哄憳鍚屾鎴愬姛锛屼换鍔D: {}, 棰嗛槦ID: {}, 鍙告満: {}, 鍖荤敓: {}, 鎶ゅ+: {}",
-//                task.getTaskId(), leadEntourageId, driverOaId, doctorOaId, nurseOaId);
+            log.info("鎵ц浜哄憳:{}", params);
+            log.info("浠诲姟鎵ц浜哄憳鍚屾鎴愬姛锛屼换鍔D: {}, 棰嗛槦ID: {}, 鍙告満: {}, 鍖荤敓: {}, 鎶ゅ+: {}",
+                task.getTaskId(), leadEntourageId, driverOaId, doctorOaId, nurseOaId);
 
         } catch (Exception e) {
             log.error("鍚屾浠诲姟鎵ц浜哄憳寮傚父锛屼换鍔D: {}", task.getTaskId(), e);

--
Gitblit v1.9.1