From 0a46052a92d5685a47c786ebe85c6901bb848e32 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期五, 14 十月 2022 18:49:24 +0800
Subject: [PATCH] 固件升级

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/dto/RemoteUpdateTypeDto.java                     |    5 +-
 ximon-admin/src/main/java/com/sandu/ximon/admin/controller/RemoteUpdateController.java           |   42 +++++++++++++--------
 ximon-admin/src/main/java/com/sandu/ximon/admin/manager/iot/rrpc/enums/RemoteUpdateTypeEnum.java |   52 ++++++++++---------------
 ximon-admin/src/main/java/com/sandu/ximon/admin/param/RemotePrarm.java                           |    2 
 4 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/RemoteUpdateController.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/RemoteUpdateController.java
index 50792c1..6714a39 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/RemoteUpdateController.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/controller/RemoteUpdateController.java
@@ -5,6 +5,7 @@
 import com.sandu.common.util.ResponseUtil;
 import com.sandu.ximon.admin.dto.RemoteFileDto;
 import com.sandu.ximon.admin.manager.iot.rrpc.enums.A5OrderEnum;
+import com.sandu.ximon.admin.manager.iot.rrpc.enums.RemoteUpdateTypeEnum;
 import com.sandu.ximon.admin.param.RemotePrarm;
 import com.sandu.ximon.admin.param.RemoteUpdateParam;
 import com.sandu.ximon.admin.security.PermissionConfig;
@@ -13,6 +14,8 @@
 import lombok.AllArgsConstructor;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
+
+import static com.sandu.ximon.admin.manager.iot.rrpc.enums.RemoteUpdateTypeEnum.MQTT_MAIN;
 
 /**
  * 鍥轰欢鍗囩骇Controller
@@ -84,22 +87,29 @@
         String orderType;
         boolean UpdateFlag = false;
 
-        switch (remotePrarm.getDeviceType()) {
-            case "MQTT涓插彛":
-            case "CAT1":
-                orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode();
-                break;
-            case "澶ф皵":
-                orderType = A5OrderEnum.REQUEST_ATMOSPHERE_DATA.getCode();
-                break;
-            case "C3鍏呯數妗�":
-                orderType = A5OrderEnum.REQUEST_C3_DATA.getCode();
-                break;
-            case "鏉嗕綋鍊炬枩":
-                orderType = A5OrderEnum.REQUEST_POLE_MONITOR_DATA.getCode();
-                break;
-            default:
-                throw new BusinessException("鍗囩骇纭欢璁惧绫诲瀷鎸囦护鏈夎锛岃纭锛�");
+        if (RemoteUpdateTypeEnum.MQTT_MAIN.equals(remotePrarm.getDeviceType())) {
+            //MQTT涓绘澘
+            orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode();
+        } else if (RemoteUpdateTypeEnum.MQTT_CORE.equals(remotePrarm.getDeviceType())) {
+            //MQTT鏍稿績鏉�
+            orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode();
+        } else if (RemoteUpdateTypeEnum.LIGHT.equals(remotePrarm.getDeviceType())) {
+            //鍗曠伅妯″潡
+            orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode();
+        } else if (RemoteUpdateTypeEnum.C3_CHARGING.equals(remotePrarm.getDeviceType())) {
+            //C3鍏呯數妗╂ā鍧�
+            orderType = A5OrderEnum.REQUEST_C3_DATA.getCode();
+        } else if (RemoteUpdateTypeEnum.CAT1_MAIN.equals(remotePrarm.getDeviceType())) {
+            //Cat.1涓绘澘
+            orderType = A5OrderEnum.REQUEST_LIGHT_DATA.getCode();
+        } else if (RemoteUpdateTypeEnum.LIGHT_POLE_HELING.equals(remotePrarm.getDeviceType())) {
+            //鐏潌鍊炬枩妯″潡
+            orderType = A5OrderEnum.REQUEST_POLE_MONITOR_DATA.getCode();
+        } else if (RemoteUpdateTypeEnum.AIR_EQUIPMENT.equals(remotePrarm.getDeviceType())) {
+            //澶ф皵璁惧妯″潡
+            orderType = A5OrderEnum.REQUEST_ATMOSPHERE_DATA.getCode();
+        } else {
+            throw new BusinessException("鍗囩骇纭欢璁惧绫诲瀷鎸囦护鏈夎锛岃纭锛�");
         }
 
         //鍚姩杩滅▼鍗囩骇鍛戒护
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/dto/RemoteUpdateTypeDto.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/dto/RemoteUpdateTypeDto.java
index cfeafbc..e10e344 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/dto/RemoteUpdateTypeDto.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/dto/RemoteUpdateTypeDto.java
@@ -11,6 +11,7 @@
 
     private String fileTypeName;
 
-    private String val;
-
+    public RemoteUpdateTypeDto(String fileTypeName) {
+        this.fileTypeName = fileTypeName;
+    }
 }
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/manager/iot/rrpc/enums/RemoteUpdateTypeEnum.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/manager/iot/rrpc/enums/RemoteUpdateTypeEnum.java
index a6ae43f..91d3ae5 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/manager/iot/rrpc/enums/RemoteUpdateTypeEnum.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/manager/iot/rrpc/enums/RemoteUpdateTypeEnum.java
@@ -10,46 +10,36 @@
  * @author ZZQ
  * @date 2022/4/12 11:39
  */
