Просмотр исходного кода

2023-10-30 气瓶服务启动删除蓝牙网关的redis。

chaiyunlong лет назад: 2
Родитель
Сommit
db3f76624a

+ 3 - 0
zd-modules/zd-airbottle/src/main/java/com/zd/airbottle/ZdAirbottleApplication.java

@@ -62,6 +62,9 @@ public class ZdAirbottleApplication implements ApplicationRunner {
             dbBluetoothGateway.setSubId(db.getSubjectId());
             dbBluetoothGateway.setSubId(db.getSubjectId());
             List <DbBluetoothGateway> bluetoothGatewayList = dbBluetoothGatewayService.selectDbBluetoothGatewayList(dbBluetoothGateway);
             List <DbBluetoothGateway> bluetoothGatewayList = dbBluetoothGatewayService.selectDbBluetoothGatewayList(dbBluetoothGateway);
             if(bluetoothGatewayList.size()>0){
             if(bluetoothGatewayList.size()>0){
+                for(DbBluetoothGateway oldGateway:bluetoothGatewayList){
+                    redisService.deleteObject(BaseConstants.BEACON_MAC+"~"+ oldGateway.getGatewayMac());
+                }
                 redisService.setCacheObject(BaseConstants.BEACON_MATE_DET+"~"+ db.getBeaconTag()+"~"+db.getSubjectId()+"~"+db.getGasName(),db.getBeaconTag(), 120L, TimeUnit.SECONDS);
                 redisService.setCacheObject(BaseConstants.BEACON_MATE_DET+"~"+ db.getBeaconTag()+"~"+db.getSubjectId()+"~"+db.getGasName(),db.getBeaconTag(), 120L, TimeUnit.SECONDS);
             }
             }
         }
         }

+ 1 - 0
zd-modules/zd-airbottle/src/main/java/com/zd/airbottle/controller/DbBluetoothGatewayController.java

@@ -104,6 +104,7 @@ public class DbBluetoothGatewayController extends BaseController {
             redisService.setCacheObject(BaseConstants.BEACON_MATE_DET + "~" + stock.getBeaconTag() + "~" + stock.getSubjectId() + "~" + stock.getGasName(), stock.getBeaconTag(), 120L, TimeUnit.SECONDS);
             redisService.setCacheObject(BaseConstants.BEACON_MATE_DET + "~" + stock.getBeaconTag() + "~" + stock.getSubjectId() + "~" + stock.getGasName(), stock.getBeaconTag(), 120L, TimeUnit.SECONDS);
         }
         }
         redisService.deleteObject(BaseConstants.BEACON_MAC+"~"+ oldGateway.getGatewayMac());
         redisService.deleteObject(BaseConstants.BEACON_MAC+"~"+ oldGateway.getGatewayMac());
+        redisService.deleteObject(BaseConstants.BEACON_MAC+"~"+ dbBluetoothGateway.getGatewayMac());
         redisService.deleteObject(BaseConstants.BEACON_SUBMAC);
         redisService.deleteObject(BaseConstants.BEACON_SUBMAC);
         return ResultData.result(flag);
         return ResultData.result(flag);
     }
     }