|
@@ -1,6 +1,7 @@
|
|
|
package com.huimv.env.manage.saas.controller;
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.huimv.env.manage.entity.EnvDeviceRegister;
|
|
@@ -47,7 +48,8 @@ public class EnvDeviceEquipmentController {
|
|
|
public Result update(@RequestBody EnvDeviceEquipment envDeviceEquipment){
|
|
|
try {
|
|
|
envDeviceEquipmentService.updateById(envDeviceEquipment);
|
|
|
- String deviceCode = envDeviceEquipment.getDeviceCode();
|
|
|
+ EnvDeviceEquipment byId = envDeviceEquipmentService.getById(envDeviceEquipment.getId());
|
|
|
+ String deviceCode = byId.getDeviceCode();
|
|
|
System.out.println("设备"+deviceCode);
|
|
|
QueryWrapper<EnvDeviceRegister> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("device_code",deviceCode);
|
|
@@ -55,8 +57,6 @@ public class EnvDeviceEquipmentController {
|
|
|
String chipId = one.getChipId();
|
|
|
log.info("-------获取设备编码:"+chipId);
|
|
|
PublishMQTT publishMQTT = new PublishMQTT();
|
|
|
- String connect = publishMQTT.Connect(chipId);
|
|
|
- log.info("-----连接成功----");
|
|
|
|
|
|
log.info("-----开始配置消息----");
|
|
|
QueryWrapper<EnvDeviceEquipment> queryWrapper1 = new QueryWrapper<>();
|
|
@@ -70,11 +70,14 @@ public class EnvDeviceEquipmentController {
|
|
|
deviceStatus.replace(equipmentPort -1,equipmentPort,openStart+"");
|
|
|
}
|
|
|
String s = deviceStatus.toString();
|
|
|
+ JSONObject jsonObject =new JSONObject();
|
|
|
+ jsonObject.put("dev_ctrl",s);
|
|
|
log.info("消息配置完成开始发送:"+s);
|
|
|
|
|
|
- publishMQTT.start("tcp://192.168.1.68:1883",chipId,"admin","admin","huimv_down_"+chipId,s);
|
|
|
+ publishMQTT.start("tcp://115.238.57.190:1883",chipId,"admin","admin","huimv_down_"+chipId,jsonObject.toJSONString());
|
|
|
return new Result(10000,"修改成功",true);
|
|
|
}catch (Exception e){
|
|
|
+ System.out.println(e);
|
|
|
return new Result(10001,"修改失败",false);
|
|
|
}
|
|
|
|