Browse Source

调试经济运行问题

xieshengjie 2 years ago
parent
commit
e9f506a0b1

+ 7 - 0
histroy/benchmarking-histroy-new/src/main/java/com/gyee/benchmarkinghistroy/init/CacheContext.java

@@ -68,6 +68,8 @@ public class CacheContext implements CommandLineRunner {
 
     public static List<Line> lines = new ArrayList<>();
 
+    public static Map<String, String> lineWP = new HashMap<>();
+
 
     @Override
     public void run(String... args) throws Exception {
@@ -82,6 +84,11 @@ public class CacheContext implements CommandLineRunner {
         projects = projectService.list();
 
         lines = lineService.list();
+        lines.stream().forEach(line -> {
+            String projectid = line.getProjectid();
+            String windpowerstationid = projects.stream().filter(p -> p.getId().equals(projectid)).findFirst().get().getWindpowerstationid();
+            lineWP.put(line.getId(),windpowerstationid);
+        });
 
         wtls = windturbineService.list();
         wtls.stream().forEach(wt->{

+ 5 - 3
histroy/benchmarking-histroy-new/src/main/java/com/gyee/benchmarkinghistroy/service/infoday/InfodayService.java

@@ -522,9 +522,11 @@ public class InfodayService {
 
     public void saveWindpowerinfoday3(String beginDate,String endDate){
         List<String> days = DateUtils.getDays(beginDate, endDate);
-        List<Line> lines = CacheContext.lines;
-        List<Project> projects = CacheContext.projects;
-        List<Windpowerstation> wplist = CacheContext.wplist;
+
+
+        List<Project> projects = CacheContext.projects.stream().filter(p->p.getWindpowerstationid().endsWith("FDC")).collect(Collectors.toList());
+        List<Line> lines = CacheContext.lines.stream().filter(line->CacheContext.lineWP.get(line.getId()).endsWith("FDC")).collect(Collectors.toList());
+        List<Windpowerstation> wplist = CacheContext.wplist.stream().filter(wp->wp.getId().endsWith("FDC")).collect(Collectors.toList());
         Map<String, Map<String, Windpowerstationpointnew>> lnPointmap = CacheContext.lnPointmap;
         Map<String, Map<String, Windpowerstationpointnew>> pjPointmap = CacheContext.pjPointmap;
         Map<String, Map<String, Windpowerstationpointnew>> wppointmap = CacheContext.wppointmap;

+ 8 - 12
histroy/benchmarking-histroy-new/src/test/java/com/gyee/benchmarkinghistroy/BenchmarkingHistroyMainNewTest.java

@@ -1,13 +1,9 @@
 package com.gyee.benchmarkinghistroy;
 
 
-import com.gyee.benchmarkinghistroy.model.auto.Windpowerstationpointnew;
 import com.gyee.benchmarkinghistroy.service.benchmarking.BenchmarkingHistroyService;
 import com.gyee.benchmarkinghistroy.service.infoday.InfodayService;
 import com.gyee.benchmarkinghistroy.service.specific.SpecificService;
-import com.gyee.benchmarkinghistroy.util.realtimesource.IEdosUtil;
-import com.gyee.benchmarkinghistroy.util.realtimesource.MongoEdosUtil;
-import com.gyee.common.model.PointData;
 import com.gyee.common.util.DateUtils;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -43,25 +39,25 @@ public  class BenchmarkingHistroyMainNewTest {
 
     @Test
     public void test1() throws Exception {
-        String date = "2022-05-02";
+        String date = "2022-07-17";
 //        benchmarkingHistroyService.saveEquipmentdayinfo(date,date);
 //        benchmarkingHistroyService.saveEquipmentdaydetailed(date,date);
 //        benchmarkingHistroyService.saveOperationrecord(date,date);
 //        benchmarkingHistroyService.saveBeanchmarkList(date,date);
 //        benchmarkingHistroyService.saveBenchmark(date,date);
 //        infodayService.saveWindturbineinfoday(date,date);
-        infodayService.saveWindturbineinfoday3(date,date);
-        infodayService.saveWindpowerinfoday(date,date);
+//        infodayService.saveWindturbineinfoday3(date,date);
+//        infodayService.saveWindpowerinfoday(date,date);
         infodayService.saveWindpowerinfoday3(date,date);
     }
 
     @Test
     public void test2() throws Exception {
-        Windpowerstationpointnew point = new Windpowerstationpointnew();
-        point.setCode("HB_GD_KBF_FJ_P4_L17_200_AI0103");
-        IEdosUtil edosUtil = new MongoEdosUtil();
-        PointData realData = edosUtil.getRealData(point);
-        System.out.println(realData);
+//        Windpowerstationpointnew point = new Windpowerstationpointnew();
+//        point.setCode("HB_GD_KBF_FJ_P4_L17_200_AI0103");
+//        IEdosUtil edosUtil = new MongoEdosUtil();
+//        PointData realData = edosUtil.getRealData(point);
+//        System.out.println(realData);
     }
 
     @Test

+ 18 - 12
web/benchmarking-web-hb/src/main/java/com/gyee/benchmarkingweb/service/specific/SpecificService.java

@@ -415,12 +415,15 @@ public class SpecificService {
         }else {
             CacheContext.wplist.stream().forEach(wp->{
                 Optional<SpecificCenterVo> optionMonth = monthresultList.stream().filter(j -> j.getWpid().equals(wp.getId())).findFirst();
-                SpecificCenterVo leftVo = optionMonth.get();
-                leftVo.setTqmtbf(0.0);
-                leftVo.setTqmttr(0.0);
-                leftVo.setTqfwjsl(0.0);
-                leftVo.setTqztzhl(0.0);
-                leftVo.setTqxqjsl(0.0);
+                if (optionMonth.isPresent()){
+                    SpecificCenterVo leftVo = optionMonth.get();
+                    leftVo.setTqmtbf(0.0);
+                    leftVo.setTqmttr(0.0);
+                    leftVo.setTqfwjsl(0.0);
+                    leftVo.setTqztzhl(0.0);
+                    leftVo.setTqxqjsl(0.0);
+                }
+
             });
 
         }
@@ -458,12 +461,15 @@ public class SpecificService {
         }else {
             CacheContext.wplist.stream().forEach(wp->{
                 Optional<SpecificCenterVo> optionMonth = yearresultList.stream().filter(j -> j.getWpid().equals(wp.getId())).findFirst();
-                SpecificCenterVo leftVo = optionMonth.get();
-                leftVo.setTqmtbf(0.0);
-                leftVo.setTqmttr(0.0);
-                leftVo.setTqfwjsl(0.0);
-                leftVo.setTqztzhl(0.0);
-                leftVo.setTqxqjsl(0.0);
+                if (optionMonth.isPresent()){
+                    SpecificCenterVo leftVo = optionMonth.get();
+                    leftVo.setTqmtbf(0.0);
+                    leftVo.setTqmttr(0.0);
+                    leftVo.setTqfwjsl(0.0);
+                    leftVo.setTqztzhl(0.0);
+                    leftVo.setTqxqjsl(0.0);
+                }
+
             });
         }