Commit 5c68a2b5 authored by 赵啸非's avatar 赵啸非

分组更新设备

parent 069b326f
......@@ -151,7 +151,7 @@ public class DemoApiController {
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
try {
//根据设备编码查询设备
DeviceEntity deviceEntity = deviceService.get(deviceId);
DeviceEntity deviceEntity = deviceService.getCache(deviceId.toString());
if (!ObjectUtils.isEmpty(deviceEntity)) {
//将上报信息转发到mq中
......@@ -160,7 +160,7 @@ public class DemoApiController {
throw new AppException("当前设备未配置所属系统平台,请在后台配置后再激活!");
}
// authInfo.setHost(platformEntity.getPlatformSn());
ProductEntity productEntity = productService.get(deviceEntity.getProductId());
ProductEntity productEntity = productService.getCache(deviceEntity.getProductId().toString());
if (ObjectUtils.isEmpty(productEntity)) {
throw new AppException("当前设备未配置所属产品,请在后台配置后再激活!");
}
......@@ -177,15 +177,14 @@ public class DemoApiController {
deviceService.sendDeviceMessage(deviceEntity, info, header, JSON.toJSONString(deviceEntity), null, null);
*/
TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders();
header.put(MessageHeader.MESSAGETYPE,Constant.MESSAGETYPE_HEARTBEAT);
header.put(MessageHeader.MESSAGETYPE, Constant.MESSAGETYPE_HEARTBEAT);
header.put(MessageHeader.DEVICECODE, deviceEntity.getDeviceCode());
// header.put(MessageHeader.TIMESTAMP, );
// header.put(MessageHeader.TIMESTAMP, );
TbQueueMsg queueMsg = new DefaultTbQueueMsg(IdUtil.fastUUID(), "w==", header);
messageProducer.sendMsg(QueueKey.DEFAULT_EXCHANGE, Constant.DOWN_TOPIC + deviceEntity.getDeviceCode(), JSON.toJSONString(queueMsg));
}
} catch (Exception e) {
log.error("接收数据失败", e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment