新能源专项分析功能优化

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

@@ -21,7 +21,7 @@ public interface DeptLineFeignClient {
HttpResult<List<String>> getLineByDeptId(@RequestParam("id")String id); HttpResult<List<String>> getLineByDeptId(@RequestParam("id")String id);
@PostMapping("/getLineByDeptIdAndNewStation") @PostMapping("/getLineByDeptIdAndNewStation")
HttpResult<List<String>> getLineByDeptIdAndNewStation(@RequestParam("id")String id); HttpResult<List<String>> getLineByDeptIdAndNewStation(@RequestParam(value = "id",required = false)String id);
@PostMapping("/selectDeptBindLines") @PostMapping("/selectDeptBindLines")
HttpResult<Boolean> selectDeptBindLines(@RequestParam("ids") List<String> ids); HttpResult<Boolean> selectDeptBindLines(@RequestParam("ids") List<String> ids);

View File

@@ -115,7 +115,7 @@ public class DeptLineController extends BaseController {
@OperateInfo(info = LogEnum.SYSTEM_COMMON) @OperateInfo(info = LogEnum.SYSTEM_COMMON)
@PostMapping("/getLineByDeptIdAndNewStation") @PostMapping("/getLineByDeptIdAndNewStation")
@ApiOperation("根据部门id获取绑定的监测点且再根据监测点详情进行过滤") @ApiOperation("根据部门id获取绑定的监测点且再根据监测点详情进行过滤")
public HttpResult<List<String>> getLineByDeptIdAndNewStation(@RequestParam("id") String id) { public HttpResult<List<String>> getLineByDeptIdAndNewStation(@RequestParam(value = "id",required = false) String id) {
String methodDescribe = getMethodDescribe("getLineByDeptIdAndNewStation"); String methodDescribe = getMethodDescribe("getLineByDeptIdAndNewStation");
List<String> list = deptLineService.getLineByDeptIdAndNewStation(id); List<String> list = deptLineService.getLineByDeptIdAndNewStation(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);

View File

@@ -43,6 +43,8 @@ public interface LineDetailMapper extends BaseMapper<LineDetail> {
* @return 结果 * @return 结果
*/ */
List<LineDetailDataVO> getLineDetailInfo(@Param("lineIds") List<String> lineIds); List<LineDetailDataVO> getLineDetailInfo(@Param("lineIds") List<String> lineIds);
@Select ("select count(1) from pq_line a where a.Level=4 and SUBSTRING_INDEX(SUBSTRING_INDEX(a.Pids, ',', 4),',',-1)=#{subIndex}") @Select ("select count(1) from pq_line a where a.Level=4 and SUBSTRING_INDEX(SUBSTRING_INDEX(a.Pids, ',', 4),',',-1)=#{subIndex}")
Integer getDeviceCountBySubstation(@Param("subIndex")String subIndex); Integer getDeviceCountBySubstation(@Param("subIndex")String subIndex);

View File

@@ -204,9 +204,10 @@
FROM FROM
pq_dept_line pdl pq_dept_line pdl
INNER JOIN pq_line_detail pld ON pdl.Line_Id = pld.Id INNER JOIN pq_line_detail pld ON pdl.Line_Id = pld.Id
WHERE <where>
pld.Obj_Id IS NOT NULL and pld.Obj_Id !=''
<if test="id !=null and id !='' "> <if test="id !=null and id !='' ">
pdl.Id = #{id} and pdl.Id = #{id}
</if> </if>
<if test="dictTree!=null and dictTree.size!=0"> <if test="dictTree!=null and dictTree.size!=0">
and pld.Big_Obj_Type in and pld.Big_Obj_Type in
@@ -214,6 +215,6 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
and pld.Obj_Id IS NOT NULL and pld.Obj_Id !='' </where>
</select> </select>
</mapper> </mapper>

View File

@@ -42,10 +42,9 @@
c.id lineId, c.id lineId,
a.name lineName, a.name lineName,
c.Time_Interval, c.Time_Interval,
e.name scale, d.Scale AS scale,
c.Obj_Id obyId, c.Obj_Id obyId,
c.Big_Obj_Type bigObjType, c.Big_Obj_Type bigObjType
d.Scale AS scale
from pq_line a from pq_line a
inner join pq_line b on a.pid = b.id inner join pq_line b on a.pid = b.id
inner join pq_line_detail c on a.id = c.id inner join pq_line_detail c on a.id = c.id

View File

@@ -1466,7 +1466,8 @@
pqd.Run_Flag as runFlag, pqd.Run_Flag as runFlag,
detail.PT_Type AS ptType, detail.PT_Type AS ptType,
detail.PT_Phase_Type AS ptPhaseType, detail.PT_Phase_Type AS ptPhaseType,
detail.Obj_Id AS objId detail.Obj_Id AS objId,
detail.Big_Obj_Type AS bigObjType
FROM FROM
pq_line line, pq_line line,
pq_line_detail detail, pq_line_detail detail,

View File

@@ -903,7 +903,6 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
} }
}); });
return lineDetailInfo; return lineDetailInfo;
} }
/** /**

View File

@@ -54,7 +54,6 @@ public class SpThroughServiceImpl extends MppServiceImpl<SpThroughMapper, SpThro
private final EventDetailFeignClient eventDetailFeignClient; private final EventDetailFeignClient eventDetailFeignClient;
private final TransientFeignClient transientFeignClient; private final TransientFeignClient transientFeignClient;
private final DeptLineFeignClient deptLineFeignClient; private final DeptLineFeignClient deptLineFeignClient;
private final UserLedgerFeignClient userLedgerFeignClient;
private final LineFeignClient lineFeignClient; private final LineFeignClient lineFeignClient;
private final DictTreeFeignClient dictTreeFeignClient; private final DictTreeFeignClient dictTreeFeignClient;
private final DicDataFeignClient dicDataFeignClient; private final DicDataFeignClient dicDataFeignClient;
@@ -72,98 +71,98 @@ public class SpThroughServiceImpl extends MppServiceImpl<SpThroughMapper, SpThro
List<String> lineIds = deptLineFeignClient.getLineByDeptIdAndNewStation(null).getData(); List<String> lineIds = deptLineFeignClient.getLineByDeptIdAndNewStation(null).getData();
if (CollUtil.isNotEmpty(lineIds)) { if (CollUtil.isNotEmpty(lineIds)) {
List<LineDetailDataVO> lineDetailDataVOS = lineFeignClient.getLineDetailList(lineIds).getData(); List<LineDetailDataVO> lineDetailDataVOS = lineFeignClient.getLineDetailList(lineIds).getData();
Map<String, LineDetailDataVO> lineDetailDataMap = lineDetailDataVOS.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity())); if (CollUtil.isNotEmpty(lineDetailDataVOS)) {
List<String> objIds = lineDetailDataVOS.stream().map(LineDetailDataVO::getObyId).distinct().collect(Collectors.toList()); Map<String, LineDetailDataVO> lineDetailDataMap = lineDetailDataVOS.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity()));
List<NewUserReportVO> userReportVOS = userLedgerFeignClient.getUserReportByIds(objIds).getData(); EventCountParam param = new EventCountParam();
Map<String, Double> userReportMap = userReportVOS.stream().collect(Collectors.toMap(NewUserReportVO::getId, NewUserReportVO::getRatePower)); param.setIds(new ArrayList<>(lineDetailDataMap.keySet()));
LocalDateTime lastTime = getLastTime();
if (ObjectUtil.isNotNull(getLastTime())) {
EventCountParam param = new EventCountParam(); param.setStartTime(lastTime.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
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);
}
}
} }
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<>(); List<Integer> indexs = new ArrayList<>();
//根据channelNames取出电压对应listRmsData数据中的数据索引 //根据channelNames取出电压对应listRmsData数据中的数据索引
for (int i = 0; i < waveDataDTO.getChannelNames().size(); i++) { 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); indexs.add(i);
} }
} }

View File

@@ -16,12 +16,6 @@ public class NewUserReportVO {
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private String id; private String id;
/**
* 监测点id
*/
@ApiModelProperty(value = "lineId")
private String lineId;
/** /**
* 工程名称 * 工程名称
*/ */