Parcourir la source

fix: 北京营养分析totalCount改Long写入并用Number读取修复ClassCastException

Xiaogang Liao il y a 3 semaines
Parent
commit
42248115f7

+ 3 - 3
cfc-backend/src/main/java/com/etotem/cfc/service/BeijingNutritionService.java

@@ -326,7 +326,7 @@ public class BeijingNutritionService {
                         return s != null && !"正常".equals(s);
                     }).count();
             dim.put("abnormalCount", abnormalCount);
-            dim.put("totalCount", entry.getValue().size());
+            dim.put("totalCount", (long) entry.getValue().size());
 
             // 评估状态
             if (abnormalCount == 0) {
@@ -405,8 +405,8 @@ public class BeijingNutritionService {
     /** 功能维度摘要 */
     private String getFuncSummary(String funcName, Map<String, Object> dim) {
         String status = (String) dim.get("status");
-        long total = (long) dim.get("totalCount");
-        long abnormal = (long) dim.get("abnormalCount");
+        long total = ((Number) dim.get("totalCount")).longValue();
+        long abnormal = ((Number) dim.get("abnormalCount")).longValue();
 
         switch (funcName) {
             case "丁酸盐生产者":