Explorar o código

2023-10-25 信标通信修改整理日志消息。

chaiyunlong %!s(int64=2) %!d(string=hai) anos
pai
achega
ce73803400

+ 5 - 5
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/event/RedisExpiredAndWorkListener.java

@@ -129,7 +129,7 @@ public class RedisExpiredAndWorkListener extends KeyExpirationEventMessageListen
             Map <String,Object> map = new HashMap<>();
             map.put("gatewayMac",beaconStr[1]);
             map.put("gatewayOnline",0);
-            log.info("21.=====================================》网关断电或失联mac:"+beaconStr[1]);
+            log.info("1------------------------------------》网关断电或失联mac:"+beaconStr[1]);
             remoteAirBottleService.setBluetoothGateway(map);
         }
 
@@ -152,7 +152,7 @@ public class RedisExpiredAndWorkListener extends KeyExpirationEventMessageListen
                     map.put("floorId",layoutVo.getFloorId());
                 }
             }
-            log.info("31.=====================================》信标丢失:"+beaconStr[1]+",实验室id:"+beaconStr[2]);
+            log.info("2------------------------------------》信标丢失:"+beaconStr[1]+",实验室id:"+beaconStr[2]);
             // todo 这里需要根据实验室id查询对应的网关,通过网关查询redis,排查是不是有网关掉线了,如果有,就不通知报警,如果没有,发出报警
             Boolean flag = Boolean.TRUE;
             ResultData<List<Map<String,Object>>> resultData = remoteAirBottleService.getBluetoothBySubId(Long.parseLong(beaconStr[2]));
@@ -164,11 +164,11 @@ public class RedisExpiredAndWorkListener extends KeyExpirationEventMessageListen
                     }
                 }
             }
