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

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

@@ -1,27 +1,27 @@
package com.njcn.process.constant; //package com.njcn.process.constant;
//
import com.google.common.collect.Maps; //import com.google.common.collect.Maps;
import com.njcn.device.pq.pojo.po.DataV; //import com.njcn.device.pq.pojo.po.DataV;
import org.springframework.cglib.beans.BeanMap; //import org.springframework.cglib.beans.BeanMap;
//
import java.util.Map; //import java.util.Map;
//
/** ///**
* Description: // * Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html // * 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/12/7 15:18【需求编号】 // * Date: 2022/12/7 15:18【需求编号】
* // *
* @author clam // * @author clam
* @version V1.0.0 // * @version V1.0.0
*/ // */
public class Test { //public class Test {
public static void main(String[] args) { // public static void main(String[] args) {
//
Map<String, Object> map = Maps.newHashMap ( ); // Map<String, Object> map = Maps.newHashMap ( );
DataV d = new DataV ( ); // DataV d = new DataV ( );
BeanMap beanMap = BeanMap.create (d); // BeanMap beanMap = BeanMap.create (d);
for (Object key : beanMap.keySet ( )) { // for (Object key : beanMap.keySet ( )) {
} // }
} // }
//
} //}

View File

@@ -25,6 +25,10 @@ public class MonitorParam {
@NotEmpty(message = "类型不能为空") @NotEmpty(message = "类型不能为空")
private Integer type; private Integer type;
@ApiModelProperty(value = "等级 0.自动策略 1.手动策略 2.排他策略")
@NotEmpty(message = "等级不能为空")
private Integer grade;
@ApiModelProperty(value = "预警策略/告警策略id") @ApiModelProperty(value = "预警策略/告警策略id")
@NotEmpty(message = "策略id集合不能为空") @NotEmpty(message = "策略id集合不能为空")
private List<String> alarmId; private List<String> alarmId;

View File

@@ -37,6 +37,10 @@ public class ThsDeptAlarm implements Serializable {
@TableField("Alarm_Id") @TableField("Alarm_Id")
private String alarmId; private String alarmId;
@ApiModelProperty(value = "等级0自动策略1手动策略2排他策略")
@TableField("Grade")
private Integer Grade;
@ApiModelProperty(value = "监测点id") @ApiModelProperty(value = "监测点id")
@TableField("Monitor_Id") @TableField("Monitor_Id")
private String monitorId; private String monitorId;

View File

@@ -122,9 +122,11 @@ public class ThsWarnStrategyController extends BaseController {
@GetMapping("/echoMonitor") @GetMapping("/echoMonitor")
@ApiOperation(value = "监测点回显") @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"); 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); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, info, methodDescribe);
} }

View File

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