From 88a7706ccb8ee5931eea5aece4e140d408b42778 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 26 Mar 2024 09:42:39 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=8A=9F=E7=8E=8724=E5=B0=8F=E6=97=B6?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/main/vo/HydropowerStationVo.java | 3 +++ .../operation/home/impl/RealTargetServiceImpl.java | 4 +++- .../data/service/impl/HzimsDataServiceImpl.java | 26 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerStationVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerStationVo.java index 0bbcb8f..09e09ac 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerStationVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerStationVo.java @@ -75,6 +75,9 @@ public class HydropowerStationVo { @ApiModelProperty(value = "年发电量完成百分比") private List powerYearMap; + @ApiModelProperty(value = "24小时机组有功功率") + private List activePowerVoList; + @ApiModelProperty(value = "设备信息") private List deviceList; } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java index 70bd210..640af35 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java @@ -1123,7 +1123,9 @@ public class RealTargetServiceImpl implements RealTargetService { * @return */ private List getLoadsByDay(EminfoAndEmParamVo device) { - String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00"; + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.HOUR_OF_DAY,-24); + String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); List records = dataService.periodTargetData(start, end, 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD); if (CollectionUtil.isEmpty(records)) { diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java index 6550b4f..f8b4c12 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java @@ -256,10 +256,36 @@ public class HzimsDataServiceImpl implements HzimsDataService { this.handleWaterLeve(station.getCode(),response); // 年发电量完成百分比 response.setPowerYearMap(this.handlePowerFinish(Collections.singletonList(station),map)); + // 功率曲线 + response.setActivePowerVoList(this.activePowers(station.getRefDept(),targetList)); return response; } /** + * 24小时功率曲线 + * @param refDept + * @param targetList + * @return + */ + private List activePowers(Long refDept, List targetList) { + if(CollectionUtil.isEmpty(targetList)){ + return new ArrayList<>(); + } + List actives = new ArrayList<>(); + targetList.stream().filter(o->o.getDeptId().equals(refDept)).map(HydropowerUnitTargetVo::getActivePowerVoList).collect(Collectors.toList()).forEach(actives::addAll); + if(CollectionUtil.isEmpty(actives)){ + return new ArrayList<>(); + } + Map> maps = actives.stream().collect(Collectors.groupingBy(ActivePowerVo::getHour)); + return maps.entrySet().stream().map(entry->{ + ActivePowerVo activePower = new ActivePowerVo(); + activePower.setHour(entry.getKey()); + activePower.setActivePower(String.valueOf(entry.getValue().stream().mapToDouble(o->Double.parseDouble(o.getActivePower())).sum())); + return activePower; + }).collect(Collectors.toList()); + } + + /** * 站点天气、降雨、水位 * @param stationCode * @return