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);