|
@@ -253,23 +253,6 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|
|
return iotDeviceMapper.selectIotDeviceList(iotDevice);
|
|
return iotDeviceMapper.selectIotDeviceList(iotDevice);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 新增设备基础
|
|
|
|
|
- *
|
|
|
|
|
- * @param iotDevice 设备基础
|
|
|
|
|
- * @return 结果
|
|
|
|
|
- */
|
|
|
|
|
- @Override
|
|
|
|
|
- public int insertIotDevice(IotDevice iotDevice) {
|
|
|
|
|
- iotDevice.setDevBid(iotDevice.getUUId());
|
|
|
|
|
- iotDevice.setTid(SecurityUtils.getTid());
|
|
|
|
|
- int result = iotDeviceMapper.insertIotDevice(iotDevice);
|
|
|
|
|
- sendToTosMsgService.sendIotDeviceInsertMsg(iotDevice);
|
|
|
|
|
- sendToIotsMsgService.sendIotDeviceInsertMsg(iotDevice);
|
|
|
|
|
- return result;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 批量新增设备基础
|
|
* 批量新增设备基础
|
|
|
*
|
|
*
|
|
@@ -282,9 +265,12 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|
|
iotDevice.setTid(SecurityUtils.getTid());
|
|
iotDevice.setTid(SecurityUtils.getTid());
|
|
|
}
|
|
}
|
|
|
int status = iotDeviceMapper.insertIotDeviceByBatch(iotDeviceList);
|
|
int status = iotDeviceMapper.insertIotDeviceByBatch(iotDeviceList);
|
|
|
- // TODO 发送消息
|
|
|
|
|
- // 获取连接 订阅设备
|
|
|
|
|
// 同步新增设备到TOS
|
|
// 同步新增设备到TOS
|
|
|
|
|
+ // 获取连接 订阅设备
|
|
|
|
|
+ for(IotDevice iotDevice : iotDeviceList){
|
|
|
|
|
+ sendToTosMsgService.sendIotDeviceInsertMsg(iotDevice);
|
|
|
|
|
+ sendToIotsMsgService.sendIotDeviceInsertMsg(iotDevice);
|
|
|
|
|
+ }
|
|
|
return status;
|
|
return status;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -297,12 +283,13 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|
|
@Override
|
|
@Override
|
|
|
public int updateIotDevice(IotDevice iotDevice, IotDeviceconn oldDeviceconn, IotDeviceconn newDeviceconn){
|
|
public int updateIotDevice(IotDevice iotDevice, IotDeviceconn oldDeviceconn, IotDeviceconn newDeviceconn){
|
|
|
int result = iotDeviceMapper.updateIotDevice(iotDevice);
|
|
int result = iotDeviceMapper.updateIotDevice(iotDevice);
|
|
|
- // TODO 发送消息
|
|
|
|
|
- // 解除旧连接订阅
|
|
|
|
|
- // 订阅新连接
|
|
|
|
|
// 同步修改设备到TOS
|
|
// 同步修改设备到TOS
|
|
|
sendToTosMsgService.sendIotDeviceUpdateMsg(iotDevice);
|
|
sendToTosMsgService.sendIotDeviceUpdateMsg(iotDevice);
|
|
|
- sendToIotsMsgService.sendIotDeviceUpdateMsg(iotDevice);
|
|
|
|
|
|
|
+ if(oldDeviceconn != null && newDeviceconn != null){
|
|
|
|
|
+ // 解除旧连接订阅 串行
|
|
|
|
|
+ // 订阅新连接 串行
|
|
|
|
|
+ sendToIotsMsgService.sendIotDeviceUpdateMsg(iotDevice);
|
|
|
|
|
+ }
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -318,10 +305,9 @@ public class IotDeviceServiceImpl implements IIotDeviceService
|
|
|
public int deleteIotDeviceByDevBid(IotDevice iotDevice) {
|
|
public int deleteIotDeviceByDevBid(IotDevice iotDevice) {
|
|
|
String devBid = iotDevice.getDevBid();
|
|
String devBid = iotDevice.getDevBid();
|
|
|
int result = iotDeviceMapper.deleteIotDeviceByDevBid(devBid);
|
|
int result = iotDeviceMapper.deleteIotDeviceByDevBid(devBid);
|
|
|
- // TODO
|
|
|
|
|
- // 解除连接订阅
|
|
|
|
|
// 同步删除设备到TOS
|
|
// 同步删除设备到TOS
|
|
|
sendToTosMsgService.sendIotDeviceDeleteMsg(iotDevice);
|
|
sendToTosMsgService.sendIotDeviceDeleteMsg(iotDevice);
|
|
|
|
|
+ // 解除连接订阅
|
|
|
sendToIotsMsgService.sendIotDeviceDeleteMsg(iotDevice);
|
|
sendToIotsMsgService.sendIotDeviceDeleteMsg(iotDevice);
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|