From 656db1a5ee987356f6114dbd3926541da22943d9 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 28 Aug 2024 14:35:58 +0800 Subject: [PATCH] =?UTF-8?q?#=E7=94=B5=E9=87=8F=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ElectricReportServiceImpl.java | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java index 4c53620..a6026d7 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java @@ -156,6 +156,21 @@ public class ElectricReportServiceImpl implements IElectricReportService { }else{ comprehensive.setLastMonthGenerateRate(0.0); } + // 本年发电 + if(CollectionUtil.isEmpty(electrics)){ + comprehensive.setYearGenerate(comprehensive.getMonthGenerate()); + comprehensive.setLastYearGenerate(comprehensive.getLastMonthGenerate()); + }else{ + // 累计发电 + comprehensive.setYearGenerate(electrics.stream().mapToDouble(ComprehensiveElectricVo::getMonthGenerate).sum() + comprehensive.getMonthGenerate()); + comprehensive.setLastYearGenerate(electrics.stream().mapToDouble(ComprehensiveElectricVo::getLastMonthGenerate).sum() + comprehensive.getLastMonthGenerate()); + } + if(comprehensive.getYearGenerate() > 0 && comprehensive.getLastYearGenerate() > 0){ + comprehensive.setLastYearGenerateRate(BigDecimal.valueOf(comprehensive.getYearGenerate() / comprehensive.getLastYearGenerate() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue()); + }else{ + comprehensive.setLastYearGenerateRate(0.0); + } + // 本月等效小时 if(comprehensive.getMonthGenerate() > 0){ comprehensive.setMonthEquivalent(BigDecimal.valueOf(comprehensive.getMonthGenerate() / installedCapacity).setScale(2, RoundingMode.HALF_UP).doubleValue()); @@ -168,11 +183,6 @@ public class ElectricReportServiceImpl implements IElectricReportService { }else{ comprehensive.setLastMonthEquivalent(0.0); } - comprehensive.setYearGenerate(threes.stream().filter(o->o.getStrMonth().contains(currentYear)).mapToDouble(o->o.getGenerate().doubleValue()).sum()); - comprehensive.setLastYearGenerate(threes.stream().filter(o->o.getStrMonth().contains(lastYear)).mapToDouble(o->o.getGenerate().doubleValue()).sum()); - if(comprehensive.getYearGenerate() > 0 && comprehensive.getLastYearGenerate() > 0){ - comprehensive.setLastYearGenerateRate(BigDecimal.valueOf(comprehensive.getYearGenerate() / comprehensive.getLastYearGenerate() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue()); - } if(CollectionUtil.isEmpty(electrics)){ // 本年等效小时 comprehensive.setYearEquivalent(comprehensive.getMonthEquivalent()); @@ -783,7 +793,7 @@ public class ElectricReportServiceImpl implements IElectricReportService { AnalyzeDataConditionPO generate = new AnalyzeDataConditionPO(); generate.setFull(1); generate.setKeepFigures(2); - generate.setAccessRules(6); + generate.setAccessRules(5); generate.setSaveTimeType(2); generate.setSignages("generation_capacity"); generate.setTimeInterval(1); @@ -794,7 +804,7 @@ public class ElectricReportServiceImpl implements IElectricReportService { AnalyzeDataConditionPO reactive = new AnalyzeDataConditionPO(); reactive.setFull(1); reactive.setKeepFigures(2); - reactive.setAccessRules(6); + reactive.setAccessRules(5); reactive.setSaveTimeType(2); reactive.setSignages("reactive_generation"); reactive.setTimeInterval(1);