Quellcode durchsuchen

临时解决BUG

wukai vor 1 Woche
Ursprung
Commit
a0e915e7f5
1 geänderte Dateien mit 14 neuen und 5 gelöschten Zeilen
  1. 14 5
      jjt-biz/src/main/java/com/jjt/utils/AsyncService.java

+ 14 - 5
jjt-biz/src/main/java/com/jjt/utils/AsyncService.java

@@ -8,6 +8,7 @@ import com.jjt.calc.domain.TwinCalcHourSpec;
 import com.jjt.calc.domain.TwinRecordAlarms;
 import com.jjt.calc.domain.TwinRecordStop;
 import com.jjt.common.utils.DateUtils;
+import com.jjt.common.utils.StringUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.AsyncResult;
@@ -245,8 +246,12 @@ public class AsyncService {
                 //第一次数据是上次最后一条,只做记录用,不做处理
                 first = curr.clone();
                 last = curr.clone();
-                lastMkz = da.getInt(fieldList.indexOf("Formula_data_3"));
-                lastHeight = da.getFloat(fieldList.indexOf("Formula_data_15"));
+                if (StringUtils.isNotEmpty(da.getStr(fieldList.indexOf("Formula_data_3")))) {
+                    lastMkz = da.getInt(fieldList.indexOf("Formula_data_3"));
+                }
+                if (StringUtils.isNotEmpty(da.getStr(fieldList.indexOf("Formula_data_15")))) {
+                    lastHeight = da.getFloat(fieldList.indexOf("Formula_data_15"));
+                }
                 last48 = curr48;
                 continue;
             }
@@ -271,10 +276,14 @@ public class AsyncService {
 
             //复制数组,设置last值为当前值
             last = curr.clone();
-            if (da.getInt(fieldList.indexOf("Formula_data_3")) != 0) {
-                lastMkz = da.getInt(fieldList.indexOf("Formula_data_3"));
+            if (StringUtils.isNotEmpty(da.getStr(fieldList.indexOf("Formula_data_3")))) {
+                if (da.getInt(fieldList.indexOf("Formula_data_3")) != 0) {
+                    lastMkz = da.getInt(fieldList.indexOf("Formula_data_3"));
+                }
+            }
+            if (StringUtils.isNotEmpty(da.getStr(fieldList.indexOf("Formula_data_15")))) {
+                lastHeight = da.getFloat(fieldList.indexOf("Formula_data_15"));
             }
-            lastHeight = da.getFloat(fieldList.indexOf("Formula_data_15"));
             last48 = curr48;
         }
         //还是只计算米长