Commit 9c52ffc3 authored by 赵啸非's avatar 赵啸非

修改redis 过期事件通知

parent a94e573c
...@@ -51,8 +51,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -51,8 +51,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
return data.getDeviceCode(); return data.getDeviceCode();
} }
@Autowired @Autowired
private MessageService messageService; private MessageService messageService;
@Autowired @Autowired
...@@ -222,27 +220,32 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -222,27 +220,32 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
protected void removeBefore(Long[] ids, Context context) throws AppException { protected void removeBefore(Long[] ids, Context context) throws AppException {
Arrays.asList(ids).stream().forEach(id -> { Arrays.asList(ids).stream().forEach(id -> {
DeviceEntity deviceEntity = this.get(id, context); DeviceEntity deviceEntity = this.get(id, context);
TbQueueCallback callback = new TbQueueCallback() { if (!ObjectUtils.isEmpty(deviceEntity)) {
@Override
public void onSuccess(TbQueueMsgMetadata metadata) {
log.info("队列删除成功");
}
@Override
public void onFailure(Throwable t) {
log.error("队列删除失败", t);
} TbQueueCallback callback = new TbQueueCallback() {
}; @Override
messageService.delQueue(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode(), callback); public void onSuccess(TbQueueMsgMetadata metadata) {
messageService.delQueue(Constant.DOWN_TOPIC + deviceEntity.getDeviceCode(), callback); log.info("队列删除成功");
}
@Override
public void onFailure(Throwable t) {
log.error("队列删除失败", t);
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId()); }
ProductEntity productEntity = productService.get(deviceEntity.getProductId()); };
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) { messageService.delQueue(Constant.UPLOAD_TOPIC + deviceEntity.getDeviceCode(), callback);
//新增设备通知第三方平台 messageService.delQueue(Constant.DOWN_TOPIC + deviceEntity.getDeviceCode(), callback);
sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceStatusEnum.DEL);
PlatformEntity platformEntity = platformService.get(deviceEntity.getPlatformId());
ProductEntity productEntity = productService.get(deviceEntity.getProductId());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//新增设备通知第三方平台
sendThirdParty(deviceEntity, productEntity, platformEntity, DeviceStatusEnum.DEL);
}
//删除扩展extKey
this.removeCache(deviceEntity.getDeviceCode());
} }
}); });
super.removeBefore(ids, context); super.removeBefore(ids, context);
......
...@@ -71,7 +71,7 @@ POST {{baseUrl}}/api/register ...@@ -71,7 +71,7 @@ POST {{baseUrl}}/api/register
Content-Type: application/json Content-Type: application/json
{ {
"deviceCode": "b12345678" "deviceCode": "c12345678"
} }
> {% > {%
...@@ -108,7 +108,7 @@ Content-Type: application/json ...@@ -108,7 +108,7 @@ Content-Type: application/json
Authorization: {{authToken}} Authorization: {{authToken}}
{ {
"deviceCode": "b12345678", "deviceCode": "c12345678",
"action": "upload" "action": "upload"
} }
......
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