wukai 1 tydzień temu
rodzic
commit
1e0a059d43

+ 38 - 0
jjt-admin/src/test/java/com/jjt/task/RzTest.java

@@ -0,0 +1,38 @@
+package com.jjt.task;
+
+import com.jjt.JjtApplication;
+import com.jjt.calc.service.ITwinCalcDayYhjService;
+import com.jjt.calc.service.ITwinCalcHourYhjService;
+import com.jjt.rz.service.ITwinDeviceRzService;
+import com.jjt.utils.IotService;
+import com.jjt.ws.service.ITwinWorkshopCalcService;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+
+import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+
+/**
+ * DataProcess$
+ *
+ * @author wukai
+ * @date 2024/5/7 11:49
+ */
+@SpringBootTest(classes = JjtApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+public class RzTest {
+    @Resource
+    private ITwinCalcDayYhjService dayService;
+    @Resource
+    private IotService iotService;
+    @Resource
+    private ITwinDeviceRzService rzService;
+
+    @Test
+    public void test() {
+        iotService.setToken();
+    }
+}
+

+ 1 - 0
jjt-admin/src/test/java/com/jjt/task/YhjTaskTest.java

@@ -7,6 +7,7 @@ import com.jjt.utils.IotService;
 import com.jjt.ws.service.ITwinWorkshopCalcService;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
 
 import javax.annotation.Resource;
 import java.time.LocalDate;

+ 3 - 0
jjt-biz/src/main/java/com/jjt/biz/service/impl/ApiYrServiceImpl.java

@@ -88,6 +88,9 @@ public class ApiYrServiceImpl implements IApiYrService {
         sumByDeviceAndTeam.forEach((deviceId, teamMap) -> {
             Integer lengthA = teamMap.get("A");
             Integer lengthB = teamMap.get("B");
+            if (lengthB == null) {
+                lengthB = 0;
+            }
             Integer length = lengthA + lengthB;
             YrProdEfficiencyVO vo = arr[deviceId.intValue()];
             if (length > 0) {

+ 3 - 1
jjt-biz/src/main/java/com/jjt/calc/service/impl/TwinCalcHourYhjServiceImpl.java

@@ -217,7 +217,9 @@ public class TwinCalcHourYhjServiceImpl implements ITwinCalcHourYhjService {
                 // 任务完成后获取结果
                 try {
                     TwinCalcHourYhj calcYhj = future.get(10L, TimeUnit.SECONDS);
-                    calcList.add(calcYhj);
+                    if (calcYhj.getDeviceId() != null) {
+                        calcList.add(calcYhj);
+                    }
                 } catch (TimeoutException e) {
                     log.error("有超时的哟{}", e.getMessage());
                 }