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);