1.pqbug修改

This commit is contained in:
wr
2023-06-02 16:36:25 +08:00
parent 7f71e9e5d8
commit e37fbf4f47
7 changed files with 128 additions and 86 deletions

View File

@@ -2,11 +2,11 @@ package com.njcn.harmonic.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.CharUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
@@ -18,6 +18,7 @@ import com.njcn.device.pq.pojo.dto.OverLimitLineDTO;
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
import com.njcn.device.pq.pojo.dto.WarningSubstationDTO;
import com.njcn.event.api.EventDetailFeignClient;
import com.njcn.event.pojo.vo.GeneralVO;
import com.njcn.harmonic.constant.Param;
import com.njcn.harmonic.mapper.RStatLimitRateDMapper;
import com.njcn.harmonic.mapper.RStatLimitTargetMapper;
@@ -27,7 +28,6 @@ import com.njcn.harmonic.pojo.excel.monitor.MonitorExcel;
import com.njcn.harmonic.pojo.excel.monitor.OverLimitDays;
import com.njcn.harmonic.pojo.excel.monitor.UTimes;
import com.njcn.harmonic.pojo.excel.substation.SubstationExcel;
import com.njcn.harmonic.pojo.po.EventDetail;
import com.njcn.harmonic.pojo.po.LimitTarget;
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO;
@@ -55,6 +55,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Instant;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@@ -132,7 +133,7 @@ public class AnalyzeServiceImpl implements IAnalyzeService {
List<String> line = new ArrayList<>(), subInfo = new ArrayList<>();
List<WarningSubstationDTO> substationDTOList = new ArrayList<>();
Map<String, List<RStatLimitRateDPO>> map = new HashMap<>();
Map<String, List<com.njcn.event.pojo.po.EventDetail>> map2 = new HashMap<>();
Map<String, GeneralVO> map2 = new HashMap<>();
param.setServerName(generalInfo.getMicroServiceName());
List<WarningSubstationVO> list = new ArrayList<>();
List<GeneralDeviceDTO> subList = generalDeviceInfoClient.getPracticalRunDeviceInfoAsSubstation(param).getData();
@@ -152,9 +153,9 @@ public class AnalyzeServiceImpl implements IAnalyzeService {
if (!CollectionUtils.isEmpty(limitRateList)) {
map = limitRateList.stream().collect(Collectors.groupingBy(RStatLimitRateDPO::getLineId));
}
List<com.njcn.event.pojo.po.EventDetail> eventDetailList = getEventDetail(line, param.getSearchBeginTime(), param.getSearchEndTime());
List<GeneralVO> eventDetailList = getEventDetail(line, param.getSearchBeginTime(), param.getSearchEndTime(), eventStatis);
if (!CollectionUtils.isEmpty(eventDetailList)) {
map2 = eventDetailList.stream().collect(Collectors.groupingBy(com.njcn.event.pojo.po.EventDetail::getLineId));
map2 = eventDetailList.stream().collect(Collectors.toMap(GeneralVO::getId, Function.identity()));
}
}
for (GeneralDeviceDTO item : temList) {
@@ -213,27 +214,15 @@ public class AnalyzeServiceImpl implements IAnalyzeService {
}
}
//暂降统计
if (!CollectionUtils.isEmpty(map2.get(item2))) {
List<com.njcn.event.pojo.po.EventDetail> eventDetailList = map2.get(item2);
if (!CollectionUtils.isEmpty(eventDetailList)) {
for (com.njcn.event.pojo.po.EventDetail item3 : eventDetailList) {
String eventType = item3.getEventType();
List<String> code = eventStatis.stream().filter(x -> x.getId().equals(eventType))
.map(DictData::getCode).collect(Collectors.toList());
if (CollUtil.isNotEmpty(code)) {
if (DicDataEnum.VOLTAGE_DIP.getCode().equals(code.get(0))) {
eventDowns++;
}
if (DicDataEnum.VOLTAGE_RISE.getCode().equals(code.get(0))) {
eventUps++;
}
if (DicDataEnum.SHORT_INTERRUPTIONS.getCode().equals(code.get(0))) {
eventInterrupts++;
}
}
}
if (ObjectUtil.isNotNull(map2.get(item2))) {
GeneralVO eventDetailList = map2.get(item2);
if (ObjectUtil.isNotNull(eventDetailList)) {
//电压暂降
eventDowns += eventDetailList.getSagsCount();
//电压暂升
eventUps += eventDetailList.getUpCount();
//电压暂升
eventInterrupts += eventDetailList.getBreakCount();
}
}
if (eventDowns > 0) {
@@ -781,8 +770,16 @@ public class AnalyzeServiceImpl implements IAnalyzeService {
return result;
}
public List<com.njcn.event.pojo.po.EventDetail> getEventDetail(List<String> list, String startTime, String endTime) {
return eventDetailFeignClient.getEventDetail(list, startTime, endTime).getData();
public List<GeneralVO> getEventDetail(List<String> list, String startTime, String endTime, List<DictData> eventStatis) {
Map<String, String> dictMap = eventStatis.stream().collect(Collectors.toMap(DictData::getCode, DictData::getId));
HashMap<String, Object> condMap = new HashMap<>();
condMap.put("startTime", DateUtil.beginOfDay(DateUtil.parse(startTime)).toString());
condMap.put("endTime", DateUtil.endOfDay(DateUtil.parse(endTime)).toString());
condMap.put("ids", list);
condMap.put(DicDataEnum.VOLTAGE_DIP.getCode(), dictMap.get(DicDataEnum.VOLTAGE_DIP.getCode())); //电压暂降
condMap.put(DicDataEnum.SHORT_INTERRUPTIONS.getCode(), dictMap.get(DicDataEnum.SHORT_INTERRUPTIONS.getCode())); //短时中断
condMap.put(DicDataEnum.VOLTAGE_RISE.getCode(), dictMap.get(DicDataEnum.VOLTAGE_RISE.getCode())); //电压暂升
return eventDetailFeignClient.getEventDetailCount(condMap).getData();
}
public List<LimitTarget> getOverDays(List<String> list, String startTime, String endTime) {