|
|
|
|
@@ -32,6 +32,7 @@ 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.GridDiagramParam;
|
|
|
|
|
import com.njcn.device.pq.pojo.po.Device;
|
|
|
|
|
import com.njcn.device.pq.pojo.po.Line;
|
|
|
|
|
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
|
|
|
|
import com.njcn.device.pq.pojo.vo.GridDiagramVO;
|
|
|
|
|
@@ -46,6 +47,7 @@ import com.njcn.event.pojo.vo.*;
|
|
|
|
|
import com.njcn.event.service.majornetwork.RmpEventDetailService;
|
|
|
|
|
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
|
|
|
|
|
import com.njcn.event.pojo.po.RMpEventDetailM;
|
|
|
|
|
import com.njcn.harmonic.pojo.vo.RStatOrgIndexVO;
|
|
|
|
|
import com.njcn.system.api.DicDataFeignClient;
|
|
|
|
|
import com.njcn.system.enums.DicDataEnum;
|
|
|
|
|
import com.njcn.system.enums.DicDataTypeEnum;
|
|
|
|
|
@@ -55,10 +57,13 @@ import com.njcn.user.pojo.dto.DeptDTO;
|
|
|
|
|
import com.njcn.web.factory.PageFactory;
|
|
|
|
|
import com.njcn.web.pojo.param.BaseParam;
|
|
|
|
|
import com.njcn.web.utils.RequestUtil;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
@@ -196,18 +201,18 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
|
|
|
|
if (Objects.isNull(rmpEventDetailPO)) {
|
|
|
|
|
throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND);
|
|
|
|
|
}
|
|
|
|
|
List<String> monitorIds = Stream.of(rmpEventDetailPO.getLineId()).collect(Collectors.toList());
|
|
|
|
|
List<String> monitorIds = Stream.of(rmpEventDetailPO.getLineId()).collect(Collectors.toList());
|
|
|
|
|
BeanUtils.copyProperties(rmpEventDetailPO, rmpEventDetailVO);
|
|
|
|
|
if ("pms".equals(sysType)) {
|
|
|
|
|
|
|
|
|
|
if(Objects.isNull(smallType) || smallType == 0){
|
|
|
|
|
if (Objects.isNull(smallType) || smallType == 0) {
|
|
|
|
|
List<Monitor> monitorList = monitorClient.getMonitorList(monitorIds).getData();
|
|
|
|
|
if (CollectionUtil.isNotEmpty(monitorList)) {
|
|
|
|
|
rmpEventDetailVO.setMeasurementPointName(monitorList.get(0).getName());
|
|
|
|
|
rmpEventDetailVO.setPowerStationName(monitorList.get(0).getPowerrName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
//配网
|
|
|
|
|
List<PwPmsMonitorDTO> pwPmsMonitorDTOList = distributionMonitorClient.pwMonitorAreaDetailInfo(monitorIds).getData();
|
|
|
|
|
if (CollectionUtil.isNotEmpty(pwPmsMonitorDTOList)) {
|
|
|
|
|
@@ -228,21 +233,21 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Page<AdvanceEventDetailVO> querySagEvents(BaseParam baseParam) {
|
|
|
|
|
Page<AdvanceEventDetailVO> pageResult = new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam));
|
|
|
|
|
Page<AdvanceEventDetailVO> pageResult = new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam));
|
|
|
|
|
List<String> lineIds = generalDeviceInfoClient.deptGetRunLineEvent(RequestUtil.getDeptIndex()).getData();
|
|
|
|
|
if(CollUtil.isNotEmpty(lineIds)){
|
|
|
|
|
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper =new LambdaQueryWrapper<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(lineIds)) {
|
|
|
|
|
LambdaQueryWrapper<RmpEventDetailPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
lambdaQueryWrapper.isNull(RmpEventDetailPO::getEventassIndex);
|
|
|
|
|
Page<RmpEventDetailPO> poPage = this.page(new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam)),lambdaQueryWrapper);
|
|
|
|
|
Page<RmpEventDetailPO> poPage = this.page(new Page<>(PageFactory.getPageNum(baseParam), PageFactory.getPageSize(baseParam)), lambdaQueryWrapper);
|
|
|
|
|
|
|
|
|
|
List<String> tempLineIds = poPage.getRecords().stream().map(RmpEventDetailPO::getLineId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<AreaLineInfoVO> temLine = lineFeignClient.getBaseLineAreaInfo(tempLineIds).getData();
|
|
|
|
|
Map<String, AreaLineInfoVO> map = temLine.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(poPage.getRecords(),AdvanceEventDetailVO.class);
|
|
|
|
|
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item->{
|
|
|
|
|
if(map.containsKey(item.getLineId())){
|
|
|
|
|
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(poPage.getRecords(), AdvanceEventDetailVO.class);
|
|
|
|
|
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item -> {
|
|
|
|
|
if (map.containsKey(item.getLineId())) {
|
|
|
|
|
item.setGdName(map.get(item.getLineId()).getGdName());
|
|
|
|
|
item.setSubName(map.get(item.getLineId()).getSubName());
|
|
|
|
|
switch (item.getDealFlag()) {
|
|
|
|
|
@@ -262,9 +267,9 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
|
|
|
|
throw new IllegalStateException("未发现的类型: " + item.getDealFlag());
|
|
|
|
|
}
|
|
|
|
|
//录波文件
|
|
|
|
|
if(Objects.nonNull(item.getFileFlag()) && item.getFileFlag() == 1){
|
|
|
|
|
if (Objects.nonNull(item.getFileFlag()) && item.getFileFlag() == 1) {
|
|
|
|
|
item.setBoFileFlag(EnumFlag.EXIST.description);
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
item.setBoFileFlag(EnumFlag.ABSENCE.description);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -282,7 +287,6 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RmpEventDetailPO queryEventDetailByEventId(String eventId) {
|
|
|
|
|
return this.getById(eventId);
|
|
|
|
|
@@ -302,17 +306,17 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
|
|
|
|
deptGetLineParam.setLineRunFlag(0);
|
|
|
|
|
List<DeptGetChildrenMoreDTO> deptGetChildrenMoreDTOS = commTerminalGeneralClient.deptGetLine(deptGetLineParam).getData();
|
|
|
|
|
List<LineDevGetDTO> collect = deptGetChildrenMoreDTOS.stream()
|
|
|
|
|
.filter(x->deptIDS.contains(x.getUnitId()))
|
|
|
|
|
.filter(x -> deptIDS.contains(x.getUnitId()))
|
|
|
|
|
.flatMap(x -> x.getLineBaseList().stream()).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
List<String> lineAllIds = collect.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
List<String> gwLineAllIds = collect.stream().filter(x->1==x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
List<String> gwLineAllIds = collect.stream().filter(x -> 1 == x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
|
|
|
|
List<RmpEventDetailPO> list1 = this.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
|
|
|
|
.in(CollUtil.isNotEmpty(lineAllIds), RmpEventDetailPO::getMeasurementPointId, lineAllIds)
|
|
|
|
|
.ge(StrUtil.isNotBlank(param.getStartTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
|
|
|
|
|
.le(StrUtil.isNotBlank(param.getEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
|
|
|
|
|
);
|
|
|
|
|
List<RmpEventDetailPO> list =list1.stream().filter(x->param.getIds().contains(x.getEventType())).collect(Collectors.toList());
|
|
|
|
|
List<RmpEventDetailPO> list = list1.stream().filter(x -> param.getIds().contains(x.getEventType())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
Map<String, DeptGetChildrenMoreDTO> deptLineMap = deptGetChildrenMoreDTOS.stream().collect(Collectors.toMap(DeptGetChildrenMoreDTO::getUnitId, Function.identity()));
|
|
|
|
|
GridDiagramVO.LineStatistics lineStatistics;
|
|
|
|
|
@@ -327,7 +331,7 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
|
|
|
|
gwLineStatistics.setOrgName(datum.getName());
|
|
|
|
|
List<LineDevGetDTO> lineBaseList = deptLineMap.get(datum.getId()).getLineBaseList();
|
|
|
|
|
List<String> lineIds = lineBaseList.stream().map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
|
|
|
|
|
List<String> gwLineIds = lineBaseList.stream().filter(x -> 1==x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
|
|
|
|
|
List<String> gwLineIds = lineBaseList.stream().filter(x -> 1 == x.getIsUpToGrid()).map(LineDevGetDTO::getPointId).distinct().collect(Collectors.toList());
|
|
|
|
|
long count = list.stream().filter(x -> lineIds.contains(x.getMeasurementPointId())).map(RmpEventDetailPO::getEventId).count();
|
|
|
|
|
long gwCount = list.stream().filter(x -> gwLineIds.contains(x.getMeasurementPointId())).map(RmpEventDetailPO::getEventId).count();
|
|
|
|
|
lineStatistics.setCount(count);
|
|
|
|
|
@@ -345,38 +349,48 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<EventDetailVO> getEventDetailByList(GridDiagramParam param) {
|
|
|
|
|
List<EventDetailVO> info=new ArrayList<>();
|
|
|
|
|
//获取污区图统计类型
|
|
|
|
|
List<EventDetailVO> info = new ArrayList<>();
|
|
|
|
|
//获取统计类型
|
|
|
|
|
DictData dip = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData();
|
|
|
|
|
DictData rise = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_RISE.getCode()).getData();
|
|
|
|
|
DictData interruptions = dicDataFeignClient.getDicDataByCode(DicDataEnum.SHORT_INTERRUPTIONS.getCode()).getData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<GeneralDeviceDTO> data = generalDeviceInfoClient.getPracticalRunDeviceInfo(param.getDeviceInfoParam()).getData();
|
|
|
|
|
List<String> lineIds = data.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
|
|
|
|
|
List<RmpEventDetailPO> list = this.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
|
|
|
|
.select(RmpEventDetailPO::getEventId,RmpEventDetailPO::getMeasurementPointId ,RmpEventDetailPO::getEventType, RmpEventDetailPO::getSeverity)
|
|
|
|
|
.select(RmpEventDetailPO::getEventId, RmpEventDetailPO::getMeasurementPointId, RmpEventDetailPO::getEventType, RmpEventDetailPO::getSeverity)
|
|
|
|
|
.in(CollUtil.isNotEmpty(lineIds), RmpEventDetailPO::getMeasurementPointId, lineIds)
|
|
|
|
|
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())))
|
|
|
|
|
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())))
|
|
|
|
|
);
|
|
|
|
|
Map<String, Line> lineMap = new HashMap<>();
|
|
|
|
|
if (CollUtil.isNotEmpty(lineIds)) {
|
|
|
|
|
List<Line> lines = lineFeignClient.getBaseLineList(lineIds).getData();
|
|
|
|
|
lineMap = lines.stream().collect(Collectors.toMap(Line::getId, Function.identity()));
|
|
|
|
|
}
|
|
|
|
|
EventDetailVO vo;
|
|
|
|
|
for (GeneralDeviceDTO datum : data) {
|
|
|
|
|
vo=new EventDetailVO();
|
|
|
|
|
vo = new EventDetailVO();
|
|
|
|
|
vo.setId(datum.getIndex());
|
|
|
|
|
vo.setName(datum.getName());
|
|
|
|
|
List<RmpEventDetailPO> detailPOList = list.stream().filter(x -> datum.getLineIndexes().contains(x.getMeasurementPointId())).collect(Collectors.toList());
|
|
|
|
|
if(CollUtil.isNotEmpty(detailPOList)){
|
|
|
|
|
vo.setSwellTimes(detailPOList.stream().filter(x->x.getEventType().equals(rise.getId())).count());
|
|
|
|
|
vo.setSagTimes(detailPOList.stream().filter(x->x.getEventType().equals(dip.getId())).count());
|
|
|
|
|
vo.setInterruptTimes(detailPOList.stream().filter(x->x.getEventType().equals(interruptions.getId())).count());
|
|
|
|
|
double v90 = detailPOList.stream().filter(x -> x.getSeverity()*100<=90).count() * 100.0 / detailPOList.size();
|
|
|
|
|
double v50 = detailPOList.stream().filter(x -> x.getSeverity()*100<=50).count() * 100.0 / detailPOList.size();
|
|
|
|
|
double v20 = detailPOList.stream().filter(x -> x.getSeverity()*100<=20).count() * 100.0 / detailPOList.size();
|
|
|
|
|
vo.setRate90(NumberUtil.round(v90,2).doubleValue());
|
|
|
|
|
vo.setRate50(NumberUtil.round(v50,2).doubleValue());
|
|
|
|
|
vo.setRate20(NumberUtil.round(v20,2).doubleValue());
|
|
|
|
|
}else {
|
|
|
|
|
if (CollUtil.isNotEmpty(detailPOList)) {
|
|
|
|
|
vo.setSwellTimes(detailPOList.stream().filter(x -> x.getEventType().equals(rise.getId())).count());
|
|
|
|
|
vo.setSwellTimesIds(eventLine(detailPOList, rise.getId(), lineMap));
|
|
|
|
|
|
|
|
|
|
vo.setSagTimes(detailPOList.stream().filter(x -> x.getEventType().equals(dip.getId())).count());
|
|
|
|
|
vo.setSagTimesIds(eventLine(detailPOList, dip.getId(), lineMap));
|
|
|
|
|
|
|
|
|
|
vo.setInterruptTimes(detailPOList.stream().filter(x -> x.getEventType().equals(interruptions.getId())).count());
|
|
|
|
|
vo.setInterruptTimesIds(eventLine(detailPOList, interruptions.getId(), lineMap));
|
|
|
|
|
|
|
|
|
|
double v90 = detailPOList.stream().filter(x -> x.getSeverity() * 100 <= 90).count() * 100.0 / detailPOList.size();
|
|
|
|
|
double v50 = detailPOList.stream().filter(x -> x.getSeverity() * 100 <= 50).count() * 100.0 / detailPOList.size();
|
|
|
|
|
double v20 = detailPOList.stream().filter(x -> x.getSeverity() * 100 <= 20).count() * 100.0 / detailPOList.size();
|
|
|
|
|
vo.setRate90(NumberUtil.round(v90, 2).doubleValue());
|
|
|
|
|
vo.setRate50(NumberUtil.round(v50, 2).doubleValue());
|
|
|
|
|
vo.setRate20(NumberUtil.round(v20, 2).doubleValue());
|
|
|
|
|
} else {
|
|
|
|
|
vo.setSwellTimes(0L);
|
|
|
|
|
vo.setSagTimes(0L);
|
|
|
|
|
vo.setInterruptTimes(0L);
|
|
|
|
|
@@ -389,6 +403,24 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<EventCount.Detail> eventLine(List<RmpEventDetailPO> detailPOList, String dicData, Map<String, Line> lineMap) {
|
|
|
|
|
List<EventCount.Detail> info = new ArrayList<>();
|
|
|
|
|
Map<String, Long> collect = detailPOList.stream().filter(x -> x.getEventType().equals(dicData))
|
|
|
|
|
.collect(Collectors.groupingBy(RmpEventDetailPO::getMeasurementPointId, Collectors.counting()));
|
|
|
|
|
collect.forEach((key, value) -> {
|
|
|
|
|
if (lineMap.containsKey(key)) {
|
|
|
|
|
EventCount.Detail detail = new EventCount.Detail();
|
|
|
|
|
detail.setLineId(key);
|
|
|
|
|
detail.setDicData(dicData);
|
|
|
|
|
detail.setLineName(lineMap.get(key).getName());
|
|
|
|
|
detail.setCount(BigDecimal.valueOf(value));
|
|
|
|
|
info.add(detail);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
info.sort(Comparator.comparing(EventCount.Detail::getCount).reversed());
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public RMpEventDetailM getEventDetailByLine(StatisticsBizBaseParam param) {
|
|
|
|
|
RMpEventDetailM rMpEventDetailM = eventDetailMMapper.selectOne(new LambdaQueryWrapper<RMpEventDetailM>()
|
|
|
|
|
@@ -401,37 +433,37 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map<String, Object>> getImMonitorEvents(EventBaseParam param) {
|
|
|
|
|
List<Map<String,Object>> mapList = new ArrayList<>();
|
|
|
|
|
DictData eventDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.VOLTAGE_DIP.getCode(),DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
|
|
|
|
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.MOST_IMPORMENT.getCode(),DicDataTypeEnum.DEV_GRADE.getCode()).getData();
|
|
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
|
|
DictData eventDic = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.VOLTAGE_DIP.getCode(), DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
|
|
|
|
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.MOST_IMPORMENT.getCode(), DicDataTypeEnum.DEV_GRADE.getCode()).getData();
|
|
|
|
|
|
|
|
|
|
QueryWrapper<RmpEventDetailPO> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
|
|
if(StrUtil.isNotBlank(param.getLineId())){
|
|
|
|
|
queryWrapper.eq("measurement_point_id",param.getSearchValue());
|
|
|
|
|
}else {
|
|
|
|
|
List<String> lineIds = lineFeignClient.getLevelMonitorIdByDept(dictData.getId(),param.getDeptId()).getData();
|
|
|
|
|
if(CollUtil.isEmpty(lineIds)){
|
|
|
|
|
if (StrUtil.isNotBlank(param.getLineId())) {
|
|
|
|
|
queryWrapper.eq("measurement_point_id", param.getSearchValue());
|
|
|
|
|
} else {
|
|
|
|
|
List<String> lineIds = lineFeignClient.getLevelMonitorIdByDept(dictData.getId(), param.getDeptId()).getData();
|
|
|
|
|
if (CollUtil.isEmpty(lineIds)) {
|
|
|
|
|
return mapList;
|
|
|
|
|
}
|
|
|
|
|
queryWrapper.in("measurement_point_id",lineIds);
|
|
|
|
|
queryWrapper.in("measurement_point_id", lineIds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//lineFeignClient.getLevelMonitorIdByDept(dictData.getId(),)
|
|
|
|
|
queryWrapper.select("measurement_point_id as lineId","count(event_id) as eventCount").between("start_time",param.getSearchBeginTime(),param.getSearchEndTime())
|
|
|
|
|
.eq("event_type",eventDic.getId())
|
|
|
|
|
queryWrapper.select("measurement_point_id as lineId", "count(event_id) as eventCount").between("start_time", param.getSearchBeginTime(), param.getSearchEndTime())
|
|
|
|
|
.eq("event_type", eventDic.getId())
|
|
|
|
|
.groupBy("measurement_point_id");
|
|
|
|
|
mapList = this.baseMapper.selectMaps(queryWrapper);
|
|
|
|
|
if(CollUtil.isEmpty(mapList)){
|
|
|
|
|
if (CollUtil.isEmpty(mapList)) {
|
|
|
|
|
return mapList;
|
|
|
|
|
}
|
|
|
|
|
List<String> ids = mapList.stream().map(it->it.get("lineId").toString()).distinct().collect(Collectors.toList());
|
|
|
|
|
List<String> ids = mapList.stream().map(it -> it.get("lineId").toString()).distinct().collect(Collectors.toList());
|
|
|
|
|
List<AreaLineInfoVO> lineList = lineFeignClient.getBaseLineAreaInfo(ids).getData();
|
|
|
|
|
Map<String,AreaLineInfoVO> lineMap = lineList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId,Function.identity()));
|
|
|
|
|
Map<String, AreaLineInfoVO> lineMap = lineList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
mapList.forEach(item->{
|
|
|
|
|
mapList.forEach(item -> {
|
|
|
|
|
AreaLineInfoVO tem = lineMap.get(item.get("lineId").toString());
|
|
|
|
|
item.put("lineName",tem.getVoltageName()+"_"+tem.getLineName());
|
|
|
|
|
item.put("lineName", tem.getVoltageName() + "_" + tem.getLineName());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return mapList;
|
|
|
|
|
@@ -452,9 +484,60 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
|
|
|
|
return eventCountList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Page<AdvanceEventDetailVO> getEventByLineIdsCount(EventBaseParam.Info param) {
|
|
|
|
|
Page<RmpEventDetailPO> poPage = this.page(new Page<>(PageFactory.getPageNum(param), PageFactory.getPageSize(param)), new LambdaQueryWrapper<RmpEventDetailPO>()
|
|
|
|
|
.eq(StrUtil.isNotBlank(param.getLineId()), RmpEventDetailPO::getLineId, param.getLineId())
|
|
|
|
|
.eq(StrUtil.isNotBlank(param.getDicData()), RmpEventDetailPO::getEventType, param.getDicData())
|
|
|
|
|
.ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())))
|
|
|
|
|
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())))
|
|
|
|
|
);
|
|
|
|
|
List<String> tempLineIds = poPage.getRecords().stream().map(RmpEventDetailPO::getLineId).distinct().collect(Collectors.toList());
|
|
|
|
|
List<AreaLineInfoVO> temLine = lineFeignClient.getBaseLineAreaInfo(tempLineIds).getData();
|
|
|
|
|
Map<String, AreaLineInfoVO> map = temLine.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId, Function.identity()));
|
|
|
|
|
List<AdvanceEventDetailVO> advanceEventDetailVOList = BeanUtil.copyToList(poPage.getRecords(), AdvanceEventDetailVO.class);
|
|
|
|
|
advanceEventDetailVOList = advanceEventDetailVOList.stream().peek(item -> {
|
|
|
|
|
if (map.containsKey(item.getLineId())) {
|
|
|
|
|
item.setGdName(map.get(item.getLineId()).getGdName());
|
|
|
|
|
item.setSubName(map.get(item.getLineId()).getSubName());
|
|
|
|
|
switch (item.getDealFlag()) {
|
|
|
|
|
case 0:
|
|
|
|
|
item.setFeatureAmplitudeFlag(EnumFlag.UNTREATED.getDescription());
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
item.setFeatureAmplitudeFlag(EnumFlag.PROCESSED.getDescription());
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
item.setFeatureAmplitudeFlag(EnumFlag.NODATA.getDescription());
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
item.setFeatureAmplitudeFlag(EnumFlag.PROCESSFAIL.getDescription());
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
throw new IllegalStateException("未发现的类型: " + item.getDealFlag());
|
|
|
|
|
}
|
|
|
|
|
//录波文件
|
|
|
|
|
if (Objects.nonNull(item.getFileFlag()) && item.getFileFlag() == 1) {
|
|
|
|
|
item.setBoFileFlag(EnumFlag.EXIST.description);
|
|
|
|
|
} else {
|
|
|
|
|
item.setBoFileFlag(EnumFlag.ABSENCE.description);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
Page<AdvanceEventDetailVO> pageResult = new Page<>();
|
|
|
|
|
pageResult.setRecords(advanceEventDetailVOList);
|
|
|
|
|
pageResult.setTotal(poPage.getTotal());
|
|
|
|
|
pageResult.setPages(poPage.getPages());
|
|
|
|
|
pageResult.setSize(poPage.getSize());
|
|
|
|
|
pageResult.setCurrent(poPage.getCurrent());
|
|
|
|
|
return pageResult;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<Double> setData(List<String> gwLineAllIds, List<RmpEventDetailPO> list) {
|
|
|
|
|
List<Double> info=new ArrayList<>();
|
|
|
|
|
List<Double> info = new ArrayList<>();
|
|
|
|
|
long count90 = list.stream()
|
|
|
|
|
.filter(x -> ObjectUtil.isNotNull(x.getSeverity()))
|
|
|
|
|
.filter(x -> gwLineAllIds.contains(x.getMeasurementPointId()))
|
|
|
|
|
@@ -463,21 +546,21 @@ public class RmpEventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper,
|
|
|
|
|
.filter(x -> ObjectUtil.isNotNull(x.getSeverity()))
|
|
|
|
|
.filter(x -> gwLineAllIds.contains(x.getMeasurementPointId()))
|
|
|
|
|
.filter(x -> 0.5 > x.getSeverity()).count();
|
|
|
|
|
if(count90>0){
|
|
|
|
|
info.add(NumberUtil.round(count90*100.0/list.size(),2).doubleValue());
|
|
|
|
|
}else {
|
|
|
|
|
if (count90 > 0) {
|
|
|
|
|
info.add(NumberUtil.round(count90 * 100.0 / list.size(), 2).doubleValue());
|
|
|
|
|
} else {
|
|
|
|
|
info.add(0.0);
|
|
|
|
|
}
|
|
|
|
|
if(count50>0){
|
|
|
|
|
info.add(NumberUtil.round(count50*100.0/list.size(),2).doubleValue());
|
|
|
|
|
}else {
|
|
|
|
|
if (count50 > 0) {
|
|
|
|
|
info.add(NumberUtil.round(count50 * 100.0 / list.size(), 2).doubleValue());
|
|
|
|
|
} else {
|
|
|
|
|
info.add(0.0);
|
|
|
|
|
}
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 内部枚举类:高级算法处理事件的标识描述
|
|
|
|
|
* 内部枚举类:高级算法处理事件的标识描述
|
|
|
|
|
*/
|
|
|
|
|
enum EnumFlag {
|
|
|
|
|
PROCESSED(1, "计算成功"), UNTREATED(0, "未计算"), EXIST(1, "存在"), ABSENCE(0, "不存在"), NODATA(2, "无结果"), PROCESSFAIL(3, "计算失败");
|
|
|
|
|
|