Просмотр исходного кода

完善 开始考试 检查 故障部位 检查。

tom 1 неделя назад
Родитель
Сommit
eec15b61ee

+ 2 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/constant/CommConst.java

@@ -43,6 +43,8 @@ public interface CommConst {
 
     String ANSWER_RIGHT = "00000000";
     String ANSWER_WRONG = "00000001";
+    String WHG_MSG_EXIT_NO = "00";
+    String WHG_MSG_EXIST_YES = "01";
 
     int LENGTH_2 = 2;
     int LENGTH_8 = 8;

+ 13 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/constant/FaultConst.java

@@ -11,6 +11,11 @@ public class FaultConst {
 
     public static HashSet<String> FAULT_SET_JUDGE_RIGHT_FROM_WRONG_SP2 = new HashSet<>();
 
+    /**
+     * 是否是 2型,3型 的 维护管
+     */
+    public static HashSet<String> FAULT_SET_WHG = new HashSet<>();
+
     static {
         {
             // 1型
@@ -37,5 +42,13 @@ public class FaultConst {
             FAULT_SET_JUDGE_RIGHT_FROM_WRONG_SP2.add("0002GZBW0007");
             FAULT_SET_JUDGE_RIGHT_FROM_WRONG_SP2.add("0002GZBW0008");
         }
+        {
+            // 2型
+            // FAULT_SET_WHG.add("0002GZBW0009");
+            FAULT_SET_WHG.add("0002GZBW0010");
+            // 3型
+            // FAULT_SET_WHG.add("0003GZBW0007");
+            FAULT_SET_WHG.add("0003GZBW0008");
+        }
     }
 }

+ 19 - 16
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/CommReceiveService.java

@@ -1,6 +1,7 @@
 package com.ruoyi.sim.service.impl;
 
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.sim.constant.CommConst;
 import com.ruoyi.sim.constant.FaultConst;
 import com.ruoyi.sim.domain.*;
 import org.apache.commons.lang3.StringUtils;
@@ -163,7 +164,7 @@ public class CommReceiveService {
     }
 
     /**
-     * 截取
+     * 截取 内容报文。
      *
      * @param receiveMsg
      * @return
@@ -185,27 +186,29 @@ public class CommReceiveService {
      */
     public AjaxResult getOneFaultCheck(SimMsg sm, Sim s, Fault f) {
         String checkValue = parseGetData(sm.getReceiveMsg());
-        if (s != null && isFaultCheckPass(sm, s, f)) {
+        if (s == null) {
+            return AjaxResult.error("没有对应模拟器!");
+        }
+        // 是否在 故障部位 跳过检查 白名单中。
+        if (FaultConst.FAULT_SET_CHECK_PASS.contains(f.getFaultId())) {
+            // 跳过检查,直接成功。
             return AjaxResult.success(f);
         }
-        if (BLANK_CONTENT.equals(checkValue)) {
+        // 是否是 2型的维护管 或 3型的维护管
+        if (FaultConst.FAULT_SET_WHG.contains(f.getFaultId())) {
+            // 判断必须存在
+            String WHG_EXIST_MSG = checkValue.substring(4, 6);
+            if (CommConst.WHG_MSG_EXIST_YES.equals(WHG_EXIST_MSG)) {
+                return AjaxResult.success(f);
+            } else {
+                return AjaxResult.error("故障部位[" + f.getBindHardwareMsg() + "][" + f.getReplaceName() + "]未正确安装;", f);
+            }
+        }
+        if (CommConst.BLANK_CONTENT.equals(checkValue)) {
             l.info("故障部位[" + f.getBindHardwareMsg() + "][" + f.getReplaceName() + "]未正确安装;");
             return AjaxResult.error("故障部位[" + f.getBindHardwareMsg() + "][" + f.getReplaceName() + "]未正确安装;", f);
         } else {
             return AjaxResult.success(f);
         }
     }
-
-    /**
-     * 是否在故障部位白名单中。
-     *
-     * @param sm
-     * @param s
-     * @param f
-     * @return true 在白名单中。
-     */
-    public boolean isFaultCheckPass(SimMsg sm, Sim s, Fault f) {
-        String faultRealGZBWId = f.getFaultId();
-        return FaultConst.FAULT_SET_CHECK_PASS.contains(faultRealGZBWId);
-    }
 }