Commit b441b439 authored by 赵啸非's avatar 赵啸非

添加开启与关闭消费队列

parent 139a89e6
...@@ -134,18 +134,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -134,18 +134,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
ApiResp<String> resp = new ApiResp<>(); ApiResp<String> resp = new ApiResp<>();
resp.setCode(ApiRespCodeEnum.SUCCESS.getValue()); resp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
resp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel()); resp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel());
// TbQueueCallback callback = new TbQueueCallback() {
// @Override
// public void onSuccess(TbQueueMsgMetadata metadata) {
//
// log.info("消息投递成功,设备通道编码:" + deviceEntity.getDeviceMac());
// }
//
// @Override
// public void onFailure(Throwable t) {
// log.error("消息投递成功,设备通道编码:" + deviceEntity.getDeviceMac(), t);
// }
// };
messageService.send(info, header, message, callback); messageService.send(info, header, message, callback);
return resp; return resp;
} }
...@@ -169,7 +157,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -169,7 +157,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
if (deviceEntity.getDeviceStatus() != DeviceStatusEnum.未激活.getValue()) throw new AppException("当前设备已激活!"); if (deviceEntity.getDeviceStatus() != DeviceStatusEnum.未激活.getValue()) throw new AppException("当前设备已激活!");
deviceEntity.setDeviceStatus(DeviceStatusEnum.离线.getValue()); deviceEntity.setDeviceStatus(DeviceStatusEnum.离线.getValue());
deviceEntity.setEnabled(EnabledEnum.启用.getValue()); deviceEntity.setEnabled(EnabledEnum.启用.getValue());
this.update(deviceEntity, context); this.getDeviceDao().update(deviceEntity);
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId()); PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
ProductEntity productEntity = productService.get(deviceEntity.getProductId()); ProductEntity productEntity = productService.get(deviceEntity.getProductId());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) { if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
...@@ -196,10 +184,9 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -196,10 +184,9 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
deviceEntity.setEnabled(enabled); deviceEntity.setEnabled(enabled);
deviceEntity.setUpdateTime(new Date()); deviceEntity.setUpdateTime(new Date());
deviceEntity.setUpdateUserId(getContextUserId(context)); deviceEntity.setUpdateUserId(getContextUserId(context));
this.update(deviceEntity, context); this.getDeviceDao().update(deviceEntity);
ProductEntity productEntity = productService.get(deviceEntity.getProductId()); ProductEntity productEntity = productService.get(deviceEntity.getProductId());
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId()); PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
if (enabled == YesNoEnum.YES.getValue()) { if (enabled == YesNoEnum.YES.getValue()) {
this.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.ENABLED); this.sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceMethodEnum.ENABLED);
} else { } else {
...@@ -236,8 +223,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -236,8 +223,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) { if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//注册rabbmit相关队列与绑定 //注册rabbmit相关队列与绑定
registerRabbitQueue(entity, platformEntity, productEntity); registerRabbitQueue(entity, platformEntity, productEntity);
//新增设备通知第三方平台
// sendThirdParty(entity, productEntity, platformEntity, DeviceMethodEnum.ADD);
} else { } else {
throw new AppException("产品或平台不存在!"); throw new AppException("产品或平台不存在!");
} }
......
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