diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/MonitorPointController.java b/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/MonitorPointController.java index 0122714ca..7cf30a632 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/MonitorPointController.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/controller/majornetwork/MonitorPointController.java @@ -174,9 +174,9 @@ public class MonitorPointController extends BaseController { @PostMapping("/getPlot") @ApiOperation("暂降事件点图") @ApiImplicitParam(name = "statisticsParam", value = "暂降事件点图参数", required = true) - public HttpResult> getPlot(@RequestBody @Validated StatisticsParam statisticsParam){ + public HttpResult getPlot(@RequestBody @Validated StatisticsParam statisticsParam){ String methodDescribe = getMethodDescribe("getPlot"); - List page = eventAnalysisService.getPlot(statisticsParam); + VoltageToleranceCurveVO page = eventAnalysisService.getPlot(statisticsParam); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe); } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventAnalysisService.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventAnalysisService.java index 2eab822a6..37bb556f1 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventAnalysisService.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/EventAnalysisService.java @@ -73,7 +73,7 @@ public interface EventAnalysisService { * @param statisticsParam * @return */ - List getPlot(StatisticsParam statisticsParam); + VoltageToleranceCurveVO getPlot(StatisticsParam statisticsParam); /** *监测点暂降事件分析查询 diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventAnalysisServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventAnalysisServiceImpl.java index 5bb8a31df..69e641e8a 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventAnalysisServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventAnalysisServiceImpl.java @@ -1,6 +1,7 @@ package com.njcn.event.service.majornetwork.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.util.ObjectUtil; @@ -1417,7 +1418,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { * @author xxy */ @Override - public List getPlot(StatisticsParam statisticsParam) { + public VoltageToleranceCurveVO getPlot(StatisticsParam statisticsParam) { List result = new ArrayList<>(); // QueryResult query = MonitorQuery(statisticsParam); // InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); @@ -1476,8 +1477,37 @@ public class EventAnalysisServiceImpl implements EventAnalysisService { result.add(eventDetailNew); } + if (CollUtil.isEmpty(result)) { + return VoltageToleranceCurveVO.empty(); + } + ArrayList lineIds = new ArrayList<>(); + lineIds.add(statisticsParam.getLineIndex()); + List getBaseLineAreaInfo = lineFeignClient.getBaseLineAreaInfo(lineIds).getData(); + if (CollUtil.isEmpty(getBaseLineAreaInfo)) { + return VoltageToleranceCurveVO.empty(); + } - return result; + Map areaLineInfoVOMap = + getBaseLineAreaInfo.parallelStream().collect(Collectors.toConcurrentMap(AreaLineInfoVO::getLineId, + Function.identity())); + + List curveDataList = result.parallelStream() + .map(dto -> { + AreaLineInfoVO info = areaLineInfoVOMap.get(dto.getLineId()); + + VoltageToleranceCurveVO.VoltageToleranceCurveDataList voltageToleranceCurve = new VoltageToleranceCurveVO.VoltageToleranceCurveDataList(); + voltageToleranceCurve.setLineId(dto.getLineId()); + voltageToleranceCurve.setPersistTime(dto.getDuration()); + voltageToleranceCurve.setEventValue(dto.getFeatureAmplitude()); + voltageToleranceCurve.setTime(dto.getStartTime()); + voltageToleranceCurve.setGdName(info.getGdName()); + voltageToleranceCurve.setSubName(info.getSubName()); + return voltageToleranceCurve; + }) + //.sorted(VoltageToleranceCurveDataList.sortAscTime()) + .collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>()))); + + return VoltageToleranceCurveVO.buildVO(result.size(), curveDataList); } /**