From cb0556cfb22ccfed0068961a2028f915571f5930 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 4 Jan 2024 10:29:09 +0800 Subject: [PATCH] =?UTF-8?q?#=E6=97=A5=E5=B8=B8=E7=BB=B4=E6=8A=A4=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/service/impl/HydropowerServiceImpl.java | 27 +++++++++++++++------- .../scheduled/MaintenanceTaskSchedule.java | 4 ++-- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index 85f83fc..80c7fcc 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java @@ -590,7 +590,7 @@ public class HydropowerServiceImpl implements HydropowerService { // 总有功功率(总发电负荷) response.setPowerSum(this.getPowerSum(realList,station.getRefDept())); // 总有功单位 - response.setPowerUnit(this.getPowerUnit(realList,station.getRefDept())); + response.setPowerUnit("kW"); // 月计划发电量 response.setPlanPowerMon(this.getPlanPowerrMon(station.getCode())); // 年计划发电量 @@ -1553,8 +1553,6 @@ public class HydropowerServiceImpl implements HydropowerService { hydropower.setMinTemp(this.intervalTemp(weekWeather,station.getCode(),false)); // 装机容量 hydropower.setCapacity(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept())).mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum()); - // 负荷 - hydropower.setLoad(reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept())).mapToDouble(HydropowerUnitRealVo::getActivePower).sum()); // 出力 if(Math.abs(hydropower.getCapacity()) > 0){ hydropower.setOutput(BigDecimal.valueOf(hydropower.getLoad() / hydropower.getCapacity() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue()); @@ -1571,8 +1569,9 @@ public class HydropowerServiceImpl implements HydropowerService { // 站点设备 List devices = reals.stream().filter(real-> real.getDeptId().equals(station.getRefDept())).collect(Collectors.toList()); if(CollectionUtil.isNotEmpty(devices)){ - // 设备 - hydropower.setDevices(devices.stream().map(real->{ + List hydropowerDevices = new ArrayList<>(); + Double loadSum = 0.0; + for(HydropowerUnitRealVo real : devices){ AppHydropowerDeviceVo device = new AppHydropowerDeviceVo(); device.setOrd(real.getOrd()); device.setDeviceCode(real.getDeviceCode()); @@ -1580,12 +1579,24 @@ public class HydropowerServiceImpl implements HydropowerService { device.setOrd(real.getOrd()); device.setState(real.getState()); device.setLoadUnit(Optional.ofNullable(real.getPowerUnit()).orElse("kW")); + if("MW".equalsIgnoreCase(device.getLoadUnit())){ + loadSum += (real.getActivePower() * 1000); + }else{ + loadSum += real.getActivePower(); + } device.setCapacity(real.getInstalledCapacity()); device.setLoad(real.getActivePower()); - return device; - }).sorted(Comparator.comparing(AppHydropowerDeviceVo::getOrd)).collect(Collectors.toList())); - hydropower.setLoadUnit(hydropower.getDevices().get(0).getLoadUnit()); + hydropowerDevices.add(device); + }; + // 设备 + hydropower.setDevices(hydropowerDevices.stream().sorted(Comparator.comparing(AppHydropowerDeviceVo::getOrd)).collect(Collectors.toList())); + // 负荷 + hydropower.setLoad(loadSum); + }else{ + hydropower.setLoad(0.0); } + // 负荷单位 + hydropower.setLoadUnit("kW"); return hydropower; }).collect(Collectors.toList()); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java index ea0052e..f9dfce6 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskSchedule.java @@ -48,7 +48,7 @@ public class MaintenanceTaskSchedule { private final IOperMaintenanceTaskService taskService; private final IFlowClient flowClient; - @XxlJob(TASK_VALUE_MAINTENANCE_TASK_CREATE) + /*@XxlJob(TASK_VALUE_MAINTENANCE_TASK_CREATE) public ReturnT execute(String param) throws Exception { Date startDate = StringUtil.isNotBlank(param) ? DateUtil.parse(param, DateUtil.PATTERN_DATE) : DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE); Date endDate = DateUtil.parse(DateUtil.formatDate(DateUtil.plusDays(startDate, 1)), DateUtil.PATTERN_DATE); @@ -60,7 +60,7 @@ public class MaintenanceTaskSchedule { planList.forEach(this::generateTaskByPlan); XxlJobLogger.log("日常维护任务生成完成!"); return new ReturnT<>("SUCCESS"); - } + }*/ /** * 根据日常维护计划生成日常维护任务