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("升级硬件设备类型指令有误,请确认!"); } //启动远程升级命令 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; } } 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 { //“MQTT主板”、“MQTT核心板”、“单灯模块”、“C3充电桩模块”、“Cat.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", "杆体倾斜模块"); } }; } ximon-admin/src/main/java/com/sandu/ximon/admin/param/RemotePrarm.java
@@ -22,7 +22,7 @@ private String mac; /** * 设备类型,单灯/大气/C3充电桩/杆体倾斜 * “MQTT主板”、“MQTT核心板”、“单灯模块”、“C3充电桩模块”、“Cat.1主板”,“灯杆倾斜模块”和“大气设备模块”这7个类型 */ @NotEmpty private String deviceType;