新能源场站高低电压穿越统计
This commit is contained in:
@@ -27,6 +27,14 @@ public interface Param {
|
||||
String BEGIN =" 00:00:00";
|
||||
String END =" 23:59:59";
|
||||
|
||||
|
||||
//以下四个固定ID用于某些业务判断
|
||||
//字典(sys_dict_data):电压暂升的ID
|
||||
String UPPEREVENT = "c5ce588cb76fba90c4519ab250c962d0";
|
||||
//字典(sys_dict_data):电升暂升的ID
|
||||
String LOWEREVENT = "c37861896dafab0883321e1d508caa51";
|
||||
//字典(sys_dict_data):光伏电站的ID
|
||||
String PHOTOVOLTAICPOWER = "45615057cb88650ffc4779b0629bac7e";
|
||||
//字典(sys_dict_data):风电场的ID
|
||||
String WINDFARM = "f9145acb79cbf136b9ee89fd38d72583";
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 高低电压穿越统计查询实体类
|
||||
* @author guofeihu
|
||||
* @since 2024-08-15
|
||||
*/
|
||||
@Data
|
||||
public class VoltageRideThroughQueryParam extends BaseParam {
|
||||
|
||||
@ApiModelProperty("区域ID")
|
||||
@NotBlank(message = "区域ID不能为空")
|
||||
private String areaId;
|
||||
|
||||
@ApiModelProperty("1:风电场,2:光伏电厂")
|
||||
@NotBlank(message = "新能源场站不能为空")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty("监测点集合(用于后端使用)")
|
||||
private List<String> lineIds;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 高低电压穿越统计 暂降事件列表实体类
|
||||
* @author guofeihu
|
||||
* @since 2024-08-15
|
||||
*/
|
||||
@Data
|
||||
public class EventNewStationVo implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "事件ID")
|
||||
private String eventId;
|
||||
|
||||
@ApiModelProperty(value = "监测点ID")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(value = "电站名称")
|
||||
private String newStationName;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@ApiModelProperty(value = "特征幅值")
|
||||
private Double featureAmplitude;
|
||||
|
||||
@ApiModelProperty(value = "暂降原因")
|
||||
private String advanceReason;
|
||||
|
||||
@ApiModelProperty(value = "暂降严重度")
|
||||
private Double severity;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 高低电压穿越统计 地图实体类
|
||||
* @author: guofeihu
|
||||
* @date: 2024-08-15
|
||||
*/
|
||||
@Data
|
||||
public class VoltageRideThroughVo implements Serializable {
|
||||
|
||||
@ApiModelProperty("地区ID")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("地区名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("中心点经度")
|
||||
private BigDecimal lng;
|
||||
|
||||
@ApiModelProperty("中心点纬度")
|
||||
private BigDecimal lat;
|
||||
|
||||
@ApiModelProperty("低压次数")
|
||||
private String lowPressure;
|
||||
|
||||
@ApiModelProperty("高压次数")
|
||||
private String highPressure;
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user