Merge remote-tracking branch 'origin/main'

This commit is contained in:
xy
2026-01-26 19:28:47 +08:00
19 changed files with 2282 additions and 1832 deletions

View File

@@ -374,7 +374,11 @@ public class CommMonitorEventReportServiceImpl implements CommMonitorEventReport
//6.1整合提出查询语句
Boolean fly = exportParam.isYybg() || exportParam.isYytx() || exportParam.isLxbg() || exportParam.isLxtx();
if (fly) {
StatisticVO statistic = eventReportService.getStatistic(info, reasonData, typeData);
List<DictData> tempDictType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
List<String> typeIds = tempDictType.stream().filter(x -> DicDataEnum.VOLTAGE_DIP.getCode().equals(x.getCode()) || DicDataEnum.SHORT_INTERRUPTIONS.getCode().equals(x.getCode()))
.map(DictData::getId).collect(Collectors.toList());
List<EventDetail> tempInfo = info.stream().filter(temp -> typeIds.contains(temp.getEventType())).collect(Collectors.toList());
StatisticVO statistic = eventReportService.getStatistic(tempInfo, reasonData, typeData);
if (exportParam.isYybg() || exportParam.isYytx()) {
createTitle(doc, "4." + i + " 原因统计", "标题 2", 200, 15);
// StatisticVO statistic = eventAnalysisService.getStatistic(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag()));
@@ -571,14 +575,14 @@ public class CommMonitorEventReportServiceImpl implements CommMonitorEventReport
* @return
*/
private List<EventDetail> info(StatisticsParam statisticsParam) {
//获取事件类型
List<DictData> dictType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
List<String> typeIds = dictType.stream().filter(x -> DicDataEnum.VOLTAGE_DIP.getCode().equals(x.getCode()) || DicDataEnum.SHORT_INTERRUPTIONS.getCode().equals(x.getCode()))
.map(DictData::getId).collect(Collectors.toList());
// //获取事件类型
// List<DictData> dictType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
// List<String> typeIds = dictType.stream().filter(x -> DicDataEnum.VOLTAGE_DIP.getCode().equals(x.getCode()) || DicDataEnum.SHORT_INTERRUPTIONS.getCode().equals(x.getCode()))
// .map(DictData::getId).collect(Collectors.toList());
//数据暂降查询
List<RmpEventDetailPO> info = rmpEventDetailMapper.selectList(new LambdaQueryWrapper<RmpEventDetailPO>()
.eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex())
.in(RmpEventDetailPO::getEventType, typeIds)
// .in(RmpEventDetailPO::getEventType, typeIds)
.ge(StrUtil.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime())))
.le(StrUtil.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime())))
);

View File

