From 8c792bb3ce0d58b74b243186792e40814b5eb554 Mon Sep 17 00:00:00 2001
From: tjx <t2856754968@163.com>
Date: 星期二, 23 十二月 2025 13:29:47 +0800
Subject: [PATCH] 111

---
 src/test/java/com/gs/dingtalk/DeviceReceivingApplicationTests.java |   46 ++++++++++++++++++++++++++++------------------
 1 files changed, 28 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..e61b889 100644
--- a/src/test/java/com/gs/dingtalk/DeviceReceivingApplicationTests.java
+++ b/src/test/java/com/gs/dingtalk/DeviceReceivingApplicationTests.java
@@ -280,15 +280,7 @@
                     // 鎵撳嵃寮傚父淇℃伅
                     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());
                         });
                     }
@@ -356,15 +348,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 +387,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