From 04d04154d9041535342736bd1c924ade5d818614 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期一, 09 十一月 2026 16:45:07 +0800
Subject: [PATCH] 合并修改com/ruoyi/quartz/task/RyTacom/ruoyi/quartz/task/RyTask.java:3sk.java:3com/ruoyi/quart/task/RyTask.java:3

---
 ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java |   47 +++++++++++++++++++++++++++++++----------------
 1 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java b/ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java
index eb6683c..9f570dc 100644
--- a/ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java
+++ b/ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java
@@ -913,7 +913,7 @@
             serviceOutPath.setSubId(serviceSubtask1.getId());
             List<ServiceOutPath> serviceOutPaths = serviceOutPathMapper.selectServiceOutPathList(serviceOutPath);
             if (CollectionUtils.isNotEmpty(serviceOutPaths))
-                format = String.format("%03X", serviceOutPaths.get(0).getId());
+                format = ShortCode.encode(serviceOutPaths.get(0).getId());
             else format = getOutPath(serviceSubtask1, rsaPublicKeyExample);
             serviceSubtask = serviceSubtask1;
         } else {
@@ -965,7 +965,7 @@
         serviceOutPath.setSubId(serviceSubtask.getId());
         iServiceOutPathService.insertServiceOutPath(serviceOutPath);
         //杞垚16杩涘埗
-        format = String.format("%03X", serviceOutPath.getId());
+        format = ShortCode.encode(serviceOutPath.getId());
         serviceOutPath.setRadix(format);
         serviceOutPath.setUpdateTime(new Date());
         iServiceOutPathService.updateServiceOutPath(serviceOutPath);
@@ -2459,7 +2459,10 @@
             if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
                 groupKey = drcode;
             } else {
-                groupKey = "deptcode";
+                // 2026-11 瀛楁閲嶅懡鍚嶅悗锛歞eptcode 鏄湪闄㈢瀹わ紙鍘嗗彶鏁版嵁涓虹┖锛夛紝
+                // 鍑洪櫌绉戝宸叉敼鍚嶄负 leaveldeptcode锛屽垎缁勫繀椤荤敤鍚庤�咃紝
+                // 鍚﹀垯 getSfStatisticsGroupKey 浼氳繑鍥� NULL锛屾嫾鎴� IN (NULL) 瀵艰嚧鏁磋〃鏌ョ┖銆�
+                groupKey = "leaveldeptcode";
             }
         } else if (serviceSubtaskCountReq.getStatisticaltype() != null && serviceSubtaskCountReq.getStatisticaltype() == 3) {
             // 鐥呯缁熻锛氭寜浠诲姟ID鍒嗙粍锛屾瘡涓换鍔″嵆涓�涓梾绉嶉殢璁夸换鍔�
@@ -2470,6 +2473,17 @@
         Map<String, List<ServiceSubtask>> collect = new HashMap<>();
         serviceSubtaskCountReq.setGroupKey(groupKey);
         List<String> groupKeyList = serviceSubtaskMapper.getSfStatisticsGroupKey(serviceSubtaskCountReq);
+        /*
+         * 鍒嗙粍閿彲鑳戒负 NULL锛堝巻鍙叉暟鎹�佹垨閲嶅懡鍚嶅悗灏氭湭鍥炲~鐨勫湪闄㈢淮搴﹀垪锛夛紝
+         * 鐩存帴鎷艰繘 SQL 浼氬彉鎴� `AND IFNULL(鍒�,'Unknown') IN (NULL)`锛屾亽涓嶆垚绔嬶紝鏁村紶缁熻琛ㄤ负绌恒��
+         * 杩欓噷缁熶竴鎴� 'Unknown'锛屼笌鑱氬悎 SQL 鐨� IFNULL(鍒�,'Unknown') 鍙e緞瀵归綈銆�
+         */
+        if (groupKeyList != null) {
+            groupKeyList = groupKeyList.stream()
+                    .map(key -> key == null ? "Unknown" : key)
+                    .distinct()
+                    .collect(Collectors.toList());
+        }
         serviceSubtaskCountReq.setGroupKeyList(groupKeyList);
         List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
         switch (groupKey) {
@@ -2484,6 +2498,7 @@
                 collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getManagementDoctorCode()).orElse("Unknown")));
                 break;
             case "deptcode":
+            case "leaveldeptcode":
                 collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeaveldeptcode()).orElse("Unknown")));
                 break;
             case "leavehospitaldistrictcode":