@@ -941,37 +941,47 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
.le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime())))
);
List<DictData> reasonList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()).getData();
Map<String,String> reasonData = reasonList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
Map<String, Integer> reasonMap = convertMap(reasonData);
List<DictData> advanceTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData();
Map<String,String> advanceTypeData = advanceTypeList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
Map<String, Integer> typeMap = convertMap(advanceTypeData);
HttpResult<List<DictData>> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName());
HttpResult<List<DictData>> type = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName());
List<DictData> reasonData = reason.getData();
List<DictData> typeData = type.getData();
Map<String, Integer> reasonMap = new LinkedHashMap<>();
Map<String, Integer> typeMap = new LinkedHashMap<>();
info = info.stream().filter(temp->Objects.nonNull(temp.getAdvanceReason())||Objects.nonNull(temp.getAdvanceType())).collect(Collectors.toList());
//添加detail
for (RmpEventDetailPO detail : info) {
EventDetail details = BeanUtil.copyProperties(detail, EventDetail.class);
if(StrUtil.isNotBlank(detail.getAdvanceType())){
details.setAdvanceType(advanceTypeData.get(detail.getAdvanceType()));
}else {
details.setAdvanceType(DicDataEnum.OTHER.getName());
EventDetail details = null;
if (typeList.contains(detail.getEventType())) {
for (DictData data : reasonData) {
reasonMap.put(data.getName(), 0);
//此处写法会报空指针异常修改写法
if (Objects.equals(detail.getAdvanceReason(),data.getId())) {
details = BeanUtil.copyProperties(detail, EventDetail.class);
details.setAdvanceReason(data.getName());
}
}
for (DictData data : typeData) {
typeMap.put(data.getName(), 0);
if (Objects.equals(detail.getAdvanceType(),data.getId())) {
// details = BeanUtil.copyProperties(detail, EventDetail.class);
details.setAdvanceType(data.getName());
}
}
list.add(details);
}
if(StrUtil.isNotBlank(detail.getAdvanceReason())){
details.setAdvanceReason(reasonData.get(detail.getAdvanceReason()));
}else {
details.setAdvanceReason(DicDataEnum.OTHER.getName());
}
list.add(details);
}
//添加reason到map
for (EventDetail data : list) {
if (reasonMap.get(data.getAdvanceReason()) != null) {
if (Objects.nonNull(data.getAdvanceReason())&&reasonMap.get(data.getAdvanceReason()) != null) {
reasonMap.put(data.getAdvanceReason(), reasonMap.get(data.getAdvanceReason()) + 1);
}
}
//添加type到map
for (EventDetail data : list) {
if (typeMap.get(data.getAdvanceType()) != null) {
if (Objects.nonNull(data.getAdvanceType())&&typeMap.get(data.getAdvanceType()) != null) {
typeMap.put(data.getAdvanceType(), typeMap.get(data.getAdvanceType()) + 1);
}
}
@@ -985,29 +995,10 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
}
result.setTypes(typesVOS);
result.setReason(reasonsVOS);
//result.setDetail(list);
return result;
}
/**
* 将原Map的value作为新Map的key0作为新Map的value
* @param originalMap 原始Mapkey和value唯一
* @return 转换后的新Map
*/
public static <K, V> Map<V, Integer> convertMap(Map<K, V> originalMap) {
// 创建新的HashMap存储结果
Map<V, Integer> newMap = new HashMap<>();
// 遍历原始Map的所有entry
for (Map.Entry<K, V> entry : originalMap.entrySet()) {
// 原value作为新key0作为新value
V originalValue = entry.getValue();
newMap.put(originalValue, 0);
}
return newMap;
}
/**
* 暂降幅值的概率分布函数
*
@@ -1337,12 +1328,12 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
// }
// }
//获取电压暂降信息
List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
List<String> typeList = data.stream().filter(it->it.getCode().equals(DicDataEnum.VOLTAGE_DIP.getCode()) || it.getCode().equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())).map(DictData::getId).collect(Collectors.toList());
// List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
// List<String> typeList = data.stream().filter(it->it.getCode().equals(DicDataEnum.VOLTAGE_DIP.getCode()) || it.getCode().equals(DicDataEnum.SHORT_INTERRUPTIONS.getCode())).map(DictData::getId).collect(Collectors.toList());
//查询监测点未处理暂态事件
List<RmpEventDetailPO> eventDetails = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
.eq(RmpEventDetailPO::getMeasurementPointId, statisticsParam.getLineIndex())
.in(RmpEventDetailPO::getEventType,typeList)
// .in(RmpEventDetailPO::getEventType,typeList)
.ge(StringUtils.isNotBlank(statisticsParam.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime())))
.le(StringUtils.isNotBlank(statisticsParam.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(statisticsParam.getEndTime())))
);

View File

@@ -44,7 +44,8 @@ public class EventReportServiceImpl implements EventReportService {
}
for (int i = 0; i < info.size(); i++) {
Double eventvalue = info.get(i).getFeatureAmplitude();
double persisttime = info.get(i).getDuration();
//mysql存的S要转换成ms
double persisttime = info.get(i).getDuration()*1000;
if (eventvalue * 100 < 10) {
if (persisttime < 20) {
arr[4][0]++;
@@ -156,7 +157,8 @@ public class EventReportServiceImpl implements EventReportService {
}
for (int i = 0; i < info.size(); i++) {
Double eventvalue = info.get(i).getFeatureAmplitude();
double persisttime = info.get(i).getDuration();
//mysql存的S要转换成ms
double persisttime = info.get(i).getDuration()*1000;
if (eventvalue * 100 < 1) {
if (persisttime < 20 && persisttime >= 10) {
arr[2][0]++;
@@ -218,7 +220,9 @@ public class EventReportServiceImpl implements EventReportService {
}
for (int i = 0; i < info.size(); i++) {
Double eventvalue = info.get(i).getFeatureAmplitude();
double persisttime = info.get(i).getDuration();
//mysql存的S要转换成ms
double persisttime = info.get(i).getDuration()*1000;
if (eventvalue * 100 < 1 && eventvalue * 100 >= 0) {
if (persisttime > 10 && persisttime <= 100) {
arr[16][0]++;
@@ -709,7 +713,8 @@ public class EventReportServiceImpl implements EventReportService {
timeMap.put("<180", 0);
//求不同时间段的总数
for (EventDetail eventDetail : info) {
Double persistTime = eventDetail.getDuration();
//转换成ms
Double persistTime = eventDetail.getDuration()*1000;
if (persistTime / 1000 < 0.1) {
timeMap.put("<0.1", timeMap.get("<0.1") + 1);
} else if (persistTime / 1000 > 0.1 && persistTime / 1000 < 0.25) {
@@ -770,7 +775,7 @@ public class EventReportServiceImpl implements EventReportService {
//求sisttime
List<String> sisttime = new ArrayList<>();
for (EventDetail eventDetail : info) {
Double persistTime = eventDetail.getDuration();
Double persistTime = eventDetail.getDuration()*1000;
if (persistTime / 1000 < 0.1) {
timeMap2.put("<0.1", timeMap2.get("<0.1") + 1);
}