Selaa lähdekoodia

* 协议变更

chen.cheng 4 kuukautta sitten
vanhempi
commit
cd341b35ab

+ 16 - 2
bd-park/park-backend/park-collect/src/main/java/com/huashe/park/collect/event/MachineRealtimeEventListener.java

@@ -1,5 +1,6 @@
 package com.huashe.park.collect.event;
 
+import static com.huashe.park.common.consts.enums.ConsStatus.CONS_STATUS_00;
 import static com.huashe.park.common.consts.enums.ConsStatus.CONS_STATUS_02;
 
 import org.apache.commons.lang3.ObjectUtils;
@@ -70,11 +71,17 @@ public class MachineRealtimeEventListener {
             pileHoleIndexRealtime.setStartTime(DateTimeUtil.parseDate(dateFromMills));
             pileHoleIndexRealtimeService.insertPileHoleIndexRealtime(pileHoleIndexRealtime);
         }
+        consPileHoleInfoService.updateConsPileHoleInfo(new ConsPileHoleInfo() {
+            {
+                setId(consPileHoleInfo.getId());
+                setConsStatus(CONS_STATUS_02.getCode());
+            }
+        });
         pileMachineInfoService.updatePileMachineInfo(new PileMachineInfo() {
             {
                 setId(pileMachineInfo.getId());
-                setLat(event.getMessage().getLatitude());
-                setLng(event.getMessage().getLongitude());
+                setLat(consPileHoleInfo.getLat());
+                setLng(consPileHoleInfo.getLng());
                 setStatus(MachineStatus.MACHINE_STATUS_00.getCode());
             }
         });
