Explorar el Código

优化 调整设备最新数据redis key

zhaiyifei hace 10 meses
padre
commit
db1b65fe47

+ 1 - 1
src/main/java/com/yunfeiyun/agmp/iots/service/impl/IotBzyPestRecogService.java

@@ -54,7 +54,7 @@ public class IotBzyPestRecogService {
     private HashMap<String, BigDecimal> getDeviceAtAndAh(IotDevice iotDevice) {
         String atStr = "";
         String ahStr = "";
-        IotDevicelasteddata iotDevicelasteddata = redisCacheManager.getCacheObject(RedisCacheKey.SYS_RES, iotDevice.getDevBid());
+        IotDevicelasteddata iotDevicelasteddata = redisCacheManager.getCacheObject(RedisCacheKey.IOT_DEV_LASTED_DATA, iotDevice.getDevBid());
         if (iotDevicelasteddata != null) {
             JSONObject devData = JSONObject.parseObject(iotDevicelasteddata.getDevldContent());
             atStr = devData.getString("at");

+ 3 - 3
src/main/java/com/yunfeiyun/agmp/iots/service/impl/IotDevicelasteddataServiceImpl.java

@@ -46,7 +46,7 @@ public class IotDevicelasteddataServiceImpl implements IIotDevicelasteddataServi
         iotDevicelasteddata.setDevldDelstatus("0");
 
         this.redisCacheManager.setCacheObject(
-                RedisCacheKey.SYS_RES, iotDevicelasteddata.getDevBid(),
+                RedisCacheKey.IOT_DEV_LASTED_DATA, iotDevicelasteddata.getDevBid(),
                 iotDevicelasteddata, expireTime, TimeUnit.SECONDS
         );
     }
@@ -61,7 +61,7 @@ public class IotDevicelasteddataServiceImpl implements IIotDevicelasteddataServi
      */
     @Override
     public IotDevicelasteddata selectDeviceLastedDataBydevBid(String devBid) {
-        return this.redisCacheManager.getCacheObject(RedisCacheKey.SYS_RES, devBid);
+        return this.redisCacheManager.getCacheObject(RedisCacheKey.IOT_DEV_LASTED_DATA, devBid);
     }
 
     @Override
@@ -79,7 +79,7 @@ public class IotDevicelasteddataServiceImpl implements IIotDevicelasteddataServi
 
         //缓存起来
         this.redisCacheManager.setCacheObject(
-                RedisCacheKey.SYS_RES, iotDevicelasteddata.getDevBid(),
+                RedisCacheKey.IOT_DEV_LASTED_DATA, iotDevicelasteddata.getDevBid(),
                 iotDevicelasteddata
         );
 

+ 1 - 1
src/main/java/com/yunfeiyun/agmp/iots/service/impl/IotPestRecogService.java

@@ -57,7 +57,7 @@ public class IotPestRecogService {
     private HashMap<String, BigDecimal> getDeviceAtAndAh(IotDevice iotDevice) {
         String atStr = "";
         String ahStr = "";
-        IotDevicelasteddata iotDevicelasteddata = redisCacheManager.getCacheObject(RedisCacheKey.SYS_RES, iotDevice.getDevBid());
+        IotDevicelasteddata iotDevicelasteddata = redisCacheManager.getCacheObject(RedisCacheKey.IOT_DEV_LASTED_DATA, iotDevice.getDevBid());
         if (iotDevicelasteddata != null) {
             JSONObject devData = JSONObject.parseObject(iotDevicelasteddata.getDevldContent());
             atStr = devData.getString("at");