Pārlūkot izejas kodu

2023-10-30 修改网关需要移除旧的网关缓存。

chaiyunlong 2 gadi atpakaļ
vecāks
revīzija
748429caf5

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

@@ -94,6 +94,7 @@ public class DbBluetoothGatewayController extends BaseController {
     @Log(title = "蓝牙网关", businessType = BusinessType.UPDATE)
     @PutMapping
     public ResultData<Boolean> edit(@RequestBody DbBluetoothGateway dbBluetoothGateway) {
+        DbBluetoothGateway oldGateway = dbBluetoothGatewayService.selectDbBluetoothGatewayById(dbBluetoothGateway.getId());
         dbBluetoothGateway.setGatewayOnline(0);
         int flag = dbBluetoothGatewayService.updateDbBluetoothGateway(dbBluetoothGateway);
         LambdaQueryWrapper<DbStock> queryWrapper = new LambdaQueryWrapper();
@@ -102,7 +103,7 @@ public class DbBluetoothGatewayController extends BaseController {
         for(DbStock stock : list){
             redisService.setCacheObject(BaseConstants.BEACON_MATE_DET + "~" + stock.getBeaconTag() + "~" + stock.getSubjectId() + "~" + stock.getGasName(), stock.getBeaconTag(), 120L, TimeUnit.SECONDS);
         }
-        redisService.deleteObject(BaseConstants.BEACON_MAC+"~"+ dbBluetoothGateway.getGatewayMac());
+        redisService.deleteObject(BaseConstants.BEACON_MAC+"~"+ oldGateway.getGatewayMac());
         redisService.deleteObject(BaseConstants.BEACON_SUBMAC);
         return ResultData.result(flag);
     }