From 47286e93c39477b9a1137004b906e5e235ddef3e Mon Sep 17 00:00:00 2001 From: zhangjunwen Date: Mon, 22 Apr 2024 11:13:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=A7=84=E5=88=99=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E9=87=8D=E5=A4=8D=E5=AD=98=E5=82=A8=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../industrial/service/impl/IpcAlarmRulesServiceImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRulesServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRulesServiceImpl.java index af6a5c2..afc1b25 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRulesServiceImpl.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcAlarmRulesServiceImpl.java @@ -46,8 +46,10 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService public void init(){ List equips = ipcEquipInfoService.selectIpcEquipInfoList(null); for (IpcEquipInfo equip : equips) { - List rulesByEquipId = selectIpcAlarmRulesByEquipId(equip.getId()); - redisCache.setCacheList((CacheConstants.IPC_RULES_KEY+equip.getId()),rulesByEquipId); + if(!redisCache.hasKey((CacheConstants.IPC_RULES_KEY+equip.getId()))) { + List rulesByEquipId = selectIpcAlarmRulesByEquipId(equip.getId()); + redisCache.setCacheList((CacheConstants.IPC_RULES_KEY + equip.getId()), rulesByEquipId); + } } } @@ -169,6 +171,7 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService */ @Override public List selectIpcAlarmRulesConfigListByCache(String equipId){ + List rules = redisCache.getCacheList(CacheConstants.IPC_RULES_KEY + equipId); if (rules == null || rules.size() == 0){ List rulesList = selectIpcAlarmRulesByEquipId(equipId);