解决规则缓存重复存储报错问题
This commit is contained in:
parent
5baec55fe7
commit
47286e93c3
@ -46,8 +46,10 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
|
|||||||
public void init(){
|
public void init(){
|
||||||
List<IpcEquipInfo> equips = ipcEquipInfoService.selectIpcEquipInfoList(null);
|
List<IpcEquipInfo> equips = ipcEquipInfoService.selectIpcEquipInfoList(null);
|
||||||
for (IpcEquipInfo equip : equips) {
|
for (IpcEquipInfo equip : equips) {
|
||||||
|
if(!redisCache.hasKey((CacheConstants.IPC_RULES_KEY+equip.getId()))) {
|
||||||
List<IpcAlarmRules> rulesByEquipId = selectIpcAlarmRulesByEquipId(equip.getId());
|
List<IpcAlarmRules> rulesByEquipId = selectIpcAlarmRulesByEquipId(equip.getId());
|
||||||
redisCache.setCacheList((CacheConstants.IPC_RULES_KEY+equip.getId()),rulesByEquipId);
|
redisCache.setCacheList((CacheConstants.IPC_RULES_KEY + equip.getId()), rulesByEquipId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,6 +171,7 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<IpcAlarmRules> selectIpcAlarmRulesConfigListByCache(String equipId){
|
public List<IpcAlarmRules> selectIpcAlarmRulesConfigListByCache(String equipId){
|
||||||
|
|
||||||
List<IpcAlarmRules> rules = redisCache.getCacheList(CacheConstants.IPC_RULES_KEY + equipId);
|
List<IpcAlarmRules> rules = redisCache.getCacheList(CacheConstants.IPC_RULES_KEY + equipId);
|
||||||
if (rules == null || rules.size() == 0){
|
if (rules == null || rules.size() == 0){
|
||||||
List<IpcAlarmRules> rulesList = selectIpcAlarmRulesByEquipId(equipId);
|
List<IpcAlarmRules> rulesList = selectIpcAlarmRulesByEquipId(equipId);
|
||||||
|
Loading…
Reference in New Issue
Block a user