1.台账审核和变电站查询。2.配网,稳态指标和暂态指标相关代码

This commit is contained in:
wurui
2023-02-22 15:10:58 +08:00
parent c7c992df3b
commit 6ddcc366e8
20 changed files with 331 additions and 83 deletions

View File

@@ -6,8 +6,10 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.vo.EventDistributionStatisticsTableVO;
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
import com.njcn.event.pojo.vo.RStatSubstationVO;
import com.njcn.event.pojo.vo.SimpleVO;
import com.njcn.event.service.distribution.PwEventCategoryDetailsService;
import com.njcn.web.controller.BaseController;
@@ -99,4 +101,20 @@ public class PwEventCategoryDetailsController extends BaseController {
EventFeatureAmplitudeCurveVO vo = pwEventCategoryDetailsService.getPwEventFeatureAmplitudeCurve(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
}
/**
* 获取变电站暂态指标分类统计表
*
* @param param 前端传入参数
* @return 变电站暂态指标分类统计表
*/
@PostMapping("/getPwRStatSubstation")
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("获取变电站暂态指标分类统计表")
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
public HttpResult<List<RStatSubstationVO>> getRStatSubstation(@RequestBody UniversalFrontEndParam param) {
String methodDescribe = getMethodDescribe("getRStatSubstation");
List<RStatSubstationVO> list = pwEventCategoryDetailsService.getRStatSubstation(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
}

View File

@@ -3,21 +3,33 @@ 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.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.PwMonitorClient;
import com.njcn.device.pms.api.StatationStatClient;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.device.pms.pojo.po.StatationStat;
import com.njcn.event.mapper.distribution.PwEventCategoryDetailsMapper;
import com.njcn.event.mapper.majornetwork.RStatSubstationMapper;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
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.RStatSubstationVO;
import com.njcn.event.pojo.vo.SimpleVO;
import com.njcn.event.service.distribution.PwEventCategoryDetailsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
@@ -27,6 +39,8 @@ import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@@ -41,8 +55,10 @@ import java.util.stream.Collectors;
public class PwEventCategoryDetailsServiceImpl implements PwEventCategoryDetailsService {
private final PwMonitorClient pwMonitorClient;
private final PwEventCategoryDetailsMapper pwEventCategoryDetailsMapper;
private final RStatSubstationMapper rStatSubstationMapper;
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
private final StatationStatClient statationStatClient;
/**
* 获取配网暂态事件分布统计
@@ -338,6 +354,67 @@ public class PwEventCategoryDetailsServiceImpl implements PwEventCategoryDetails
return EventFeatureAmplitudeCurveVO.buildVO(rmpEventDetailList.size(), curveDataList);
}
@Override
public List<RStatSubstationVO> getRStatSubstation(UniversalFrontEndParam param) {
//远程调用监测点信息接口
PmsDeviceInfoParam pms = new PmsDeviceInfoParam();
pms.setDeptIndex(param.getId());
pms.setStatisticalType(new SimpleDTO());
//获取配网台账信息(根据台账信息获取,变电站的集合包括所有的子集变电站)
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPwPmsDeviceInfoWithOrgId(pms).getData();
List<String> ids = new ArrayList<>();
data.stream().forEach(e -> ids.addAll(e.getPowerrIdList()));
// 查询变电站信息
PmsStatationStatInfoParam pmsStatationStatInfoParam = new PmsStatationStatInfoParam();
pmsStatationStatInfoParam.setPowerIds(ids);
if (!StringUtils.isEmpty(param.getSubName())) {
pmsStatationStatInfoParam.setPowerName(param.getSubName());
}
List<StatationStat> powerInfo = statationStatClient.getPowerInfo(pmsStatationStatInfoParam).getData();
if (CollUtil.isEmpty(powerInfo)) {
return Collections.emptyList();
}
// 取出变电站id
List<String> powerIds = powerInfo.stream().map(StatationStat::getPowerId).collect(Collectors.toList());
//创建返回集合
List<RStatSubstationVO> result = new ArrayList<>();
// 类型1年 2季度 3月份 4日
switch (param.getType().toString()) {
case BizParamConstant.STAT_BIZ_YEAR:
// 获取年变电站暂态指标分类统计表
result = rStatSubstationMapper.getYearInfo(powerIds, param.getStartTime(), param.getEndTime());
break;
case BizParamConstant.STAT_BIZ_QUARTER:
// 获取季变电站暂态指标分类统计表
result = rStatSubstationMapper.getQuarterInfo(powerIds, param.getStartTime(), param.getEndTime());
break;
case BizParamConstant.STAT_BIZ_MONTH:
// 获取月变电站暂态指标分类统计表
result = rStatSubstationMapper.getMonthInfo(powerIds, param.getStartTime(), param.getEndTime());
break;
default:
break;
}
if (CollUtil.isEmpty(result)) {
return Collections.emptyList();
}
// 将变电站信息根据变电站id转换成map集合(当出现重复数据,用第二条)
Map<String, StatationStat> powerMap = powerInfo.stream().collect(
Collectors.toMap(StatationStat::getPowerId, Function.identity(), (key1, key2) -> key2));
// 属性赋值(获取部门名称,变电站名称)
return result.stream().peek(vo -> {
String substationId = vo.getSubstationId();
vo.setDeptId(powerMap.get(substationId).getOrgId());
vo.setSubstationName(powerMap.get(substationId).getPowerName());
vo.setDeptName(powerMap.get(substationId).getOrgName());
}).collect(Collectors.toList());
}
/**
* 获取单位id
*

View File

@@ -1,8 +1,10 @@
package com.njcn.event.service.distribution;
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.vo.EventDistributionStatisticsTableVO;
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
import com.njcn.event.pojo.vo.RStatSubstationVO;
import com.njcn.event.pojo.vo.SimpleVO;
import java.util.List;
@@ -52,4 +54,12 @@ public interface PwEventCategoryDetailsService {
* @date 2022/10/31
*/
EventFeatureAmplitudeCurveVO getPwEventFeatureAmplitudeCurve(StatisticsBizBaseParam param);
/**
* 获取变电站暂态指标分类统计表
*
* @param param 前端传入参数
* @return 变电站暂态指标分类统计表
*/
List<RStatSubstationVO> getRStatSubstation(UniversalFrontEndParam param);
}