Browse Source

2023-10-23 出库的气瓶,需要移除气瓶提示框。

chaiyunlong 2 years ago
parent
commit
f158cf13d5

+ 20 - 0
zd-modules/zd-airbottle/src/main/java/com/zd/airbottle/controller/DbStockController.java

@@ -346,6 +346,26 @@ public class DbStockController extends AbstractController {
         redisService.setCacheObject(BaseConstants.BEACON_MATE_INFO + "~" + dbStock.getSubjectId(), list, 7L, TimeUnit.DAYS);
         //将信标从redis中移除
         redisService.deleteObject(BaseConstants.BEACON_MATE_DET + "~" + dbStock.getBeaconTag() + "~" + dbStock.getSubjectId() + "~" + dbStock.getGasName());
+        //先把对应的信标提示语撤销
+        List <Map<String,Object>> beaconNoticeList = redisService.getCacheObject(BaseConstants.BEACON_MATE_NOTICE+"~"+dbStock.getSubjectId());
+        List <Map<String,Object>> newNoticeList = new ArrayList <>();
+        if(beaconNoticeList!=null){
+            newNoticeList.addAll(beaconNoticeList);
+        }
+        //todo 循环信标通知,修改的信标提示语移除。
+        if(beaconNoticeList != null){
+            for(Map notice:beaconNoticeList){
+                if(notice.get("beaconTag").equals(dbStock.getBeaconTag())){
+                    log.info("=====================================》移除返回来的信标提示语:"+notice);
+                    newNoticeList.remove(notice);
+                }
+            }
+        }
+        //下发通知,告诉前端页面,查询redis获取相关信息
+        if(beaconNoticeList!=null && beaconNoticeList.size()!=newNoticeList.size()){
+            //判断通知消息集合有数据,说明信标有变动,需要重新变更加通知
+            redisService.setCacheObject(BaseConstants.BEACON_MATE_NOTICE+"~"+ dbStock.getSubjectId(),newNoticeList, 30L, TimeUnit.MINUTES);
+        }
     }
 
     /**