Pārlūkot izejas kodu

修改多升压站上网电量计算方式

xieshengjie 4 gadi atpakaļ
vecāks
revīzija
14acd273fb

+ 78 - 23
src/main/java/cn/gyee/tamplate/service/analysis/AnalysisNewService.java

@@ -143,44 +143,92 @@ public class AnalysisNewService {
                     continue;
                 }
                 List<Analysissubtablebottom> currentDay = currentDayBdz.stream().filter(i -> i.getWpid().equals(project.getWindpowerstationid())).collect(Collectors.toList());
-                List<String> fcfdlmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
-                        .filter(i -> (
-                                i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")
-                        )).map(i -> i.getId()).collect(Collectors.toList());
-                double fcfdl = 0.0;
-                for (String meterid : fcfdlmeterids) {
-                    fcfdl += currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue():0.0;
-                }
-
-
-                //-------------------------------------------------------------------------------------------------------------------------------------------------
                 List<String> fcswmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
                         .filter(i -> (
                                 i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("正向有功")
                         )).map(i -> i.getId()).collect(Collectors.toList());
+                double fcfdl = 0.0;
                 double fcswfdl = 0.0;
-                for (String meterid : fcswmeterids) {
-                    fcswfdl += currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue():0.0;
-                }
-                //-------------------------------------------------------------------------------------------------------------------------------------------------
-                List<String> fcgwmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
-                        .filter(i -> (
-                                i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("反向有功")
-                        )).map(i -> i.getId()).collect(Collectors.toList());
                 double fcgwfdl = 0.0;
-                for (String meterid : fcgwmeterids) {
-                    fcgwfdl += currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue():0.0;
+                double fczyb = 0.0;
+                if (fcswmeterids.size()==1){
+                    List<String> fcfdlmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                            .filter(i -> (
+                                    i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")
+                            )).map(i -> i.getId()).collect(Collectors.toList());
+                    for (String meterid : fcfdlmeterids) {
+                        fcfdl += currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue():0.0;
+                    }
+                    for (String meterid : fcswmeterids) {
+                        fcswfdl += currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue():0.0;
+                    }
+                    List<String> fcgwmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                            .filter(i -> (
+                                    i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("反向有功")
+                            )).map(i -> i.getId()).collect(Collectors.toList());
+                    for (String meterid : fcgwmeterids) {
+                        fcgwfdl += currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue():0.0;
+                    }
+
+                }else{
+                    List<Meterpoint2> collect = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                            .filter(i -> (
+                                   i.getProjectid().contains(project.getId()) && i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("正向有功")
+                            )).collect(Collectors.toList());
+                    List<Meterpoint2> gwdls = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                            .filter(i -> (
+                                    i.getProjectid().contains(project.getId()) && i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("反向有功")
+                            )).collect(Collectors.toList());
+                    if (StringUtils.isNotEmpty(gwdls)){
+                        fcgwfdl+= currentDay.stream().filter(i->i.getMeterid().equals(gwdls.get(0).getId())).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(gwdls.get(0).getId())).findFirst().get().getDayvaluemodify().doubleValue():0.0;
+
+                    }
+                    for(Meterpoint2 m : collect){
+                        String[] projects = m.getProjectid().split("\\|");
+                        for (String projectid : projects) {
+                            List<Meterpoint2> fcfdls = wpmeterMap.get(project.getWindpowerstationid()).stream()
+                                    .filter(i -> (
+                                            i.getProjectid().equals(projectid) && i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")
+                                    )).collect(Collectors.toList());
+                            for (Meterpoint2 meterpoint2 : fcfdls) {
+                                fcfdl += currentDay.stream().filter(i->i.getMeterid().equals(meterpoint2.getId())).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterpoint2.getId())).findFirst().get().getDayvaluemodify().doubleValue():0.0;
+                            }
+                        }
+                        fcswfdl += currentDay.stream().filter(i->i.getMeterid().equals(m.getId())).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(m.getId())).findFirst().get().getDayvaluemodify().doubleValue():0.0;
+                    }
+
                 }
-                //-------------------------------------------------------------------------------------------------------------------------------------------------
+
                 List<String> fczybmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
                         .filter(i -> (
                                 i.getMetersort().equals("主") && i.getMetertype().equals("站用变") && i.getDisplaytype().equals("正向有功")
                         )).map(i -> i.getId()).collect(Collectors.toList());
-                double fczyb = 0.0;
                 for (String meterid : fczybmeterids) {
                     fczyb += currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue():0.0;
                 }
 
+
+//                //-------------------------------------------------------------------------------------------------------------------------------------------------
+//                List<String> fcswmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+//                        .filter(i -> (
+//                                i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("正向有功")
+//                        )).map(i -> i.getId()).collect(Collectors.toList());
+//                double fcswfdl = 0.0;
+//                for (String meterid : fcswmeterids) {
+//                    fcswfdl += currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue():0.0;
+//                }
+//                //-------------------------------------------------------------------------------------------------------------------------------------------------
+//                List<String> fcgwmeterids = wpmeterMap.get(project.getWindpowerstationid()).stream()
+//                        .filter(i -> (
+//                                i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getDisplaytype().equals("反向有功")
+//                        )).map(i -> i.getId()).collect(Collectors.toList());
+//                double fcgwfdl = 0.0;
+//                for (String meterid : fcgwmeterids) {
+//                    fcgwfdl += currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().isPresent()?currentDay.stream().filter(i->i.getMeterid().equals(meterid)).findFirst().get().getDayvaluemodify().doubleValue():0.0;
+//                }
+                //-------------------------------------------------------------------------------------------------------------------------------------------------
+
+
                 List<String> fdls = wpmeterMap.get(project.getWindpowerstationid()).stream()
                         .filter(i-> (
                                 i.getProjectid().equals(project.getId()) && i.getMetersort().equals("主") && i.getMetertype().equals("进线") && i.getDisplaytype().equals("正向有功")
@@ -201,6 +249,7 @@ public class AnalysisNewService {
                 can.setRecorddate(DateUtils.parseDate(day));
                 can.setZjrl(project.getCapacity() / 10);
 
+
                 can.setFdl(generatingcapacity/10000);
                 can.setSwdl(fcfdl!=0.0?(generatingcapacity/fcfdl*fcswfdl)/10000:0.0);
                 can.setGwdl(fcfdl!=0.0?(generatingcapacity/fcfdl*fcgwfdl)/10000:0.0);
@@ -853,6 +902,12 @@ public class AnalysisNewService {
 
         return resltList;
     }
+
+    /**
+     * 将list 转 map
+     * @param list
+     * @return
+     */
     public Map convert(List list){
         List result;
         Map resmap = new HashMap();

+ 1 - 0
src/test/java/cn/gyee/tamplate/TamplateApplicationTests.java

@@ -71,6 +71,7 @@ public class TamplateApplicationTests {
 //        analysisNewService.savePvStation("2021-03-30","2021-03-30");
 
 
+
     }