高低电压穿越相关接口走算法模块
This commit is contained in:
@@ -78,6 +78,12 @@
|
||||
<artifactId>harmonic-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>prepare-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -212,4 +213,22 @@ public class EventDetailController extends BaseController {
|
||||
);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据开始时间及结束时间获取暂态事件信息
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getNewEventDetailByTime")
|
||||
@ApiOperation("根据开始时间及结束时间获取暂态事件信息")
|
||||
public HttpResult<List<RmpEventDetailPO>> getNewEventDetailByTime(@RequestParam(name = "lastTime",required = false) LocalDateTime lastTime, @RequestParam("currentTime")LocalDateTime currentTime) {
|
||||
String methodDescribe = getMethodDescribe("getNewEventDetailByTime");
|
||||
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper = new LambdaQueryWrapper();
|
||||
lambdaQueryWrapper.le(RmpEventDetailPO::getStartTime,currentTime);
|
||||
if(lastTime != null){
|
||||
lambdaQueryWrapper.gt(RmpEventDetailPO::getStartTime,lastTime);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventDetailService.list(lambdaQueryWrapper), methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.njcn.device.biz.commApi.CommLineClient;
|
||||
import com.njcn.device.pq.api.DeptLineFeignClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.NewStationClient;
|
||||
@@ -14,6 +13,8 @@ import com.njcn.event.pojo.vo.EventNewStationVo;
|
||||
import com.njcn.event.pojo.vo.VoltageRideThroughVo;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.event.service.majornetwork.VoltageRideThroughEventService;
|
||||
import com.njcn.prepare.harmonic.api.event.SpThroughFeignClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SpThroughParam;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
@@ -25,7 +26,6 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -46,14 +46,14 @@ public class VoltageRideThroughEventServiceImpl implements VoltageRideThroughEve
|
||||
|
||||
private final DeptLineFeignClient deptLineFeignClient;
|
||||
|
||||
private final CommLineClient commLineClient;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final EventDetailService eventDetailService;
|
||||
|
||||
private final NewStationClient newStationClient;
|
||||
|
||||
private final SpThroughFeignClient spThroughFeignClient;
|
||||
|
||||
@Override
|
||||
public List<VoltageRideThroughVo> voltageRideThroughView(VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
|
||||
List<VoltageRideThroughVo> voltageRideThroughVos = new ArrayList<>();
|
||||
@@ -70,39 +70,17 @@ public class VoltageRideThroughEventServiceImpl implements VoltageRideThroughEve
|
||||
voltageRideThroughVo.setLat(area.getLat());
|
||||
voltageRideThroughVo.setLng(area.getLng());
|
||||
}
|
||||
voltageRideThroughVo.setHighPressure((int) (Math.random() * 100 + 1)+"");
|
||||
voltageRideThroughVo.setLowPressure((int) (Math.random() * 100 + 1)+"");
|
||||
//开始计算每个地区高低压穿越次数
|
||||
//获取当前部门下所有的监测点(当然也会根据选择的新能源场站类型进行过滤)
|
||||
List<String> lineIds = deptLineFeignClient.getLineByDeptIdAndNewStation(deptDTO.getId(),voltageRideThroughQueryParam.getType()).getData();
|
||||
for(String lineId : lineIds){
|
||||
//监测点绑定的暂降事件
|
||||
List<EventDetail> eventDetails = eventDetailService.getEventDetailData(lineId,voltageRideThroughQueryParam.getSearchBeginTime()+Param.BEGIN,voltageRideThroughQueryParam.getSearchEndTime()+Param.END);
|
||||
//取出事件类型为:暂升
|
||||
List<EventDetail> upperEventDetails = eventDetails.stream().filter(e -> e.getEventType().equals(Param.UPPEREVENT)).collect(Collectors.toList());
|
||||
//取出事件类型为:暂降
|
||||
List<EventDetail> lowerEventDetails = eventDetails.stream().filter(e -> e.getEventType().equals(Param.LOWEREVENT)).collect(Collectors.toList());
|
||||
//当前监测点为:风电场
|
||||
if("1".equals(voltageRideThroughQueryParam.getType())){
|
||||
//计算 风电场 暂升次数
|
||||
for(EventDetail eventDetail : upperEventDetails){
|
||||
|
||||
}
|
||||
//计算 风电场 暂降次数
|
||||
for(EventDetail eventDetail : lowerEventDetails){
|
||||
|
||||
}
|
||||
}
|
||||
//当前监测点为:光伏电站
|
||||
if("2".equals(voltageRideThroughQueryParam.getType())){
|
||||
//计算 光伏电站 暂升次数
|
||||
for(EventDetail eventDetail : upperEventDetails){
|
||||
|
||||
}
|
||||
//计算 光伏电站 暂降次数
|
||||
for(EventDetail eventDetail : lowerEventDetails){
|
||||
|
||||
}
|
||||
//开始计算当前地区高低压穿越次数
|
||||
//获取当前部门下所有的已绑定能源站的监测点
|
||||
List<String> lineIds = deptLineFeignClient.getLineByDeptIdAndNewStation(deptDTO.getId()).getData();
|
||||
if(!lineIds.isEmpty()){
|
||||
//根据已绑定能源站的监测点获取关联的暂态事件
|
||||
List<EventDetail> eventDetails = eventDetailService.getEventDetail(lineIds,voltageRideThroughQueryParam.getSearchBeginTime()+Param.BEGIN,voltageRideThroughQueryParam.getSearchEndTime()+Param.END,null);
|
||||
List<String> eventIds = eventDetails.stream().map(EventDetail::getEventId).collect(Collectors.toList());
|
||||
if(!eventIds.isEmpty()){
|
||||
SpThroughParam spThroughParam = new SpThroughParam(eventIds,voltageRideThroughQueryParam.getType());
|
||||
//赋值子部门高低电压穿越次数
|
||||
BeanUtils.copyProperties(spThroughFeignClient.getDataByEventIds(spThroughParam).getData(),voltageRideThroughVo);
|
||||
}
|
||||
}
|
||||
voltageRideThroughVos.add(voltageRideThroughVo);
|
||||
@@ -114,17 +92,24 @@ public class VoltageRideThroughEventServiceImpl implements VoltageRideThroughEve
|
||||
public List<EventNewStationVo> voltageRideThroughEventQueryPage(VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
|
||||
List<EventNewStationVo> eventNewStationVos = new ArrayList<>();
|
||||
List<String> lineIds = new ArrayList<>();
|
||||
//获取当前选择的部门下所有的监测点(当然也会根据选择的新能源场站类型进行过滤)
|
||||
lineIds.addAll(deptLineFeignClient.getLineByDeptIdAndNewStation(voltageRideThroughQueryParam.getAreaId(),voltageRideThroughQueryParam.getType()).getData());
|
||||
//获取当前部门下所有的已绑定能源站的监测点
|
||||
lineIds.addAll(deptLineFeignClient.getLineByDeptIdAndNewStation(voltageRideThroughQueryParam.getAreaId()).getData());
|
||||
if(!lineIds.isEmpty()){
|
||||
//根据监测点获取监测点下所有的事件集合
|
||||
eventNewStationVos = BeanUtil.copyToList(eventDetailService.getEventDetail(lineIds,voltageRideThroughQueryParam.getSearchBeginTime()+Param.BEGIN,voltageRideThroughQueryParam.getSearchEndTime()+Param.END,null), EventNewStationVo.class);
|
||||
//特殊处理事件集合中新能源场站名称
|
||||
for(EventNewStationVo eventNewStationVo : eventNewStationVos){
|
||||
List<LineDetailDataVO> lineDetailDataVOS = lineFeignClient.getLineDetailList(Arrays.asList(eventNewStationVo.getLineId())).getData();
|
||||
if(!lineDetailDataVOS.isEmpty()){
|
||||
NewStation newStation = newStationClient.selectById(lineDetailDataVOS.get(0).getNewStationId()).getData();
|
||||
eventNewStationVo.setNewStationName(newStation.getName());
|
||||
if(!eventNewStationVos.isEmpty()){
|
||||
SpThroughParam spThroughParam = new SpThroughParam(eventNewStationVos.stream().map(EventNewStationVo::getEventId).collect(Collectors.toList()),voltageRideThroughQueryParam.getType());
|
||||
//eventNewStationVos:事件集合中是包含了所有符合条件的事件,可能有部分事件并没有被高低电压穿越记录定时任务所执行 所以需要过滤下 具体逻辑说请看spThroughFeignClient.formatEventIds
|
||||
List<String> eventIds = spThroughFeignClient.formatEventIds(spThroughParam).getData();
|
||||
//过滤掉不符合的事件(eventIds为有效事件ID)
|
||||
eventNewStationVos = eventNewStationVos.stream().filter(item->eventIds.contains(item.getEventId())).collect(Collectors.toList());
|
||||
//特殊处理事件集合中新能源场站名称
|
||||
for(EventNewStationVo eventNewStationVo : eventNewStationVos){
|
||||
List<LineDetailDataVO> lineDetailDataVOS = lineFeignClient.getLineDetailList(Arrays.asList(eventNewStationVo.getLineId())).getData();
|
||||
if(!lineDetailDataVOS.isEmpty()){
|
||||
NewStation newStation = newStationClient.selectById(lineDetailDataVOS.get(0).getNewStationId()).getData();
|
||||
eventNewStationVo.setNewStationName(newStation.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user