Merge remote-tracking branch 'origin/master'

This commit is contained in:
Lee
2023-03-23 16:12:53 +08:00
29 changed files with 450 additions and 76 deletions

View File

@@ -36,7 +36,7 @@ public class StrategyParam {
@ApiModelProperty("名称")
private String name;
@ApiModelProperty("等级0一级1二级2三级")
@ApiModelProperty("等级0:自动策略 1:手动策略 2:排除策略")
private Integer grade;
@ApiModelProperty(value = "区分预警单/告警单0预警单 1告警单")
@@ -142,9 +142,6 @@ public class StrategyParam {
@ApiModelProperty("名称")
private String name;
// @ApiModelProperty("变电站信息")
// private List<Power> childPower;
@ApiModelProperty("子节点详细信息")
private List<?> children;
}

View File

@@ -38,8 +38,8 @@ public class SurveyPlanExcel implements Serializable {
@Excel(name = "变电站数量", width = 15)
private Long subCount;
@Excel(name = "母线数量", width = 15)
private Long busCount;
// @Excel(name = "母线数量", width = 15)
// private Long busCount;
@Excel(name = "计划状态", width = 15)
private String status;

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

@@ -325,22 +325,46 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
SurveyPlanExcel surveyPlanExcel = new SurveyPlanExcel ( );
BeanUtils.copyProperties (temp, surveyPlanExcel);
long Busbarcount = rGeneralSurveyPlanDetails.stream ( ).
filter (surveyPlanDetail -> Objects.equals (surveyPlanDetail.getPlanNo ( ), temp.getPlanNo ( ))).
map (RGeneralSurveyPlanDetail::getBusbarId).distinct ( ).count ( );
// long Busbarcount = rGeneralSurveyPlanDetails.stream ( ).
// filter (surveyPlanDetail -> Objects.equals (surveyPlanDetail.getPlanNo ( ), temp.getPlanNo ( ))).
// map (RGeneralSurveyPlanDetail::getBusbarId).distinct ( ).count ( );
long Subcount = rGeneralSurveyPlanDetails.stream ( ).
filter (surveyPlanDetail -> Objects.equals (surveyPlanDetail.getPlanNo ( ), temp.getPlanNo ( ))).
map (RGeneralSurveyPlanDetail::getSubId).distinct ( ).count ( );
surveyPlanExcel.setBusCount (Busbarcount);
// surveyPlanExcel.setBusCount (Busbarcount);
surveyPlanExcel.setSubCount (Subcount);
surveyPlanExcel.setOrgNo (pvTerminalTreeVOMap.get (surveyPlanExcel.getOrgNo ( )));
surveyPlanExcel.setStatus (getPlanStatus(temp.getStatus ()));
surveyPlanExcels.add (surveyPlanExcel);
});
return surveyPlanExcels;
}
private String getPlanStatus(int status) {
String result = "";
switch (status) {
case 0:
result = "新建";
break;
case 1:
result = "待审核";
break;
case 2:
result = "审核未通过";
break;
case 3:
result = "已发布";
break;
case 4:
result = "已完成";
break;
default:
result = "";
}
return result;
}
/**
* @param questionQueryParm
* @Description: querySurveyPlanOnQuestion

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();