冀北电网一张图暂态信息
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package com.njcn.event.controller.majornetwork;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
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.device.pq.pojo.vo.GridDiagramVO;
|
||||
import com.njcn.event.service.majornetwork.RmpEventDetailService;
|
||||
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
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;
|
||||
|
||||
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gridDiagram")
|
||||
@Api(tags = "冀北电网一张图信息展示")
|
||||
@AllArgsConstructor
|
||||
public class GridDiagramEventController extends BaseController {
|
||||
|
||||
private final RmpEventDetailService rmpEventDetailService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventLevelEvaluation")
|
||||
@ApiOperation("暂态电能质量水平评价")
|
||||
public HttpResult<GridDiagramVO> getSubLineGiveAnAlarm(@RequestBody StatSubstationBizBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getSubLineGiveAnAlarm");
|
||||
GridDiagramVO eventLevelEvaluation = rmpEventDetailService.getEventLevelEvaluation(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventLevelEvaluation, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventStatisticsList")
|
||||
@ApiOperation("暂态统计详情")
|
||||
public HttpResult<List<?>> getEventStatisticsList(@RequestBody StatSubstationBizBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getEventStatisticsList");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,17 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.pms.api.DistributionMonitorClient;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
||||
@@ -22,16 +27,19 @@ import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.GridDiagramVO;
|
||||
import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
|
||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.service.majornetwork.RmpEventDetailService;
|
||||
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.event.enums.EventResponseEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
@@ -72,7 +80,7 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
private final DistributionMonitorClient distributionMonitorClient;
|
||||
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
/**
|
||||
* 获取暂态事件明细
|
||||
*
|
||||
@@ -263,6 +271,74 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
||||
return this.getById(eventId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GridDiagramVO getEventLevelEvaluation(StatSubstationBizBaseParam param) {
|
||||
GridDiagramVO gridDiagramVO = new GridDiagramVO();
|
||||
List<GridDiagramVO.LineStatistics> info = new ArrayList<>();
|
||||
List<GridDiagramVO.LineStatistics> gwInfo = new ArrayList<>();
|
||||
|
||||
//获取部门数据关系
|
||||
List<DeptDTO> data = deptFeignClient.getDepSonDetailByDeptId(param.getId()).getData();
|
||||
List<String> deptIDS = data.stream().map(x -> x.getId()).collect(Collectors.toList());
|
||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||
deptGetLineParam.setDeptId(param.getId());
|
||||
List<DeptGetChildrenMoreDTO> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
||||
List<LineDevGetDTO> collect = deptGetChildrenMoreDTOS.stream()
|
||||
.filter(x->deptIDS.contains(x.getUnitId()))
|
||||
.flatMap(x -> x.getLineBaseList().stream()).collect(Collectors.toList());
|
||||
|
||||
List<String> lineAllIds = collect.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
List<String> gwLineAllIds = collect.stream().filter(x->1==x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||
|
||||
List<RmpEventDetailPO> list = this.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
.in(CollUtil.isNotEmpty(lineAllIds), RmpEventDetailPO::getMeasurementPointId, lineAllIds)
|
||||
.ge(StrUtil.isNotBlank(param.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
|
||||
.le(StrUtil.isNotBlank(param.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
|
||||
);
|
||||
|
||||
Map<String, DeptGetChildrenMoreDTO> deptLineMap = deptGetChildrenMoreDTOS.stream().collect(Collectors.toMap(DeptGetChildrenMoreDTO::getUnitId, Function.identity()));
|
||||
GridDiagramVO.LineStatistics lineStatistics;
|
||||
GridDiagramVO.LineStatistics gwLineStatistics;
|
||||
for (DeptDTO datum : data) {
|
||||
if (deptLineMap.containsKey(datum.getId())) {
|
||||
lineStatistics = new GridDiagramVO.LineStatistics();
|
||||
lineStatistics.setOrgId(datum.getId());
|
||||
lineStatistics.setOrgName(datum.getName());
|
||||
gwLineStatistics = new GridDiagramVO.LineStatistics();
|
||||
gwLineStatistics.setOrgId(datum.getId());
|
||||
gwLineStatistics.setOrgName(datum.getName());
|
||||
List<LineDevGetDTO> lineBaseList = deptLineMap.get(datum.getId()).getLineBaseList();
|
||||
List<String> lineIds = lineBaseList.stream().map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
|
||||
List<String> gwLineIds = lineBaseList.stream().filter(x -> 1==x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
|
||||
long count = list.stream().filter(x -> lineIds.contains(x.getMeasurementPointId())).map(RmpEventDetailPO::getEventId).count();
|
||||
long gwCount = list.stream().filter(x -> gwLineIds.contains(x.getMeasurementPointId())).map(RmpEventDetailPO::getEventId).count();
|
||||
lineStatistics.setCount(count);
|
||||
gwLineStatistics.setCount(gwCount);
|
||||
info.add(lineStatistics);
|
||||
gwInfo.add(gwLineStatistics);
|
||||
}
|
||||
}
|
||||
gridDiagramVO.setData(setData(gridDiagramVO, lineAllIds, list));
|
||||
gridDiagramVO.setGwData(setData(gridDiagramVO, gwLineAllIds, list));
|
||||
setData(gridDiagramVO, gwLineAllIds, list);
|
||||
gridDiagramVO.setInfo(info);
|
||||
gridDiagramVO.setGwInfo(gwInfo);
|
||||
return gridDiagramVO;
|
||||
}
|
||||
|
||||
|
||||
private Double setData(GridDiagramVO gridDiagramVO, List<String> gwLineAllIds, List<RmpEventDetailPO> list) {
|
||||
List<Double> asGwDouble = list.stream()
|
||||
.filter(x -> ObjectUtil.isNotNull(x.getSeverity()))
|
||||
.filter(x -> gwLineAllIds.contains(x.getMeasurementPointId()))
|
||||
.map(RmpEventDetailPO::getSeverity).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(asGwDouble)){
|
||||
return asGwDouble.stream().mapToDouble(Double::doubleValue).average().getAsDouble();
|
||||
}else{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 内部枚举类:高级算法处理事件的标识描述
|
||||
*/
|
||||
|
||||
@@ -2,14 +2,14 @@ package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.pq.pojo.vo.GridDiagramVO;
|
||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.AdvanceEventDetailVO;
|
||||
import com.njcn.event.pojo.vo.RmpEventDetailVO;
|
||||
import com.njcn.event.pojo.vo.TransientVO;
|
||||
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -56,4 +56,7 @@ public interface RmpEventDetailService extends IService<RmpEventDetailPO> {
|
||||
* @date 2023/7/28
|
||||
*/
|
||||
RmpEventDetailPO queryEventDetailByEventId(String eventId);
|
||||
|
||||
GridDiagramVO getEventLevelEvaluation(StatSubstationBizBaseParam param);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user