1.终端运行评价初始化类

2.解决稳态符合性占比图接口异常和暂态事件列表按照10kV电压等级查询结果为空
This commit is contained in:
wr
2025-05-08 14:00:49 +08:00
parent 1d594e0810
commit 31dd5f1f1e
8 changed files with 99 additions and 40 deletions

View File

@@ -42,6 +42,8 @@ public class GridDiagramVO {
@Data
public static class LineStatisticsData {
@ApiModelProperty(name = "columnName", value = "列名")
private String columnName;
@ApiModelProperty(name = "num", value = "监测点个数")
private Integer num;
@@ -64,6 +66,8 @@ public class GridDiagramVO {
@Data
public static class StatisticsData {
@ApiModelProperty(name = "columnName", value = "列名")
private String columnName;
@ApiModelProperty(name = "numOne", value = "数据")
private Long numOne;
@@ -71,6 +75,9 @@ public class GridDiagramVO {
@ApiModelProperty(name = "numOneList", value = "数据集合")
private List<String> numOneList;
/**
* 上送国网
*/
@ApiModelProperty(name = "numTwo", value = "数据")
private Long numTwo;

View File

@@ -0,0 +1,24 @@
package com.njcn.device.pq.controller;
import com.njcn.device.pq.service.DeviceRunEvaluateService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author 终端运行评价
* @description
* @date 2025/5/8 13:57
*/
@Slf4j
@Api(tags = "终端运行评价")
@RestController
@RequestMapping("/deviceRunEvaluate")
@RequiredArgsConstructor
public class DeviceRunEvaluateController {
private final DeviceRunEvaluateService deviceRunEvaluateService;
}

View File

@@ -0,0 +1,9 @@
package com.njcn.device.pq.service;
/**
* @author wr
* @description
* @date 2025/5/8 13:45
*/
public interface DeviceRunEvaluateService {
}

View File

@@ -0,0 +1,18 @@
package com.njcn.device.pq.service.impl;
import com.njcn.device.pq.service.DeviceRunEvaluateService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
* @author wr
* @description
* @date 2025/5/8 13:45
*/
@Service
@RequiredArgsConstructor
public class DeviceRunEvaluateServiceImpl implements DeviceRunEvaluateService {
}

View File

@@ -429,7 +429,7 @@ public class GeneralDeviceService {
//3.筛选出变电站id理论上监测点的pids中第四个id为变电站id 联查: pq_line t1 ,pq_substation t2
List<String> subIds=devices.stream().map(Line::getPid).collect(Collectors.toList());
List<Line> sub = terminalBaseService.getSubByCondition(subIds, deviceInfoParam.getScale());
List<Line> sub = terminalBaseService.getSubByCondition(subIds, new ArrayList<>());
//筛选最终的数据
dealDeviceData(generalDeviceDTO, lines, devices, voltages, sub);

View File

@@ -169,7 +169,7 @@ public class GridDiagramServiceImpl implements GridDiagramService {
//终端id集合
List<String> devIds = lineBaseList.stream().filter(x -> value.equals(x.getVoltageLevel())).map(LineDevGetDTO::getDevId).distinct().collect(Collectors.toList());
gridDiagramAdd(statisticsData, onlineRateByDevIds, onIntegrityByIds, devIds, lineIds, onLineNumIds);
gridDiagramAdd(statisticsData, onlineRateByDevIds,value, onIntegrityByIds, devIds, lineIds, onLineNumIds);
}
@@ -180,11 +180,12 @@ public class GridDiagramServiceImpl implements GridDiagramService {
List<String> lineIdsAll = lineBaseList.stream().map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
List<String> onLineNumAll = lineBaseList.stream().filter(x -> 1 == x.getComFlag()).map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
gridDiagramAdd(statisticsData, onlineRateByDevIds, onIntegrityByIds, devIdsAll, lineIdsAll, onLineNumAll);
gridDiagramAdd(statisticsData, onlineRateByDevIds,null, onIntegrityByIds, devIdsAll, lineIdsAll, onLineNumAll);
}
private void gridDiagramAdd(List<GridDiagramVO.LineStatisticsData> statisticsData, List<RStatOnlinerateD> onlineRateByDevIds, List<RStatIntegrityD> onIntegrityByIds, List<String> devIdsAll, List<String> lineIdsAll, List<String> onLineNumAll) {
private void gridDiagramAdd(List<GridDiagramVO.LineStatisticsData> statisticsData, List<RStatOnlinerateD> onlineRateByDevIds,String value, List<RStatIntegrityD> onIntegrityByIds, List<String> devIdsAll, List<String> lineIdsAll, List<String> onLineNumAll) {
GridDiagramVO.LineStatisticsData lineStatisticsData = new GridDiagramVO.LineStatisticsData();
lineStatisticsData.setColumnName(value);
lineStatisticsData.setNum(lineIdsAll.size());
lineStatisticsData.setNumList(lineIdsAll);
lineStatisticsData.setOnLineNum(onLineNumAll.size());
@@ -203,7 +204,7 @@ public class GridDiagramServiceImpl implements GridDiagramService {
//终端id集合
List<String> devIds = lineBaseList.stream().filter(x -> value.equals(x.getVoltageLevel())).filter(x -> 1 == x.getIsUpToGrid()).map(LineDevGetDTO::getDevId).distinct().collect(Collectors.toList());
gridDiagramAdd(statisticsData, onlineRateByDevIds, onIntegrityByIds, devIds, lineIds, onLineNumIds);
gridDiagramAdd(statisticsData, onlineRateByDevIds, value, onIntegrityByIds, devIds, lineIds, onLineNumIds);
}
private void gwStatisticsDataOtherList(List<GridDiagramVO.LineStatisticsData> statisticsData, List<LineDevGetDTO> lineBaseList, List<RStatOnlinerateD> onlineRateByDevIds, List<RStatIntegrityD> onIntegrityByIds) {
@@ -213,7 +214,7 @@ public class GridDiagramServiceImpl implements GridDiagramService {
List<String> lineIdsAll = lineBaseList.stream().filter(x -> 1 == x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
List<String> onLineNumAll = lineBaseList.stream().filter(x -> 1 == x.getComFlag() && 1 == x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
gridDiagramAdd(statisticsData, onlineRateByDevIds, onIntegrityByIds, devIdsAll, lineIdsAll, onLineNumAll);
gridDiagramAdd(statisticsData, onlineRateByDevIds,null, onIntegrityByIds, devIdsAll, lineIdsAll, onLineNumAll);
}
private void onLineAndIntegrity(List<String> lineIds, List<RStatIntegrityD> onIntegrityByIds, List<String> devIds, List<RStatOnlinerateD> onlineRateByDevIds, GridDiagramVO.LineStatisticsData lineStatisticsData) {
@@ -555,6 +556,7 @@ public class GridDiagramServiceImpl implements GridDiagramService {
for (String voltageId : voltageIds) {
for (int i = 0; i < 2; i++) {
data = new GridDiagramVO.StatisticsData();
data.setColumnName(voltageId);
int finalI = i;
//todo 1国网信息
long count = lineBaseList.stream().filter(x -> getIsUpToGrid(finalI, x, voltageId)).map(LineDevGetDTO::getDevId).distinct().count();

View File

@@ -97,7 +97,6 @@ public class TransientServiceImpl implements TransientService {
private final DeviceTreeClient deviceTreeClient;
@Override
public Page<TransientVO> getTransientData(TransientParam transientParam) {
Page<TransientVO> page = new Page<>();
@@ -196,11 +195,11 @@ public class TransientServiceImpl implements TransientService {
ip = monitorVO.getIp();
}
String waveName = eventDetail.getWavePath();
String cfgPath, datPath,cfgPath2,datPath2;
String cfgPath, datPath, cfgPath2, datPath2;
if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) {
cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG;
datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT;
log.info("本地磁盘波形文件路径----"+cfgPath);
log.info("本地磁盘波形文件路径----" + cfgPath);
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
@@ -213,7 +212,7 @@ public class TransientServiceImpl implements TransientService {
//适配文件后缀小写
cfgPath2 = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG.toLowerCase();
datPath2 = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT.toLowerCase();
log.info("文件服务器波形文件路径----"+cfgPath);
log.info("文件服务器波形文件路径----" + cfgPath);
try (
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath);
InputStream datStream = fileStorageUtil.getFileStream(datPath)
@@ -230,7 +229,7 @@ public class TransientServiceImpl implements TransientService {
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
}
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
}catch (Exception e1){
} catch (Exception e1) {
throw new BusinessException(WaveFileResponseEnum.WAVE_DATA_INVALID);
}
@@ -292,11 +291,11 @@ public class TransientServiceImpl implements TransientService {
page.setSize(transientParam.getPageSize());
page.setCurrent(transientParam.getPageNum());
// 按部门分类的实际运行终端综合信息
List<GeneralDeviceDTO> generalDeviceDTOList =new ArrayList<>();
if(transientParam.getIsType()==0){
List<GeneralDeviceDTO> generalDeviceDTOList;
if (transientParam.getIsType() == 0) {
generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(transientParam).getData();
}else{
generalDeviceDTOList = generalDeviceInfoClient.getOfflineRunDeviceInfo(transientParam).getData();
} else {
generalDeviceDTOList = generalDeviceInfoClient.getOfflineRunDeviceInfo(transientParam).getData();
}
if (!CollectionUtils.isEmpty(generalDeviceDTOList)) {
if (Objects.nonNull(transientParam.getEventValueMin())) {
@@ -308,12 +307,12 @@ public class TransientServiceImpl implements TransientService {
// 获取按终端分类的监测点索引集合
List<String> lineList = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
List<TerminalTree> data = deviceTreeClient.getTerminalTree().getData();
if(!CollectionUtils.isEmpty(transientParam.getSubstationIds())){
if (!CollectionUtils.isEmpty(transientParam.getSubstationIds())) {
List<String> collect = data.stream().map(TerminalTree::getChildren).flatMap(Collection::stream)
.map(TerminalTree::getChildren).flatMap(Collection::stream)
.map(TerminalTree::getChildren).flatMap(Collection::stream)
.map(TerminalTree::getChildren).flatMap(Collection::stream)
.filter(temp->transientParam.getSubstationIds().contains(temp.getId()))
.filter(temp -> transientParam.getSubstationIds().contains(temp.getId()))
.map(TerminalTree::getChildren).flatMap(Collection::stream)
.map(TerminalTree::getChildren).flatMap(Collection::stream)
.map(TerminalTree::getChildren).flatMap(Collection::stream)
@@ -321,7 +320,7 @@ public class TransientServiceImpl implements TransientService {
lineList.retainAll(collect);
}
if(!CollectionUtils.isEmpty(transientParam.getLineIds())){
if (!CollectionUtils.isEmpty(transientParam.getLineIds())) {
List<String> collect1 = data.stream().map(TerminalTree::getChildren).flatMap(Collection::stream)
.map(TerminalTree::getChildren).flatMap(Collection::stream)
.map(TerminalTree::getChildren).flatMap(Collection::stream)
@@ -329,11 +328,11 @@ public class TransientServiceImpl implements TransientService {
.map(TerminalTree::getChildren).flatMap(Collection::stream)
.map(TerminalTree::getChildren).flatMap(Collection::stream)
.map(TerminalTree::getChildren).flatMap(Collection::stream)
.filter(temp->transientParam.getLineIds().contains(temp.getId()))
.filter(temp -> transientParam.getLineIds().contains(temp.getId()))
.map(TerminalTree::getId).collect(Collectors.toList());
lineList.retainAll(collect1);
}
if(CollUtil.isEmpty(lineList)){
if (CollUtil.isEmpty(lineList)) {
return new Page<>();
}
List<AreaLineInfoVO> lineInfoVOList = lineFeignClient.getBaseLineAreaInfo(lineList).getData();
@@ -351,17 +350,17 @@ public class TransientServiceImpl implements TransientService {
.in(CollUtil.isNotEmpty(transientParam.getEventType()), RmpEventDetailPO::getAdvanceType, transientParam.getEventType());
if(StrUtil.isNotBlank(transientParam.getOrderBy())){
if(transientParam.getSortBy().equals("start_time")){
wrapper.orderBy(true,transientParam.getOrderBy().equals("asc"),RmpEventDetailPO::getStartTime);
}else if(transientParam.getSortBy().equals("feature_amplitude")){
wrapper.orderBy(true,transientParam.getOrderBy().equals("asc"),RmpEventDetailPO::getFeatureAmplitude);
}else if(transientParam.getSortBy().equals("firstMs")){
wrapper.orderBy(true,transientParam.getOrderBy().equals("asc"),RmpEventDetailPO::getFirstMs);
}else if(transientParam.getSortBy().equals("duration")){
wrapper.orderBy(true,transientParam.getOrderBy().equals("asc"),RmpEventDetailPO::getDuration);
if (StrUtil.isNotBlank(transientParam.getOrderBy())) {
if (transientParam.getSortBy().equals("start_time")) {
wrapper.orderBy(true, transientParam.getOrderBy().equals("asc"), RmpEventDetailPO::getStartTime);
} else if (transientParam.getSortBy().equals("feature_amplitude")) {
wrapper.orderBy(true, transientParam.getOrderBy().equals("asc"), RmpEventDetailPO::getFeatureAmplitude);
} else if (transientParam.getSortBy().equals("firstMs")) {
wrapper.orderBy(true, transientParam.getOrderBy().equals("asc"), RmpEventDetailPO::getFirstMs);
} else if (transientParam.getSortBy().equals("duration")) {
wrapper.orderBy(true, transientParam.getOrderBy().equals("asc"), RmpEventDetailPO::getDuration);
}
}else {
} else {
wrapper.orderByDesc(RmpEventDetailPO::getStartTime);
}
@@ -383,7 +382,7 @@ public class TransientServiceImpl implements TransientService {
if (Objects.nonNull(transientParam.getFileFlag())) {
wrapper.eq(Objects.nonNull(transientParam.getFileFlag()), RmpEventDetailPO::getFileFlag, transientParam.getFileFlag());
}
wrapper.in(!CollectionUtils.isEmpty(transientParam.getVerifyReason()),RmpEventDetailPO::getVerifyReason,transientParam.getVerifyReason());
wrapper.in(!CollectionUtils.isEmpty(transientParam.getVerifyReason()), RmpEventDetailPO::getVerifyReason, transientParam.getVerifyReason());
// Page<RmpEventDetailPO> pageInfo = eventDetailService.page(new Page<>(transientParam.getPageNum(), transientParam.getPageSize()),wrapper);
Page<RmpEventDetailPO> pageInfo = pwRmpEventDetailMapper.selectPage(new Page<>(transientParam.getPageNum(), transientParam.getPageSize()), wrapper);
List<EventDetailNew> eventDetailData = BeanUtil.copyToList(pageInfo.getRecords(), EventDetailNew.class);
@@ -395,7 +394,7 @@ public class TransientServiceImpl implements TransientService {
List<DictData> typeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData();
for (EventDetailNew eventDetail : eventDetailData) {
DecimalFormat df = new DecimalFormat("#0.000");
eventDetail.setSeverity(Double.parseDouble(df.format(Objects.isNull(eventDetail.getSeverity())?0.00:eventDetail.getSeverity())));
eventDetail.setSeverity(Double.parseDouble(df.format(Objects.isNull(eventDetail.getSeverity()) ? 0.00 : eventDetail.getSeverity())));
for (AreaLineInfoVO areaLineInfoVO : r) {
if (eventDetail.getLineId().equals(areaLineInfoVO.getLineId())) {
eventDetail.setLineId(areaLineInfoVO.getLineId());
@@ -440,9 +439,9 @@ public class TransientServiceImpl implements TransientService {
@Override
public void updateEventReason(EventVerifyReasonParam eventVerifyReasonParam) {
eventDetailService.lambdaUpdate()
.eq(RmpEventDetailPO::getEventId,eventVerifyReasonParam.getEventId())
.set(RmpEventDetailPO::getVerifyReason,eventVerifyReasonParam.getVerifyReason())
.set(RmpEventDetailPO::getVerifyReasonDetail,eventVerifyReasonParam.getVerifyReasonDetail())
.eq(RmpEventDetailPO::getEventId, eventVerifyReasonParam.getEventId())
.set(RmpEventDetailPO::getVerifyReason, eventVerifyReasonParam.getVerifyReason())
.set(RmpEventDetailPO::getVerifyReasonDetail, eventVerifyReasonParam.getVerifyReasonDetail())
.update();
}
@@ -467,10 +466,10 @@ public class TransientServiceImpl implements TransientService {
*/
public void copyTempData(List<String> eventIds) {
List<RmpEventDetailPO> rmpEventDetailPOList = eventDetailService.listByIds(eventIds);
List<RmpEventDetailPO> nullWave = rmpEventDetailPOList.stream().filter(item->Objects.isNull(item.getWavePath())).collect(Collectors.toList());
if(nullWave.size()!=0){
throw new BusinessException("请选择存在波形的事件导出!");
}
List<RmpEventDetailPO> nullWave = rmpEventDetailPOList.stream().filter(item -> Objects.isNull(item.getWavePath())).collect(Collectors.toList());
if (nullWave.size() != 0) {
throw new BusinessException("请选择存在波形的事件导出!");
}
if (CollUtil.isNotEmpty(rmpEventDetailPOList)) {
for (int i = 0; i < rmpEventDetailPOList.size(); i++) {
//根据监测点id获取监测点详情

View File

@@ -61,7 +61,6 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl<RMpTargetWarnDMapper,
voltageIds = dictDataList.stream().filter(item -> vName.contains(item.getName())).sorted(Comparator.comparing(DictData::getSort).reversed()).map(DictData::getId).collect(Collectors.toList());
}else{
voltageIds = dictDataList.stream().filter(item -> Objects.equals(DicDataEnum.DY_500KV.getCode(), item.getCode()) || Objects.equals(DicDataEnum.DY_220KV.getCode(), item.getCode()) || Objects.equals(DicDataEnum.DY_110KV.getCode(), item.getCode()) || Objects.equals(DicDataEnum.DY_35KV.getCode(), item.getCode())).sorted(Comparator.comparing(DictData::getSort).reversed()).map(DictData::getId).collect(Collectors.toList());
}
@@ -136,6 +135,7 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl<RMpTargetWarnDMapper,
for (String voltageId : voltageIds) {
for (int i = 0; i < 2; i++) {
data = new GridDiagramVO.StatisticsData();
data.setColumnName(voltageId);
int finalI = i;
long count = subBaseList.stream()
.filter(x -> getIsUpToGrid(finalI, x, voltageId))