|
@@ -2138,8 +2138,11 @@ public class TEquipmentController {
|
|
|
if (desc != null) {
|
|
|
TEquipment equipment = tEquipmentService.getById(equipmentDesc.getEquipmentId());
|
|
|
String status = equipmentDesc.getIsMaterialUse();
|
|
|
+ // 发送MQTT消息
|
|
|
String message = PushUtils.buildJson(OperationType.MATERIAL.getCode(), status).toString();
|
|
|
tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.MATERIAL, message, adminId);
|
|
|
+ // 发送MQ消息
|
|
|
+ tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("Param", "M502" + ":" + status).toString());
|
|
|
}
|
|
|
return R.ok();
|
|
|
}
|
|
@@ -2232,7 +2235,10 @@ public class TEquipmentController {
|
|
|
if (equipment != null) {
|
|
|
String volume = param.getVolume();
|
|
|
String message = PushUtils.buildJson(OperationType.VOLUME.getCode(), volume).toString();
|
|
|
+ // MQTT消息
|
|
|
tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.VOLUME, message, adminId);
|
|
|
+ // MQ消息
|
|
|
+ tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("volume", volume).toString());
|
|
|
return R.ok();
|
|
|
}
|
|
|
return R.fail(ResponseCodesEnum.A0001);
|
|
@@ -2255,13 +2261,19 @@ public class TEquipmentController {
|
|
|
kindData.put("type", "0");
|
|
|
kindData.put("password", guestPwd);
|
|
|
String message = PushUtils.buildJson(OperationType.PASSWORD.getCode(), kindData.toString()).toString();
|
|
|
+ // MQTT消息
|
|
|
tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.PASSWORD, message, adminId);
|
|
|
+ // MQ消息
|
|
|
+ tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("guestPwd", guestPwd).toString());
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(adminPwd)) {
|
|
|
kindData.put("type", "1");
|
|
|
kindData.put("password", adminPwd);
|
|
|
String message = PushUtils.buildJson(OperationType.PASSWORD.getCode(), kindData.toString()).toString();
|
|
|
+ // MQTT消息
|
|
|
tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.PASSWORD, message, adminId);
|
|
|
+ // MQ消息
|
|
|
+ tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("adminPwd", adminPwd).toString());
|
|
|
}
|
|
|
return R.ok();
|
|
|
}
|
|
@@ -2284,7 +2296,14 @@ public class TEquipmentController {
|
|
|
kindData.put("type", type);
|
|
|
kindData.put("status", status);
|
|
|
String message = PushUtils.buildJson(OperationType.OPEN_DOOR.getCode(), kindData.toString()).toString();
|
|
|
+ // MQTT消息
|
|
|
tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.OPEN_DOOR, message, adminId);
|
|
|
+ // MQ消息
|
|
|
+ if (type.equals("0")) {
|
|
|
+ tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("outdoor", status).toString());
|
|
|
+ } else if (type.equals("1")) {
|
|
|
+ tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("indoor", status).toString());
|
|
|
+ }
|
|
|
return R.ok();
|
|
|
}
|
|
|
return R.fail(ResponseCodesEnum.A0001);
|
|
@@ -2301,7 +2320,10 @@ public class TEquipmentController {
|
|
|
if (equipment != null) {
|
|
|
String clientId = equipment.getClientId();
|
|
|
String message = PushUtils.buildJson(OperationType.RESTART_ANDROID.getCode(), OperationType.RESTART_ANDROID.getCode()).toString();
|
|
|
+ // MQTT消息
|
|
|
tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.RESTART_ANDROID, message, adminId);
|
|
|
+ // MQ消息
|
|
|
+ tEquipmentService.sentMessage(clientId, PushUtils.buildJson("restartAndroid", "restartAndroid").toString());
|
|
|
return R.ok();
|
|
|
}
|
|
|
return R.fail(ResponseCodesEnum.A0001);
|
|
@@ -2319,7 +2341,10 @@ public class TEquipmentController {
|
|
|
String clientId = equipment.getClientId();
|
|
|
String isSleep = param.getIsSleep();
|
|
|
String message = PushUtils.buildJson(OperationType.SLEEP.getCode(), isSleep).toString();
|
|
|
+ // MQTT消息
|
|
|
tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.SLEEP, message, adminId);
|
|
|
+ // MQ消息
|
|
|
+ tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("is_sleep", isSleep).toString());
|
|
|
return R.ok();
|
|
|
}
|
|
|
return R.fail(ResponseCodesEnum.A0001);
|
|
@@ -2341,7 +2366,10 @@ public class TEquipmentController {
|
|
|
time = System.currentTimeMillis();
|
|
|
}
|
|
|
String message = PushUtils.buildJson(OperationType.EQE_STATUS.getCode(), String.valueOf(eqeStatus), String.valueOf(time), "http://time.tianqi.com").toString();
|
|
|
+ // MQTT消息
|
|
|
tEquipmentService.sendRemoteMessage(equipment.getClientId(), OperationType.EQE_STATUS, message, adminId);
|
|
|
+ // MQ消息
|
|
|
+ tEquipmentService.sentMessage(equipment.getClientId(), PushUtils.buildJson("eqeStatus", String.valueOf(eqeStatus), String.valueOf(time), "http://time.tianqi.com").toString());
|
|
|
return R.ok();
|
|
|
}
|
|
|
return R.fail(ResponseCodesEnum.A0001);
|