From 5e9afdc94267d4779c3cf4d62e4de96c4e114a0f Mon Sep 17 00:00:00 2001 From: zhangbaojian <1065122561@qq.com> Date: Thu, 4 May 2023 15:49:36 +0800 Subject: [PATCH] =?UTF-8?q?zbj//1.=E6=9A=82=E9=99=8D=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E7=82=B9=E5=9B=BE=E8=BF=94=E5=9B=9E=E5=AF=B9=E8=B1=A1=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../majornetwork/MonitorPointController.java | 4 +-- .../majornetwork/EventAnalysisService.java | 2 +- .../Impl/EventAnalysisServiceImpl.java | 34 +++++++++++++++++-- 3 files changed, 35 insertions(+), 5 deletions(-) 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); } /**