-            log.info("32.=====================================》判别网关是否有断电情况:"+flag);
+            log.info("3------------------------------------》判别网关是否在线情况:"+flag);
             if(flag){
                 List <Map<String,Object>> beaconNoticeList = redisService.getCacheObject(BaseConstants.BEACON_MATE_NOTICE+"~"+beaconStr[2]);
                 if(beaconNoticeList != null && beaconNoticeList.size()>0){
-                    log.info("33.=====================================》通知消息列表大小:"+beaconNoticeList.size());
+                    log.info("4------------------------------------》通知消息列表大小:"+beaconNoticeList.size());
                     Boolean noticeFlag = Boolean.TRUE;
                     for(Map notice:beaconNoticeList){
                         if(map.get("beaconTag").equals(notice.get("beaconTag"))){
@@ -184,7 +184,7 @@ public class RedisExpiredAndWorkListener extends KeyExpirationEventMessageListen
                     //向前端发送mqtt预案触发提示
                     messageSendService.riskPlanTriggerNotice();
                 }else{
-                    log.info("34.=====================================》通知消息:");
+                    log.info("5------------------------------------》新消息通知:"+map);
                     List<Map <String,Object>> beaconList = new ArrayList <>();
                     beaconList.add(map);
                     redisService.setCacheObject(BaseConstants.BEACON_MATE_NOTICE+"~"+ beaconStr[2],beaconList, 30L, TimeUnit.MINUTES);

+ 7 - 14
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/socket/service/impl/BeaconMateImpl.java

@@ -39,7 +39,7 @@ public class BeaconMateImpl implements BeaconMate {
     private RemoteLaboratoryService remoteLaboratoryService = SpringUtils.getBean(RemoteLaboratoryService.class);
 
     public void sendBeaconMate(String dataStr){
-        log.info("1.=====================================》上报蓝牙网关编码:"+dataStr);
+        log.info("1=====================================》上报蓝牙网关编码:"+dataStr);
         JSONObject jsonObject=JSONObject.parseObject(dataStr);
         String mac = jsonObject.getString("mac");
         if(mac!=null && !"".equals(mac)){
@@ -55,23 +55,17 @@ public class BeaconMateImpl implements BeaconMate {
             if(resultData.getCode()==200){
                 //todo redis存储蓝牙网关mac地址,用于在线离线问题。
                 redisService.setCacheObject(BaseConstants.BEACON_MAC+"~"+ mac,mac, 60L, TimeUnit.SECONDS);
-
-                log.info("2.=====================================》获取实验室id:"+resultData.getData().get("subId"));
+                log.info("2=====================================》获取实验室id:"+resultData.getData().get("subId"));
                 Long subId = Long.parseLong(resultData.getData().get("subId")+"");
                 List <Map<String,Object>> beaconList = redisService.getCacheObject(BaseConstants.BEACON_MATE_INFO+"~"+subId);
                 if(beaconList==null || initFlag){
+                    log.info("2.1=====================================》初始化实验室信标列表和实验室下的所有信标生命周期");
                     //todo 根据实验室id获取蓝牙信标列表
                     remoteAirBottleService.setBeaconBySubId(subId);
-//                    ResultData<List <Map<String,Object>>> beaconData = remoteAirBottleService.findBySubId(subId);
-//                    log.info("2.1=====================================》如果信标列表为空,查询信标列表:");
-//                    if(beaconData.getCode()==200){
-//                        log.info("2.2=====================================》beaconList查询信标列表数据列表大小:"+beaconData.getData().size());
-//                        redisService.setCacheObject(BaseConstants.BEACON_MATE_INFO+"~"+ subId,beaconData.getData(), 7L, TimeUnit.DAYS);
-//                    }
                 }
 
                 if(beaconList!=null){
-                    log.info("3.=====================================》上报信标列表:"+jsonObject.getJSONArray("devices"));
+                    log.info("3=====================================》上报信标列表:"+jsonObject.getJSONArray("devices"));
                     JSONArray array = jsonObject.getJSONArray("devices");
 
                     //todo 这里需要查看信标通知列表,移除通知列表对应的信标气瓶数据
@@ -91,17 +85,15 @@ public class BeaconMateImpl implements BeaconMate {
                                 if(beaconStr.endsWith("b5")){
                                     //todo 这里需要处理信标字符串
                                     beaconStr = checkBeacon(beaconStr);
-                                    log.info("4.=====================================》上报的信标处理后返回信标编码:"+beaconStr);
                                     if(beaconList.get(x).get("beaconTag").equals(beaconStr)){
-                                        log.info("5.=====================================》将匹配的信标保存到对应的redis里面:"+BaseConstants.BEACON_MATE_DET+"~"+ beaconStr+"~"+beaconList.get(x).get("gasName"));
+                                        log.info("4.=====================================》上报的信标处理后返回信标编码:"+beaconStr+";实验室下匹配后的信标:"+beaconList.get(x).get("beaconTag"));
                                         //todo redis存储蓝牙信标编码和实验室id和mac地址
                                         redisService.setCacheObject(BaseConstants.BEACON_MATE_DET+"~"+ beaconStr+"~"+subId+"~"+beaconList.get(x).get("gasName"),beaconStr, 120L, TimeUnit.SECONDS);
-
                                         //todo 循环信标通知,把还回来的气瓶提示移除。
                                         if(beaconNoticeList != null){
                                             for(Map notice:beaconNoticeList){
                                                 if(notice.get("beaconTag").equals(beaconStr)){
-                                                    log.info("6.=====================================》移除返回来的信标提示语:"+notice);
+                                                    log.info("5.=====================================》移除返回来的信标提示语:"+notice);
                                                     newNoticeList.remove(notice);
                                                     beaconTagBuild.append(",");
                                                     beaconTagBuild.append(beaconStr);
@@ -122,6 +114,7 @@ public class BeaconMateImpl implements BeaconMate {
                         messageSendService.riskPlanTriggerNotice();
                         //这里需要调用通知修改接口,把离位改成在位
                         if(beaconTagBuild.length()>0){
+                            log.info("6.=====================================》带离气瓶归还后需要修改在位"+beaconTagBuild.substring(1));
                             WarningNoticeLogDto warningNoticeLogDto = new WarningNoticeLogDto();
                             warningNoticeLogDto.setBeaconTag(beaconTagBuild.substring(1));
                             remoteLaboratoryService.updateLocationState(warningNoticeLogDto);