修改告警策略,绑定监测点

This commit is contained in:
wr
2023-04-13 18:45:00 +08:00
parent 9aa8355364
commit 1f1e262a14
6 changed files with 44 additions and 31 deletions

View File

@@ -122,9 +122,11 @@ public class ThsWarnStrategyController extends BaseController {
@GetMapping("/echoMonitor")
@ApiOperation(value = "监测点回显")
public HttpResult<StrategyParam.MonitorTree> echoMonitor(@Param("deptId") String deptId,@Param("type") Integer type) {
public HttpResult<StrategyParam.MonitorTree> echoMonitor(@Param("deptId") String deptId,
@Param("type") Integer type,
@Param("grade") Integer grade) {
String methodDescribe = getMethodDescribe("echoMonitor");
StrategyParam.MonitorTree info = thsWarnStrategyService.echoMonitor(deptId, type);
StrategyParam.MonitorTree info = thsWarnStrategyService.echoMonitor(deptId, type,grade);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, info, methodDescribe);
}

View File

@@ -109,7 +109,7 @@ public interface ThsWarnStrategyService extends IService<ThsWarnStrategy> {
* @param type
* @return List<ThsDeptAlarm>
*/
StrategyParam.MonitorTree echoMonitor(String org,Integer type);
StrategyParam.MonitorTree echoMonitor(String org,Integer type,Integer grade);
/***
* 预警单/告警单删除

View File

@@ -194,6 +194,7 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
LambdaQueryWrapper<ThsDeptAlarm> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ThsDeptAlarm::getDeptId, param.getDeptId());
lambdaQueryWrapper.eq(ThsDeptAlarm::getType, param.getType());
lambdaQueryWrapper.eq(ThsDeptAlarm::getGrade, param.getGrade());
thsDeptAlarmService.remove(lambdaQueryWrapper);
//信息添加
@@ -210,6 +211,7 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
alarm.setDeptId(deptId);
alarm.setType(type);
alarm.setAlarmId(s);
alarm.setGrade(param.getGrade());
alarm.setMonitorId(monitorId);
info.add(alarm);
}
@@ -218,10 +220,11 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
}
@Override
public StrategyParam.MonitorTree echoMonitor(String org,Integer type) {
public StrategyParam.MonitorTree echoMonitor(String org,Integer type,Integer grade) {
List<ThsDeptAlarm> list = thsDeptAlarmService.list(new LambdaQueryWrapper<ThsDeptAlarm>()
.eq(ThsDeptAlarm::getDeptId, org)
.eq(ThsDeptAlarm::getType, type)
.eq(ThsDeptAlarm::getGrade, grade)
);
StrategyParam.MonitorTree tree=new StrategyParam.MonitorTree();
List<String> collect = list.stream().map(ThsDeptAlarm::getAlarmId).distinct().collect(Collectors.toList());