Explorar el Código

2023-10-21 优化网关重启,初始化数据。

chaiyunlong hace 2 años
padre
commit
3b7a7a852a

+ 8 - 1
zd-modules/zd-airbottle/src/main/java/com/zd/airbottle/controller/DbStockController.java

@@ -303,7 +303,14 @@ public class DbStockController extends AbstractController {
         LambdaQueryWrapper<DbStock> queryWrapper = new LambdaQueryWrapper();
         queryWrapper.eq(DbStock::getSubjectId, subId);
         List<DbStock> list = dbStockService.list(queryWrapper);
-        return ResultData.success(list);
+        redisService.setCacheObject(BaseConstants.BEACON_MATE_INFO + "~" + subId, list, 7L, TimeUnit.DAYS);
+        for(DbStock stock : list){
+            redisService.setCacheObject(BaseConstants.BEACON_MATE_DET + "~" + stock.getBeaconTag() + "~" + stock.getSubjectId() + "~" + stock.getGasName(), stock.getBeaconTag(), 120L, TimeUnit.SECONDS);
+        }
+//        LambdaQueryWrapper<DbStock> queryWrapper = new LambdaQueryWrapper();
+//        queryWrapper.eq(DbStock::getSubjectId, subId);
+//        List<DbStock> list = dbStockService.list(queryWrapper);
+        return ResultData.success(new ArrayList<>());
     }
 
 

+ 1 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/vo/WarningNoticeLogVO.java

@@ -28,6 +28,7 @@ public class WarningNoticeLogVO {
     @TableId(value = "id", type = IdType.ASSIGN_ID)
     private Long id;
 
+    @JsonSerialize(using = ToStringSerializer.class)
     @ApiModelProperty("keyId")
     private Long keyId;
 

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

@@ -57,12 +57,13 @@ public class BeaconMateImpl implements BeaconMate {
                 List <Map<String,Object>> beaconList = redisService.getCacheObject(BaseConstants.BEACON_MATE_INFO+"~"+subId);
                 if(beaconList==null || initFlag){
                     //todo 根据实验室id获取蓝牙信标列表
-                    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);
-                    }
+                    remoteAirBottleService.findBySubId(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){