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 fa547fc..94927d3 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 @@ -93,11 +93,13 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService { * @return 结果 */ @Override - @Transactional public int insertIpcAlarmRules(IpcAlarmRules ipcAlarmRules) { int num = ipcAlarmRulesMapper.insertIpcAlarmRules(ipcAlarmRules); - List rulesList = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId()); - redisCache.setCacheObject((CacheConstants.IPC_RULES_KEY + ipcAlarmRules.getEquipId()), rulesList); + if (num > 0) { + List rulesList = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId()); + redisCache.setCacheObject((CacheConstants.IPC_RULES_KEY + Constant.RUNNING + CacheConstants.SEPARATOR + ipcAlarmRules.getEquipId()), rulesList.stream().filter(rules -> Constant.RUNNING.equals(ipcAlarmRules.getType())).collect(Collectors.toList())); + redisCache.setCacheObject((CacheConstants.IPC_RULES_KEY + Constant.TRY_RUNNING + CacheConstants.SEPARATOR + ipcAlarmRules.getEquipId()), rulesList.stream().filter(rules -> Constant.TRY_RUNNING.equals(ipcAlarmRules.getType())).collect(Collectors.toList())); + } return num; } @@ -111,8 +113,9 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService { public int updateIpcAlarmRules(IpcAlarmRules ipcAlarmRules) { int num = ipcAlarmRulesMapper.updateIpcAlarmRules(ipcAlarmRules); if (num > 0) { - List rules = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId()); - redisCache.setCacheObject(CacheConstants.IPC_RULES_KEY + ipcAlarmRules.getEquipId(), rules); + List rulesList = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId()); + redisCache.setCacheObject((CacheConstants.IPC_RULES_KEY + Constant.RUNNING + CacheConstants.SEPARATOR + ipcAlarmRules.getEquipId()), rulesList.stream().filter(rules -> Constant.RUNNING.equals(ipcAlarmRules.getType())).collect(Collectors.toList())); + redisCache.setCacheObject((CacheConstants.IPC_RULES_KEY + Constant.TRY_RUNNING + CacheConstants.SEPARATOR + ipcAlarmRules.getEquipId()), rulesList.stream().filter(rules -> Constant.TRY_RUNNING.equals(ipcAlarmRules.getType())).collect(Collectors.toList())); } return num; } @@ -126,9 +129,12 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService { @Override public int deleteIpcAlarmRulesByIds(String[] ids) { int num = ipcAlarmRulesMapper.deleteIpcAlarmRulesByIds(ids); - IpcAlarmRules ipcAlarmRules = selectIpcAlarmRulesById(ids[0]); - List rules = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId()); - redisCache.setCacheObject(CacheConstants.IPC_RULES_KEY + ipcAlarmRules.getEquipId(), rules); + if (num > 0) { + IpcAlarmRules ipcAlarmRules = selectIpcAlarmRulesById(ids[0]); + List rulesList = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId()); + redisCache.setCacheObject((CacheConstants.IPC_RULES_KEY + Constant.RUNNING + CacheConstants.SEPARATOR + ipcAlarmRules.getEquipId()), rulesList.stream().filter(rules -> Constant.RUNNING.equals(ipcAlarmRules.getType())).collect(Collectors.toList())); + redisCache.setCacheObject((CacheConstants.IPC_RULES_KEY + Constant.TRY_RUNNING + CacheConstants.SEPARATOR + ipcAlarmRules.getEquipId()), rulesList.stream().filter(rules -> Constant.TRY_RUNNING.equals(ipcAlarmRules.getType())).collect(Collectors.toList())); + } return num; } @@ -141,9 +147,12 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService { @Override public int deleteIpcAlarmRulesById(String id) { int num = ipcAlarmRulesMapper.deleteIpcAlarmRulesById(id); - IpcAlarmRules ipcAlarmRules = selectIpcAlarmRulesById(id); - List rules = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId()); - redisCache.setCacheObject(CacheConstants.IPC_RULES_KEY + ipcAlarmRules.getEquipId(), rules); + if (num > 0) { + IpcAlarmRules ipcAlarmRules = selectIpcAlarmRulesById(id); + List rulesList = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId()); + redisCache.setCacheObject((CacheConstants.IPC_RULES_KEY + Constant.RUNNING + CacheConstants.SEPARATOR + ipcAlarmRules.getEquipId()), rulesList.stream().filter(rules -> Constant.RUNNING.equals(ipcAlarmRules.getType())).collect(Collectors.toList())); + redisCache.setCacheObject((CacheConstants.IPC_RULES_KEY + Constant.TRY_RUNNING + CacheConstants.SEPARATOR + ipcAlarmRules.getEquipId()), rulesList.stream().filter(rules -> Constant.TRY_RUNNING.equals(ipcAlarmRules.getType())).collect(Collectors.toList())); + } return num; } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/utils/Constant.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/utils/Constant.java index 5d8a2bc..5bffa14 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/utils/Constant.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/utils/Constant.java @@ -38,9 +38,9 @@ public class Constant { public static final String OUTSIDE_INTERVAL = "区间外"; /** - * 区间外(根据基准值确定上下限) + * 区间外(根据基准值上下波动) */ - public static final String BASE_VALUE = "区间外(根据基准值确定上下限)"; + public static final String BASE_VALUE = "区间外(根据基准值上下波动)"; /** * 区间外(根据基准值范围精确设置) diff --git a/zfipc-ui/src/views/warn/alarmrules/index.vue b/zfipc-ui/src/views/warn/alarmrules/index.vue index 412163b..3a7720e 100644 --- a/zfipc-ui/src/views/warn/alarmrules/index.vue +++ b/zfipc-ui/src/views/warn/alarmrules/index.vue @@ -703,21 +703,6 @@ - - - - - + + + + + + @@ -776,12 +777,12 @@