Parcourir la source

fix:预警接口请求异常

lbingyu il y a 1 semaine
Parent
commit
1871cc2d77

+ 7 - 1
snowy-plugin/snowy-plugin-coldchain/src/main/java/vip/xiaonuo/coldchain/modular/monitorscreen/service/impl/MonitorServiceImpl.java

@@ -281,6 +281,10 @@ public class MonitorServiceImpl implements MonitorService {
         LocalDateTime now = LocalDateTime.now();
         LocalDateTime threshold;
 
+        if (s == null) {
+            s = "1w"; // 默认值
+        }
+
         switch (s) {
             case "1d":
                 threshold = now.minusDays(1);
@@ -289,12 +293,14 @@ public class MonitorServiceImpl implements MonitorService {
                 threshold = now.minusDays(3);
                 break;
             case "1w":
-            default:
                 threshold = now.minusWeeks(1);
                 break;
             case "1m":
                 threshold = now.minusMonths(1);
                 break;
+            default:
+                threshold = now.minusWeeks(1);  // 默认值
+                break;
         }
 
         // 直接传递LocalDateTime或格式化字符串(根据数据库支持选择)