波形代码提交

This commit is contained in:
wurui
2023-03-23 14:51:15 +08:00
parent 50107edbe9
commit 49744fdf85
20 changed files with 353 additions and 42 deletions

View File

@@ -48,6 +48,15 @@ public class ThsWarnStrategyController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
@PostMapping("/getStrategyList")
@ApiOperation("数据查询")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
public HttpResult<List<ThsWarnStrategy>> strategyList(@RequestBody @Validated StrategyParam.StrategyPageParam param) {
String methodDescribe = getMethodDescribe("getStrategyPage");
List<ThsWarnStrategy> list = thsWarnStrategyService.strategyList(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@PostMapping("/insertStrategy")
@ApiOperation(value = "数据添加")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@@ -113,10 +122,10 @@ public class ThsWarnStrategyController extends BaseController {
@GetMapping("/echoMonitor")
@ApiOperation(value = "监测点回显")
public HttpResult<List<String>> echoMonitor(@Param("deptId") String deptId,@Param("type") Integer type) {
public HttpResult<StrategyParam.MonitorTree> echoMonitor(@Param("deptId") String deptId,@Param("type") Integer type) {
String methodDescribe = getMethodDescribe("echoMonitor");
List<String> strings = thsWarnStrategyService.echoMonitor(deptId, type);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, strings, methodDescribe);
StrategyParam.MonitorTree info = thsWarnStrategyService.echoMonitor(deptId, type);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, info, methodDescribe);
}
@PostMapping("/delStrategy")

View File

@@ -27,6 +27,14 @@ public interface ThsWarnStrategyService extends IService<ThsWarnStrategy> {
*/
Page<ThsWarnStrategy> strategyPage(StrategyParam.StrategyPageParam param);
/***
* 预警单/告警单集合
* @author wr
* @date 2023-02-27 13:58
* @param param
* @return Page<?>
*/
List<ThsWarnStrategy> strategyList(StrategyParam.StrategyPageParam param);
/***
* 预警单/告警单单条新增
@@ -101,7 +109,7 @@ public interface ThsWarnStrategyService extends IService<ThsWarnStrategy> {
* @param type
* @return List<ThsDeptAlarm>
*/
List<String> echoMonitor(String org,Integer type);
StrategyParam.MonitorTree echoMonitor(String org,Integer type);
/***
* 预警单/告警单删除

View File

@@ -1,6 +1,7 @@
package com.njcn.process.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@@ -27,11 +28,13 @@ import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.RequestUtil;
import com.njcn.web.utils.WebUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.math3.random.RandomDataGenerator;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* <p>
@@ -62,6 +65,17 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
);
}
@Override
public List<ThsWarnStrategy> strategyList(StrategyParam.StrategyPageParam param) {
return this.list(new LambdaQueryWrapper<ThsWarnStrategy>()
.like(StrUtil.isNotBlank(param.getName()), ThsWarnStrategy::getName, param.getName())
.eq(param.getGrade() != null, ThsWarnStrategy::getGrade, param.getGrade())
.eq(param.getType() != null, ThsWarnStrategy::getType, param.getType())
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
);
}
@Override
@Transactional(rollbackFor = {Exception.class})
public Boolean insertStrategy(StrategyParam.StrategyInsertParam param) {
@@ -196,12 +210,18 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
}
@Override
public List<String> echoMonitor(String org,Integer type) {
public StrategyParam.MonitorTree echoMonitor(String org,Integer type) {
List<ThsDeptAlarm> list = thsDeptAlarmService.list(new LambdaQueryWrapper<ThsDeptAlarm>()
.eq(ThsDeptAlarm::getDeptId, org)
.eq(ThsDeptAlarm::getType, type)
);
return list.stream().map(ThsDeptAlarm::getMonitorId).distinct().collect(Collectors.toList());
StrategyParam.MonitorTree tree=new StrategyParam.MonitorTree();
List<String> collect = list.stream().map(ThsDeptAlarm::getAlarmId).distinct().collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(collect)){
tree.setId(collect.get(0));
}
tree.setChildren(list.stream().map(ThsDeptAlarm::getMonitorId).distinct().collect(Collectors.toList()));
return tree;
}
@Override
@@ -283,7 +303,9 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
collect.forEach((key, value) -> {
String[] split = key.split("_");
StrategyParam.MonitorTree power = new StrategyParam.MonitorTree();
power.setId(split[0]);
//生成随机数
RandomDataGenerator randomDataGenerator = new RandomDataGenerator();
power.setId(split[0]+randomDataGenerator.nextInt(1,9));
power.setName("变电站名称: "+split[1]);
//监测点信息
List<StrategyParam.Monitor> monitors = new ArrayList();