新能源专项分析功能优化

This commit is contained in:
wr
2025-04-01 20:38:43 +08:00
parent cd8c31ccd6
commit ede8c5c7af
9 changed files with 103 additions and 108 deletions

View File

@@ -54,7 +54,6 @@ public class SpThroughServiceImpl extends MppServiceImpl<SpThroughMapper, SpThro
private final EventDetailFeignClient eventDetailFeignClient;
private final TransientFeignClient transientFeignClient;
private final DeptLineFeignClient deptLineFeignClient;
private final UserLedgerFeignClient userLedgerFeignClient;
private final LineFeignClient lineFeignClient;
private final DictTreeFeignClient dictTreeFeignClient;
private final DicDataFeignClient dicDataFeignClient;
@@ -72,98 +71,98 @@ public class SpThroughServiceImpl extends MppServiceImpl<SpThroughMapper, SpThro
List<String> lineIds = deptLineFeignClient.getLineByDeptIdAndNewStation(null).getData();
if (CollUtil.isNotEmpty(lineIds)) {
List<LineDetailDataVO> lineDetailDataVOS = lineFeignClient.getLineDetailList(lineIds).getData();
Map<String, LineDetailDataVO> lineDetailDataMap = lineDetailDataVOS.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity()));
List<String> objIds = lineDetailDataVOS.stream().map(LineDetailDataVO::getObyId).distinct().collect(Collectors.toList());
List<NewUserReportVO> userReportVOS = userLedgerFeignClient.getUserReportByIds(objIds).getData();
Map<String, Double> userReportMap = userReportVOS.stream().collect(Collectors.toMap(NewUserReportVO::getId, NewUserReportVO::getRatePower));
EventCountParam param = new EventCountParam();
param.setIds(lineIds);
param.setStartTime(getLastTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
param.setEndTime(currentTime.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
List<RmpEventDetailPO> evenStDetailPOS = eventDetailFeignClient.getNewEventDetailByTime(param).getData();
MonitorTerminalParam monitorTerminalParam = new MonitorTerminalParam();
monitorTerminalParam.setSystemType(0);
monitorTerminalParam.setType(0);
for (RmpEventDetailPO rmpEventDetailPO : evenStDetailPOS) {
if (lineDetailDataMap.containsKey(rmpEventDetailPO.getMeasurementPointId())) {
LineDetailDataVO line = lineDetailDataMap.get(rmpEventDetailPO.getMeasurementPointId());
LambdaQueryWrapper<SpThroughPO> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.eq(SpThroughPO::getEventId, rmpEventDetailPO.getEventId())
.eq(SpThroughPO::getEventType, rmpEventDetailPO.getEventType())
.eq(SpThroughPO::getStationType, line.getBigObjType())
.eq(SpThroughPO::getState, 1);
if (this.baseMapper.selectList(lambdaQueryWrapper).isEmpty()) {
//准备高低电压穿越实体bean
SpThroughPO spThroughPO = new SpThroughPO();
spThroughPO.setId(IdUtil.simpleUUID());
spThroughPO.setEventId(rmpEventDetailPO.getEventId());
spThroughPO.setEventType(rmpEventDetailPO.getEventType());
spThroughPO.setStationType(line.getBigObjType());
//默认该事件没有穿越
spThroughPO.setIsOrNot(0);
//设置波形查询的条件:事件ID
monitorTerminalParam.setId(rmpEventDetailPO.getEventId());
//获取RMS波形数据(由于WaveDataDTO为复杂对象所以转成byte数组在进行反序列化)
byte[] bytes = transientFeignClient.getTransientAnalyseWaveToByteArray(monitorTerminalParam).getData();
WaveDataDTO waveDataDTO = null;
try {
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bis);
//强转成WaveDataDTO
waveDataDTO = (WaveDataDTO) ois.readObject();
} catch (Exception e) {
e.printStackTrace();
}
//标称电压
if (line.getScale() != null) {
Float voltageLevel = Float.parseFloat(line.getScale());
//格式化数据源
List<List<Float>> newListRmsData = listRmsDataFormat(waveDataDTO);
//暂升事件
if (rmpEventDetailPO.getEventType().equals(rise.getId())) {
//风电场
if (line.getBigObjType().equals(windFarms.getId())) {
if (isThrough(125, 130, 500, voltageLevel.floatValue(), newListRmsData)
&& isThrough(120, 125, 1000, voltageLevel.floatValue(), newListRmsData)
&& isThrough(110, 120, 10000, voltageLevel.floatValue(), newListRmsData)) {
spThroughPO.setIsOrNot(1);
}
}
//光伏电站
if (line.getBigObjType().equals(powerStation.getId())) {
if (isThrough(125, 130, 500, voltageLevel.floatValue(), newListRmsData)
&& isThrough(120, 125, 1000, voltageLevel.floatValue(), newListRmsData)
&& isThrough(110, 120, 10000, voltageLevel.floatValue(), newListRmsData)) {
spThroughPO.setIsOrNot(1);
}
}
}
//暂降事件
if (rmpEventDetailPO.getEventType().equals(dip.getId())) {
//风电场
if (line.getBigObjType().equals(windFarms.getId())) {
if (isThrough(20, -1, 625, voltageLevel.floatValue(), newListRmsData)) {
spThroughPO.setIsOrNot(1);
}
}
//光伏电站
if (line.getBigObjType().equals(powerStation.getId())) {
if (isThrough(0, -1, 150, voltageLevel.floatValue(), newListRmsData)
&& isThrough(20, -1, 625, voltageLevel.floatValue(), newListRmsData)
&& isThrough(20, 90, -1, voltageLevel.floatValue(), newListRmsData)) {
spThroughPO.setIsOrNot(1);
}
}
}
spThroughPO.setCreateTime(currentTime);
this.baseMapper.insert(spThroughPO);
}
}
if (CollUtil.isNotEmpty(lineDetailDataVOS)) {
Map<String, LineDetailDataVO> lineDetailDataMap = lineDetailDataVOS.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity()));
EventCountParam param = new EventCountParam();
param.setIds(new ArrayList<>(lineDetailDataMap.keySet()));
LocalDateTime lastTime = getLastTime();
if (ObjectUtil.isNotNull(getLastTime())) {
param.setStartTime(lastTime.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
}
param.setEndTime(currentTime.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
List<RmpEventDetailPO> evenStDetailPOS = eventDetailFeignClient.getNewEventDetailByTime(param).getData();
MonitorTerminalParam monitorTerminalParam = new MonitorTerminalParam();
monitorTerminalParam.setSystemType(0);
monitorTerminalParam.setType(0);
for (RmpEventDetailPO rmpEventDetailPO : evenStDetailPOS) {
if (lineDetailDataMap.containsKey(rmpEventDetailPO.getMeasurementPointId())) {
LineDetailDataVO line = lineDetailDataMap.get(rmpEventDetailPO.getMeasurementPointId());
LambdaQueryWrapper<SpThroughPO> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.eq(SpThroughPO::getEventId, rmpEventDetailPO.getEventId())
.eq(SpThroughPO::getEventType, rmpEventDetailPO.getEventType())
.eq(SpThroughPO::getStationType, line.getBigObjType())
.eq(SpThroughPO::getState, 1);
if (this.baseMapper.selectList(lambdaQueryWrapper).isEmpty()) {
//准备高低电压穿越实体bean
SpThroughPO spThroughPO = new SpThroughPO();
spThroughPO.setId(IdUtil.simpleUUID());
spThroughPO.setEventId(rmpEventDetailPO.getEventId());
spThroughPO.setEventType(rmpEventDetailPO.getEventType());
spThroughPO.setStationType(line.getBigObjType());
//默认该事件没有穿越
spThroughPO.setIsOrNot(0);
//设置波形查询的条件:事件ID
monitorTerminalParam.setId(rmpEventDetailPO.getEventId());
//获取RMS波形数据(由于WaveDataDTO为复杂对象所以转成byte数组在进行反序列化)
byte[] bytes = transientFeignClient.getTransientAnalyseWaveToByteArray(monitorTerminalParam).getData();
WaveDataDTO waveDataDTO = null;
try {
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bis);
//强转成WaveDataDTO
waveDataDTO = (WaveDataDTO) ois.readObject();
} catch (Exception e) {
e.printStackTrace();
}
//标称电压
if (line.getScale() != null) {
Float voltageLevel = Float.parseFloat(line.getScale());
//格式化数据源
List<List<Float>> newListRmsData = listRmsDataFormat(waveDataDTO);
//暂升事件
if (rmpEventDetailPO.getEventType().equals(rise.getId())) {
//风电场
if (line.getBigObjType().equals(windFarms.getId())) {
if (isThrough(125, 130, 500, voltageLevel.floatValue(), newListRmsData)
&& isThrough(120, 125, 1000, voltageLevel.floatValue(), newListRmsData)
&& isThrough(110, 120, 10000, voltageLevel.floatValue(), newListRmsData)) {
spThroughPO.setIsOrNot(1);
}
}
//光伏电站
if (line.getBigObjType().equals(powerStation.getId())) {
if (isThrough(125, 130, 500, voltageLevel.floatValue(), newListRmsData)
&& isThrough(120, 125, 1000, voltageLevel.floatValue(), newListRmsData)
&& isThrough(110, 120, 10000, voltageLevel.floatValue(), newListRmsData)) {
spThroughPO.setIsOrNot(1);
}
}
}
//暂降事件
if (rmpEventDetailPO.getEventType().equals(dip.getId())) {
//风电场
if (line.getBigObjType().equals(windFarms.getId())) {
if (isThrough(20, -1, 625, voltageLevel.floatValue(), newListRmsData)) {
spThroughPO.setIsOrNot(1);
}
}
//光伏电站
if (line.getBigObjType().equals(powerStation.getId())) {
if (isThrough(0, -1, 150, voltageLevel.floatValue(), newListRmsData)
&& isThrough(20, -1, 625, voltageLevel.floatValue(), newListRmsData)
&& isThrough(20, 90, -1, voltageLevel.floatValue(), newListRmsData)) {
spThroughPO.setIsOrNot(1);
}
}
}
spThroughPO.setCreateTime(currentTime);
this.baseMapper.insert(spThroughPO);
}
}
}
}
}
}
}
@@ -233,7 +232,7 @@ public class SpThroughServiceImpl extends MppServiceImpl<SpThroughMapper, SpThro
List<Integer> indexs = new ArrayList<>();
//根据channelNames取出电压对应listRmsData数据中的数据索引
for (int i = 0; i < waveDataDTO.getChannelNames().size(); i++) {
if (waveDataDTO.getChannelNames().get(i).indexOf("电压") != -1) {
if (waveDataDTO.getChannelNames().get(i).indexOf("U") != -1) {
indexs.add(i);
}
}