Bladeren bron

添加扫描所有座次模拟器接口。

tom 2 maanden geleden
bovenliggende
commit
0d9188b7fb

+ 3 - 3
ruoyi-sim/src/main/java/com/ruoyi/sim/controller/HardwareCommDebugController.java

@@ -98,10 +98,10 @@ public class HardwareCommDebugController extends BaseController {
         return commSendService.debugWriteSelectedFaultBySimNum(seatId, faultIds, checkReplace);
     }
 
-    @GetMapping(value = "/debugRefreshAllSeat/")
-    @ApiOperation("debug模拟器扫描")
+    @GetMapping(value = "/debugScanAllSeat/")
+    @ApiOperation("debug扫描所有座次模拟器")
     public AjaxResult debugRefreshAllSeat() {
-        return commSendService.debugRefreshAllSeat();
+        return commSendService.debugScanAllSeat();
     }
 
     @GetMapping(value = "/buildMsg/")

+ 63 - 0
ruoyi-sim/src/main/java/com/ruoyi/sim/domain/vo/ScanSeatVo.java

@@ -0,0 +1,63 @@
+package com.ruoyi.sim.domain.vo;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+public class ScanSeatVo {
+
+    private Long seatId = 0L;
+
+    private Long simId = 0L;
+
+    private String simType = "";
+
+    private String text = "";
+
+    public ScanSeatVo(Long seatId, Long simId, String simType, String text) {
+        this.seatId = seatId;
+        this.simId = simId;
+        this.simType = simType;
+        this.text = text;
+    }
+
+    public Long getSeatId() {
+        return seatId;
+    }
+
+    public void setSeatId(Long seatId) {
+        this.seatId = seatId;
+    }
+
+    public Long getSimId() {
+        return simId;
+    }
+
+    public void setSimId(Long simId) {
+        this.simId = simId;
+    }
+
+    public String getSimType() {
+        return simType;
+    }
+
+    public void setSimType(String simType) {
+        this.simType = simType;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this)
+                .append("seatId", seatId)
+                .append("simId", simId)
+                .append("simType", simType)
+                .append("text", text)
+                .toString();
+    }
+}

+ 1 - 1
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/CommCheckService.java

@@ -142,7 +142,7 @@ public class CommCheckService {
             if (sim == null) {
                 return AjaxResult.error("找不到模拟器[" + simNum + "]对应数据。");
             } else {
-                l.info("在座次[{}]上发现模拟器[{}]", seat.getSeatNum(), sim.getSimNum());
+                l.info("座号[{}]上发现模拟器[{}]", seat.getSeatNum(), sim.getSimNum());
             }
             // 更新SimId
             seatService.updateSimIdBySeatNum(seat.getSeatNum(), sim.getSimId());

+ 16 - 4
ruoyi-sim/src/main/java/com/ruoyi/sim/service/impl/CommSendService.java

@@ -5,6 +5,7 @@ import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.sim.config.SimConfig;
 import com.ruoyi.sim.constant.CommConst;
 import com.ruoyi.sim.domain.*;
+import com.ruoyi.sim.domain.vo.ScanSeatVo;
 import com.ruoyi.sim.domain.vo.SimSocketParamVo;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.LoggerFactory;
@@ -557,10 +558,21 @@ public class CommSendService {
         return AjaxResult.success("下发故障流程执行成功!");
     }
 
-    public AjaxResult debugRefreshAllSeat() {
-
-
-        return AjaxResult.success("执行成功!");
+    public AjaxResult debugScanAllSeat() {
+        List<ScanSeatVo> list = new ArrayList<>();
+        seatService.listAllEnable().forEach(seat -> {
+            AjaxResult ar = commCheckService.checkOneSeatState(seat, true);
+            String text = ar.get(AjaxResult.MSG_TAG).toString();
+            // 新查询
+            seat = seatService.selectSeatBySeatId(seat.getSeatId());
+            Sim sim = simService.selectSimBySimId(seat.getCurrentSimId());
+            if (sim != null) {
+                list.add(new ScanSeatVo(seat.getSeatId(), sim.getSimId(), sim.getSimType(), text));
+            } else {
+                list.add(new ScanSeatVo(seat.getSeatId(), 0L, "", text));
+            }
+        });
+        return AjaxResult.success(list);
     }
 
     private String[] getGZBWBySimType(String simType) {