|
@@ -1919,8 +1919,17 @@ public class MapController{
|
|
|
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);
|
|
|
- String sendTopic = "/WEGW2/ReadIn/" + wifiDTO.getNum();
|
|
|
- String resTopic = "/WEGW2/ReadOut/" + wifiDTO.getNum();
|
|
|
+ String sendTopic = "", resTopic = "";
|
|
|
+ if (wifiDTO.getModel() == 1 || wifiDTO.getModel() == 5) {
|
|
|
+ sendTopic = "/WEGW2/ReadIn/" + wifiDTO.getNum();
|
|
|
+ resTopic = "/WEGW2/ReadOut/" + wifiDTO.getNum();
|
|
|
+ } else if (wifiDTO.getModel() == 3 || wifiDTO.getModel() == 6) {
|
|
|
+ sendTopic = "/WEGW3/ReadIn/" + wifiDTO.getNum();
|
|
|
+ resTopic = "/WEGW3/ReadOut/" + wifiDTO.getNum();
|
|
|
+ } else if (wifiDTO.getModel() == 0) {
|
|
|
+ sendTopic = "/WEGW/ReadIn/" + wifiDTO.getNum();
|
|
|
+ resTopic = "/WEGW/ReadOut/" + wifiDTO.getNum();
|
|
|
+ }
|
|
|
String cmd = "0001B10B";
|
|
|
String cmd1 = "0001AA01";
|
|
|
byte[] bytes = toolUtils.hexString2Bytes(cmd);
|
|
@@ -1973,22 +1982,22 @@ public class MapController{
|
|
|
wifiInfoVO.setWifiNet("4G");
|
|
|
}
|
|
|
switch (wifiDTO.getModel()) {
|
|
|
- case "6":
|
|
|
+ case 6:
|
|
|
wifiInfoVO.setWifiModel("WE-GW-G600");
|
|
|
break;
|
|
|
- case "5":
|
|
|
+ case 5:
|
|
|
wifiInfoVO.setWifiModel("WE-GW-G260");
|
|
|
break;
|
|
|
- case "4":
|
|
|
+ case 4:
|
|
|
wifiInfoVO.setWifiModel("WE-XA-G20");
|
|
|
break;
|
|
|
- case "3":
|
|
|
+ case 3:
|
|
|
wifiInfoVO.setWifiModel("WE-GW-G300");
|
|
|
break;
|
|
|
- case "2":
|
|
|
+ case 2:
|
|
|
wifiInfoVO.setWifiModel("WE-GW-G40");
|
|
|
break;
|
|
|
- case "1":
|
|
|
+ case 1:
|
|
|
wifiInfoVO.setWifiModel("WE-GW-G200");
|
|
|
break;
|
|
|
default:
|
|
@@ -2023,8 +2032,19 @@ public class MapController{
|
|
|
return toolUtils.response(InterfaceResultEnum.WIFI_NAME_LENGTH_ERROR,version);
|
|
|
if (wifiPwd.length() < 8 || wifiPwd.length() > 30)
|
|
|
return toolUtils.response(InterfaceResultEnum.WIFI_PWD_LENGTH_ERROR,version);
|
|
|
- String sendTopic = "/WEGW2/WriteIn/" + wifiDTO.getNum();
|
|
|
- String resTopic = "/WEGW2/WriteOut/" + wifiDTO.getNum();
|
|
|
+ String sendTopic = "", resTopic = "";
|
|
|
+ if (wifiDTO.getModel() == 1 || wifiDTO.getModel() == 5) {
|
|
|
+ sendTopic = "/WEGW2/WriteIn/" + wifiDTO.getNum();
|
|
|
+ resTopic = "/WEGW2/WriteOut/" + wifiDTO.getNum();
|
|
|
+ } else if (wifiDTO.getModel() == 3 || wifiDTO.getModel() == 6) {
|
|
|
+ sendTopic = "/WEGW3/WriteIn/" + wifiDTO.getNum();
|
|
|
+ resTopic = "/WEGW3/WriteOut/" + wifiDTO.getNum();
|
|
|
+ } else if (wifiDTO.getModel() == 0) {
|
|
|
+ sendTopic = "/WEGW/WriteIn/" + wifiDTO.getNum();
|
|
|
+ resTopic = "/WEGW/WriteOut/" + wifiDTO.getNum();
|
|
|
+ }
|
|
|
+ System.out.println("sendTopic:" + sendTopic);
|
|
|
+ System.out.println("resTopic:" + resTopic);
|
|
|
String cmd = "01" + "{\"B1\":\"" + wifiName + "\",\"B2\":" + wifiType + ",\"B3\":\"" + wifiPwd + "\"}";
|
|
|
System.out.println("cmd:" + cmd);
|
|
|
String resCmd = toolUtils.sendMqttCmd(sendTopic, cmd, resTopic);
|
|
@@ -2045,8 +2065,17 @@ public class MapController{
|
|
|
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 sendTopic = "", resTopic = "";
|
|
|
+ if (wifiDTO.getModel() == 1 || wifiDTO.getModel() == 5) {
|
|
|
+ sendTopic = "/WEGW2/WriteIn/" + wifiDTO.getNum();
|
|
|
+ resTopic = "/WEGW2/WriteOut/" + wifiDTO.getNum();
|
|
|
+ } else if (wifiDTO.getModel() == 3 || wifiDTO.getModel() == 6) {
|
|
|
+ sendTopic = "/WEGW3/WriteIn/" + wifiDTO.getNum();
|
|
|
+ resTopic = "/WEGW3/WriteOut/" + wifiDTO.getNum();
|
|
|
+ } else if (wifiDTO.getModel() == 0) {
|
|
|
+ sendTopic = "/WEGW/WriteIn/" + wifiDTO.getNum();
|
|
|
+ resTopic = "/WEGW/WriteOut/" + wifiDTO.getNum();
|
|
|
+ }
|
|
|
String cmd = "01" + "{\"B4\":" + status + "}";
|
|
|
System.out.println("cmd:" + cmd);
|
|
|
String resCmd = toolUtils.sendMqttCmd(sendTopic, cmd, resTopic);
|
|
@@ -2057,4 +2086,37 @@ public class MapController{
|
|
|
wifiService.updateWifiStatus(dto);
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * WiFi禁用设备
|
|
|
+ * @param request lampPoleId
|
|
|
+ * @return wifi禁用或解禁设备
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/wifiDisable", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> wifiDisable(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 macAddress = (String) toolUtils.getRequestContent(request,"macAddress",2);
|
|
|
+ if (macAddress.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_WIFI_MAC_ADDRESS_ERROR,version);
|
|
|
+ String sendTopic = "", resTopic = "";
|
|
|
+ if (wifiDTO.getModel() == 1 || wifiDTO.getModel() == 5) {
|
|
|
+ sendTopic = "/WEGW2/WriteIn/" + wifiDTO.getNum();
|
|
|
+ resTopic = "/WEGW2/WriteOut/" + wifiDTO.getNum();
|
|
|
+ } else if (wifiDTO.getModel() == 3 || wifiDTO.getModel() == 6) {
|
|
|
+ sendTopic = "/WEGW3/WriteIn/" + wifiDTO.getNum();
|
|
|
+ resTopic = "/WEGW3/WriteOut/" + wifiDTO.getNum();
|
|
|
+ } else if (wifiDTO.getModel() == 0) {
|
|
|
+ sendTopic = "/WEGW/WriteIn/" + wifiDTO.getNum();
|
|
|
+ resTopic = "/WEGW/WriteOut/" + wifiDTO.getNum();
|
|
|
+ }
|
|
|
+ String cmd = "01" + "{\"BC\":\"" + macAddress + "|" + status + "\"}";
|
|
|
+ System.out.println("cmd:" + cmd);
|
|
|
+ String resCmd = toolUtils.sendMqttCmd(sendTopic, cmd, resTopic);
|
|
|
+ System.out.println("resCmd:" + resCmd);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
|
|
|
+ }
|
|
|
}
|