1.监测评分权重,新增字段添加

2.企业概览页面接口 在线率、畸变率和暂降次数
This commit is contained in:
wr
2023-08-31 15:32:49 +08:00
parent 9b7341aa3d
commit 9f38947e28
14 changed files with 194 additions and 27 deletions

View File

@@ -8,6 +8,7 @@ import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.event.pojo.vo.AreaStatisticalVO;
import com.njcn.event.service.majornetwork.AreaStatisticalService;
import com.njcn.harmonic.pojo.vo.NodeVO;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -20,6 +21,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 区域概览
*
@@ -45,4 +48,14 @@ public class AreaStatisticalController extends BaseController {
AreaStatisticalVO res = areaStatisticalService.getAreaCalculation(deviceInfoParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getCalculation")
@ApiOperation("获取暂降区域节点图")
@ApiImplicitParam(name = "deviceInfoParam", value = "暂降事件分析参数", required = true)
public HttpResult<List<NodeVO>> getCalculation(@RequestBody @Validated DeviceInfoParam.BusinessParam deviceInfoParam) {
String methodDescribe = getMethodDescribe("getAreaCalculation");
List<NodeVO> calculation = areaStatisticalService.getCalculation(deviceInfoParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, calculation, methodDescribe);
}
}

View File

@@ -2,6 +2,9 @@ package com.njcn.event.service.majornetwork;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.event.pojo.vo.AreaStatisticalVO;
import com.njcn.harmonic.pojo.vo.NodeVO;
import java.util.List;
/**
* 区域统计
@@ -19,6 +22,13 @@ public interface AreaStatisticalService {
* @return 暂降统计信息
*/
AreaStatisticalVO getAreaCalculation(DeviceInfoParam.BusinessParam deviceInfoParam);
/**
* @Description: 节点图
* @param deviceInfoParam
* @return: java.util.List<com.njcn.harmonic.pojo.vo.NodeVO>
* @Author: wr
* @Date: 2023/8/30 9:43
*/
List<NodeVO> getCalculation(DeviceInfoParam.BusinessParam deviceInfoParam);
}

View File

@@ -1,6 +1,5 @@
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DatePattern;
@@ -9,10 +8,11 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.dto.PollutionLineDTO;
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.event.influxdb.PqsEventDetailQuery;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.AreaCalculationVO;
import com.njcn.event.pojo.vo.AreaStatisticalVO;
@@ -23,23 +23,20 @@ import com.njcn.event.pojo.vo.MonthCalculationVO;
import com.njcn.event.pojo.vo.VoltageLevelCalculationVO;
import com.njcn.event.service.majornetwork.AreaStatisticalService;
import com.njcn.event.service.majornetwork.EventDetailService;
import com.njcn.harmonic.pojo.vo.NodeVO;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.pojo.enums.StatisticsEnum;
import com.njcn.system.pojo.po.DictData;
import lombok.RequiredArgsConstructor;
import org.influxdb.querybuilder.clauses.Clause;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.njcn.event.influxdb.PqsEventDetailQuery.*;
import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.ne;
/**
* 区域统计
@@ -57,6 +54,8 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
private final DicDataFeignClient dicDataFeignClient;
private final LineFeignClient lineFeignClient;
/**
* 获取暂降区域 电压等级 月份统计
*
@@ -101,6 +100,67 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
return AreaStatisticalVO.buildVO(areaStatisticsVO, voltageStatisticsVO, monthCalculationVOS);
}
@Override
public List<NodeVO> getCalculation(DeviceInfoParam.BusinessParam deviceInfoParam) {
List<NodeVO> nodeVOS=new ArrayList<>();
//获取录波字典信息
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
// 获取指定部门下的监测点集合
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
if (CollUtil.isEmpty(generalDeviceDTOList)) {
return nodeVOS;
}
List<String> lineIds = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
if (CollUtil.isEmpty(lineIds)) {
return nodeVOS;
}
//数据暂降查询
List<RmpEventDetailPO> info = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
//todo 是否缺少录波
.eq(RmpEventDetailPO::getEventType, data.getId())
.ge(StrUtil.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())))
.le(StrUtil.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())))
);
//获取变电站信息
List<PollutionLineDTO> lineInfo = new ArrayList<>();
if (!CollectionUtils.isEmpty(lineIds)){
PollutionParamDTO paramDTO = new PollutionParamDTO();
paramDTO.setLineList(lineIds);
lineInfo = lineFeignClient.getLineInfo(paramDTO).getData();
}
//将将变电站信息组合
Map<String,List<PollutionLineDTO>> map = lineInfo.stream().collect(Collectors.groupingBy(PollutionLineDTO::getSubstationId));
generalDeviceDTOList.forEach(dto->{
if (!CollectionUtils.isEmpty(dto.getSubIndexes())){
List<NodeVO> childrenList = new ArrayList<>();
NodeVO node = new NodeVO();
node.setId(dto.getIndex());
node.setName(dto.getName()+"\n("+dto.getLineIndexes().size()+")");
dto.getSubIndexes().forEach(sub->{
List<PollutionLineDTO> l1 = map.get(sub);
NodeVO children = new NodeVO();
children.setId(sub);
children.setPid(dto.getIndex());
children.setName(l1.get(0).getSubstation());
//监测点id
List<String> lines = l1.stream().map(PollutionLineDTO::getId).collect(Collectors.toList());
//获取变电站暂降次数
List<RmpEventDetailPO> dipNum = info.stream().filter(x -> lines.contains(x.getLineId())).collect(Collectors.toList());
children.setData(dipNum.size());
childrenList.add(children);
});
if (!CollectionUtils.isEmpty(childrenList)){
node.setData(childrenList.stream().mapToInt(NodeVO::getData).sum());
node.setChildren(childrenList.stream().sorted(Comparator.comparing(NodeVO::getData).reversed().thenComparing(NodeVO::getName)).collect(Collectors.toList()));
}
nodeVOS.add(node);
}
});
return nodeVOS;
}
/**
* 统计月份信息
*