新能源场站高低电压穿越统计

This commit is contained in:
guofeihu
2024-08-20 09:36:35 +08:00
parent c2af7e708c
commit 053183cdd0
15 changed files with 385 additions and 7 deletions

View File

@@ -0,0 +1,60 @@
package com.njcn.event.controller.majornetwork;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil;
import com.njcn.event.pojo.param.VoltageRideThroughQueryParam;
import com.njcn.event.pojo.vo.EventNewStationVo;
import com.njcn.event.pojo.vo.VoltageRideThroughVo;
import com.njcn.event.service.majornetwork.VoltageRideThroughEventService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 高低电压穿越统计 前端控制器
* </p>
* @author guofeihu
* @since 2024-08-14
*/
@Api(tags = "高低电压穿越统计")
@Slf4j
@RestController
@RequestMapping("/voltageRideThrough")
@RequiredArgsConstructor
public class VoltageRideThroughEventController extends BaseController {
private final VoltageRideThroughEventService voltageRideThroughEventService;
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
@PostMapping("/view")
@ApiOperation("查询高低电压穿越视图")
public HttpResult<List<VoltageRideThroughVo>> voltageRideThroughView(@RequestBody @Validated VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
String methodDescribe = getMethodDescribe("voltageRideThroughView");
LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, voltageRideThroughQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, voltageRideThroughEventService.voltageRideThroughView(voltageRideThroughQueryParam), methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
@PostMapping("/eventQueryPage")
@ApiOperation("高低电压穿越暂态事件分页")
public HttpResult<List<EventNewStationVo>> voltageRideThroughEventQueryPage(@RequestBody @Validated VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
String methodDescribe = getMethodDescribe("voltageRideThroughEventQueryPage");
LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, voltageRideThroughQueryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, voltageRideThroughEventService.voltageRideThroughEventQueryPage(voltageRideThroughQueryParam), methodDescribe);
}
}

View File

@@ -0,0 +1,136 @@
package com.njcn.event.service.majornetwork.Impl;
import cn.hutool.core.bean.BeanUtil;
import com.njcn.device.biz.commApi.CommLineClient;
import com.njcn.device.biz.pojo.dto.LineDTO;
import com.njcn.device.pq.api.DeptLineFeignClient;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.api.NewStationClient;
import com.njcn.device.pq.pojo.po.NewStation;
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
import com.njcn.event.pojo.constant.Param;
import com.njcn.event.pojo.param.VoltageRideThroughQueryParam;
import com.njcn.event.pojo.po.EventDetail;
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.system.api.AreaFeignClient;
import com.njcn.system.pojo.po.Area;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 高低电压穿越统计 服务类实现类
* </p>
* @author guofeihu
* @since 2024-08-14
*/
@Service
@AllArgsConstructor
@Slf4j
public class VoltageRideThroughEventServiceImpl implements VoltageRideThroughEventService {
private final AreaFeignClient areaFeignClient;
private final DeptFeignClient deptFeignClient;
private final DeptLineFeignClient deptLineFeignClient;
private final CommLineClient commLineClient;
private final LineFeignClient lineFeignClient;
private final EventDetailService eventDetailService;
private final NewStationClient newStationClient;
@Override
public List<VoltageRideThroughVo> voltageRideThroughView(VoltageRideThroughQueryParam voltageRideThroughQueryParam) {
List<VoltageRideThroughVo> voltageRideThroughVos = new ArrayList<>();
//根据当前选择的部门ID获取其下的子部门集合
List<DeptDTO> deptDTOS = deptFeignClient.getDepSonDetailByDeptId(voltageRideThroughQueryParam.getAreaId()).getData();
for(DeptDTO deptDTO : deptDTOS){
//子部门信息
VoltageRideThroughVo voltageRideThroughVo = new VoltageRideThroughVo();
//赋值子部门名称及ID
BeanUtils.copyProperties(deptDTO,voltageRideThroughVo);
//根据子部门的area获取经纬度
Area area = areaFeignClient.selectIdArea(deptDTO.getArea()).getData();
if(area != null){
voltageRideThroughVo.setLat(area.getLat());
voltageRideThroughVo.setLng(area.getLng());
}
//开始计算每个地区高低压穿越次数
//获取当前部门下所有的监测点(当然也会根据选择的新能源场站类型进行过滤)
List<String> lineIds = deptLineFeignClient.getLineByDeptIdAndNewStation(deptDTO.getId(),voltageRideThroughQueryParam.getType()).getData();
for(String lineId : lineIds){
//监测点信息
LineDTO lineDTO = commLineClient.getLineDetail(lineId).getData();
if(lineDTO == null){
continue;
}
//监测点绑定的暂降事件
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(Param.PHOTOVOLTAICPOWER.equals(lineDTO.getStationType())){
//计算 光伏电站 暂升次数
for(EventDetail eventDetail : upperEventDetails){
}
//计算 光伏电站 暂降次数
for(EventDetail eventDetail : lowerEventDetails){
}
}
//当前监测点为:风电场
if(Param.WINDFARM.equals(lineDTO.getStationType())){
//计算 风电场 暂升次数
for(EventDetail eventDetail : upperEventDetails){
}
//计算 风电场 暂降次数
for(EventDetail eventDetail : lowerEventDetails){
}
}
}
voltageRideThroughVos.add(voltageRideThroughVo);
}
return voltageRideThroughVos;
}
@Override
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());
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());
}
}
}
return eventNewStationVos;
}
}

View File

@@ -0,0 +1,32 @@
package com.njcn.event.service.majornetwork;
import com.njcn.event.pojo.param.VoltageRideThroughQueryParam;
import com.njcn.event.pojo.vo.EventNewStationVo;
import com.njcn.event.pojo.vo.VoltageRideThroughVo;
import java.util.List;
/**
* <p>
* 高低电压穿越统计 服务类
* </p>
* @author guofeihu
* @since 2024-08-14
*/
public interface VoltageRideThroughEventService {
/***
* 查询高低电压穿越视图
* @param voltageRideThroughQueryParam
* @return List
*/
List<VoltageRideThroughVo> voltageRideThroughView(VoltageRideThroughQueryParam voltageRideThroughQueryParam);
/***
* 高低电压穿越暂态事件分页
* @param voltageRideThroughQueryParam
* @return Page
*/
List<EventNewStationVo> voltageRideThroughEventQueryPage(VoltageRideThroughQueryParam voltageRideThroughQueryParam);
}