规则优化

This commit is contained in:
zhanghan11 2024-11-15 08:48:25 +08:00
parent 9238822f22
commit 7c10a7274d
3 changed files with 46 additions and 36 deletions

View File

@ -93,11 +93,13 @@ public class IpcAlarmRulesServiceImpl implements IIpcAlarmRulesService {
* @return 结果
*/
@Override
@Transactional
public int insertIpcAlarmRules(IpcAlarmRules ipcAlarmRules) {
int num = ipcAlarmRulesMapper.insertIpcAlarmRules(ipcAlarmRules);
if (num > 0) {
List<IpcAlarmRules> rulesList = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId());
redisCache.setCacheObject((CacheConstants.IPC_RULES_KEY + ipcAlarmRules.getEquipId()), rulesList);
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<IpcAlarmRules> rules = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId());
redisCache.setCacheObject(CacheConstants.IPC_RULES_KEY + ipcAlarmRules.getEquipId(), rules);
List<IpcAlarmRules> 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);
if (num > 0) {
IpcAlarmRules ipcAlarmRules = selectIpcAlarmRulesById(ids[0]);
List<IpcAlarmRules> rules = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId());
redisCache.setCacheObject(CacheConstants.IPC_RULES_KEY + ipcAlarmRules.getEquipId(), rules);
List<IpcAlarmRules> 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);
if (num > 0) {
IpcAlarmRules ipcAlarmRules = selectIpcAlarmRulesById(id);
List<IpcAlarmRules> rules = selectIpcAlarmRulesByEquipId(ipcAlarmRules.getEquipId());
redisCache.setCacheObject(CacheConstants.IPC_RULES_KEY + ipcAlarmRules.getEquipId(), rules);
List<IpcAlarmRules> 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;
}

View File

@ -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 = "区间外(根据基准值上下波动";
/**
* 区间外根据基准值范围精确设置

View File

@ -703,21 +703,6 @@
</el-row>
<el-row>
<el-col :span="12">
<el-form-item
label="报警上限值"
prop="alertUpperBound"
>
<el-input-number
v-model="form.alertUpperBound"
placeholder="请输入报警上限值"
:precision="2"
:step="0.1"
:max="1000000"
:min="-1000000"
></el-input-number>
</el-form-item>
</el-col>
<el-col
:span="12"
v-if="form.referenceCon && form.referenceCon.startsWith('区间')"
@ -750,6 +735,22 @@
></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="alertUpperBound">
<template slot="label">
<span v-if="form.referenceCon && form.referenceCon.startsWith('区间')">报警上限值</span>
<span v-else>报警值</span>
</template>
<el-input-number
v-model="form.alertUpperBound"
placeholder="请输入报警上限值"
:precision="2"
:step="0.1"
:max="1000000"
:min="-1000000"
></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="form.referenceCon && form.referenceCon.startsWith('区间外(')">
<el-col :span="12">
@ -776,12 +777,12 @@
<el-row v-if="form.referenceCon=='区间外(根据基准值范围精确设置)'">
<el-col :span="12">
<el-form-item
label="基准值范围限值"
prop="baseValueUpperBound"
label="基准值范围限值"
prop="baseValueLowerBound"
>
<el-input-number
v-model="form.baseValueUpperBound"
placeholder="请输入基准值范围限值"
v-model="form.baseValueLowerBound"
placeholder="请输入基准值范围限值"
:precision="2"
:step="0.1"
:max="1000000"
@ -791,12 +792,12 @@
</el-col>
<el-col :span="12">
<el-form-item
label="基准值范围限值"
prop="baseValueLowerBound"
label="基准值范围限值"
prop="baseValueUpperBound"
>
<el-input-number
v-model="form.baseValueLowerBound"
placeholder="请输入基准值范围限值"
v-model="form.baseValueUpperBound"
placeholder="请输入基准值范围限值"
:precision="2"
:step="0.1"
:max="1000000"