-public enum RemoteUpdateTypeEnum {
+public class RemoteUpdateTypeEnum {
+    //鈥淢QTT涓绘澘鈥濄�佲�淢QTT鏍稿績鏉库�濄�佲�滃崟鐏ā鍧椻�濄�佲�淐3鍏呯數妗╂ā鍧椻�濄�佲�淐at.1涓绘澘鈥濓紝鈥滅伅鏉嗗�炬枩妯″潡鈥濆拰鈥滃ぇ姘旇澶囨ā鍧椻�濊繖7涓被鍨�
     //  MQTT涓绘澘
-    MQTT_MAIN("0"),
+    public static String MQTT_MAIN = "MQTT涓绘澘";
     //  MQTT鏍稿績鏉�
-    MQTT_CORE("1"),
+    public static String MQTT_CORE = "MQTT鏍稿績鏉�";
     //  鍗曠伅妯″潡
-    LIGHT("2"),
+    public static String LIGHT = "鍗曠伅妯″潡";
     //  C3鍏呯數妗╂ā鍧�
-    C3_CHARGING("3");
-
-    private String code;
-
-    public String getCode() {
-        return code;
-    }
-
-
-    RemoteUpdateTypeEnum(String code) {
-        this.code = code;
-    }
+    public static String C3_CHARGING = "C3鍏呯數妗╂ā鍧�";
+    //  Cat.1涓绘澘
+    public static String CAT1_MAIN = "Cat.1涓绘澘";
+    //  鐏潌鍊炬枩妯″潡
+    public static String LIGHT_POLE_HELING = "鐏潌鍊炬枩妯″潡";
+    //  澶ф皵璁惧妯″潡
+    public static String AIR_EQUIPMENT = "澶ф皵璁惧妯″潡";
 
     public static List<RemoteUpdateTypeDto> getAllType() {
 
         List<RemoteUpdateTypeDto> list = new ArrayList<>();
-        for (RemoteUpdateTypeEnum r : RemoteUpdateTypeEnum.values()) {
-            RemoteUpdateTypeDto remoteUpdateTypeEntity = new RemoteUpdateTypeDto();
-            remoteUpdateTypeEntity.setVal(r.getCode());
-            remoteUpdateTypeEntity.setFileTypeName(map.get(r.getCode()));
-            list.add(remoteUpdateTypeEntity);
-        }
+        list.add(new RemoteUpdateTypeDto(MQTT_MAIN));
+        list.add(new RemoteUpdateTypeDto(MQTT_CORE));
+        list.add(new RemoteUpdateTypeDto(LIGHT));
+        list.add(new RemoteUpdateTypeDto(C3_CHARGING));
+        list.add(new RemoteUpdateTypeDto(CAT1_MAIN));
+        list.add(new RemoteUpdateTypeDto(LIGHT_POLE_HELING));
+        list.add(new RemoteUpdateTypeDto(AIR_EQUIPMENT));
+
         return list;
     }
 
-    private static ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>() {
-        {
-            put("0", "MQTT鏍稿績鏉�");
-            put("1", "Cat.1涓绘澘");
-            put("2", "C3鍏呯數妗╂ā鍧�");
-            put("3", "澶ф皵璁惧妯″潡");
-            put("4", "鏉嗕綋鍊炬枩妯″潡");
-        }
-    };
+
 }
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/param/RemotePrarm.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/param/RemotePrarm.java
index dae9fb2..b342dfa 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/param/RemotePrarm.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/param/RemotePrarm.java
@@ -22,7 +22,7 @@
     private String mac;
 
     /**
-     * 璁惧绫诲瀷锛屽崟鐏�/澶ф皵/C3鍏呯數妗�/鏉嗕綋鍊炬枩
+     * 鈥淢QTT涓绘澘鈥濄�佲�淢QTT鏍稿績鏉库�濄�佲�滃崟鐏ā鍧椻�濄�佲�淐3鍏呯數妗╂ā鍧椻�濄�佲�淐at.1涓绘澘鈥濓紝鈥滅伅鏉嗗�炬枩妯″潡鈥濆拰鈥滃ぇ姘旇澶囨ā鍧椻�濊繖7涓被鍨�
      */
     @NotEmpty
     private String deviceType;

--
Gitblit v1.9.3