xieshengjie 1 рік тому
батько
коміт
137d373494

+ 35 - 12
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/bmk/BenchmarkingService.java

@@ -150,7 +150,7 @@ public class BenchmarkingService {
                 return true;
             }).collect(Collectors.toList());*/
             List<ProBasicOrganizeTree> collect = CacheContext.proBasicOrganizeTrees.stream()
-                    .filter(ot->!"EQ".equals(ot.getOrgType())).collect(Collectors.toList());
+                    .filter(ot -> !"EQ".equals(ot.getOrgType())).collect(Collectors.toList());
             SortUtils.sort(collect, "orderNum", SortUtils.ASC);
             organizeTrees = ObjectUtil.cloneByStream(collect);
             ProBasicOrganizeTree.buildTree(organizeTrees);
@@ -1584,11 +1584,11 @@ public class BenchmarkingService {
             if (companys.contains("RGN")) {
                 wpList = CacheContext.organizeEquipmentList.stream().map(el -> el.getWindpowerstationId()).distinct().collect(Collectors.toList());
             } else {
-                wpList = CacheContext.organizeEquipmentList.stream().filter(el -> wpids.contains(el.getCompanyId()))
+                wpList = CacheContext.organizeEquipmentList.stream().filter(el -> companys.contains(el.getCompanyId()))
                         .map(el -> el.getWindpowerstationId()).distinct().collect(Collectors.toList());
             }
         }
