From 7c10a7274ded30a2873cddf4f563d479f39716ae Mon Sep 17 00:00:00 2001 From: zhanghan11 Date: Fri, 15 Nov 2024 08:48:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E5=88=99=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/IpcAlarmRulesServiceImpl.java | 31 +++++++----- .../com/inspur/industrial/utils/Constant.java | 4 +- zfipc-ui/src/views/warn/alarmrules/index.vue | 47 ++++++++++--------- 3 files changed, 46 insertions(+), 36 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 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 @@