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

分组更新设备

parent 069b326f
...@@ -151,7 +151,7 @@ public class DemoApiController { ...@@ -151,7 +151,7 @@ public class DemoApiController {
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue()); rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
try { try {
//根据设备编码查询设备 //根据设备编码查询设备
DeviceEntity deviceEntity = deviceService.get(deviceId); DeviceEntity deviceEntity = deviceService.getCache(deviceId.toString());
if (!ObjectUtils.isEmpty(deviceEntity)) { if (!ObjectUtils.isEmpty(deviceEntity)) {
//将上报信息转发到mq中 //将上报信息转发到mq中
...@@ -160,7 +160,7 @@ public class DemoApiController { ...@@ -160,7 +160,7 @@ public class DemoApiController {
throw new AppException("当前设备未配置所属系统平台,请在后台配置后再激活!"); throw new AppException("当前设备未配置所属系统平台,请在后台配置后再激活!");
} }
// authInfo.setHost(platformEntity.getPlatformSn()); // authInfo.setHost(platformEntity.getPlatformSn());
ProductEntity productEntity = productService.get(deviceEntity.getProductId()); ProductEntity productEntity = productService.getCache(deviceEntity.getProductId().toString());
if (ObjectUtils.isEmpty(productEntity)) { if (ObjectUtils.isEmpty(productEntity)) {
throw new AppException("当前设备未配置所属产品,请在后台配置后再激活!"); throw new AppException("当前设备未配置所属产品,请在后台配置后再激活!");
} }
...@@ -177,7 +177,7 @@ public class DemoApiController { ...@@ -177,7 +177,7 @@ public class DemoApiController {
deviceService.sendDeviceMessage(deviceEntity, info, header, JSON.toJSONString(deviceEntity), null, null); deviceService.sendDeviceMessage(deviceEntity, info, header, JSON.toJSONString(deviceEntity), null, null);
*/ */
TbQueueMsgHeaders header = new DefaultTbQueueMsgHeaders(); 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.DEVICECODE, deviceEntity.getDeviceCode());
// header.put(MessageHeader.TIMESTAMP, ); // header.put(MessageHeader.TIMESTAMP, );
...@@ -185,7 +185,6 @@ public class DemoApiController { ...@@ -185,7 +185,6 @@ public class DemoApiController {
messageProducer.sendMsg(QueueKey.DEFAULT_EXCHANGE, Constant.DOWN_TOPIC + deviceEntity.getDeviceCode(), JSON.toJSONString(queueMsg)); messageProducer.sendMsg(QueueKey.DEFAULT_EXCHANGE, Constant.DOWN_TOPIC + deviceEntity.getDeviceCode(), JSON.toJSONString(queueMsg));
} }
} catch (Exception e) { } catch (Exception e) {
log.error("接收数据失败", 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