代码调整
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.event.mapper.PmsMonitorMapper;
|
||||
import com.njcn.event.mapper.RmpEventDetailMapper;
|
||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.po.PmsMonitorPO;
|
||||
import com.njcn.event.pojo.vo.RStatOrgVO;
|
||||
import com.njcn.event.pojo.vo.RStatSubstationVO;
|
||||
import com.njcn.event.pojo.vo.RmpEventDetailVO;
|
||||
import com.njcn.event.service.RmpEventDetailService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 暂态事件明细
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/12
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper, RmpEventDetailVO> implements RmpEventDetailService {
|
||||
|
||||
private final RmpEventDetailMapper rmpEventDetailMapper;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final PmsMonitorMapper pmsMonitorMapper;
|
||||
|
||||
/**
|
||||
* 获取暂态事件明细
|
||||
*
|
||||
* @param param 前端参数
|
||||
* @return 暂态事件明细
|
||||
*/
|
||||
@Override
|
||||
public List<RmpEventDetailVO> getRmpEventDetail(UniversalFrontEndParam param) {
|
||||
|
||||
// 获取当前用户的部门的子部门信息
|
||||
List<DeptDTO> data = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
//创建返回集合
|
||||
List<RmpEventDetailVO> info = new ArrayList<>();
|
||||
|
||||
// 过滤出部门id
|
||||
List<String> deptIds = data.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
|
||||
// 根据部门id查询监测点id
|
||||
List<PmsMonitorPO> monitorInfo = pmsMonitorMapper.getMonitorInfo(deptIds);
|
||||
|
||||
|
||||
|
||||
return info;
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,334 +0,0 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.event.mapper.PmsMonitorMapper;
|
||||
import com.njcn.event.mapper.RStatEventOrgMapper;
|
||||
import com.njcn.event.mapper.RStatOrgMapper;
|
||||
import com.njcn.event.mapper.RStatSubstationMapper;
|
||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.po.PmsMonitorPO;
|
||||
import com.njcn.event.pojo.vo.RStatEventOrgVO;
|
||||
import com.njcn.event.pojo.vo.RStatOrgVO;
|
||||
import com.njcn.event.pojo.vo.RStatSubstationVO;
|
||||
import com.njcn.event.service.StatisticsOfTransientIndicatorssService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 暂态指标统计
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/10
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOfTransientIndicatorssService {
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final RStatOrgMapper rStatOrgMapper;
|
||||
|
||||
private final RStatEventOrgMapper rStatEventOrgMapper;
|
||||
|
||||
private final RStatSubstationMapper rStatSubstationMapper;
|
||||
|
||||
private final PmsMonitorMapper pmsMonitorMapper;
|
||||
|
||||
/**
|
||||
* 获取区域暂态指标统计
|
||||
*
|
||||
* @param param 前端参数
|
||||
* @return 区域暂态指标统计
|
||||
*/
|
||||
@Override
|
||||
public List<RStatOrgVO> getRStatOrg(UniversalFrontEndParam param) {
|
||||
|
||||
// 获取当前用户的部门的子部门信息
|
||||
List<DeptDTO> data = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
|
||||
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
// 创建返回集合
|
||||
List<RStatOrgVO> info = new ArrayList<>();
|
||||
|
||||
// 过滤出部门id
|
||||
List<String> deptIds = data.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
|
||||
// 类型(1年 2季度 3月份 4日
|
||||
switch (param.getType()) {
|
||||
case 1:
|
||||
// 获取年区域暂态指标统计
|
||||
info = rStatOrgMapper.getYearRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime());
|
||||
break;
|
||||
case 2:
|
||||
// 获取季区域暂态指标统计
|
||||
info = rStatOrgMapper.getQuarterRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime());
|
||||
break;
|
||||
case 3:
|
||||
// 获取月区域暂态指标统计
|
||||
info = rStatOrgMapper.getMonthRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
for (RStatOrgVO rStatOrgVO : info) {
|
||||
rStatOrgVO.setEventMeasurementRatioAverage(rStatOrgVO.getEventMeasurementAverage() / rStatOrgVO.getEffectiveMeasurementAverage());
|
||||
rStatOrgVO.setEventMeasurementRatioAccrued(rStatOrgVO.getEventMeasurementAccrued() / rStatOrgVO.getEffectiveMeasurementAccrued());
|
||||
}
|
||||
|
||||
// 匹配单位名称
|
||||
for (DeptDTO dto : data) {
|
||||
for (RStatOrgVO vo : info) {
|
||||
if (dto.getId().equals(vo.getOrgNo())) {
|
||||
vo.setOrgName(dto.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取区域暂态指标分类统计表
|
||||
*
|
||||
* @param param 前端参数
|
||||
* @return 区域暂态指标分类统计表
|
||||
*/
|
||||
@Override
|
||||
public List<RStatEventOrgVO> getRStatEventOrg(UniversalFrontEndParam param) {
|
||||
|
||||
// 获取当前用户的部门的子部门信息
|
||||
List<DeptDTO> data = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
|
||||
//创建返回集合
|
||||
List<RStatEventOrgVO> info = new ArrayList<>();
|
||||
|
||||
// 根据暂态指标枚举查询暂态指标
|
||||
List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
|
||||
List<RStatEventOrgVO> temp = new ArrayList<>();
|
||||
|
||||
// 过滤出部门id
|
||||
List<String> deptIds = data.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
|
||||
// 类型(1年 2季度 3月份 4日
|
||||
switch (param.getType()) {
|
||||
case 1:
|
||||
// 获取年区域暂态指标分类统计表
|
||||
temp = rStatEventOrgMapper.getYearRStatEventOrgInfo(deptIds, param.getStartTime(), param.getEndTime());
|
||||
break;
|
||||
case 2:
|
||||
// 获取季区域暂态指标分类统计表
|
||||
temp = rStatEventOrgMapper.getQuarterRStatEventOrgInfo(deptIds, param.getStartTime(), param.getEndTime());
|
||||
break;
|
||||
case 3:
|
||||
// 获取月区域暂态指标分类统计表
|
||||
temp = rStatEventOrgMapper.getMonthRStatEventOrgInfoInfo(deptIds, param.getStartTime(), param.getEndTime());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Map<String, List<RStatEventOrgVO>> map = temp
|
||||
.stream().collect(Collectors.groupingBy(RStatEventOrgVO::getOrgNo));
|
||||
|
||||
map.forEach((orgOn, rStatEventOrgVOs) -> {
|
||||
RStatEventOrgVO rStatEventOrgVO = new RStatEventOrgVO();
|
||||
// 基础属性赋值
|
||||
for (RStatEventOrgVO tmp : rStatEventOrgVOs) {
|
||||
if (rStatEventOrgVO.getOrgNo() == null) {
|
||||
rStatEventOrgVO.setOrgNo(tmp.getOrgNo());
|
||||
rStatEventOrgVO.setDataDate(tmp.getDataDate());
|
||||
rStatEventOrgVO.setEffectiveMeasurementAverage(tmp.getEffectiveMeasurementAverage());
|
||||
rStatEventOrgVO.setEffectiveMeasurementAccrued(tmp.getEffectiveMeasurementAccrued());
|
||||
rStatEventOrgVO.setEventMeasurementAverage(tmp.getEventMeasurementAverage());
|
||||
rStatEventOrgVO.setEventMeasurementAccrued(tmp.getEventMeasurementAccrued());
|
||||
rStatEventOrgVO.setEventMeasurementRatioAverage(tmp.getEventMeasurementAverage() / tmp.getEffectiveMeasurementAverage());
|
||||
rStatEventOrgVO.setEventMeasurementRatioAccrued(tmp.getEventMeasurementAccrued() / tmp.getEffectiveMeasurementAccrued());
|
||||
}
|
||||
|
||||
}
|
||||
for (RStatEventOrgVO tmp : rStatEventOrgVOs) {
|
||||
// 暂态指标赋值
|
||||
for (DictData eventStati : eventStatis) {
|
||||
if (eventStati.getId().equals(tmp.getEventType())) {
|
||||
if (eventStati.getCode().equals(RStatEventOrgVO.SHORT_INTERRUPTIONS)) {
|
||||
// 日均短时中断
|
||||
rStatEventOrgVO.setDayShortInterruptions(tmp.getEEventMeasurementAverage());
|
||||
// 累计短时中断
|
||||
rStatEventOrgVO.setCumulativeShortInterruptions(tmp.getEventMeasurementAccrued());
|
||||
// 日均短时中断占比
|
||||
rStatEventOrgVO.setDayShortInterruptionsProportion(tmp.getEEventMeasurementRatioAverage());
|
||||
// 累计短时中断占比
|
||||
rStatEventOrgVO.setCumulativeShortInterruptionsProportion(tmp.getEEventMeasurementRatioAccrued());
|
||||
// 短时中断监测点数
|
||||
rStatEventOrgVO.setShortInterruptionsMonitor(314159);
|
||||
// 短时中断占比
|
||||
rStatEventOrgVO.setShortInterruptionsProportion(3.14159);
|
||||
// 短时中断次数
|
||||
rStatEventOrgVO.setShortInterruptionsCount(tmp.getEEventCount());
|
||||
// 短时中断频次
|
||||
rStatEventOrgVO.setShortInterruptionsFrequency(tmp.getEEventFreq());
|
||||
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_RISE)) {
|
||||
// 日均电压暂升
|
||||
rStatEventOrgVO.setDayVoltageRise(tmp.getEEventMeasurementAverage());
|
||||
// 累计电压暂升
|
||||
rStatEventOrgVO.setCumulativeVoltageRise(tmp.getEventMeasurementAccrued());
|
||||
// 日均电压暂升占比
|
||||
rStatEventOrgVO.setDayVoltageRiseProportion(tmp.getEEventMeasurementRatioAverage());
|
||||
// 累计电压暂升占比
|
||||
rStatEventOrgVO.setCumulativeVoltageRiseProportion(tmp.getEEventMeasurementRatioAccrued());
|
||||
// 电压暂升占比
|
||||
rStatEventOrgVO.setVoltageRiseProportion(3.14159);
|
||||
// 电压暂升次数
|
||||
rStatEventOrgVO.setVoltageRiseCount(tmp.getEEventCount());
|
||||
// 电压暂升频次
|
||||
rStatEventOrgVO.setVoltageRiseFrequency(tmp.getEEventFreq());
|
||||
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_DIP)) {
|
||||
// 日均电压暂降
|
||||
rStatEventOrgVO.setDayVoltageDip(tmp.getEEventMeasurementAverage());
|
||||
// 累计电压暂降
|
||||
rStatEventOrgVO.setCumulativeVoltageDip(tmp.getEventMeasurementAccrued());
|
||||
// 日均电压暂降占比
|
||||
rStatEventOrgVO.setDayVoltageDipProportion(tmp.getEEventMeasurementRatioAverage());
|
||||
// 累计电压暂降占比
|
||||
rStatEventOrgVO.setCumulativeVoltageDipProportion(tmp.getEEventMeasurementRatioAccrued());
|
||||
// 电压暂升占比
|
||||
rStatEventOrgVO.setVoltageDipProportion(3.14159);
|
||||
// 电压暂降次数
|
||||
rStatEventOrgVO.setVoltageDipCount(tmp.getEEventCount());
|
||||
// 电压暂降频次
|
||||
rStatEventOrgVO.setVoltageDipFrequency(tmp.getEEventFreq());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
info.add(rStatEventOrgVO);
|
||||
});
|
||||
|
||||
// 匹配单位名称
|
||||
for (DeptDTO dto : data) {
|
||||
for (RStatEventOrgVO vo : info) {
|
||||
if (dto.getId().equals(vo.getOrgNo())) {
|
||||
vo.setOrgName(dto.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取变电站暂态指标分类统计表
|
||||
*
|
||||
* @param param 前端传入参数
|
||||
* @return 变电站暂态指标分类统计表
|
||||
*/
|
||||
@Override
|
||||
public List<RStatSubstationVO> getRStatSubstation
|
||||
(UniversalFrontEndParam param) {
|
||||
|
||||
// 获取当前用户的部门的子部门信息
|
||||
List<DeptDTO> data = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
|
||||
|
||||
if (CollectionUtil.isNotEmpty(data)) {
|
||||
//创建返回集合
|
||||
List<RStatSubstationVO> info = new ArrayList<>();
|
||||
|
||||
// 过滤出部门id
|
||||
List<String> deptIds = data.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
|
||||
// 创建集合用于封装查询出的监测点信息
|
||||
List<PmsMonitorPO> mInfo = new ArrayList<>();
|
||||
|
||||
|
||||
// 根据部门id查询监测点id
|
||||
List<PmsMonitorPO> monitorInfo = pmsMonitorMapper.getMonitorInfo(deptIds);
|
||||
|
||||
// 过滤出变电站id
|
||||
List<String> powerrIds = new ArrayList<>();
|
||||
|
||||
// 判断前端参数是否传入的变电站名称
|
||||
if (param.getSubName() != null) {
|
||||
for (PmsMonitorPO po : monitorInfo) {
|
||||
if (po.getPowerrName().contains(param.getSubName())) {
|
||||
PmsMonitorPO pmsMonitor = new PmsMonitorPO();
|
||||
BeanUtils.copyProperties(po,pmsMonitor);
|
||||
mInfo.add(pmsMonitor);
|
||||
}
|
||||
}
|
||||
powerrIds = mInfo.stream().map(PmsMonitorPO::getPowerrId).collect(Collectors.toList());
|
||||
}else {
|
||||
powerrIds = monitorInfo.stream().map(PmsMonitorPO::getPowerrId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
// 类型(1年 2季度 3月份 4日
|
||||
switch (param.getType()) {
|
||||
case 1:
|
||||
// 获取年变电站暂态指标分类统计表
|
||||
info = rStatSubstationMapper.getYearInfo(powerrIds, param.getStartTime(), param.getEndTime());
|
||||
break;
|
||||
case 2:
|
||||
// 获取季变电站暂态指标分类统计表
|
||||
info = rStatSubstationMapper.getQuarterInfo(powerrIds, param.getStartTime(), param.getEndTime());
|
||||
break;
|
||||
case 3:
|
||||
// 获取月变电站暂态指标分类统计表
|
||||
info = rStatSubstationMapper.getMonthInfo(powerrIds, param.getStartTime(), param.getEndTime());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// 匹配单位名称
|
||||
for (RStatSubstationVO vo : info) {
|
||||
for (PmsMonitorPO pmsMonitor : monitorInfo) {
|
||||
if (vo.getSubstationId().equals(pmsMonitor.getPowerrId())) {
|
||||
vo.setDeptId(pmsMonitor.getOrgId());
|
||||
vo.setDeptName(pmsMonitor.getOrgName());
|
||||
vo.setSubstationName(pmsMonitor.getPowerrName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return info;
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,355 @@
|
||||
package com.njcn.event.service.distribution.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.device.pms.api.PwMonitorClient;
|
||||
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
|
||||
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
|
||||
import com.njcn.event.mapper.distribution.PwEventCategoryDetailsMapper;
|
||||
import com.njcn.event.pojo.po.EventDistributionStatisticsPO;
|
||||
import com.njcn.event.pojo.po.EventDurationLineChartPO;
|
||||
import com.njcn.event.pojo.po.EventFeatureAmplitudeLineChartPO;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.EventDistributionStatisticsTableVO;
|
||||
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
|
||||
import com.njcn.event.pojo.vo.SimpleVO;
|
||||
import com.njcn.event.service.distribution.PwEventCategoryDetailsService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 配网-暂态事件分布统计
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/28
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class PwEventCategoryDetailsServiceImpl implements PwEventCategoryDetailsService {
|
||||
|
||||
private final PwMonitorClient pwMonitorClient;
|
||||
|
||||
private final PwEventCategoryDetailsMapper pwEventCategoryDetailsMapper;
|
||||
|
||||
/**
|
||||
* 获取配网暂态事件分布统计
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 配网暂态事件分布统计
|
||||
*/
|
||||
@Override
|
||||
public List<EventDistributionStatisticsTableVO> getPwEventCategoryDetails(StatisticsBizBaseParam param) {
|
||||
// 获取单位下的监测点id集合
|
||||
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
|
||||
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 创建集合,返回数据
|
||||
List<EventDistributionStatisticsTableVO> vos = new ArrayList<>();
|
||||
|
||||
// 将监测点id取出
|
||||
List<String> monitorIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isEmpty(monitorIdList)) {
|
||||
return Collections.emptyList();
|
||||
|
||||
}
|
||||
// 获取暂态指标分布统计
|
||||
EventDistributionStatisticsPO po = pwEventCategoryDetailsMapper.getPwEventCategoryDetailsMapper(
|
||||
monitorIdList,
|
||||
param.getStartTime(),
|
||||
param.getEndTime());
|
||||
|
||||
if (ObjectUtil.isEmpty(po)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 特征幅值10%
|
||||
// 创建对象返回参数
|
||||
EventDistributionStatisticsTableVO featureAmplitude10 = new EventDistributionStatisticsTableVO();
|
||||
featureAmplitude10.setFeatureAmplitude("10%");
|
||||
featureAmplitude10.setDuration20(po.getFeatureAmplitude10with20s());
|
||||
featureAmplitude10.setDuration100(po.getFeatureAmplitude10with100s());
|
||||
featureAmplitude10.setDuration500(po.getFeatureAmplitude10with500s());
|
||||
featureAmplitude10.setDuration1000(po.getFeatureAmplitude10with1000s());
|
||||
featureAmplitude10.setDuration3000(po.getFeatureAmplitude10with3000s());
|
||||
featureAmplitude10.setDuration20000(po.getFeatureAmplitude10with20000s());
|
||||
featureAmplitude10.setDuration60000(po.getFeatureAmplitude10with60000s());
|
||||
featureAmplitude10.setDuration180000(po.getFeatureAmplitude10with180000s());
|
||||
|
||||
// 特征幅值40%
|
||||
// 创建对象返回参数
|
||||
EventDistributionStatisticsTableVO featureAmplitude40 = new EventDistributionStatisticsTableVO();
|
||||
featureAmplitude40.setFeatureAmplitude("40%");
|
||||
featureAmplitude40.setDuration20(po.getFeatureAmplitude40with20s());
|
||||
featureAmplitude40.setDuration100(po.getFeatureAmplitude40with100s());
|
||||
featureAmplitude40.setDuration500(po.getFeatureAmplitude40with500s());
|
||||
featureAmplitude40.setDuration1000(po.getFeatureAmplitude40with1000s());
|
||||
featureAmplitude40.setDuration3000(po.getFeatureAmplitude40with3000s());
|
||||
featureAmplitude40.setDuration20000(po.getFeatureAmplitude40with20000s());
|
||||
featureAmplitude40.setDuration60000(po.getFeatureAmplitude40with60000s());
|
||||
featureAmplitude40.setDuration180000(po.getFeatureAmplitude40with180000s());
|
||||
|
||||
// 特征幅值70%
|
||||
// 创建对象返回参数
|
||||
EventDistributionStatisticsTableVO featureAmplitude70 = new EventDistributionStatisticsTableVO();
|
||||
featureAmplitude70.setFeatureAmplitude("70%");
|
||||
featureAmplitude70.setDuration20(po.getFeatureAmplitude70with20s());
|
||||
featureAmplitude70.setDuration100(po.getFeatureAmplitude70with100s());
|
||||
featureAmplitude70.setDuration500(po.getFeatureAmplitude70with500s());
|
||||
featureAmplitude70.setDuration1000(po.getFeatureAmplitude70with1000s());
|
||||
featureAmplitude70.setDuration3000(po.getFeatureAmplitude70with3000s());
|
||||
featureAmplitude70.setDuration20000(po.getFeatureAmplitude70with20000s());
|
||||
featureAmplitude70.setDuration60000(po.getFeatureAmplitude70with60000s());
|
||||
featureAmplitude70.setDuration180000(po.getFeatureAmplitude70with180000s());
|
||||
// 特征幅值85%
|
||||
// 创建对象返回参数
|
||||
EventDistributionStatisticsTableVO featureAmplitude85 = new EventDistributionStatisticsTableVO();
|
||||
featureAmplitude85.setFeatureAmplitude("85%");
|
||||
featureAmplitude85.setDuration20(po.getFeatureAmplitude85with20s());
|
||||
featureAmplitude85.setDuration100(po.getFeatureAmplitude85with100s());
|
||||
featureAmplitude85.setDuration500(po.getFeatureAmplitude85with500s());
|
||||
featureAmplitude85.setDuration1000(po.getFeatureAmplitude85with1000s());
|
||||
featureAmplitude85.setDuration3000(po.getFeatureAmplitude85with3000s());
|
||||
featureAmplitude85.setDuration20000(po.getFeatureAmplitude85with20000s());
|
||||
featureAmplitude85.setDuration60000(po.getFeatureAmplitude85with60000s());
|
||||
featureAmplitude85.setDuration180000(po.getFeatureAmplitude85with180000s());
|
||||
// 特征幅值90%
|
||||
// 创建对象返回参数
|
||||
EventDistributionStatisticsTableVO featureAmplitude90 = new EventDistributionStatisticsTableVO();
|
||||
featureAmplitude90.setFeatureAmplitude("90%");
|
||||
featureAmplitude90.setDuration20(po.getFeatureAmplitude90with20s());
|
||||
featureAmplitude90.setDuration100(po.getFeatureAmplitude90with100s());
|
||||
featureAmplitude90.setDuration500(po.getFeatureAmplitude90with500s());
|
||||
featureAmplitude90.setDuration1000(po.getFeatureAmplitude90with1000s());
|
||||
featureAmplitude90.setDuration3000(po.getFeatureAmplitude90with3000s());
|
||||
featureAmplitude90.setDuration20000(po.getFeatureAmplitude90with20000s());
|
||||
featureAmplitude90.setDuration60000(po.getFeatureAmplitude90with60000s());
|
||||
featureAmplitude90.setDuration180000(po.getFeatureAmplitude90with180000s());
|
||||
// 属性赋值
|
||||
vos.add(featureAmplitude10);
|
||||
vos.add(featureAmplitude40);
|
||||
vos.add(featureAmplitude70);
|
||||
vos.add(featureAmplitude85);
|
||||
vos.add(featureAmplitude90);
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配网持续时间概率分布函数
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 配网持续时间概率分布函数
|
||||
* @author yzh
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
@Override
|
||||
public List<SimpleVO> getPwDurationLineChart(StatisticsBizBaseParam param) {
|
||||
// 获取单位下的监测点id集合
|
||||
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
|
||||
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 创建集合返回数据
|
||||
List<SimpleVO> result = new ArrayList<>();
|
||||
// 将监测点id取出
|
||||
List<String> monitorIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isEmpty(monitorIdList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 获取持续时间折线图
|
||||
EventDurationLineChartPO po = pwEventCategoryDetailsMapper.getPwEventDurationLineChart(
|
||||
monitorIdList,
|
||||
param.getStartTime(),
|
||||
param.getEndTime());
|
||||
if (ObjectUtil.isEmpty(po)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
SimpleVO vo100 = new SimpleVO();
|
||||
vo100.setName("0.1");
|
||||
vo100.setValue(po.getDuration100());
|
||||
SimpleVO vo250 = new SimpleVO();
|
||||
vo250.setName("0.25");
|
||||
vo250.setValue(po.getDuration250());
|
||||
SimpleVO vo500 = new SimpleVO();
|
||||
vo500.setName("0.5");
|
||||
vo500.setValue(po.getDuration500());
|
||||
SimpleVO vo1000 = new SimpleVO();
|
||||
vo1000.setName("1");
|
||||
vo1000.setValue(po.getDuration1000());
|
||||
SimpleVO vo1100 = new SimpleVO();
|
||||
vo1100.setName("1.1");
|
||||
vo1100.setValue(po.getDuration1100());
|
||||
|
||||
// 创建map集合,封装数据
|
||||
result.add(vo100);
|
||||
result.add(vo250);
|
||||
result.add(vo500);
|
||||
result.add(vo1000);
|
||||
result.add(vo1100);
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配网暂降幅值概率分布函数
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return java.util.List<com.njcn.event.pojo.vo.SimpleVO>
|
||||
* @author yzh
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
@Override
|
||||
public List<SimpleVO> getPwFeatureAmplitudeLineChart(StatisticsBizBaseParam param) {
|
||||
// 获取单位下的监测点id集合
|
||||
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
|
||||
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 创建集合返回数据
|
||||
List<SimpleVO> result = new ArrayList<>();
|
||||
// 将监测点id取出
|
||||
List<String> monitorIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isEmpty(monitorIdList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 获取特征幅值折线图
|
||||
EventFeatureAmplitudeLineChartPO po = pwEventCategoryDetailsMapper.getPwEventFeatureAmplitudeLineChart(monitorIdList,
|
||||
param.getStartTime(),
|
||||
param.getEndTime());
|
||||
|
||||
if (ObjectUtil.isEmpty(po)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
SimpleVO vo10 = new SimpleVO();
|
||||
vo10.setName("10%");
|
||||
vo10.setValue(po.getFeatureAmplitude10());
|
||||
SimpleVO vo20 = new SimpleVO();
|
||||
vo20.setName("20%");
|
||||
vo20.setValue(po.getFeatureAmplitude20());
|
||||
SimpleVO vo30 = new SimpleVO();
|
||||
vo30.setName("30%");
|
||||
vo30.setValue(po.getFeatureAmplitude30());
|
||||
SimpleVO vo40 = new SimpleVO();
|
||||
vo40.setName("40%");
|
||||
vo40.setValue(po.getFeatureAmplitude40());
|
||||
SimpleVO vo50 = new SimpleVO();
|
||||
vo50.setName("50%");
|
||||
vo50.setValue(po.getFeatureAmplitude50());
|
||||
SimpleVO vo60 = new SimpleVO();
|
||||
vo60.setName("60%");
|
||||
vo60.setValue(po.getFeatureAmplitude60());
|
||||
SimpleVO vo70 = new SimpleVO();
|
||||
vo70.setName("70%");
|
||||
vo70.setValue(po.getFeatureAmplitude70());
|
||||
SimpleVO vo80 = new SimpleVO();
|
||||
vo80.setName("80%");
|
||||
vo80.setValue(po.getFeatureAmplitude80());
|
||||
SimpleVO vo90 = new SimpleVO();
|
||||
vo90.setName("90%");
|
||||
vo90.setValue(po.getFeatureAmplitude90());
|
||||
|
||||
// 创建map集合,封装数据
|
||||
result.add(vo10);
|
||||
result.add(vo20);
|
||||
result.add(vo30);
|
||||
result.add(vo40);
|
||||
result.add(vo50);
|
||||
result.add(vo60);
|
||||
result.add(vo70);
|
||||
result.add(vo80);
|
||||
result.add(vo90);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配网暂态指标分布统计曲线图
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO
|
||||
* @author yzh
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
@Override
|
||||
public EventFeatureAmplitudeCurveVO getPwEventFeatureAmplitudeCurve(StatisticsBizBaseParam param) {
|
||||
// 获取单位下的监测点id集合
|
||||
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
|
||||
|
||||
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
|
||||
return EventFeatureAmplitudeCurveVO.empty();
|
||||
}
|
||||
|
||||
// 创建集合返回数据
|
||||
List<SimpleVO> result = new ArrayList<>();
|
||||
// 将监测点id取出
|
||||
List<String> monitorIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isEmpty(monitorIdList)) {
|
||||
return EventFeatureAmplitudeCurveVO.empty();
|
||||
}
|
||||
|
||||
// 获取监测点暂态事件明细数据
|
||||
List<RmpEventDetailPO> rmpEventDetailList = pwEventCategoryDetailsMapper.getPwRmpEventDetail(monitorIdList, param.getStartTime(), param.getEndTime());
|
||||
if (CollUtil.isEmpty(rmpEventDetailList)) {
|
||||
return EventFeatureAmplitudeCurveVO.empty();
|
||||
}
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
List<EventFeatureAmplitudeCurveVO.EventFeatureAmplitudeCurveDataList> curveDataList = rmpEventDetailList.parallelStream()
|
||||
.map(dto -> {
|
||||
EventFeatureAmplitudeCurveVO.EventFeatureAmplitudeCurveDataList eventFeatureAmplitudeCurve = new EventFeatureAmplitudeCurveVO.EventFeatureAmplitudeCurveDataList();
|
||||
eventFeatureAmplitudeCurve.setMeasurementPointId(dto.getMeasurementPointId());
|
||||
eventFeatureAmplitudeCurve.setFeatureAmplitude(dto.getFeatureAmplitude());
|
||||
eventFeatureAmplitudeCurve.setDuration(dto.getDuration());
|
||||
|
||||
Instant instant = dto.getStartTime().toInstant();
|
||||
ZoneId zoneId = ZoneId.systemDefault();
|
||||
|
||||
eventFeatureAmplitudeCurve.setStartTime(LocalDateTime.ofInstant(instant, zoneId));
|
||||
|
||||
return eventFeatureAmplitudeCurve;
|
||||
})
|
||||
//.sorted(VoltageToleranceCurveDataList.sortAscTime())
|
||||
.collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
|
||||
|
||||
return EventFeatureAmplitudeCurveVO.buildVO(rmpEventDetailList.size(), curveDataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单位id
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 单位id
|
||||
*/
|
||||
private List<PwPmsMonitorDTO> getPwMonitorList(StatisticsBizBaseParam param) {
|
||||
// 获取单位下的监测点id集合
|
||||
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
|
||||
pwPmsMonitorParam.setOrgId(param.getId());
|
||||
return pwMonitorClient
|
||||
.getPwMonitorList(pwPmsMonitorParam)
|
||||
.getData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,324 @@
|
||||
package com.njcn.event.service.distribution.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.device.pms.api.PwMonitorClient;
|
||||
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
|
||||
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
|
||||
import com.njcn.event.mapper.distribution.PwRStatOrgClassifiedMapper;
|
||||
import com.njcn.event.mapper.distribution.PwRStatOrgMapper;
|
||||
import com.njcn.event.pojo.param.PwUniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgPO;
|
||||
import com.njcn.event.pojo.po.RStatOrgPO;
|
||||
import com.njcn.event.pojo.vo.RStatEventOrgVO;
|
||||
import com.njcn.event.pojo.vo.RStatOrgVO;
|
||||
import com.njcn.event.service.distribution.PwRStatOrgService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 配网-暂态事件统计
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/24
|
||||
*/
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class PwRStatOrgServiceImpl implements PwRStatOrgService {
|
||||
|
||||
private final PwMonitorClient monitorClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final PwRStatOrgMapper pwRStatOrgMapper;
|
||||
|
||||
private final PwRStatOrgClassifiedMapper pwRStatOrgClassifiedMapper;
|
||||
|
||||
private final DecimalFormat df = new DecimalFormat("###.00");
|
||||
|
||||
/**
|
||||
* 获取配网区域暂态指标统计
|
||||
*
|
||||
* @param param 前端传入参数
|
||||
* @return 配网区域暂态指标统计
|
||||
*/
|
||||
@Override
|
||||
public List<RStatOrgVO> getPwRStatOrg(PwUniversalFrontEndParam param) {
|
||||
|
||||
// 获取单位下的监测点id集合
|
||||
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
|
||||
|
||||
if (CollUtil.isEmpty(pwPmsMonitorDTOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 查询字典表
|
||||
List<DictData> dictDataList = dicDataFeignClient
|
||||
.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode())
|
||||
.getData();
|
||||
|
||||
// 创建集合封装返回数据
|
||||
List<RStatOrgVO> result = new ArrayList<>();
|
||||
|
||||
// 取出单位id
|
||||
List<String> deptIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getOrgId).collect(Collectors.toList());
|
||||
|
||||
// 创建集合封装查询数据
|
||||
List<RStatOrgPO> rStatOrgPO = new ArrayList<>();
|
||||
|
||||
// 判断条件
|
||||
switch (param.getType()) {
|
||||
// 年
|
||||
case 1:
|
||||
rStatOrgPO = pwRStatOrgMapper.getYearInfo(
|
||||
deptIdList,
|
||||
param.getStartTime(),
|
||||
param.getEndTime(),
|
||||
param.getMonitorSort());
|
||||
break;
|
||||
// 季
|
||||
case 2:
|
||||
rStatOrgPO = pwRStatOrgMapper.getQuarterInfo(
|
||||
deptIdList,
|
||||
param.getStartTime(),
|
||||
param.getEndTime(),
|
||||
param.getMonitorSort());
|
||||
break;
|
||||
// 月
|
||||
case 3:
|
||||
rStatOrgPO = pwRStatOrgMapper.getMonthInfo(
|
||||
deptIdList,
|
||||
param.getStartTime(),
|
||||
param.getEndTime(),
|
||||
param.getMonitorSort());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// 数据处理
|
||||
for (PwPmsMonitorDTO pwPmsMonitorDTO : pwPmsMonitorDTOList) {
|
||||
for (RStatOrgPO po : rStatOrgPO) {
|
||||
// 数据处理
|
||||
if (!po.getOrgNo().equals(pwPmsMonitorDTO.getOrgId())) {
|
||||
continue;
|
||||
}
|
||||
// 创建对象封装返回数据
|
||||
RStatOrgVO rStatOrgVO = new RStatOrgVO();
|
||||
rStatOrgVO.setOrgNo(po.getOrgNo());
|
||||
rStatOrgVO.setOrgName(pwPmsMonitorDTO.getOrgName());
|
||||
rStatOrgVO.setDataDate(po.getDataDate());
|
||||
rStatOrgVO.setEffectiveMeasurementAverage(po.getEffectiveMeasurementAverage());
|
||||
rStatOrgVO.setEffectiveMeasurementAccrued(po.getEffectiveMeasurementAccrued());
|
||||
rStatOrgVO.setEventMeasurementAverage(po.getEventMeasurementAverage());
|
||||
rStatOrgVO.setEventMeasurementAccrued(po.getEventMeasurementAccrued());
|
||||
rStatOrgVO.setEventCount(po.getEventCount());
|
||||
rStatOrgVO.setDataType(po.getDataType());
|
||||
// 字典数据处理
|
||||
for (DictData dictData : dictDataList) {
|
||||
if (po.getMeasurementTypeClass().equals(dictData.getId())) {
|
||||
rStatOrgVO.setMonitorSort(dictData.getName());
|
||||
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
|
||||
rStatOrgVO.setEventMeasurementRatioAverage(Double.parseDouble(df.format((po.getEventMeasurementAverage() * 1.0) / (po.getEffectiveMeasurementAverage() * 1.0))) * 100);
|
||||
rStatOrgVO.setEventMeasurementRatioAccrued(Double.parseDouble(df.format((po.getEventMeasurementAccrued() * 1.0) / (po.getEffectiveMeasurementAccrued() * 1.0))) * 100);
|
||||
rStatOrgVO.setEventFreq(po.getEventFreq());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.add(rStatOrgVO);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配网区域暂态事件分类统计
|
||||
*
|
||||
* @param param 前端传入参数
|
||||
* @return 配网区域暂态事件分类统计
|
||||
*/
|
||||
@Override
|
||||
public List<RStatEventOrgVO> getPwRStatOrgClassified(PwUniversalFrontEndParam param) {
|
||||
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
|
||||
|
||||
if (CollUtil.isEmpty(pwPmsMonitorDTOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 查询监测点类别字典表
|
||||
List<DictData> lineSortList = dicDataFeignClient
|
||||
.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode())
|
||||
.getData();
|
||||
|
||||
// 查询暂态指标字典表
|
||||
List<DictData> eventStatisList = dicDataFeignClient
|
||||
.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode())
|
||||
.getData();
|
||||
|
||||
// 创建集合封装返回数据
|
||||
List<RStatEventOrgVO> result = new ArrayList<>();
|
||||
|
||||
// 取出单位id
|
||||
List<String> deptIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getOrgId).collect(Collectors.toList());
|
||||
|
||||
// 创建集合封装查询数据
|
||||
List<RStatEventOrgPO> rStatEventOrgVOList = new ArrayList<>();
|
||||
|
||||
// 判断条件
|
||||
switch (param.getType()) {
|
||||
// 年
|
||||
case 1:
|
||||
rStatEventOrgVOList = pwRStatOrgClassifiedMapper.getYearInfo(
|
||||
deptIdList,
|
||||
param.getStartTime(),
|
||||
param.getEndTime(),
|
||||
param.getMonitorSort());
|
||||
break;
|
||||
// 季
|
||||
case 2:
|
||||
rStatEventOrgVOList = pwRStatOrgClassifiedMapper.getQuarterInfo(
|
||||
deptIdList,
|
||||
param.getStartTime(),
|
||||
param.getEndTime(),
|
||||
param.getMonitorSort());
|
||||
break;
|
||||
// 月
|
||||
case 3:
|
||||
rStatEventOrgVOList = pwRStatOrgClassifiedMapper.getMonthInfo(
|
||||
deptIdList,
|
||||
param.getStartTime(),
|
||||
param.getEndTime(),
|
||||
param.getMonitorSort());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (CollUtil.isEmpty(rStatEventOrgVOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 将查询出的数据转为map集合
|
||||
Map<String, List<RStatEventOrgPO>> rStatEventOrgVOMap = rStatEventOrgVOList.stream().collect(Collectors.groupingBy(RStatEventOrgPO::getOrgNo));
|
||||
|
||||
// 数据处理
|
||||
rStatEventOrgVOMap.forEach((orgOn, rStatEventOrgVOs) -> {
|
||||
RStatEventOrgVO vo = new RStatEventOrgVO();
|
||||
// 基础属性赋值
|
||||
for (RStatEventOrgPO po : rStatEventOrgVOs) {
|
||||
vo.setOrgNo(po.getOrgNo());
|
||||
vo.setDataDate(po.getDataDate());
|
||||
vo.setMeasurementTypeClass(po.getMeasurementTypeClass());
|
||||
vo.setEffectiveMeasurementAverage(po.getEffectiveMeasurementAverage());
|
||||
vo.setEffectiveMeasurementAccrued(po.getEffectiveMeasurementAccrued());
|
||||
vo.setEventMeasurementAverage(po.getEventMeasurementAverage());
|
||||
vo.setEventMeasurementAccrued(po.getEventMeasurementAccrued());
|
||||
vo.setEventCount(po.getEventCount());
|
||||
vo.setEventFreq(po.getEEventFreq());
|
||||
vo.setDataType(po.getDataType());
|
||||
}
|
||||
for (RStatEventOrgPO po : rStatEventOrgVOs) {
|
||||
for (DictData dictData : lineSortList) {
|
||||
if (po.getMeasurementTypeClass().equals(dictData.getId())) {
|
||||
vo.setMeasurementTypeClass(dictData.getName());
|
||||
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
|
||||
vo.setEventMeasurementRatioAverage(Double.parseDouble(df.format((po.getEventMeasurementAverage() * 1.0) / (po.getEffectiveMeasurementAverage() * 1.0))) * 100);
|
||||
vo.setEventMeasurementRatioAccrued(Double.parseDouble(df.format((po.getEventMeasurementAccrued() * 1.0) / (po.getEffectiveMeasurementAccrued() * 1.0))) * 100);
|
||||
}
|
||||
// 暂态指标赋值
|
||||
for (DictData eventStati : eventStatisList) {
|
||||
if (eventStati.getId().equals(po.getEventType())) {
|
||||
if (eventStati.getCode().equals(RStatEventOrgVO.SHORT_INTERRUPTIONS)) {
|
||||
// 日均短时中断
|
||||
vo.setDayShortInterruptions(po.getEEventMeasurementAverage());
|
||||
// 累计短时中断
|
||||
vo.setCumulativeShortInterruptions(po.getEventMeasurementAccrued());
|
||||
|
||||
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
|
||||
// 日均短时中断占比
|
||||
vo.setDayShortInterruptionsProportion(po.getEEventMeasurementRatioAverage());
|
||||
// 累计短时中断占比
|
||||
vo.setCumulativeShortInterruptionsProportion(po.getEEventMeasurementRatioAccrued());
|
||||
vo.setShortInterruptionsFreq(po.getEEventFreq());
|
||||
vo.setShortInterruptionsCount(po.getEEventCount());
|
||||
}
|
||||
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_RISE)) {
|
||||
// 日均电压暂升
|
||||
vo.setDayVoltageRise(po.getEEventMeasurementAverage());
|
||||
// 累计电压暂升
|
||||
vo.setCumulativeVoltageRise(po.getEventMeasurementAccrued());
|
||||
|
||||
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
|
||||
// 日均电压暂升占比
|
||||
vo.setDayVoltageRiseProportion(po.getEEventMeasurementRatioAverage());
|
||||
// 累计电压暂升占比
|
||||
vo.setCumulativeVoltageRiseProportion(po.getEEventMeasurementRatioAccrued());
|
||||
vo.setVoltageRiseFreq(po.getEEventFreq());
|
||||
vo.setVoltageRiseCount(po.getEEventCount());
|
||||
}
|
||||
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_DIP)) {
|
||||
// 日均电压暂降
|
||||
vo.setDayVoltageDip(po.getEEventMeasurementAverage());
|
||||
// 累计电压暂降
|
||||
vo.setCumulativeVoltageDip(po.getEventMeasurementAccrued());
|
||||
|
||||
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
|
||||
// 日均电压暂降占比
|
||||
vo.setDayVoltageDipProportion(po.getEEventMeasurementRatioAverage());
|
||||
// 累计电压暂降占比
|
||||
vo.setCumulativeVoltageDipProportion(po.getEEventMeasurementRatioAccrued());
|
||||
vo.setVoltageDipFreq(po.getEEventFreq());
|
||||
vo.setVoltageDipCount(po.getEEventCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
result.add(vo);
|
||||
});
|
||||
|
||||
// 添加单位名称
|
||||
for (PwPmsMonitorDTO pwPmsMonitorDTO : pwPmsMonitorDTOList) {
|
||||
for (RStatEventOrgVO vo : result) {
|
||||
if (pwPmsMonitorDTO.getOrgId().equals(vo.getOrgNo())) {
|
||||
vo.setOrgName(pwPmsMonitorDTO.getOrgName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单位id
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 单位id
|
||||
*/
|
||||
private List<PwPmsMonitorDTO> getPwMonitorList(PwUniversalFrontEndParam param) {
|
||||
// 获取单位下的监测点id集合
|
||||
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
|
||||
pwPmsMonitorParam.setOrgId(param.getId());
|
||||
pwPmsMonitorParam.setMonitorSort(param.getMonitorSort());
|
||||
return monitorClient
|
||||
.getPwMonitorList(pwPmsMonitorParam)
|
||||
.getData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.njcn.event.service.distribution.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.api.PwMonitorClient;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
|
||||
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
|
||||
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
|
||||
import com.njcn.event.mapper.distribution.PwRmpEventDetailMapper;
|
||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.PwRmpEventDetailVO;
|
||||
import com.njcn.event.service.distribution.PwRmpEventDetailService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 配网-暂态事件明细
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class PwRmpEventDetailServiceImpl implements PwRmpEventDetailService {
|
||||
|
||||
private final PwRmpEventDetailMapper pwRmpEventDetailMapper;
|
||||
|
||||
private final PwMonitorClient pwMonitorClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final MonitorClient monitorClient;
|
||||
|
||||
/**
|
||||
* 获取配网暂态事件明细
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return java.util.List<com.njcn.event.pojo.vo.RmpEventDetailVO>
|
||||
* @author yzh
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
@Override
|
||||
public List<PwRmpEventDetailVO> getPwRmpEventDetail(UniversalFrontEndParam param) {
|
||||
// 获取单位下的监测点id集合
|
||||
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
|
||||
pwPmsMonitorParam.setOrgId(param.getId());
|
||||
pwPmsMonitorParam.setMonitorName(param.getMonitorName());
|
||||
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = pwMonitorClient
|
||||
.getPwMonitorList(pwPmsMonitorParam)
|
||||
.getData();
|
||||
|
||||
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 创建集合返回数据
|
||||
List<PwRmpEventDetailVO> result = new ArrayList<>();
|
||||
// 将监测点id取出
|
||||
List<String> monitorIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isEmpty(monitorIdList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 获取配网暂态事件明细
|
||||
List<RmpEventDetailPO> rmpEventDetails = pwRmpEventDetailMapper.getPwRmpEventDetail(param);
|
||||
|
||||
if (CollectionUtil.isEmpty(rmpEventDetails)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 创建集合,储存一类监测点
|
||||
List<String> oneLineMonitorIds = new ArrayList<>();
|
||||
|
||||
// 查询检测点类型字典
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
|
||||
// 属性赋值
|
||||
for (PwPmsMonitorDTO dto : pwPmsMonitorDTOList) {
|
||||
for (RmpEventDetailPO rmpEventDetail : rmpEventDetails) {
|
||||
if (rmpEventDetail.getMeasurementPointId().equals(dto.getMonitorId())) {
|
||||
PwRmpEventDetailVO pwRmpEventDetailVO = new PwRmpEventDetailVO();
|
||||
pwRmpEventDetailVO.setOrgId(dto.getOrgId());
|
||||
pwRmpEventDetailVO.setOrgName(dto.getOrgName());
|
||||
pwRmpEventDetailVO.setMonitorId(dto.getMonitorId());
|
||||
pwRmpEventDetailVO.setMonitorSort(dto.getMonitorSort());
|
||||
pwRmpEventDetailVO.setMonitorName(dto.getMonitorName());
|
||||
pwRmpEventDetailVO.setMonitorVoltageLevel(dto.getVoltageLevel());
|
||||
pwRmpEventDetailVO.setEventType(rmpEventDetail.getEventType());
|
||||
pwRmpEventDetailVO.setStartTime(rmpEventDetail.getStartTime());
|
||||
pwRmpEventDetailVO.setFeatureAmplitude(rmpEventDetail.getFeatureAmplitude());
|
||||
pwRmpEventDetailVO.setDuration(rmpEventDetail.getDuration());
|
||||
pwRmpEventDetailVO.setWavePath(rmpEventDetail.getWavePath());
|
||||
result.add(pwRmpEventDetailVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (DictData dictData : lineSortList) {
|
||||
for (PwRmpEventDetailVO vo : result) {
|
||||
if (vo.getMonitorSort().equals(dictData.getId())) {
|
||||
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
|
||||
vo.setPowerClient("/");
|
||||
vo.setPowerDistributionArea("/");
|
||||
vo.setMonitorSort(dictData.getName());
|
||||
monitorIdList.add(vo.getMonitorId());
|
||||
} else if (dictData.getCode().equals(DicDataEnum.TWO_LINE.getCode())) {
|
||||
vo.setSubName("/");
|
||||
vo.setPowerClient(vo.getMonitorName());
|
||||
vo.setMonitorName("/");
|
||||
vo.setPowerDistributionArea("/");
|
||||
vo.setMonitorSort(dictData.getName());
|
||||
} else if (dictData.getCode().equals(DicDataEnum.THREE_LINE.getCode())) {
|
||||
vo.setSubName("/");
|
||||
vo.setPowerClient("/");
|
||||
vo.setPowerClient(vo.getMonitorName());
|
||||
vo.setMonitorName("/");
|
||||
vo.setMonitorSort(dictData.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 查询监测点信息
|
||||
PmsMonitorInfoParam pmsMonitorInfoParam = new PmsMonitorInfoParam();
|
||||
pmsMonitorInfoParam.setMonitorIds(monitorIdList);
|
||||
List<PmsMonitorInfoDTO> monitorInfos = monitorClient.getMonitorInfo(pmsMonitorInfoParam).getData();
|
||||
for (PmsMonitorInfoDTO monitorInfo : monitorInfos) {
|
||||
for (PwRmpEventDetailVO vo : result) {
|
||||
if (vo.getMonitorId().equals(monitorInfo.getMonitorId())) {
|
||||
vo.setSubName(monitorInfo.getPowerName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.njcn.event.service.distribution;
|
||||
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.pojo.vo.EventDistributionStatisticsTableVO;
|
||||
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
|
||||
import com.njcn.event.pojo.vo.SimpleVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 配网-暂态事件分布统计
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/28
|
||||
*/
|
||||
|
||||
public interface PwEventCategoryDetailsService {
|
||||
/**
|
||||
* 获取配网暂态事件分布统计
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 配网暂态事件分布统计
|
||||
*/
|
||||
List<EventDistributionStatisticsTableVO> getPwEventCategoryDetails(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 获取配网持续时间概率分布函数
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return java.util.List<com.njcn.event.pojo.vo.SimpleVO>
|
||||
* @author yzh
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
List<SimpleVO> getPwDurationLineChart(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 获取配网暂降幅值概率分布函数
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return java.util.List<com.njcn.event.pojo.vo.SimpleVO>
|
||||
* @author yzh
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
List<SimpleVO> getPwFeatureAmplitudeLineChart(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 获取配网暂态指标分布统计曲线图
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO
|
||||
* @author yzh
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
EventFeatureAmplitudeCurveVO getPwEventFeatureAmplitudeCurve(StatisticsBizBaseParam param);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.event.service.distribution;
|
||||
|
||||
import com.njcn.event.pojo.param.PwUniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.vo.RStatEventOrgVO;
|
||||
import com.njcn.event.pojo.vo.RStatOrgVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 配网-暂态事件统计
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/24
|
||||
*/
|
||||
|
||||
public interface PwRStatOrgService {
|
||||
|
||||
/**
|
||||
* 获取配网区域暂态指标统计
|
||||
*
|
||||
* @param param 前端传入参数
|
||||
* @return 配网区域暂态指标统计
|
||||
*/
|
||||
List<RStatOrgVO> getPwRStatOrg(PwUniversalFrontEndParam param);
|
||||
|
||||
/**
|
||||
* 获取配网区域暂态事件分类统计
|
||||
*
|
||||
* @param param 前端传入参数
|
||||
* @return 配网区域暂态事件分类统计
|
||||
*/
|
||||
List<RStatEventOrgVO> getPwRStatOrgClassified(PwUniversalFrontEndParam param);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.event.service.distribution;
|
||||
|
||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.vo.PwRmpEventDetailVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 配网-暂态事件明细
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
|
||||
public interface PwRmpEventDetailService {
|
||||
|
||||
/**
|
||||
* 获取配网暂态事件明细
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return java.util.List<com.njcn.event.pojo.vo.RmpEventDetailVO>
|
||||
* @author yzh
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
List<PwRmpEventDetailVO> getPwRmpEventDetail(UniversalFrontEndParam param);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service;
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.event.pojo.vo.AreaAnalysisVO;
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.njcn.event.service;
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalBaseVO;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.vo.AreaSubLineVO;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service;
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service;
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.event.pojo.vo.AreaStatisticalVO;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service;
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service;
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
|
||||
@@ -29,10 +29,10 @@ public interface EventDetailService {
|
||||
/**
|
||||
* 根据监测点集合获取暂态列表
|
||||
*/
|
||||
List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime);
|
||||
List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime, List<Integer> waveType);
|
||||
|
||||
/**
|
||||
* 根据监测点集合以及分页信息获取暂降事件
|
||||
*/
|
||||
List<EventDetail> getEventDetailLimit(List<String> lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum);
|
||||
List<EventDetail> getEventDetailLimit(List<String> lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum, List<Integer> waveType);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.pojo.vo.EventDistributionStatisticsTableVO;
|
||||
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
|
||||
import com.njcn.event.pojo.vo.SimpleVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 暂态指标分布统计
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/20
|
||||
*/
|
||||
|
||||
public interface EventDistributionStatisticsService {
|
||||
|
||||
/**
|
||||
* 获取暂态指标分布统计
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 暂态指标分布统计
|
||||
*/
|
||||
List<EventDistributionStatisticsTableVO> getEventDistributionStatisticsTable(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 获取持续时间折线图
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 持续时间折线图
|
||||
*/
|
||||
List<SimpleVO> getEventDurationLineChart(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 获取特征幅值折线图
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 特征幅值折线图
|
||||
*/
|
||||
List<SimpleVO> getEventFeatureAmplitudeLineChart(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 获取暂态指标分布统计曲线图
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 暂态指标分布统计曲线图
|
||||
*/
|
||||
EventFeatureAmplitudeCurveVO getEventFeatureAmplitudeCurve(StatisticsBizBaseParam param);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.njcn.event.pojo.param.EventMonitorReportParam;
|
||||
import com.njcn.event.pojo.vo.EventDipShortDistributionVO;
|
||||
import com.njcn.event.pojo.vo.EventMonitorReportVO;
|
||||
import com.njcn.event.pojo.vo.EventRiseDistributionVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Title EventMonitorDailyReportService
|
||||
* @Package com.njcn.event.service
|
||||
* @Author jianghaifei
|
||||
* @Date 2022-10-25 09:39
|
||||
* @Version V1.0
|
||||
*/
|
||||
public interface EventMonitorReportService {
|
||||
|
||||
List<EventMonitorReportVO> getDailyReport(EventMonitorReportParam eventMonitorReportParam);
|
||||
|
||||
EventDipShortDistributionVO getEventDipShortDistributionByCond(EventMonitorReportParam eventMonitorReportParam);
|
||||
|
||||
EventRiseDistributionVO getEventRiseDistributionByCond(EventMonitorReportParam eventMonitorReportParam);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
@@ -11,13 +11,11 @@ import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.vo.AreaAnalysisVO;
|
||||
import com.njcn.event.pojo.vo.VoltageToleranceCurveVO;
|
||||
import com.njcn.event.pojo.vo.VoltageToleranceCurveVO.VoltageToleranceCurveDataList;
|
||||
import com.njcn.event.service.AreaAnalysisService;
|
||||
import com.njcn.event.service.majornetwork.AreaAnalysisService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.influxdb.querybuilder.clauses.Clause;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
@@ -6,16 +6,12 @@ import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.TerminalBaseClient;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.TerminalBaseVO;
|
||||
import com.njcn.event.pojo.constant.Param;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.vo.AreaLineVO;
|
||||
import com.njcn.event.pojo.vo.AreaSubLineVO;
|
||||
import com.njcn.event.service.AreaInfoService;
|
||||
import com.njcn.event.utils.CommUtil;
|
||||
import com.njcn.event.service.majornetwork.AreaInfoService;
|
||||
import com.njcn.influxdb.mapper.InfluxDBResultMapperCn;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDBCommUtils;
|
||||
@@ -23,7 +19,6 @@ import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -1,26 +1,23 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
|
||||
import com.njcn.device.pq.pojo.vo.SubstationDetailVO;
|
||||
import com.njcn.event.influxdb.PqsOnlinerateQuery;
|
||||
import com.njcn.event.mapper.PqDeviceMapper;
|
||||
import com.njcn.event.mapper.majornetwork.PqDeviceMapper;
|
||||
import com.njcn.event.pojo.po.PqDevice;
|
||||
import com.njcn.event.pojo.po.PqsOnlinerate;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO.TerminalRunningInfoVO;
|
||||
import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO.TerminalRunningVO;
|
||||
import com.njcn.event.service.AreaLineService;
|
||||
import com.njcn.event.service.majornetwork.AreaLineService;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateField;
|
||||
@@ -17,7 +17,7 @@ import com.njcn.event.pojo.vo.AreaStatisticalVO.MonthlyStatisticsVO;
|
||||
import com.njcn.event.pojo.vo.AreaStatisticalVO.VoltageStatisticsVO;
|
||||
import com.njcn.event.pojo.vo.MonthCalculationVO;
|
||||
import com.njcn.event.pojo.vo.VoltageLevelCalculationVO;
|
||||
import com.njcn.event.service.AreaStatisticalService;
|
||||
import com.njcn.event.service.majornetwork.AreaStatisticalService;
|
||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.influxdb.querybuilder.clauses.Clause;
|
||||
@@ -1,11 +1,8 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.abel533.echarts.code.X;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
@@ -21,8 +18,8 @@ import com.njcn.event.pojo.param.*;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.service.EventAnalysisService;
|
||||
import com.njcn.event.service.EventDetailService;
|
||||
import com.njcn.event.service.majornetwork.EventAnalysisService;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
@@ -36,7 +33,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
@@ -44,9 +40,6 @@ import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static cn.hutool.poi.excel.sax.ElementName.v;
|
||||
|
||||
|
||||
/**
|
||||
* pqs-event
|
||||
*
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.db.Page;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.service.EventDetailService;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDBCommUtils;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.influxdb.utils.AssembleSqlUtil;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -30,6 +27,7 @@ public class EventDetailServiceImpl implements EventDetailService {
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
|
||||
|
||||
@Override
|
||||
public List<EventDetail> getEventDetailData(String id, String startTime, String endTime) {
|
||||
//组装sql语句
|
||||
@@ -67,7 +65,7 @@ public class EventDetailServiceImpl implements EventDetailService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime) {
|
||||
public List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime, List<Integer> waveType) {
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ");
|
||||
@@ -75,9 +73,18 @@ public class EventDetailServiceImpl implements EventDetailService {
|
||||
if (lineIndexes.size() - i != 1) {
|
||||
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' or ");
|
||||
} else {
|
||||
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' ").append(" tz('Asia/Shanghai')");
|
||||
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' ");
|
||||
}
|
||||
}
|
||||
stringBuilder.append(" and ");
|
||||
for (int i = 0; i < waveType.size(); i++) {
|
||||
if (waveType.size() - i != 1) {
|
||||
stringBuilder.append("wave_type ='").append(waveType.get(i)).append("' or ");
|
||||
} else {
|
||||
stringBuilder.append("wave_type ='").append(waveType.get(i)).append("' ");
|
||||
}
|
||||
}
|
||||
stringBuilder.append(" tz('Asia/Shanghai')");
|
||||
//sql语句
|
||||
String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder;
|
||||
System.out.println("sql------------->>>"+sql);
|
||||
@@ -92,22 +99,31 @@ public class EventDetailServiceImpl implements EventDetailService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventDetail> getEventDetailLimit(List<String> lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum) {
|
||||
public List<EventDetail> getEventDetailLimit(List<String> lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum, List<Integer> waveType) {
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ");
|
||||
stringBuilder.append("(");
|
||||
for (int i = 0; i < lineIndexes.size(); i++) {
|
||||
if (lineIndexes.size() - i != 1) {
|
||||
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' or ");
|
||||
} else {
|
||||
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("') ");
|
||||
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' ");
|
||||
}
|
||||
}
|
||||
|
||||
stringBuilder.append(" and ");
|
||||
for (int i = 0; i < waveType.size(); i++) {
|
||||
if (waveType.size() - i != 1) {
|
||||
stringBuilder.append("wave_type ='").append(waveType.get(i)).append("' or ");
|
||||
} else {
|
||||
stringBuilder.append("wave_type ='").append(waveType.get(i)).append("' ");
|
||||
}
|
||||
}
|
||||
int i = (pageNum - 1)*pageSize;
|
||||
stringBuilder.append("LIMIT ").append(pageSize).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')");
|
||||
//sql语句
|
||||
String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder;
|
||||
System.out.println(sql);
|
||||
//结果集
|
||||
QueryResult result = influxDbUtils.query(sql);
|
||||
//结果集映射到对象中
|
||||
@@ -0,0 +1,354 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
||||
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
|
||||
import com.njcn.event.mapper.majornetwork.EventDistributionStatisticsMapper;
|
||||
import com.njcn.event.pojo.po.EventDistributionStatisticsPO;
|
||||
import com.njcn.event.pojo.po.EventDurationLineChartPO;
|
||||
import com.njcn.event.pojo.po.EventFeatureAmplitudeLineChartPO;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.EventDistributionStatisticsTableVO;
|
||||
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
|
||||
import com.njcn.event.pojo.vo.SimpleVO;
|
||||
import com.njcn.event.service.majornetwork.EventDistributionStatisticsService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 暂态指标分布统计
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/20
|
||||
*/
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class EventDistributionStatisticsServiceImpl implements EventDistributionStatisticsService {
|
||||
|
||||
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
|
||||
|
||||
private final EventDistributionStatisticsMapper eventDistributionStatisticsMapper;
|
||||
|
||||
/**
|
||||
* 获取暂态指标分布统计
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 暂态指标分布统计
|
||||
*/
|
||||
@Override
|
||||
public List<EventDistributionStatisticsTableVO> getEventDistributionStatisticsTable(StatisticsBizBaseParam param) {
|
||||
// 获取当前用户的部门的子部门信息
|
||||
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
|
||||
pmsDeviceInfoParam.setDeptIndex(param.getId());
|
||||
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||
List<PmsGeneralDeviceDTO> pmsGeneralDeviceDTOList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
|
||||
|
||||
if (CollectionUtil.isEmpty(pmsGeneralDeviceDTOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 创建集合,返回数据
|
||||
List<EventDistributionStatisticsTableVO> vos = new ArrayList<>();
|
||||
|
||||
// 将监测点id取出
|
||||
List<String> monitorIdList = getAllLineIdList(pmsGeneralDeviceDTOList);
|
||||
|
||||
if (CollectionUtil.isEmpty(monitorIdList)) {
|
||||
return Collections.emptyList();
|
||||
|
||||
}
|
||||
// 获取暂态指标分布统计
|
||||
EventDistributionStatisticsPO po = eventDistributionStatisticsMapper.getEventDistributionStatistics(
|
||||
monitorIdList,
|
||||
param.getStartTime(),
|
||||
param.getEndTime());
|
||||
|
||||
if (ObjectUtil.isEmpty(po)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 特征幅值10%
|
||||
// 创建对象返回参数
|
||||
EventDistributionStatisticsTableVO featureAmplitude10 = new EventDistributionStatisticsTableVO();
|
||||
featureAmplitude10.setFeatureAmplitude("10%");
|
||||
featureAmplitude10.setDuration20(po.getFeatureAmplitude10with20s());
|
||||
featureAmplitude10.setDuration100(po.getFeatureAmplitude10with100s());
|
||||
featureAmplitude10.setDuration500(po.getFeatureAmplitude10with500s());
|
||||
featureAmplitude10.setDuration1000(po.getFeatureAmplitude10with1000s());
|
||||
featureAmplitude10.setDuration3000(po.getFeatureAmplitude10with3000s());
|
||||
featureAmplitude10.setDuration20000(po.getFeatureAmplitude10with20000s());
|
||||
featureAmplitude10.setDuration60000(po.getFeatureAmplitude10with60000s());
|
||||
featureAmplitude10.setDuration180000(po.getFeatureAmplitude10with180000s());
|
||||
|
||||
// 特征幅值40%
|
||||
// 创建对象返回参数
|
||||
EventDistributionStatisticsTableVO featureAmplitude40 = new EventDistributionStatisticsTableVO();
|
||||
featureAmplitude40.setFeatureAmplitude("40%");
|
||||
featureAmplitude40.setDuration20(po.getFeatureAmplitude40with20s());
|
||||
featureAmplitude40.setDuration100(po.getFeatureAmplitude40with100s());
|
||||
featureAmplitude40.setDuration500(po.getFeatureAmplitude40with500s());
|
||||
featureAmplitude40.setDuration1000(po.getFeatureAmplitude40with1000s());
|
||||
featureAmplitude40.setDuration3000(po.getFeatureAmplitude40with3000s());
|
||||
featureAmplitude40.setDuration20000(po.getFeatureAmplitude40with20000s());
|
||||
featureAmplitude40.setDuration60000(po.getFeatureAmplitude40with60000s());
|
||||
featureAmplitude40.setDuration180000(po.getFeatureAmplitude40with180000s());
|
||||
|
||||
// 特征幅值70%
|
||||
// 创建对象返回参数
|
||||
EventDistributionStatisticsTableVO featureAmplitude70 = new EventDistributionStatisticsTableVO();
|
||||
featureAmplitude70.setFeatureAmplitude("70%");
|
||||
featureAmplitude70.setDuration20(po.getFeatureAmplitude70with20s());
|
||||
featureAmplitude70.setDuration100(po.getFeatureAmplitude70with100s());
|
||||
featureAmplitude70.setDuration500(po.getFeatureAmplitude70with500s());
|
||||
featureAmplitude70.setDuration1000(po.getFeatureAmplitude70with1000s());
|
||||
featureAmplitude70.setDuration3000(po.getFeatureAmplitude70with3000s());
|
||||
featureAmplitude70.setDuration20000(po.getFeatureAmplitude70with20000s());
|
||||
featureAmplitude70.setDuration60000(po.getFeatureAmplitude70with60000s());
|
||||
featureAmplitude70.setDuration180000(po.getFeatureAmplitude70with180000s());
|
||||
// 特征幅值85%
|
||||
// 创建对象返回参数
|
||||
EventDistributionStatisticsTableVO featureAmplitude85 = new EventDistributionStatisticsTableVO();
|
||||
featureAmplitude85.setFeatureAmplitude("85%");
|
||||
featureAmplitude85.setDuration20(po.getFeatureAmplitude85with20s());
|
||||
featureAmplitude85.setDuration100(po.getFeatureAmplitude85with100s());
|
||||
featureAmplitude85.setDuration500(po.getFeatureAmplitude85with500s());
|
||||
featureAmplitude85.setDuration1000(po.getFeatureAmplitude85with1000s());
|
||||
featureAmplitude85.setDuration3000(po.getFeatureAmplitude85with3000s());
|
||||
featureAmplitude85.setDuration20000(po.getFeatureAmplitude85with20000s());
|
||||
featureAmplitude85.setDuration60000(po.getFeatureAmplitude85with60000s());
|
||||
featureAmplitude85.setDuration180000(po.getFeatureAmplitude85with180000s());
|
||||
// 特征幅值90%
|
||||
// 创建对象返回参数
|
||||
EventDistributionStatisticsTableVO featureAmplitude90 = new EventDistributionStatisticsTableVO();
|
||||
featureAmplitude90.setFeatureAmplitude("90%");
|
||||
featureAmplitude90.setDuration20(po.getFeatureAmplitude90with20s());
|
||||
featureAmplitude90.setDuration100(po.getFeatureAmplitude90with100s());
|
||||
featureAmplitude90.setDuration500(po.getFeatureAmplitude90with500s());
|
||||
featureAmplitude90.setDuration1000(po.getFeatureAmplitude90with1000s());
|
||||
featureAmplitude90.setDuration3000(po.getFeatureAmplitude90with3000s());
|
||||
featureAmplitude90.setDuration20000(po.getFeatureAmplitude90with20000s());
|
||||
featureAmplitude90.setDuration60000(po.getFeatureAmplitude90with60000s());
|
||||
featureAmplitude90.setDuration180000(po.getFeatureAmplitude90with180000s());
|
||||
// 属性赋值
|
||||
vos.add(featureAmplitude10);
|
||||
vos.add(featureAmplitude40);
|
||||
vos.add(featureAmplitude70);
|
||||
vos.add(featureAmplitude85);
|
||||
vos.add(featureAmplitude90);
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取持续时间折线图
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 持续时间折线图
|
||||
*/
|
||||
@Override
|
||||
public List<SimpleVO> getEventDurationLineChart(StatisticsBizBaseParam param) {
|
||||
// 获取当前用户的部门的子部门信息
|
||||
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
|
||||
pmsDeviceInfoParam.setDeptIndex(param.getId());
|
||||
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||
List<PmsGeneralDeviceDTO> pmsGeneralDeviceDTOList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
|
||||
|
||||
if (CollectionUtil.isEmpty(pmsGeneralDeviceDTOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 创建集合返回数据
|
||||
List<SimpleVO> result = new ArrayList<>();
|
||||
// 将监测点id取出
|
||||
List<String> monitorIdList = getAllLineIdList(pmsGeneralDeviceDTOList);
|
||||
|
||||
if (CollectionUtil.isEmpty(monitorIdList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 获取持续时间折线图
|
||||
EventDurationLineChartPO po = eventDistributionStatisticsMapper.getEventDurationLineChart(
|
||||
monitorIdList,
|
||||
param.getStartTime(),
|
||||
param.getEndTime());
|
||||
|
||||
SimpleVO vo100 = new SimpleVO();
|
||||
vo100.setName("0.1");
|
||||
vo100.setValue(po.getDuration100());
|
||||
SimpleVO vo250 = new SimpleVO();
|
||||
vo250.setName("0.25");
|
||||
vo250.setValue(po.getDuration250());
|
||||
SimpleVO vo500 = new SimpleVO();
|
||||
vo500.setName("0.5");
|
||||
vo500.setValue(po.getDuration500());
|
||||
SimpleVO vo1000 = new SimpleVO();
|
||||
vo1000.setName("1");
|
||||
vo1000.setValue(po.getDuration1000());
|
||||
SimpleVO vo1100 = new SimpleVO();
|
||||
vo1100.setName("1.1");
|
||||
vo1100.setValue(po.getDuration1100());
|
||||
|
||||
// 创建map集合,封装数据
|
||||
result.add(vo100);
|
||||
result.add(vo250);
|
||||
result.add(vo500);
|
||||
result.add(vo1000);
|
||||
result.add(vo1100);
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取特征幅值折线图
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 特征幅值折线图
|
||||
*/
|
||||
@Override
|
||||
public List<SimpleVO> getEventFeatureAmplitudeLineChart(StatisticsBizBaseParam param) {
|
||||
// 获取当前用户的部门的子部门信息
|
||||
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
|
||||
pmsDeviceInfoParam.setDeptIndex(param.getId());
|
||||
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||
List<PmsGeneralDeviceDTO> pmsGeneralDeviceDTOList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
|
||||
|
||||
if (CollectionUtil.isEmpty(pmsGeneralDeviceDTOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 创建集合返回数据
|
||||
List<SimpleVO> result = new ArrayList<>();
|
||||
// 取出所有监测点id
|
||||
List<String> monitorIdList = getAllLineIdList(pmsGeneralDeviceDTOList);
|
||||
|
||||
if (CollectionUtil.isEmpty(monitorIdList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 获取特征幅值折线图
|
||||
EventFeatureAmplitudeLineChartPO po = eventDistributionStatisticsMapper.getEventFeatureAmplitudeLineChart(monitorIdList,
|
||||
param.getStartTime(),
|
||||
param.getEndTime());
|
||||
|
||||
if (ObjectUtil.isEmpty(po)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
SimpleVO vo10 = new SimpleVO();
|
||||
vo10.setName("10%");
|
||||
vo10.setValue(po.getFeatureAmplitude10());
|
||||
SimpleVO vo20 = new SimpleVO();
|
||||
vo20.setName("20%");
|
||||
vo20.setValue(po.getFeatureAmplitude20());
|
||||
SimpleVO vo30 = new SimpleVO();
|
||||
vo30.setName("30%");
|
||||
vo30.setValue(po.getFeatureAmplitude30());
|
||||
SimpleVO vo40 = new SimpleVO();
|
||||
vo40.setName("40%");
|
||||
vo40.setValue(po.getFeatureAmplitude40());
|
||||
SimpleVO vo50 = new SimpleVO();
|
||||
vo50.setName("50%");
|
||||
vo50.setValue(po.getFeatureAmplitude50());
|
||||
SimpleVO vo60 = new SimpleVO();
|
||||
vo60.setName("60%");
|
||||
vo60.setValue(po.getFeatureAmplitude60());
|
||||
SimpleVO vo70 = new SimpleVO();
|
||||
vo70.setName("70%");
|
||||
vo70.setValue(po.getFeatureAmplitude70());
|
||||
SimpleVO vo80 = new SimpleVO();
|
||||
vo80.setName("80%");
|
||||
vo80.setValue(po.getFeatureAmplitude80());
|
||||
SimpleVO vo90 = new SimpleVO();
|
||||
vo90.setName("90%");
|
||||
vo90.setValue(po.getFeatureAmplitude90());
|
||||
|
||||
// 创建map集合,封装数据
|
||||
result.add(vo10);
|
||||
result.add(vo20);
|
||||
result.add(vo30);
|
||||
result.add(vo40);
|
||||
result.add(vo50);
|
||||
result.add(vo60);
|
||||
result.add(vo70);
|
||||
result.add(vo80);
|
||||
result.add(vo90);
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取暂态指标分布统计曲线图
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 暂态指标分布统计曲线图
|
||||
*/
|
||||
@Override
|
||||
public EventFeatureAmplitudeCurveVO getEventFeatureAmplitudeCurve(StatisticsBizBaseParam param) {
|
||||
// 获取当前用户的部门的子部门信息
|
||||
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
|
||||
pmsDeviceInfoParam.setDeptIndex(param.getId());
|
||||
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||
List<PmsGeneralDeviceDTO> pmsGeneralDeviceDTOList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
|
||||
|
||||
if (CollUtil.isEmpty(pmsGeneralDeviceDTOList)) {
|
||||
return EventFeatureAmplitudeCurveVO.empty();
|
||||
}
|
||||
|
||||
// 取出所有监测点id
|
||||
List<String> monitorIdList = getAllLineIdList(pmsGeneralDeviceDTOList);
|
||||
if (CollUtil.isEmpty(monitorIdList)) {
|
||||
return EventFeatureAmplitudeCurveVO.empty();
|
||||
}
|
||||
|
||||
// 获取监测点暂态事件明细数据
|
||||
List<RmpEventDetailPO> rmpEventDetailList = eventDistributionStatisticsMapper.getRmpEventDetail(monitorIdList, param.getStartTime(), param.getEndTime());
|
||||
if (CollUtil.isEmpty(rmpEventDetailList)) {
|
||||
return EventFeatureAmplitudeCurveVO.empty();
|
||||
}
|
||||
|
||||
List<EventFeatureAmplitudeCurveVO.EventFeatureAmplitudeCurveDataList> curveDataList = rmpEventDetailList.parallelStream()
|
||||
.map(dto -> {
|
||||
EventFeatureAmplitudeCurveVO.EventFeatureAmplitudeCurveDataList eventFeatureAmplitudeCurve = new EventFeatureAmplitudeCurveVO.EventFeatureAmplitudeCurveDataList();
|
||||
eventFeatureAmplitudeCurve.setMeasurementPointId(dto.getMeasurementPointId());
|
||||
eventFeatureAmplitudeCurve.setFeatureAmplitude(dto.getFeatureAmplitude());
|
||||
eventFeatureAmplitudeCurve.setDuration(dto.getDuration());
|
||||
|
||||
eventFeatureAmplitudeCurve.setStartTime(LocalDateTime.ofInstant(dto.getStartTime().toInstant(), ZoneId.systemDefault()));
|
||||
|
||||
return eventFeatureAmplitudeCurve;
|
||||
})
|
||||
//.sorted(VoltageToleranceCurveDataList.sortAscTime())
|
||||
.collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
|
||||
|
||||
return EventFeatureAmplitudeCurveVO.buildVO(rmpEventDetailList.size(), curveDataList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部的LineID
|
||||
*
|
||||
* @param pmsGeneralDeviceDTOList 部门信息集合
|
||||
* @return lineIds
|
||||
*/
|
||||
private List<String> getAllLineIdList(List<PmsGeneralDeviceDTO> pmsGeneralDeviceDTOList) {
|
||||
|
||||
if (CollUtil.isEmpty(pmsGeneralDeviceDTOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return pmsGeneralDeviceDTOList
|
||||
.stream()
|
||||
.flatMap(pmsGeneralDeviceDTO -> pmsGeneralDeviceDTO.getMonitorIdList().stream())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
|
||||
import com.njcn.event.mapper.majornetwork.EventDistributionStatisticsMapper;
|
||||
import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
|
||||
import com.njcn.event.pojo.param.EventMonitorReportParam;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.EventDipShortDistributionVO;
|
||||
import com.njcn.event.pojo.vo.EventMonitorReportVO;
|
||||
import com.njcn.event.pojo.vo.EventRiseDistributionVO;
|
||||
import com.njcn.event.service.majornetwork.EventMonitorReportService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Title EventMonitorDailyReportServiceImpl
|
||||
* @Package com.njcn.event.service.Impl
|
||||
* @Author jianghaifei
|
||||
* @Date 2022-10-25 09:39
|
||||
* @Version V1.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EventMonitorReportServiceImpl implements EventMonitorReportService {
|
||||
|
||||
private final MonitorClient monitorClient;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final RmpEventDetailMapper rmpEventDetailMapper;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final EventDistributionStatisticsMapper eventDistributionStatisticsMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<EventMonitorReportVO> getDailyReport(EventMonitorReportParam eventMonitorReportParam) {
|
||||
//提取查询参数
|
||||
String monitorName = eventMonitorReportParam.getMonitorName(); //监测点名称
|
||||
String id = eventMonitorReportParam.getId(); //单位id
|
||||
String startTime = eventMonitorReportParam.getStartTime(); //开始时间
|
||||
String endTime = eventMonitorReportParam.getEndTime(); //截止时间
|
||||
|
||||
//获取所有子部门信息
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(id, WebUtil.filterDeptType()).getData();
|
||||
if (CollUtil.isEmpty(deptDTOList)) {
|
||||
throw new BusinessException(CommonResponseEnum.NO_DATA, "部门不存在");
|
||||
}
|
||||
//单位id集合
|
||||
List<String> orgNoList = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
|
||||
//获取电压等级的字典
|
||||
List<DictData> voltageLevelList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
//将电压信息转成map,key:id value:name
|
||||
Map<String, String> voltageLevelMap = voltageLevelList.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
|
||||
//获取暂态指标的字典
|
||||
List<DictData> eventStatisList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
//将暂态指标信息转成map,key:id value:实体
|
||||
Map<String, DictData> eventStatisMap = eventStatisList.stream().collect(Collectors.toMap(DictData::getId, data -> data));
|
||||
//将暂态指标信息转成map,key:code value:实体
|
||||
Map<String, DictData> eventStatisMapByCode = eventStatisList.stream().collect(Collectors.toMap(DictData::getCode, data -> data));
|
||||
|
||||
//查询监测点信息
|
||||
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
|
||||
pmsMonitorParam.setMonitorName(monitorName); //监测点名称
|
||||
pmsMonitorParam.setOrgIds(orgNoList); //单位ids
|
||||
List<PmsMonitorDTO> monitorList = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData(); //监测点信息
|
||||
List<String> monitorIdList = monitorList.stream().map(PmsMonitorDTO::getId).collect(Collectors.toList()); //监测点id信息
|
||||
Map<String, PmsMonitorDTO> monitorMap = monitorList.stream().collect(Collectors.toMap(PmsMonitorDTO::getId, monitor -> monitor));
|
||||
|
||||
//查询暂态事件明细
|
||||
List<RmpEventDetailPO> detailList = rmpEventDetailMapper.getDetailsOfTransientEvents(monitorIdList, null, startTime, endTime);
|
||||
Map<String, List<RmpEventDetailPO>> groupByMIdDetailMap = detailList.stream().collect(Collectors.groupingBy(RmpEventDetailPO::getMeasurementPointId, Collectors.toList()));
|
||||
List<EventMonitorReportVO> resultList = new ArrayList<>();
|
||||
groupByMIdDetailMap.forEach((key, monitorEventDetailList) -> {
|
||||
//封装返回需要返回的信息
|
||||
PmsMonitorDTO pmsMonitorDTO = monitorMap.get(key);
|
||||
|
||||
EventMonitorReportVO eventMonitorReportVO = new EventMonitorReportVO();
|
||||
eventMonitorReportVO.setDate(startTime); //查询时间
|
||||
//监测点基本信息
|
||||
eventMonitorReportVO.setMonitorId(pmsMonitorDTO.getId()); //监测点id
|
||||
eventMonitorReportVO.setMonitorName(pmsMonitorDTO.getName()); //监测点name
|
||||
eventMonitorReportVO.setOrgId(pmsMonitorDTO.getOrgId()); //单位id
|
||||
eventMonitorReportVO.setOrgName(pmsMonitorDTO.getOrgName()); //单位name
|
||||
eventMonitorReportVO.setVoltageLevel(pmsMonitorDTO.getVoltageLevel()); //监测点电压等级
|
||||
eventMonitorReportVO.setVoltageLevelName(voltageLevelMap.get(pmsMonitorDTO.getVoltageLevel())); //监测点电压等级名称
|
||||
//暂升、暂降、短时中断次数
|
||||
Map<String, List<RmpEventDetailPO>> countMap = monitorEventDetailList.stream().collect(Collectors.groupingBy(RmpEventDetailPO::getEventType, Collectors.toList()));
|
||||
countMap.forEach((countKey, value) -> {
|
||||
String code = eventStatisMap.get(countKey).getCode();
|
||||
switch (code) {
|
||||
case "Voltage_Dip":
|
||||
eventMonitorReportVO.setVoltageDipCount(CollUtil.isNotEmpty(value) ? value.size() : 0); //电压暂降次数
|
||||
break;
|
||||
case "Voltage_Rise":
|
||||
eventMonitorReportVO.setVoltageRiseCount(CollUtil.isNotEmpty(value) ? value.size() : 0); //电压暂升次数
|
||||
break;
|
||||
case "Short_Interruptions":
|
||||
eventMonitorReportVO.setShortInterruptionCount(CollUtil.isNotEmpty(value) ? value.size() : 0); //短时中断
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
});
|
||||
eventMonitorReportVO.setVoltageDipCount(eventMonitorReportVO.getVoltageDipCount() == null ? 0 : eventMonitorReportVO.getVoltageDipCount());
|
||||
eventMonitorReportVO.setVoltageRiseCount(eventMonitorReportVO.getVoltageRiseCount() == null ? 0 : eventMonitorReportVO.getVoltageRiseCount());
|
||||
eventMonitorReportVO.setShortInterruptionCount(eventMonitorReportVO.getShortInterruptionCount() == null ? 0 : eventMonitorReportVO.getShortInterruptionCount());
|
||||
|
||||
// //短时中断、暂降分布情况
|
||||
// Map<String, Object> condMap = new HashMap<>();
|
||||
// condMap.put("monitorIdList", Arrays.asList(key.split(",")));
|
||||
// condMap.put("startTime", startTime);
|
||||
// condMap.put("endTime", endTime);
|
||||
// condMap.put("eventTypeList", Arrays.asList(eventStatisMapByCode.get("Voltage_Dip").getId(), eventStatisMapByCode.get("Short_Interruptions").getId()));
|
||||
// EventDipShortDistributionVO eventDipShortDistributionVO = eventDistributionStatisticsMapper.getEventDipShortDistributionByCond(condMap);
|
||||
// eventMonitorReportVO.setDipShortStatisticsVO(eventDipShortDistributionVO);
|
||||
|
||||
//暂升分布情况
|
||||
// Map<String, Object> riseCondMap = new HashMap<>();
|
||||
// riseCondMap.put("monitorIdList", Arrays.asList(key.split(",")));
|
||||
// riseCondMap.put("startTime", startTime);
|
||||
// riseCondMap.put("endTime", endTime);
|
||||
// riseCondMap.put("eventTypeList", Collections.singletonList(eventStatisMapByCode.get("Voltage_Rise").getId()));
|
||||
// EventRiseDistributionVO eventRiseDistributionVO = eventDistributionStatisticsMapper.getEventRiseDistributionByCond(riseCondMap);
|
||||
// eventMonitorReportVO.setRiseStatisticsVO(eventRiseDistributionVO);
|
||||
|
||||
resultList.add(eventMonitorReportVO);
|
||||
});
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/***
|
||||
* 暂态指标监测点电压暂降和短时中断分布情况
|
||||
* @author jianghaifei
|
||||
* @date 2022-10-28 14:56
|
||||
* @param eventMonitorReportParam
|
||||
* @return com.njcn.event.pojo.vo.EventDipShortDistributionVO
|
||||
*/
|
||||
@Override
|
||||
public EventDipShortDistributionVO getEventDipShortDistributionByCond(EventMonitorReportParam eventMonitorReportParam) {
|
||||
//提取参数
|
||||
String monitorName = eventMonitorReportParam.getMonitorName(); //监测点名称
|
||||
String id = eventMonitorReportParam.getId(); //单位id
|
||||
String startTime = eventMonitorReportParam.getStartTime(); //开始时间
|
||||
String endTime = eventMonitorReportParam.getEndTime(); //结束时间
|
||||
|
||||
//获取所有子部门信息
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(id, WebUtil.filterDeptType()).getData();
|
||||
if (CollUtil.isEmpty(deptDTOList)) {
|
||||
throw new BusinessException(CommonResponseEnum.NO_DATA, "部门不存在");
|
||||
}
|
||||
//单位id集合
|
||||
List<String> orgNoList = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
//查询监测点信息
|
||||
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
|
||||
pmsMonitorParam.setMonitorName(monitorName); //监测点名称
|
||||
pmsMonitorParam.setOrgIds(orgNoList); //单位ids
|
||||
List<PmsMonitorDTO> monitorList = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData(); //监测点信息
|
||||
List<String> monitorIdList = monitorList.stream().map(PmsMonitorDTO::getId).collect(Collectors.toList()); //监测点id集合
|
||||
|
||||
//获取暂态指标的字典
|
||||
List<DictData> eventStatisList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
//将暂态指标信息转成map,key:code value:实体
|
||||
Map<String, DictData> eventStatisMapByCode = eventStatisList.stream().collect(Collectors.toMap(DictData::getCode, data -> data));
|
||||
|
||||
//短时中断、暂降分布情况
|
||||
Map<String, Object> condMap = new HashMap<>();
|
||||
condMap.put("monitorIdList", monitorIdList);
|
||||
condMap.put("startTime", startTime);
|
||||
condMap.put("endTime", endTime);
|
||||
condMap.put("eventTypeList", Arrays.asList(eventStatisMapByCode.get(DicDataEnum.VOLTAGE_DIP.getCode()).getId(), eventStatisMapByCode.get(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getId()));
|
||||
|
||||
return eventDistributionStatisticsMapper.getEventDipShortDistributionByCond(condMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventRiseDistributionVO getEventRiseDistributionByCond(EventMonitorReportParam eventMonitorReportParam) {
|
||||
//提取参数
|
||||
String monitorName = eventMonitorReportParam.getMonitorName(); //监测点名称
|
||||
String id = eventMonitorReportParam.getId(); //单位id
|
||||
String startTime = eventMonitorReportParam.getStartTime(); //开始时间
|
||||
String endTime = eventMonitorReportParam.getEndTime(); //结束时间
|
||||
|
||||
//获取所有子部门信息
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(id, WebUtil.filterDeptType()).getData();
|
||||
if (CollUtil.isEmpty(deptDTOList)) {
|
||||
throw new BusinessException(CommonResponseEnum.NO_DATA, "部门不存在");
|
||||
}
|
||||
//单位id集合
|
||||
List<String> orgNoList = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
//查询监测点信息
|
||||
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
|
||||
pmsMonitorParam.setMonitorName(monitorName); //监测点名称
|
||||
pmsMonitorParam.setOrgIds(orgNoList); //单位ids
|
||||
List<PmsMonitorDTO> monitorList = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData(); //监测点信息
|
||||
List<String> monitorIdList = monitorList.stream().map(PmsMonitorDTO::getId).collect(Collectors.toList()); //监测点id集合
|
||||
|
||||
//获取暂态指标的字典
|
||||
List<DictData> eventStatisList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
//将暂态指标信息转成map,key:code value:实体
|
||||
Map<String, DictData> eventStatisMapByCode = eventStatisList.stream().collect(Collectors.toMap(DictData::getCode, data -> data));
|
||||
//暂升分布情况
|
||||
Map<String, Object> riseCondMap = new HashMap<>();
|
||||
riseCondMap.put("monitorIdList", monitorIdList);
|
||||
riseCondMap.put("startTime", startTime);
|
||||
riseCondMap.put("endTime", endTime);
|
||||
riseCondMap.put("eventTypeList", Collections.singletonList(eventStatisMapByCode.get(DicDataEnum.VOLTAGE_RISE.getCode()).getId()));
|
||||
|
||||
return eventDistributionStatisticsMapper.getEventRiseDistributionByCond(riseCondMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.event.mapper.majornetwork.RStatEventDMapper;
|
||||
import com.njcn.event.pojo.po.RStatEventD;
|
||||
import com.njcn.event.service.majornetwork.RStatEventDService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-12
|
||||
*/
|
||||
@Service
|
||||
public class RStatEventDServiceImpl extends ServiceImpl<RStatEventDMapper, RStatEventD> implements RStatEventDService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,591 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
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.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.mapper.majornetwork.RStatEventDMapper;
|
||||
import com.njcn.event.mapper.majornetwork.RStatEventMMapper;
|
||||
import com.njcn.event.mapper.majornetwork.RStatEventVoltageMMapper;
|
||||
import com.njcn.event.pojo.param.REventMParam;
|
||||
import com.njcn.event.pojo.po.*;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.service.majornetwork.RStatEventMService;
|
||||
import com.njcn.device.pq.utils.PublicDateUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-11
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RStatEventMServiceImpl extends ServiceImpl<RStatEventMMapper, RStatEventM> implements RStatEventMService {
|
||||
|
||||
private final RStatEventMMapper rStatEventMMapper;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final RStatEventDMapper rStatEventDMapper;
|
||||
private final RStatEventVoltageMMapper rStatEventVoltageMMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getRStatEventMAll(StatisticsBizBaseParam param) {
|
||||
//子节点 获取所有得干扰源类型(监测点类型)
|
||||
List<DictData> interferenceSourceTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.MONITORING_LABELS.getCode()).getData();
|
||||
Map<String, DictData> interferenceMap = interferenceSourceTypeData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> lineTypeMap = lineTypeData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
//获取主网id信息
|
||||
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||
|
||||
//数据库查询
|
||||
List<RStatEventM> list = rStatEventMMapper.selectList(new LambdaQueryWrapper<RStatEventM>()
|
||||
.eq(RStatEventM::getDataType, mainnetData.getId())
|
||||
.ge(param.getStartTime() != null, RStatEventM::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventM::getDataDate, param.getEndTime()));
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventMVO> rm = new ArrayList<>();
|
||||
for (DictData lineTypeDatum : interferenceSourceTypeData) {
|
||||
RStatEventMVO r = new RStatEventMVO();
|
||||
r.setEventName(lineTypeDatum.getName());
|
||||
r.setSort(lineTypeDatum.getSort());
|
||||
r.setEventMeasurementAverage(0);
|
||||
r.setEventMeasurementAccrued(0);
|
||||
r.setEventFreq(0.0F);
|
||||
r.setEventCount(0);
|
||||
r.setEventMeasurementRatioAverage(0.0F);
|
||||
r.setEventMeasurementRatioAccrued(0.0F);
|
||||
rm.add(r);
|
||||
}
|
||||
for (DictData lineTypeDatum : lineTypeData) {
|
||||
RArrayVO r = new RArrayVO();
|
||||
r.setRowName(lineTypeDatum.getName());
|
||||
r.setColumns(rm);
|
||||
r.setSort(lineTypeDatum.getSort());
|
||||
arrayVOList.add(r);
|
||||
}
|
||||
//根据暂态指标分组
|
||||
Map<String, List<RStatEventM>> MeasurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventM::getEventType));
|
||||
//重新生成数据结构
|
||||
MeasurementTypeClassMap.forEach((key, value) -> {
|
||||
if (lineTypeMap.containsKey(key)) {
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
DictData data = lineTypeMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
List<RStatEventMVO> b = new ArrayList<>();
|
||||
b.addAll(rm);
|
||||
for (RStatEventM rStatEventM : value) {
|
||||
if(interferenceMap.containsKey(rStatEventM.getMeasurementTypeClass())){
|
||||
RStatEventMVO r = BeanUtil.copyProperties(rStatEventM, RStatEventMVO.class);
|
||||
DictData data1 = interferenceMap.get(rStatEventM.getMeasurementTypeClass());
|
||||
r.setEventName(data1.getName());
|
||||
r.setSort(data1.getSort());
|
||||
b.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
Map<String, RStatEventMVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RStatEventMVO harmonicMVO : b) {
|
||||
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
|
||||
}
|
||||
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVO.setColumns(aa);
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
});
|
||||
Map<String, RArrayVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RArrayVO rArrayVO : arrayVOList) {
|
||||
linkedHashMap.put(rArrayVO.getRowName(), rArrayVO);
|
||||
}
|
||||
List<RArrayVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return aa;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getPwRStatEventMAll(StatisticsBizBaseParam param) {
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> eventData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> eventMap = eventData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
//子节点 获取监测点类别
|
||||
List<DictData> lineData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineMap = lineData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
//获取配网id信息
|
||||
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
//数据库查询
|
||||
List<RStatEventM> list = rStatEventMMapper.selectList(new LambdaQueryWrapper<RStatEventM>()
|
||||
.eq(RStatEventM::getDataType, distributionData.getId())
|
||||
.ge(param.getStartTime() != null, RStatEventM::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventM::getDataDate, param.getEndTime()));
|
||||
//根据暂态指标分组
|
||||
Map<String, List<RStatEventM>> measurementMap = list.stream().collect(Collectors.groupingBy(RStatEventM::getEventType));
|
||||
//判断对象是否为空
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
//重新生成数据结构
|
||||
measurementMap.forEach((key, value) -> {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
if (eventMap.containsKey(key)) {
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
DictData data = eventMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
for (RStatEventM rStatEvent : value) {
|
||||
if(lineMap.containsKey(rStatEvent.getMeasurementTypeClass())){
|
||||
RStatEventMVO r = BeanUtil.copyProperties(rStatEvent, RStatEventMVO.class);
|
||||
DictData data1 = lineMap.get(rStatEvent.getMeasurementTypeClass());
|
||||
r.setEventName(data1.getName());
|
||||
r.setSort(data1.getSort());
|
||||
eventVO.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
//根据监测点类别获取差集
|
||||
Map<String, List<RStatEventM>> listMap = value.stream().collect(Collectors.groupingBy(RStatEventM::getMeasurementTypeClass));
|
||||
List<DictData> differenceList = lineData.stream().filter(r -> !listMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
this.assignDict(differenceList, eventVO, arrayVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//处理主节点不存在的集合
|
||||
List<DictData> notMeasurementList = eventData.stream().filter(r -> !measurementMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
for (DictData notData : notMeasurementList) {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
arrayVO.setRowName(notData.getName());
|
||||
arrayVO.setSort(notData.getSort());
|
||||
this.assignDict(lineData, eventVO, arrayVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RStatEventMVO> getRStatHarmonicIcon(REventMParam param) {
|
||||
//干扰数据类型(监测对象)
|
||||
DictData measurementData;
|
||||
//指标对象类型属性
|
||||
DictData eventData;
|
||||
//判断是是否传入检测点信息值(电压)
|
||||
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
|
||||
//干扰数据类型(监测对象)
|
||||
List<DictData> interferenceSourceTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.MONITORING_LABELS.getCode()).getData();
|
||||
interferenceSourceTypeData.sort(Comparator.comparing(data -> data.getSort()));
|
||||
measurementData = interferenceSourceTypeData.get(0);
|
||||
//指标对象类型
|
||||
List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
|
||||
eventData = indicatorTypeDate.get(0);
|
||||
} else {
|
||||
//获取检测点对象(电压)
|
||||
measurementData = dicDataFeignClient.getDicDataById(
|
||||
param.getMonitorID()).getData();
|
||||
//获取指标对象(频率偏差)
|
||||
eventData = dicDataFeignClient.getDicDataById(
|
||||
param.getStasisID()).getData();
|
||||
}
|
||||
//反防止参数查询数据报错
|
||||
Assert.isTrue(
|
||||
ObjectUtil.isNotNull(measurementData) || ObjectUtil.isNotNull(eventData)
|
||||
, "干扰源类型或者指标类型为空,请检查入参是否准确");
|
||||
//获取电压字典
|
||||
List<DictData> devVoltageData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
Map<String, DictData> devVoltageMap = devVoltageData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
//获取主网id信息
|
||||
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||
|
||||
//初始化对象
|
||||
List<RStatEventMVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventVoltageM> rStatHarmonicVoltageMS = rStatEventVoltageMMapper.selectList(new LambdaQueryWrapper<RStatEventVoltageM>()
|
||||
.eq(RStatEventVoltageM::getDataType, mainnetData.getId())
|
||||
.eq(RStatEventVoltageM::getMeasurementTypeClass, measurementData.getId())
|
||||
.eq(RStatEventVoltageM::getEventType, eventData.getId())
|
||||
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventVoltageM::getDataDate, param.getStartTime())
|
||||
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventVoltageM::getDataDate, param.getEndTime())
|
||||
);
|
||||
//将数据转换为map进行便利
|
||||
Map<String, RStatEventVoltageM> voltageMMap = rStatHarmonicVoltageMS.stream()
|
||||
.collect(Collectors.toMap(RStatEventVoltageM::getVoltageType, Function.identity()));
|
||||
//对象
|
||||
if (CollUtil.isNotEmpty(rStatHarmonicVoltageMS)) {
|
||||
voltageMMap.forEach((key, value) -> {
|
||||
if (devVoltageMap.containsKey(key)) {
|
||||
DictData data = devVoltageMap.get(key);
|
||||
RStatEventMVO riconvo = new RStatEventMVO();
|
||||
riconvo.setEventName(data.getName());
|
||||
riconvo.setSort(data.getSort());
|
||||
riconvo.setEventMeasurementAverage(value.getEventMeasurementAverage());
|
||||
riconvo.setEventMeasurementAccrued(value.getEventMeasurementAccrued());
|
||||
riconvo.setEventFreq(value.getEventFreq());
|
||||
riconvo.setEventCount(value.getEventCount());
|
||||
riconvo.setEventMeasurementRatioAverage(value.getEventMeasurementRatioAverage());
|
||||
riconvo.setEventMeasurementRatioAccrued(value.getEventMeasurementRatioAccrued());
|
||||
arrayVOList.add(riconvo);
|
||||
}
|
||||
});
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getSort()));
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public List<REventPolylineVO> getRStatHarmonicIcon2(REventMParam param) {
|
||||
//初始化对象
|
||||
List<REventPolylineVO> iconList = new ArrayList<>();
|
||||
DictData measurementDate;
|
||||
//指标对象类型属性
|
||||
DictData harmonicDate;
|
||||
//判断是是否传入检测点信息值(电压)
|
||||
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
|
||||
//干扰数据类型(监测对象)
|
||||
List<DictData> interferenceSourceTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.MONITORING_LABELS.getCode()).getData();
|
||||
interferenceSourceTypeData.sort(Comparator.comparing(data -> data.getSort()));
|
||||
measurementDate = interferenceSourceTypeData.get(0);
|
||||
//指标对象类型
|
||||
List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
|
||||
harmonicDate = indicatorTypeDate.get(0);
|
||||
} else {
|
||||
//获取检测点对象(电压)
|
||||
measurementDate = dicDataFeignClient.getDicDataById(
|
||||
param.getMonitorID()).getData();
|
||||
//获取指标对象(频率偏差)
|
||||
harmonicDate = dicDataFeignClient.getDicDataById(
|
||||
param.getStasisID()).getData();
|
||||
}
|
||||
//反防止参数查询数据报错
|
||||
Assert.isTrue(
|
||||
ObjectUtil.isNotNull(measurementDate) || ObjectUtil.isNotNull(harmonicDate)
|
||||
, "干扰源类型或者指标类型为空,请检查入参是否准确");
|
||||
//获取主网id信息
|
||||
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||
|
||||
List<RStatEventD> rStatHarmonicVoltageMS = rStatEventDMapper.selectList(new LambdaQueryWrapper<RStatEventD>()
|
||||
.eq(RStatEventD::getDataType, mainnetData.getId())
|
||||
.eq(RStatEventD::getMeasurementTypeClass, measurementDate.getId())
|
||||
.eq(RStatEventD::getEventType, harmonicDate.getId())
|
||||
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventD::getDataDate, param.getStartTime())
|
||||
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventD::getDataDate, param.getEndTime())
|
||||
);
|
||||
Map<LocalDate, List<RStatEventD>> rStatEventDMap =
|
||||
rStatHarmonicVoltageMS.stream().collect(Collectors.groupingBy(RStatEventD::getDataDate));
|
||||
//获取月份
|
||||
List<String> intervalTime = this.getIntervalTime(param.getStartTime(), param.getEndTime());
|
||||
for (String interTime : intervalTime) {
|
||||
//生成初始时间
|
||||
String startTime = PublicDateUtil.getFisrtDayOfMonth(Integer.parseInt(interTime.substring(0, 4)), Integer.parseInt(interTime.substring(5)));
|
||||
String endTime = PublicDateUtil.getLastDayOfMonth(Integer.parseInt(interTime.substring(0, 4)), Integer.parseInt(interTime.substring(5)));
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date dt = simpleDateFormat.parse(startTime);
|
||||
Date dtDate = simpleDateFormat.parse(endTime);
|
||||
Integer year = Integer.valueOf(String.format("%tY", dt));
|
||||
Integer mon = Integer.valueOf(String.format("%tm", dt));
|
||||
Integer day = Integer.valueOf(String.format("%td", dtDate));
|
||||
//生成月份数据
|
||||
List<String> dayTime = this.getIntervalDateTime(year, mon, day);
|
||||
for (String s : dayTime) {
|
||||
REventPolylineVO rPolylineVO = new REventPolylineVO();
|
||||
rPolylineVO.setDate(s);
|
||||
if (rStatEventDMap.containsKey(LocalDateTimeUtil.parseDate(s, "yyyy-MM-dd"))) {
|
||||
List<RStatEventD> rSd = rStatEventDMap.get(LocalDateTimeUtil.parseDate(s, "yyyy-MM-dd"));
|
||||
rPolylineVO.setEventCount(rSd.get(0).getEventCount());
|
||||
rPolylineVO.setEventMeasurement(rSd.get(0).getEventMeasurement());
|
||||
rPolylineVO.setEventMeasurementRatio(rSd.get(0).getEventMeasurementRatio());
|
||||
rPolylineVO.setEventFreq(1);
|
||||
} else {
|
||||
rPolylineVO.setEventMeasurement(0);
|
||||
rPolylineVO.setEventMeasurementRatio(0.0F);
|
||||
rPolylineVO.setEventCount(0);
|
||||
rPolylineVO.setEventFreq(0);
|
||||
}
|
||||
iconList.add(rPolylineVO);
|
||||
}
|
||||
|
||||
}
|
||||
return iconList;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public List<REventPolylineVO> getPwRStatHarmonicIcon2(REventMParam param) {
|
||||
//初始化对象
|
||||
List<REventPolylineVO> iconList = new ArrayList<>();
|
||||
DictData measurementData;
|
||||
//指标对象类型属性
|
||||
DictData eventData;
|
||||
//判断是是否传入监测点信息值
|
||||
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
|
||||
//干扰数据类型(监测对象)
|
||||
List<DictData> interferenceSourceTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
interferenceSourceTypeData.sort(Comparator.comparing(data -> data.getSort()));
|
||||
measurementData = interferenceSourceTypeData.get(0);
|
||||
//指标对象类型
|
||||
List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
|
||||
eventData = indicatorTypeDate.get(0);
|
||||
} else {
|
||||
//获取检测点对象(电压)
|
||||
measurementData = dicDataFeignClient.getDicDataById(
|
||||
param.getMonitorID()).getData();
|
||||
//获取指标对象(频率偏差)
|
||||
eventData = dicDataFeignClient.getDicDataById(
|
||||
param.getStasisID()).getData();
|
||||
}
|
||||
//反防止参数查询数据报错
|
||||
Assert.isTrue(
|
||||
ObjectUtil.isNotNull(measurementData) || ObjectUtil.isNotNull(eventData)
|
||||
, "干扰源类型或者指标类型为空,请检查入参是否准确");
|
||||
//获取配网信息
|
||||
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
|
||||
|
||||
List<RStatEventD> rStatHarmonicVoltageMS = rStatEventDMapper.selectList(new LambdaQueryWrapper<RStatEventD>()
|
||||
.eq(RStatEventD::getDataType, distributionData.getId())
|
||||
.eq(RStatEventD::getMeasurementTypeClass, measurementData.getId())
|
||||
.eq(RStatEventD::getEventType, eventData.getId())
|
||||
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventD::getDataDate, param.getStartTime())
|
||||
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventD::getDataDate, param.getEndTime())
|
||||
);
|
||||
Map<LocalDate, List<RStatEventD>> rStatEventDMap =
|
||||
rStatHarmonicVoltageMS.stream().collect(Collectors.groupingBy(RStatEventD::getDataDate));
|
||||
//获取月份
|
||||
List<String> intervalTime = this.getIntervalTime(param.getStartTime(), param.getEndTime());
|
||||
for (String interTime : intervalTime) {
|
||||
//生成初始时间
|
||||
String startTime = PublicDateUtil.getFisrtDayOfMonth(Integer.parseInt(interTime.substring(0, 4)), Integer.parseInt(interTime.substring(5)));
|
||||
String endTime = PublicDateUtil.getLastDayOfMonth(Integer.parseInt(interTime.substring(0, 4)), Integer.parseInt(interTime.substring(5)));
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date dt = simpleDateFormat.parse(startTime);
|
||||
Date dtDate = simpleDateFormat.parse(endTime);
|
||||
Integer year = Integer.valueOf(String.format("%tY", dt));
|
||||
Integer mon = Integer.valueOf(String.format("%tm", dt));
|
||||
Integer day = Integer.valueOf(String.format("%td", dtDate));
|
||||
//生成月份数据
|
||||
List<String> dayTime = this.getIntervalDateTime(year, mon, day);
|
||||
for (String s : dayTime) {
|
||||
REventPolylineVO rPolylineVO = new REventPolylineVO();
|
||||
rPolylineVO.setDate(s);
|
||||
if (rStatEventDMap.containsKey(LocalDateTimeUtil.parseDate(s, "yyyy-MM-dd"))) {
|
||||
List<RStatEventD> rSd = rStatEventDMap.get(LocalDateTimeUtil.parseDate(s, "yyyy-MM-dd"));
|
||||
rPolylineVO.setEventCount(rSd.get(0).getEventCount());
|
||||
rPolylineVO.setEventMeasurement(rSd.get(0).getEventMeasurement());
|
||||
rPolylineVO.setEventMeasurementRatio(rSd.get(0).getEventMeasurementRatio());
|
||||
rPolylineVO.setEventFreq(1);
|
||||
} else {
|
||||
rPolylineVO.setEventMeasurement(0);
|
||||
rPolylineVO.setEventMeasurementRatio(0.0F);
|
||||
rPolylineVO.setEventCount(0);
|
||||
rPolylineVO.setEventFreq(0);
|
||||
}
|
||||
iconList.add(rPolylineVO);
|
||||
}
|
||||
|
||||
}
|
||||
return iconList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户选择的时间区间返回月份日期
|
||||
*/
|
||||
@SneakyThrows
|
||||
private List<String> getIntervalTime(String startTime, String endTime) {
|
||||
List<String> times = new ArrayList<>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
Date start = sdf.parse(startTime);
|
||||
Date end = sdf.parse(endTime);
|
||||
// 同月
|
||||
if (start.getTime() == end.getTime()) {
|
||||
String time = startTime.substring(0, 7);
|
||||
times.add(time);
|
||||
} else if (start.getYear() == end.getYear()) {
|
||||
// 同年
|
||||
int startM = start.getMonth() + 1;
|
||||
int endM = end.getMonth() + 1;
|
||||
int temp = endM - startM;
|
||||
for (int i = 0; i <= temp; i++) {
|
||||
String time = start.getYear() + 1900 + "";
|
||||
int month = startM + i;
|
||||
if (month < 10) {
|
||||
time = time + "-0" + month;
|
||||
} else {
|
||||
time = time + "-" + month;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
} else {
|
||||
// 不同年!!!!这里忽略了年份之间跨年的情况
|
||||
int startY = start.getYear() + 1900;
|
||||
int startM = start.getMonth() + 1;
|
||||
int endY = end.getYear() + 1900;
|
||||
int endM = end.getMonth() + 1;
|
||||
int tempS = 12 - startM;
|
||||
// 连续的年份
|
||||
if (endY - startY == 1) {
|
||||
// 第一年的时间获取
|
||||
for (int i = 0; i <= tempS; i++) {
|
||||
int month = startM + i;
|
||||
String time = startY + "-";
|
||||
if (month < 10) {
|
||||
time = time + "0" + month;
|
||||
} else {
|
||||
time = time + month;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
// 第二年的时间获取
|
||||
|
||||
for (int i = 1; i <= endM; i++) {
|
||||
String time = endY + "-";
|
||||
if (i < 10) {
|
||||
time = time + "0" + i;
|
||||
} else {
|
||||
time = time + i;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
} else {
|
||||
// 不连续的年份
|
||||
// 第一年的时间获取
|
||||
for (int i = 0; i <= tempS; i++) {
|
||||
int month = startM + i;
|
||||
String time = startY + "-";
|
||||
if (month < 10) {
|
||||
time = time + "0" + month;
|
||||
} else {
|
||||
time = time + month;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
int tempY = endY - startY;
|
||||
// 中间年份的时间
|
||||
for (int i = 1; i < tempY; i++) {
|
||||
for (int j = 1; j <= 12; j++) {
|
||||
String time = startY + i + "-";
|
||||
if (j < 10) {
|
||||
time = time + "0" + j;
|
||||
} else {
|
||||
time = time + j;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
}
|
||||
// 最后一年的时间获取
|
||||
for (int i = 1; i <= endM; i++) {
|
||||
String time = endY + "-";
|
||||
if (i < 10) {
|
||||
time = time + "0" + i;
|
||||
} else {
|
||||
time = time + i;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private List<String> getIntervalDateTime(Integer startTime, Integer endTime, Integer dd) {
|
||||
List<String> list = new ArrayList<>();
|
||||
Calendar calendar = Calendar.getInstance(Locale.CHINA);
|
||||
calendar.set(startTime, endTime - 1, 1);
|
||||
//年份
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
//月份
|
||||
int month = calendar.get(Calendar.MONTH) + 1;
|
||||
for (int i = 1; i <= dd; i++) {
|
||||
String date = null;
|
||||
if (month < 10 && i < 10) {
|
||||
date = year + "-0" + month + "-0" + i;
|
||||
}
|
||||
if (month < 10 && i >= 10) {
|
||||
date = year + "-0" + month + "-" + i;
|
||||
}
|
||||
if (month >= 10 && i < 10) {
|
||||
date = year + "-" + month + "-0" + i;
|
||||
}
|
||||
if (month >= 10 && i >= 10) {
|
||||
date = year + "-" + month + "-" + i;
|
||||
}
|
||||
|
||||
list.add(date);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 便利赋值
|
||||
*
|
||||
* @param DictDataList 暂态类型集合
|
||||
* @param eventVO 暂态监测点
|
||||
* @param arrayVO 初始化对象
|
||||
*/
|
||||
private void assignDict(List<DictData> DictDataList, List<RStatEventMVO> eventVO, RArrayVO arrayVO) {
|
||||
for (DictData dictData : DictDataList) {
|
||||
RStatEventMVO notEventVO = new RStatEventMVO();
|
||||
notEventVO.setEventName(dictData.getName());
|
||||
notEventVO.setSort(dictData.getSort());
|
||||
notEventVO.setEventMeasurementAverage(0);
|
||||
notEventVO.setEventMeasurementAccrued(0);
|
||||
notEventVO.setEventFreq(0.0F);
|
||||
notEventVO.setEventCount(0);
|
||||
notEventVO.setEventMeasurementRatioAverage(0.0F);
|
||||
notEventVO.setEventMeasurementRatioAccrued(0.0F);
|
||||
eventVO.add(notEventVO);
|
||||
}
|
||||
arrayVO.setColumns(eventVO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,342 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
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.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.mapper.majornetwork.RStatEventOrgMMapper;
|
||||
import com.njcn.event.pojo.param.REventMParam;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgM;
|
||||
import com.njcn.event.pojo.vo.RArrayVO;
|
||||
import com.njcn.event.pojo.vo.RStatEventMVO;
|
||||
import com.njcn.event.service.majornetwork.RStatEventOrgMService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-11
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper, RStatEventOrgM> implements RStatEventOrgMService {
|
||||
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final RStatEventOrgMMapper statEventOrgMMapper;
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getRStatEventOrgMAll(StatisticsBizBaseParam param) {
|
||||
//子节点 获取所有得各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
|
||||
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> lineTypeMap = lineTypeData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
//获取主网id信息
|
||||
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||
|
||||
//数据库查询
|
||||
List<RStatEventOrgM> list = statEventOrgMMapper.selectList(new LambdaQueryWrapper<RStatEventOrgM>()
|
||||
.eq(RStatEventOrgM::getDataType, mainnetData.getId())
|
||||
.in(RStatEventOrgM::getOrgNo, deptIds)
|
||||
.ge(param.getStartTime() != null, RStatEventOrgM::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventOrgM::getDataDate, param.getEndTime()));
|
||||
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventMVO> rm = new ArrayList<>();
|
||||
for (DeptDTO deptDTO : deptDTOList) {
|
||||
RStatEventMVO r = new RStatEventMVO();
|
||||
r.setEventName(deptDTO.getName());
|
||||
r.setEventMeasurementAverage(0);
|
||||
r.setEventMeasurementAccrued(0);
|
||||
r.setEventFreq(0.0F);
|
||||
r.setEventCount(0);
|
||||
r.setEventMeasurementRatioAverage(0.0F);
|
||||
r.setEventMeasurementRatioAccrued(0.0F);
|
||||
rm.add(r);
|
||||
}
|
||||
for (DictData lineTypeDatum : lineTypeData) {
|
||||
RArrayVO r = new RArrayVO();
|
||||
r.setRowName(lineTypeDatum.getName());
|
||||
r.setColumns(rm);
|
||||
r.setSort(lineTypeDatum.getSort());
|
||||
arrayVOList.add(r);
|
||||
}
|
||||
//根据检测点对象分组
|
||||
Map<String, List<RStatEventOrgM>> MeasurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventOrgM::getEventType));
|
||||
//重新生成数据结构
|
||||
MeasurementTypeClassMap.forEach((key, value) -> {
|
||||
if (lineTypeMap.containsKey(key)) {
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
DictData data = lineTypeMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
List<RStatEventMVO> b = new ArrayList<>();
|
||||
b.addAll(rm);
|
||||
for (RStatEventOrgM orgM : value) {
|
||||
if(deptMap.containsKey(orgM.getOrgNo())){
|
||||
RStatEventMVO r = BeanUtil.copyProperties(orgM, RStatEventMVO.class);
|
||||
DeptDTO data1 = deptMap.get(orgM.getOrgNo());
|
||||
r.setEventName(data1.getName());
|
||||
b.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
Map<String, RStatEventMVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RStatEventMVO harmonicMVO : b) {
|
||||
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
|
||||
}
|
||||
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName()));
|
||||
arrayVO.setColumns(aa);
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
|
||||
});
|
||||
Map<String, RArrayVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RArrayVO rArrayVO : arrayVOList) {
|
||||
linkedHashMap.put(rArrayVO.getRowName(), rArrayVO);
|
||||
}
|
||||
List<RArrayVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return aa;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RStatEventMVO> getRStatHarmonicOrgMIcon(REventMParam param) {
|
||||
//各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
//指标对象类型属性
|
||||
DictData eventData;
|
||||
//判断是是否传入检测点信息值(电压)
|
||||
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
|
||||
//指标对象类型
|
||||
List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
|
||||
eventData = indicatorTypeDate.get(0);
|
||||
} else {
|
||||
//获取指标对象(频率偏差)
|
||||
eventData = dicDataFeignClient.getDicDataById(
|
||||
param.getStasisID()).getData();
|
||||
}
|
||||
//反防止参数查询数据报错
|
||||
Assert.isTrue(
|
||||
CollUtil.isNotEmpty(deptDTOList) || ObjectUtil.isNotNull(eventData)
|
||||
, "各单位或者指标类型为空,请检查入参是否准确");
|
||||
//获取主网id信息
|
||||
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||
|
||||
//初始化对象
|
||||
List<RStatEventMVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventOrgM> rStatHarmonicVoltageMS = statEventOrgMMapper.selectList(new LambdaQueryWrapper<RStatEventOrgM>()
|
||||
.eq(RStatEventOrgM::getDataType, mainnetData.getId())
|
||||
.in(RStatEventOrgM::getOrgNo, deptIds)
|
||||
.eq(RStatEventOrgM::getEventType, eventData.getId())
|
||||
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventOrgM::getDataDate, param.getStartTime())
|
||||
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventOrgM::getDataDate, param.getEndTime())
|
||||
);
|
||||
//将数据转换为map进行便利
|
||||
Map<String, List<RStatEventOrgM>> voltageMMap = rStatHarmonicVoltageMS.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventOrgM::getOrgNo));
|
||||
//对象
|
||||
if (CollUtil.isNotEmpty(rStatHarmonicVoltageMS)) {
|
||||
voltageMMap.forEach((key, value) -> {
|
||||
if (deptMap.containsKey(key)) {
|
||||
DeptDTO data = deptMap.get(key);
|
||||
for (RStatEventOrgM orgM : value) {
|
||||
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgM, RStatEventMVO.class);
|
||||
rStatEventMVO.setEventName(data.getName());
|
||||
arrayVOList.add(rStatEventMVO);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getPwRStatEventOrgMAll(StatisticsBizBaseParam param) {
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> eventData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> eventMap = eventData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
//子节点 获取所有得各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
|
||||
|
||||
//获取配网信息
|
||||
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
|
||||
|
||||
//数据库查询
|
||||
List<RStatEventOrgM> list = statEventOrgMMapper.selectList(new LambdaQueryWrapper<RStatEventOrgM>()
|
||||
.eq(RStatEventOrgM::getDataType, distributionData.getId())
|
||||
.in(RStatEventOrgM::getOrgNo, deptIds)
|
||||
.ge(param.getStartTime() != null, RStatEventOrgM::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventOrgM::getDataDate, param.getEndTime()));
|
||||
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
|
||||
//根据检测点对象分组
|
||||
Map<String, List<RStatEventOrgM>> measurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventOrgM::getEventType));
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
//重新生成数据结构
|
||||
measurementTypeClassMap.forEach((key, value) -> {
|
||||
if (eventMap.containsKey(key)) {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
DictData data = eventMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
for (RStatEventOrgM org : value) {
|
||||
if(deptMap.containsKey(org.getOrgNo())){
|
||||
RStatEventMVO r = BeanUtil.copyProperties(org, RStatEventMVO.class);
|
||||
DeptDTO deptDTO = deptMap.get(org.getOrgNo());
|
||||
r.setEventName(deptDTO.getName());
|
||||
eventVO.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
//根据监测点类别获取差集
|
||||
Map<String, List<RStatEventOrgM>> listMap = value.stream().collect(Collectors.groupingBy(RStatEventOrgM::getEventType));
|
||||
List<DeptDTO> notDeptList = deptDTOList.stream().filter(r -> !listMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
this.assignDept(notDeptList, eventVO, arrayVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
//处理主节点不存在的集合
|
||||
List<DictData> notMeasurementList = eventData.stream().filter(r -> !measurementTypeClassMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
for (DictData notData : notMeasurementList) {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
arrayVO.setRowName(notData.getName());
|
||||
arrayVO.setSort(notData.getSort());
|
||||
this.assignDept(deptDTOList, eventVO, arrayVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RStatEventMVO> getPwRStatHarmonicOrgMIcon(REventMParam param) {
|
||||
//各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
//指标对象类型属性
|
||||
DictData eventData;
|
||||
//判断是是否传入检测点信息值(电压)
|
||||
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
|
||||
//指标对象类型
|
||||
List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
|
||||
eventData = indicatorTypeDate.get(0);
|
||||
} else {
|
||||
//获取指标对象(频率偏差)
|
||||
eventData = dicDataFeignClient.getDicDataById(
|
||||
param.getStasisID()).getData();
|
||||
}
|
||||
//反防止参数查询数据报错
|
||||
Assert.isTrue(
|
||||
CollUtil.isNotEmpty(deptDTOList) || ObjectUtil.isNotNull(eventData)
|
||||
, "各单位或者指标类型为空,请检查入参是否准确");
|
||||
//获取配网信息
|
||||
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
|
||||
|
||||
//初始化对象
|
||||
List<RStatEventMVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventOrgM> rStatHarmonicVoltageMS = statEventOrgMMapper.selectList(new LambdaQueryWrapper<RStatEventOrgM>()
|
||||
.eq(RStatEventOrgM::getDataType, distributionData.getId())
|
||||
.in(RStatEventOrgM::getOrgNo, deptIds)
|
||||
.eq(RStatEventOrgM::getEventType, eventData.getId())
|
||||
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventOrgM::getDataDate, param.getStartTime())
|
||||
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventOrgM::getDataDate, param.getEndTime())
|
||||
);
|
||||
//将数据转换为map进行便利
|
||||
Map<String, List<RStatEventOrgM>> voltageMMap = rStatHarmonicVoltageMS.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventOrgM::getOrgNo));
|
||||
//对象
|
||||
if (CollUtil.isNotEmpty(rStatHarmonicVoltageMS)) {
|
||||
voltageMMap.forEach((key, value) -> {
|
||||
if (deptMap.containsKey(key)) {
|
||||
DeptDTO data = deptMap.get(key);
|
||||
for (RStatEventOrgM orgM : value) {
|
||||
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgM, RStatEventMVO.class);
|
||||
rStatEventMVO.setEventName(data.getName());
|
||||
arrayVOList.add(rStatEventMVO);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 便利赋值
|
||||
*
|
||||
* @param deptDTOList 部门集合
|
||||
* @param eventVO 暂态监测点
|
||||
* @param arrayVO 初始化对象
|
||||
*/
|
||||
private void assignDept(List<DeptDTO> deptDTOList, List<RStatEventMVO> eventVO, RArrayVO arrayVO) {
|
||||
for (DeptDTO dictData : deptDTOList) {
|
||||
RStatEventMVO notEventVO = new RStatEventMVO();
|
||||
notEventVO.setEventName(dictData.getName());
|
||||
notEventVO.setEventMeasurementAverage(0);
|
||||
notEventVO.setEventMeasurementAccrued(0);
|
||||
notEventVO.setEventFreq(0.0F);
|
||||
notEventVO.setEventCount(0);
|
||||
notEventVO.setEventMeasurementRatioAverage(0.0F);
|
||||
notEventVO.setEventMeasurementRatioAccrued(0.0F);
|
||||
eventVO.add(notEventVO);
|
||||
}
|
||||
arrayVO.setColumns(eventVO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,342 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.pojo.param.REventMParam;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgQ;
|
||||
import com.njcn.event.mapper.majornetwork.RStatEventOrgQMapper;
|
||||
import com.njcn.event.pojo.vo.RArrayVO;
|
||||
import com.njcn.event.pojo.vo.RStatEventMVO;
|
||||
import com.njcn.event.service.majornetwork.RStatEventOrgQService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-17
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RStatEventOrgQServiceImpl extends ServiceImpl<RStatEventOrgQMapper, RStatEventOrgQ> implements RStatEventOrgQService {
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final RStatEventOrgQMapper statEventOrgQMapper;
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getRStatEventOrgQAll(StatisticsBizBaseParam param) {
|
||||
//子节点 获取所有得各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
|
||||
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> lineTypeMap = lineTypeData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
//获取主网id信息
|
||||
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||
|
||||
//数据库查询
|
||||
List<RStatEventOrgQ> list = statEventOrgQMapper.selectList(new LambdaQueryWrapper<RStatEventOrgQ>()
|
||||
.eq(RStatEventOrgQ::getDataType, mainnetData.getId())
|
||||
.in(RStatEventOrgQ::getOrgNo, deptIds)
|
||||
.ge(param.getStartTime() != null, RStatEventOrgQ::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventOrgQ::getDataDate, param.getEndTime()));
|
||||
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventMVO> rm = new ArrayList<>();
|
||||
for (DeptDTO deptDTO : deptDTOList) {
|
||||
RStatEventMVO r = new RStatEventMVO();
|
||||
r.setEventName(deptDTO.getName());
|
||||
r.setEventMeasurementAverage(0);
|
||||
r.setEventMeasurementAccrued(0);
|
||||
r.setEventFreq(0.0F);
|
||||
r.setEventCount(0);
|
||||
r.setEventMeasurementRatioAverage(0.0F);
|
||||
r.setEventMeasurementRatioAccrued(0.0F);
|
||||
rm.add(r);
|
||||
}
|
||||
for (DictData lineTypeDatum : lineTypeData) {
|
||||
RArrayVO r = new RArrayVO();
|
||||
r.setRowName(lineTypeDatum.getName());
|
||||
r.setColumns(rm);
|
||||
r.setSort(lineTypeDatum.getSort());
|
||||
arrayVOList.add(r);
|
||||
}
|
||||
//根据检测点对象分组
|
||||
Map<String, List<RStatEventOrgQ>> MeasurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventOrgQ::getEventType));
|
||||
//重新生成数据结构
|
||||
MeasurementTypeClassMap.forEach((key, value) -> {
|
||||
if (lineTypeMap.containsKey(key)) {
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
DictData data = lineTypeMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
List<RStatEventMVO> b = new ArrayList<>();
|
||||
b.addAll(rm);
|
||||
for (RStatEventOrgQ orgQ : value) {
|
||||
if(deptMap.containsKey(orgQ.getOrgNo())){
|
||||
RStatEventMVO r = BeanUtil.copyProperties(orgQ, RStatEventMVO.class);
|
||||
DeptDTO data1 = deptMap.get(orgQ.getOrgNo());
|
||||
r.setEventName(data1.getName());
|
||||
b.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
Map<String, RStatEventMVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RStatEventMVO harmonicMVO : b) {
|
||||
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
|
||||
}
|
||||
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName()));
|
||||
arrayVO.setColumns(aa);
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
|
||||
});
|
||||
Map<String, RArrayVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RArrayVO rArrayVO : arrayVOList) {
|
||||
linkedHashMap.put(rArrayVO.getRowName(), rArrayVO);
|
||||
}
|
||||
List<RArrayVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return aa;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RStatEventMVO> getRStatHarmonicOrgQIcon(REventMParam param) {
|
||||
//各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
//指标对象类型属性
|
||||
DictData eventData;
|
||||
//判断是是否传入检测点信息值(电压)
|
||||
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
|
||||
//指标对象类型
|
||||
List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
|
||||
eventData = indicatorTypeDate.get(0);
|
||||
} else {
|
||||
//获取指标对象(频率偏差)
|
||||
eventData = dicDataFeignClient.getDicDataById(
|
||||
param.getStasisID()).getData();
|
||||
}
|
||||
//反防止参数查询数据报错
|
||||
Assert.isTrue(
|
||||
CollUtil.isNotEmpty(deptDTOList) || ObjectUtil.isNotNull(eventData)
|
||||
, "各单位或者指标类型为空,请检查入参是否准确");
|
||||
//获取主网id信息
|
||||
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||
|
||||
//初始化对象
|
||||
List<RStatEventMVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventOrgQ> rStatHarmonicVoltageMS = statEventOrgQMapper.selectList(new LambdaQueryWrapper<RStatEventOrgQ>()
|
||||
.eq(RStatEventOrgQ::getDataType, mainnetData.getId())
|
||||
.in(RStatEventOrgQ::getOrgNo, deptIds)
|
||||
.eq(RStatEventOrgQ::getEventType, eventData.getId())
|
||||
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventOrgQ::getDataDate, param.getStartTime())
|
||||
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventOrgQ::getDataDate, param.getEndTime())
|
||||
);
|
||||
//将数据转换为map进行便利
|
||||
Map<String, List<RStatEventOrgQ>> voltageMMap = rStatHarmonicVoltageMS.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventOrgQ::getOrgNo));
|
||||
//对象
|
||||
if (CollUtil.isNotEmpty(rStatHarmonicVoltageMS)) {
|
||||
voltageMMap.forEach((key, value) -> {
|
||||
if (deptMap.containsKey(key)) {
|
||||
DeptDTO data = deptMap.get(key);
|
||||
for (RStatEventOrgQ orgQ : value) {
|
||||
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgQ, RStatEventMVO.class);
|
||||
rStatEventMVO.setEventName(data.getName());
|
||||
arrayVOList.add(rStatEventMVO);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getPwRStatEventOrgQAll(StatisticsBizBaseParam param) {
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> eventData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> eventMap = eventData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
//子节点 获取所有得各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
|
||||
|
||||
//获取配网信息
|
||||
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
|
||||
|
||||
//数据库查询
|
||||
List<RStatEventOrgQ> list = statEventOrgQMapper.selectList(new LambdaQueryWrapper<RStatEventOrgQ>()
|
||||
.eq(RStatEventOrgQ::getDataType, distributionData.getId())
|
||||
.in(RStatEventOrgQ::getOrgNo, deptIds)
|
||||
.ge(param.getStartTime() != null, RStatEventOrgQ::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventOrgQ::getDataDate, param.getEndTime()));
|
||||
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
//根据检测点对象分组
|
||||
Map<String, List<RStatEventOrgQ>> measurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventOrgQ::getEventType));
|
||||
//判断对象是否为空
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
//重新生成数据结构
|
||||
measurementTypeClassMap.forEach((key, value) -> {
|
||||
if (eventMap.containsKey(key)) {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
DictData data = eventMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
for (RStatEventOrgQ org : value) {
|
||||
if(deptMap.containsKey(org.getOrgNo())){
|
||||
RStatEventMVO r = BeanUtil.copyProperties(org, RStatEventMVO.class);
|
||||
DeptDTO deptDTO = deptMap.get(org.getOrgNo());
|
||||
r.setEventName(deptDTO.getName());
|
||||
eventVO.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
//根据监测点类别获取差集
|
||||
Map<String, List<RStatEventOrgQ>> listMap = value.stream().collect(Collectors.groupingBy(RStatEventOrgQ::getEventType));
|
||||
List<DeptDTO> notDeptList = deptDTOList.stream().filter(r -> !listMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
this.assignDept(notDeptList, eventVO, arrayVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//处理主节点不存在的集合
|
||||
List<DictData> notMeasurementList = eventData.stream().filter(r -> !measurementTypeClassMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
for (DictData notData : notMeasurementList) {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
arrayVO.setRowName(notData.getName());
|
||||
arrayVO.setSort(notData.getSort());
|
||||
this.assignDept(deptDTOList, eventVO, arrayVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RStatEventMVO> getPwRStatHarmonicOrgQIcon(REventMParam param) {
|
||||
//各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
//指标对象类型属性
|
||||
DictData eventData;
|
||||
//判断是是否传入检测点信息值(电压)
|
||||
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
|
||||
//指标对象类型
|
||||
List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
|
||||
eventData = indicatorTypeDate.get(0);
|
||||
} else {
|
||||
//获取指标对象(频率偏差)
|
||||
eventData = dicDataFeignClient.getDicDataById(
|
||||
param.getStasisID()).getData();
|
||||
}
|
||||
//反防止参数查询数据报错
|
||||
Assert.isTrue(
|
||||
CollUtil.isNotEmpty(deptDTOList) || ObjectUtil.isNotNull(eventData)
|
||||
, "各单位或者指标类型为空,请检查入参是否准确");
|
||||
//获取配网信息
|
||||
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
|
||||
|
||||
//初始化对象
|
||||
List<RStatEventMVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventOrgQ> rStatHarmonicVoltageMS = statEventOrgQMapper.selectList(new LambdaQueryWrapper<RStatEventOrgQ>()
|
||||
.eq(RStatEventOrgQ::getDataType, distributionData.getId())
|
||||
.in(RStatEventOrgQ::getOrgNo, deptIds)
|
||||
.eq(RStatEventOrgQ::getEventType, eventData.getId())
|
||||
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventOrgQ::getDataDate, param.getStartTime())
|
||||
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventOrgQ::getDataDate, param.getEndTime())
|
||||
);
|
||||
//将数据转换为map进行便利
|
||||
Map<String, List<RStatEventOrgQ>> voltageMMap = rStatHarmonicVoltageMS.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventOrgQ::getOrgNo));
|
||||
//对象
|
||||
if (CollUtil.isNotEmpty(rStatHarmonicVoltageMS)) {
|
||||
voltageMMap.forEach((key, value) -> {
|
||||
if (deptMap.containsKey(key)) {
|
||||
DeptDTO data = deptMap.get(key);
|
||||
for (RStatEventOrgQ orgQ : value) {
|
||||
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgQ, RStatEventMVO.class);
|
||||
rStatEventMVO.setEventName(data.getName());
|
||||
arrayVOList.add(rStatEventMVO);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 便利赋值
|
||||
*
|
||||
* @param deptDTOList 部门集合
|
||||
* @param eventVO 暂态监测点
|
||||
* @param arrayVO 初始化对象
|
||||
*/
|
||||
private void assignDept(List<DeptDTO> deptDTOList, List<RStatEventMVO> eventVO, RArrayVO arrayVO) {
|
||||
for (DeptDTO dictData : deptDTOList) {
|
||||
RStatEventMVO notEventVO = new RStatEventMVO();
|
||||
notEventVO.setEventName(dictData.getName());
|
||||
notEventVO.setEventMeasurementAverage(0);
|
||||
notEventVO.setEventMeasurementAccrued(0);
|
||||
notEventVO.setEventFreq(0.0F);
|
||||
notEventVO.setEventCount(0);
|
||||
notEventVO.setEventMeasurementRatioAverage(0.0F);
|
||||
notEventVO.setEventMeasurementRatioAccrued(0.0F);
|
||||
eventVO.add(notEventVO);
|
||||
}
|
||||
arrayVO.setColumns(eventVO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.pojo.param.REventMParam;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgY;
|
||||
import com.njcn.event.mapper.majornetwork.RStatEventOrgYMapper;
|
||||
import com.njcn.event.pojo.vo.RArrayVO;
|
||||
import com.njcn.event.pojo.vo.RStatEventMVO;
|
||||
import com.njcn.event.service.majornetwork.RStatEventOrgYService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-17
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RStatEventOrgYServiceImpl extends ServiceImpl<RStatEventOrgYMapper, RStatEventOrgY> implements RStatEventOrgYService {
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final RStatEventOrgYMapper statEventOrgYMapper;
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getRStatEventOrgYAll(StatisticsBizBaseParam param) {
|
||||
//子节点 获取所有得各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
|
||||
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> lineTypeMap = lineTypeData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
//获取主网id信息
|
||||
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||
|
||||
//数据库查询
|
||||
List<RStatEventOrgY> list = statEventOrgYMapper.selectList(new LambdaQueryWrapper<RStatEventOrgY>()
|
||||
.eq(RStatEventOrgY::getDataType, mainnetData.getId())
|
||||
.in(RStatEventOrgY::getOrgNo, deptIds)
|
||||
.ge(param.getStartTime() != null, RStatEventOrgY::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventOrgY::getDataDate, param.getEndTime()));
|
||||
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventMVO> rm = new ArrayList<>();
|
||||
for (DeptDTO deptDTO : deptDTOList) {
|
||||
RStatEventMVO r = new RStatEventMVO();
|
||||
r.setEventName(deptDTO.getName());
|
||||
r.setEventMeasurementAverage(0);
|
||||
r.setEventMeasurementAccrued(0);
|
||||
r.setEventFreq(0.0F);
|
||||
r.setEventCount(0);
|
||||
r.setEventMeasurementRatioAverage(0.0F);
|
||||
r.setEventMeasurementRatioAccrued(0.0F);
|
||||
rm.add(r);
|
||||
}
|
||||
for (DictData lineTypeDatum : lineTypeData) {
|
||||
RArrayVO r = new RArrayVO();
|
||||
r.setRowName(lineTypeDatum.getName());
|
||||
r.setColumns(rm);
|
||||
r.setSort(lineTypeDatum.getSort());
|
||||
arrayVOList.add(r);
|
||||
}
|
||||
//根据检测点对象分组
|
||||
Map<String, List<RStatEventOrgY>> measurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventOrgY::getEventType));
|
||||
//重新生成数据结构
|
||||
measurementTypeClassMap.forEach((key, value) -> {
|
||||
if (lineTypeMap.containsKey(key)) {
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
DictData data = lineTypeMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
List<RStatEventMVO> b = new ArrayList<>();
|
||||
b.addAll(rm);
|
||||
for (RStatEventOrgY orgY : value) {
|
||||
if (deptMap.containsKey(orgY.getOrgNo())) {
|
||||
RStatEventMVO r = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
|
||||
DeptDTO data1 = deptMap.get(orgY.getOrgNo());
|
||||
r.setEventName(data1.getName());
|
||||
b.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
Map<String, RStatEventMVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RStatEventMVO harmonicMVO : b) {
|
||||
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
|
||||
}
|
||||
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName()));
|
||||
arrayVO.setColumns(aa);
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
|
||||
});
|
||||
Map<String, RArrayVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RArrayVO rArrayVO : arrayVOList) {
|
||||
linkedHashMap.put(rArrayVO.getRowName(), rArrayVO);
|
||||
}
|
||||
List<RArrayVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return aa;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RStatEventMVO> getRStatHarmonicOrgYIcon(REventMParam param) {
|
||||
//各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
//指标对象类型属性
|
||||
DictData eventData;
|
||||
//判断是是否传入检测点信息值(电压)
|
||||
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
|
||||
//指标对象类型
|
||||
List<DictData> indicatorTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
indicatorTypeData.sort(Comparator.comparing(data -> data.getSort()));
|
||||
eventData = indicatorTypeData.get(0);
|
||||
} else {
|
||||
//获取指标对象(频率偏差)
|
||||
eventData = dicDataFeignClient.getDicDataById(
|
||||
param.getStasisID()).getData();
|
||||
}
|
||||
//反防止参数查询数据报错
|
||||
Assert.isTrue(
|
||||
CollUtil.isNotEmpty(deptDTOList) || ObjectUtil.isNotNull(eventData)
|
||||
, "各单位或者指标类型为空,请检查入参是否准确");
|
||||
//获取主网id信息
|
||||
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||
|
||||
//初始化对象
|
||||
List<RStatEventMVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventOrgY> rStatHarmonicVoltageMS = statEventOrgYMapper.selectList(new LambdaQueryWrapper<RStatEventOrgY>()
|
||||
.eq(RStatEventOrgY::getDataType, mainnetData.getId())
|
||||
.in(RStatEventOrgY::getOrgNo, deptIds)
|
||||
.eq(RStatEventOrgY::getEventType, eventData.getId())
|
||||
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventOrgY::getDataDate, param.getStartTime())
|
||||
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventOrgY::getDataDate, param.getEndTime())
|
||||
);
|
||||
//将数据转换为map进行便利
|
||||
Map<String, List<RStatEventOrgY>> voltageMMap = rStatHarmonicVoltageMS.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventOrgY::getOrgNo));
|
||||
//对象
|
||||
if (CollUtil.isNotEmpty(rStatHarmonicVoltageMS)) {
|
||||
voltageMMap.forEach((key, value) -> {
|
||||
if (deptMap.containsKey(key)) {
|
||||
DeptDTO data = deptMap.get(key);
|
||||
for (RStatEventOrgY orgY : value) {
|
||||
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
|
||||
rStatEventMVO.setEventName(data.getName());
|
||||
arrayVOList.add(rStatEventMVO);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getPwRStatEventOrgYAll(StatisticsBizBaseParam param) {
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> eventData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> eventMap = eventData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
//子节点 获取所有得各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
|
||||
|
||||
//获取配网信息
|
||||
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
|
||||
|
||||
//数据库查询
|
||||
List<RStatEventOrgY> list = statEventOrgYMapper.selectList(new LambdaQueryWrapper<RStatEventOrgY>()
|
||||
.eq(RStatEventOrgY::getDataType, distributionData.getId())
|
||||
.in(RStatEventOrgY::getOrgNo, deptIds)
|
||||
.ge(param.getStartTime() != null, RStatEventOrgY::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventOrgY::getDataDate, param.getEndTime()));
|
||||
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
//根据检测点对象分组
|
||||
Map<String, List<RStatEventOrgY>> measurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventOrgY::getEventType));
|
||||
//判断对象是否为空
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
//重新生成数据结构
|
||||
measurementTypeClassMap.forEach((key, value) -> {
|
||||
if (eventMap.containsKey(key)) {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
DictData data = eventMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
for (RStatEventOrgY orgY : value) {
|
||||
if (deptMap.containsKey(orgY.getOrgNo())) {
|
||||
RStatEventMVO r = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
|
||||
DeptDTO deptDTO = deptMap.get(orgY.getOrgNo());
|
||||
r.setEventName(deptDTO.getName());
|
||||
eventVO.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
//根据监测点类别获取差集
|
||||
Map<String, List<RStatEventOrgY>> listMap = value.stream().collect(Collectors.groupingBy(RStatEventOrgY::getEventType));
|
||||
List<DeptDTO> notDeptList = deptDTOList.stream().filter(r -> !listMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
this.assignDept(notDeptList, eventVO, arrayVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getEventName()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//处理主节点不存在的集合
|
||||
List<DictData> notMeasurementList = eventData.stream().filter(r -> !measurementTypeClassMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
for (DictData notData : notMeasurementList) {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
arrayVO.setRowName(notData.getName());
|
||||
arrayVO.setSort(notData.getSort());
|
||||
this.assignDept(deptDTOList, eventVO, arrayVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RStatEventMVO> getPwRStatHarmonicOrgYIcon(REventMParam param) {
|
||||
//各单位类型
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
Map<String, DeptDTO> deptMap = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getId, Function.identity()));
|
||||
//获取部门id集合
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).collect(Collectors.toList());
|
||||
//指标对象类型属性
|
||||
DictData eventData;
|
||||
//判断是是否传入检测点信息值(电压)
|
||||
if (StrUtil.isBlank(param.getStasisID()) && StrUtil.isBlank(param.getMonitorID())) {
|
||||
//指标对象类型
|
||||
List<DictData> indicatorTypeDate = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
indicatorTypeDate.sort(Comparator.comparing(data -> data.getSort()));
|
||||
eventData = indicatorTypeDate.get(0);
|
||||
} else {
|
||||
//获取指标对象(频率偏差)
|
||||
eventData = dicDataFeignClient.getDicDataById(
|
||||
param.getStasisID()).getData();
|
||||
}
|
||||
//反防止参数查询数据报错
|
||||
Assert.isTrue(
|
||||
CollUtil.isNotEmpty(deptDTOList) || ObjectUtil.isNotNull(eventData)
|
||||
, "各单位或者指标类型为空,请检查入参是否准确");
|
||||
//获取配网信息
|
||||
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
|
||||
|
||||
//初始化对象
|
||||
List<RStatEventMVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventOrgY> rStatHarmonicVoltageMS = statEventOrgYMapper.selectList(new LambdaQueryWrapper<RStatEventOrgY>()
|
||||
.eq(RStatEventOrgY::getDataType, distributionData.getId())
|
||||
.in(RStatEventOrgY::getOrgNo, deptIds)
|
||||
.eq(RStatEventOrgY::getEventType, eventData.getId())
|
||||
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventOrgY::getDataDate, param.getStartTime())
|
||||
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventOrgY::getDataDate, param.getEndTime())
|
||||
);
|
||||
//将数据转换为map进行便利
|
||||
Map<String, List<RStatEventOrgY>> voltageMMap = rStatHarmonicVoltageMS.stream()
|
||||
.collect(Collectors.groupingBy(RStatEventOrgY::getOrgNo));
|
||||
//对象
|
||||
if (CollUtil.isNotEmpty(rStatHarmonicVoltageMS)) {
|
||||
voltageMMap.forEach((key, value) -> {
|
||||
if (deptMap.containsKey(key)) {
|
||||
DeptDTO data = deptMap.get(key);
|
||||
for (RStatEventOrgY orgY : value) {
|
||||
RStatEventMVO rStatEventMVO = BeanUtil.copyProperties(orgY, RStatEventMVO.class);
|
||||
rStatEventMVO.setEventName(data.getName());
|
||||
arrayVOList.add(rStatEventMVO);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rIconVO -> rIconVO.getEventName()));
|
||||
return arrayVOList;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 便利赋值
|
||||
*
|
||||
* @param deptDTOList 部门集合
|
||||
* @param eventVO 暂态监测点
|
||||
* @param arrayVO 初始化对象
|
||||
*/
|
||||
private void assignDept(List<DeptDTO> deptDTOList, List<RStatEventMVO> eventVO, RArrayVO arrayVO) {
|
||||
for (DeptDTO dictData : deptDTOList) {
|
||||
RStatEventMVO notEventVO = new RStatEventMVO();
|
||||
notEventVO.setEventName(dictData.getName());
|
||||
notEventVO.setEventMeasurementAverage(0);
|
||||
notEventVO.setEventMeasurementAccrued(0);
|
||||
notEventVO.setEventFreq(0.0F);
|
||||
notEventVO.setEventCount(0);
|
||||
notEventVO.setEventMeasurementRatioAverage(0.0F);
|
||||
notEventVO.setEventMeasurementRatioAccrued(0.0F);
|
||||
eventVO.add(notEventVO);
|
||||
}
|
||||
arrayVO.setColumns(eventVO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.mapper.majornetwork.RStatEventQMapper;
|
||||
import com.njcn.event.pojo.po.RStatEventQ;
|
||||
import com.njcn.event.pojo.vo.RArrayVO;
|
||||
import com.njcn.event.pojo.vo.RStatEventMVO;
|
||||
import com.njcn.event.service.majornetwork.RStatEventQService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-12
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RStatEventQServiceImpl extends ServiceImpl<RStatEventQMapper, RStatEventQ> implements RStatEventQService {
|
||||
|
||||
private final RStatEventQMapper rStatEventQMapper;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getRStatEventQAll(StatisticsBizBaseParam param) {
|
||||
//子节点 获取所有得干扰源类型(监测点类型)
|
||||
List<DictData> interferenceSourceTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.MONITORING_LABELS.getCode()).getData();
|
||||
Map<String, DictData> interferenceMap = interferenceSourceTypeData
|
||||
.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> lineTypeMap = lineTypeData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
//获取主网id信息
|
||||
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||
|
||||
//数据库查询
|
||||
List<RStatEventQ> list = rStatEventQMapper.selectList(new LambdaQueryWrapper<RStatEventQ>()
|
||||
.eq(RStatEventQ::getDataType, mainnetData.getId())
|
||||
.ge(param.getStartTime() != null, RStatEventQ::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventQ::getDataDate, param.getEndTime()));
|
||||
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventMVO> rm = new ArrayList<>();
|
||||
for (DictData lineTypeDatum : interferenceSourceTypeData) {
|
||||
RStatEventMVO r = new RStatEventMVO();
|
||||
r.setEventName(lineTypeDatum.getName());
|
||||
r.setSort(lineTypeDatum.getSort());
|
||||
r.setEventMeasurementAverage(0);
|
||||
r.setEventMeasurementAccrued(0);
|
||||
r.setEventFreq(0.0F);
|
||||
r.setEventCount(0);
|
||||
r.setEventMeasurementRatioAverage(0.0F);
|
||||
r.setEventMeasurementRatioAccrued(0.0F);
|
||||
rm.add(r);
|
||||
}
|
||||
for (DictData lineTypeDatum : lineTypeData) {
|
||||
RArrayVO r = new RArrayVO();
|
||||
r.setRowName(lineTypeDatum.getName());
|
||||
r.setColumns(rm);
|
||||
r.setSort(lineTypeDatum.getSort());
|
||||
arrayVOList.add(r);
|
||||
}
|
||||
//根据暂态指标分组
|
||||
Map<String, List<RStatEventQ>> MeasurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventQ::getEventType));
|
||||
//重新生成数据结构
|
||||
MeasurementTypeClassMap.forEach((key, value) -> {
|
||||
if (lineTypeMap.containsKey(key)) {
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
DictData data = lineTypeMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
List<RStatEventMVO> b = new ArrayList<>();
|
||||
b.addAll(rm);
|
||||
for (RStatEventQ rStatEventQ : value) {
|
||||
if(interferenceMap.containsKey(rStatEventQ.getMeasurementTypeClass())){
|
||||
RStatEventMVO r = BeanUtil.copyProperties(rStatEventQ, RStatEventMVO.class);
|
||||
DictData data1 = interferenceMap.get(rStatEventQ.getMeasurementTypeClass());
|
||||
r.setEventName(data1.getName());
|
||||
r.setSort(data1.getSort());
|
||||
b.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
Map<String, RStatEventMVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RStatEventMVO harmonicMVO : b) {
|
||||
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
|
||||
}
|
||||
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVO.setColumns(aa);
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
|
||||
});
|
||||
Map<String, RArrayVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RArrayVO rArrayVO : arrayVOList) {
|
||||
linkedHashMap.put(rArrayVO.getRowName(), rArrayVO);
|
||||
}
|
||||
List<RArrayVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return aa;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getPwRStatEventQAll(StatisticsBizBaseParam param) {
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> eventData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> eventMap = eventData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
//子节点 获取监测点类别
|
||||
List<DictData> lineData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineMap = lineData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
//获取配网id信息
|
||||
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
//数据库查询
|
||||
List<RStatEventQ> list = rStatEventQMapper.selectList(new LambdaQueryWrapper<RStatEventQ>()
|
||||
.eq(RStatEventQ::getDataType, distributionData.getId())
|
||||
.ge(param.getStartTime() != null, RStatEventQ::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventQ::getDataDate, param.getEndTime()));
|
||||
//根据暂态指标分组
|
||||
Map<String, List<RStatEventQ>> measurementMap = list.stream().collect(Collectors.groupingBy(RStatEventQ::getEventType));
|
||||
//判断对象是否为空
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
//重新生成数据结构
|
||||
measurementMap.forEach((key, value) -> {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
if (eventMap.containsKey(key)) {
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
DictData data = eventMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
for (RStatEventQ rStatEvent : value) {
|
||||
if(lineMap.containsKey(rStatEvent.getMeasurementTypeClass())){
|
||||
RStatEventMVO r = BeanUtil.copyProperties(rStatEvent, RStatEventMVO.class);
|
||||
DictData data1 = lineMap.get(rStatEvent.getMeasurementTypeClass());
|
||||
r.setEventName(data1.getName());
|
||||
r.setSort(data1.getSort());
|
||||
eventVO.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
//根据监测点类别获取差集
|
||||
Map<String, List<RStatEventQ>> listMap = value.stream().collect(Collectors.groupingBy(RStatEventQ::getMeasurementTypeClass));
|
||||
List<DictData> differenceList = lineData.stream().filter(r -> !listMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
this.assignDict(differenceList, eventVO, arrayVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//处理主节点不存在的集合
|
||||
List<DictData> notMeasurementList = eventData.stream().filter(r -> !measurementMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
for (DictData notData : notMeasurementList) {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
arrayVO.setRowName(notData.getName());
|
||||
arrayVO.setSort(notData.getSort());
|
||||
this.assignDict(lineData, eventVO, arrayVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 便利赋值
|
||||
*
|
||||
* @param DictDataList 暂态类型集合
|
||||
* @param eventVO 暂态监测点
|
||||
* @param arrayVO 初始化对象
|
||||
*/
|
||||
private void assignDict(List<DictData> DictDataList, List<RStatEventMVO> eventVO, RArrayVO arrayVO) {
|
||||
for (DictData dictData : DictDataList) {
|
||||
RStatEventMVO notEventVO = new RStatEventMVO();
|
||||
notEventVO.setEventName(dictData.getName());
|
||||
notEventVO.setSort(dictData.getSort());
|
||||
notEventVO.setEventMeasurementAverage(0);
|
||||
notEventVO.setEventMeasurementAccrued(0);
|
||||
notEventVO.setEventFreq(0.0F);
|
||||
notEventVO.setEventCount(0);
|
||||
notEventVO.setEventMeasurementRatioAverage(0.0F);
|
||||
notEventVO.setEventMeasurementRatioAccrued(0.0F);
|
||||
eventVO.add(notEventVO);
|
||||
}
|
||||
arrayVO.setColumns(eventVO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.mapper.majornetwork.RStatEventYMapper;
|
||||
import com.njcn.event.pojo.po.RStatEventY;
|
||||
import com.njcn.event.pojo.vo.RArrayVO;
|
||||
import com.njcn.event.pojo.vo.RStatEventMVO;
|
||||
import com.njcn.event.service.majornetwork.RStatEventYService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-12
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RStatEventYServiceImpl extends ServiceImpl<RStatEventYMapper, RStatEventY> implements RStatEventYService {
|
||||
|
||||
private final RStatEventYMapper rStatEventYMapper;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getRStatEventYAll(StatisticsBizBaseParam param) {
|
||||
//子节点 获取所有得干扰源类型(监测点类型)
|
||||
List<DictData> interferenceSourceTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.MONITORING_LABELS.getCode()).getData();
|
||||
Map<String, DictData> interferenceMap = interferenceSourceTypeData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> lineTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> lineTypeMap = lineTypeData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
//获取主网id信息
|
||||
DictData mainnetData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||
|
||||
//数据库查询
|
||||
List<RStatEventY> list = rStatEventYMapper.selectList(new LambdaQueryWrapper<RStatEventY>()
|
||||
.eq(RStatEventY::getDataType, mainnetData.getId())
|
||||
.ge(param.getStartTime() != null, RStatEventY::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventY::getDataDate, param.getEndTime()));
|
||||
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
List<RStatEventMVO> rm = new ArrayList<>();
|
||||
for (DictData lineTypeDatum : interferenceSourceTypeData) {
|
||||
RStatEventMVO r = new RStatEventMVO();
|
||||
r.setEventName(lineTypeDatum.getName());
|
||||
r.setSort(lineTypeDatum.getSort());
|
||||
r.setEventMeasurementAverage(0);
|
||||
r.setEventMeasurementAccrued(0);
|
||||
r.setEventFreq(0.0F);
|
||||
r.setEventCount(0);
|
||||
r.setEventMeasurementRatioAverage(0.0F);
|
||||
r.setEventMeasurementRatioAccrued(0.0F);
|
||||
rm.add(r);
|
||||
}
|
||||
for (DictData lineTypeDatum : lineTypeData) {
|
||||
RArrayVO r = new RArrayVO();
|
||||
r.setRowName(lineTypeDatum.getName());
|
||||
r.setColumns(rm);
|
||||
r.setSort(lineTypeDatum.getSort());
|
||||
arrayVOList.add(r);
|
||||
}
|
||||
//根据暂态指标分组
|
||||
Map<String, List<RStatEventY>> MeasurementTypeClassMap = list.stream().collect(Collectors.groupingBy(RStatEventY::getEventType));
|
||||
//重新生成数据结构
|
||||
MeasurementTypeClassMap.forEach((key, value) -> {
|
||||
if (lineTypeMap.containsKey(key)) {
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
DictData data = lineTypeMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
List<RStatEventMVO> b = new ArrayList<>();
|
||||
b.addAll(rm);
|
||||
for (RStatEventY rStatEventY : value) {
|
||||
if(interferenceMap.containsKey(rStatEventY.getMeasurementTypeClass())){
|
||||
RStatEventMVO r = BeanUtil.copyProperties(rStatEventY, RStatEventMVO.class);
|
||||
DictData data1 = interferenceMap.get(rStatEventY.getMeasurementTypeClass());
|
||||
r.setEventName(data1.getName());
|
||||
r.setSort(data1.getSort());
|
||||
b.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
Map<String, RStatEventMVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RStatEventMVO harmonicMVO : b) {
|
||||
linkedHashMap.put(harmonicMVO.getEventName(), harmonicMVO);
|
||||
}
|
||||
List<RStatEventMVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
aa.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVO.setColumns(aa);
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
|
||||
});
|
||||
Map<String, RArrayVO> linkedHashMap = new LinkedHashMap<>();
|
||||
for (RArrayVO rArrayVO : arrayVOList) {
|
||||
linkedHashMap.put(rArrayVO.getRowName(), rArrayVO);
|
||||
}
|
||||
List<RArrayVO> aa = new ArrayList<>(linkedHashMap.values());
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return aa;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RArrayVO> getPwRStatEventYAll(StatisticsBizBaseParam param) {
|
||||
//对象主节点 获取所有得暂降类型
|
||||
List<DictData> eventData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
Map<String, DictData> eventMap = eventData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
//子节点 获取监测点类别
|
||||
List<DictData> lineData = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
Map<String, DictData> lineMap = lineData.stream()
|
||||
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
|
||||
//获取配网id信息
|
||||
DictData distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
|
||||
//初始化指标类型(横向)
|
||||
List<RArrayVO> arrayVOList = new ArrayList<>();
|
||||
//数据库查询
|
||||
List<RStatEventY> list = rStatEventYMapper.selectList(new LambdaQueryWrapper<RStatEventY>()
|
||||
.eq(RStatEventY::getDataType, distributionData.getId())
|
||||
.ge(param.getStartTime() != null, RStatEventY::getDataDate, param.getStartTime())
|
||||
.le(param.getEndTime() != null, RStatEventY::getDataDate, param.getEndTime()));
|
||||
//根据暂态指标分组
|
||||
Map<String, List<RStatEventY>> measurementMap = list.stream().collect(Collectors.groupingBy(RStatEventY::getEventType));
|
||||
|
||||
//判断对象是否为空
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
//重新生成数据结构
|
||||
measurementMap.forEach((key, value) -> {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
if (eventMap.containsKey(key)) {
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
DictData data = eventMap.get(key);
|
||||
arrayVO.setRowName(data.getName());
|
||||
arrayVO.setSort(data.getSort());
|
||||
for (RStatEventY rStatEventY : value) {
|
||||
if(lineMap.containsKey(rStatEventY.getMeasurementTypeClass())){
|
||||
RStatEventMVO r = BeanUtil.copyProperties(rStatEventY, RStatEventMVO.class);
|
||||
DictData data1 = lineMap.get(rStatEventY.getMeasurementTypeClass());
|
||||
r.setEventName(data1.getName());
|
||||
r.setSort(data1.getSort());
|
||||
eventVO.add(r);
|
||||
}
|
||||
|
||||
}
|
||||
//根据监测点类别获取差集
|
||||
Map<String, List<RStatEventY>> listMap = value.stream().collect(Collectors.groupingBy(RStatEventY::getMeasurementTypeClass));
|
||||
List<DictData> differenceList = lineData.stream().filter(r -> !listMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
this.assignDict(differenceList, eventVO, arrayVO);
|
||||
arrayVO.setColumns(eventVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//处理主节点不存在的集合
|
||||
List<DictData> notMeasurementList = eventData.stream().filter(r -> !measurementMap.containsKey(r.getId()))
|
||||
.collect(Collectors.toList());
|
||||
for (DictData notData : notMeasurementList) {
|
||||
List<RStatEventMVO> eventVO = new ArrayList<>();
|
||||
RArrayVO arrayVO = new RArrayVO();
|
||||
arrayVO.setRowName(notData.getName());
|
||||
arrayVO.setSort(notData.getSort());
|
||||
this.assignDict(lineData, eventVO, arrayVO);
|
||||
eventVO.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||
arrayVOList.add(arrayVO);
|
||||
}
|
||||
arrayVOList.sort(Comparator.comparing(rArrayVO -> rArrayVO.getSort()));
|
||||
return arrayVOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 便利赋值
|
||||
*
|
||||
* @param DictDataList 暂态类型集合
|
||||
* @param eventVO 暂态监测点
|
||||
* @param arrayVO 初始化对象
|
||||
*/
|
||||
private void assignDict(List<DictData> DictDataList, List<RStatEventMVO> eventVO, RArrayVO arrayVO) {
|
||||
for (DictData dictData : DictDataList) {
|
||||
RStatEventMVO notEventVO = new RStatEventMVO();
|
||||
notEventVO.setEventName(dictData.getName());
|
||||
notEventVO.setSort(dictData.getSort());
|
||||
notEventVO.setEventMeasurementAverage(0);
|
||||
notEventVO.setEventMeasurementAccrued(0);
|
||||
notEventVO.setEventFreq(0.0F);
|
||||
notEventVO.setEventCount(0);
|
||||
notEventVO.setEventMeasurementRatioAverage(0.0F);
|
||||
notEventVO.setEventMeasurementRatioAccrued(0.0F);
|
||||
eventVO.add(notEventVO);
|
||||
}
|
||||
arrayVO.setColumns(eventVO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
||||
import com.njcn.device.pms.api.StatationStatClient;
|
||||
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
|
||||
import com.njcn.device.pms.pojo.dto.PmsStatationStatInfoDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
|
||||
import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam;
|
||||
import com.njcn.event.mapper.majornetwork.RStatSubstationMMapper;
|
||||
import com.njcn.event.mapper.majornetwork.RStatSubstationQMapper;
|
||||
import com.njcn.event.mapper.majornetwork.RStatSubstationYMapper;
|
||||
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
|
||||
import com.njcn.event.pojo.po.RStatSubstationM;
|
||||
import com.njcn.event.pojo.vo.RSubstationIcon2VO;
|
||||
import com.njcn.event.pojo.vo.RSubstationIconVO;
|
||||
import com.njcn.event.service.majornetwork.RStatSubstationMService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-18
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RStatSubstationMServiceImpl extends ServiceImpl<RStatSubstationMMapper, RStatSubstationM> implements RStatSubstationMService {
|
||||
|
||||
private final RStatSubstationMMapper rStatSubstationMMapper;
|
||||
private final RStatSubstationQMapper rStatSubstationQMapper;
|
||||
private final RStatSubstationYMapper rStatSubstationYMapper;
|
||||
private final StatationStatClient statationStatClient;
|
||||
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
|
||||
|
||||
@Override
|
||||
public RSubstationIconVO getStatSubstationIcon(StatisticsBizBaseParam param) {
|
||||
//获取部门下面监测点信息
|
||||
RSubstationIconVO rSubstationIconVO = new RSubstationIconVO();
|
||||
StatSubstationBizBaseParam baseParam = BeanUtil.copyProperties(param, StatSubstationBizBaseParam.class);
|
||||
//变电站id
|
||||
// baseParam.setIds(this.powerrIdList(param.getId()));
|
||||
String string = param.getType().toString();
|
||||
switch (string) {
|
||||
//查询变变电站暂态分布(按发生频次)-年数据
|
||||
case BizParamConstant.STAT_BIZ_YEAR:
|
||||
rSubstationIconVO = rStatSubstationYMapper.getStatSubstationIconY(baseParam);
|
||||
break;
|
||||
//查询变电站暂态分布(按发生频次)-季数据
|
||||
case BizParamConstant.STAT_BIZ_QUARTER:
|
||||
rSubstationIconVO = rStatSubstationQMapper.getStatSubstationIconQ(baseParam);
|
||||
break;
|
||||
//查询变电站暂态分布(按发生频次)-月数据
|
||||
case BizParamConstant.STAT_BIZ_MONTH:
|
||||
rSubstationIconVO = rStatSubstationMMapper.getStatSubstationIconM(baseParam);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return rSubstationIconVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RSubstationIcon2VO> getStatSubstationIcon2(StatisticsBizBaseParam param) {
|
||||
List<RSubstationIcon2VO> rSubstationIconVO = new ArrayList<>();
|
||||
StatSubstationBizBaseParam baseParam = BeanUtil.copyProperties(param, StatSubstationBizBaseParam.class);
|
||||
//获取变电站id
|
||||
// baseParam.setIds(this.powerrIdList(param.getId()));
|
||||
String string = param.getType().toString();
|
||||
switch (string) {
|
||||
//查询变电站暂态指标发生频次-年数据
|
||||
case BizParamConstant.STAT_BIZ_YEAR:
|
||||
rSubstationIconVO = rStatSubstationYMapper.getStatSubstationIcon2Y(baseParam);
|
||||
break;
|
||||
//查询变电站暂态指标发生频次-季数据
|
||||
case BizParamConstant.STAT_BIZ_QUARTER:
|
||||
rSubstationIconVO = rStatSubstationQMapper.getStatSubstationIcon2Q(baseParam);
|
||||
break;
|
||||
//查询变电站暂态指标发生频次-月数据
|
||||
case BizParamConstant.STAT_BIZ_MONTH:
|
||||
rSubstationIconVO = rStatSubstationMMapper.getStatSubstationIcon2M(baseParam);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//获取变电站名称属性替换
|
||||
if (CollUtil.isNotEmpty(rSubstationIconVO)) {
|
||||
List<String> ids = rSubstationIconVO.stream().map(RSubstationIcon2VO::getSubstationId).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
PmsStatationStatInfoParam pmsParam = new PmsStatationStatInfoParam();
|
||||
pmsParam.setPowerIds(ids);
|
||||
List<PmsStatationStatInfoDTO> data1 = statationStatClient.getStatationStatInfo(pmsParam).getData();
|
||||
if (CollUtil.isNotEmpty(data1)) {
|
||||
for (PmsStatationStatInfoDTO dto : data1) {
|
||||
for (RSubstationIcon2VO vo : rSubstationIconVO) {
|
||||
if (dto.getPowerId().equals(vo.getSubstationId())) {
|
||||
vo.setSubstationName(dto.getPowerName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rSubstationIconVO;
|
||||
}
|
||||
|
||||
//根据部门获取监测点id信息
|
||||
private List<String> powerrIdList(String id) {
|
||||
//获取部门下面监测点信息
|
||||
PmsDeviceInfoParam pms = new PmsDeviceInfoParam();
|
||||
pms.setDeptIndex(id);
|
||||
pms.setStatisticalType(new SimpleDTO());
|
||||
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pms).getData();
|
||||
List<String> addids = new ArrayList<>();
|
||||
data.stream().forEach(e -> addids.addAll(e.getPowerrIdList()));
|
||||
return addids;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.mapper.majornetwork.RStatSubstationVoltageMMapper;
|
||||
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
|
||||
import com.njcn.event.pojo.po.RStatSubstationVoltageM;
|
||||
import com.njcn.event.pojo.vo.RVoltageIconVO;
|
||||
import com.njcn.event.service.majornetwork.RStatSubstationVoltageMService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-18
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RStatSubstationVoltageMServiceImpl extends ServiceImpl<RStatSubstationVoltageMMapper, RStatSubstationVoltageM> implements RStatSubstationVoltageMService {
|
||||
|
||||
private final RStatSubstationVoltageMMapper rStatSubstationVoltageMMapper;
|
||||
|
||||
@Override
|
||||
public List<RVoltageIconVO> getStatSubstationIcon(StatisticsBizBaseParam param) {
|
||||
StatSubstationBizBaseParam baseParam = BeanUtil.copyProperties(param, StatSubstationBizBaseParam.class);
|
||||
return rStatSubstationVoltageMMapper.getStatSubstationIcon(baseParam);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service.Impl;//package com.njcn.event.service.Impl;
|
||||
package com.njcn.event.service.majornetwork.Impl;//package com.njcn.event.service.Impl;
|
||||
//
|
||||
//import java.io.ByteArrayInputStream;
|
||||
//import java.io.File;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
@@ -35,8 +35,8 @@ import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.po.Eventass;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.service.EventAnalysisService;
|
||||
import com.njcn.event.service.ReportService;
|
||||
import com.njcn.event.service.majornetwork.EventAnalysisService;
|
||||
import com.njcn.event.service.majornetwork.ReportService;
|
||||
import com.njcn.event.utils.EchartsUtil;
|
||||
import com.njcn.event.utils.FreemarkerUtil;
|
||||
import com.njcn.event.utils.WordUtils;
|
||||
@@ -67,8 +67,6 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import sun.misc.BASE64Decoder;
|
||||
|
||||
@@ -82,14 +80,12 @@ import java.net.URLEncoder;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
||||
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
|
||||
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
|
||||
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.RmpEventDetailVO;
|
||||
import com.njcn.event.service.majornetwork.RmpEventDetailService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 暂态事件明细
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/12
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper, RmpEventDetailVO> implements RmpEventDetailService {
|
||||
|
||||
private final RmpEventDetailMapper rmpEventDetailMapper;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
|
||||
|
||||
private final MonitorClient monitorClient;
|
||||
|
||||
/**
|
||||
* 获取暂态事件明细
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 暂态事件明细
|
||||
*/
|
||||
@Override
|
||||
public List<RmpEventDetailVO> getRmpEventDetail(UniversalFrontEndParam param) {
|
||||
// 获取当前用户的部门的子部门信息
|
||||
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
|
||||
pmsDeviceInfoParam.setDeptIndex(param.getId());
|
||||
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
|
||||
|
||||
if (CollectionUtil.isEmpty(data)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 创建返回集合
|
||||
List<RmpEventDetailVO> info = new ArrayList<>();
|
||||
|
||||
// 查询事件类型字典表
|
||||
List<DictData> eventStatisData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
|
||||
// 查询监测点类别
|
||||
String monitorSort = dicDataFeignClient.getDicDataById(param.getMonitorSort().get(0)).getData().getName();
|
||||
|
||||
for (PmsGeneralDeviceDTO pmsGeneralDeviceDTO : data) {
|
||||
if (CollectionUtil.isEmpty(pmsGeneralDeviceDTO.getMonitorIdList())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 查询监测点信息
|
||||
PmsMonitorInfoParam pmsMonitorInfoParam = new PmsMonitorInfoParam();
|
||||
pmsMonitorInfoParam.setMonitorIds(pmsGeneralDeviceDTO.getMonitorIdList());
|
||||
List<PmsMonitorInfoDTO> monitorInfo = monitorClient.getMonitorInfo(pmsMonitorInfoParam).getData();
|
||||
|
||||
if (CollectionUtil.isEmpty(monitorInfo)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 获取监测点id集合
|
||||
List<String> monitorIds = monitorInfo.stream().map(PmsMonitorInfoDTO::getMonitorId).collect(Collectors.toList());
|
||||
|
||||
// 获取暂态事件明细
|
||||
List<RmpEventDetailPO> detailsOfTransientEvents = rmpEventDetailMapper.getDetailsOfTransientEvents(monitorIds, param.getEventType(), param.getStartTime(), param.getEndTime());
|
||||
|
||||
if (CollectionUtil.isEmpty(detailsOfTransientEvents)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 属性赋值
|
||||
for (RmpEventDetailPO po : detailsOfTransientEvents) {
|
||||
RmpEventDetailVO vo = new RmpEventDetailVO();
|
||||
vo.setDeptId(pmsGeneralDeviceDTO.getIndex());
|
||||
vo.setDeptName(pmsGeneralDeviceDTO.getName());
|
||||
vo.setEventId(po.getEventId());
|
||||
vo.setMeasurementPointId(po.getMeasurementPointId());
|
||||
vo.setEventType(po.getEventType());
|
||||
vo.setPhase(po.getPhase());
|
||||
vo.setStartTime(po.getStartTime());
|
||||
vo.setDuration(po.getDuration());
|
||||
vo.setFeatureAmplitude(po.getFeatureAmplitude());
|
||||
vo.setWavePath(po.getWavePath());
|
||||
vo.setMonitorSort(monitorSort);
|
||||
info.add(vo);
|
||||
}
|
||||
// 监测点名称赋值
|
||||
for (PmsMonitorInfoDTO pmsMonitorInfoDTO : monitorInfo) {
|
||||
for (RmpEventDetailVO rmpEventDetailVO : info) {
|
||||
if (pmsMonitorInfoDTO.getMonitorId().equals(rmpEventDetailVO.getMeasurementPointId())){
|
||||
rmpEventDetailVO.setMeasurementPointName(pmsMonitorInfoDTO.getMonitorName());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 暂态指标赋值
|
||||
for (DictData datum : eventStatisData) {
|
||||
for (RmpEventDetailVO rmpEventDetailVO : info) {
|
||||
if (datum.getId().equals(rmpEventDetailVO.getEventType())){
|
||||
rmpEventDetailVO.setEventType(datum.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return info;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取暂态指标类型列表
|
||||
*
|
||||
* @return 暂态指标类型列表
|
||||
*/
|
||||
@Override
|
||||
public List<DictData> getEventStatisList() {
|
||||
return dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,373 @@
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
||||
import com.njcn.device.pms.api.StatationStatClient;
|
||||
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
|
||||
import com.njcn.device.pms.pojo.dto.PmsStatationStatInfoDTO;
|
||||
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
|
||||
import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam;
|
||||
import com.njcn.event.mapper.majornetwork.RStatEventOrgMapper;
|
||||
import com.njcn.event.mapper.majornetwork.RStatOrgMapper;
|
||||
import com.njcn.event.mapper.majornetwork.RStatSubstationMapper;
|
||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgPO;
|
||||
import com.njcn.event.pojo.vo.RStatEventOrgVO;
|
||||
import com.njcn.event.pojo.vo.RStatOrgVO;
|
||||
import com.njcn.event.pojo.vo.RStatSubstationVO;
|
||||
import com.njcn.event.service.majornetwork.StatisticsOfTransientIndicatorssService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 暂态指标统计
|
||||
*
|
||||
* @author yzh
|
||||
* @date 2022/10/10
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class StatisticsOfTransientIndicatorssServiceImpl implements StatisticsOfTransientIndicatorssService {
|
||||
|
||||
private final RStatOrgMapper rStatOrgMapper;
|
||||
|
||||
private final RStatEventOrgMapper rStatEventOrgMapper;
|
||||
|
||||
private final RStatSubstationMapper rStatSubstationMapper;
|
||||
|
||||
private final DecimalFormat df = new DecimalFormat("###.00");
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
|
||||
|
||||
private final MonitorClient monitorClient;
|
||||
|
||||
private final StatationStatClient statationStatClient;
|
||||
|
||||
/**
|
||||
* 获取区域暂态指标统计
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 区域暂态指标统计
|
||||
*/
|
||||
@Override
|
||||
public List<RStatOrgVO> getRStatOrg(UniversalFrontEndParam param) {
|
||||
|
||||
// 获取当前用户的部门的子部门信息
|
||||
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
|
||||
pmsDeviceInfoParam.setDeptIndex(param.getId());
|
||||
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
|
||||
|
||||
if (CollectionUtil.isEmpty(data)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 获取主网的id
|
||||
String mainnetPointId = getMainnetPointId();
|
||||
|
||||
// 创建返回集合
|
||||
List<RStatOrgVO> info = new ArrayList<>();
|
||||
|
||||
// 过滤出部门id
|
||||
List<String> deptIds = data.stream().map(PmsGeneralDeviceDTO::getIndex).collect(Collectors.toList());
|
||||
|
||||
// 类型(1年 2季度 3月份 4日
|
||||
switch (param.getType()) {
|
||||
case 1:
|
||||
// 获取年区域暂态指标统计
|
||||
info = rStatOrgMapper.getYearRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId);
|
||||
break;
|
||||
case 2:
|
||||
// 获取季区域暂态指标统计
|
||||
info = rStatOrgMapper.getQuarterRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId);
|
||||
break;
|
||||
case 3:
|
||||
// 获取月区域暂态指标统计
|
||||
info = rStatOrgMapper.getMonthRStatOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (CollUtil.isEmpty(info)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
for (RStatOrgVO rStatOrgVO : info) {
|
||||
rStatOrgVO.setEventMeasurementRatioAverage(Double.parseDouble(
|
||||
df.format((rStatOrgVO.getEventMeasurementAverage() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAverage() * 1.0))) * 100);
|
||||
rStatOrgVO.setEventMeasurementRatioAccrued(Double.parseDouble(
|
||||
df.format((rStatOrgVO.getEventMeasurementAccrued() * 1.0) / (rStatOrgVO.getEffectiveMeasurementAccrued() * 1.0))) * 100);
|
||||
}
|
||||
|
||||
// 匹配单位名称
|
||||
for (PmsGeneralDeviceDTO dto : data) {
|
||||
for (RStatOrgVO vo : info) {
|
||||
if (dto.getIndex().equals(vo.getOrgNo())) {
|
||||
vo.setOrgName(dto.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取区域暂态指标分类统计表
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 区域暂态指标分类统计表
|
||||
*/
|
||||
@Override
|
||||
public List<RStatEventOrgVO> getRStatEventOrg(UniversalFrontEndParam param) {
|
||||
|
||||
// 获取当前用户的部门的子部门信息
|
||||
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
|
||||
pmsDeviceInfoParam.setDeptIndex(param.getId());
|
||||
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||
List<SimpleDTO> voltageLevel = param.getVoltageLevel().stream().map(s -> {
|
||||
SimpleDTO simpleDTO = new SimpleDTO();
|
||||
simpleDTO.setId(s);
|
||||
return simpleDTO;
|
||||
}).collect(Collectors.toList());
|
||||
pmsDeviceInfoParam.setVoltageLevel(voltageLevel);
|
||||
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
|
||||
|
||||
if (CollectionUtil.isEmpty(data)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 获取主网的id
|
||||
String mainnetPointId = getMainnetPointId();
|
||||
|
||||
//创建返回集合
|
||||
List<RStatEventOrgVO> info = new ArrayList<>();
|
||||
// 根据暂态指标枚举查询暂态指标
|
||||
List<DictData> eventStatis = dicDataFeignClient.getDicDataByTypeCode(
|
||||
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
|
||||
List<RStatEventOrgPO> temp = new ArrayList<>();
|
||||
|
||||
// 过滤出部门id
|
||||
List<String> deptIds = data.stream().map(PmsGeneralDeviceDTO::getIndex).collect(Collectors.toList());
|
||||
|
||||
// 类型(1年 2季度 3月份 4日
|
||||
switch (param.getType()) {
|
||||
case 1:
|
||||
// 获取年区域暂态指标分类统计表
|
||||
temp = rStatEventOrgMapper.getYearRStatEventOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId);
|
||||
break;
|
||||
case 2:
|
||||
// 获取季区域暂态指标分类统计表
|
||||
temp = rStatEventOrgMapper.getQuarterRStatEventOrgInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId);
|
||||
break;
|
||||
case 3:
|
||||
// 获取月区域暂态指标分类统计表
|
||||
temp = rStatEventOrgMapper.getMonthRStatEventOrgInfoInfo(deptIds, param.getStartTime(), param.getEndTime(), mainnetPointId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (CollUtil.isEmpty(temp)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 通过单位id将集合转换为map集合
|
||||
Map<String, List<RStatEventOrgPO>> map = temp
|
||||
.stream().collect(Collectors.groupingBy(RStatEventOrgPO::getOrgNo));
|
||||
|
||||
map.forEach((orgOn, rStatEventOrgVOs) -> {
|
||||
RStatEventOrgVO rStatEventOrgVO = new RStatEventOrgVO();
|
||||
// 基础属性赋值
|
||||
for (RStatEventOrgPO tmp : rStatEventOrgVOs) {
|
||||
if (rStatEventOrgVO.getOrgNo() == null) {
|
||||
rStatEventOrgVO.setOrgNo(tmp.getOrgNo());
|
||||
rStatEventOrgVO.setDataDate(tmp.getDataDate());
|
||||
rStatEventOrgVO.setEffectiveMeasurementAverage(tmp.getEffectiveMeasurementAverage());
|
||||
rStatEventOrgVO.setEffectiveMeasurementAccrued(tmp.getEffectiveMeasurementAccrued());
|
||||
rStatEventOrgVO.setEventMeasurementAverage(tmp.getEventMeasurementAverage());
|
||||
rStatEventOrgVO.setEventMeasurementAccrued(tmp.getEventMeasurementAccrued());
|
||||
rStatEventOrgVO.setEventMeasurementRatioAverage(Double.parseDouble(df.format((tmp.getEventMeasurementAverage() * 1.0) / (tmp.getEffectiveMeasurementAverage() * 1.0))) * 100);
|
||||
rStatEventOrgVO.setEventMeasurementRatioAccrued(Double.parseDouble(df.format((tmp.getEventMeasurementAccrued() * 1.0) / (tmp.getEffectiveMeasurementAccrued() * 1.0))) * 100);
|
||||
rStatEventOrgVO.setDataType(tmp.getDataType());
|
||||
}
|
||||
|
||||
}
|
||||
for (RStatEventOrgPO tmp : rStatEventOrgVOs) {
|
||||
// 暂态指标赋值
|
||||
for (DictData eventStati : eventStatis) {
|
||||
if (eventStati.getId().equals(tmp.getEventType())) {
|
||||
if (eventStati.getCode().equals(RStatEventOrgVO.SHORT_INTERRUPTIONS)) {
|
||||
// 日均短时中断
|
||||
rStatEventOrgVO.setDayShortInterruptions(tmp.getEEventMeasurementAverage());
|
||||
// 累计短时中断
|
||||
rStatEventOrgVO.setCumulativeShortInterruptions(tmp.getEventMeasurementAccrued());
|
||||
// 日均短时中断占比
|
||||
rStatEventOrgVO.setDayShortInterruptionsProportion(tmp.getEEventMeasurementRatioAverage());
|
||||
// 累计短时中断占比
|
||||
rStatEventOrgVO.setCumulativeShortInterruptionsProportion(tmp.getEEventMeasurementRatioAccrued());
|
||||
|
||||
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_RISE)) {
|
||||
// 日均电压暂升
|
||||
rStatEventOrgVO.setDayVoltageRise(tmp.getEEventMeasurementAverage());
|
||||
// 累计电压暂升
|
||||
rStatEventOrgVO.setCumulativeVoltageRise(tmp.getEventMeasurementAccrued());
|
||||
// 日均电压暂升占比
|
||||
rStatEventOrgVO.setDayVoltageRiseProportion(tmp.getEEventMeasurementRatioAverage());
|
||||
// 累计电压暂升占比
|
||||
rStatEventOrgVO.setCumulativeVoltageRiseProportion(tmp.getEEventMeasurementRatioAccrued());
|
||||
|
||||
} else if (eventStati.getCode().equals(RStatEventOrgVO.VOLTAGE_DIP)) {
|
||||
// 日均电压暂降
|
||||
rStatEventOrgVO.setDayVoltageDip(tmp.getEEventMeasurementAverage());
|
||||
// 累计电压暂降
|
||||
rStatEventOrgVO.setCumulativeVoltageDip(tmp.getEventMeasurementAccrued());
|
||||
// 日均电压暂降占比
|
||||
rStatEventOrgVO.setDayVoltageDipProportion(tmp.getEEventMeasurementRatioAverage());
|
||||
// 累计电压暂降占比
|
||||
rStatEventOrgVO.setCumulativeVoltageDipProportion(tmp.getEEventMeasurementRatioAccrued());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
info.add(rStatEventOrgVO);
|
||||
});
|
||||
|
||||
// 匹配单位名称
|
||||
for (PmsGeneralDeviceDTO dto : data) {
|
||||
for (RStatEventOrgVO vo : info) {
|
||||
if (dto.getIndex().equals(vo.getOrgNo())) {
|
||||
vo.setOrgName(dto.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取变电站暂态指标分类统计表
|
||||
*
|
||||
* @param param 前端传入参数
|
||||
* @return 变电站暂态指标分类统计表
|
||||
*/
|
||||
@Override
|
||||
public List<RStatSubstationVO> getRStatSubstation
|
||||
(UniversalFrontEndParam param) {
|
||||
|
||||
// 获取当前用户的部门的子部门信息
|
||||
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
|
||||
pmsDeviceInfoParam.setDeptIndex(param.getId());
|
||||
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
|
||||
|
||||
//创建返回集合
|
||||
List<RStatSubstationVO> info = new ArrayList<>();
|
||||
|
||||
if (CollectionUtil.isEmpty(data)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
//创建返回集合
|
||||
List<RStatSubstationVO> temp = new ArrayList<>();
|
||||
|
||||
for (PmsGeneralDeviceDTO dto : data) {
|
||||
// 创建对象封装数据
|
||||
PmsStatationStatInfoParam pmsStatationStatInfoParam = new PmsStatationStatInfoParam();
|
||||
|
||||
if (CollectionUtil.isEmpty(dto.getPowerrIdList())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 取出变电站id
|
||||
List<String> powerrIdList = dto.getPowerrIdList();
|
||||
|
||||
// 通过变电站id获取变电站详细信息
|
||||
pmsStatationStatInfoParam.setPowerIds(powerrIdList);
|
||||
pmsStatationStatInfoParam.setPowerName(param.getSubName());
|
||||
List<PmsStatationStatInfoDTO> subInfo = statationStatClient.getStatationStatInfo(pmsStatationStatInfoParam).getData();
|
||||
|
||||
if (CollUtil.isEmpty(subInfo)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 取出变电站id
|
||||
List<String> powerIds = subInfo.stream().map(PmsStatationStatInfoDTO::getPowerId).collect(Collectors.toList());
|
||||
|
||||
// 类型(1年 2季度 3月份 4日
|
||||
switch (param.getType()) {
|
||||
case 1:
|
||||
// 获取年变电站暂态指标分类统计表
|
||||
temp = rStatSubstationMapper.getYearInfo(powerIds, param.getStartTime(), param.getEndTime());
|
||||
break;
|
||||
case 2:
|
||||
// 获取季变电站暂态指标分类统计表
|
||||
temp = rStatSubstationMapper.getQuarterInfo(powerIds, param.getStartTime(), param.getEndTime());
|
||||
break;
|
||||
case 3:
|
||||
// 获取月变电站暂态指标分类统计表
|
||||
temp = rStatSubstationMapper.getMonthInfo(powerIds, param.getStartTime(), param.getEndTime());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (CollUtil.isEmpty(temp)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 匹配单位名称
|
||||
for (RStatSubstationVO vo : temp) {
|
||||
for (PmsStatationStatInfoDTO statInfoDTO : subInfo) {
|
||||
if (vo.getSubstationId().equals(statInfoDTO.getPowerId())) {
|
||||
vo.setDeptId(dto.getIndex());
|
||||
vo.setDeptName(dto.getName());
|
||||
vo.setSubstationName(statInfoDTO.getPowerName());
|
||||
}
|
||||
}
|
||||
info.add(vo);
|
||||
}
|
||||
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主网的id
|
||||
*
|
||||
* @return java.lang.String
|
||||
* @author yzh
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
private String getMainnetPointId() {
|
||||
return dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData().getId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
package com.njcn.event.service.majornetwork.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
||||
@@ -17,15 +16,14 @@ import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.event.enums.EventResponseEnum;
|
||||
import com.njcn.event.mapper.TransientMapper;
|
||||
import com.njcn.event.mapper.majornetwork.TransientMapper;
|
||||
import com.njcn.event.pojo.param.TransientParam;
|
||||
import com.njcn.event.pojo.param.WaveFileParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.vo.AreaLineVO;
|
||||
import com.njcn.event.pojo.vo.TransientVO;
|
||||
import com.njcn.event.service.EventDetailService;
|
||||
import com.njcn.event.service.TransientService;
|
||||
import com.njcn.event.service.majornetwork.EventDetailService;
|
||||
import com.njcn.event.service.majornetwork.TransientService;
|
||||
import com.njcn.influxdb.mapper.InfluxDBResultMapperCn;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDBCommUtils;
|
||||
@@ -33,10 +31,8 @@ import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@@ -99,13 +95,13 @@ public class TransientServiceImpl implements TransientService {
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(lineList)) {
|
||||
//influxDB查询待分页数据总量
|
||||
List<EventDetail> data = eventDetailService.getEventDetail(lineList, transientParam.getSearchBeginTime(), transientParam.getSearchEndTime());
|
||||
List<EventDetail> data = eventDetailService.getEventDetail(lineList, transientParam.getSearchBeginTime(), transientParam.getSearchEndTime(),transientParam.getWaveType());
|
||||
page.setTotal(data.size());
|
||||
//分页总页数
|
||||
int pages = (int) Math.ceil(data.size() * 1.0 / transientParam.getPageSize());
|
||||
page.setPages(pages);
|
||||
//influxDB分页查询
|
||||
List<EventDetail> eventDetailData = eventDetailService.getEventDetailLimit(lineList, transientParam.getSearchBeginTime(), transientParam.getSearchEndTime(), transientParam.getPageSize(), transientParam.getPageNum());
|
||||
List<EventDetail> eventDetailData = eventDetailService.getEventDetailLimit(lineList, transientParam.getSearchBeginTime(), transientParam.getSearchEndTime(), transientParam.getPageSize(), transientParam.getPageNum(),transientParam.getWaveType());
|
||||
// List<List<EventDetail>> partition = Lists.partition(eventDetailData, transientParam.getPageSize());
|
||||
// List<EventDetail> detailList = partition.get(transientParam.getPageNum() - 1);
|
||||
if (!CollectionUtils.isEmpty(eventDetailData)) {
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.event.pojo.po.RStatEventD;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-12
|
||||
*/
|
||||
public interface RStatEventDService extends IService<RStatEventD> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.pojo.param.REventMParam;
|
||||
import com.njcn.event.pojo.po.RStatEventM;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-11
|
||||
*/
|
||||
public interface RStatEventMService extends IService<RStatEventM> {
|
||||
|
||||
/**
|
||||
* 主网查询暂态监测点暂态指标(月)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RArrayVO> getRStatEventMAll(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 配网网查询暂态监测点暂态指标(月)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RArrayVO> getPwRStatEventMAll(StatisticsBizBaseParam param);
|
||||
|
||||
|
||||
/**
|
||||
* 主网暂态电铁-频率偏差-电压统计图
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<RStatEventMVO> getRStatHarmonicIcon(REventMParam param);
|
||||
|
||||
/**
|
||||
* 主网暂态电铁-频率偏差-越线日期统计图
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<REventPolylineVO> getRStatHarmonicIcon2(REventMParam param);
|
||||
|
||||
/**
|
||||
* 配网监测点-频率偏差-越线日期统计图
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<REventPolylineVO> getPwRStatHarmonicIcon2(REventMParam param);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.pojo.param.REventMParam;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgM;
|
||||
import com.njcn.event.pojo.vo.RArrayVO;
|
||||
import com.njcn.event.pojo.vo.RStatEventMVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-11
|
||||
*/
|
||||
public interface RStatEventOrgMService extends IService<RStatEventOrgM> {
|
||||
|
||||
/**
|
||||
* 主网查询各单位暂态指标 日/月点数(月)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RArrayVO> getRStatEventOrgMAll(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 主网查询暂态各单位累计超标监测点数统计图-月数据
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RStatEventMVO> getRStatHarmonicOrgMIcon(REventMParam param);
|
||||
|
||||
/**
|
||||
* 配网查询各单位暂态指标 日/月点数(月)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RArrayVO> getPwRStatEventOrgMAll(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 配网查询暂态各单位累计超标监测点数统计图-月数据
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RStatEventMVO> getPwRStatHarmonicOrgMIcon(REventMParam param);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.pojo.param.REventMParam;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgQ;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.event.pojo.vo.RArrayVO;
|
||||
import com.njcn.event.pojo.vo.RStatEventMVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-17
|
||||
*/
|
||||
public interface RStatEventOrgQService extends IService<RStatEventOrgQ> {
|
||||
|
||||
/**
|
||||
* 主网查询查询各单位暂态指标 日/月点数(季)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RArrayVO> getRStatEventOrgQAll(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 主网查询暂态各单位累计超标监测点数统计图-季数据
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RStatEventMVO> getRStatHarmonicOrgQIcon(REventMParam param);
|
||||
|
||||
/**
|
||||
* 配网网查询查询各单位暂态指标 日/月点数(季)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RArrayVO> getPwRStatEventOrgQAll(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 配网查询暂态各单位累计超标监测点数统计图-季数据
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RStatEventMVO> getPwRStatHarmonicOrgQIcon(REventMParam param);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.pojo.param.REventMParam;
|
||||
import com.njcn.event.pojo.po.RStatEventOrgY;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.event.pojo.vo.RArrayVO;
|
||||
import com.njcn.event.pojo.vo.RStatEventMVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-17
|
||||
*/
|
||||
public interface RStatEventOrgYService extends IService<RStatEventOrgY> {
|
||||
|
||||
/**
|
||||
* 主网查询查询各单位暂态指标 日/月点数(年)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RArrayVO> getRStatEventOrgYAll(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 主网查询暂态各单位累计超标监测点数统计图-年数据
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RStatEventMVO> getRStatHarmonicOrgYIcon(REventMParam param);
|
||||
|
||||
/**
|
||||
* 配网查询查询各单位暂态指标 日/月点数(年)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RArrayVO> getPwRStatEventOrgYAll(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 配网查询暂态各单位累计超标监测点数统计图-年数据
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RStatEventMVO> getPwRStatHarmonicOrgYIcon(REventMParam param);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.pojo.po.RStatEventQ;
|
||||
import com.njcn.event.pojo.vo.RArrayVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-12
|
||||
*/
|
||||
public interface RStatEventQService extends IService<RStatEventQ> {
|
||||
|
||||
/**
|
||||
* 主网查询监测点暂态指标(季)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RArrayVO> getRStatEventQAll(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 配网查询监测点暂态指标(季)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RArrayVO> getPwRStatEventQAll(StatisticsBizBaseParam param);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.pojo.po.RStatEventY;
|
||||
import com.njcn.event.pojo.vo.RArrayVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-12
|
||||
*/
|
||||
public interface RStatEventYService extends IService<RStatEventY> {
|
||||
|
||||
/**
|
||||
* 主网查询查询监测点暂态指标(年)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RArrayVO> getRStatEventYAll(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 配网查询监测点暂态指标(年)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RArrayVO> getPwRStatEventYAll(StatisticsBizBaseParam param);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.pojo.po.RStatSubstationM;
|
||||
import com.njcn.event.pojo.vo.RSubstationIcon2VO;
|
||||
import com.njcn.event.pojo.vo.RSubstationIconVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-18
|
||||
*/
|
||||
public interface RStatSubstationMService extends IService<RStatSubstationM> {
|
||||
|
||||
/**
|
||||
* 变电站暂态分布(按发生频次)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
RSubstationIconVO getStatSubstationIcon(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 变电站暂态指标发生频次
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RSubstationIcon2VO> getStatSubstationIcon2(StatisticsBizBaseParam param);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.event.pojo.po.RStatSubstationVoltageM;
|
||||
import com.njcn.event.pojo.vo.RVoltageIconVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author rui.wu
|
||||
* @since 2022-10-18
|
||||
*/
|
||||
public interface RStatSubstationVoltageMService extends IService<RStatSubstationVoltageM> {
|
||||
|
||||
/**
|
||||
* 变电站暂态分布(按电压等级)
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RVoltageIconVO> getStatSubstationIcon(StatisticsBizBaseParam param);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service;
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.njcn.event.service;
|
||||
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.vo.RmpEventDetailVO;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,8 +18,18 @@ public interface RmpEventDetailService extends IService<RmpEventDetailVO> {
|
||||
|
||||
/**
|
||||
* 获取暂态事件明细
|
||||
* @param param 前端参数
|
||||
*
|
||||
* @param param 条件参数
|
||||
* @return 暂态事件明细
|
||||
*/
|
||||
List<RmpEventDetailVO> getRmpEventDetail(UniversalFrontEndParam param);
|
||||
|
||||
/**
|
||||
* 获取暂态指标类型列表
|
||||
*
|
||||
* @return 暂态指标类型列表
|
||||
*/
|
||||
List<DictData> getEventStatisList();
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service;
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.vo.RStatEventOrgVO;
|
||||
@@ -19,14 +19,14 @@ public interface StatisticsOfTransientIndicatorssService{
|
||||
/**
|
||||
* 获取区域暂态指标统计
|
||||
*
|
||||
* @param param 前端参数
|
||||
* @param param 条件参数
|
||||
* @return 获取区域暂态指标统计
|
||||
*/
|
||||
List<RStatOrgVO> getRStatOrg(UniversalFrontEndParam param);
|
||||
|
||||
/**
|
||||
* 获取区域暂态指标分类统计表
|
||||
* @param param 前端参数
|
||||
* @param param 条件参数
|
||||
* @return 区域暂态指标分类统计表
|
||||
*/
|
||||
List<RStatEventOrgVO> getRStatEventOrg(UniversalFrontEndParam param);
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.event.service;
|
||||
package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
||||
Reference in New Issue
Block a user