From 2c3d8abefd778b7aa9b9ee69ff3fdb02b31f4865 Mon Sep 17 00:00:00 2001
From: tjx <t2856754968@163.com>
Date: 星期二, 23 十二月 2025 16:01:39 +0800
Subject: [PATCH] 111

---
 src/test/java/com/gs/dingtalk/DeviceReceivingApplicationTests.java |   55 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/src/test/java/com/gs/dingtalk/DeviceReceivingApplicationTests.java b/src/test/java/com/gs/dingtalk/DeviceReceivingApplicationTests.java
index 71afa7f..8e3997b 100644
--- a/src/test/java/com/gs/dingtalk/DeviceReceivingApplicationTests.java
+++ b/src/test/java/com/gs/dingtalk/DeviceReceivingApplicationTests.java
@@ -9,6 +9,7 @@
 import com.gs.dingtalk.service.SimpleExample;
 import com.gs.dingtalk.service.VwCjScSjTsBbService;
 import com.gs.dingtalk.service.WorkWXService;
+import com.gs.dingtalk.service.QwCheckinDayDataService;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -33,6 +34,9 @@
 
     @Autowired
     private QwCheckinDataService qwCheckinDataService;
+
+    @Autowired
+    private QwCheckinDayDataService qwCheckinDayDataService;
 
     /**
      * 娴嬭瘯瀵煎嚭鐢熶骇鏁版嵁骞跺彂閫侀拤閽夋秷鎭�
@@ -280,19 +284,16 @@
                     // 鎵撳嵃寮傚父淇℃伅
                     if (data.getExceptionInfos() != null && !data.getExceptionInfos().isEmpty()) {
                         data.getExceptionInfos().forEach(ex -> {
-                            String exType = switch (ex.getException()) {
-                                case 1 -> "杩熷埌";
-                                case 2 -> "鏃╅��";
-                                case 3 -> "缂哄崱";
-                                case 4 -> "鏃峰伐";
-                                case 5 -> "鍦扮偣寮傚父";
-                                case 6 -> "璁惧寮傚父";
-                                default -> "鏈煡";
-                            };
+                            String exType = getExceptionTypeName(ex.getException());
                             System.out.println("      寮傚父: " + exType + ", 娆℃暟: " + ex.getCount() + ", 鏃堕暱(绉�): " + ex.getDuration());
                         });
                     }
                 });
+
+                // 淇濆瓨鍒版暟鎹簱
+                System.out.println("  - 寮�濮嬩繚瀛樻墦鍗℃棩鎶ユ暟鎹埌鏁版嵁搴�...");
+                int insertCount = qwCheckinDayDataService.saveDayDataBatch(dayDataList);
+                System.out.println("鉁� 淇濆瓨瀹屾垚锛屾柊澧炶褰曟暟: " + insertCount + ", 鏇存柊(宸插瓨鍦�): " + (dayDataList.size() - insertCount));
             } else {
                 System.out.println("鉁� 鑾峰彇鐨勬墦鍗℃棩鎶ユ暟鎹负绌�");
             }
@@ -356,15 +357,7 @@
                     if (data.getExceptionInfos() != null && !data.getExceptionInfos().isEmpty()) {
                         System.out.println("  寮傚父淇℃伅:");
                         data.getExceptionInfos().forEach(ex -> {
-                            String exType = switch (ex.getException()) {
-                                case 1 -> "杩熷埌";
-                                case 2 -> "鏃╅��";
-                                case 3 -> "缂哄崱";
-                                case 4 -> "鏃峰伐";
-                                case 5 -> "鍦扮偣寮傚父";
-                                case 6 -> "璁惧寮傚父";
-                                default -> "鏈煡";
-                            };
+                            String exType = getExceptionTypeName(ex.getException());
                             System.out.println("    - " + exType + ": " + ex.getCount() + "娆�, 鏃堕暱: " + formatSeconds(ex.getDuration()));
                         });
                     }
@@ -403,4 +396,30 @@
         return sb.toString();
     }
 
+    /**
+     * 鑾峰彇寮傚父绫诲瀷鍚嶇О
+     * @param exceptionType 寮傚父绫诲瀷浠g爜锛�1-杩熷埌锛�2-鏃╅��锛�3-缂哄崱锛�4-鏃峰伐锛�5-鍦扮偣寮傚父锛�6-璁惧寮傚父
+     */
+    private String getExceptionTypeName(Integer exceptionType) {
+        if (exceptionType == null) {
+            return "鏈煡";
+        }
+        switch (exceptionType) {
+            case 1:
+                return "杩熷埌";
+            case 2:
+                return "鏃╅��";
+            case 3:
+                return "缂哄崱";
+            case 4:
+                return "鏃峰伐";
+            case 5:
+                return "鍦扮偣寮傚父";
+            case 6:
+                return "璁惧寮傚父";
+            default:
+                return "鏈煡";
+        }
+    }
+
 }

--
Gitblit v1.9.3