|
@@ -2025,10 +2025,36 @@ public class MapController{
|
|
|
return toolUtils.response(InterfaceResultEnum.WIFI_PWD_LENGTH_ERROR,version);
|
|
|
String sendTopic = "/WEGW2/WriteIn/" + wifiDTO.getNum();
|
|
|
String resTopic = "/WEGW2/WriteOut/" + wifiDTO.getNum();
|
|
|
- String cmd = "0001{\"B1\":\"" + wifiName + "\",\"B2\":" + wifiType + ",\"B3\":\"" + wifiPwd + "\"}";
|
|
|
+ String cmd = "01" + "{\"B1\":\"" + wifiName + "\",\"B2\":" + wifiType + ",\"B3\":\"" + wifiPwd + "\"}";
|
|
|
System.out.println("cmd:" + cmd);
|
|
|
String resCmd = toolUtils.sendMqttCmd(sendTopic, cmd, resTopic);
|
|
|
System.out.println("resCmd:" + resCmd);
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 打开关闭WiFi
|
|
|
+ * @param request lampPoleId
|
|
|
+ * @return WiFi开关状态
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/wifiOpenClose", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> wifiOpenClose(HttpServletRequest request) {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer lampPoleId = (Integer) toolUtils.getRequestContent(request,"lampPoleId",1);
|
|
|
+ if (lampPoleId == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
|
|
|
+ WifiDTO wifiDTO = wifiService.getWifiInfoByLampPoleId(lampPoleId);
|
|
|
+ if (wifiDTO == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
|
|
|
+ Integer status = (Integer) toolUtils.getRequestContent(request,"status",1);
|
|
|
+ String sendTopic = "/WEGW2/WriteIn/" + wifiDTO.getNum();
|
|
|
+ String resTopic = "/WEGW2/WriteOut/" + wifiDTO.getNum();
|
|
|
+ String cmd = "01" + "{\"B4\":" + status + "}";
|
|
|
+ System.out.println("cmd:" + cmd);
|
|
|
+ String resCmd = toolUtils.sendMqttCmd(sendTopic, cmd, resTopic);
|
|
|
+ System.out.println("resCmd:" + resCmd);
|
|
|
+ WifiDTO dto = new WifiDTO();
|
|
|
+ dto.setStatus(status);
|
|
|
+ dto.setLampPoleId(lampPoleId);
|
|
|
+ wifiService.updateWifiStatus(dto);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
}
|