@@ -3100,7 +3115,7 @@
     }
 
     /**
-     * 鍐嶆闅忚闄勫姞缁熻锛氬緟闅忚銆佸凡鍙戦�併�佷汉宸ョ數璇濊秴鏃跺強鍥為櫌澶嶈瘖澶嶆煡锛坰uggest=6锛夈��
+     * 鍐嶆闅忚闄勫姞缁熻锛氬緟闅忚銆佸凡鍙戦�併�佷汉宸ョ數璇濊秴鏃跺強鍥為櫌澶嶈瘖澶嶆煡锛坰uggest=7锛夈��
      */
     private void applyAgainFollowUpExtraStatistics(ServiceSubtaskStatistic statistic, ServiceSubtask serviceSubtask) {
         if (serviceSubtask.getVisitCount() == null || serviceSubtask.getVisitCount() <= 1) {
@@ -3110,9 +3125,9 @@
             return;
         }
         Long sendstate = serviceSubtask.getSendstate();
-        // 鍥為櫌澶嶈瘖澶嶆煡锛氬啀娆¢殢璁夸腑鎸夊鐞嗘剰瑙� suggest=6 缁熻
-        if (StringUtils.equals("6", StringUtils.trim(serviceSubtask.getSuggest()))) {
-            statistic.setSuggest6CountAgain(statistic.getSuggest6CountAgain() + 1L);
+        // 鍥為櫌澶嶈瘖澶嶆煡锛氬啀娆¢殢璁夸腑鎸夊鐞嗘剰瑙� suggest=7 缁熻
+        if (StringUtils.equals("7", StringUtils.trim(serviceSubtask.getSuggest()))) {
+            statistic.setSuggest7CountAgain(statistic.getSuggest7CountAgain() + 1L);
         }
         if (sendstate.equals(3L)) {
             statistic.setSentAgain(statistic.getSentAgain() + 1L);
@@ -3758,7 +3773,7 @@
      * pendingFollowUpSentAgainInfo - visitCount > 1 && sendstate in (3,7)
      * sentInfo - visitCount = 1 && sendstate = 3
      * sentAgainInfo - visitCount > 1 && sendstate = 3
-     * suggest6CountAgainInfo - visitCount > 1 && suggest = 6
+     * suggest7CountAgainInfo - visitCount > 1 && suggest = 7
      * filterCountList - taskSituation = 6 && sendstate = 4
      *
      */
@@ -3943,10 +3958,10 @@
                 serviceSubtaskCountReq.setVisitCount(2);
                 serviceSubtaskCountReq.setExcep("1");
                 break;
-            case "suggest6CountAgainInfo":
-                // 鍐嶆闅忚鍥為櫌澶嶈瘖澶嶆煡锛歷isitCount > 1 涓� suggest = 6
+            case "suggest7CountAgainInfo":
+                // 鍐嶆闅忚鍥為櫌澶嶈瘖澶嶆煡锛歷isitCount > 1 涓� suggest = 7
                 serviceSubtaskCountReq.setVisitCount(2);
-                serviceSubtaskCountReq.setSuggest("6");
+                serviceSubtaskCountReq.setSuggest("7");
                 break;
             case "taskSituation1Info":
                 serviceSubtaskCountReq.setTaskSituation(1);
@@ -4505,7 +4520,7 @@
         total.setSentAgain(0L);
         total.setFollowUpSuccessAgain(0L);
         total.setFollowUpFailAgain(0L);
-        total.setSuggest6CountAgain(0L);
+        total.setSuggest7CountAgain(0L);
         total.setManualAgain(0L);
         total.setSmsAgain(0L);
         total.setWeChatAgain(0L);
@@ -4550,7 +4565,7 @@
             total.setSentAgain(total.getSentAgain() + (stat.getSentAgain() != null ? stat.getSentAgain() : 0L));
             total.setFollowUpSuccessAgain(total.getFollowUpSuccessAgain() + (stat.getFollowUpSuccessAgain() != null ? stat.getFollowUpSuccessAgain() : 0L));
             total.setFollowUpFailAgain(total.getFollowUpFailAgain() + (stat.getFollowUpFailAgain() != null ? stat.getFollowUpFailAgain() : 0L));
-            total.setSuggest6CountAgain(total.getSuggest6CountAgain() + (stat.getSuggest6CountAgain() != null ? stat.getSuggest6CountAgain() : 0L));
+            total.setSuggest7CountAgain(total.getSuggest7CountAgain() + (stat.getSuggest7CountAgain() != null ? stat.getSuggest7CountAgain() : 0L));
             total.setManualAgain(total.getManualAgain() + (stat.getManualAgain() != null ? stat.getManualAgain() : 0L));
             total.setSmsAgain(total.getSmsAgain() + (stat.getSmsAgain() != null ? stat.getSmsAgain() : 0L));
             total.setWeChatAgain(total.getWeChatAgain() + (stat.getWeChatAgain() != null ? stat.getWeChatAgain() : 0L));
@@ -5128,7 +5143,7 @@
         serviceOutPath.setCreateTime(new Date());
         serviceOutPath.setOrgid(serviceSubtask.getOrgid());
         iServiceOutPathService.insertServiceOutPath(serviceOutPath);
-        String format = String.format("%03X", serviceOutPath.getId());
+        String format = ShortCode.encode(serviceOutPath.getId());
         String url = "";
         SendMagParam sendMagParam = new SendMagParam();
         sendMagParam.setType("4");
@@ -5212,7 +5227,7 @@
             serviceOutPath.setCreateTime(new Date());
             serviceOutPath.setOrgid(serviceSubtask.getOrgid());
             iServiceOutPathService.insertServiceOutPath(serviceOutPath);
-            String format = String.format("%03X", serviceOutPath.getId());
+            String format = ShortCode.encode(serviceOutPath.getId());
             serviceOutPath.setRadix(format);
             serviceOutPath.setUpdateTime(new Date());
             serviceOutPath.setUrl(url);
@@ -5427,7 +5442,7 @@
                         serviceOutPath.setCreateTime(new Date());
                         serviceOutPath.setOrgid(serviceTask.getOrgid());
                         iServiceOutPathService.insertServiceOutPath(serviceOutPath);
-                        String format = String.format("%03X", serviceOutPath.getId());
+                        String format = ShortCode.encode(serviceOutPath.getId());
                         serviceOutPath.setRadix(format);
                         serviceOutPath.setUpdateTime(new Date());
                         String url = StringUtils.isNotEmpty(req_path) ? ip + ":" + req_path + "/wt?p=" + format : ip + "/wt?p=" + format;

--
Gitblit v1.9.3