-        if(StringUtils.isNotEmpty(wpList)){
+        if (StringUtils.isNotEmpty(wpList)) {
             qw.in("windpowerstation_id", wpList);
             pepi1.in("windpowerstation_id", wpList);
         }
@@ -1600,33 +1600,56 @@ public class BenchmarkingService {
         List<ProEconPowerstationInfoDay1> lpepi1 = iProEconPowerstationInfoDay1Service.list(pepi1);
         Map<String, ProEconPowerstationInfoDay1> pepid1Map = lpepi1.stream().collect(Collectors.toMap(ProEconPowerstationInfoDay1::getWindpowerstationId, Function.identity()));
 
+        List<String> finalWpList = wpList;
         Map<String, ProBasicPowerstationPoint> collect = CacheContext.proBasicPowerstationPoint.stream()
-                .filter(p -> "GNLYL".equals(p.getUniformCode()) && wpids.contains(p.getWindpowerstationId()))
+                .filter(p -> "GNLYL".equals(p.getUniformCode()) && finalWpList.contains(p.getWindpowerstationId()))
                 .collect(Collectors.toMap(ProBasicPowerstationPoint::getWindpowerstationId, Function.identity()));
 
         for (ProEconPowerstationInfoDay7 day7 : lpepi7) {
             String wpId = day7.getWindpowerstationId();
             OperationalAnalysis oa = new OperationalAnalysis();
-            oa.setWpsName(CacheContext.proBasicOrganizeTreesMap.get(wpId).getAname());
+            if (CacheContext.proBasicOrganizeTreesMap.get(wpId) == null) {
+                System.out.println(wpId);
+            } else {
+                oa.setWpsName(CacheContext.proBasicOrganizeTreesMap.get(wpId).getAname());
+            }
             oa.setWpsId(wpId);
             oa.setModelId(equipmentStationMap.get(wpId).get(0).getModelId());
             oa.setConversionRate(day7.getRnbqzhxl().doubleValue());
-            oa.setUtilizationHour(pepid1Map.get(wpId).getRfdl().doubleValue() / (CacheContext.proBasicOrganizeTreesMap.get(wpId).getZjCapacity()));
+
+            Double zjCapacity = CacheContext.proBasicOrganizeTreesMap.get(wpId).getZjCapacity();
+            ProEconPowerstationInfoDay1 day1 = pepid1Map.get(wpId);
+            BigDecimal pv = pepid1Map.get(wpId).getRfdl();
+            if (zjCapacity == null || zjCapacity == 0 || pv == null) {
+                oa.setUtilizationHour(0.0);
+            } else {
+                oa.setUtilizationHour(pv.doubleValue() / zjCapacity);
+            }
+
             List<PointData> historyDatasRaw = edosUtil.getHistoryDatasRaw(collect.get(wpId).getNemCode(), date1.getTime() / 1000, date2.getTime() / 1000);
             double v = historyDatasRaw.stream().mapToDouble(PointData::getPointValueInDouble).average().orElse(0);
             oa.setIlluminationUtilizationRate(v);
             resultList.add(oa);
         }
-        Collection<OperationalAnalysis> values = resultList.stream().collect(Collectors.toMap(OperationalAnalysis::getModelId, r -> r, (r1, r2) -> {
+/*        Collection<OperationalAnalysis> values = resultList.stream().collect(Collectors.toMap(OperationalAnalysis::getModelId, r -> r, (r1, r2) -> {
             r1.setConversionRate(r1.getConversionRate() + r2.getConversionRate());
             r1.setUtilizationHour(r1.getUtilizationHour() + r2.getUtilizationHour());
             r1.setIlluminationUtilizationRate(r1.getIlluminationUtilizationRate() + r2.getIlluminationUtilizationRate());
             return r1;
-        })).values();
-        List<OperationalAnalysis> collect1 = values.stream().peek(oa -> {
-            oa.setConversionRate(NumberUtil.round(oa.getConversionRate(), 2).doubleValue());
-            oa.setUtilizationHour(NumberUtil.round(oa.getUtilizationHour(), 2).doubleValue());
-            oa.setIlluminationUtilizationRate(NumberUtil.round(oa.getIlluminationUtilizationRate(), 2).doubleValue());
+        })).values();*/
+
+        List<OperationalAnalysis> collect1 = resultList.stream().peek(oa -> {
+            if (oa.getConversionRate() != null) {
+                oa.setConversionRate(NumberUtil.round(oa.getConversionRate(), 2).doubleValue());
+            }
+            if (oa.getUtilizationHour() != null) {
+                oa.setUtilizationHour(NumberUtil.round(oa.getUtilizationHour(), 2).doubleValue());
+            }
+            Double utilizationRate = oa.getIlluminationUtilizationRate();
+            if (utilizationRate != null && !Double.isInfinite(utilizationRate)) {
+                oa.setIlluminationUtilizationRate(NumberUtil.round(utilizationRate, 2).doubleValue());
+            }
+
         }).collect(Collectors.toList());
 
         return collect1;

+ 12 - 10
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/goodness/WindturbinegoodnessService.java

@@ -889,7 +889,7 @@ public class WindturbinegoodnessService {
     public Page<PvVo> pvgoodness(Integer pageNum, Integer pageSize, String companys, String wpid, String recorddate, String target, String sort) {
 
         Map<String, ProEconEquipmentmodel> modelMap = CacheContext.modelMap;
-        Map<String, ProBasicOrganizeTree> wtmap = CacheContext.wtmap;
+        Map<String, ProBasicOrganizeTree> wtmap = CacheContext.proBasicOrganizeTreesMap;
         LambdaQueryWrapper<ProEconEquipmentInfoDay6> qw = new LambdaQueryWrapper<>();
 
         qw.eq(ProEconEquipmentInfoDay6::getRecordDate, DateUtils.parseDate(recorddate));
@@ -940,11 +940,7 @@ public class WindturbinegoodnessService {
 
         });
 
-        if (StringUtils.isNotEmpty(target)) {
-            if (sort.equals("1"))
-                SortUtils.sort(resultList, target, SortUtils.ASC);
-            SortUtils.sort(resultList, target, SortUtils.DESC);
-        }
+        SortUtils.sort(resultList, "wtid", SortUtils.ASC);
 
         /*List<PvVo> collect = resultList.stream().filter(wv -> {
             boolean b = false;
@@ -1256,10 +1252,16 @@ public class WindturbinegoodnessService {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         Page<ProEconAnalysisClean> page = new Page<>(pageNum, pageSize);
         QueryWrapper<ProEconAnalysisClean> peac = new QueryWrapper();
-        peac.eq("company_id", companys)
-                .eq("windpowerstation_id", wpid)
-                .eq("windturbine_id", wtid)
-                .eq("date", sdf.parse(date));
+        if(StringUtils.isNotEmpty(wtid)){
+            peac.eq("windturbine_id", wtid);
+        }else if(StringUtils.isNotEmpty(wpid)){
+            peac.eq("windpowerstation_id", wpid);
+        }else if(StringUtils.isNotEmpty(companys)){
+            if(!companys.contains("RGN")){
+                peac.eq("company_id", companys);
+            }
+        }
+        peac.eq("date", sdf.parse(date));
         return iProEconAnalysisCleanService.page(page, peac);
     }