|
|
@ -23,6 +23,7 @@ import com.hnac.hzims.operational.report.entity.RunMonthEntity; |
|
|
|
import com.hnac.hzims.operational.report.mapper.RunMonthMapper; |
|
|
|
import com.hnac.hzims.operational.report.mapper.RunMonthMapper; |
|
|
|
import com.hnac.hzims.operational.report.service.RunMonthReportService; |
|
|
|
import com.hnac.hzims.operational.report.service.RunMonthReportService; |
|
|
|
import com.hnac.hzims.operational.report.service.RunMonthService; |
|
|
|
import com.hnac.hzims.operational.report.service.RunMonthService; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.report.utils.SetNameFormatterUtil; |
|
|
|
import com.hnac.hzims.operational.report.vo.*; |
|
|
|
import com.hnac.hzims.operational.report.vo.*; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
@ -285,7 +286,7 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt |
|
|
|
// 保存生成月报数据
|
|
|
|
// 保存生成月报数据
|
|
|
|
boolean save = runMonthReportService.save(run); |
|
|
|
boolean save = runMonthReportService.save(run); |
|
|
|
// 调用大模型分析月报接口 结果通过mqtt获取
|
|
|
|
// 调用大模型分析月报接口 结果通过mqtt获取
|
|
|
|
this.smartReportGeneratePower(mon,stationCode); |
|
|
|
new Thread(() -> this.smartReportGeneratePower(mon,stationCode),"运行月报分析结论").start(); |
|
|
|
return save; |
|
|
|
return save; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -313,7 +314,12 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt |
|
|
|
RunReportAnalyseRequest analyseRequest = new RunReportAnalyseRequest(); |
|
|
|
RunReportAnalyseRequest analyseRequest = new RunReportAnalyseRequest(); |
|
|
|
analyseRequest.setMonth(mon); |
|
|
|
analyseRequest.setMonth(mon); |
|
|
|
analyseRequest.setStationCode(stationCode); |
|
|
|
analyseRequest.setStationCode(stationCode); |
|
|
|
analyseRequest.setAnalyseDTOS(analyseVOList); |
|
|
|
// 将设备名称拼接位标准格式
|
|
|
|
|
|
|
|
List<RunReportDataAnalyseDTO> analyseDTOList = analyseVOList.stream() |
|
|
|
|
|
|
|
.sorted(Comparator.comparing(RunReportDataAnalyseDTO::getDeviceOrder)) |
|
|
|
|
|
|
|
.peek(a -> a.setEmName(a.getDeviceOrder() + "#机组")) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
analyseRequest.setAnalyseDTOS(analyseDTOList); |
|
|
|
dataAnalyseClient.smartReportGeneratePower(analyseRequest); |
|
|
|
dataAnalyseClient.smartReportGeneratePower(analyseRequest); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -332,14 +338,43 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt |
|
|
|
List<String> runDatas = rundatas.stream().map(RunDataVo::getDeviceName).distinct().collect(Collectors.toList()); |
|
|
|
List<String> runDatas = rundatas.stream().map(RunDataVo::getDeviceName).distinct().collect(Collectors.toList()); |
|
|
|
List<String> alarmDatas = alarms.stream().map(RunAlarmVo::getDeviceName).distinct().collect(Collectors.toList()); |
|
|
|
List<String> alarmDatas = alarms.stream().map(RunAlarmVo::getDeviceName).distinct().collect(Collectors.toList()); |
|
|
|
Collection<String> unionDeviceNames = CollectionUtils.union(runDatas, alarmDatas); |
|
|
|
Collection<String> unionDeviceNames = CollectionUtils.union(runDatas, alarmDatas); |
|
|
|
|
|
|
|
// 过滤掉设备名称无法获取机组设备的字段以及值为空的字段
|
|
|
|
unionDeviceNames.forEach(deviceName -> { |
|
|
|
unionDeviceNames.forEach(deviceName -> { |
|
|
|
Optional<RunReportDataAnalyseDTO> exist = analyseVOList.stream().filter(vo -> deviceName.equals(vo.getEmName())).findFirst(); |
|
|
|
Integer deviceOrder = SetNameFormatterUtil.getSetOrder(deviceName); |
|
|
|
if(!exist.isPresent()) { |
|
|
|
if(Func.isNotEmpty(deviceOrder)) { |
|
|
|
// 若该设备未新增接受数据对象,则新增之后填充数据
|
|
|
|
String formateDevice = deviceOrder + "#机组"; |
|
|
|
RunReportDataAnalyseDTO analyseVO = this.createDeviceAnalyse(deviceName, month); |
|
|
|
Optional<RunReportDataAnalyseDTO> exist = analyseVOList.stream().filter(a -> formateDevice.equals(a.getEmName())).findFirst(); |
|
|
|
analyseVOList.add(analyseVO); |
|
|
|
if(!exist.isPresent()) { |
|
|
|
|
|
|
|
// 若该设备未新增接受数据对象,则新增之后填充数据
|
|
|
|
|
|
|
|
RunReportDataAnalyseDTO analyseVO = this.createDeviceAnalyse(formateDevice, month, deviceOrder); |
|
|
|
|
|
|
|
analyseVOList.add(analyseVO); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<RunDataVo> runDataVos = rundatas.stream().filter(data -> deviceName.equals(data.getDeviceName())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
Double power = runDataVos.stream().collect(Collectors.summingDouble(RunDataVo::getGenerate)); |
|
|
|
|
|
|
|
Double runHours = runDataVos.stream().collect(Collectors.summingDouble(RunDataVo::getRunHours)); |
|
|
|
|
|
|
|
RunReportDataAnalyseDTO analyseDTO = analyseVOList.stream().filter(a -> formateDevice.equals(a.getEmName())).findFirst().get(); |
|
|
|
|
|
|
|
PowerDataDTO powerDataDTO = analyseDTO.getPower().stream().filter(p -> req.getMonth().equals(p.getDate())).findFirst().get(); |
|
|
|
|
|
|
|
// 发电量赋值
|
|
|
|
|
|
|
|
if(Func.isNotEmpty(powerDataDTO)) { |
|
|
|
|
|
|
|
if(Func.isNotEmpty(power)) { |
|
|
|
|
|
|
|
powerDataDTO.setValue(Optional.ofNullable(powerDataDTO.getValue()).orElse(0.0) + power); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(Func.isNotEmpty(runHours)) { |
|
|
|
|
|
|
|
powerDataDTO.setRunTime(Optional.ofNullable(powerDataDTO.getRunTime()).orElse(0.0) + runHours); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 告警信息
|
|
|
|
|
|
|
|
List<SoeDataDTO> soeDataDTOS = alarms.stream().filter(a -> deviceName.equals(a.getDeviceName())).map(alarm -> { |
|
|
|
|
|
|
|
SoeDataDTO soeDataDTO = new SoeDataDTO(); |
|
|
|
|
|
|
|
soeDataDTO.setDate(month); |
|
|
|
|
|
|
|
soeDataDTO.setName(alarm.getContent()); |
|
|
|
|
|
|
|
soeDataDTO.setTimes(alarm.getCount()); |
|
|
|
|
|
|
|
return soeDataDTO; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(soeDataDTOS)) { |
|
|
|
|
|
|
|
analyseDTO.getSoe().addAll(soeDataDTOS); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.fillDeviceAnalyse(deviceName,req.getMonth(),rundatas,alarms,analyseVOList); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -348,11 +383,13 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt |
|
|
|
* 创建大模型分析所需对象 |
|
|
|
* 创建大模型分析所需对象 |
|
|
|
* @param deviceName 设备名称 |
|
|
|
* @param deviceName 设备名称 |
|
|
|
* @param month 对象月份 |
|
|
|
* @param month 对象月份 |
|
|
|
|
|
|
|
* @param deviceOrder 设备序号 |
|
|
|
* @return 大模型分析所需对象 |
|
|
|
* @return 大模型分析所需对象 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private RunReportDataAnalyseDTO createDeviceAnalyse(String deviceName, String month) { |
|
|
|
private RunReportDataAnalyseDTO createDeviceAnalyse(String deviceName, String month, Integer deviceOrder) { |
|
|
|
RunReportDataAnalyseDTO analyseVO = new RunReportDataAnalyseDTO(); |
|
|
|
RunReportDataAnalyseDTO analyseVO = new RunReportDataAnalyseDTO(); |
|
|
|
analyseVO.setEmName(deviceName); |
|
|
|
analyseVO.setEmName(deviceName); |
|
|
|
|
|
|
|
analyseVO.setDeviceOrder(deviceOrder); |
|
|
|
YearMonth yearMonth = YearMonth.parse(month); |
|
|
|
YearMonth yearMonth = YearMonth.parse(month); |
|
|
|
List<PowerDataDTO> powerDataDTOS = Lists.newArrayList(); |
|
|
|
List<PowerDataDTO> powerDataDTOS = Lists.newArrayList(); |
|
|
|
List<RunTimeDataDTO> runTimeDataDTOS = Lists.newArrayList(); |
|
|
|
List<RunTimeDataDTO> runTimeDataDTOS = Lists.newArrayList(); |
|
|
@ -368,37 +405,37 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt |
|
|
|
return analyseVO; |
|
|
|
return analyseVO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
// /**
|
|
|
|
* 填充大模型分析所需参数 |
|
|
|
// * 填充大模型分析所需参数
|
|
|
|
* @param deviceName 设备名称 |
|
|
|
// * @param deviceName 设备名称
|
|
|
|
* @param month 月报数据月份 |
|
|
|
// * @param month 月报数据月份
|
|
|
|
* @param rundatas 月报运行数据 |
|
|
|
// * @param rundatas 月报运行数据
|
|
|
|
* @param alarms 月报告警报表数据 |
|
|
|
// * @param alarms 月报告警报表数据
|
|
|
|
* @param analyseVOList 待填充的设备分析传参对象 |
|
|
|
// * @param analyseVOList 待填充的设备分析传参对象
|
|
|
|
*/ |
|
|
|
// */
|
|
|
|
private void fillDeviceAnalyse(String deviceName,String month,List<RunDataVo> rundatas,List<RunAlarmVo> alarms,List<RunReportDataAnalyseDTO> analyseVOList) { |
|
|
|
// private void fillDeviceAnalyse(String deviceName,String formateDeviceName,String month,List<RunDataVo> rundatas,List<RunAlarmVo> alarms,List<RunReportDataAnalyseDTO> analyseVOList) {
|
|
|
|
Optional<RunDataVo> runDataVo = rundatas.stream().filter(d -> deviceName.equals(d.getDeviceName())).findFirst(); |
|
|
|
// Optional<RunDataVo> runDataVo = rundatas.stream().filter(d -> deviceName.equals(d.getDeviceName())).findFirst();
|
|
|
|
List<SoeDataDTO> soeDataDTOS = alarms.stream().filter(a -> deviceName.equals(a.getDeviceName())).map(alarm -> { |
|
|
|
// List<SoeDataDTO> soeDataDTOS = alarms.stream().filter(a -> deviceName.equals(a.getDeviceName())).map(alarm -> {
|
|
|
|
SoeDataDTO soeDataDTO = new SoeDataDTO(); |
|
|
|
// SoeDataDTO soeDataDTO = new SoeDataDTO();
|
|
|
|
soeDataDTO.setDate(month); |
|
|
|
// soeDataDTO.setDate(month);
|
|
|
|
soeDataDTO.setName(alarm.getContent()); |
|
|
|
// soeDataDTO.setName(alarm.getContent());
|
|
|
|
soeDataDTO.setTimes(alarm.getCount()); |
|
|
|
// soeDataDTO.setTimes(alarm.getCount());
|
|
|
|
return soeDataDTO; |
|
|
|
// return soeDataDTO;
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
// }).collect(Collectors.toList());
|
|
|
|
RunReportDataAnalyseDTO analyseVO = analyseVOList.stream().filter(vo -> deviceName.equals(vo.getEmName())).findFirst().get(); |
|
|
|
// RunReportDataAnalyseDTO analyseVO = analyseVOList.stream().filter(vo -> deviceName.equals(vo.getEmName())).findFirst().get();
|
|
|
|
if(runDataVo.isPresent()) { |
|
|
|
// if(runDataVo.isPresent()) {
|
|
|
|
// 补充发电量、运行时长
|
|
|
|
// // 补充发电量、运行时长
|
|
|
|
Optional<PowerDataDTO> powerData = analyseVO.getPower().stream().filter(p -> month.equals(p.getDate())).findFirst(); |
|
|
|
// Optional<PowerDataDTO> powerData = analyseVO.getPower().stream().filter(p -> month.equals(p.getDate())).findFirst();
|
|
|
|
if(powerData.isPresent()) { |
|
|
|
// if(powerData.isPresent()) {
|
|
|
|
powerData.get().setValue(runDataVo.get().getGenerate()); |
|
|
|
// powerData.get().setValue();
|
|
|
|
powerData.get().setRunTime(runDataVo.get().getRunHours()); |
|
|
|
// powerData.get().setRunTime(runDataVo.get().getRunHours());
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
if(Func.isNotEmpty(soeDataDTOS)) { |
|
|
|
// if(Func.isNotEmpty(soeDataDTOS)) {
|
|
|
|
// 补充告警
|
|
|
|
// // 补充告警
|
|
|
|
analyseVO.getSoe().addAll(soeDataDTOS); |
|
|
|
// analyseVO.getSoe().addAll(soeDataDTOS);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 先删除原先月报数据 |
|
|
|
* 先删除原先月报数据 |
|
|
@ -797,6 +834,12 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Boolean generateAnalyseResult(String month, String stationCode) { |
|
|
|
|
|
|
|
this.smartReportGeneratePower(month,stationCode); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 手绘运行数据表格 |
|
|
|
* 手绘运行数据表格 |
|
|
|
* @return |
|
|
|
* @return |
|
|
|