河北pms接口慢问题解决
This commit is contained in:
@@ -23,4 +23,8 @@ public class PwUniversalFrontEndParam extends StatisticsBizBaseParam implements
|
||||
*/
|
||||
@ApiModelProperty(name = "monitorSort", value = "监测点类别")
|
||||
private List<String> monitorSort;
|
||||
|
||||
private Integer pageNum;
|
||||
|
||||
private Integer pageSize;
|
||||
}
|
||||
|
||||
@@ -52,4 +52,8 @@ public class UniversalFrontEndParam extends StatisticsBizBaseParam implements Se
|
||||
private String monitorName;
|
||||
|
||||
|
||||
private Integer pageNum;
|
||||
|
||||
private Integer pageSize;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.event.controller.distribution;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -44,9 +45,9 @@ public class PwRmpEventDetailController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@ApiOperation("获取暂态事件明细")
|
||||
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
|
||||
public HttpResult<List<PwRmpEventDetailVO>> getPwRmpEventDetail(@RequestBody UniversalFrontEndParam param) {
|
||||
public HttpResult<Page<PwRmpEventDetailVO>> getPwRmpEventDetail(@RequestBody UniversalFrontEndParam param) {
|
||||
String methodDescribe = getMethodDescribe("getPwRmpEventDetail");
|
||||
List<PwRmpEventDetailVO> list = pwRmpEventDetailService.getPwRmpEventDetail(param);
|
||||
Page<PwRmpEventDetailVO> list = pwRmpEventDetailService.getPwRmpEventDetail(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public interface PwRmpEventDetailMapper extends BaseMapper<RmpEventDetailPO> {
|
||||
* @author yzh
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
List<RmpEventDetailPO> getPwRmpEventDetail(@Param("param") UniversalFrontEndParam param,
|
||||
Page<RmpEventDetailPO> getPwRmpEventDetail(@Param("page")Page<RmpEventDetailPO> page,@Param("param") UniversalFrontEndParam param,
|
||||
@Param("monitorIdList") List<String> monitorIdList);
|
||||
|
||||
/**
|
||||
|
||||
@@ -208,6 +208,7 @@
|
||||
feature_amplitude AS featureAmplitude
|
||||
FROM
|
||||
`r_mp_event_detail`
|
||||
where start_time between #{startTime} and #{endTime}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -70,24 +70,20 @@ public class PwEventCategoryDetailsServiceImpl implements PwEventCategoryDetails
|
||||
@Override
|
||||
public List<EventDistributionStatisticsTableVO> getPwEventCategoryDetails(StatisticsBizBaseParam param) {
|
||||
// 获取单位下的监测点id集合
|
||||
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
|
||||
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
|
||||
pwPmsMonitorParam.setOrgId(param.getId());
|
||||
List<String> monitorIds = pmsGeneralDeviceInfoClient.getPwPmsMonitorIds(pwPmsMonitorParam).getData();
|
||||
|
||||
// 创建集合,返回数据
|
||||
List<EventDistributionStatisticsTableVO> vos = new ArrayList<>();
|
||||
|
||||
// 将监测点id取出
|
||||
List<String> monitorIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isEmpty(monitorIdList)) {
|
||||
if (CollectionUtil.isEmpty(monitorIds)) {
|
||||
return Collections.emptyList();
|
||||
|
||||
}
|
||||
// 获取暂态指标分布统计
|
||||
EventDistributionStatisticsPO po = pwEventCategoryDetailsMapper.getPwEventCategoryDetailsMapper(
|
||||
monitorIdList,
|
||||
monitorIds,
|
||||
param.getStartTime(),
|
||||
param.getEndTime());
|
||||
|
||||
@@ -177,23 +173,19 @@ public class PwEventCategoryDetailsServiceImpl implements PwEventCategoryDetails
|
||||
*/
|
||||
@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());
|
||||
// 获取单位下的监测点id集合
|
||||
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
|
||||
pwPmsMonitorParam.setOrgId(param.getId());
|
||||
List<String> monitorIds = pmsGeneralDeviceInfoClient.getPwPmsMonitorIds(pwPmsMonitorParam).getData();
|
||||
|
||||
if (CollectionUtil.isEmpty(monitorIdList)) {
|
||||
if (CollectionUtil.isEmpty(monitorIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 获取持续时间折线图
|
||||
EventDurationLineChartPO po = pwEventCategoryDetailsMapper.getPwEventDurationLineChart(
|
||||
monitorIdList,
|
||||
monitorIds,
|
||||
param.getStartTime(),
|
||||
param.getEndTime());
|
||||
if (ObjectUtil.isEmpty(po)) {
|
||||
@@ -236,22 +228,19 @@ public class PwEventCategoryDetailsServiceImpl implements PwEventCategoryDetails
|
||||
*/
|
||||
@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)) {
|
||||
// 获取单位下的监测点id集合
|
||||
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
|
||||
pwPmsMonitorParam.setOrgId(param.getId());
|
||||
List<String> monitorIds = pmsGeneralDeviceInfoClient.getPwPmsMonitorIds(pwPmsMonitorParam).getData();
|
||||
|
||||
if (CollectionUtil.isEmpty(monitorIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 获取特征幅值折线图
|
||||
EventFeatureAmplitudeLineChartPO po = pwEventCategoryDetailsMapper.getPwEventFeatureAmplitudeLineChart(monitorIdList,
|
||||
EventFeatureAmplitudeLineChartPO po = pwEventCategoryDetailsMapper.getPwEventFeatureAmplitudeLineChart(monitorIds,
|
||||
param.getStartTime(),
|
||||
param.getEndTime());
|
||||
|
||||
@@ -312,23 +301,16 @@ public class PwEventCategoryDetailsServiceImpl implements PwEventCategoryDetails
|
||||
@Override
|
||||
public EventFeatureAmplitudeCurveVO getPwEventFeatureAmplitudeCurve(StatisticsBizBaseParam param) {
|
||||
// 获取单位下的监测点id集合
|
||||
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
|
||||
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
|
||||
pwPmsMonitorParam.setOrgId(param.getId());
|
||||
List<String> monitorIds = pmsGeneralDeviceInfoClient.getPwPmsMonitorIds(pwPmsMonitorParam).getData();
|
||||
|
||||
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)) {
|
||||
if (CollectionUtil.isEmpty(monitorIds)) {
|
||||
return EventFeatureAmplitudeCurveVO.empty();
|
||||
}
|
||||
|
||||
// 获取监测点暂态事件明细数据
|
||||
List<RmpEventDetailPO> rmpEventDetailList = pwEventCategoryDetailsMapper.getPwRmpEventDetail(monitorIdList, param.getStartTime(), param.getEndTime());
|
||||
List<RmpEventDetailPO> rmpEventDetailList = pwEventCategoryDetailsMapper.getPwRmpEventDetail(monitorIds, param.getStartTime(), param.getEndTime());
|
||||
if (CollUtil.isEmpty(rmpEventDetailList)) {
|
||||
return EventFeatureAmplitudeCurveVO.empty();
|
||||
}
|
||||
@@ -345,7 +327,6 @@ public class PwEventCategoryDetailsServiceImpl implements PwEventCategoryDetails
|
||||
|
||||
return eventFeatureAmplitudeCurve;
|
||||
})
|
||||
//.sorted(VoltageToleranceCurveDataList.sortAscTime())
|
||||
.collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
|
||||
|
||||
return EventFeatureAmplitudeCurveVO.buildVO(rmpEventDetailList.size(), curveDataList);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.event.service.distribution.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
||||
import com.njcn.device.pms.api.PwMonitorClient;
|
||||
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
|
||||
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
|
||||
@@ -41,6 +42,8 @@ public class PwEventMonitorReportServiceImpl implements PwEventMonitorReportServ
|
||||
|
||||
private final PwEventDistributionStatisticsMapper eventDistributionStatisticsMapper;
|
||||
|
||||
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
|
||||
|
||||
|
||||
/***
|
||||
* 监测点暂态事件发生次数
|
||||
@@ -52,8 +55,7 @@ public class PwEventMonitorReportServiceImpl implements PwEventMonitorReportServ
|
||||
@Override
|
||||
public List<EventMonitorReportVO> getMonitorEventCount(EventMonitorReportParam eventMonitorReportParam) {
|
||||
//提取查询参数
|
||||
// String monitorName = eventMonitorReportParam.getMonitorName(); //监测点名称
|
||||
// String id = eventMonitorReportParam.getId(); //单位id
|
||||
|
||||
String startTime = eventMonitorReportParam.getStartTime(); //开始时间
|
||||
String endTime = eventMonitorReportParam.getEndTime(); //结束时间
|
||||
Integer type = eventMonitorReportParam.getType(); //时间类型(日/月)
|
||||
@@ -61,6 +63,7 @@ public class PwEventMonitorReportServiceImpl implements PwEventMonitorReportServ
|
||||
//查询监测点信息
|
||||
List<PwPmsMonitorDTO> monitorList = this.getMonitorList(eventMonitorReportParam);
|
||||
List<String> monitorIdList = monitorList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList()); //监测点id信息
|
||||
|
||||
Map<String, PwPmsMonitorDTO> monitorMap = monitorList.stream().collect(Collectors.toMap(PwPmsMonitorDTO::getMonitorId, Function.identity(),(kye1,key2)->kye1));
|
||||
|
||||
//获取电压等级的字典
|
||||
@@ -137,16 +140,15 @@ public class PwEventMonitorReportServiceImpl implements PwEventMonitorReportServ
|
||||
@Override
|
||||
public List<EventDipShortDistributionTableVO> getEventDipShortDistributionByCond(EventMonitorReportParam eventMonitorReportParam) {
|
||||
//提取参数
|
||||
// String monitorName = eventMonitorReportParam.getMonitorName(); //监测点名称
|
||||
// String id = eventMonitorReportParam.getId(); //单位id
|
||||
|
||||
String startTime = eventMonitorReportParam.getStartTime(); //开始时间
|
||||
String endTime = eventMonitorReportParam.getEndTime(); //结束时间
|
||||
Integer type = eventMonitorReportParam.getType(); //时间类型(日/月)
|
||||
|
||||
//查询监测点信息
|
||||
List<PwPmsMonitorDTO> monitorList = this.getMonitorList(eventMonitorReportParam);
|
||||
List<String> monitorIdList = monitorList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList()); //监测点id集合
|
||||
|
||||
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
|
||||
pwPmsMonitorParam.setOrgId(eventMonitorReportParam.getId());
|
||||
List<String> monitorIds = pmsGeneralDeviceInfoClient.getPwPmsMonitorIds(pwPmsMonitorParam).getData();
|
||||
//获取暂态指标的字典
|
||||
List<DictData> eventStatisList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||
//将暂态指标信息转成map,key:code value:实体
|
||||
@@ -154,7 +156,7 @@ public class PwEventMonitorReportServiceImpl implements PwEventMonitorReportServ
|
||||
|
||||
//短时中断、暂降分布情况
|
||||
Map<String, Object> condMap = new HashMap<>();
|
||||
condMap.put("monitorIdList", monitorIdList);
|
||||
condMap.put("monitorIdList", monitorIds);
|
||||
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()));
|
||||
@@ -292,23 +294,21 @@ public class PwEventMonitorReportServiceImpl implements PwEventMonitorReportServ
|
||||
@Override
|
||||
public List<EventRiseDistributionTableVO> getEventRiseDistributionByCond(EventMonitorReportParam eventMonitorReportParam) {
|
||||
//提取参数
|
||||
// String monitorName = eventMonitorReportParam.getMonitorName(); //监测点名称
|
||||
// String id = eventMonitorReportParam.getId(); //单位id
|
||||
String startTime = eventMonitorReportParam.getStartTime(); //开始时间
|
||||
String endTime = eventMonitorReportParam.getEndTime(); //结束时间
|
||||
Integer type = eventMonitorReportParam.getType(); //时间类型(日/月)
|
||||
|
||||
//查询监测点信息
|
||||
List<PwPmsMonitorDTO> monitorList = this.getMonitorList(eventMonitorReportParam);
|
||||
List<String> monitorIdList = monitorList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList()); //监测点id集合
|
||||
|
||||
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
|
||||
pwPmsMonitorParam.setOrgId(eventMonitorReportParam.getId());
|
||||
List<String> monitorIds = pmsGeneralDeviceInfoClient.getPwPmsMonitorIds(pwPmsMonitorParam).getData();
|
||||
//获取暂态指标的字典
|
||||
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("monitorIdList", monitorIds);
|
||||
riseCondMap.put("startTime", startTime);
|
||||
riseCondMap.put("endTime", endTime);
|
||||
riseCondMap.put("eventTypeList", Collections.singletonList(eventStatisMapByCode.get(DicDataEnum.VOLTAGE_RISE.getCode()).getId()));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.event.service.distribution.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
||||
import com.njcn.device.pms.api.PwMonitorClient;
|
||||
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
|
||||
@@ -17,6 +18,8 @@ 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 lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -27,6 +30,7 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -49,6 +53,8 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
|
||||
|
||||
private final PwRStatOrgClassifiedMapper pwRStatOrgClassifiedMapper;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final DecimalFormat df = new DecimalFormat("###.00");
|
||||
|
||||
/**
|
||||
@@ -60,16 +66,15 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
|
||||
@Override
|
||||
public List<RStatOrgVO> getPwRStatOrg(PwUniversalFrontEndParam param) {
|
||||
// 获取单位下的监测点id集合
|
||||
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
|
||||
if (CollUtil.isEmpty(pwPmsMonitorDTOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDepSonDetailByDeptId(param.getId()).getData();
|
||||
Map<String,DeptDTO> map = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
|
||||
|
||||
// 查询字典表
|
||||
List<DictData> dictDataList = dicDataFeignClient
|
||||
.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode())
|
||||
.getData();
|
||||
// 取出单位id
|
||||
List<String> deptIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getOrgId).collect(Collectors.toList());
|
||||
List<String> deptIdList = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
// 获取配网id
|
||||
String distributionPoint = getDistributionPoint();
|
||||
// 创建集合封装查询数据
|
||||
@@ -110,25 +115,26 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
|
||||
return rStatOrgPO.stream().map(po -> {
|
||||
RStatOrgVO vo = new RStatOrgVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
for (PwPmsMonitorDTO dto : pwPmsMonitorDTOList) {
|
||||
if (dto.getOrgId().equals(po.getOrgNo())) {
|
||||
vo.setOrgName(dto.getOrgName());
|
||||
for (DictData dictData : dictDataList) {
|
||||
if (po.getMeasurementTypeClass().equals(dictData.getId())) {
|
||||
vo.setMonitorSort(dictData.getName());
|
||||
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
|
||||
vo.setEventMeasurementRatioAverage(df.format(((po.getEventMeasurementAverage() * 1.0) / (po.getEffectiveMeasurementAverage() * 1.0)) * 100));
|
||||
vo.setEventMeasurementRatioAccrued(df.format(((po.getEventMeasurementAccrued() * 1.0) / (po.getEffectiveMeasurementAccrued() * 1.0)) * 100));
|
||||
vo.setEventFreq(po.getEventFreq().toString());
|
||||
} else {
|
||||
vo.setEventMeasurementRatioAverage("/");
|
||||
vo.setEventMeasurementRatioAccrued("/");
|
||||
vo.setEventFreq("/");
|
||||
}
|
||||
if(map.containsKey(po.getOrgNo())){
|
||||
DeptDTO dto = map.get(po.getOrgNo());
|
||||
vo.setOrgName(dto.getName());
|
||||
for (DictData dictData : dictDataList) {
|
||||
if (po.getMeasurementTypeClass().equals(dictData.getId())) {
|
||||
vo.setMonitorSort(dictData.getName());
|
||||
if (dictData.getCode().equals(DicDataEnum.ONE_LINE.getCode())) {
|
||||
vo.setEventMeasurementRatioAverage(df.format(((po.getEventMeasurementAverage() * 1.0) / (po.getEffectiveMeasurementAverage() * 1.0)) * 100));
|
||||
vo.setEventMeasurementRatioAccrued(df.format(((po.getEventMeasurementAccrued() * 1.0) / (po.getEffectiveMeasurementAccrued() * 1.0)) * 100));
|
||||
vo.setEventFreq(po.getEventFreq().toString());
|
||||
} else {
|
||||
vo.setEventMeasurementRatioAverage("/");
|
||||
vo.setEventMeasurementRatioAccrued("/");
|
||||
vo.setEventFreq("/");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
@@ -141,14 +147,12 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
|
||||
*/
|
||||
@Override
|
||||
public List<PwRStatEventOrgVO> getPwRStatOrgClassified(PwUniversalFrontEndParam param) {
|
||||
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = getPwMonitorList(param);
|
||||
if (CollUtil.isEmpty(pwPmsMonitorDTOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDepSonDetailByDeptId(param.getId()).getData();
|
||||
|
||||
// 创建集合封装返回数据
|
||||
List<PwRStatEventOrgVO> result = new ArrayList<>();
|
||||
// 取出单位id
|
||||
List<String> deptIdList = pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getOrgId).collect(Collectors.toList());
|
||||
List<String> deptIdList = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
// 创建集合封装查询数据
|
||||
List<RStatEventOrgPO> rStatEventOrgVOList = new ArrayList<>();
|
||||
// 获取配网id
|
||||
@@ -199,16 +203,15 @@ public class PwRStatOrgServiceImpl implements PwRStatOrgService {
|
||||
Map<String, DictData> lineSortMap = lineSortList.stream().collect(Collectors.toMap(DictData::getId, DictData -> DictData));
|
||||
// 根据暂态指标code转换成map
|
||||
Map<String, DictData> eventStatisMap = eventStatisList.stream().collect(Collectors.toMap(DictData::getId, DictData -> DictData));
|
||||
// 蒋配网监测点信息根据单位转换成map
|
||||
Map<String, List<PwPmsMonitorDTO>> pwPmsMonitorDTOMap =
|
||||
pwPmsMonitorDTOList.stream().collect(Collectors.groupingBy(PwPmsMonitorDTO::getOrgId));
|
||||
|
||||
// 数据处理
|
||||
Map<String,DeptDTO> map = deptDTOList.stream().collect(Collectors.toMap(DeptDTO::getCode, Function.identity()));
|
||||
rStatEventOrgVOMap.forEach((orgOn, pos) -> {
|
||||
PwRStatEventOrgVO vo = new PwRStatEventOrgVO();
|
||||
// 基础属性赋值
|
||||
if (vo.getOrgNo() == null) {
|
||||
vo.setOrgNo(pos.get(0).getOrgNo());
|
||||
vo.setOrgName(pwPmsMonitorDTOMap.get(pos.get(0).getOrgNo()).get(0).getOrgName());
|
||||
vo.setOrgName(map.get(orgOn).getName());
|
||||
vo.setDataDate(pos.get(0).getDataDate());
|
||||
vo.setMeasurementTypeClass(pos.get(0).getMeasurementTypeClass());
|
||||
vo.setEffectiveMeasurementAverage(pos.get(0).getEffectiveMeasurementAverage());
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.njcn.event.service.distribution.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.device.pms.api.DistributionMonitorClient;
|
||||
import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
||||
import com.njcn.device.pms.api.PwMonitorClient;
|
||||
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
|
||||
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
|
||||
@@ -19,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -44,6 +48,10 @@ public class PwRmpEventDetailServiceImpl implements PwRmpEventDetailService {
|
||||
|
||||
private final MonitorClient monitorClient;
|
||||
|
||||
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
|
||||
|
||||
private final DistributionMonitorClient distributionMonitorClient;
|
||||
|
||||
/**
|
||||
* 获取配网暂态事件明细
|
||||
*
|
||||
@@ -53,31 +61,38 @@ public class PwRmpEventDetailServiceImpl implements PwRmpEventDetailService {
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
@Override
|
||||
public List<PwRmpEventDetailVO> getPwRmpEventDetail(UniversalFrontEndParam param) {
|
||||
public Page<PwRmpEventDetailVO> getPwRmpEventDetail(UniversalFrontEndParam param) {
|
||||
Page<PwRmpEventDetailVO> pageResult = new Page<>(param.getPageNum(),param.getPageSize());
|
||||
// 获取单位下的监测点id集合
|
||||
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
|
||||
pwPmsMonitorParam.setOrgId(param.getId());
|
||||
pwPmsMonitorParam.setMonitorName(param.getMonitorName());
|
||||
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = pwMonitorClient
|
||||
.getPwMonitorList(pwPmsMonitorParam)
|
||||
.getData();
|
||||
List<String> pwPmsMonitorDTOList = pmsGeneralDeviceInfoClient.getPwPmsMonitorIds(pwPmsMonitorParam).getData();
|
||||
if (CollectionUtil.isEmpty(pwPmsMonitorDTOList)) {
|
||||
return Collections.emptyList();
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
|
||||
// 获取配网暂态事件明细
|
||||
List<RmpEventDetailPO> rmpEventDetailsPO = pwRmpEventDetailMapper.getPwRmpEventDetail(param,
|
||||
pwPmsMonitorDTOList.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList()));
|
||||
if (CollectionUtil.isEmpty(rmpEventDetailsPO)) {
|
||||
return Collections.emptyList();
|
||||
Page<RmpEventDetailPO> rmpEventDetailsPO = pwRmpEventDetailMapper.getPwRmpEventDetail(new Page<>(param.getPageNum(),param.getPageSize()),param,
|
||||
pwPmsMonitorDTOList);
|
||||
|
||||
List<RmpEventDetailPO> temList = rmpEventDetailsPO.getRecords();
|
||||
if (CollectionUtil.isEmpty(temList)) {
|
||||
return pageResult;
|
||||
}
|
||||
List<String> ids = temList.stream().map(RmpEventDetailPO::getMeasurementPointId).distinct().collect(Collectors.toList());
|
||||
List<PwPmsMonitorDTO> pList = distributionMonitorClient.pwMonitorAreaDetailInfo(ids).getData();
|
||||
Map<String,PwPmsMonitorDTO> pwPmsMonitorDTOMap = pList.stream().collect(Collectors.toMap(PwPmsMonitorDTO::getMonitorId,Function.identity()));
|
||||
|
||||
// 查询检测点类型字典
|
||||
List<DictData> lineSortList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LINE_SORT.getCode()).getData();
|
||||
// 将单位信息转为map集合 key: 单位id value: 单位实体
|
||||
Map<String, PwPmsMonitorDTO> pwPmsMonitorDTOMap = pwPmsMonitorDTOList.stream().collect(Collectors.toMap(PwPmsMonitorDTO::getMonitorId, PwPmsMonitorDTO -> PwPmsMonitorDTO, (oldValue, newValue) -> oldValue));
|
||||
|
||||
|
||||
// 属性赋值
|
||||
return rmpEventDetailsPO.stream().map(po -> {
|
||||
List<PwRmpEventDetailVO> t = new ArrayList<>();
|
||||
temList.forEach(po -> {
|
||||
PwRmpEventDetailVO vo = new PwRmpEventDetailVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
vo.setMonitorId(po.getMeasurementPointId());
|
||||
@@ -109,8 +124,10 @@ public class PwRmpEventDetailServiceImpl implements PwRmpEventDetailService {
|
||||
}
|
||||
}
|
||||
}
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
t.add(vo);
|
||||
});
|
||||
pageResult.setRecords(t);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.event.service.distribution;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.event.pojo.param.PwUniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.vo.PwRStatEventOrgVO;
|
||||
import com.njcn.event.pojo.vo.RStatOrgVO;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.event.service.distribution;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.vo.PwRmpEventDetailVO;
|
||||
|
||||
@@ -22,5 +23,5 @@ public interface PwRmpEventDetailService {
|
||||
* @author yzh
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
List<PwRmpEventDetailVO> getPwRmpEventDetail(UniversalFrontEndParam param);
|
||||
Page<PwRmpEventDetailVO> getPwRmpEventDetail(UniversalFrontEndParam param);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user