Commit 97a45a95 by 罗志长

fix: DeviceCacheUtil

parent a0242a68
...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.entity.saas.PlatTenant; import com.makeit.entity.saas.PlatTenant;
import com.makeit.enums.CommonEnum;
import com.makeit.enums.redis.RedisConst; import com.makeit.enums.redis.RedisConst;
import com.makeit.global.aspect.tenant.TenantIdIgnore; import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.global.aspect.tenant.TenantIdIgnoreUtil; import com.makeit.global.aspect.tenant.TenantIdIgnoreUtil;
...@@ -43,7 +44,9 @@ public class DeviceCacheUtil implements ApplicationRunner { ...@@ -43,7 +44,9 @@ public class DeviceCacheUtil implements ApplicationRunner {
PlatTenant platTenant = platTenantService.getById(platDevice.getTenantId()); PlatTenant platTenant = platTenantService.getById(platDevice.getTenantId());
if(StringUtils.equals(platDevice.getStatus(),DeviceState.online.getValue())) { if(StringUtils.equals(platDevice.getStatus(),DeviceState.online.getValue())) {
RedisUtil.set(RedisConst.PLAT_IOT_DEVICE_PREFIX + platDevice.getOriDeviceId()+":"+platTenant.getIotOrgId(), platDevice); RedisUtil.set(RedisConst.PLAT_IOT_DEVICE_PREFIX + platDevice.getOriDeviceId()+":"+platTenant.getIotOrgId(), platDevice);
RedisUtil.set(RedisConst.PLAT_OWN_IOT_DEVICE_ID + platDevice.getOriDeviceId(), platDevice); if (CommonEnum.YES.getValue().equals(platTenant.getStatus())) {
RedisUtil.set(RedisConst.PLAT_OWN_IOT_DEVICE_ID + platDevice.getOriDeviceId(), platDevice);
}
}else { }else {
String key = RedisConst.PLAT_IOT_DEVICE_PREFIX + platDevice.getOriDeviceId()+":"+platTenant.getIotOrgId(); String key = RedisConst.PLAT_IOT_DEVICE_PREFIX + platDevice.getOriDeviceId()+":"+platTenant.getIotOrgId();
if(RedisUtil.exist(key)){ if(RedisUtil.exist(key)){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment