Procházet zdrojové kódy

添加针对特殊情况故障判断。

tom před 1 týdnem
rodič
revize
d149217e71

+ 1 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/ConfigController.java

@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.*;
 public class ConfigController {
 
     /**
+     * http://192.168.1.151:8080/sim/config/set?key=CHECK_REPLACE_EMPTY&value=false
      * http://192.168.1.60:8080/sim/config/set?key=CHECK_REPLACE_EMPTY&value=false
      * http://192.168.1.60:8080/sim/config/set?key=SCHEDULED_CONNECT&value=false
      *

+ 4 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/CommConst.java

@@ -40,6 +40,10 @@ public interface CommConst {
     String CMD_READ_FAULT_RESISTANCE = "03";
 
     String CMD_ID_GET_SN = "B1";
+
+    String ANSWER_RIGHT = "00000000";
+    String ANSWER_WRONG = "00000001";
+
     int LENGTH_2 = 2;
     int LENGTH_8 = 8;
     /**

+ 15 - 23
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/CommReceiveService.java

@@ -1,7 +1,6 @@
 package com.ruoyi.sim.service.impl;
 
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.utils.uuid.IdUtils;
 import com.ruoyi.sim.domain.*;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -196,6 +195,20 @@ public class CommReceiveService {
         }
     }
 
+    private static HashSet<String> FAULT_CHECK_PASS_SET = new HashSet<>();
+
+    static {
+        // 1型
+        // 1型不存在
+        // 2型
+        FAULT_CHECK_PASS_SET.add("0002GZBW0001");
+        FAULT_CHECK_PASS_SET.add("0002GZBW0005");
+        FAULT_CHECK_PASS_SET.add("0002GZBW0009");
+        // 3型
+        FAULT_CHECK_PASS_SET.add("0003GZBW0006");
+        FAULT_CHECK_PASS_SET.add("0003GZBW0007");
+    }
+
     /**
      * 是否在故障部位白名单中。
      *
@@ -205,28 +218,7 @@ public class CommReceiveService {
      * @return true 在白名单中。
      */
     public boolean isFaultCheckPass(SimMsg sm, Sim s, Fault f) {
-        String simType = s.getSimType();
         String faultRealGZBWId = f.getFaultId();
-        if (Sim.TYPE_0001.equals(simType)) {
-
-        }
-        if (Sim.TYPE_0002.equals(simType)) {
-            // 0002型 01故障部位进行特殊处理。
-            if ("0002GZBW0001".equals(faultRealGZBWId)) {
-                return true;
-            }
-        }
-        if (Sim.TYPE_0003.equals(simType)) {
-            // 干燥管
-            if ("0003GZBW0007".equals(faultRealGZBWId)) {
-                return true;
-            }
-            // 检测剂
-            if ("0003GZBW0006".equals(faultRealGZBWId)) {
-                return true;
-            }
-        }
-        // finally
-        return false;
+        return FAULT_CHECK_PASS_SET.contains(faultRealGZBWId);
     }
 }