@@ -100,6 +107,7 @@ public class MachineRealtimeEventListener {
         pileHoleIndexRealtime.setHoleNum(consPileHoleInfo.getHoleNum());
         pileHoleIndexRealtime.setSprayVolume(event.getMessage().getSprayVolume());
         pileHoleIndexRealtime.setVerticalDeviation(event.getMessage().getVerticalDeviation());
+        pileHoleIndexRealtime.setStatus(CONS_STATUS_00.getCode());
 
         if (ObjectUtils.isNotEmpty(event.getMessage().getEndTime())) {
             String dateFromMills = DateTimeUtil.getDateFromMills(event.getMessage().getEndTime());
@@ -112,6 +120,12 @@ public class MachineRealtimeEventListener {
             pileHoleIndexRealtime.setStartTime(DateTimeUtil.parseDate(dateFromMills));
             pileHoleIndexRealtimeService.insertPileHoleIndexRealtime(pileHoleIndexRealtime);
         }
+        consPileHoleInfoService.updateConsPileHoleInfo(new ConsPileHoleInfo() {
+            {
+                setId(consPileHoleInfo.getId());
+                setConsStatus(CONS_STATUS_00.getCode());
+            }
+        });
         pileMachineInfoService.updatePileMachineInfo(new PileMachineInfo() {
             {
                 setId(pileMachineInfo.getId());

+ 1 - 1
bd-park/park-backend/park-collect/src/main/resources/application-locale.yml

@@ -1,7 +1,7 @@
 ## MQTT##
 aliyun:
   mqtt:
-    uri: tcp://200.200.19.121:31005
+    uri: tcp://xt.wenhq.top:8581
 
 
 # 数据源配置

+ 82 - 0
bd-park/park-backend/park-common/src/main/java/com/huashe/park/common/consts/enums/ConsResult.java

@@ -0,0 +1,82 @@
+package com.huashe.park.common.consts.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The enum Cons result.
+ */
+public enum ConsResult {
+    /**
+     * S cons result.
+     */
+    S(0, "S", "成功"),
+    /**
+     * X cons result.
+     */
+    X(1, "X", "失败"),
+    /**
+     * Sr cons result.
+     */
+    SR(2, "SR", "补桩成功");
+
+    private final Integer code;
+
+    private final String value;
+
+    private final String info;
+
+    private static final Map<Integer, ConsResult> dic = new HashMap<>();
+
+    static {
+        for (ConsResult status : values()) {
+            dic.put(status.code, status);
+        }
+    }
+
+    ConsResult(Integer code, String value, String info) {
+        this.code = code;
+        this.info = info;
+        this.value = value;
+    }
+
+    /**
+     * Gets code.
+     *
+     * @return the code
+     */
+    public Integer getCode() {
+        return code;
+    }
+
+    /**
+     * Gets value.
+     *
+     * @return the value
+     */
+    public String getValue() {
+        return value;
+    }
+
+    /**
+     * Gets info.
+     *
+     * @return the info
+     */
+    public String getInfo() {
+        return info;
+    }
+
+    /**
+     * Gets by code.
+     *
+     * @param code the code
+     * @return the by code
+     */
+    public static ConsResult getByCode(Integer code) {
+        if (!dic.containsKey(code)) {
+            return X;
+        }
+        return dic.get(code);
+    }
+}

+ 18 - 0
bd-park/park-backend/park-common/src/main/java/com/huashe/park/common/consts/enums/ConsStatus.java

@@ -1,5 +1,8 @@
 package com.huashe.park.common.consts.enums;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * The enum Cons status.
  */
@@ -21,6 +24,14 @@ public enum ConsStatus {
 
     private final String info;
 
+    private static final Map<String, ConsStatus> dic = new HashMap<>();
+
+    static {
+        for (ConsStatus status : values()) {
+            dic.put(status.code, status);
+        }
+    }
+
     ConsStatus(String code, String info) {
         this.code = code;
         this.info = info;
@@ -43,4 +54,11 @@ public enum ConsStatus {
     public String getInfo() {
         return info;
     }
+
+    public static ConsStatus getByCode(String code) {
+        if (!dic.containsKey(code)){
+            return CONS_STATUS_01;
+        }
+        return dic.get(code);
+    }
 }

+ 5 - 1
bd-park/park-backend/park-core/src/main/java/com/huashe/park/core/service/impl/MachineProcessResultServiceImpl.java

@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.huashe.park.common.DateTimeUtil;
+import com.huashe.park.common.consts.enums.ConsResult;
 import com.huashe.park.core.mapper.MachineProcessResultMapper;
 import com.huashe.park.core.service.IMachineProcessResultService;
 import com.huashe.park.domain.dto.cons.ConsUnitResult;
@@ -23,6 +24,7 @@ import cn.hutool.core.bean.BeanUtil;
  */
 @Service
 public class MachineProcessResultServiceImpl implements IMachineProcessResultService {
+
     @Autowired
     private MachineProcessResultMapper machineProcessResultMapper;
 
@@ -107,7 +109,9 @@ public class MachineProcessResultServiceImpl implements IMachineProcessResultSer
             resultCADCsv.setStartingTime(
                 DateTimeUtil.getDateFromMills(consUnitResult.getDataTime(), DateTimeUtil.DateFormatter.HHmmss));
             resultCADCsv.setDuration(consUnitResult.getEndTime() - consUnitResult.getStartTime());
-            // TODO: 评价结果转换
+            // 评价结果转换
+            ConsResult consResult = ConsResult.getByCode(consUnitResult.getResultEvaluation());
+            resultCADCsv.setEvaluation(consResult.getValue());
             resultCADCsvs.add(resultCADCsv);
         }
         return resultCADCsvs;

+ 1 - 1
bd-park/park-backend/park-core/src/main/resources/mapper/cons/MachineProcessResultMapper.xml

@@ -451,7 +451,7 @@
         from cons_machine_process_result cmpr
                  inner join cons_pile_hole_index_realtime cphir on
             cmpr.pile_id = cphir.hole_byte_key
-        where cphir.cons_unit_id = #{consUnitId}
+        where cphir.cons_unit_id = #{consUnitId} and cphir.status = '00'
     </select>
 
 </mapper>