|  | @@ -1,7 +1,6 @@
 | 
											
												
													
														|  |  package com.ruoyi.sim.service.impl;
 |  |  package com.ruoyi.sim.service.impl;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  import com.ruoyi.common.core.domain.AjaxResult;
 |  |  import com.ruoyi.common.core.domain.AjaxResult;
 | 
											
												
													
														|  | -import com.ruoyi.sim.constant.CommConst;
 |  | 
 | 
											
												
													
														|  |  import com.ruoyi.sim.constant.FaultConst;
 |  |  import com.ruoyi.sim.constant.FaultConst;
 | 
											
												
													
														|  |  import com.ruoyi.sim.domain.*;
 |  |  import com.ruoyi.sim.domain.*;
 | 
											
												
													
														|  |  import org.apache.commons.lang3.StringUtils;
 |  |  import org.apache.commons.lang3.StringUtils;
 | 
											
										
											
												
													
														|  | @@ -36,15 +35,47 @@ public class CommReceiveService {
 | 
											
												
													
														|  |       *
 |  |       *
 | 
											
												
													
														|  |       * @param sm
 |  |       * @param sm
 | 
											
												
													
														|  |       * @param s
 |  |       * @param s
 | 
											
												
													
														|  | 
 |  | +     * @return
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  | -    public void checkOneSimState(SimMsg sm, Sim s) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public AjaxResult checkOneSimState(SimMsg sm, Sim s) {
 | 
											
												
													
														|  |          if (s == null) {
 |  |          if (s == null) {
 | 
											
												
													
														|  |              l.warn("s is null");
 |  |              l.warn("s is null");
 | 
											
												
													
														|  | -            return;
 |  | 
 | 
											
												
													
														|  | 
 |  | +            return AjaxResult.error("sim is null");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          if (StringUtils.isNotBlank(sm.getReceiveMsg())) {
 |  |          if (StringUtils.isNotBlank(sm.getReceiveMsg())) {
 | 
											
												
													
														|  |              simService.updateSimStateBySimId(s.getSimId(), Sim.State.ONLINE);
 |  |              simService.updateSimStateBySimId(s.getSimId(), Sim.State.ONLINE);
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | 
 |  | +        return AjaxResult.success();
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    public AjaxResult checkOneSimSn(SimMsg sm, Sim s) {
 | 
											
												
													
														|  | 
 |  | +        final String simType = s.getSimType();
 | 
											
												
													
														|  | 
 |  | +        final String r = sm.getReceiveMsg();
 | 
											
												
													
														|  | 
 |  | +        final String msgError = "连接模拟器类型不正确!";
 | 
											
												
													
														|  | 
 |  | +        switch (simType) {
 | 
											
												
													
														|  | 
 |  | +            case Sim.TYPE_0001 -> {
 | 
											
												
													
														|  | 
 |  | +                if (r.startsWith(Sim.TYPE_0001_SN) && r.endsWith(s.getSimNum())) {
 | 
											
												
													
														|  | 
 |  | +                    return AjaxResult.success();
 | 
											
												
													
														|  | 
 |  | +                } else {
 | 
											
												
													
														|  | 
 |  | +                    return AjaxResult.error(msgError);
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            case Sim.TYPE_0002 -> {
 | 
											
												
													
														|  | 
 |  | +                if (r.startsWith(Sim.TYPE_0002_SN) && r.endsWith(s.getSimNum())) {
 | 
											
												
													
														|  | 
 |  | +                    return AjaxResult.success();
 | 
											
												
													
														|  | 
 |  | +                } else {
 | 
											
												
													
														|  | 
 |  | +                    return AjaxResult.error(msgError);
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            case Sim.TYPE_0003 -> {
 | 
											
												
													
														|  | 
 |  | +                if (r.startsWith(Sim.TYPE_0003_SN) && r.endsWith(s.getSimNum())) {
 | 
											
												
													
														|  | 
 |  | +                    return AjaxResult.success();
 | 
											
												
													
														|  | 
 |  | +                } else {
 | 
											
												
													
														|  | 
 |  | +                    return AjaxResult.error(msgError);
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            default -> throw new IllegalStateException("Unexpected value: " + simType);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      public void clearOneFault(SimMsg sm, Sim s, RealExamFault reF, Fault f) {
 |  |      public void clearOneFault(SimMsg sm, Sim s, RealExamFault reF, Fault f) {
 | 
											
										
											
												
													
														|  | @@ -70,7 +101,7 @@ public class CommReceiveService {
 | 
											
												
													
														|  |          // check
 |  |          // check
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          //
 |  |          //
 | 
											
												
													
														|  | -        String faultQuestionValue = parseGetData(sm.getReceiveMsg());
 |  | 
 | 
											
												
													
														|  | 
 |  | +        String faultQuestionValue = subContentData(sm.getReceiveMsg());
 | 
											
												
													
														|  |          // todo:
 |  |          // todo:
 | 
											
												
													
														|  |          if (StringUtils.isBlank(faultQuestionValue)) {
 |  |          if (StringUtils.isBlank(faultQuestionValue)) {
 | 
											
												
													
														|  |              l.warn("faultQuestionValue is empty!");
 |  |              l.warn("faultQuestionValue is empty!");
 | 
											
										
											
												
													
														|  | @@ -137,7 +168,7 @@ public class CommReceiveService {
 | 
											
												
													
														|  |      public void setFaultAnswerValue(SimMsg sm, Sim s, RealExamFault reF, Fault f, String refState) {
 |  |      public void setFaultAnswerValue(SimMsg sm, Sim s, RealExamFault reF, Fault f, String refState) {
 | 
											
												
													
														|  |          // check
 |  |          // check
 | 
											
												
													
														|  |          //
 |  |          //
 | 
											
												
													
														|  | -        String faultAnswerValue = parseGetData(sm.getReceiveMsg());
 |  | 
 | 
											
												
													
														|  | 
 |  | +        String faultAnswerValue = subContentData(sm.getReceiveMsg());
 | 
											
												
													
														|  |          // todo:
 |  |          // todo:
 | 
											
												
													
														|  |          if (StringUtils.isBlank(faultAnswerValue)) {
 |  |          if (StringUtils.isBlank(faultAnswerValue)) {
 | 
											
												
													
														|  |              l.warn("faultAnswerValue is empty!");
 |  |              l.warn("faultAnswerValue is empty!");
 | 
											
										
											
												
													
														|  | @@ -171,7 +202,7 @@ public class CommReceiveService {
 | 
											
												
													
														|  |       * @param receiveMsg
 |  |       * @param receiveMsg
 | 
											
												
													
														|  |       * @return
 |  |       * @return
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  | -    public String parseGetData(String receiveMsg) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public String subContentData(String receiveMsg) {
 | 
											
												
													
														|  |          if (StringUtils.isEmpty(receiveMsg)) {
 |  |          if (StringUtils.isEmpty(receiveMsg)) {
 | 
											
												
													
														|  |              return "";
 |  |              return "";
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
										
											
												
													
														|  | @@ -187,7 +218,7 @@ public class CommReceiveService {
 | 
											
												
													
														|  |       * @return
 |  |       * @return
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  |      public AjaxResult getOneFaultCheck(SimMsg sm, Sim s, Fault f) {
 |  |      public AjaxResult getOneFaultCheck(SimMsg sm, Sim s, Fault f) {
 | 
											
												
													
														|  | -        String checkValue = parseGetData(sm.getReceiveMsg());
 |  | 
 | 
											
												
													
														|  | 
 |  | +        String checkValue = subContentData(sm.getReceiveMsg());
 | 
											
												
													
														|  |          if (s == null) {
 |  |          if (s == null) {
 | 
											
												
													
														|  |              return AjaxResult.error("没有对应模拟器!");
 |  |              return AjaxResult.error("没有对应模拟器!");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
										
											
												
													
														|  | @@ -200,13 +231,13 @@ public class CommReceiveService {
 | 
											
												
													
														|  |          if (FaultConst.FAULT_SET_WHG.contains(f.getFaultId())) {
 |  |          if (FaultConst.FAULT_SET_WHG.contains(f.getFaultId())) {
 | 
											
												
													
														|  |              // 判断必须存在
 |  |              // 判断必须存在
 | 
											
												
													
														|  |              String WHG_EXIST_MSG = checkValue.substring(4, 6);
 |  |              String WHG_EXIST_MSG = checkValue.substring(4, 6);
 | 
											
												
													
														|  | -            if (CommConst.WHG_MSG_EXIST_YES.equals(WHG_EXIST_MSG)) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +            if (WHG_MSG_EXIST_YES.equals(WHG_EXIST_MSG)) {
 | 
											
												
													
														|  |                  return AjaxResult.success(f);
 |  |                  return AjaxResult.success(f);
 | 
											
												
													
														|  |              } else {
 |  |              } else {
 | 
											
												
													
														|  |                  return AjaxResult.error("故障部位[" + f.getBindHardwareMsg() + "][" + f.getReplaceName() + "]未正确安装;", f);
 |  |                  return AjaxResult.error("故障部位[" + f.getBindHardwareMsg() + "][" + f.getReplaceName() + "]未正确安装;", f);
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        if (CommConst.BLANK_CONTENT.equals(checkValue)) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (BLANK_CONTENT.equals(checkValue)) {
 | 
											
												
													
														|  |              l.info("故障部位[" + f.getBindHardwareMsg() + "][" + f.getReplaceName() + "]未正确安装;");
 |  |              l.info("故障部位[" + f.getBindHardwareMsg() + "][" + f.getReplaceName() + "]未正确安装;");
 | 
											
												
													
														|  |              return AjaxResult.error("故障部位[" + f.getBindHardwareMsg() + "][" + f.getReplaceName() + "]未正确安装;", f);
 |  |              return AjaxResult.error("故障部位[" + f.getBindHardwareMsg() + "][" + f.getReplaceName() + "]未正确安装;", f);
 | 
											
												
													
														|  |          } else {
 |  |          } else {
 |