Browse Source

Merge branch 'master' of http://124.70.43.205:3000/xieshengjie/sis

xieshengjie 1 year ago
parent
commit
4dcaf9affe
68 changed files with 6030 additions and 2929 deletions
  1. 1 0
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconFailureStatisticMainMapper.java
  2. 67 43
      realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/ParttemperatureService.java
  3. 7 4
      realtime/failurestatistics-server/src/test/java/FailuresTest.java
  4. 3 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/GenerationMain.java
  5. 5 5
      realtime/generationXK-service/src/main/java/com/gyee/generation/config/ThreadPoolTaskConfig.java
  6. 73 71
      realtime/generationXK-service/src/main/java/com/gyee/generation/config/XxlJobConfig.java
  7. 79 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/StatusDetailValue.java
  8. 65 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/StatusValue.java
  9. 17 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo1Service.java
  10. 17 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java
  11. 17 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo3Service.java
  12. 19 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java
  13. 17 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo5Service.java
  14. 69 6
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo6Service.java
  15. 79 211
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfoDayTopService.java
  16. 1508 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPut2Service.java
  17. 233 13
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPutService.java
  18. 144 1087
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitEventService.java
  19. 1036 91
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitEventnewService.java
  20. 171 10
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeGfService.java
  21. 168 10
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeService.java
  22. 505 565
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownService.java
  23. 432 272
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownnewService.java
  24. 51 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java
  25. 50 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo2Service.java
  26. 51 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo3Service.java
  27. 50 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo4Service.java
  28. 48 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo5Service.java
  29. 18 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WpwindDayInfoService.java
  30. 18 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WtAlysisDayService.java
  31. 17 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WtwindDayInfoService.java
  32. 112 43
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/SaticSchedulePgTask.java
  33. 4 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/BrownoutsThread.java
  34. 37 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/BrownoutsThreadPool.java
  35. 1 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo4ThreadPool.java
  36. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo5Thread.java
  37. 34 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/MainBrownoutsThreadPool.java
  38. 66 4
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/ShutdownnewThreadPool.java
  39. 31 7
      realtime/generationXK-service/src/main/resources/application-jn.yml
  40. 25 0
      realtime/generationXK-service/src/main/resources/xxl-job-executor2.properties
  41. 25 0
      realtime/generationXK-service/src/main/resources/xxl-job-executor3.properties
  42. 58 26
      realtime/generationXK-service/src/test/java/com/gyee/generation/HealthTest.java
  43. 2 1
      realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/HealthmodelMain.java
  44. 67 67
      realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/config/XxlJobConfig.java
  45. 1 1
      realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/mapper/auto/ProEconRecommenMainMapper.java
  46. 2 0
      realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/model/auto/ProEconHealthReportMain.java
  47. 84 94
      realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/service/HealthJudgeService.java
  48. 5 0
      realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/service/HealthReportService.java
  49. 1 2
      realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/service/RecommenmainsService.java
  50. 7 9
      realtime/healthmodel-server/src/test/java/HealthTest.java
  51. 3 0
      web/health/src/main/java/com/gyee/health/controller/health/HealthMainController.java
  52. 5 5
      web/health/src/main/java/com/gyee/health/controller/health/HealthReportController.java
  53. 14 14
      web/health/src/main/java/com/gyee/health/controller/health/RecommenController.java
  54. 1 1
      web/health/src/main/java/com/gyee/health/mapper/auto/AlarmcountMapper.java
  55. 1 1
      web/health/src/main/java/com/gyee/health/mapper/auto/ProEconRecommenMainMapper.java
  56. 2 0
      web/health/src/main/java/com/gyee/health/model/auto/ProEconHealthReportMain.java
  57. 9 2
      web/health/src/main/java/com/gyee/health/model/custom/HealthmodelrecordsVo.java
  58. 9 0
      web/health/src/main/java/com/gyee/health/model/custom/StopTypeTreeVo.java
  59. 91 0
      web/health/src/main/java/com/gyee/health/model/vo/ProEconRecommenMainVo.java
  60. 3 0
      web/health/src/main/java/com/gyee/health/service/auto/IProBasicProjectPlanService.java
  61. 23 12
      web/health/src/main/java/com/gyee/health/service/auto/impl/ProBasicProjectPlanServiceImpl.java
  62. 41 16
      web/health/src/main/java/com/gyee/health/service/health/HealthMainService.java
  63. 16 11
      web/health/src/main/java/com/gyee/health/service/health/HealthReportService.java
  64. 7 33
      web/health/src/main/java/com/gyee/health/service/health/HealthSubService.java
  65. 106 98
      web/health/src/main/java/com/gyee/health/service/health/WindTurbineHealthListService.java
  66. 55 17
      web/health/src/main/java/com/gyee/health/service/recommen/RecommenService.java
  67. 44 42
      web/health/src/main/java/com/gyee/health/util/golden/EdosUtil.java
  68. 2 2
      web/health/src/main/resources/application-jn.properties

+ 1 - 0
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/mapper/auto/ProEconFailureStatisticMainMapper.java

@@ -42,6 +42,7 @@ public interface ProEconFailureStatisticMainMapper extends BaseMapper<ProEconFai
 
     public List<EventVo> getCountMap(@Param(value = "beginDate")Date beginDate, @Param(value = "endDate")Date endDate);
 
+
     @Select(" select t.id,t.windturbine_id,t.warning_id,w.chinese_text warnDesc,t.stop_time,t.start_time,t.stop_hours,t.loss_power from pro_econ_shutdown_event t ,pro_econ_warning w,pro_basic_equipment b WHERE  " +
             "               cast(t.warning_id as integer )=w.edna_value and t.windturbine_id=b.id  and t.stop_time>=#{beginDate} and t.stop_time<=#{endDate}  order by t.windturbine_id,t.start_time desc  ")
 

+ 67 - 43
realtime/failurestatistics-server/src/main/java/com/gyee/failurestatistics/service/ParttemperatureService.java

@@ -35,13 +35,10 @@ public class ParttemperatureService {
     SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
 
-
     public void deleteParttemperaturemain(Date recodedate) {
         proEconPartTemperatureMainService.deleteParttemperaturemain(recodedate);
     }
 
-    
-
     public int insertParttemperaturemain(ProEconPartTemperatureMain po) {
 
         return proEconPartTemperatureMainService.insertParttemperaturemain(po);
@@ -76,7 +73,6 @@ public class ParttemperatureService {
                 // 初始化当日数据
                 statticsData(cal,endDate, beginDate, wtls,codeParentmap, codenamemap);
 
-
             }
 
         }
@@ -99,29 +95,35 @@ public class ParttemperatureService {
                 Map<String, Double> wdmap = getWdValue(wt, ContantXk.AI074, endDate, beginDate, map);
 
 
-                Map<String, Double> cLXSRZYW1map = getPartTargetValue(wt, ContantXk.AI042, endDate, beginDate, map,63,0);
-                Map<String, Double> cLXSRZYW2map = getPartTargetValue(wt, ContantXk.AI043, endDate, beginDate, map,63,0);
-                Map<String, Double> cLXRKYWmap = getPartTargetValue(wt, ContantXk.AI038, endDate, beginDate, map,63,0);
-                Map<String, Double> cLXYWmap = getPartTargetValue(wt, ContantXk.AI039, endDate, beginDate, map,60,0);
+                Map<String, Double> cLXSRZYW1map = getPartTargetValue(wt, ContantXk.AI042, endDate, beginDate, map,72,0);
+                Map<String, Double> cLXSRZYW2map = getPartTargetValue(wt, ContantXk.AI043, endDate, beginDate, map,72,0);
+                Map<String, Double> cLXRKYWmap = getPartTargetValue(wt, ContantXk.AI038, endDate, beginDate, map,72,0);
+                Map<String, Double> cLXYWmap = getPartTargetValue(wt, ContantXk.AI039, endDate, beginDate, map,72,0);
 
-                Map<String, Double> fDJZCWDAmap = getPartTargetValue(wt, ContantXk.AI092, endDate, beginDate, map,45,0);
-                Map<String, Double> fDJZCWDBmap = getPartTargetValue(wt, ContantXk.AI062, endDate, beginDate, map,45,0);
+                Map<String, Double> fDJZCWDAmap = getPartTargetValue(wt, ContantXk.AI092, endDate, beginDate, map,60,0);
+                Map<String, Double> fDJZCWDBmap = getPartTargetValue(wt, ContantXk.AI062, endDate, beginDate, map,60,0);
                 Map<String, Double> fDJUXYZWDmap = getPartTargetValue(wt, ContantXk.AI004, endDate, beginDate, map,110,0);
                 Map<String, Double> fDJVXYZWDmap = getPartTargetValue(wt, ContantXk.AI006, endDate, beginDate, map,110,0);
                 Map<String, Double> fDJWXYZWDmap = getPartTargetValue(wt, ContantXk.AI008, endDate, beginDate, map,110,0);
-                Map<String, Double> fDJLQFWDmap = getPartTargetValue(wt, ContantXk.AI059, endDate, beginDate, map,50,0);
+                Map<String, Double> fDJLQFWDmap = getPartTargetValue(wt, ContantXk.AI059, endDate, beginDate, map,60,0);
 
-                Map<String, Double> bJDRQWDmap = getPartTargetValue(wt, ContantXk.AI050, endDate, beginDate, map,35,0);
-                Map<String, Double> bJDRDYmap = getPartTargetValue(wt, ContantXk.AI076, endDate, beginDate, map,70,0);
-                Map<String, Double> bJDLQWDmap = getPartTargetValue(wt, ContantXk.AI020, endDate, beginDate, map,50,0);
-                Map<String, Double> bJDJWDmap = getPartTargetValue(wt, ContantXk.AI045, endDate, beginDate, map,50,0);
-                Map<String, Double> bJKZGWDmap = getPartTargetValue(wt, ContantXk.AI029, endDate, beginDate, map,45,0);
+                Map<String, Double> bJDRQWDmap = getPartTargetValue(wt, ContantXk.AI050, endDate, beginDate, map,45,0);
+                Map<String, Double> bJDRDYmap = getPartTargetValue(wt, ContantXk.AI076, endDate, beginDate, map,81,0);
+                Map<String, Double> bJDLQWDmap = getPartTargetValue(wt, ContantXk.AI020, endDate, beginDate, map,60,0);
+                Map<String, Double> bJDJWDmap = getPartTargetValue(wt, ContantXk.AI045, endDate, beginDate, map,60,0);
+                Map<String, Double> bJKZGWDmap = getPartTargetValue(wt, ContantXk.AI029, endDate, beginDate, map,48,0);
 
-                Map<String, Double> tDGWDmap = getPartTargetValue(wt, ContantXk.AI085, endDate, beginDate, map,35,0);
-                Map<String, Double> tDJGWDmap = getPartTargetValue(wt, ContantXk.AI099, endDate, beginDate, map,35,0);
+                Map<String, Double> tDGWDmap = getPartTargetValue(wt, ContantXk.AI085, endDate, beginDate, map,45,0);
+                Map<String, Double> tDJGWDmap = getPartTargetValue(wt, ContantXk.AI099, endDate, beginDate, map,45,0);
 
+                Map<String, Map<String, Integer>> pointmap =new TreeMap<>();
+
+                intial(pointmap,"0-20");
+                intial(pointmap,"21-40");
+                intial(pointmap,"41-60");
+                intial(pointmap,"61-80");
+                intial(pointmap,"81-100");
 
-                Map<String, Map<String, Integer>> pointmap =new HashMap<>();
                 if (!wdmap.isEmpty()  ) {
 
                     Set<Map.Entry<String, Double>> wdset = wdmap.entrySet();
@@ -220,39 +222,66 @@ public class ParttemperatureService {
         }
     }
 
+    private static void intial(Map<String, Map<String, Integer>> pointmap,String trange) {
+        Map<String, Integer> initalmap=new HashMap<>();
+        initalmap.put(ContantXk.AI042,0);
+        initalmap.put(ContantXk.AI043,0);
+        initalmap.put(ContantXk.AI038,0);
+        initalmap.put(ContantXk.AI039,0);
+        initalmap.put(ContantXk.AI092,0);
+        initalmap.put(ContantXk.AI062,0);
+        initalmap.put(ContantXk.AI004,0);
+        initalmap.put(ContantXk.AI006,0);
+        initalmap.put(ContantXk.AI008,0);
+        initalmap.put(ContantXk.AI059,0);
+        initalmap.put(ContantXk.AI050,0);
+        initalmap.put(ContantXk.AI076,0);
+        initalmap.put(ContantXk.AI020,0);
+        initalmap.put(ContantXk.AI045,0);
+        initalmap.put(ContantXk.AI029,0);
+        initalmap.put(ContantXk.AI085,0);
+        initalmap.put(ContantXk.AI099,0);
+        pointmap.put(trange,initalmap);
+    }
+
     private void setPointValues(String code,Map<String, Double> valuemap, Map<String, Map<String, Integer>> pointmap, Map.Entry<String, Double> wdentry) {
 
         if(StringUtils.notEmp(valuemap))
         {
-            String wdkey=getPoStringInfo(wdentry.getValue());
 
-            if(pointmap.containsKey(wdkey))
+            if(wdentry.getValue() <=100 && wdentry.getValue()>0)
             {
-                Map<String, Integer> pmap=pointmap.get(wdkey);
+                String wdkey=getPoStringInfo(wdentry.getValue());
 
-                if(pmap.containsKey(code))
+                if(pointmap.containsKey(wdkey))
                 {
-                    int num=pmap.get(code);
+                    Map<String, Integer> pmap=pointmap.get(wdkey);
+
+                    if(pmap.containsKey(code))
+                    {
+                        int num=pmap.get(code);
+
+                        num=num+setPointValue(wdentry.getKey(), valuemap);
+                        pmap.put(code, num);
+                        pointmap.put(wdkey, pmap);
+                    }else
+                    {
+                        int num=0;
+                        num=num+setPointValue(wdentry.getKey(), valuemap);
+                        pmap.put(code, num);
+                        pointmap.put(wdkey, pmap);
+                    }
 
-                    num=num+setPointValue(wdentry.getKey(), valuemap);
-                    pmap.put(code, num);
-                    pointmap.put(wdkey, pmap);
                 }else
                 {
+                    Map<String, Integer> pmap=new HashMap<>();
                     int num=0;
                     num=num+setPointValue(wdentry.getKey(), valuemap);
                     pmap.put(code, num);
                     pointmap.put(wdkey, pmap);
                 }
-
-            }else
-            {
-                Map<String, Integer> pmap=new HashMap<>();
-                int num=0;
-                num=num+setPointValue(wdentry.getKey(), valuemap);
-                pmap.put(code, num);
-                pointmap.put(wdkey, pmap);
             }
+
         }
 
     }
@@ -261,13 +290,8 @@ public class ParttemperatureService {
         StringBuilder sb = new StringBuilder();
         int num =0;
         int WDSTEP = 20;
-        if (value < 0) {
-            num = (int) value / WDSTEP;
-            sb.append((num - 1) * WDSTEP).append("-").append(num * WDSTEP);
-        } else {
-            num = (int) value / WDSTEP;
-            sb.append(num * WDSTEP).append("-").append((num + 1) * WDSTEP);
-        }
+        num = (int) value / WDSTEP;
+        sb.append(num * WDSTEP).append("-").append((num + 1) * WDSTEP);
         return String.valueOf(sb);
     }
 
@@ -391,7 +415,7 @@ public class ParttemperatureService {
 
     private Map<String, Double> getWdValue(ProBasicEquipment wt, String code, Date endDate, Date beginDate, Map<String, ProBasicEquipmentPoint> map) throws Exception {
 
-        Map<String, Double> resultmap = new TreeMap<String, Double>();
+        Map<String, Double> resultmap = new TreeMap<>();
 
         if (map.containsKey(code)) {
             ProBasicEquipmentPoint point = map.get(code);

+ 7 - 4
realtime/failurestatistics-server/src/test/java/FailuresTest.java

@@ -1,4 +1,7 @@
 import com.gyee.failurestatistics.FailurestatisticsMain;
+import com.gyee.failurestatistics.service.FailurestatisticsService;
+import com.gyee.failurestatistics.service.ParttemperatureService;
+import com.gyee.failurestatistics.util.SpringUtils;
 import lombok.SneakyThrows;
 import org.springframework.boot.SpringApplication;
 
@@ -10,9 +13,9 @@ public class FailuresTest {
         SpringApplication.run(FailurestatisticsMain.class, args);
 
 
-////
-//        FailurestatisticsService failurestatisticsService= SpringUtils.getBean("failurestatisticsService");
 //
+        FailurestatisticsService failurestatisticsService= SpringUtils.getBean("failurestatisticsService");
+
 //        failurestatisticsService.deleteFailurestatisticsmain(DateUtils.truncate(new Date()));
 //        failurestatisticsService.saveFailurestatisticsmain();
 //
@@ -31,8 +34,8 @@ public class FailuresTest {
 //        partstatisticsService.savePartstatisticsmain();
 
 
-//        ParttemperatureService parttemperatureService= SpringUtils.getBean("parttemperatureService");
-//        parttemperatureService.saveParttemperaturestattics();
+        ParttemperatureService parttemperatureService= SpringUtils.getBean("parttemperatureService");
+        parttemperatureService.saveParttemperaturestattics();
 //        System.out.println("test!");
     }
 }

+ 3 - 3
realtime/generationXK-service/src/main/java/com/gyee/generation/GenerationMain.java

@@ -15,9 +15,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 public class GenerationMain {
     public static void main(String[] args) throws Exception {
         SpringApplication.run(GenerationMain.class, args);
-//
-//
-//
+
+
+
 //        CacheService cacheService= SpringUtils.getBean("cacheService");
 //        cacheService.initRedisCache();
 //

+ 5 - 5
realtime/generationXK-service/src/main/java/com/gyee/generation/config/ThreadPoolTaskConfig.java

@@ -14,15 +14,15 @@ public class ThreadPoolTaskConfig {
      */
 
     /** 核心线程数(默认线程数) */
-    private static final int corePoolSize = 3000;
+    private static final int corePoolSize =100;
     /** 最大线程数 */
-    private static final int maxPoolSize = 10000;
+    private static final int maxPoolSize = 240;
     /** 允许线程空闲时间(单位:默认为秒) */
-    private static final int keepAliveTime = 1000;
+    private static final int keepAliveTime = 60;
     /** 缓冲队列大小 */
-    private static final int queueCapacity = 1000;
+    private static final int queueCapacity = 100;
     /** 允许等待最长时间 */
-    private static final int awaitTime = 10;
+    private static final int awaitTime = 30;
     /** 线程池名前缀 */
     private static final String threadNamePrefix = "GYEE-Thread-";
 

+ 73 - 71
realtime/generationXK-service/src/main/java/com/gyee/generation/config/XxlJobConfig.java

@@ -1,71 +1,73 @@
-//package com.gyee.generation.config;
-//
-//
-//import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.context.EnvironmentAware;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.context.annotation.PropertySource;
-//import org.springframework.core.env.Environment;
-//
-///**
-// * xxl-job config
-// *
-// * @author xuxueli 2017-04-28
-// */
-//
-//
-//@Configuration
-//@PropertySource("classpath:xxl-job-executor.properties")
-////@PropertySource("classpath:xxl-job-executorWPLY.properties")
-////@PropertySource("classpath:xxl-job-executorRG.properties")
-////@PropertySource("classpath:xxl-job-executorJN.properties")
-//public class XxlJobConfig implements EnvironmentAware {
-//    private Environment env;
-//
-//
-//    @Override
-//    public void setEnvironment(Environment environment) {
-//        this.env=environment;
-//    }
-//
-//    private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
-//
-//
-//
-//    @Bean
-//    public XxlJobSpringExecutor xxlJobExecutor() {
-//        logger.info(">>>>>>>>>>> xxl-job config init.");
-//        XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
-//        xxlJobSpringExecutor.setAdminAddresses(env.getProperty("xxl.job.admin.addresses"));
-//        xxlJobSpringExecutor.setAppname(env.getProperty("xxl.job.executor.appname"));
-//        xxlJobSpringExecutor.setAddress(env.getProperty("xxl.job.executor.address"));
-//        xxlJobSpringExecutor.setIp(env.getProperty("xxl.job.executor.ip"));
-//        xxlJobSpringExecutor.setPort(Integer.parseInt(env.getProperty("xxl.job.executor.port")));
-//        xxlJobSpringExecutor.setAccessToken(env.getProperty("xxl.job.accessToken"));
-//        xxlJobSpringExecutor.setLogPath(env.getProperty("xxl.job.executor.logpath"));
-//        xxlJobSpringExecutor.setLogRetentionDays(Integer.parseInt(env.getProperty("xxl.job.executor.logretentiondays")));
-//        return xxlJobSpringExecutor;
-//    }
-//
-//    /**
-//     * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
-//     *
-//     *      1、引入依赖:
-//     *          <dependency>
-//     *             <groupId>org.springframework.cloud</groupId>
-//     *             <artifactId>spring-cloud-commons</artifactId>
-//     *             <version>${version}</version>
-//     *         </dependency>
-//     *
-//     *      2、配置文件,或者容器启动变量
-//     *          spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
-//     *
-//     *      3、获取IP
-//     *          String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
-//     */
-//
-//
-//}
+package com.gyee.generation.config;
+
+
+import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.EnvironmentAware;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+
+/**
+ * xxl-job config
+ *
+ * @author xuxueli 2017-04-28
+ */
+
+
+@Configuration
+@PropertySource("classpath:xxl-job-executor.properties")
+//@PropertySource("classpath:xxl-job-executor2.properties")
+//@PropertySource("classpath:xxl-job-executor3.properties")
+//@PropertySource("classpath:xxl-job-executorWPLY.properties")
+//@PropertySource("classpath:xxl-job-executorRG.properties")
+//@PropertySource("classpath:xxl-job-executorJN.properties")
+public class XxlJobConfig implements EnvironmentAware {
+    private Environment env;
+
+
+    @Override
+    public void setEnvironment(Environment environment) {
+        this.env=environment;
+    }
+
+    private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
+
+
+
+    @Bean
+    public XxlJobSpringExecutor xxlJobExecutor() {
+        logger.info(">>>>>>>>>>> xxl-job config init.");
+        XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
+        xxlJobSpringExecutor.setAdminAddresses(env.getProperty("xxl.job.admin.addresses"));
+        xxlJobSpringExecutor.setAppname(env.getProperty("xxl.job.executor.appname"));
+        xxlJobSpringExecutor.setAddress(env.getProperty("xxl.job.executor.address"));
+        xxlJobSpringExecutor.setIp(env.getProperty("xxl.job.executor.ip"));
+        xxlJobSpringExecutor.setPort(Integer.parseInt(env.getProperty("xxl.job.executor.port")));
+        xxlJobSpringExecutor.setAccessToken(env.getProperty("xxl.job.accessToken"));
+        xxlJobSpringExecutor.setLogPath(env.getProperty("xxl.job.executor.logpath"));
+        xxlJobSpringExecutor.setLogRetentionDays(Integer.parseInt(env.getProperty("xxl.job.executor.logretentiondays")));
+        return xxlJobSpringExecutor;
+    }
+
+    /**
+     * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
+     *
+     *      1、引入依赖:
+     *          <dependency>
+     *             <groupId>org.springframework.cloud</groupId>
+     *             <artifactId>spring-cloud-commons</artifactId>
+     *             <version>${version}</version>
+     *         </dependency>
+     *
+     *      2、配置文件,或者容器启动变量
+     *          spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
+     *
+     *      3、获取IP
+     *          String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
+     */
+
+
+}

+ 79 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/StatusDetailValue.java

@@ -0,0 +1,79 @@
+package com.gyee.generation.model.vo;
+
+public enum StatusDetailValue {
+    //0	待机
+    //1	手动停机
+    //2	正常发电
+    //3	发电降出力
+    //4	故障
+    //5	故障受累
+    //6	检修
+    //7	检修受累
+    //8	限电降出力
+    //9	限电停机
+    //10	电网受累
+    //11	环境受累
+    //12	通讯中断
+    //13	设备离线
+
+
+    DJ(0.0, "待机"),
+    SDTJ(1.0, "手动停机"),
+    ZCFD(2.0, "正常发电"),
+    FDJCL(3.0, "发电降出力"),
+    GZ(4.0, "故障"),
+    GZSL(5.0, "故障受累"),
+    JX(6.0, "检修"),
+    JXSL(7.0, "检修受累"),
+    XDJCL(8.0, "限电降出力"),
+    XDTJ(9.0, "限电停机"),
+    DWSL(10.0, "电网受累"),
+    HJSL(11.0, "环境受累"),
+    TXZD(12.0, "通讯中断"),
+    SBLX(13.0, "设备离线");
+
+    private Double code;
+    private String name;
+
+    StatusDetailValue(Double code) {
+        this.code = code;
+    }
+
+    StatusDetailValue(Double code, String name) {
+        this.code = code;
+        this.name = name;
+    }
+
+    public Double getCode() {
+        return code;
+    }
+
+    public void setCode(Double code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * 根据code获取message
+     *
+     * @param code
+     * @return
+     */
+    public static String getNmaeByCode(Double code) {
+        for (StatusDetailValue ele : values()) {
+            if (ele.getCode().equals(code)) {
+                return ele.getName();
+            }
+        }
+        return null;
+    }
+
+
+}

+ 65 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/StatusValue.java

@@ -0,0 +1,65 @@
+package com.gyee.generation.model.vo;
+
+public enum StatusValue {
+
+    //0	待机
+    //1	运行
+    //2	故障
+    //3	检修
+    //4	限电
+    //5	受累
+    //6	离线
+
+    DJ(0.0, "待机"),
+    YX(1.0, "运行"),
+    GZ(2.0, "故障"),
+    JX(3.0, "检修"),
+    XD(4.0, "限电"),
+    SL(5.0, "受累"),
+    LX(6.0, "离线");
+
+    private Double code;
+    private String name;
+
+    StatusValue(Double code) {
+        this.code = code;
+    }
+
+    StatusValue(Double code, String name) {
+        this.code = code;
+        this.name = name;
+    }
+
+    public Double getCode() {
+        return code;
+    }
+
+    public void setCode(Double code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * 根据code获取message
+     *
+     * @param code
+     * @return
+     */
+    public static String getNmaeByCode(Double code) {
+        for (StatusValue ele : values()) {
+            if (ele.getCode().equals(code)) {
+                return ele.getName();
+            }
+        }
+        return null;
+    }
+
+
+}

+ 17 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo1Service.java

@@ -122,7 +122,23 @@ public class EquipmentInfo1Service {
                     edosUtil,latch)).start();
         }
         latch.await();
-        proEconEquipmentInfoDay1Service.saveBatch(dayls);
+
+        List<ProEconEquipmentInfoDay1> templs=new ArrayList<>();
+        for(ProEconEquipmentInfoDay1 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconEquipmentInfoDay1Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconEquipmentInfoDay1Service.saveOrUpdateBatch(templs);
+        }
+//        proEconEquipmentInfoDay1Service.saveBatch(dayls);
     }
 
     private void extracted(Date recordDate, Date end, Date begin,Map<String, ProBasicEquipmentPoint> pointmap, ProEconEquipmentInfoDay1 pewp,List<ProEconEquipmentInfoDay1> pepid1ls) throws Exception {

+ 17 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java

@@ -127,7 +127,23 @@ public class EquipmentInfo2Service {
                     edosUtil,latch)).start();
         }
         latch.await();
-        proEconEquipmentInfoDay2Service.saveBatch(dayls);
+
+        List<ProEconEquipmentInfoDay2> templs=new ArrayList<>();
+        for(ProEconEquipmentInfoDay2 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconEquipmentInfoDay2Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconEquipmentInfoDay2Service.saveOrUpdateBatch(templs);
+        }
+//        proEconEquipmentInfoDay2Service.saveBatch(dayls);
     }
 
     private void calDetiall(ProEconEquipmentInfoDay2 pewp, Date end, Date begin, ProBasicEquipment wt, List<ProEconEquipmentInfoDay2> pepidls) throws Exception {

+ 17 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo3Service.java

@@ -131,7 +131,23 @@ public class EquipmentInfo3Service {
                     edosUtil,latch)).start();
         }
         latch.await();
-        proEconEquipmentInfoDay3Service.saveBatch(dayls);
+
+        List<ProEconEquipmentInfoDay3> templs=new ArrayList<>();
+        for(ProEconEquipmentInfoDay3 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconEquipmentInfoDay3Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconEquipmentInfoDay3Service.saveOrUpdateBatch(templs);
+        }
+//        proEconEquipmentInfoDay3Service.saveBatch(dayls);
     }
 
     private void calDetiall(ProEconEquipmentInfoDay3 pewp, Date end, Date begin, ProBasicEquipment wt, List<ProEconEquipmentInfoDay3> pepidls) throws Exception {

+ 19 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java

@@ -174,7 +174,7 @@ public class EquipmentInfo4Service {
 //        //拟合优度接口调用
 //        Map<String, Map<String, Double>> nhydMap = goodnessOfFitService.goodnessOfFit(begin);
         List<ProEconEquipmentInfoDay4> dayls=new ArrayList<>();
-        final CountDownLatch latch = new CountDownLatch(+CacheContext.wtls.size());
+        final CountDownLatch latch = new CountDownLatch(CacheContext.wtls.size());
         for (ProBasicEquipment wt : CacheContext.wtls) {
 //            if (CacheContext.wtpAimap.containsKey(wt.getId())) {
 //
@@ -273,8 +273,25 @@ public class EquipmentInfo4Service {
                     proEconCurveFittYearMainService,
                     proEconCurveFittYearSubService,latch)).start();
         }
+
         latch.await();
-        proEconEquipmentInfoDay4Service.saveBatch(dayls);
+
+        List<ProEconEquipmentInfoDay4> templs=new ArrayList<>();
+        for(ProEconEquipmentInfoDay4 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconEquipmentInfoDay4Service.saveBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconEquipmentInfoDay4Service.saveBatch(templs);
+        }
+      //  proEconEquipmentInfoDay4Service.saveBatch(dayls);
     }
 
     private void calDetiall(Map<String, ProEconInOrOutSpeedTotal> peioomap, ProEconEquipmentInfoDay4 pewp, Date end, Date begin,

+ 17 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo5Service.java

@@ -174,7 +174,23 @@ public class EquipmentInfo5Service {
 
             }
 
-        proEconEquipmentInfoDay5Service.saveBatch(dayls);
+        List<ProEconEquipmentInfoDay5> templs=new ArrayList<>();
+        for(ProEconEquipmentInfoDay5 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconEquipmentInfoDay5Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconEquipmentInfoDay5Service.saveOrUpdateBatch(templs);
+        }
+
+     //   proEconEquipmentInfoDay5Service.saveBatch(dayls);
     }
 
     public void buildresetRate(ProEconEquipmentInfoDay5 dayInfo, ProEconEquipmentInfoDay5 day) {

+ 69 - 6
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo6Service.java

@@ -17,9 +17,7 @@ import com.gyee.generation.service.auto.IProEconEquipmentInfoDay6Service;
 import com.gyee.generation.service.auto.IProEconPowerstationInfoDay7Service;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
-import com.gyee.generation.util.statisticcs.Initial;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections.ArrayStack;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -269,7 +267,23 @@ public class EquipmentInfo6Service {
                 }
                 resultList.add(rate);
             }
-            proEconEquipmentInfoDay6Service.saveBatch(resultList);
+
+            List<ProEconEquipmentInfoDay6> templs=new ArrayList<>();
+            for(ProEconEquipmentInfoDay6 vo:resultList)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconEquipmentInfoDay6Service.saveOrUpdateBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
+
+            if(!templs.isEmpty())
+            {
+                proEconEquipmentInfoDay6Service.saveOrUpdateBatch(templs);
+            }
+           // proEconEquipmentInfoDay6Service.saveBatch(resultList);
         });
     }
 
@@ -335,7 +349,23 @@ public class EquipmentInfo6Service {
                     lnResultlist.add(proEconPowerstationInfoDay7);
                 }
             });
-            proEconPowerstationInfoDay7Service.saveBatch(lnResultlist);
+
+            List<ProEconPowerstationInfoDay7> templs=new ArrayList<>();
+            for(ProEconPowerstationInfoDay7 vo:lnResultlist)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconPowerstationInfoDay7Service.saveOrUpdateBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
+
+            if(!templs.isEmpty())
+            {
+                proEconPowerstationInfoDay7Service.saveOrUpdateBatch(templs);
+            }
+//            proEconPowerstationInfoDay7Service.saveBatch(lnResultlist);
 
             List<ProEconPowerstationInfoDay7> pjResultlist = new ArrayList<>();
             pjls.stream().forEach(pj->{
@@ -371,7 +401,24 @@ public class EquipmentInfo6Service {
                     pjResultlist.add(proEconPowerstationInfoDay7);
                 }
             });
-            proEconPowerstationInfoDay7Service.saveBatch(pjResultlist);
+
+
+            List<ProEconPowerstationInfoDay7> temp2ls=new ArrayList<>();
+            for(ProEconPowerstationInfoDay7 vo:pjResultlist)
+            {
+                temp2ls.add(vo);
+                if(temp2ls.size()==100)
+                {
+                    proEconPowerstationInfoDay7Service.saveOrUpdateBatch(temp2ls);
+                    temp2ls=new ArrayList<>();
+                }
+            }
+
+            if(!temp2ls.isEmpty())
+            {
+                proEconPowerstationInfoDay7Service.saveOrUpdateBatch(temp2ls);
+            }
+//            proEconPowerstationInfoDay7Service.saveBatch(pjResultlist);
 
 
             List<ProEconPowerstationInfoDay7> wpResultlist = new ArrayList<>();
@@ -407,7 +454,23 @@ public class EquipmentInfo6Service {
                     wpResultlist.add(proEconPowerstationInfoDay7);
                 }
             });
-            proEconPowerstationInfoDay7Service.saveBatch(wpResultlist);
+
+            List<ProEconPowerstationInfoDay7> temp3ls=new ArrayList<>();
+            for(ProEconPowerstationInfoDay7 vo:wpResultlist)
+            {
+                temp3ls.add(vo);
+                if(temp3ls.size()==100)
+                {
+                    proEconPowerstationInfoDay7Service.saveOrUpdateBatch(temp3ls);
+                    temp3ls=new ArrayList<>();
+                }
+            }
+
+            if(!temp3ls.isEmpty())
+            {
+                proEconPowerstationInfoDay7Service.saveOrUpdateBatch(temp3ls);
+            }
+//            proEconPowerstationInfoDay7Service.saveBatch(wpResultlist);
 
 
             List<ProEconPowerstationInfoDay7> cp0Resultlist = new ArrayList<>();

+ 79 - 211
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfoDayTopService.java

@@ -41,9 +41,6 @@ public class EquipmentInfoDayTopService {
         queryWrapper.ge("record_date",DateUtils.truncate(recordDate)).eq("types",1);
         //判断是否有重复记录,先删除重复记录
         List<Long> idls = proEconEquipmentInfoDayTopService.list(queryWrapper).stream()
-//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && i.getTypes() ==1
-//                        && CacheContext.wtmap.containsKey(i.getWindturbineId()))
                 .map(ProEconEquipmentInfoDayTop::getId)
                 .collect(Collectors.toList());
 
@@ -51,6 +48,7 @@ public class EquipmentInfoDayTopService {
 
             proEconEquipmentInfoDayTopService.removeByIds(idls);
         }
+
         for (ProBasicPowerstation wp : CacheContext.wpls) {
 
             List<ProEconEquipmentInfoDayTop> topls = new ArrayList<>();
@@ -83,7 +81,23 @@ public class EquipmentInfoDayTopService {
                 ProEconEquipmentInfoDayTop top =topls.get(i);
                 top.setDayRank(i+1);
             }
-            proEconEquipmentInfoDayTopService.saveBatch(topls);
+
+            List<ProEconEquipmentInfoDayTop> templs=new ArrayList<>();
+            for(ProEconEquipmentInfoDayTop vo:topls)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconEquipmentInfoDayTopService.saveOrUpdateBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
+
+            if(!templs.isEmpty())
+            {
+                proEconEquipmentInfoDayTopService.saveOrUpdateBatch(templs);
+            }
+//            proEconEquipmentInfoDayTopService.saveBatch(topls);
         }
 
     }
@@ -141,7 +155,22 @@ public class EquipmentInfoDayTopService {
             }
 
 
-            proEconEquipmentInfoDayTopService.saveBatch(topls);
+            List<ProEconEquipmentInfoDayTop> templs=new ArrayList<>();
+            for(ProEconEquipmentInfoDayTop vo:topls)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconEquipmentInfoDayTopService.saveOrUpdateBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
+
+            if(!templs.isEmpty())
+            {
+                proEconEquipmentInfoDayTopService.saveOrUpdateBatch(templs);
+            }
+//            proEconEquipmentInfoDayTopService.saveBatch(topls);
         }
 
 
@@ -197,8 +226,22 @@ public class EquipmentInfoDayTopService {
                 top.setDayRank(i+1);
             }
 
+            List<ProEconEquipmentInfoDayTop> templs=new ArrayList<>();
+            for(ProEconEquipmentInfoDayTop vo:topls)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconEquipmentInfoDayTopService.saveOrUpdateBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
 
-            proEconEquipmentInfoDayTopService.saveBatch(topls);
+            if(!templs.isEmpty())
+            {
+                proEconEquipmentInfoDayTopService.saveOrUpdateBatch(templs);
+            }
+//            proEconEquipmentInfoDayTopService.saveBatch(topls);
         }
 
 
@@ -219,10 +262,6 @@ public class EquipmentInfoDayTopService {
         QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper = new QueryWrapper<>();
         queryWrapper.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
         List<ProEconEquipmentInfoDay1> pepid1ls = proEconEquipmentInfoDay1Service.list(queryWrapper);
-//                .stream()
-//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && i.getWindturbineId().equals(wt.getId())
-//                ).collect(Collectors.toList());
 
         if (!pepid1ls.isEmpty()) {
             ProEconEquipmentInfoDay1 pepid1 = pepid1ls.get(0);
@@ -255,10 +294,7 @@ public class EquipmentInfoDayTopService {
         QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
         queryWrapper2.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
         List<ProEconEquipmentInfoDay2> pepid2ls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
-//                .stream()
-//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && i.getWindturbineId().equals(wt.getId())
-//                ).collect(Collectors.toList());
+
 
         if (!pepid2ls.isEmpty()) {
             ProEconEquipmentInfoDay2 pepid2 = pepid2ls.get(0);
@@ -301,10 +337,7 @@ public class EquipmentInfoDayTopService {
         QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper4 = new QueryWrapper<>();
         queryWrapper4.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
         List<ProEconEquipmentInfoDay4> pepid4ls = proEconEquipmentInfoDay4Service.list(queryWrapper4);
-//                .stream()
-//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && i.getWindturbineId().equals(wt.getId())
-//                ).collect(Collectors.toList());
+
 
         if (!pepid4ls.isEmpty()) {
             ProEconEquipmentInfoDay4 pepid4 = pepid4ls.get(0);
@@ -343,13 +376,15 @@ public class EquipmentInfoDayTopService {
         peeidt.setYear(DateUtils.getYear(recordDate));
         peeidt.setMonth(DateUtils.getMonth(recordDate) + 1);
         initial(peeidt);
+
+        Calendar cal=Calendar.getInstance();
+        cal.setTime(recordDate);
+        int days=cal.get(Calendar.DAY_OF_MONTH);
+
         QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper = new QueryWrapper<>();
         queryWrapper.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
         List<ProEconEquipmentInfoDay1> pepid1ls = proEconEquipmentInfoDay1Service.list(queryWrapper);
-//                .stream()
-//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && i.getWindturbineId().equals(wt.getId())
-//                ).collect(Collectors.toList());
+
 
         if (!pepid1ls.isEmpty()) {
             ProEconEquipmentInfoDay1 pepid1 = pepid1ls.get(0);
@@ -382,10 +417,6 @@ public class EquipmentInfoDayTopService {
         QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
         queryWrapper2.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
         List<ProEconEquipmentInfoDay2> pepid2ls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
-//                .stream()
-//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && i.getWindturbineId().equals(wt.getId())
-//                ).collect(Collectors.toList());
 
         if (!pepid2ls.isEmpty()) {
             ProEconEquipmentInfoDay2 pepid2 = pepid2ls.get(0);
@@ -412,14 +443,14 @@ public class EquipmentInfoDayTopService {
 
 
             //设备可利用率
-            int dayhours = 24;
+            int dayhours = 24*days;
             double temp = StringUtils.round(dayhours - peeidt.getDaygzsj(), 2);
             peeidt.setDaysbklyl(temp);
 
 
 
             //等效可用系数
-            dayhours = 24;
+            dayhours = 24*days;
             temp = StringUtils.round(dayhours - peeidt.getDaygzsj() - peeidt.getDaywhsj(), 2);
             peeidt.setDaydxkyxs(temp);
 
@@ -428,10 +459,6 @@ public class EquipmentInfoDayTopService {
         QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper4 = new QueryWrapper<>();
         queryWrapper4.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
         List<ProEconEquipmentInfoDay4> pepid4ls = proEconEquipmentInfoDay4Service.list(queryWrapper4);
-//                .stream()
-//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && i.getWindturbineId().equals(wt.getId())
-//                ).collect(Collectors.toList());
 
         if (!pepid4ls.isEmpty()) {
             ProEconEquipmentInfoDay4 pepid4 = pepid4ls.get(0);
@@ -446,7 +473,7 @@ public class EquipmentInfoDayTopService {
 
             //静风频率
 
-            int dayhours = 24;
+            int dayhours = 24*days;
             double temp = BigDecimal.valueOf(pepid4.getYjfsc()).divide(new BigDecimal(dayhours), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
             peeidt.setDayjfpl(temp);
 
@@ -471,14 +498,15 @@ public class EquipmentInfoDayTopService {
         peeidt.setMonth(DateUtils.getMonth(recordDate) + 1);
         initial(peeidt);
 
+        Calendar cal=Calendar.getInstance();
+        cal.setTime(recordDate);
+        int days=cal.get(Calendar.DAY_OF_YEAR);
+
         QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper = new QueryWrapper<>();
         queryWrapper.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
 
         List<ProEconEquipmentInfoDay1> pepid1ls = proEconEquipmentInfoDay1Service.list(queryWrapper);
-//                .stream()
-//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && i.getWindturbineId().equals(wt.getId())
-//                ).collect(Collectors.toList());
+
 
         if (!pepid1ls.isEmpty()) {
             ProEconEquipmentInfoDay1 pepid1 = pepid1ls.get(0);
@@ -511,10 +539,6 @@ public class EquipmentInfoDayTopService {
         QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
         queryWrapper2.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
         List<ProEconEquipmentInfoDay2> pepid2ls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
-//        .stream()
-//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && i.getWindturbineId().equals(wt.getId())
-//                ).collect(Collectors.toList());
 
         if (!pepid2ls.isEmpty()) {
             ProEconEquipmentInfoDay2 pepid2 = pepid2ls.get(0);
@@ -541,14 +565,14 @@ public class EquipmentInfoDayTopService {
 
 
             //设备可利用率
-            int dayhours = 24;
+            int dayhours = 24*days;
             double temp = StringUtils.round(dayhours - peeidt.getDaygzsj(), 2);
             peeidt.setDaysbklyl(temp);
 
 
 
             //等效可用系数
-            dayhours = 24;
+            dayhours = 24*days;
             temp = StringUtils.round(dayhours - peeidt.getDaygzsj() - peeidt.getDaywhsj(), 2);
             peeidt.setDaydxkyxs(temp);
 
@@ -557,10 +581,7 @@ public class EquipmentInfoDayTopService {
         QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper4 = new QueryWrapper<>();
         queryWrapper4.ge("record_date",DateUtils.truncate(recordDate)).eq("windturbine_id",wt.getId());
         List<ProEconEquipmentInfoDay4> pepid4ls = proEconEquipmentInfoDay4Service.list(queryWrapper4);
-//        .stream()
-//                .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(recordDate)) == 0
-//                        && i.getWindturbineId().equals(wt.getId())
-//                ).collect(Collectors.toList());
+
 
         if (!pepid4ls.isEmpty()) {
             ProEconEquipmentInfoDay4 pepid4 = pepid4ls.get(0);
@@ -574,13 +595,11 @@ public class EquipmentInfoDayTopService {
             peeidt.setDayxfqr(pepid4.getNxfqrfs());
 
             //静风频率
-
-            int dayhours = 24;
+            int dayhours = 24*days;
             double temp = BigDecimal.valueOf(pepid4.getNjfsc()).divide(new BigDecimal(dayhours), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
             peeidt.setDayjfpl(temp);
 
 
-
             //功率一致性系数
             peeidt.setDayglyzxxs(pepid4.getNglyzxxs());
 
@@ -600,48 +619,20 @@ public class EquipmentInfoDayTopService {
 
             switch (str) {
                 case "dayfs":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDayfs).reversed()).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthfs((double) (i + 1));
-                    }
-                    break;
                 case "monthfs":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getMonthfs).reversed()).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthfs((double) (i + 1));
-                    }
-                    break;
                 case "yearfs":
                     ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getYearfs).reversed()).collect(Collectors.toList());
+                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDayfs).reversed()).collect(Collectors.toList());
                     for (int i = 0; i < ls.size(); i++) {
                         ProEconEquipmentInfoDayTop po = ls.get(i);
                         po.setMonthfs((double) (i + 1));
                     }
                     break;
                 case "dayxnssdl":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDayxnssdl)).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthxnssdl((double) (i + 1));
-                    }
-                    break;
                 case "monthxnssdl":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getMonthxnssdl)).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthxnssdl((double) (i + 1));
-                    }
-                    break;
                 case "yearxnssdl":
                     ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getYearxnssdl)).collect(Collectors.toList());
+                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDayxnssdl)).collect(Collectors.toList());
                     for (int i = 0; i < ls.size(); i++) {
                         ProEconEquipmentInfoDayTop po = ls.get(i);
                         po.setMonthxnssdl((double) (i + 1));
@@ -649,192 +640,80 @@ public class EquipmentInfoDayTopService {
                     break;
 
                 case "daylyxs":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDaylyxs).reversed()).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthlyxs((double) (i + 1));
-                    }
-                    break;
                 case "monthlyxs":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getMonthlyxs).reversed()).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthlyxs((double) (i + 1));
-                    }
-                    break;
                 case "yearlyxs":
                     ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getYearlyxs).reversed()).collect(Collectors.toList());
+                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDaylyxs).reversed()).collect(Collectors.toList());
                     for (int i = 0; i < ls.size(); i++) {
                         ProEconEquipmentInfoDayTop po = ls.get(i);
                         po.setMonthlyxs((double) (i + 1));
                     }
                     break;
                 case "daynhyd":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDaynhyd)).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthnhyd((double) (i + 1));
-                    }
-                    break;
                 case "monthnhyd":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getMonthnhyd)).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthnhyd((double) (i + 1));
-                    }
-                    break;
                 case "yearnhyd":
                     ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getYearnhyd)).collect(Collectors.toList());
+                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDaynhyd)).collect(Collectors.toList());
                     for (int i = 0; i < ls.size(); i++) {
                         ProEconEquipmentInfoDayTop po = ls.get(i);
                         po.setMonthnhyd((double) (i + 1));
                     }
                     break;
                 case "daysbklyl":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDaysbklyl).reversed()).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthsbklyl((double) (i + 1));
-                    }
-                    break;
                 case "monthsbklyl":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getMonthsbklyl).reversed()).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthsbklyl((double) (i + 1));
-                    }
-                    break;
                 case "yearsbklyl":
                     ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getYearsbklyl).reversed()).collect(Collectors.toList());
+                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDaysbklyl).reversed()).collect(Collectors.toList());
                     for (int i = 0; i < ls.size(); i++) {
                         ProEconEquipmentInfoDayTop po = ls.get(i);
                         po.setMonthsbklyl((double) (i + 1));
                     }
                     break;
                 case "daydxkyxs":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDaydxkyxs).reversed()).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthdxkyxs((double) (i + 1));
-                    }
-                    break;
                 case "monthdxkyxs":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getMonthdxkyxs).reversed()).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthdxkyxs((double) (i + 1));
-                    }
-                    break;
                 case "yeardxkyxs":
                     ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getYeardxkyxs).reversed()).collect(Collectors.toList());
+                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDaydxkyxs).reversed()).collect(Collectors.toList());
                     for (int i = 0; i < ls.size(); i++) {
                         ProEconEquipmentInfoDayTop po = ls.get(i);
                         po.setMonthdxkyxs((double) (i + 1));
                     }
                     break;
                 case "dayyxfss":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDayyxfss).reversed()).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthyxfss((double) (i + 1));
-                    }
-                    break;
                 case "monthyxfss":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getMonthyxfss).reversed()).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthyxfss((double) (i + 1));
-                    }
-                    break;
                 case "yearyxfss":
                     ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getYearyxfss).reversed()).collect(Collectors.toList());
+                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDayyxfss).reversed()).collect(Collectors.toList());
                     for (int i = 0; i < ls.size(); i++) {
                         ProEconEquipmentInfoDayTop po = ls.get(i);
                         po.setMonthyxfss((double) (i + 1));
                     }
                     break;
                 case "dayxfqr":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDayxfqr)).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthxfqr((double) (i + 1));
-                    }
-                    break;
                 case "monthxfqr":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getMonthxfqr)).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthxfqr((double) (i + 1));
-                    }
-                    break;
                 case "yearxfqr":
                     ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getYearxfqr)).collect(Collectors.toList());
+                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDayxfqr)).collect(Collectors.toList());
                     for (int i = 0; i < ls.size(); i++) {
                         ProEconEquipmentInfoDayTop po = ls.get(i);
                         po.setMonthxfqr((double) (i + 1));
                     }
                     break;
                 case "dayjfpl":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDayjfpl)).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthjfpl((double) (i + 1));
-                    }
-                    break;
                 case "monthjfpl":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getMonthjfpl)).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthjfpl((double) (i + 1));
-                    }
-                    break;
                 case "yearjfpl":
                     ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getYearjfpl)).collect(Collectors.toList());
+                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDayjfpl)).collect(Collectors.toList());
                     for (int i = 0; i < ls.size(); i++) {
                         ProEconEquipmentInfoDayTop po = ls.get(i);
                         po.setMonthjfpl((double) (i + 1));
                     }
                     break;
                 case "dayglyzxxs":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDayglyzxxs)).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthglyzxxs((double) (i + 1));
-                    }
-                    break;
                 case "monthglyzxxs":
-                    ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getMonthglyzxxs)).collect(Collectors.toList());
-                    for (int i = 0; i < ls.size(); i++) {
-                        ProEconEquipmentInfoDayTop po = ls.get(i);
-                        po.setMonthglyzxxs((double) (i + 1));
-                    }
-                    break;
                 case "yearglyzxxs":
                     ls = topls.stream()
-                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getYearglyzxxs)).collect(Collectors.toList());
+                            .sorted(Comparator.comparing(ProEconEquipmentInfoDayTop::getDayglyzxxs)).collect(Collectors.toList());
                     for (int i = 0; i < ls.size(); i++) {
                         ProEconEquipmentInfoDayTop po = ls.get(i);
                         po.setMonthglyzxxs((double) (i + 1));
@@ -1059,36 +938,25 @@ public class EquipmentInfoDayTopService {
         filedls.add("dayxnssdl");
 
 
-
-
         filedls.add("daylyxs");
 
 
-
-
         filedls.add("daynhyd");
 
 
-
-
         filedls.add("daysbklyl");
 
 
-
         filedls.add("daydxkyxs");
 
 
 
-
         filedls.add("dayyxfss");
 
 
-
         filedls.add("dayxfqr");
 
 
-
-
         filedls.add("dayjfpl");
 
 

File diff suppressed because it is too large
+ 1508 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPut2Service.java


+ 233 - 13
realtime/generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPutService.java

@@ -1,13 +1,15 @@
 package com.gyee.generation.service;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.vo.StatusValue;
 import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.IProEconInOrOutSpeedTotal2Service;
 import com.gyee.generation.service.auto.IProEconInOrOutSpeedTotalService;
 import com.gyee.generation.service.auto.IProEconInputOrOutputSpeedService;
-import com.gyee.generation.task.thread.InputOrOutPutkThread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
@@ -42,29 +44,247 @@ public class InputOrOutPutService {
 
     public void inputOrOutputSpeed(Date recordDate) throws Exception {
 
-        Date begin = DateUtils.addMinutes(recordDate, -frequency);
+//        Date begin = DateUtils.addSeconds(recordDate, -60);
 //
-//        Date begin = DateUtils.addSeconds(recordDate, -frequency);
+        Date begin = DateUtils.addSeconds(recordDate, -frequency);
         Date end = recordDate;
+        Map<String, ProEconInputOrOutputSpeed> wtTimeStatusMap=new HashMap<>();
+        Map<String,Double> wtLastStatusMap=new HashMap<>();
 
+        QueryWrapper<ProEconInputOrOutputSpeed> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ge("record_date",begin).le("record_date",end);
+        queryWrapper.orderByAsc("record_date");
+        List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list(queryWrapper);
+
+        Map<String, Map<String,ProEconInputOrOutputSpeed>> statusMap=new HashMap<>();
+        if(!recordList.isEmpty())
+        {
+            for(ProEconInputOrOutputSpeed po:recordList)
+            {
+                if(statusMap.containsKey(po.getWindturbineId()))
+                {
+                    Map<String, ProEconInputOrOutputSpeed> map= statusMap.get(po.getWindturbineId());
+                    map.put(String.valueOf(po.getRecordDate().getTime()),po);
+                }else
+                {
+                    Map<String, ProEconInputOrOutputSpeed> map= new HashMap<>();
+                    map.put(String.valueOf(po.getRecordDate().getTime()),po);
+                    statusMap.put(po.getWindturbineId(),map);
+                }
+
+            }
+        }
+        List<ProBasicEquipment> wtls= new ArrayList<>();
+        for(ProBasicPowerstation wp: CacheContext.wpls)
+        {
+            if(wp.getId().contains("FDC") && !wp.getId().contains("MLJ") )
+            {
+                wtls.addAll(CacheContext.wpwtmap.get(wp.getId()));
+            }
+        }
+
+        List<ProEconInputOrOutputSpeed> ls=new ArrayList<>();
+
+
+        List<String> mxztls=new ArrayList<>();
+        List<String> ssfsls=new ArrayList<>();
+        for (ProBasicEquipment wt: wtls)
+        {
+
+            Map<String, ProBasicEquipmentPoint> pointmap= CacheContext.wtpAimap.get(wt.getId());
 
-        for (int i = 0; i < CacheContext.wtls.size(); i++) {
+            ProBasicEquipmentPoint mxzt= pointmap.get(ContantXk.SBZT);
+            mxztls.add(mxzt.getNemCode());
+            ProBasicEquipmentPoint ssfs= pointmap.get(ContantXk.CJ_SSFS);
+            ssfsls.add(ssfs.getNemCode());
+        }
+
+        Calendar c=Calendar.getInstance();
+        c.setTime(recordDate);
+        c.add(Calendar.SECOND,-1);
+
+        List<PointData> mxztlastvaluels = edosUtil.getHistMatrix(mxztls,c.getTime().getTime()/1000);
+        List<PointData> mxztvaluels = edosUtil.getRealData(mxztls);
+        List<PointData> ssfsvaluels = edosUtil.getRealData(ssfsls);
+
+        if(ssfsvaluels.size() == mxztlastvaluels.size() && ssfsvaluels.size() == mxztvaluels.size() && ssfsvaluels.size()==wtls.size())
+        {
+            for (int i=0;i<wtls.size();i++)
             {
-                ProBasicEquipment wt = CacheContext.wtls.get(i);
-                if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
-                    continue;
+                ProBasicEquipment wt=wtls.get(i);
+
+                double lastStatus=StringUtils.round(mxztlastvaluels.get(i).getPointValueInDouble(),0);
+                double status=StringUtils.round(mxztvaluels.get(i).getPointValueInDouble(),0);
+                PointData ssfspo=ssfsvaluels.get(i);
+                //     切入切出风速
+                if (lastStatus == StatusValue.DJ.getCode() && status == StatusValue.YX.getCode())
+                {
+                    ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
+
+                    input.setWindturbineId(wt.getId());
+                    input.setWindpowerstationId(wt.getWindpowerstationId());
+                    input.setProjectId(wt.getProjectId());
+                    input.setLineId(wt.getLineId());
+                    input.setRecordDate(new Date());
+                    input.setInputOrOutput(1);
+
+
+                    input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
+
+
+                    if(statusMap.containsKey(wt.getId()))
+                    {
+                        Map<String, ProEconInputOrOutputSpeed> map= statusMap.get(wt.getId());
+
+                        if(!map.containsKey(String.valueOf(ssfspo.getPointTime())) )
+                        {
+                            ls.add(input);
+                        }
+                    }
+
+                }
+                else if (lastStatus == StatusValue.YX.getCode() && status== StatusValue.DJ.getCode())
+                {
+                    ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
+                    input.setWindturbineId(wt.getId());
+                    input.setWindpowerstationId(wt.getWindpowerstationId());
+                    input.setProjectId(wt.getProjectId());
+                    input.setLineId(wt.getLineId());
+                    input.setRecordDate(new Date());
+                    input.setInputOrOutput(0);
+
+                    input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
+
+                    if(statusMap.containsKey(wt.getId()))
+                    {
+                        Map<String, ProEconInputOrOutputSpeed> map= statusMap.get(wt.getId());
+
+                        if(!map.containsKey(String.valueOf(ssfspo.getPointTime())) )
+                        {
+                            ls.add(input);
+                        }
+                    }
                 }
+            }
+        }
+//        for (ProBasicEquipment wt: wtls) {
+//            {
+//
+////                if (wt.getWindpowerstationId().contains(WpType.GDC.id)) {
+////                    continue;
+////                }
+//                Map<String, ProBasicEquipmentPoint> pointmap= CacheContext.wtpAimap.get(wt.getId());
+//
+//
+//                if(statusMap.containsKey(wt.getId()))
+//                {
+//                    wtTimeStatusMap=statusMap.get(wt.getId());
+//                }
+//
+//                double lastStatus=-1;
+//
+//
+//                ProBasicEquipmentPoint mxzt= pointmap.get(ContantXk.SBZT);
+//                ProBasicEquipmentPoint ssfs= pointmap.get(ContantXk.CJ_SSFS);
+//
+//                //获取5分钟没个间隔1秒钟,保证状态与时序库保持一致
+//                List<PointData> statusls = edosUtil.getHistoryDatasSnap(mxzt.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000,null,1L);
+//                List<PointData> ssfsls = edosUtil.getHistoryDatasSnap(ssfs.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000,null,1L);
+//
+//
+//                if(!statusls.isEmpty() && !ssfsls.isEmpty() && ssfsls.size()==statusls.size())
+//                {
+//
+//                    for(int i=0;i<statusls.size();i++)
+//                    {
+//
+//
+//                        if(wtLastStatusMap.containsKey(wt.getId()))
+//                        {
+//                            lastStatus=wtLastStatusMap.get(wt.getId());
+//                        }
+//
+//                        PointData statuspo=statusls.get(i);
+//                        PointData ssfspo=ssfsls.get(i);
+//                        double status= StringUtils.round(statuspo.getPointValueInDouble(),0);
+//
+//                        if(i==0)
+//                        {
+//                            lastStatus=status;
+//                        }
+//                        if (!Objects.equals(lastStatus, status))
+//                        {
+//
+//                            //     切入切出风速
+//                            if (lastStatus == 0 && status == 1)
+//                            {
+//                                ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
+//
+//                                input.setWindturbineId(wt.getId());
+//                                input.setWindpowerstationId(wt.getWindpowerstationId());
+//                                input.setProjectId(wt.getProjectId());
+//                                input.setLineId(wt.getLineId());
+//                                input.setRecordDate(new Date());
+//                                input.setInputOrOutput(1);
+//
+//
+//                                input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
+//
+//                                if(!wtTimeStatusMap.containsKey(String.valueOf(statuspo.getPointTime())) && !wtTimeStatusMap.get(String.valueOf(statuspo.getPointTime())).getWindturbineId().equals(wt.getId()))
+//                                {
+//                                    //roEconInputOrOutputSpeedService.save(input);
+//                                    ls.add(input);
+//                                }
+//                                lastStatus=status;
+//
+//                            }
+//                            else if (lastStatus == 1 && status== 0)
+//                            {
+//                                ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
+//                                input.setWindturbineId(wt.getId());
+//                                input.setWindpowerstationId(wt.getWindpowerstationId());
+//                                input.setProjectId(wt.getProjectId());
+//                                input.setLineId(wt.getLineId());
+//                                input.setRecordDate(new Date());
+//                                input.setInputOrOutput(0);
+//
+//                                input.setSpeed(StringUtils.round(ssfspo.getPointValueInDouble(),2));
+//
+//                                if(!wtTimeStatusMap.containsKey(String.valueOf(statuspo.getPointTime())) && !wtTimeStatusMap.get(String.valueOf(statuspo.getPointTime())).getWindturbineId().equals(wt.getId()))
+//                                {
+//                                    //proEconInputOrOutputSpeedService.save(input);
+//
+//                                    ls.add(input);
+//                                }
+//                                lastStatus=status;
+//                            }
+//
+//                            wtLastStatusMap.put(wt.getId(), status);
+//
+//                        }
+//                    }
+//
+//
 //
-//                try {
-//                    Thread.sleep(100);
-//                } catch (InterruptedException e1) {
-//                    e1.printStackTrace();
 //                }
-                new Thread(new InputOrOutPutkThread(executor,  wt,  begin, end,proEconInputOrOutputSpeedService, edosUtil)).start();
+//
+//            }
+//
+//        System.out.println("切入切出数量"+ls.size());
+            List<ProEconInputOrOutputSpeed> templs = new ArrayList<>();
+            for (ProEconInputOrOutputSpeed vo : ls) {
+                templs.add(vo);
+                if (templs.size() == 100) {
+                    proEconInputOrOutputSpeedService.saveBatch(templs);
+                    templs = new ArrayList<>();
+                }
+            }
 
+            if (!templs.isEmpty()) {
+                proEconInputOrOutputSpeedService.saveBatch(templs);
             }
 
-        }
+//        }
 
     }
 

File diff suppressed because it is too large
+ 144 - 1087
realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitEventService.java


File diff suppressed because it is too large
+ 1036 - 91
realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitEventnewService.java


+ 171 - 10
realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeGfService.java

@@ -285,7 +285,24 @@ public class PowerCurveFittingByTimeGfService {
             subls.add(pLCBuild(key, recordDate, windMap, modelpower, 12, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints));
             subls.add(pLCBuild(key, recordDate, windMap, modelpower, 13, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints));
 
-            proEconCurveFittingSubService.saveBatch(subls);
+
+
+            List<ProEconCurveFittingSub> templs=new ArrayList<>();
+            for(ProEconCurveFittingSub vo:subls)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconCurveFittingSubService.saveOrUpdateBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
+
+            if(!templs.isEmpty())
+            {
+                proEconCurveFittingSubService.saveOrUpdateBatch(templs);
+            }
+//            proEconCurveFittingSubService.saveBatch(subls);
 
             insertPoints(recordDate,  windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), key);
 
@@ -295,7 +312,24 @@ public class PowerCurveFittingByTimeGfService {
 
 
         }
-        proEconCurveFittingMainService.saveBatch(mainls);
+
+
+        List<ProEconCurveFittingMain> templs=new ArrayList<>();
+        for(ProEconCurveFittingMain vo:mainls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconCurveFittingMainService.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconCurveFittingMainService.saveOrUpdateBatch(templs);
+        }
+//        proEconCurveFittingMainService.saveBatch(mainls);
     }
 
     public void cureFittingMonth(Date recordDate,String type) throws Exception {
@@ -542,7 +576,22 @@ public class PowerCurveFittingByTimeGfService {
             subls.add(pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 12, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints));
             subls.add(pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 13, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints));
 
-            proEconCurveFittMonthSubService.saveBatch(subls);
+            List<ProEconCurveFittMonthSub> templs=new ArrayList<>();
+            for(ProEconCurveFittMonthSub vo:subls)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconCurveFittMonthSubService.saveOrUpdateBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
+
+            if(!templs.isEmpty())
+            {
+                proEconCurveFittMonthSubService.saveOrUpdateBatch(templs);
+            }
+//            proEconCurveFittMonthSubService.saveBatch(subls);
             insertPoints(stringyear, stringmonth, windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), key);
 
             if(type.equals("1"))
@@ -555,7 +604,23 @@ public class PowerCurveFittingByTimeGfService {
 
 
         }
-        proEconCurveFittMonthMainService.saveBatch(mainls);
+
+        List<ProEconCurveFittMonthMain> templs=new ArrayList<>();
+        for(ProEconCurveFittMonthMain vo:mainls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconCurveFittMonthMainService.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconCurveFittMonthMainService.saveOrUpdateBatch(templs);
+        }
+//        proEconCurveFittMonthMainService.saveBatch(mainls);
 
         logger.info("曲线保存完成!");
     }
@@ -823,7 +888,24 @@ public class PowerCurveFittingByTimeGfService {
             subls.add(pLCBuild(key, stringyear, windMap, modelpower, 12, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints));
             subls.add(pLCBuild(key, stringyear, windMap, modelpower, 13, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints));
 
-            proEconCurveFittYearSubService.saveBatch(subls);
+
+            List<ProEconCurveFittYearSub> templs=new ArrayList<>();
+            for(ProEconCurveFittYearSub vo:subls)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconCurveFittYearSubService.saveOrUpdateBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
+
+            if(!templs.isEmpty())
+            {
+                proEconCurveFittYearSubService.saveOrUpdateBatch(templs);
+            }
+
+//            proEconCurveFittYearSubService.saveBatch(subls);
             insertPoints(stringyear, windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), key);
 
             logger.info(key);
@@ -832,7 +914,24 @@ public class PowerCurveFittingByTimeGfService {
 
 
         }
-        proEconCurveFittYearMainService.saveBatch(mainls);
+
+        List<ProEconCurveFittYearMain> templs=new ArrayList<>();
+        for(ProEconCurveFittYearMain vo:mainls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconCurveFittYearMainService.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconCurveFittYearMainService.saveOrUpdateBatch(templs);
+        }
+
+//        proEconCurveFittYearMainService.saveBatch(mainls);
     }
 
 
@@ -1063,7 +1162,23 @@ public class PowerCurveFittingByTimeGfService {
             }
             //*********************************************当日曲线偏差记录**********************************************************/
         }
-        proEconWtCurveFittingService.saveBatch(wtcfls);
+
+        List<ProEconWtCurveFitting> templs=new ArrayList<>();
+        for(ProEconWtCurveFitting vo:wtcfls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconWtCurveFittingService.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconWtCurveFittingService.saveOrUpdateBatch(templs);
+        }
+//        proEconWtCurveFittingService.saveBatch(wtcfls);
         String s = JSONObject.toJSONString(wtcfls);
         redisService.set(CurveType.dayCurve.id+"_"+windturbineId, s);
 
@@ -1142,7 +1257,23 @@ public class PowerCurveFittingByTimeGfService {
         }
         //*********************************************当月曲线偏差记录**********************************************************/
 
-        proEconWtCurveFittingMonthService.saveBatch(wtcfls);
+
+        List<ProEconWtCurveFittingMonth> templs=new ArrayList<>();
+        for(ProEconWtCurveFittingMonth vo:wtcfls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconWtCurveFittingMonthService.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconWtCurveFittingMonthService.saveOrUpdateBatch(templs);
+        }
+//        proEconWtCurveFittingMonthService.saveBatch(wtcfls);
         String s = JSONObject.toJSONString(wtcfls);
         redisService.set(CurveType.monthCurve.id+"_"+windturbineId, s);
     }
@@ -1215,7 +1346,22 @@ public class PowerCurveFittingByTimeGfService {
         }
         //*********************************************当年曲线偏差记录**********************************************************/
 
-        proEconWtCurveFittingYearService.saveBatch(wtcfls);
+        List<ProEconWtCurveFittingYear> templs=new ArrayList<>();
+        for(ProEconWtCurveFittingYear vo:wtcfls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconWtCurveFittingYearService.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconWtCurveFittingYearService.saveOrUpdateBatch(templs);
+        }
+//        proEconWtCurveFittingYearService.saveBatch(wtcfls);
         String s = JSONObject.toJSONString(wtcfls);
         redisService.set(CurveType.yearCurve.id+"_"+windturbineId, s);
     }
@@ -1304,7 +1450,22 @@ public class PowerCurveFittingByTimeGfService {
             }
         }
 
-        proEconWtPowerCurveFittingService.saveBatch(wtcfls);
+        List<ProEconWtPowerCurveFitting> templs=new ArrayList<>();
+        for(ProEconWtPowerCurveFitting vo:wtcfls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconWtPowerCurveFittingService.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconWtPowerCurveFittingService.saveOrUpdateBatch(templs);
+        }
+//        proEconWtPowerCurveFittingService.saveBatch(wtcfls);
     }
 
     private void yearBuildPoints(List<ProEconWtCurveFittingYear> data, List<PointVo> points) {

+ 168 - 10
realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeService.java

@@ -285,7 +285,22 @@ public class PowerCurveFittingByTimeService {
             subls.add(pLCBuild(key, recordDate, windMap, modelpower, 12, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints));
             subls.add(pLCBuild(key, recordDate, windMap, modelpower, 13, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints));
 
-            proEconCurveFittingSubService.saveBatch(subls);
+            List<ProEconCurveFittingSub> templs=new ArrayList<>();
+            for(ProEconCurveFittingSub vo:subls)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconCurveFittingSubService.saveBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
+
+            if(!templs.isEmpty())
+            {
+                proEconCurveFittingSubService.saveBatch(templs);
+            }
+//            proEconCurveFittingSubService.saveBatch(subls);
 
             insertPoints(recordDate,  windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), key);
 
@@ -295,7 +310,23 @@ public class PowerCurveFittingByTimeService {
 
 
         }
-        proEconCurveFittingMainService.saveBatch(mainls);
+
+        List<ProEconCurveFittingMain> templs=new ArrayList<>();
+        for(ProEconCurveFittingMain vo:mainls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconCurveFittingMainService.saveBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconCurveFittingMainService.saveBatch(templs);
+        }
+//        proEconCurveFittingMainService.saveBatch(mainls);
     }
 
     public void cureFittingMonth(Date recordDate,String type) throws Exception {
@@ -542,7 +573,23 @@ public class PowerCurveFittingByTimeService {
             subls.add(pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 12, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints));
             subls.add(pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 13, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints));
 
-            proEconCurveFittMonthSubService.saveBatch(subls);
+
+            List<ProEconCurveFittMonthSub> templs=new ArrayList<>();
+            for(ProEconCurveFittMonthSub vo:subls)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconCurveFittMonthSubService.saveBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
+
+            if(!templs.isEmpty())
+            {
+                proEconCurveFittMonthSubService.saveBatch(templs);
+            }
+//            proEconCurveFittMonthSubService.saveBatch(subls);
             insertPoints(stringyear, stringmonth, windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), key);
 
             if(type.equals("1"))
@@ -555,7 +602,23 @@ public class PowerCurveFittingByTimeService {
 
 
         }
-        proEconCurveFittMonthMainService.saveBatch(mainls);
+
+        List<ProEconCurveFittMonthMain> templs=new ArrayList<>();
+        for(ProEconCurveFittMonthMain vo:mainls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconCurveFittMonthMainService.saveBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconCurveFittMonthMainService.saveBatch(templs);
+        }
+//        proEconCurveFittMonthMainService.saveBatch(mainls);
 
         logger.info("曲线保存完成!");
     }
@@ -823,7 +886,23 @@ public class PowerCurveFittingByTimeService {
             subls.add(pLCBuild(key, stringyear, windMap, modelpower, 12, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints));
             subls.add(pLCBuild(key, stringyear, windMap, modelpower, 13, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints));
 
-            proEconCurveFittYearSubService.saveBatch(subls);
+
+            List<ProEconCurveFittYearSub> templs=new ArrayList<>();
+            for(ProEconCurveFittYearSub vo:subls)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconCurveFittYearSubService.saveBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
+
+            if(!templs.isEmpty())
+            {
+                proEconCurveFittYearSubService.saveBatch(templs);
+            }
+//            proEconCurveFittYearSubService.saveBatch(subls);
             insertPoints(stringyear, windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), key);
 
             logger.info(key);
@@ -832,7 +911,23 @@ public class PowerCurveFittingByTimeService {
 
 
         }
-        proEconCurveFittYearMainService.saveBatch(mainls);
+
+        List<ProEconCurveFittYearMain> templs=new ArrayList<>();
+        for(ProEconCurveFittYearMain vo:mainls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconCurveFittYearMainService.saveBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconCurveFittYearMainService.saveBatch(templs);
+        }
+//        proEconCurveFittYearMainService.saveBatch(mainls);
     }
 
 
@@ -1063,7 +1158,23 @@ public class PowerCurveFittingByTimeService {
             }
             //*********************************************当日曲线偏差记录**********************************************************/
         }
-        proEconWtCurveFittingService.saveBatch(wtcfls);
+
+        List<ProEconWtCurveFitting> templs=new ArrayList<>();
+        for(ProEconWtCurveFitting vo:wtcfls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconWtCurveFittingService.saveBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconWtCurveFittingService.saveBatch(templs);
+        }
+//        proEconWtCurveFittingService.saveBatch(wtcfls);
         String s = JSONObject.toJSONString(wtcfls);
         redisService.set(CurveType.dayCurve.id+"_"+windturbineId, s);
 
@@ -1142,7 +1253,22 @@ public class PowerCurveFittingByTimeService {
         }
         //*********************************************当月曲线偏差记录**********************************************************/
 
-        proEconWtCurveFittingMonthService.saveBatch(wtcfls);
+        List<ProEconWtCurveFittingMonth> templs=new ArrayList<>();
+        for(ProEconWtCurveFittingMonth vo:wtcfls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconWtCurveFittingMonthService.saveBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconWtCurveFittingMonthService.saveBatch(templs);
+        }
+//        proEconWtCurveFittingMonthService.saveBatch(wtcfls);
         String s = JSONObject.toJSONString(wtcfls);
         redisService.set(CurveType.monthCurve.id+"_"+windturbineId, s);
     }
@@ -1215,7 +1341,23 @@ public class PowerCurveFittingByTimeService {
         }
         //*********************************************当年曲线偏差记录**********************************************************/
 
-        proEconWtCurveFittingYearService.saveBatch(wtcfls);
+
+        List<ProEconWtCurveFittingYear> templs=new ArrayList<>();
+        for(ProEconWtCurveFittingYear vo:wtcfls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconWtCurveFittingYearService.saveBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconWtCurveFittingYearService.saveBatch(templs);
+        }
+//        proEconWtCurveFittingYearService.saveBatch(wtcfls);
         String s = JSONObject.toJSONString(wtcfls);
         redisService.set(CurveType.yearCurve.id+"_"+windturbineId, s);
     }
@@ -1304,7 +1446,23 @@ public class PowerCurveFittingByTimeService {
             }
         }
 
-        proEconWtPowerCurveFittingService.saveBatch(wtcfls);
+
+        List<ProEconWtPowerCurveFitting> templs=new ArrayList<>();
+        for(ProEconWtPowerCurveFitting vo:wtcfls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconWtPowerCurveFittingService.saveBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconWtPowerCurveFittingService.saveBatch(templs);
+        }
+//        proEconWtPowerCurveFittingService.saveBatch(wtcfls);
     }
 
     private void yearBuildPoints(List<ProEconWtCurveFittingYear> data, List<PointVo> points) {

File diff suppressed because it is too large
+ 505 - 565
realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownService.java


+ 432 - 272
realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownnewService.java

@@ -1,21 +1,21 @@
 package com.gyee.generation.service;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.vo.StatusDetailValue;
 import com.gyee.generation.service.auto.IProEconInterruptionService;
 import com.gyee.generation.service.auto.IProEconShutdownEvent2Service;
 import com.gyee.generation.service.auto.IProEconShutdownEventService;
 import com.gyee.generation.service.auto.IProEconWindturbineStatusService;
-import com.gyee.generation.task.thread.ShutdownnewThread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -40,20 +40,10 @@ public class ShutdownnewService {
     private IProEconShutdownEvent2Service proEconShutdownEvent2Service;
     @Resource
     private IProEconInterruptionService proEconInterruptionService;
-    @Value("${frequency.shutdown}")
-    private Integer frequency;
 
 
     public static Logger logger = LoggerFactory.getLogger(ShutdownnewService.class);
-    /// 风机状态说明,key为状态码,value为状态说明
-    public Map<Integer, String> statusDescriptionMap = new HashMap<>();
-    /// 风机当前状态,key为风机编号
-    public Map<String, List<PointData>> statusMap = new HashMap<>();
 
-    Map<String, ProEconWindturbineStatus> oldStatusMap = new HashMap<>();
-    Map<String, ProEconShutdownEvent> oldShutdownEvent = new HashMap<>();
-    Map<String, ProEconInterruption> oldInterrup = new HashMap<>();
-    Map<String, ProEconShutdownEvent2> oldShutdownEvent2 = new HashMap<>();
 
     @Resource
     private Executor executor;
@@ -61,313 +51,492 @@ public class ShutdownnewService {
 
     public void execShutdown(Date recordDate) throws Exception {
 
-        Date begin = DateUtils.addMinutes(recordDate, -frequency);
-
-
-        Date end = recordDate;
-        oldStatusMap.clear();
-        oldShutdownEvent.clear();
-        oldInterrup.clear();
-        oldShutdownEvent2.clear();
-
-        statusDescriptionMap.put(0, "待机");
-        statusDescriptionMap.put(1, "手动停机");
-        statusDescriptionMap.put(2, "正常发电");
-        statusDescriptionMap.put(3, "缺陷降出力");
-        statusDescriptionMap.put(4, "故障停机");
-        statusDescriptionMap.put(5, "故障受累");
-        statusDescriptionMap.put(6, "检修停机");
-        statusDescriptionMap.put(7, "检修受累");
-        statusDescriptionMap.put(8, "限电降出力");
-        statusDescriptionMap.put(9, "限电停机");
-        statusDescriptionMap.put(10, "电网受累");
-        statusDescriptionMap.put(11, "环境受累");
-        statusDescriptionMap.put(12, "通讯中断");
-        statusDescriptionMap.put(13, "设备离线");
-
-        for (ProBasicEquipment wt : CacheContext.wtls)
-        {
-//            Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(wt.getId());
-//
-//            //取实时状态数据 赋值给status
-//
-//            if(windturbinetestingpointnewMap.containsKey(ContantXk.MXZT))
-//            {
-//                ProBasicEquipmentPoint mxztPoint = windturbinetestingpointnewMap.get(ContantXk.MXZT);
-//                //获取5分钟没个间隔1秒钟,保证状态与时序库保持一致
-//                List<PointData> statusls = edosUtil.getHistoryDatasSnap(mxztPoint.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000,null,1L);
-//
-//                statusMap.put(wt.getId(), statusls);
-//            }
-            statusMap.put(wt.getId(), null);
+        List<String> wtStatusIdLs = new ArrayList<>();
+
+        Map<String, PointData> wtStatusMap = new HashMap<>();
+
+
+        Map<String, ProEconWindturbineStatus> oldStatusMap = new HashMap<>();
+        Map<String, ProEconShutdownEvent> oldShutdownEvent = new HashMap<>();
+        Map<String, ProEconInterruption> oldInterrup = new HashMap<>();
+        Map<String, ProEconShutdownEvent2> oldShutdownEvent2 = new HashMap<>();
+
+        List<ProBasicEquipment> wtls = new ArrayList<>();
+        for (ProBasicEquipment wt : CacheContext.wtls) {
+
+            if (wt.getWindpowerstationId().contains("GDC")) {
+                continue;
+            }
+
+            wtls.add(wt);
+        }
+        for (ProBasicEquipment wt : wtls) {
+            Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(wt.getId());
+
+            //取实时状态数据 赋值给status
+
+            if (windturbinetestingpointnewMap.containsKey(ContantXk.MXZT)) {
+                ProBasicEquipmentPoint mxztPoint = windturbinetestingpointnewMap.get(ContantXk.MXZT);
+                wtStatusIdLs.add(mxztPoint.getNemCode());
+            }
+
             //初始化将所有风机编号作为key,value全部赋值为null
             oldStatusMap.put(wt.getId(), null);
             oldShutdownEvent.put(wt.getId(), null);
             oldInterrup.put(wt.getId(), null);
             oldShutdownEvent2.put(wt.getId(), null);
         }
+
+        List<PointData> wtStatusLs = edosUtil.getHistMatrix(wtStatusIdLs,recordDate.getTime()/1000);
+
+        if (wtStatusLs.size() == wtls.size()) {
+
+            for (int i = 0; i < wtls.size(); i++) {
+
+                ProBasicEquipment wt = wtls.get(i);
+
+                wtStatusMap.put(wt.getId(), wtStatusLs.get(i));
+
+            }
+        }
 //******************************************************************************************************/
 
         //读取数据库存在的恢复时间为NULL的数据,并通过风机编号把数据遍历到对应的map
         QueryWrapper<ProEconWindturbineStatus> queryWrapper = new QueryWrapper<>();
         queryWrapper.isNull("start_Time");
-        List<ProEconWindturbineStatus> oldStatusQuery=proEconWindturbineStatusService.list(queryWrapper).stream()
-//                .filter(i->StringUtils.empty(i.getStartTime()))
-                .sorted(Comparator.comparing(ProEconWindturbineStatus::getStopTime)).collect(Collectors.toList());
-
-        for (ProEconWindturbineStatus oldStatus : oldStatusQuery)
-        {
-            if (oldStatusMap.containsKey(oldStatus.getWindturbineId()))
-            {
-                oldStatusMap.put(oldStatus.getWindturbineId(),oldStatus);
+        queryWrapper.orderByDesc("stop_Time");
+        List<ProEconWindturbineStatus> oldStatusQuery = proEconWindturbineStatusService.list(queryWrapper).stream().collect(Collectors.toList());
+
+        for (ProEconWindturbineStatus oldStatus : oldStatusQuery) {
+            if (oldStatusMap.containsKey(oldStatus.getWindturbineId())) {
+                oldStatusMap.put(oldStatus.getWindturbineId(), oldStatus);
             }
         }
         QueryWrapper<ProEconShutdownEvent> queryWrapper2 = new QueryWrapper<>();
         queryWrapper2.isNull("start_Time");
-        List<ProEconShutdownEvent> oldShutdwonQuery=proEconShutdownEventService.list(queryWrapper2).stream()
-//                .filter(i->StringUtils.empty(i.getStartTime()))
-                .sorted(Comparator.comparing(ProEconShutdownEvent::getStopTime)).collect(Collectors.toList());
-
-        for (ProEconShutdownEvent shutdown : oldShutdwonQuery)
-        {
-            if (oldShutdownEvent.containsKey(shutdown.getWindturbineId()))
-            {
-                oldShutdownEvent.put(shutdown.getWindturbineId(),shutdown);
+        queryWrapper2.orderByDesc("stop_Time");
+        List<ProEconShutdownEvent> oldShutdwonQuery = proEconShutdownEventService.list(queryWrapper2).stream().collect(Collectors.toList());
+
+        for (ProEconShutdownEvent shutdown : oldShutdwonQuery) {
+            if (oldShutdownEvent.containsKey(shutdown.getWindturbineId())) {
+                oldShutdownEvent.put(shutdown.getWindturbineId(), shutdown);
             }
         }
+
         QueryWrapper<ProEconInterruption> queryWrapper3 = new QueryWrapper<>();
         queryWrapper3.isNull("start_Time");
-        List<ProEconInterruption> oldInterrupQuery=proEconInterruptionService.list(queryWrapper3).stream()
-//                .filter(i->StringUtils.empty(i.getStartTime()))
-                .sorted(Comparator.comparing(ProEconInterruption::getStopTime)).collect(Collectors.toList());
-
-        for (ProEconInterruption interrup : oldInterrupQuery)
-        {
-            if (oldInterrup.containsKey(interrup.getWindturbineId()))
-            {
-                oldInterrup.put(interrup.getWindturbineId(),interrup);
+        queryWrapper3.orderByDesc("stop_Time");
+        List<ProEconInterruption> oldInterrupQuery = proEconInterruptionService.list(queryWrapper3).stream().collect(Collectors.toList());
+
+        for (ProEconInterruption interrup : oldInterrupQuery) {
+            if (oldInterrup.containsKey(interrup.getWindturbineId())) {
+                oldInterrup.put(interrup.getWindturbineId(), interrup);
             }
         }
         QueryWrapper<ProEconShutdownEvent2> queryWrapper4 = new QueryWrapper<>();
         queryWrapper4.isNull("start_Time");
-        List<ProEconShutdownEvent2> oldShutdwonQuery2=proEconShutdownEvent2Service.list(queryWrapper4).stream()
-//                .filter(i->StringUtils.empty(i.getStartTime()))
-                .sorted(Comparator.comparing(ProEconShutdownEvent2::getStopTime)).collect(Collectors.toList());
-
-        for (ProEconShutdownEvent2 shutdown : oldShutdwonQuery2)
-        {
-            if (oldShutdownEvent2.containsKey(shutdown.getWindturbineId()))
-            {
+        queryWrapper4.orderByDesc("stop_Time");
+        List<ProEconShutdownEvent2> oldShutdwonQuery2 = proEconShutdownEvent2Service.list(queryWrapper4).stream().collect(Collectors.toList());
 
-
-                oldShutdownEvent2.put(shutdown.getWindturbineId(),shutdown);
+        for (ProEconShutdownEvent2 shutdown : oldShutdwonQuery2) {
+            if (oldShutdownEvent2.containsKey(shutdown.getWindturbineId())) {
+                oldShutdownEvent2.put(shutdown.getWindturbineId(), shutdown);
             }
         }
 //******************************************************************************************************/
+
+        List<ProEconShutdownEvent> updateProEconShutdownEventls = new ArrayList<>();
+        List<ProEconShutdownEvent2> updateProEconShutdownEvent2ls = new ArrayList<>();
+        List<ProEconInterruption> updateProEconInterruptionls = new ArrayList<>();
+        List<ProEconWindturbineStatus> updateProEconWindturbineStatusls = new ArrayList<>();
+
+        List<ProEconShutdownEvent> insertProEconShutdownEventls = new ArrayList<>();
+        List<ProEconShutdownEvent2> insertProEconShutdownEvent2ls = new ArrayList<>();
+        List<ProEconInterruption> insertProEconInterruptionls = new ArrayList<>();
+        List<ProEconWindturbineStatus> insertProEconWindturbineStatusls = new ArrayList<>();
         //遍历PG数据库中存在的记录,恢复时间为空的集合
-        for (String windturbineId : oldStatusMap.keySet())
-        {
-//            try {
-//                Thread.sleep(100);
-//            } catch (InterruptedException e1) {
-//                e1.printStackTrace();
-//            }
-            new Thread(new ShutdownnewThread(executor,  oldStatusMap,  statusMap,  windturbineId,
-                     statusDescriptionMap,  oldShutdownEvent,
-                    oldInterrup,  oldShutdownEvent2,begin,  end,edosUtil,proEconWindturbineStatusService,
-                    proEconShutdownEventService, proEconShutdownEvent2Service,
-                    proEconInterruptionService)).start();
+        for (String wtId : oldStatusMap.keySet()) {
+
+            ProEconShutdownEvent shutdwonEvent = null;
+            ProEconInterruption interrup = null;
+            ProEconShutdownEvent2 shutdwonEvent2 = null;
+            ProEconWindturbineStatus item = null;
+
+            if (oldStatusMap.containsKey(wtId)) {
+                item = oldStatusMap.get(wtId);
+            }
+            if (oldShutdownEvent.containsKey(wtId)) {
+                shutdwonEvent = oldShutdownEvent.get(wtId);
+            }
+            if (oldShutdownEvent2.containsKey(wtId)) {
+                shutdwonEvent2 = oldShutdownEvent2.get(wtId);
+            }
+            if (oldInterrup.containsKey(wtId)) {
+                interrup = oldInterrup.get(wtId);
+            }
+
+            if (wtStatusMap.containsKey(wtId)) {
+                if(wtId.equals("SXJ_KGDL_PTZ_F_WT_0022_EQ"))
+                {
+                    System.out.println("");
+                }
+                PointData wtPoint = wtStatusMap.get(wtId);
+                //获取当前时间
+                Date currentTime = recordDate;
+                if (StringUtils.empty(item)) {
+                    item = new ProEconWindturbineStatus();
+                    initalWindturbineStatus(insertProEconWindturbineStatusls, wtId, wtStatusMap, currentTime, item);
+                } else if (StringUtils.notEmp(item) && wtPoint.getPointValueInDouble() != item.getSatusCode()) {
+                    finishWindturbineStatus(updateProEconWindturbineStatusls, wtId, currentTime, item);
+
+                }
+
+                if (wtPoint.getPointValueInDouble() == StatusDetailValue.TXZD.getCode()) {
+                    if (StringUtils.empty(interrup)) {
+                        interrup = new ProEconInterruption();
+                        initalInterruption(insertProEconInterruptionls, wtId, currentTime, interrup);
+                    }
+                } else  if (StringUtils.notEmp(interrup)) {
+
+                    finishInterruption(updateProEconInterruptionls, wtId, currentTime, interrup);
+
+                }
+
+                if (wtPoint.getPointValueInDouble() == StatusDetailValue.GZ.getCode()) {
+                    if (StringUtils.empty(shutdwonEvent)) {
+                        shutdwonEvent = new ProEconShutdownEvent();
+                        initalShutdownEvent(insertProEconShutdownEventls, wtId, wtStatusMap, currentTime, shutdwonEvent);
+                    }
+                    if (StringUtils.empty(shutdwonEvent2)) {
+                        shutdwonEvent2 = new ProEconShutdownEvent2();
+                        initalShutdownEvent2(insertProEconShutdownEvent2ls, wtId, wtStatusMap, currentTime, shutdwonEvent2);
+                    }
+                } else {
+                    if (StringUtils.notEmp(shutdwonEvent)  && shutdwonEvent.getStatusCode()!=wtPoint.getPointValueInDouble())
+                    {
+                        finishShutdownEvent(updateProEconShutdownEventls, wtId, wtStatusMap, currentTime, shutdwonEvent);
+                    }
+                    if (StringUtils.notEmp(shutdwonEvent2)  && shutdwonEvent.getStatusCode()!=wtPoint.getPointValueInDouble())
+                    {
+                        finishShutdownEvent2(updateProEconShutdownEvent2ls, wtId, wtStatusMap, currentTime, shutdwonEvent2);
+                    }
+
+                }
+
+                if (wtPoint.getPointValueInDouble() == StatusDetailValue.JX.getCode()) {
+                    if (StringUtils.empty(shutdwonEvent)) {
+                        shutdwonEvent = new ProEconShutdownEvent();
+                        initalShutdownEvent(insertProEconShutdownEventls, wtId, wtStatusMap, currentTime, shutdwonEvent);
+                    }
+                    if (StringUtils.empty(shutdwonEvent2)) {
+                        shutdwonEvent2 = new ProEconShutdownEvent2();
+                        initalShutdownEvent2(insertProEconShutdownEvent2ls, wtId, wtStatusMap, currentTime, shutdwonEvent2);
+                    }
+                } else {
+                    if (StringUtils.notEmp(shutdwonEvent) && shutdwonEvent.getStatusCode()!=wtPoint.getPointValueInDouble())
+                    {
+                        finishShutdownEvent(updateProEconShutdownEventls, wtId, wtStatusMap, currentTime, shutdwonEvent);
+                    }
+                    if (StringUtils.notEmp(shutdwonEvent2)  && shutdwonEvent.getStatusCode()!=wtPoint.getPointValueInDouble())
+                    {
+                        finishShutdownEvent2(updateProEconShutdownEvent2ls, wtId, wtStatusMap, currentTime, shutdwonEvent2);
+                    }
+
+                }
+            }
+
+        }
+
+
+        for (ProEconShutdownEvent vo : updateProEconShutdownEventls) {
+            UpdateWrapper<ProEconShutdownEvent> updateWrapper = new UpdateWrapper<>();
+//            updateWrapper.set("start_time", vo.getStartTime());
+//            updateWrapper.set("loss_power", vo.getLossPower());
+//            updateWrapper.set("stop_hours", vo.getStopHours());
+            proEconShutdownEventService.update(vo, updateWrapper);
+        }
+
+        for (ProEconShutdownEvent2 vo : updateProEconShutdownEvent2ls) {
+            UpdateWrapper<ProEconShutdownEvent2> updateWrapper = new UpdateWrapper<>();
+//            updateWrapper.set("start_time", vo.getStartTime());
+//            updateWrapper.set("loss_power", vo.getLossPower());
+//            updateWrapper.set("stop_hours", vo.getStopHours());
+            proEconShutdownEvent2Service.update(vo, updateWrapper);
+        }
+        for (ProEconWindturbineStatus vo : updateProEconWindturbineStatusls) {
+            UpdateWrapper<ProEconWindturbineStatus> updateWrapper = new UpdateWrapper<>();
+//            updateWrapper.set("start_time", vo.getStartTime());
+//            updateWrapper.set("loss_power", vo.getLossPower());
+//            updateWrapper.set("stop_hours", vo.getStopHours());
+            proEconWindturbineStatusService.update(vo, updateWrapper);
+        }
 
+        for (ProEconInterruption vo : updateProEconInterruptionls) {
+            UpdateWrapper<ProEconInterruption> updateWrapper = new UpdateWrapper<>();
+//            updateWrapper.set("start_time", vo.getStartTime());
+//            updateWrapper.set("stop_hours", vo.getStopHours());
+            proEconInterruptionService.update(vo, updateWrapper);
+        }
+
+        List<ProEconWindturbineStatus> temp1ls = new ArrayList<>();
+        for (ProEconWindturbineStatus vo : insertProEconWindturbineStatusls) {
+            temp1ls.add(vo);
+            if (temp1ls.size() == 100) {
+                proEconWindturbineStatusService.saveBatch(temp1ls);
+                temp1ls = new ArrayList<>();
+            }
+        }
+
+        if (!temp1ls.isEmpty()) {
+            proEconWindturbineStatusService.saveBatch(temp1ls);
+        }
+        List<ProEconInterruption> temp2ls = new ArrayList<>();
+        for (ProEconInterruption vo : insertProEconInterruptionls) {
+            temp2ls.add(vo);
+            if (temp2ls.size() == 100) {
+                proEconInterruptionService.saveBatch(temp2ls);
+                temp2ls = new ArrayList<>();
+            }
+        }
+
+        if (!temp2ls.isEmpty()) {
+            proEconInterruptionService.saveBatch(temp2ls);
+        }
+        
+        List<ProEconShutdownEvent> temp3ls = new ArrayList<>();
+        for (ProEconShutdownEvent vo : insertProEconShutdownEventls) {
+            temp3ls.add(vo);
+            if (temp3ls.size() == 100) {
+                proEconShutdownEventService.saveBatch(temp3ls);
+                temp3ls = new ArrayList<>();
+            }
+        }
 
+        if (!temp3ls.isEmpty()) {
+            proEconShutdownEventService.saveBatch(temp3ls);
+        }
+        List<ProEconShutdownEvent2> temp4ls = new ArrayList<>();
+        for (ProEconShutdownEvent2 vo : insertProEconShutdownEvent2ls) {
+            temp4ls.add(vo);
+            if (temp4ls.size() == 100) {
+                proEconShutdownEvent2Service.saveBatch(temp4ls);
+                temp4ls = new ArrayList<>();
+            }
         }
 
+        if (!temp4ls.isEmpty()) {
+            proEconShutdownEvent2Service.saveBatch(temp4ls);
+        }
+
+
+
 
 
 //******************************************************************************************************/
 
 
-    }
+}
 
-    private ProEconShutdownEvent finishShutdownEvent(String windturbineId, ProEconShutdownEvent shutdwonEvent, Integer currentStatus, Date currentTime) throws Exception {
-//        if(currentStatus != 4 && currentStatus != 6)
-//        {
-            shutdwonEvent.setStartTime(currentTime);
+    private void finishShutdownEvent(List<ProEconShutdownEvent> updateProEconShutdownEventls,
+                                     String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconShutdownEvent item) throws Exception {
 
-            double timehour=DateUtils.hoursDiff2(shutdwonEvent.getStartTime(), shutdwonEvent.getStopTime());
-            shutdwonEvent.setStopHours(timehour);
-            double losspower=calLossPower(windturbineId, shutdwonEvent.getStartTime(), shutdwonEvent.getStopTime());
-            shutdwonEvent.setLossPower(losspower);
+        if (item.getStatusCode() != wtStatusMap.get(wtId).getPointValueInDouble()) {
+            item.setStartTime(currentTime);
 
+            double timehour = DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
+            item.setStopHours(timehour);
+            double losspower = calLossPower(wtId, item.getStartTime(), item.getStopTime());
+            item.setLossPower(losspower);
+
+
+            updateProEconShutdownEventls.add(item);
+        }
 
-            proEconShutdownEventService.saveOrUpdate(shutdwonEvent);
-            oldShutdownEvent.put(windturbineId,null);
-            shutdwonEvent =null;
-//        }
-        return shutdwonEvent;
     }
 
-    private ProEconInterruption finishInterruption(String windturbineId, ProEconInterruption interrup, Integer currentStatus, Date currentTime) {
-//        if(currentStatus != 12)
-//        {
-            interrup.setStartTime(currentTime);
-            double timehour=DateUtils.hoursDiff2(interrup.getStartTime(), interrup.getStopTime());
-            interrup.setStopHours(timehour);
 
+    private void finishShutdownEvent2(List<ProEconShutdownEvent2> insertProEconShutdownEvent2ls,
+                                      String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconShutdownEvent2 item) throws Exception {
 
-            proEconInterruptionService.saveOrUpdate(interrup);
-            oldInterrup.put(windturbineId,null);
-            interrup =null;
-//        }
-        return interrup;
-    }
+        if (item.getStatusCode() != wtStatusMap.get(wtId).getPointValueInDouble()) {
+            item.setStartTime(currentTime);
 
-    private ProEconShutdownEvent2 finishShutdownEvent2(String windturbineId, ProEconShutdownEvent2 shutdwonEvent2, Integer currentStatus, Date currentTime) throws Exception {
-//        if(currentStatus != 4 && currentStatus != 6)
-//        {
-            shutdwonEvent2.setStartTime(currentTime);
-
-            double timehour=DateUtils.hoursDiff2(shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
-            shutdwonEvent2.setStopHours(timehour);
-            double losspower=calLossPower(windturbineId, shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
-            shutdwonEvent2.setLossPower(losspower);
-
-            if(timehour<=24)
-            {
-                proEconShutdownEvent2Service.saveOrUpdate(shutdwonEvent2);
-            }else
-            {
-                int days=DateUtils.daysDiff1(shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
-                Calendar c=Calendar.getInstance();
-                Date startTime=shutdwonEvent2.getStartTime();
-                c.setTime(shutdwonEvent2.getStopTime());
-                c.set(Calendar.HOUR_OF_DAY,23);
-                c.set(Calendar.MINUTE,59);
-                c.set(Calendar.SECOND,59);
-                for(int i=0;i<days;i++)
-                {
-                    if(i==0)
-                    {
-                        shutdwonEvent2.setStartTime(c.getTime());
-                        losspower=calLossPower(windturbineId, shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
+            double timehour = DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
+            item.setStopHours(timehour);
+            double losspower = calLossPower(wtId, item.getStartTime(), item.getStopTime());
+            item.setLossPower(losspower);
 
-                    }
-                    else {
-                        shutdwonEvent2.setStopTime(DateUtils.truncate(c.getTime()));
-                        if(i==days-1)
-                        {
-                            shutdwonEvent2.setStartTime(startTime);
+            if (timehour <= 24) {
+
+                insertProEconShutdownEvent2ls.add(item);
+
+            } else {
+                int days = DateUtils.daysDiff1(item.getStartTime(), item.getStopTime());
+                Calendar c = Calendar.getInstance();
+                Date startTime = item.getStartTime();
+                c.setTime(item.getStopTime());
+                c.set(Calendar.HOUR_OF_DAY, 23);
+                c.set(Calendar.MINUTE, 59);
+                c.set(Calendar.SECOND, 59);
+                for (int i = 0; i < days; i++) {
+                    if (i == 0) {
+                        item.setStartTime(c.getTime());
+                        losspower = calLossPower(wtId, item.getStartTime(), item.getStopTime());
+                        item.setLossPower(losspower);
+                        insertProEconShutdownEvent2ls.add(item);
+
+                    } else {
+                        ProEconShutdownEvent2 newto = initalShutdownEventnew2(wtId, wtStatusMap, DateUtils.truncate(c.getTime()));
 
-                        }else
-                        {
-                            shutdwonEvent2.setStartTime(c.getTime());
+                        if (i == days - 1) {
+                            newto.setStartTime(startTime);
+
+                        } else {
+                            newto.setStartTime(c.getTime());
 
                         }
-                        losspower=calLossPower(windturbineId, shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
+                        losspower = calLossPower(wtId, newto.getStartTime(), newto.getStopTime());
+                        newto.setLossPower(losspower);
+                        insertProEconShutdownEvent2ls.add(newto);
+
                     }
-                    shutdwonEvent2.setLossPower(losspower);
-                    proEconShutdownEvent2Service.saveOrUpdate(shutdwonEvent2);
-                    c.add(Calendar.DAY_OF_MONTH,1);
+
+                    c.add(Calendar.DAY_OF_MONTH, 1);
                 }
             }
+        }
 
 
-            shutdwonEvent2 =null;
-            oldShutdownEvent2.put(windturbineId,null);
-//        }
-        return shutdwonEvent2;
     }
 
-    private void finishWindturbineStatus(String windturbineId, ProEconWindturbineStatus item, Integer currentStatus, Date currentTime) throws Exception {
-        if(!Objects.equals(item.getSatusCode(), currentStatus))
-        {
-            item.setStartTime(currentTime);
-            double timehour=DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
-            item.setStopHours(timehour);
-            double losspower=calLossPower(windturbineId, item.getStartTime(), item.getStopTime());
-            item.setLossPower(losspower);
 
-            proEconWindturbineStatusService.saveOrUpdate(item);
+
+    private void initalShutdownEvent2(List<ProEconShutdownEvent2> insertProEconShutdownEvent2ls,
+                                      String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconShutdownEvent2 item) {
+        item.setId(StringUtils.getUUID());
+        item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
+        item.setStatusCode((int)wtStatusMap.get(wtId).getPointValueInDouble());
+        item.setStopTime(currentTime);
+        item.setWinpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
+        item.setWindturbineId(wtId);
+        if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.GZ.getCode()) {
+
+            item.setStopTypeId("gzbmq");
+
+            //读取报警记录表前后五分钟数据,选取第一个报警报警类型
+
+            // String stopTypeId =newMethod( windturbineId, begin, end);
+            String stopTypeId = null;
+            if (StringUtils.notEmp(stopTypeId)) {
+                item.setStopTypeId(stopTypeId);
+
+            }
+        } else if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.JX.getCode()) {
+            item.setStopTypeId("wh");
 
         }
-    }
 
-    private static void initalInterruption(String windturbineId, ProEconWindturbineStatus item, Date stopTime, ProEconInterruption interrup) {
-        interrup.setProjectId(CacheContext.wtmap.get(windturbineId).getProjectId());
-        interrup.setStopTime(stopTime);
-        interrup.setWindpowerstationId(CacheContext.wtmap.get(windturbineId).getWindpowerstationId());
-        interrup.setWindturbineId(windturbineId);
+        insertProEconShutdownEvent2ls.add(item);
     }
 
-    private static void initalShutdownEvent2(String windturbineId, ProEconWindturbineStatus item, Integer currentStatus, Date stopTime, ProEconShutdownEvent2 shutdwonEvent2) {
-        shutdwonEvent2.setId(StringUtils.getUUID());
-        shutdwonEvent2.setProjectId(CacheContext.wtmap.get(windturbineId).getProjectId());
-        shutdwonEvent2.setStatusCode(currentStatus);
-        shutdwonEvent2.setStopTime(stopTime);
-        shutdwonEvent2.setWinpowerstationId(CacheContext.wtmap.get(windturbineId).getWindpowerstationId());
-        shutdwonEvent2.setWindturbineId(windturbineId);
-        if (currentStatus == 4)
-        {
-
-            shutdwonEvent2.setStopTypeId("gzbmq");
+    private ProEconShutdownEvent2 initalShutdownEventnew2(String wtId, Map<String, PointData> wtStatusMap, Date currentTime) {
+        ProEconShutdownEvent2 item = new ProEconShutdownEvent2();
+        item.setId(StringUtils.getUUID());
+        item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
+        item.setStatusCode((int)wtStatusMap.get(wtId).getPointValueInDouble());
+        item.setStopTime(currentTime);
+        item.setWinpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
+        item.setWindturbineId(wtId);
+        if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.GZ.getCode()) {
+
+            item.setStopTypeId("gzbmq");
+
             //读取报警记录表前后五分钟数据,选取第一个报警报警类型
 
             // String stopTypeId =newMethod( windturbineId, begin, end);
-            String stopTypeId=null;
-            if (StringUtils.notEmp(stopTypeId))
-            {
-                shutdwonEvent2.setStopTypeId(stopTypeId);
+            String stopTypeId = null;
+            if (StringUtils.notEmp(stopTypeId)) {
+                item.setStopTypeId(stopTypeId);
 
             }
-        }
-        else
-        {
-            shutdwonEvent2.setStopTypeId("wh");
+        } else if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.JX.getCode()) {
+            item.setStopTypeId("wh");
 
         }
+        return item;
     }
 
-    private static void initalShutdownEvent(String windturbineId, ProEconWindturbineStatus item, Integer currentStatus, Date stopTime, ProEconShutdownEvent shutdwonEvent) {
-
-        shutdwonEvent.setId(StringUtils.getUUID());
-        shutdwonEvent.setProjectId(CacheContext.wtmap.get(windturbineId).getProjectId());
-        shutdwonEvent.setStatusCode(currentStatus);
-        shutdwonEvent.setStopTime(stopTime);
-        shutdwonEvent.setWindpowerstationId(CacheContext.wtmap.get(windturbineId).getWindpowerstationId());
-        shutdwonEvent.setWindturbineId(windturbineId);
-        if (currentStatus == 4)
-        {
+    private static void initalShutdownEvent(List<ProEconShutdownEvent> insertProEconShutdownEventls,
+                                            String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconShutdownEvent item) {
+        item.setId(StringUtils.getUUID());
+        item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
+        item.setStatusCode((int)wtStatusMap.get(wtId).getPointValueInDouble());
+        item.setStopTime(currentTime);
+        item.setWindpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
+        item.setWindturbineId(wtId);
+        if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.GZ.getCode()) {
 
-            shutdwonEvent.setStoptypeId("gzbmq");
+            item.setStoptypeId("gzbmq");
 
             //读取报警记录表前后五分钟数据,选取第一个报警报警类型
 
             // String stopTypeId =newMethod( windturbineId, begin, end);
-            String stopTypeId=null;
-            if (StringUtils.notEmp(stopTypeId))
-            {
-                shutdwonEvent.setStoptypeId(stopTypeId);
+            String stopTypeId = null;
+            if (StringUtils.notEmp(stopTypeId)) {
+                item.setStoptypeId(stopTypeId);
 
             }
-        }
-        else
-        {
-            shutdwonEvent.setStoptypeId("wh");
+        } else if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.JX.getCode()) {
+            item.setStoptypeId("wh");
 
         }
+
+        insertProEconShutdownEventls.add(item);
     }
 
-    private void initalWindturbineStatus(String windturbineId, ProEconWindturbineStatus item, Integer currentStatus, Date stopTime,PointData stpo) {
-        item.setProjectId(CacheContext.wtmap.get(windturbineId).getProjectId());
-        item.setSatusCode(currentStatus);
-        item.setStatusDesc(statusDescriptionMap.get((int)stpo.getPointValueInDouble()));
-        item.setStopTime(stopTime);
-        item.setWindpowerstationId(CacheContext.wtmap.get(windturbineId).getWindpowerstationId());
-        item.setWindturbineId(windturbineId);
+    private void initalWindturbineStatus(List<ProEconWindturbineStatus> insertProEconWindturbineStatusls,
+                                         String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconWindturbineStatus item) {
+
+        item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
+        item.setSatusCode((int)wtStatusMap.get(wtId).getPointValueInDouble());
+        item.setStatusDesc(StatusDetailValue.getNmaeByCode(wtStatusMap.get(wtId).getPointValueInDouble()));
+        item.setStopTime(currentTime);
+        item.setWindpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
+        item.setWindturbineId(wtId);
+        insertProEconWindturbineStatusls.add(item);
+
+    }
+
+    private void finishWindturbineStatus(List<ProEconWindturbineStatus> updateProEconWindturbineStatusls,
+                                         String wtId, Date currentTime, ProEconWindturbineStatus item) throws Exception {
+        item.setStartTime(currentTime);
+        double timehour = DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
+        item.setStopHours(timehour);
+        double losspower = calLossPower(wtId, item.getStartTime(), item.getStopTime());
+        item.setLossPower(losspower);
+        updateProEconWindturbineStatusls.add(item);
     }
 
+    private void initalInterruption(List<ProEconInterruption> insertProEconWindturbineStatusls,
+                                    String wtId, Date currentTime, ProEconInterruption item) {
+        item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
+        item.setStopTime(currentTime);
+        item.setWindpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
+        item.setWindturbineId(wtId);
+        insertProEconWindturbineStatusls.add(item);
+    }
 
-    private  String newMethod( String windturbineId, Date begin, Date end)
-    {
+    private void finishInterruption(List<ProEconInterruption> updateProEconWindturbineStatusls,
+                                    String wtId, Date currentTime, ProEconInterruption item) {
+
+        item.setStartTime(currentTime);
+        double timehour = DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
+        item.setStopHours(timehour);
+
+        updateProEconWindturbineStatusls.add(item);
+    }
+
+    private String newMethod(String windturbineId, Date begin, Date end) {
         String result = "";
 
         return result;
@@ -378,88 +547,79 @@ public class ShutdownnewService {
         double result = 0.0;
 
         Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
-        Map<String, ProBasicEquipmentPoint> wtpointmap=wtpAimap.get(windturbineId);
+        Map<String, ProBasicEquipmentPoint> wtpointmap = wtpAimap.get(windturbineId);
 
-        Calendar c1=Calendar.getInstance();
+        Calendar c1 = Calendar.getInstance();
         c1.setTime(startDate);
-        Calendar c2=Calendar.getInstance();
+        Calendar c2 = Calendar.getInstance();
         c2.setTime(endDate);
         //判定限电是否跨年
-        if(endDate.after(startDate) && c1.get(Calendar.YEAR)==c2.get(Calendar.YEAR))
-        {
+        if (endDate.after(startDate) && c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR)) {
             //年故障损失电量
-            if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
-            {
+            if (wtpointmap.containsKey(ContantXk.NGZSSDL)) {
                 double beginvalue;
                 double endvalue;
 
-                List<String> pointid=new ArrayList<>();
+                List<String> pointid = new ArrayList<>();
                 pointid.add(wtpointmap.get(ContantXk.NGZSSDL).getNemCode());
-                List<PointData> xdbegin=edosUtil.getHistMatrix(pointid,startDate.getTime()/1000);
-                List<PointData> xdend=edosUtil.getHistMatrix(pointid,endDate.getTime()/1000);
+                List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
+                List<PointData> xdend = edosUtil.getHistMatrix(pointid, endDate.getTime() / 1000);
 
 
-                if(xdbegin.size()==1 && xdend.size()==1)
-                {
-                    beginvalue=xdbegin.get(0).getPointValueInDouble();
-                    endvalue=xdend.get(0).getPointValueInDouble();
+                if (xdbegin.size() == 1 && xdend.size() == 1) {
+                    beginvalue = xdbegin.get(0).getPointValueInDouble();
+                    endvalue = xdend.get(0).getPointValueInDouble();
 
                     if (endvalue > beginvalue) {
-                        result =result+(endvalue - beginvalue);
+                        result = result + (endvalue - beginvalue);
                     }
                 }
             }
 
 
-        }else
-        {
-            Calendar c=Calendar.getInstance();
+        } else {
+            Calendar c = Calendar.getInstance();
             c.setTime(DateUtils.truncate(startDate));
-            c.add(Calendar.DAY_OF_MONTH,1);
+            c.add(Calendar.DAY_OF_MONTH, 1);
             //获得1月1日零点值
-            Date endtime=c.getTime();
+            Date endtime = c.getTime();
             //年故障损失电量
-            if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
-            {
+            if (wtpointmap.containsKey(ContantXk.NGZSSDL)) {
                 double beginvalue;
                 double endvalue;
 
 
-
-                List<String> pointid=new ArrayList<>();
+                List<String> pointid = new ArrayList<>();
                 pointid.add(wtpointmap.get(ContantXk.NGZSSDL).getNemCode());
-                List<PointData> xdbegin=edosUtil.getHistMatrix(pointid,startDate.getTime()/1000);
-                List<PointData> xdend=edosUtil.getHistMatrix(pointid,endtime.getTime()/1000);
+                List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
+                List<PointData> xdend = edosUtil.getHistMatrix(pointid, endtime.getTime() / 1000);
 
 
-                if(xdbegin.size()==1 && xdend.size()==1)
-                {
-                    beginvalue=xdbegin.get(0).getPointValueInDouble();
-                    endvalue=xdend.get(0).getPointValueInDouble();
+                if (xdbegin.size() == 1 && xdend.size() == 1) {
+                    beginvalue = xdbegin.get(0).getPointValueInDouble();
+                    endvalue = xdend.get(0).getPointValueInDouble();
 
                     if (endvalue > beginvalue) {
-                        result =result+(endvalue - beginvalue);
+                        result = result + (endvalue - beginvalue);
                     }
                 }
             }
 
             //日故障损失电量
-            if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
-            {
+            if (wtpointmap.containsKey(ContantXk.NGZSSDL)) {
 
                 double endvalue;
 
-                List<String> pointid=new ArrayList<>();
+                List<String> pointid = new ArrayList<>();
                 pointid.add(wtpointmap.get(ContantXk.NGZSSDL).getNemCode());
-                List<PointData> xdend=edosUtil.getHistMatrix(pointid,startDate.getTime()/1000);
+                List<PointData> xdend = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
 
-                if(xdend.size()==1)
-                {
+                if (xdend.size() == 1) {
 
-                    endvalue=xdend.get(0).getPointValueInDouble();
+                    endvalue = xdend.get(0).getPointValueInDouble();
 
                     if (endvalue > 0) {
-                        result =result+endvalue;
+                        result = result + endvalue;
                     }
                 }
             }

+ 51 - 3
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java

@@ -622,7 +622,23 @@ public class WindPowerInfo1Service {
 
 
         }
-        proEconPowerstationInfoDay1Service.saveBatch(dayls);
+
+        List<ProEconPowerstationInfoDay1> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay1 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay1Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay1Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay1Service.saveBatch(dayls);
     }
 
     /**
@@ -700,7 +716,23 @@ public class WindPowerInfo1Service {
 
 
         }
-        proEconPowerstationInfoDay1Service.saveBatch(dayls);
+
+        List<ProEconPowerstationInfoDay1> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay1 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay1Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay1Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay1Service.saveBatch(dayls);
     }
 
     /**
@@ -782,7 +814,23 @@ public class WindPowerInfo1Service {
 
 
         }
-        proEconPowerstationInfoDay1Service.saveBatch(dayls);
+
+        List<ProEconPowerstationInfoDay1> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay1 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay1Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay1Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay1Service.saveBatch(dayls);
     }
 
     private void extracted(Date recordDate, Date end, Date begin, Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay1 pewp, List<ProEconPowerstationInfoDay1> pepid1ls) throws Exception {

+ 50 - 3
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo2Service.java

@@ -463,7 +463,23 @@ public class WindPowerInfo2Service {
 
 
         }
-        proEconPowerstationInfoDay2Service.saveBatch(dayls);
+
+        List<ProEconPowerstationInfoDay2> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay2 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay2Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay2Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay2Service.saveBatch(dayls);
     }
 
     /**
@@ -543,7 +559,22 @@ public class WindPowerInfo2Service {
 
 
         }
-        proEconPowerstationInfoDay2Service.saveBatch(dayls);
+        List<ProEconPowerstationInfoDay2> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay2 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay2Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay2Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay2Service.saveBatch(dayls);
     }
 
     /**
@@ -627,7 +658,23 @@ public class WindPowerInfo2Service {
 
 
 //        }
-        proEconPowerstationInfoDay2Service.saveBatch(dayls);
+
+        List<ProEconPowerstationInfoDay2> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay2 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay2Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay2Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay2Service.saveBatch(dayls);
     }
 
     private void calDetiall(ProEconPowerstationInfoDay2 pewp, Date end, Date begin, List<ProBasicEquipment> wtls, List<ProEconPowerstationInfoDay2> pepidls) throws Exception {

+ 51 - 3
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo3Service.java

@@ -462,7 +462,23 @@ public class WindPowerInfo3Service {
 
 
         }
-        proEconPowerstationInfoDay3Service.saveBatch(dayls);
+
+        List<ProEconPowerstationInfoDay3> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay3 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay3Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay3Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay3Service.saveBatch(dayls);
     }
 
     /**
@@ -541,7 +557,23 @@ public class WindPowerInfo3Service {
 
 
         }
-        proEconPowerstationInfoDay3Service.saveBatch(dayls);
+
+        List<ProEconPowerstationInfoDay3> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay3 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay3Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay3Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay3Service.saveBatch(dayls);
     }
 
     /**
@@ -624,7 +656,23 @@ public class WindPowerInfo3Service {
 
 
         //      }
-        proEconPowerstationInfoDay3Service.saveBatch(dayls);
+
+        List<ProEconPowerstationInfoDay3> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay3 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay3Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay3Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay3Service.saveBatch(dayls);
     }
 
     private void calDetiall(ProEconPowerstationInfoDay3 pewp, Date end, Date begin, List<ProBasicEquipment> wtls, List<ProEconPowerstationInfoDay3> pepidls) throws Exception {

+ 50 - 3
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo4Service.java

@@ -526,7 +526,23 @@ public class WindPowerInfo4Service {
 
 
         }
-        proEconPowerstationInfoDay4Service.saveBatch(dayls);
+
+        List<ProEconPowerstationInfoDay4> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay4 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay4Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay4Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay4Service.saveBatch(dayls);
     }
 
     /**
@@ -645,7 +661,22 @@ public class WindPowerInfo4Service {
 
 
         }
-        proEconPowerstationInfoDay4Service.saveBatch(dayls);
+        List<ProEconPowerstationInfoDay4> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay4 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay4Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay4Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay4Service.saveBatch(dayls);
     }
 
     /**
@@ -766,7 +797,23 @@ public class WindPowerInfo4Service {
 
 
         }
-        proEconPowerstationInfoDay4Service.saveBatch(dayls);
+
+        List<ProEconPowerstationInfoDay4> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay4 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay4Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay4Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay4Service.saveBatch(dayls);
     }
 
     private void calDetiall(ProEconPowerstationInfoDay4 pewp, Date end, Date begin, List<ProBasicEquipment> wtls,

+ 48 - 3
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo5Service.java

@@ -409,7 +409,22 @@ public class WindPowerInfo5Service {
 
 
         }
-        proEconPowerstationInfoDay5Service.saveBatch(dayls);
+        List<ProEconPowerstationInfoDay5> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay5 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay5Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay5Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay5Service.saveBatch(dayls);
     }
 
     /**
@@ -480,7 +495,22 @@ public class WindPowerInfo5Service {
 
 
         }
-        proEconPowerstationInfoDay5Service.saveBatch(dayls);
+        List<ProEconPowerstationInfoDay5> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay5 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay5Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay5Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay5Service.saveBatch(dayls);
     }
 
     /**
@@ -555,7 +585,22 @@ public class WindPowerInfo5Service {
 
 
         }
-        proEconPowerstationInfoDay5Service.saveBatch(dayls);
+        List<ProEconPowerstationInfoDay5> templs=new ArrayList<>();
+        for(ProEconPowerstationInfoDay5 vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconPowerstationInfoDay5Service.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconPowerstationInfoDay5Service.saveOrUpdateBatch(templs);
+        }
+//        proEconPowerstationInfoDay5Service.saveBatch(dayls);
     }
 
     private void extracted(Date recordDate, Map<String, ProBasicPowerstationPoint> pointmap, ProEconPowerstationInfoDay5 pewp) throws Exception {

+ 18 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WpwindDayInfoService.java

@@ -95,7 +95,24 @@ public class WpwindDayInfoService {
 
 
         }
-        proEconWpwindDayInfoService.saveBatch(dayls);
+
+
+        List<ProEconWpwindDayInfo> templs=new ArrayList<>();
+        for(ProEconWpwindDayInfo vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconWpwindDayInfoService.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconWpwindDayInfoService.saveOrUpdateBatch(templs);
+        }
+//        proEconWpwindDayInfoService.saveBatch(dayls);
     }
 
 

+ 18 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WtAlysisDayService.java

@@ -272,7 +272,24 @@ public class WtAlysisDayService {
                     edosUtil, c, proEconWtAlysisDayService,latch)).start();
         }
         latch.await();
-        proEconWtAlysisDayService.saveBatch(dayls);
+
+
+        List<ProEconWtAlysisDay> templs=new ArrayList<>();
+        for(ProEconWtAlysisDay vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconWtAlysisDayService.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconWtAlysisDayService.saveOrUpdateBatch(templs);
+        }
+//        proEconWtAlysisDayService.saveBatch(dayls);
     }
 
     private void calSimple(ProEconWtAlysisDay pewp, Date end, Date begin, ProBasicEquipment wt, List<ProEconWtAlysisDay> pepidls) throws Exception {

+ 17 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WtwindDayInfoService.java

@@ -95,7 +95,23 @@ public class WtwindDayInfoService {
 
 
         }
-        proEconWtwindDayInfoService.saveBatch(dayls);
+
+        List<ProEconWtwindDayInfo> templs=new ArrayList<>();
+        for(ProEconWtwindDayInfo vo:dayls)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconWtwindDayInfoService.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconWtwindDayInfoService.saveOrUpdateBatch(templs);
+        }
+//        proEconWtwindDayInfoService.saveBatch(dayls);
     }
 
 

+ 112 - 43
realtime/generationXK-service/src/main/java/com/gyee/generation/task/SaticSchedulePgTask.java

@@ -364,57 +364,126 @@ public class SaticSchedulePgTask {
     }
 
     /**
-     * 设备1-6
+     * 设备1-5
      *  15分钟只执行一次
      *
      */
-    @XxlJob("equipment_PowerInfo_PG")
-    public void equipment_PowerInfo_PG() throws Exception {
+    @XxlJob("equipment_PowerInfo1_PG")
+    public void equipment_PowerInfo1_PG() throws Exception {
 
-        XxlJobHelper.log("设备指标调度程序执行开始!........");
+        XxlJobHelper.log("设备指标1调度程序执行开始!........");
 
         Date date=new Date();
 
 
         equipmentInfo1Service.calEquipmentInfoDay(date);
 
+
+
+        XxlJobHelper.log("设备指标1调度程序执行完成!........");
+
+    }
+
+
+    /**
+     * 设备2表
+     *  15分钟只执行一次
+     *
+     */
+    @XxlJob("equipment_PowerInfo2_PG")
+    public void equipment_PowerInfo2_PG() throws Exception {
+
+        XxlJobHelper.log("设备指标2调度程序执行开始!........");
+
+        Date date=new Date();
+
         equipmentInfo2Service.calEquipmentInfoDay(date);
 
+
+        XxlJobHelper.log("设备指标2调度程序执行完成!........");
+
+    }
+
+    /**
+     * 设备3表
+     *  15分钟只执行一次
+     *
+     */
+    @XxlJob("equipment_PowerInfo3_PG")
+    public void equipment_PowerInfo3_PG() throws Exception {
+
+        XxlJobHelper.log("设备指标3调度程序执行开始!........");
+
+        Date date=new Date();
+
+
         equipmentInfo3Service.calEquipmentInfoDay(date);
 
+
+        XxlJobHelper.log("设备指标3调度程序执行完成!........");
+
+    }
+
+
+    /**
+     * 设备3表
+     *  15分钟只执行一次
+     *
+     */
+    @XxlJob("equipment_PowerInfo4_PG")
+    public void equipment_PowerInfo4_PG() throws Exception {
+
+        XxlJobHelper.log("设备指标4调度程序执行开始!........");
+
+        Date date=new Date();
+
+
+
         equipmentInfo4Service.calEquipmentInfoDay(date);
 
-        equipmentInfo5Service.calEquipmentInfoDay(date);
 
-        equipmentInfoDayTopService.calEquipmentInfoDayTop(date);
-        equipmentInfoDayTopService.calEquipmentInfoMonthTop(date);
-        equipmentInfoDayTopService.calEquipmentInfoYearTop(date);
+        XxlJobHelper.log("设备指标调度4程序执行完成!........");
 
-        wtAlysisDayService.calEquipmentInfoDay(date);
+    }
 
-        XxlJobHelper.log("设备指标调度程序执行完成!........");
+    /**
+     * 设备5表
+     *  15分钟只执行一次
+     *
+     */
+    @XxlJob("equipment_PowerInfo5_PG")
+    public void equipment_PowerInfo5_PG() throws Exception {
+
+        XxlJobHelper.log("设备指标5调度程序执行开始!........");
+
+        Date date=new Date();
+
+
+        equipmentInfo5Service.calEquipmentInfoDay(date);
+
+
+        XxlJobHelper.log("设备指标调度5程序执行完成!........");
 
     }
+    /**
+     * 等级评估统计
+     * 每天执行一次
+     */
+
+    @XxlJob("equipmentInfoDayTop_PG")
+    public void equipmentInfoDayTop_PG()  {
 
-//    /**
-//     * 等级评估统计
-//     * 每天执行一次
-//     */
-//
-//    @XxlJob("equipmentInfoDayTop_PG")
-//    public void equipmentInfoDayTop_PG()  {
-//
-//
-//        XxlJobHelper.log("等级评估统计调度程序执行开始!........");
-//        try {
-//            equipmentInfoDayTopService.calEquipmentInfoDayTop(new Date());
-//            equipmentInfoDayTopService.calEquipmentInfoMonthTop(new Date());
-//            equipmentInfoDayTopService.calEquipmentInfoYearTop(new Date());
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//        XxlJobHelper.log("等级评估统计调度任务处理完成!........");
-//    }
+
+        XxlJobHelper.log("等级评估统计调度程序执行开始!........");
+        try {
+            equipmentInfoDayTopService.calEquipmentInfoDayTop(new Date());
+            equipmentInfoDayTopService.calEquipmentInfoMonthTop(new Date());
+            equipmentInfoDayTopService.calEquipmentInfoYearTop(new Date());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("等级评估统计调度任务处理完成!........");
+    }
 
     /**
      * 功率一致性系数和拟合优度
@@ -433,20 +502,20 @@ public class SaticSchedulePgTask {
         }
         XxlJobHelper.log("功率一致性系数和拟合优度统计调度任务处理完成!........");
     }
-//
-//
-//    @XxlJob("wtAlysisDay_PG")
-//    public void wtAlysisDay_PG()  {
-//
-//
-//        XxlJobHelper.log("分析数据统计调度程序执行开始!........");
-//        try {
-//            wtAlysisDayService.calEquipmentInfoDay(new Date());
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//        XxlJobHelper.log("分析数据统计调度任务处理完成!........");
-//    }
+
+
+    @XxlJob("wtAlysisDay_PG")
+    public void wtAlysisDay_PG()  {
+
+
+        XxlJobHelper.log("分析数据统计调度程序执行开始!........");
+        try {
+            wtAlysisDayService.calEquipmentInfoDay(new Date());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("分析数据统计调度任务处理完成!........");
+    }
 
     /**
      * 设备风资源统计调度

+ 4 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/BrownoutsThread.java

@@ -94,8 +94,11 @@ public class BrownoutsThread implements Runnable {
 		} catch (ExecutionException e) {
 			futureTask.cancel(true);
 		} catch (Exception e) {
+
 			futureTask.cancel(true);
 			// 超时后,进行相应处理
-		} 
+		} finally {
+			logger.info("限电子表数据完成任务并提交到线程池中:" + wtId);
+		}
 	}
 }

+ 37 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/BrownoutsThreadPool.java

@@ -222,13 +222,48 @@ public class BrownoutsThreadPool implements Callable<String>, Serializable {
 
             }
 
+            List<ProEconBrownoutsEvent> templs=new ArrayList<>();
+            for(ProEconBrownoutsEvent vo:proEconBrownoutsEventls)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconBrownoutsEventService.saveOrUpdateBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
+
+            if(!templs.isEmpty())
+            {
+                proEconBrownoutsEventService.saveOrUpdateBatch(templs);
+            }
 
-            proEconBrownoutsEventService.saveOrUpdateBatch(proEconBrownoutsEventls);
-            proEconBrownoutsEvent2Service.saveOrUpdateBatch(proEconBrownoutsEvent2ls);
+
+            List<ProEconBrownoutsEvent2> templs2=new ArrayList<>();
+            for(ProEconBrownoutsEvent2 vo:proEconBrownoutsEvent2ls)
+            {
+                templs2.add(vo);
+                if(templs2.size()==100)
+                {
+                    proEconBrownoutsEvent2Service.saveOrUpdateBatch(templs2);
+                    templs2=new ArrayList<>();
+                }
+            }
+
+            if(!templs2.isEmpty())
+            {
+                proEconBrownoutsEvent2Service.saveOrUpdateBatch(templs2);
+            }
+
+
+//            proEconBrownoutsEventService.saveOrUpdateBatch(proEconBrownoutsEventls);
+//            proEconBrownoutsEvent2Service.saveOrUpdateBatch(proEconBrownoutsEvent2ls);
         } catch (Exception e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
+
+
         threadPoolTaskData = null;
 
         return result;

+ 1 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo4ThreadPool.java

@@ -114,6 +114,7 @@ public class EquipmentInfo4ThreadPool implements Callable<String>, Serializable
 
 
 				ProEconEquipmentInfoDay4 pewp = new ProEconEquipmentInfoDay4();
+				pewp.setId(StringUtils.getUUID());
 				Initial.initial(pewp);
 				pewp.setCompanyId(wt.getCompanyId());
 				pewp.setWindpowerstationId(wt.getWindpowerstationId());

+ 1 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo5Thread.java

@@ -53,7 +53,7 @@ public class EquipmentInfo5Thread implements Runnable {
 	public synchronized void run() {
 
 		String task = "task@ " + wt.getId();
-		logger.info("设备4计算服务创建任务并提交到线程池中:" + wt.getId());
+		logger.info("设备5计算服务创建任务并提交到线程池中:" + wt.getId());
 		FutureTask<String> futureTask = new FutureTask<String>(new EquipmentInfo5ThreadPool(task,
 				 wt,  rates,
 				   endDate,  beginDate,

+ 34 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/MainBrownoutsThreadPool.java

@@ -229,9 +229,41 @@ public class MainBrownoutsThreadPool implements Callable<String>, Serializable {
 
             }
 
+            List<ProEconMainBrownouts> templs=new ArrayList<>();
+            for(ProEconMainBrownouts vo:proEconMainBrownoutsls)
+            {
+                templs.add(vo);
+                if(templs.size()==100)
+                {
+                    proEconMainBrownoutsService.saveOrUpdateBatch(templs);
+                    templs=new ArrayList<>();
+                }
+            }
+
+            if(!templs.isEmpty())
+            {
+                proEconMainBrownoutsService.saveOrUpdateBatch(templs);
+            }
+
+
+            List<ProEconMainBrownouts2> templs2=new ArrayList<>();
+            for(ProEconMainBrownouts2 vo:proEconMainBrownouts2ls)
+            {
+                templs2.add(vo);
+                if(templs2.size()==100)
+                {
+                    proEconMainBrownouts2Service.saveOrUpdateBatch(templs2);
+                    templs2=new ArrayList<>();
+                }
+            }
+
+            if(!templs2.isEmpty())
+            {
+                proEconMainBrownouts2Service.saveOrUpdateBatch(templs2);
+            }
+//            proEconMainBrownoutsService.saveOrUpdateBatch(proEconMainBrownoutsls);
+//            proEconMainBrownouts2Service.saveOrUpdateBatch(proEconMainBrownouts2ls);
 
-            proEconMainBrownoutsService.saveOrUpdateBatch(proEconMainBrownoutsls);
-            proEconMainBrownouts2Service.saveOrUpdateBatch(proEconMainBrownouts2ls);
         } catch (Exception e) {
             // TODO Auto-generated catch block
             e.printStackTrace();

+ 66 - 4
realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/ShutdownnewThreadPool.java

@@ -353,19 +353,81 @@ public class ShutdownnewThreadPool implements Callable<String>, Serializable {
 
 			if(!windturbineStatusls.isEmpty())
 			{
-				proEconWindturbineStatusService.saveOrUpdateBatch(windturbineStatusls);
+				List<ProEconWindturbineStatus> templs=new ArrayList<>();
+				for(ProEconWindturbineStatus vo:windturbineStatusls)
+				{
+					templs.add(vo);
+					if(templs.size()==100)
+					{
+						proEconWindturbineStatusService.saveOrUpdateBatch(templs);
+						templs=new ArrayList<>();
+					}
+				}
+
+				if(!templs.isEmpty())
+				{
+					proEconWindturbineStatusService.saveOrUpdateBatch(templs);
+				}
 			}
 			if(!shutdwonEventls.isEmpty())
 			{
-				proEconShutdownEventService.saveOrUpdateBatch(shutdwonEventls);
+
+				List<ProEconShutdownEvent> templs=new ArrayList<>();
+				for(ProEconShutdownEvent vo:shutdwonEventls)
+				{
+					templs.add(vo);
+					if(templs.size()==100)
+					{
+						proEconShutdownEventService.saveOrUpdateBatch(templs);
+						templs=new ArrayList<>();
+					}
+				}
+
+				if(!templs.isEmpty())
+				{
+					proEconShutdownEventService.saveOrUpdateBatch(templs);
+				}
+
 			}
 			if(!shutdwonEvent2ls.isEmpty())
 			{
-				proEconShutdownEvent2Service.saveOrUpdateBatch(shutdwonEvent2ls);
+
+				List<ProEconShutdownEvent2> templs=new ArrayList<>();
+				for(ProEconShutdownEvent2 vo:shutdwonEvent2ls)
+				{
+					templs.add(vo);
+					if(templs.size()==100)
+					{
+						proEconShutdownEvent2Service.saveOrUpdateBatch(templs);
+						templs=new ArrayList<>();
+					}
+				}
+
+				if(!templs.isEmpty())
+				{
+					proEconShutdownEvent2Service.saveOrUpdateBatch(templs);
+				}
+
 			}
 			if(!interrupls.isEmpty())
 			{
-				proEconInterruptionService.saveOrUpdateBatch(interrupls);
+
+				List<ProEconInterruption> templs=new ArrayList<>();
+				for(ProEconInterruption vo:interrupls)
+				{
+					templs.add(vo);
+					if(templs.size()==100)
+					{
+						proEconInterruptionService.saveOrUpdateBatch(templs);
+						templs=new ArrayList<>();
+					}
+				}
+
+				if(!templs.isEmpty())
+				{
+					proEconInterruptionService.saveOrUpdateBatch(templs);
+				}
+
 			}
 
 		} catch (Exception e) {

+ 31 - 7
realtime/generationXK-service/src/main/resources/application-jn.yml

@@ -82,15 +82,39 @@ mybatis-plus:
       logic-not-delete-value: 1
       # 删除后
       logic-delete-value: 0
+# 日志配置
 logging:
   level:
     root: info
-    com.example: debug
+  charset:
+    # 输出控制台编码
+    console: UTF-8
+    # 输出文件编码
+    file: UTF-8
+  # 输出文件名及路径,不配置则不输出文件
+  file:
+    # 切记,该文件表示正在产出日志的日志文件。并不会打包,当文件大于max-file-size,会根据file-name-pattern格式打包
+    # 名称为log/ota.log文件夹会在项目根目录下,打包后会在启动包同目录下;名称为/log/ota.log的文件夹会在项目所在磁盘的跟目录下
+    name: log/ota.log
+  logback:
+    rollingpolicy:
+      # 单文件的大小,默认10M, 超过之后打包成一个日志文件
+      max-file-size: 1MB
+      # 日志保存的天数
+      max-history: 30
+      # 打包文件格式,默认: ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz,书写格式为:文件路径/文件名.%i.文件后缀,其中%i不可省去,否则无日志显示
+      # 例如: 日期为:2021/11/5 ,则打包文件之后为: log/ota.2021-11-05.0.gz,0表示日志的第一部分,后续就是,1,2,3...
+      # 如果是压缩包,里面会多一个名log/ota.2021-11-05.0的日志文件
+      # 如下面的例子,打包之后为: log/2021-11/ota.2020-11-5.0.log,这是一个日志文件
+      file-name-pattern: log/%d{yyyy-MM}/ota.%d{yyyy-MM-dd}.%i.log
+
 #db url
 db:
-  url1: http://10.81.3.155:8033/ts
-  url2: http://10.81.3.155:8033/ts
-  #url: http://127.0.0.1:8011/ts
+  url1: http://10.81.3.160:8011/ts
+  url2: http://10.81.3.160:8011/ts
+#  url1: http://127.0.0.1:8011/ts
+#  url2: http://127.0.0.1:8011/ts
+
 #参与计算的场站
 #runWindpowerstation: SXJ_KGDL_GJY_FDC_STA
 runWindpowerstation: SXJ_KGDL_BHB3_FDC_STA,SXJ_KGDL_BHB_FDC_STA,SXJ_KGDL_GJY_FDC_STA,SXJ_KGDL_HSM_FDC_STA,SXJ_KGDL_NJL_FDC_STA,SXJ_KGDL_PDL_FDC_STA,SXJ_KGDL_PTZ_FDC_STA,SXJ_KGDL_SY_GDC_STA,SXJ_KGDL_XWT_FDC_STA,SXJ_KGDL_YF_FDC_STA,SXJ_KGDL_YLZ_FDC_STA,SXJ_KGDL_YTY_FDC_STA,SXJ_KGDL_ZK_FDC_STA
@@ -115,11 +139,11 @@ initialcode: INITIAL
 ##调用区间间隔时长,需要与XXLJOB调度时长结合,保证查询区间时长大于调度时长,单位分钟
 frequency:
   #停机
-  shutdown: 6
+  shutdown: 1
   #限电
-  powerrationing: 6
+  powerrationing: 1
   #切入切出
-  cutinandout: 6
+  cutinandout: 1
 
 
 

+ 25 - 0
realtime/generationXK-service/src/main/resources/xxl-job-executor2.properties

@@ -0,0 +1,25 @@
+### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
+#xxl.job.admin.addresses=http://localhost:8175/xxl-job-admin
+xxl.job.admin.addresses=http://10.81.3.152:8175/xxl-job-admin
+### xxl-job, access token
+xxl.job.accessToken=
+
+### xxl-job executor appname
+### 场站计算
+xxl.job.executor.appname=generationTarget-job-2
+### 区域公司计算
+#xxl.job.executor.appname=generationRG-job
+### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null
+xxl.job.executor.address=
+### xxl-job executor server-info
+xxl.job.executor.ip=
+#场站端口
+xxl.job.executor.port=9203
+#区域端口
+#xxl.job.executor.port=9202
+
+### xxl-job executor log-path
+xxl.job.executor.logpath=/data/nem/computeEngine/logs
+### xxl-job executor log-retention-days
+xxl.job.executor.logretentiondays=30
+

+ 25 - 0
realtime/generationXK-service/src/main/resources/xxl-job-executor3.properties

@@ -0,0 +1,25 @@
+### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
+#xxl.job.admin.addresses=http://localhost:8175/xxl-job-admin
+xxl.job.admin.addresses=http://10.81.3.152:8175/xxl-job-admin
+### xxl-job, access token
+xxl.job.accessToken=
+
+### xxl-job executor appname
+### 场站计算
+xxl.job.executor.appname=generationTarget-job-3
+### 区域公司计算
+#xxl.job.executor.appname=generationRG-job
+### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null
+xxl.job.executor.address=
+### xxl-job executor server-info
+xxl.job.executor.ip=
+#场站端口
+xxl.job.executor.port=9204
+#区域端口
+#xxl.job.executor.port=9202
+
+### xxl-job executor log-path
+xxl.job.executor.logpath=/data/nem/computeEngine/logs
+### xxl-job executor log-retention-days
+xxl.job.executor.logretentiondays=30
+

+ 58 - 26
realtime/generationXK-service/src/test/java/com/gyee/generation/HealthTest.java

@@ -1,6 +1,7 @@
 package com.gyee.generation;
 
-import com.gyee.generation.service.WindturbineGoodnessService;
+import com.gyee.generation.service.InputOrOutPutService;
+import com.gyee.generation.service.ShutdownnewService;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.SpringUtils;
 import org.springframework.boot.SpringApplication;
@@ -13,6 +14,8 @@ public class HealthTest {
 
     public static void main(String[] args) throws Exception {
         SpringApplication.run(GenerationMain.class, args);
+
+        InputOrOutPutService inputOrOutPutService= SpringUtils.getBean("inputOrOutPutService");
         Calendar c = Calendar.getInstance();
         Date begin=null;
         Date end=null;
@@ -36,18 +39,35 @@ public class HealthTest {
 //        System.out.println("切15分钟数据统计记录记录调度程序执行结束!。。。。。。");
 //
 //
-//        begin=new Date();
-//        System.out.println("切入切出状态切换记录调度程序执行开始!。。。。。。");
-//        InputOrOutPutService inputOrOutPutService= SpringUtils.getBean("inputOrOutPutService");
-//
-//        inputOrOutPutService.inputOrOutputSpeed(c.getTime());
-//        end=new Date();
-//        System.out.println("执行用时"+ DateUtils.secondsDiff(begin,end) +"秒");
-//        System.out.println("切入切出状态切换记录调度程序执行结束!。。。。。。");
+
+
+
+//        List<ProBasicEquipment> wtls= CacheContext.wpwtmap.get("SXJ_KGDL_GJY_FDC_STA");
+//        List<ProBasicEquipment> wtls= new ArrayList<>();
+//        for(ProBasicPowerstation wp: CacheContext.wpls)
+//        {
+//            if(wp.getId().contains("FDC"))
+//            {
+//                wtls.addAll(CacheContext.wpwtmap.get(wp.getId()));
+//            }
+//        }
+
+//        List<ProBasicEquipment> wtls= CacheContext.wpwtmap.get("SXJ_KGDL_GJY_FDC_STA");
+//
+//        while (true)
+//        {
+//            begin=new Date();
+//            System.out.println("切入切出状态切换记录调度程序执行开始!。。。。。。");
+//            inputOrOutPutService.inputOrOutputSpeed(c.getTime());
+//            end=new Date();
+//            System.out.println("执行用时"+ DateUtils.secondsDiff(begin,end) +"秒");
+//            System.out.println("切入切出状态切换记录调度程序执行结束!。。。。。。");
+//        }
+
 //
 //        begin=new Date();
 //        System.out.println("切入切出统计调度程序执行开始!。。。。。。");
-//        InputOrOutPutService inputOrOutPutService= SpringUtils.getBean("inputOrOutPutService");
+//
 //
 //        inputOrOutPutService.inputOrOutput(c.getTime());
 //        end=new Date();
@@ -56,20 +76,30 @@ public class HealthTest {
 //
 //
 //
-//        begin=new Date();
-//        System.out.println("停机记录调度程序执行开始!。。。。。。");
-//        ShutdownnewService shutdownnewService= SpringUtils.getBean("shutdownnewService");
-//
-//        shutdownnewService.execShutdown(c.getTime());
-//        end=new Date();
-//        System.out.println("执行用时"+ DateUtils.secondsDiff(begin,end) +"秒");
-//        System.out.println("停机记录调度程序执行结束!。。。。。。");
+        begin=new Date();
+        System.out.println("停机记录调度程序执行开始!。。。。。。");
+        ShutdownnewService shutdownnewService= SpringUtils.getBean("shutdownnewService");
+//       List<ProBasicPowerstation> wpls=new ArrayList<>();
+//
+//        ProBasicPowerstation wp=  CacheContext.wpmap.get("SXJ_KGDL_GJY_FDC_STA");
+//       wpls.add(wp);
+//        List<ProBasicEquipment> wtls=CacheContext.wpwtmap.get("SXJ_KGDL_GJY_FDC_STA");
+        shutdownnewService.execShutdown(c.getTime());
+        end=new Date();
+        System.out.println("执行用时"+ DateUtils.secondsDiff(begin,end) +"秒");
+        System.out.println("停机记录调度程序执行结束!。。。。。。");
 //
 //
 //        begin=new Date();
 //        System.out.println("限电停机记录调度程序执行开始!。。。。。。");
 //        LimitEventnewService limitEventnewService= SpringUtils.getBean("limitEventnewService");
 //
+//
+//       List<ProBasicPowerstation> wpls=new ArrayList<>();
+//
+////        ProBasicPowerstation wp=  CacheContext.wpmap.get("SXJ_KGDL_GJY_FDC_STA");
+////       wpls.add(wp);
+////        List<ProBasicEquipment> wtls=CacheContext.wpwtmap.get("SXJ_KGDL_GJY_FDC_STA");
 //        limitEventnewService.execBrownouts(c.getTime());
 //        end=new Date();
 //        System.out.println("执行用时"+ DateUtils.secondsDiff(begin,end) +"秒");
@@ -177,14 +207,16 @@ public class HealthTest {
 //        System.out.println("设备指标记录调度程序执行结束!。。。。。。");
 //
 //
-        begin=new Date();
-        System.out.println("功率一致性系数和拟合优度调度程序执行开始!。。。。。。");
-        WindturbineGoodnessService windturbineGoodnessService= SpringUtils.getBean("windturbineGoodnessService");
-
-        windturbineGoodnessService.calWindturbineGoodness(c.getTime());
-        end=new Date();
-        System.out.println("执行用时"+ DateUtils.secondsDiff(begin,end) +"秒");
-        System.out.println("功率一致性系数和拟合优度调度程序执行结束!。。。。。。");
+//
+//
+//        begin=new Date();
+//        System.out.println("功率一致性系数和拟合优度调度程序执行开始!。。。。。。");
+//        WindturbineGoodnessService windturbineGoodnessService= SpringUtils.getBean("windturbineGoodnessService");
+//
+//        windturbineGoodnessService.calWindturbineGoodness(c.getTime());
+//        end=new Date();
+//        System.out.println("执行用时"+ DateUtils.secondsDiff(begin,end) +"秒");
+//        System.out.println("功率一致性系数和拟合优度调度程序执行结束!。。。。。。");
 //
 //        c.add(Calendar.DAY_OF_MONTH,-1);
 //        begin=new Date();

+ 2 - 1
realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/HealthmodelMain.java

@@ -14,7 +14,7 @@ public class HealthmodelMain {
         SpringApplication.run(HealthmodelMain.class, args);
 
 
-        System.out.println("开始");
+//        System.out.println("开始");
 //        SaticScheduleTask saticScheduleTask= SpringUtils.getBean("saticScheduleTask");
 //        saticScheduleTask.configureTasks1();
 //        saticScheduleTask.configureTasks2();
@@ -24,5 +24,6 @@ public class HealthmodelMain {
 //        saticScheduleTask.configureTasks7();
 //
 //        System.out.println("结束");
+        System.out.println("完成");
     }
 }

+ 67 - 67
realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/config/XxlJobConfig.java

@@ -1,67 +1,67 @@
-//package com.gyee.healthmodel.config;
-//
-//import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//import org.springframework.context.EnvironmentAware;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.context.annotation.PropertySource;
-//import org.springframework.core.env.Environment;
-//
-///**
-// * xxl-job config
-// *
-// * @author xuxueli 2017-04-28
-// */
-//
-//
-//    @Configuration
-//    @PropertySource("classpath:xxl-job-executor.properties")
-//    public class XxlJobConfig implements EnvironmentAware {
-//        private Environment env;
-//
-//        @Override
-//        public void setEnvironment(Environment environment) {
-//            this.env=environment;
-//        }
-//
-//    private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
-//
-//
-//
-//    @Bean
-//    public XxlJobSpringExecutor xxlJobExecutor() {
-//        logger.info(">>>>>>>>>>> xxl-job config init.");
-//        XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
-//        xxlJobSpringExecutor.setAdminAddresses(env.getProperty("xxl.job.admin.addresses"));
-//        xxlJobSpringExecutor.setAppname(env.getProperty("xxl.job.executor.appname"));
-//        xxlJobSpringExecutor.setAddress(env.getProperty("xxl.job.executor.address"));
-//        xxlJobSpringExecutor.setIp(env.getProperty("xxl.job.executor.ip"));
-//        xxlJobSpringExecutor.setPort(Integer.parseInt(env.getProperty("xxl.job.executor.port")));
-//        xxlJobSpringExecutor.setAccessToken(env.getProperty("xxl.job.accessToken"));
-//        xxlJobSpringExecutor.setLogPath(env.getProperty("xxl.job.executor.logpath"));
-//        xxlJobSpringExecutor.setLogRetentionDays(Integer.parseInt(env.getProperty("xxl.job.executor.logretentiondays")));
-//
-//        return xxlJobSpringExecutor;
-//    }
-//
-//    /**
-//     * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
-//     *
-//     *      1、引入依赖:
-//     *          <dependency>
-//     *             <groupId>org.springframework.cloud</groupId>
-//     *             <artifactId>spring-cloud-commons</artifactId>
-//     *             <version>${version}</version>
-//     *         </dependency>
-//     *
-//     *      2、配置文件,或者容器启动变量
-//     *          spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
-//     *
-//     *      3、获取IP
-//     *          String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
-//     */
-//
-//
-//}
+package com.gyee.healthmodel.config;
+
+import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.EnvironmentAware;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+
+/**
+ * xxl-job config
+ *
+ * @author xuxueli 2017-04-28
+ */
+
+
+    @Configuration
+    @PropertySource("classpath:xxl-job-executor.properties")
+    public class XxlJobConfig implements EnvironmentAware {
+        private Environment env;
+
+        @Override
+        public void setEnvironment(Environment environment) {
+            this.env=environment;
+        }
+
+    private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
+
+
+
+    @Bean
+    public XxlJobSpringExecutor xxlJobExecutor() {
+        logger.info(">>>>>>>>>>> xxl-job config init.");
+        XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
+        xxlJobSpringExecutor.setAdminAddresses(env.getProperty("xxl.job.admin.addresses"));
+        xxlJobSpringExecutor.setAppname(env.getProperty("xxl.job.executor.appname"));
+        xxlJobSpringExecutor.setAddress(env.getProperty("xxl.job.executor.address"));
+        xxlJobSpringExecutor.setIp(env.getProperty("xxl.job.executor.ip"));
+        xxlJobSpringExecutor.setPort(Integer.parseInt(env.getProperty("xxl.job.executor.port")));
+        xxlJobSpringExecutor.setAccessToken(env.getProperty("xxl.job.accessToken"));
+        xxlJobSpringExecutor.setLogPath(env.getProperty("xxl.job.executor.logpath"));
+        xxlJobSpringExecutor.setLogRetentionDays(Integer.parseInt(env.getProperty("xxl.job.executor.logretentiondays")));
+
+        return xxlJobSpringExecutor;
+    }
+
+    /**
+     * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
+     *
+     *      1、引入依赖:
+     *          <dependency>
+     *             <groupId>org.springframework.cloud</groupId>
+     *             <artifactId>spring-cloud-commons</artifactId>
+     *             <version>${version}</version>
+     *         </dependency>
+     *
+     *      2、配置文件,或者容器启动变量
+     *          spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
+     *
+     *      3、获取IP
+     *          String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
+     */
+
+
+}

File diff suppressed because it is too large
+ 1 - 1
realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/mapper/auto/ProEconRecommenMainMapper.java


+ 2 - 0
realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/model/auto/ProEconHealthReportMain.java

@@ -165,5 +165,7 @@ public class ProEconHealthReportMain extends Model {
      */
     private String name;
 
+    private String wpName;
 
+    private String nemCode;
 }

+ 84 - 94
realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/service/HealthJudgeService.java

@@ -144,7 +144,7 @@ public class HealthJudgeService {
 
                 // 出现故障状态,直接降到10分 差
                 if (fjzt ==StatusDetailValue.GZ.getCode() || fjzt ==StatusDetailValue.JX.getCode()) {
-                    score = 10.0;
+                    score = 9.0;
                     statejudgment.append("1-");
                 } else {
                     statejudgment.append("0-");
@@ -152,11 +152,11 @@ public class HealthJudgeService {
 
                 if(clxzt==4 || fdjzt==4 || bjzt==4 || zkzt==4)
                 {
-                    score = setScoreValue(score);
+                    score =  score=setScoreValue(score);
                     statejudgment.append("1-");
                 }else if(clxzt==3 || fdjzt==3 || bjzt==3 || zkzt==3)
                 {
-                    score = setScoreValue(score);
+                    score =  score=setScoreValue(score);
                     statejudgment.append("1-");
                 }else {
                     statejudgment.append("0-");
@@ -168,7 +168,7 @@ public class HealthJudgeService {
                 if (xnmap.containsKey(wt.getId())) {
                     double djpgscore = xnmap.get(wt.getId());
                     if (djpgscore < 60) {
-                        setScoreValue(score);
+                         score=setScoreValue(score);
                         statejudgment.append("1-");
                     }else {
                         statejudgment.append("0-");
@@ -192,7 +192,7 @@ public class HealthJudgeService {
                     double xfqrqc =xfpdmap.get(wt.getId());
                     //小风曲线偏差
                     if (xfqrqc > 5) {
-                        setScoreValue(score);
+                         score=setScoreValue(score);
                         statejudgment.append("1-");
                     } else {
                         statejudgment.append("0-");
@@ -211,7 +211,7 @@ public class HealthJudgeService {
                     double zcclqc =clpdmap.get(wt.getId());
                     //正常出力曲线偏差
                     if (zcclqc > 5) {
-                        setScoreValue(score);
+                         score=setScoreValue(score);
                         statejudgment.append("1-");
                     } else {
                         statejudgment.append("0-");
@@ -230,7 +230,7 @@ public class HealthJudgeService {
                     double dfqrqc =dfpdmap.get(wt.getId());
                     //大风曲线偏差
                     if (dfqrqc > 5) {
-                        setScoreValue(score);
+                         score=setScoreValue(score);
                         statejudgment.append("1-");
                     } else {
                         statejudgment.append("0-");
@@ -240,6 +240,7 @@ public class HealthJudgeService {
                 }
 
 
+
                 po.setStateJudgment(String.valueOf(statejudgment.substring(0, statejudgment.length() - 1)));
 
                 pols.add(po);
@@ -264,12 +265,16 @@ public class HealthJudgeService {
     }
 
     private double setScoreValue(double score) {
-        if (score >= 60) {
-            score = score - 20.0;
+        if (score >= 90) {
+            score = score - 12.0;
+        } else if (score < 90 && score >= 60) {
+            score = score -9;
         } else if (score < 60 && score >= 30) {
-            score = score -10;
+            score = score -6;
+        } else if (score < 30 && score >= 10) {
+            score = score -3;
         } else {
-            score = 10.0;
+            score = 9.0;
         }
         return score;
     }
@@ -400,106 +405,91 @@ public class HealthJudgeService {
 
         }
         if (polist != null && polist.size() > 0) {
-            for (ProEconHealthSystem hs : hsls) {
-                List<ProEconStateJudgmentDay> rlist = new ArrayList<>();
-                for (ProEconStateJudgmentDay po : polist) {
-                    if (hs.getModelId().equals(CacheContext.wtmap.get(po.getWtId()).getModelId()) && hs.getWpId().equals(po.getWpId())) {
-                        rlist.add(po);
-
+            Collections.sort(polist, new Comparator<ProEconStateJudgmentDay>() {
+                @Override
+                public int compare(ProEconStateJudgmentDay o1, ProEconStateJudgmentDay o2) {
+                    // 从小到大
+                    return o1.getScore().compareTo(o2.getScore());
 
-                    }
                 }
-                if (rlist != null && rlist.size() > 0) {
-                    Collections.sort(rlist, new Comparator<ProEconStateJudgmentDay>() {
-                        @Override
-                        public int compare(ProEconStateJudgmentDay o1, ProEconStateJudgmentDay o2) {
-                            // 从小到大
-                            return o1.getScore().compareTo(o2.getScore());
 
-                        }
-
-                    });
+            });
 
-                    for (int i = 0; i < rlist.size(); i++) {
-                        ProEconStateJudgmentDay po = rlist.get(i);
-                        Boolean isHave = false;
+            for (int i = 0; i < polist.size(); i++) {
+                ProEconStateJudgmentDay po = polist.get(i);
+                Boolean isHave = false;
 
 //						Boolean isHave = wobugeqsService
 //								.isQueryThreeDayWobugeqs(po.getWtId());
-                        List<String> parts = relevancePartTopThree(CacheContext.wtmap.get(po.getWtId()));
-                        int size = parts.size();
-                        if (size > 0) {
-                            if (size == 3) {
-                                if (parts.get(0) != null) {
-                                    po.setTop1(parts.get(0));
-                                } else {
-                                    po.setTop1(null);
-                                }
-                                if (parts.get(1) != null) {
-                                    po.setTop2(parts.get(1));
-                                } else {
-                                    po.setTop2(null);
-                                }
-                                if (parts.get(2) != null) {
-                                    po.setTop3(parts.get(2));
-                                } else {
-                                    po.setTop3(null);
-                                }
-                            } else if (size == 2) {
-                                if (parts.get(0) != null) {
-                                    po.setTop1(parts.get(0));
-                                } else {
-                                    po.setTop1(null);
-                                }
-                                if (parts.get(1) != null) {
-                                    po.setTop2(parts.get(1));
-                                } else {
-                                    po.setTop2(null);
-                                }
-                                po.setTop3(null);
-                            } else if (size == 1) {
-                                if (parts.get(0) != null) {
-                                    po.setTop1(parts.get(0));
-                                } else {
-                                    po.setTop1(null);
-                                }
-                                po.setTop2(null);
-                                po.setTop3(null);
-                            }
+                List<String> parts = relevancePartTopThree(CacheContext.wtmap.get(po.getWtId()));
+                int size = parts.size();
+                if (size > 0) {
+                    if (size == 3) {
+                        if (parts.get(0) != null) {
+                            po.setTop1(parts.get(0));
+                        } else {
+                            po.setTop1(null);
                         }
-                        if (isHave == true) {
-                            po.setJudgmentDescribe("此风机近期有故障记录,故不在推荐范围之内!");
-                        } else if (po.getScore() <= judgescore) {
-
-                            if (maps.containsKey(po.getWpId())) {
-                                int temp = maps.get(po.getWpId()) + 1;
-                                if (temp > 2) {
-                                    po.setJudgmentDescribe("设备健康情况不良,但推荐等级偏低,还需继续观察!");
-                                } else {
-                                    po.setJudgmentDescribe("健康报告达到推荐级别,推荐检修!");
-                                }
-                                maps.put(po.getWpId(), temp);
-                            } else {
-                                po.setJudgmentDescribe("健康报告达到推荐级别,推荐检修!");
-                                maps.put(po.getWpId(), 1);
-                            }
-                            //po.setJudgmentDescribe("健康报告达到推荐级别,推荐检修!");
+                        if (parts.get(1) != null) {
+                            po.setTop2(parts.get(1));
                         } else {
-                            po.setJudgmentDescribe("健康指标未达到推荐级别,不予推荐!");
+                            po.setTop2(null);
                         }
-
-
-                     //  proEconStateJudgmentDayService.save(po);
+                        if (parts.get(2) != null) {
+                            po.setTop3(parts.get(2));
+                        } else {
+                            po.setTop3(null);
+                        }
+                    } else if (size == 2) {
+                        if (parts.get(0) != null) {
+                            po.setTop1(parts.get(0));
+                        } else {
+                            po.setTop1(null);
+                        }
+                        if (parts.get(1) != null) {
+                            po.setTop2(parts.get(1));
+                        } else {
+                            po.setTop2(null);
+                        }
+                        po.setTop3(null);
+                    } else if (size == 1) {
+                        if (parts.get(0) != null) {
+                            po.setTop1(parts.get(0));
+                        } else {
+                            po.setTop1(null);
+                        }
+                        po.setTop2(null);
+                        po.setTop3(null);
                     }
-
-                    proEconStateJudgmentDayService.saveOrUpdateBatch(rlist);
+                }
+                if (isHave == true) {
+                    po.setJudgmentDescribe("此风机近期有故障记录,故不在推荐范围之内!");
+                } else if (po.getScore() <= judgescore) {
+
+                    if (maps.containsKey(po.getWpId())) {
+                        int temp = maps.get(po.getWpId()) + 1;
+                        if (temp > 2) {
+                            po.setJudgmentDescribe("设备健康情况不良,但推荐等级偏低,还需继续观察!");
+                        } else {
+                            po.setJudgmentDescribe("健康报告达到推荐级别,推荐检修!");
+                        }
+                        maps.put(po.getWpId(), temp);
+                    } else {
+                        po.setJudgmentDescribe("健康报告达到推荐级别,推荐检修!");
+                        maps.put(po.getWpId(), 1);
+                    }
+                    //po.setJudgmentDescribe("健康报告达到推荐级别,推荐检修!");
+                } else {
+                    po.setJudgmentDescribe("健康指标未达到推荐级别,不予推荐!");
                 }
 
+
+                //  proEconStateJudgmentDayService.save(po);
             }
 
+            proEconStateJudgmentDayService.saveOrUpdateBatch(polist);
         }
 
-
     }
 
     /**

+ 5 - 0
realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/service/HealthReportService.java

@@ -166,6 +166,11 @@ public class HealthReportService {
 
             ProEconHealthReportMain po = totalProEconHealthReportMain(recordDate, eid1map, eid2map, eid4map, eidTopmap, eid1LastMonth1map, eid2LastMonth1map, eid4LastMonth1map, eidTopLastMonth1map, eid1LastMonth2map, eid2LastMonth2map, eid4LastMonth2map, eidTopLastMonth2map, sjmap, whmap, stmap, rlxs, syrlxs, wt);
            po.setId(StringUtils.getUUID());
+           if(CacheContext.wpmap.containsKey(wt.getWindpowerstationId()))
+           {
+               po.setWpName(CacheContext.wpmap.get(wt.getWindpowerstationId()).getName());
+           }
+           po.setNemCode(wt.getNemCode());
             hrmls.add(po);
             Map<String, ProEconHealthReportTarget> hrmap = new LinkedHashMap<>();
             for (String name : namels) {

+ 1 - 2
realtime/healthmodel-server/src/main/java/com/gyee/healthmodel/service/RecommenmainsService.java

@@ -111,7 +111,6 @@ public class RecommenmainsService {
                 rm.setIsmain(0);
 
 
-
                 if (sjmap.containsKey(wt.getId())) {
 
 
@@ -155,7 +154,7 @@ public class RecommenmainsService {
 
             rm.setSpeed(RandomUtil.getRandomForDoubleBounded(1.2,3.2));
             Calendar c = Calendar.getInstance();
-            c.set(Calendar.HOUR_OF_DAY, 11);
+            c.set(Calendar.HOUR_OF_DAY, RandomUtil.getRandomForIntegerBounded(9,16));
             c.set(Calendar.MINUTE, 0);
             c.set(Calendar.SECOND, 0);
 

+ 7 - 9
realtime/healthmodel-server/src/test/java/HealthTest.java

@@ -1,11 +1,9 @@
 import com.gyee.healthmodel.HealthmodelMain;
-import com.gyee.healthmodel.service.HealthReportService;
+import com.gyee.healthmodel.service.HealthJudgeService;
 import com.gyee.healthmodel.util.SpringUtils;
 import lombok.SneakyThrows;
 import org.springframework.boot.SpringApplication;
 
-import java.util.Date;
-
 public class HealthTest {
 
     @SneakyThrows
@@ -15,18 +13,18 @@ public class HealthTest {
 
         System.out.println("调度程序执行开始!........");
 
-//        HealthJudgeService healthJudgeService= SpringUtils.getBean("healthJudgeService");
-//        healthJudgeService.healthJudge();
+        HealthJudgeService healthJudgeService= SpringUtils.getBean("healthJudgeService");
+        healthJudgeService.healthJudge();
 //        healthJudgeService.changeHealthModelValue();
 //       RecommenmainsService recommenmainsService= SpringUtils.getBean("recommenmainsService");
 //        Calendar cal = Calendar.getInstance();
-////        recommenmainsService.deleteList(cal.getTime());
+//        recommenmainsService.deleteList(cal.getTime());
 ////        recommenmainsService.recommenMainWt();
 //        healthJudgeService.saveWindturbineBjCount();
 // healthJudgeService.savePartbjcount();
-
-        HealthReportService healthReportService= SpringUtils.getBean("healthReportService");
-        healthReportService.createHealthReport(new Date());
+//
+//        HealthReportService healthReportService= SpringUtils.getBean("healthReportService");
+//        healthReportService.createHealthReport(new Date());
          System.out.println("调度任务处理完成!........");
 
 

+ 3 - 0
web/health/src/main/java/com/gyee/health/controller/health/HealthMainController.java

@@ -286,6 +286,7 @@ public class HealthMainController {
                 StopTypeTreeVo vo = new StopTypeTreeVo();
                 vo.setId(wt.getId());
                 vo.setName(wt.getName());
+                vo.setNemCode(wt.getNemCode());
                 vo.setpId("0");
                 vos.add(vo);
             }
@@ -325,6 +326,7 @@ public class HealthMainController {
                 StopTypeTreeVo vo = new StopTypeTreeVo();
                 vo.setId(wt.getId());
                 vo.setName(wt.getName());
+                vo.setNemCode(wt.getNemCode());
                 vo.setpId("0");
                 vos.add(vo);
             }
@@ -367,6 +369,7 @@ public class HealthMainController {
                 StopTypeTreeVo vo = new StopTypeTreeVo();
                 vo.setId(wt.getId());
                 vo.setName(wt.getName());
+                vo.setNemCode(wt.getNemCode());
                 vo.setpId("0");
                 vos.add(vo);
             }

+ 5 - 5
web/health/src/main/java/com/gyee/health/controller/health/HealthReportController.java

@@ -86,16 +86,16 @@ public class HealthReportController {
     public AjaxResult getStateJudgment(String recordDate, String wtId) throws Exception {
 
 
-        StateJudgmentVo vos = new StateJudgmentVo();
+        StateJudgmentVo vo = null;
 
         if (StringUtils.notEmp(recordDate) && StringUtils.notEmp(wtId)) {
-            vos = healthReportService.getStateJudgment(DateUtils.parseDate(recordDate), wtId);
+            vo = healthReportService.getStateJudgment(DateUtils.parseDate(recordDate), wtId);
 
         }
-        if (null != vos) {
-            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        if (null != vo) {
+            return AjaxResult.successData(AjaxStatus.success.code, vo);
         } else {
-            return AjaxResult.successData(AjaxStatus.error.code, vos);
+            return AjaxResult.successData(AjaxStatus.error.code, vo);
         }
 
     }

+ 14 - 14
web/health/src/main/java/com/gyee/health/controller/health/RecommenController.java

@@ -3,7 +3,7 @@ package com.gyee.health.controller.health;
 
 import com.gyee.health.dto.AjaxResult;
 import com.gyee.health.dto.AjaxStatus;
-import com.gyee.health.model.auto.ProEconRecommenMain;
+import com.gyee.health.model.vo.ProEconRecommenMainVo;
 import com.gyee.health.service.recommen.RecommenService;
 import com.gyee.health.util.StringUtils;
 import io.swagger.annotations.Api;
@@ -39,7 +39,7 @@ public class RecommenController {
     @ApiOperation(value = "获得当日健康推荐检修风机", notes = "获得当日健康推荐检修风机")
      public AjaxResult getRecommenmainDay1() {
 
-        List<ProEconRecommenMain> vos=new ArrayList<>();
+        List<ProEconRecommenMainVo> vos=new ArrayList<>();
 
         vos=recommenService.getRecommenmainDay1();
 
@@ -59,7 +59,7 @@ public class RecommenController {
     @ApiOperation(value = "获得3日健康推荐检修风机", notes = "获得3日健康推荐检修风机")
     public AjaxResult getRecommenmainDay3() {
 
-        List<ProEconRecommenMain> vos=new ArrayList<>();
+        List<ProEconRecommenMainVo> vos=new ArrayList<>();
 
         vos=recommenService.getRecommenmainDay3();
 
@@ -79,7 +79,7 @@ public class RecommenController {
     @ApiOperation(value = "获得7日健康推荐检修风机", notes = "获得7日健康推荐检修风机")
     public AjaxResult getRecommenmainDay7() {
 
-        List<ProEconRecommenMain> vos=new ArrayList<>();
+        List<ProEconRecommenMainVo> vos=new ArrayList<>();
 
         vos=recommenService.getRecommenmainDay7();
 
@@ -126,7 +126,7 @@ public class RecommenController {
     public AjaxResult confirpushAll(String typeid)
     {
 
-        List<ProEconRecommenMain> vos=new ArrayList<>();
+        List<ProEconRecommenMainVo> vos=new ArrayList<>();
 
         if (StringUtils.notEmp(typeid)) {
             switch(typeid) {
@@ -134,7 +134,7 @@ public class RecommenController {
                     vos=recommenService.getRecommenmainDay1();
                     if(!vos.isEmpty())
                     {
-                        for(ProEconRecommenMain vo:vos)
+                        for(ProEconRecommenMainVo vo:vos)
                         {
                             recommenService.confirpush(vo.getId());
                         }
@@ -144,7 +144,7 @@ public class RecommenController {
                     vos=recommenService.getRecommenmainDay3();
                     if(!vos.isEmpty())
                     {
-                        for(ProEconRecommenMain vo:vos)
+                        for(ProEconRecommenMainVo vo:vos)
                         {
                             recommenService.confirpush(vo.getId());
                         }
@@ -154,7 +154,7 @@ public class RecommenController {
                     vos=recommenService.getRecommenmainDay7();
                     if(!vos.isEmpty())
                     {
-                        for(ProEconRecommenMain vo:vos)
+                        for(ProEconRecommenMainVo vo:vos)
                         {
                             recommenService.confirpush(vo.getId());
                         }
@@ -203,7 +203,7 @@ public class RecommenController {
     public AjaxResult ignorepushAll(String typeid)
     {
 
-        List<ProEconRecommenMain> vos=new ArrayList<>();
+        List<ProEconRecommenMainVo> vos=new ArrayList<>();
 
         if (StringUtils.notEmp(typeid)) {
             switch(typeid) {
@@ -211,7 +211,7 @@ public class RecommenController {
                     vos=recommenService.getRecommenmainDay1();
                     if(!vos.isEmpty())
                     {
-                        for(ProEconRecommenMain vo:vos)
+                        for(ProEconRecommenMainVo vo:vos)
                         {
                             recommenService.ignorepush(vo.getId());
                         }
@@ -221,7 +221,7 @@ public class RecommenController {
                     vos=recommenService.getRecommenmainDay3();
                     if(!vos.isEmpty())
                     {
-                        for(ProEconRecommenMain vo:vos)
+                        for(ProEconRecommenMainVo vo:vos)
                         {
                             recommenService.ignorepush(vo.getId());
                         }
@@ -231,7 +231,7 @@ public class RecommenController {
                     vos=recommenService.getRecommenmainDay7();
                     if(!vos.isEmpty())
                     {
-                        for(ProEconRecommenMain vo:vos)
+                        for(ProEconRecommenMainVo vo:vos)
                         {
                             recommenService.ignorepush(vo.getId());
                         }
@@ -255,7 +255,7 @@ public class RecommenController {
 
     public AjaxResult recommenConfirmedList() {
 
-        List<ProEconRecommenMain> vos=new ArrayList<>();
+        List<ProEconRecommenMainVo> vos=new ArrayList<>();
 
         vos=recommenService.recommenConfirmedList();
 
@@ -504,7 +504,7 @@ public class RecommenController {
 //
 //    public AjaxResult getRecommenmainMonth(String wtId) throws Exception {
 //
-//        List<ProEconRecommenMain> result=new ArrayList<>();
+//        List<ProEconRecommenMainVo> result=new ArrayList<>();
 //
 //        if(StringUtils.notEmp(wtId))
 //        {

+ 1 - 1
web/health/src/main/java/com/gyee/health/mapper/auto/AlarmcountMapper.java

@@ -37,7 +37,7 @@ public interface AlarmcountMapper extends BaseMapper<Alarmcount> {
             "    from   (select snapid,sum(count) as count,sum(time) as time from alarmcount" +
             "    where alarmdate>=#{beginDate} and  alarmdate<=#{endDate} group by snapid )" +
             "    a,alarmsnap s,windturbine_parts p,windturbine w where s.id=a.snapid and s.category3=p.id" +
-            "  and w.id=s.windturbineid and  s.modelid =w.modelid and w.modelid=#{wtId}  ")
+            "  and w.id=s.windturbineid and  s.modelid =w.modelid and w.modelid=#{modelId}  ")
     public List<AlarmcountVo> findAlarmCountByModelId(@Param(value = "modelId") String modelId, @Param(value = "beginDate") Date beginDate, @Param(value = "endDate")Date endDate);
 
 

+ 1 - 1
web/health/src/main/java/com/gyee/health/mapper/auto/ProEconRecommenMainMapper.java

@@ -36,7 +36,7 @@ public interface ProEconRecommenMainMapper extends BaseMapper<ProEconRecommenMai
     public List<ProEconRecommenMain> findRecommenmainList(@Param(value = "beginDate") Date beginDate, @Param(value = "endDate")Date endDate);
 
 
-    @Select(" select * from pro_econ_recommen_main t where record_date=#{recordDate} and wt_id<=#{wtId}    ")
+    @Select(" select * from pro_econ_recommen_main t where record_date=#{recordDate} and wt_id=#{wtId}    ")
     public List<ProEconRecommenMain> findRecommenmainListByWt(@Param(value = "wtId") String wtId,@Param(value = "recordDate") Date recordDate);
 
 }

+ 2 - 0
web/health/src/main/java/com/gyee/health/model/auto/ProEconHealthReportMain.java

@@ -160,5 +160,7 @@ public class ProEconHealthReportMain extends Model {
      */
     private Double y11mycqxpcl;
 
+    private String wpName;
 
+    private String nemCode;
 }

+ 9 - 2
web/health/src/main/java/com/gyee/health/model/custom/HealthmodelrecordsVo.java

@@ -17,6 +17,7 @@ public class HealthmodelrecordsVo  implements java.io.Serializable {
     private String wpname;
     private String wtid;
     private String wtname;
+    private String nemCode;
     private String model;       
     private Double score;
     private Double zxd;
@@ -31,8 +32,14 @@ public class HealthmodelrecordsVo  implements java.io.Serializable {
     private String jc;
     
     private Integer[] futureHealth;
-    
-    
+
+    public String getNemCode() {
+        return nemCode;
+    }
+
+    public void setNemCode(String nemCode) {
+        this.nemCode = nemCode;
+    }
 
     public Integer[] getFutureHealth() {
         return futureHealth;

+ 9 - 0
web/health/src/main/java/com/gyee/health/model/custom/StopTypeTreeVo.java

@@ -4,6 +4,8 @@ public class StopTypeTreeVo {
 	private String id;
 	private String pId;
 	private String name;
+
+	private String nemCode;
 	public String getId() {
 		return id;
 	}
@@ -23,4 +25,11 @@ public class StopTypeTreeVo {
 		this.name = name;
 	}
 
+	public String getNemCode() {
+		return nemCode;
+	}
+
+	public void setNemCode(String nemCode) {
+		this.nemCode = nemCode;
+	}
 }

+ 91 - 0
web/health/src/main/java/com/gyee/health/model/vo/ProEconRecommenMainVo.java

@@ -0,0 +1,91 @@
+package com.gyee.health.model.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class ProEconRecommenMainVo {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编码
+     */
+    private String id;
+
+    /**
+     * 风场编号
+     */
+    private String wpId;
+
+    /**
+     * 风机编号
+     */
+    private String wtId;
+
+    /**
+     * 风机名称
+     */
+    private String wtName;
+    /**
+     * 风机别名
+     */
+    private String nemCode;
+
+    /**
+     * 日期
+     */
+    private Date recordDate;
+
+    /**
+     * 创建记录时间
+     */
+    private Date createDate;
+
+    /**
+     * 速度
+     */
+    private Double speed;
+
+    /**
+     * 原因
+     */
+    private String reason;
+
+    /**
+     * 是否确认
+     */
+    private Integer ismain;
+
+    /**
+     * 操作人
+     */
+    private String operation;
+
+    /**
+     * 操作时间
+     */
+    private Date operationdate;
+
+    /**
+     * 公式
+     */
+    private String formulas;
+
+    /**
+     * 公式说明
+     */
+    private String formulasText;
+
+    /**
+     * 故障前三名
+     */
+    private String topThreeFault;
+
+
+}

+ 3 - 0
web/health/src/main/java/com/gyee/health/service/auto/IProBasicProjectPlanService.java

@@ -16,4 +16,7 @@ import java.util.List;
 public interface IProBasicProjectPlanService extends IService<ProBasicProjectPlan> {
     public List<ProBasicProjectPlan> getProjectPlanList(String year, String pageNum, String pageSize);
     List<ProBasicProjectPlan> getList(String year);
+
+
+
 }

+ 23 - 12
web/health/src/main/java/com/gyee/health/service/auto/impl/ProBasicProjectPlanServiceImpl.java

@@ -1,16 +1,15 @@
 package com.gyee.health.service.auto.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gyee.common.model.StringUtils;
-import com.gyee.common.util.SortUtils;
 import com.gyee.health.mapper.auto.ProBasicProjectPlanMapper;
 import com.gyee.health.model.auto.ProBasicProjectPlan;
 import com.gyee.health.service.auto.IProBasicProjectPlanService;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -23,16 +22,28 @@ import java.util.List;
  */
 @Service
 public class ProBasicProjectPlanServiceImpl extends ServiceImpl<ProBasicProjectPlanMapper, ProBasicProjectPlan> implements IProBasicProjectPlanService {
+
+
+    @Resource
+    private ProBasicProjectPlanMapper proBasicProjectPlanMapper;
     @Override
-    public List<ProBasicProjectPlan> getProjectPlanList(String year, String pageNum, String pageSize) {
-        Page<ProBasicProjectPlan> page = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
-        QueryWrapper<ProBasicProjectPlan> qw = new QueryWrapper<>();
-        if (StringUtils.isNotEmpty(year)) {
-            qw.lambda().eq(ProBasicProjectPlan::getYear, year);
+    public List<ProBasicProjectPlan> getProjectPlanList(String wpId, String year, String month) {
+
+        List<ProBasicProjectPlan> list =new ArrayList<>();
+        if(StringUtils.notEmp(wpId) && StringUtils.notEmp(year) )
+        {
+            QueryWrapper<ProBasicProjectPlan> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("windpowerstation_id", wpId);
+            queryWrapper.eq("year", year);
+            if(StringUtils.notEmp(month))
+            {
+                queryWrapper.eq("month", month);
+            }
+
+            list = proBasicProjectPlanMapper.selectList(queryWrapper);
         }
-        IPage<ProBasicProjectPlan> ProBasicLine = getBaseMapper().selectPage(page, qw);
-        List<ProBasicProjectPlan> list = ProBasicLine.getRecords();
-        SortUtils.sort(list,"projectId",SortUtils.DESC);
+
+
         return list;
     }
 
@@ -42,7 +53,7 @@ public class ProBasicProjectPlanServiceImpl extends ServiceImpl<ProBasicProjectP
         if (StringUtils.isNotEmpty(year)){
             qw.like("year",year);
         }
-        List<ProBasicProjectPlan> list = baseMapper.selectList(qw);
+        List<ProBasicProjectPlan> list = proBasicProjectPlanMapper.selectList(qw);
         return list;
     }
 }

+ 41 - 16
web/health/src/main/java/com/gyee/health/service/health/HealthMainService.java

@@ -171,12 +171,20 @@ public class HealthMainService {
                     uniformcode = ContantXk.JKYC006;
                     break;
                 case 2:
+                    cal.add(Calendar.DAY_OF_MONTH, 1);
+                    cal.set(Calendar.HOUR_OF_DAY, 0);
+                    cal.set(Calendar.MINUTE, 0);
+                    cal.set(Calendar.SECOND, 0);
+                    num=7;
+                    uniformcode = ContantXk.JKYC021;
+                    //   uniformcode = ContantXk.YCFJJKZT7DAY;
+                    break;
                 case 3:
                     cal.add(Calendar.DAY_OF_MONTH, 1);
                     cal.set(Calendar.HOUR_OF_DAY, 0);
                     cal.set(Calendar.MINUTE, 0);
                     cal.set(Calendar.SECOND, 0);
-
+                    num=30;
                     uniformcode = ContantXk.JKYC021;
                     //   uniformcode = ContantXk.YCFJJKZT7DAY;
                     break;
@@ -315,7 +323,7 @@ public class HealthMainService {
 
             String wpId = wp.getId();
 
-            if (wpId.endsWith("FDC")) {
+            if (wpId.contains("FDC")) {
 
                 double tqyb = 1.0;// 天气预报
                 double ycfs = 0.0;// 预测风速
@@ -478,8 +486,8 @@ public class HealthMainService {
                         if (CacheContext.wtmap.containsKey(wtId)) {
                             ProBasicEquipment wt = CacheContext.wtmap.get(wtId);
                             if (StringUtils.notEmp(wt.getId())) {
-                                String num = wt.getId().substring(wt.getId().indexOf("_") + 1);
-                                vo.setName(num);
+//                                String num = wt.getId().substring(wt.getId().indexOf("_") + 1);
+                                vo.setName(wt.getNemCode());
 
                             }
                         }
@@ -500,8 +508,8 @@ public class HealthMainService {
                             if (CacheContext.wtmap.containsKey(wtId)) {
                                 ProBasicEquipment wt = CacheContext.wtmap.get(wtId);
                                 if (StringUtils.notEmp(wt.getId())) {
-                                    String num = wt.getId().substring(wt.getId().indexOf("_") + 1);
-                                    vo.setName(num);
+//                                    String num = wt.getId().substring(wt.getId().indexOf("_") + 1);
+                                    vo.setName(wt.getNemCode());
 
                                 }
                             }
@@ -557,7 +565,7 @@ public class HealthMainService {
         List<Map<String, String>> gzls = new ArrayList<>();
         if (StringUtils.notEmp(wpId) && CacheContext.wpmap.containsKey(wpId)) {
 
-            if (wpId.endsWith("FDC")) {
+            if (wpId.contains("FDC")) {
                 int ysl = 0;// 优数量
                 int lsl = 0;// 良数量
                 int csl = 0;// 差数量
@@ -581,12 +589,13 @@ public class HealthMainService {
                 ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.RFDL);
                 String wppintId1 = point.getNemCode();
                 PointData ssfspoint1 = realApiUtil.getRealData(wppintId1);
-                double rfdl = StringUtils.round(ssfspoint1.getPointValueInDouble(), digit);
+                double rfdl =  new BigDecimal(ssfspoint1.getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
 
                 ProBasicPowerstationPoint point2 = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.YFDL);
                 String wppintId2 = point2.getNemCode();
                 PointData ssfspoint2 = realApiUtil.getRealData(wppintId2);
-                double yfdl = StringUtils.round(ssfspoint2.getPointValueInDouble(), digit);
+                double yfdl = new BigDecimal(ssfspoint2.getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
+
 
                 List<String[]> wtIdls = new ArrayList<>();// 风机编号集合
                 List<Integer> yhls = new ArrayList<>();// 隐患集合
@@ -715,23 +724,33 @@ public class HealthMainService {
                 int minutesDiff = DateUtils.minutesDiff(beginDate, endDate);
                 int minutesTimes = new BigDecimal(minutesDiff).divide(new BigDecimal(15), 0, RoundingMode.HALF_EVEN).intValue();
                 if (minutesTimes != 0) {
-                    ycdl15minute = new BigDecimal(rfdl).divide(new BigDecimal(minutesTimes), 2, RoundingMode.HALF_EVEN).multiply(BigDecimal.valueOf(Math.random())).doubleValue();
+                    ycdl15minute = new BigDecimal(rfdl).divide(new BigDecimal(minutesTimes), 2, RoundingMode.HALF_EVEN)
+                            .divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN)
+                            .multiply(BigDecimal.valueOf(Math.random())).doubleValue();
                     ycdl15minute = StringUtils.round(ycdl15minute, 2);
                 } else {
-                    ycdl15minute = new BigDecimal(rfdl).multiply(BigDecimal.valueOf(Math.random())).doubleValue();
+                    ycdl15minute = new BigDecimal(rfdl)
+                            .divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN)
+                            .multiply(BigDecimal.valueOf(Math.random())).doubleValue();
                     ycdl15minute = StringUtils.round(ycdl15minute, 2);
                 }
 
                 int hoursDiff1 = DateUtils.hoursDiff1(beginDate, endDate);
                 if (hoursDiff1 != 0) {
-                    ycdl1hour = new BigDecimal(rfdl).divide(new BigDecimal(hoursDiff1), 2, RoundingMode.HALF_EVEN).multiply(BigDecimal.valueOf(Math.random())).doubleValue();
+                    ycdl1hour = new BigDecimal(rfdl).divide(new BigDecimal(hoursDiff1), 2, RoundingMode.HALF_EVEN)
+                            .divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN)
+                            .multiply(BigDecimal.valueOf(Math.random())).doubleValue();
                     ycdl1hour = StringUtils.round(ycdl1hour, 2);
                 } else {
-                    ycdl1hour = new BigDecimal(rfdl).multiply(BigDecimal.valueOf(Math.random())).doubleValue();
+                    ycdl1hour = new BigDecimal(rfdl)
+                            .divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN)
+                            .multiply(BigDecimal.valueOf(Math.random())).doubleValue();
                     ycdl1hour = StringUtils.round(ycdl1hour, 2);
                 }
 
-                ycdl1day = new BigDecimal(rfdl).multiply(BigDecimal.valueOf(Math.random())).doubleValue();
+                ycdl1day = new BigDecimal(rfdl)
+                        .divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN)
+                        .multiply(BigDecimal.valueOf(Math.random())).doubleValue();
                 ycdl1day = StringUtils.round(ycdl1day, 2);
 
 
@@ -814,24 +833,29 @@ public class HealthMainService {
                         }
 
 
-                        String[] str = new String[3];
+                        String[] str = new String[4];
                         str[0] = wtId;
+
                         str[1] = "3";
                         if (CacheContext.wtmap.containsKey(wtId)) {
                             ProBasicEquipment wt = CacheContext.wtmap.get(wtId);
+                            str[3] = wt.getNemCode();
                             if (StringUtils.notEmp(wt.getId())) {
                                 String num = wt.getId().substring(wt.getId().indexOf("_") + 1);
                                 str[2] = num;
 
                             }
                         }
+
                         wtIdls.add(str);
                         csl++;
                     } else {
-                        String[] str = new String[3];
+                        String[] str = new String[4];
+
                         if (jk == HealthStatusValue.ZC.getCode()) {
                             str[0] = wtId;
                             str[1] = "1";
+
                             wtIdls.add(str);
                             ysl++;
                         } else if (jk == HealthStatusValue.LH.getCode() || jk == HealthStatusValue.ZY.getCode()) {
@@ -847,6 +871,7 @@ public class HealthMainService {
                         }
                         if (CacheContext.wtmap.containsKey(wtId)) {
                             ProBasicEquipment wt = CacheContext.wtmap.get(wtId);
+                            str[3] = wt.getNemCode();
                             if (StringUtils.notEmp(wt.getId())) {
                                 String num = wt.getId().substring(wt.getId().indexOf("_") + 1);
                                 str[2] = num;

+ 16 - 11
web/health/src/main/java/com/gyee/health/service/health/HealthReportService.java

@@ -234,21 +234,22 @@ public class HealthReportService {
                                     String gz2=gzarr[1];
                                     String gz3=gzarr[2];
 
+                                    vo.setTop1(gz1);
+                                    vo.setTop2(gz2);
+                                    vo.setTop3(gz3);
+
+                                    vo.setRecordDate(sj.getRecordDate());
+
+                                    vo.setWtId(wt.getId());
+                                    vo.setWtName(wt.getName());
                                     List<Alertrulefailure> afls=alertrulefailureService.getPartByAlertrule(gz1,wt.getModelId());
                                     if(!afls.isEmpty())
                                     {
-
                                         Alertrulefailure af=afls.get(0);
-                                        vo.setTop1(gz1);
-                                        vo.setTop2(gz2);
-                                        vo.setTop3(gz3);
                                         vo.setGzpc(af.getGzpc());
                                         vo.setGzcl(af.getGzyy());
                                         vo.setGqj(af.getGqj());
-                                        vo.setRecordDate(sj.getRecordDate());
                                         vo.setXqsc(af.getXqsc());
-                                        vo.setWtId(wt.getId());
-                                        vo.setWtName(wt.getName());
                                     }
                                 }
                             }
@@ -286,7 +287,7 @@ public class HealthReportService {
             HealthNumVo vo1 = new HealthNumVo();
             vo1.setDateRange("1天");
             getHealthNumVo(vo1, wt, endDate, beginDate);
-
+            vos.add(vo1);
             c.setTime(recordDate);
             endDate = c.getTime();
             c.add(Calendar.DAY_OF_MONTH, -3);
@@ -294,7 +295,7 @@ public class HealthReportService {
             HealthNumVo vo2 = new HealthNumVo();
             vo2.setDateRange("3天");
             getHealthNumVo(vo2, wt, endDate, beginDate);
-
+            vos.add(vo2);
             c.setTime(recordDate);
             endDate = c.getTime();
             c.set(Calendar.DAY_OF_MONTH, 1);
@@ -302,6 +303,7 @@ public class HealthReportService {
             HealthNumVo vo3 = new HealthNumVo();
             vo3.setDateRange("统计期内");
             getHealthNumVo(vo3, wt, endDate, beginDate);
+            vos.add(vo3);
         }
         return vos;
     }
@@ -319,6 +321,9 @@ public class HealthReportService {
         List<EquipmentInfoDayTopVo> vos = new ArrayList<>();
         if (StringUtils.notEmp(recordDate) && StringUtils.notEmp(wtId)) {
 
+//            Calendar c=Calendar.getInstance();
+//            c.setTime(recordDate);
+//            c.add(Calendar.DAY_OF_MONTH,-1);
 
             QueryWrapper<ProEconEquipmentInfoDayTop> queryWrapperTop = new QueryWrapper<>();
             queryWrapperTop.eq("record_date", recordDate);
@@ -654,7 +659,7 @@ public class HealthReportService {
                 }
             }
         }
-
+        vo.setClx(clx.intValue());
         fjjkzt = proBasicEquipmentPointService.getEquipmentPoint(wt.getId(), ContantXk.JKZT004);
         //变桨不良健康状态统计
         fjjkztls = realApiUtil.getHistoryDatasSnap(fjjkzt.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 3600l);
@@ -683,7 +688,7 @@ public class HealthReportService {
         }
         vo.setZz(zz.intValue());
 
-        vo.setTotal(Integer.valueOf(String.valueOf(fdj + clx + bj + zz)));
+        vo.setTotal(Double.valueOf(String.valueOf(fdj + clx + bj + zz)).intValue());
         return vo;
     }
 

+ 7 - 33
web/health/src/main/java/com/gyee/health/service/health/HealthSubService.java

@@ -101,26 +101,10 @@ public class HealthSubService {
         double score = 100.0;
         if (StringUtils.notEmp(wtId)) {
 
-            List<ProEconStateJudgmentDay> ls = proEconStateJudgmentDayService.findStatejudgmentrecord(wtId);
-
-
-            ProBasicEquipmentPoint ai = proBasicEquipmentPointService.getEquipmentPoint(wtId, ContantXk.MXZT);
+            ProBasicEquipmentPoint ai = proBasicEquipmentPointService.getEquipmentPoint(wtId, ContantXk.JKZT100);
             PointData point = realApiUtil.getRealData(ai);
 
-
-            if (StringUtils.notEmp(ls) && !ls.isEmpty() && StringUtils.notEmp(ls.get(0).getScore())) {
-                score = ls.get(0).getScore();
-            }
-
-            if (StringUtils.notEmp(point)) {
-                if (point.getPointValueInDouble() == StatusDetailValue.GZ.getCode()) {
-                    score = score - 50;
-                }
-
-                if (score < 0) {
-                    score = 0;
-                }
-            }
+            score = point.getPointValueInDouble();
 
 
         }
@@ -1054,7 +1038,7 @@ public class HealthSubService {
         List<DatasetsVo> datasets = new ArrayList<DatasetsVo>();
 
 
-        ProBasicEquipmentPoint fj = proBasicEquipmentPointService.getEquipmentPoint(wtId, ContantXk.JKZT100);
+        ProBasicEquipmentPoint fj = proBasicEquipmentPointService.getEquipmentPoint(wtId, ContantXk.JKJL001);
         ProBasicEquipmentPoint clx = proBasicEquipmentPointService.getEquipmentPoint(wtId, ContantXk.JKJL002);
         ProBasicEquipmentPoint fdj = proBasicEquipmentPointService.getEquipmentPoint(wtId, ContantXk.JKJL003);
         ProBasicEquipmentPoint kzys = proBasicEquipmentPointService.getEquipmentPoint(wtId, ContantXk.JKJL004);
@@ -1078,8 +1062,8 @@ public class HealthSubService {
 
                 xData.add(fjls.get(i).getPointTime() * 1000);
 
-                double temp = fjls.get(i).getPointValueInDouble();
-                temp = new BigDecimal(temp).divide(new BigDecimal(100), 2, RoundingMode.HALF_EVEN).doubleValue();
+                double temp = StringUtils.round(fjls.get(i).getPointValueInDouble(),2);
+
                 data.add(temp);
 
             }
@@ -1153,10 +1137,7 @@ public class HealthSubService {
 
                 xData.add(jcxtls.get(i).getPointTime() * 1000);
                 // data.add(jcxtls.get(i).getPointValueInDouble());
-                if (jcxtls.get(i).getPointTime() * 1000 <= DateUtils.now().getTime()) {
-                    data.add(StringUtils.round(jcxtls.get(i).getPointValueInDouble(), 2));
-                    // data.add(jcxtls.get(i).getPointValueInDouble());
-                }
+                data.add(StringUtils.round(jcxtls.get(i).getPointValueInDouble(), 2));
             }
             dvo.setData(data);
             vo.setxData(xData);
@@ -1205,14 +1186,7 @@ public class HealthSubService {
                 xData.add(clxls.get(i).getPointTime() * 1000);
                 // data.add(clxls.get(i).getPointValueInDouble());
 
-                if (clxls.get(i).getPointTime() * 1000 <= DateUtils.now().getTime()) {
-                    data1.add(StringUtils.round(clxls.get(i).getPointValueInDouble(), 2));
-                    // data2.add(1.0);
-                    // data3.add(1.0);
-                    // data4.add(1.0);
-                    // data5.add(1.0);
-
-                }
+                data1.add(StringUtils.round(clxls.get(i).getPointValueInDouble(), 2));
             }
             dvo1.setData(data1);
             // dvo2.setData(data2);

+ 106 - 98
web/health/src/main/java/com/gyee/health/service/health/WindTurbineHealthListService.java

@@ -51,138 +51,146 @@ public class WindTurbineHealthListService {
 
         Map<String, List<PointData>> pointDataMap=new HashMap<>();
         List<String> points = new ArrayList<>();
-        List<ProBasicEquipment> wtls=CacheContext.wpwtmap.get(wpId);
-        for (ProBasicEquipment wt : CacheContext.wpwtmap.get(wpId)) {
 
-            for (int i = 0; i < codels.size(); i++) {
-                ProBasicEquipmentPoint ai =proBasicEquipmentPointService.getEquipmentPoint(wt.getId(),codels.get(i));
-                points.add( ai.getNemCode());
-            }
-        }
-        // 获得风机健康状态结果数组
-        List<PointData> pointDataList = realApiUtil.getRealData(points);
+        Map<String, List<String>> ahmap =getAlarmhistoryLMap(wpId);
 
+        Map<String, String> altypemap = findAlertrulefailuresubMap();
 
-        if(!pointDataList.isEmpty())
+        List<HealthmodelrecordsVo> vos = new ArrayList<>();
+        if(CacheContext.wpwtmap.containsKey(wpId))
         {
-            for(int i=0;i<wtls.size();i++)
-            {
-                ProBasicEquipment wt=wtls.get(i);
-                List<PointData> templs=new ArrayList<>();
-                for(int j=0;j<5;j++)
-                {
-                    templs.add(pointDataList.get(i*5+j));
+            List<ProBasicEquipment> wtls=CacheContext.wpwtmap.get(wpId);
+            for (ProBasicEquipment wt : wtls) {
+
+                for (int i = 0; i < codels.size(); i++) {
+                    ProBasicEquipmentPoint ai =proBasicEquipmentPointService.getEquipmentPoint(wt.getId(),codels.get(i));
+                    points.add( ai.getNemCode());
                 }
-                pointDataMap.put(wt.getId(),templs);
             }
-
-        }
+            // 获得风机健康状态结果数组
+            List<PointData> pointDataList = realApiUtil.getRealData(points);
 
 
+            if(!pointDataList.isEmpty())
+            {
+                for(int i=0;i<wtls.size();i++)
+                {
+                    ProBasicEquipment wt=wtls.get(i);
+                    List<PointData> templs=new ArrayList<>();
+                    for(int j=0;j<5;j++)
+                    {
+                        templs.add(pointDataList.get(i*5+j));
+                    }
+                    pointDataMap.put(wt.getId(),templs);
+                }
 
-        Map<String, List<String>> ahmap =getAlarmhistoryLMap(wpId);
+            }
 
-        Map<String, String> altypemap = findAlertrulefailuresubMap();
 
-        List<HealthmodelrecordsVo> vos = new ArrayList<>();
-        int id = 0;
-        if(CacheContext.wpwtmap.containsKey(wpId))
-        {
-            for (ProBasicEquipment wt : CacheContext.wpwtmap.get(wpId)) {
-                HealthmodelrecordsVo vo = new HealthmodelrecordsVo();
-                vo.setId(id);
-                vo.setRecodedate(beginDate);
-                vo.setWpid(wt.getWindpowerstationId());
-                vo.setWpname(CacheContext.wpmap.get(wt.getWindpowerstationId()).getName());
-                vo.setWtid(wt.getId());
-                vo.setWtname(wt.getId());
-                vo.setModel(wt.getModelId());
 
+            int id = 0;
+            if(CacheContext.wpwtmap.containsKey(wpId))
+            {
+                for (ProBasicEquipment wt : CacheContext.wpwtmap.get(wpId)) {
+                    HealthmodelrecordsVo vo = new HealthmodelrecordsVo();
+                    vo.setId(id);
+                    vo.setRecodedate(beginDate);
+                    vo.setWpid(wt.getWindpowerstationId());
+                    vo.setWpname(CacheContext.wpmap.get(wt.getWindpowerstationId()).getName());
+                    vo.setWtid(wt.getId());
+                    vo.setWtname(wt.getId());
+                    vo.setModel(wt.getModelId());
 
-                // 获得风机健康状态结果数组
-                List<PointData> jkvalues = pointDataMap.get(wt.getId());
 
-                double score = jkvalues.get(0).getPointValueInDouble();
-                double clxzt = jkvalues.get(1).getPointValueInDouble();
-                double fdjzt = jkvalues.get(2).getPointValueInDouble();
-                double bjzt = jkvalues.get(3).getPointValueInDouble();
-                double zkzt = jkvalues.get(4).getPointValueInDouble();
+                    // 获得风机健康状态结果数组
+                    List<PointData> jkvalues = pointDataMap.get(wt.getId());
 
+                    double score = jkvalues.get(0).getPointValueInDouble();
+                    double clxzt = jkvalues.get(1).getPointValueInDouble();
+                    double fdjzt = jkvalues.get(2).getPointValueInDouble();
+                    double bjzt = jkvalues.get(3).getPointValueInDouble();
+                    double zkzt = jkvalues.get(4).getPointValueInDouble();
 
-                vo.setScore(StringUtils.round(score, 2));
 
-                vo.setClx(getStateValue(clxzt));
-                vo.setFdj(getStateValue(fdjzt));
-                vo.setBj(getStateValue(bjzt));
-                vo.setZk(getStateValue(zkzt));
+                    vo.setScore(StringUtils.round(score, 2));
 
-                vo.setBpq("优");
-                vo.setPh("优");
-                vo.setJc("优");
-                vo.setZz("优");
+                    vo.setNemCode(wt.getNemCode());
+                    vo.setClx(getStateValue(clxzt));
+                    vo.setFdj(getStateValue(fdjzt));
+                    vo.setBj(getStateValue(bjzt));
+                    vo.setZk(getStateValue(zkzt));
 
-                if(ahmap.containsKey(wt.getId()))
-                {
-                    List<String> ahtypels=ahmap.get(wt.getId());
+                    vo.setBpq("优");
+                    vo.setPh("优");
+                    vo.setJc("优");
+                    vo.setZz("优");
 
-                    if(!ahtypels.isEmpty())
+                    if(ahmap.containsKey(wt.getId()))
                     {
-                        for(String type:ahtypels)
+                        List<String> ahtypels=ahmap.get(wt.getId());
+
+                        if(!ahtypels.isEmpty())
                         {
-                            if(altypemap.containsKey(type))
+                            for(String type:ahtypels)
                             {
-                                String typetext=altypemap.get(type);
-
-                                switch (typetext) {
-                                    case "CLX":
-                                        vo.setClx("差");
-                                        break;
-                                    case "FDJ":
-                                        vo.setFdj("差");
-                                        break;
-                                    case "BJ":
-                                        vo.setBj("差");
-                                        break;
-                                    case "ZK":
-                                        vo.setZk("差");
-                                        break;
-                                    case "PH":
-                                        vo.setPh("差");
-                                        break;
-                                    case "JC":
-                                        vo.setJc("差");
-                                        break;
-                                    case "ZZ":
-                                        vo.setZz("差");
-                                        break;
-                                    default:
-                                        break;
+                                if(altypemap.containsKey(type))
+                                {
+                                    String typetext=altypemap.get(type);
+
+                                    switch (typetext) {
+                                        case "CLX":
+                                            vo.setClx("差");
+                                            break;
+                                        case "FDJ":
+                                            vo.setFdj("差");
+                                            break;
+                                        case "BJ":
+                                            vo.setBj("差");
+                                            break;
+                                        case "ZK":
+                                            vo.setZk("差");
+                                            break;
+                                        case "PH":
+                                            vo.setPh("差");
+                                            break;
+                                        case "JC":
+                                            vo.setJc("差");
+                                            break;
+                                        case "ZZ":
+                                            vo.setZz("差");
+                                            break;
+                                        default:
+                                            break;
+                                    }
                                 }
-                            }
 
+                            }
                         }
-                    }
 
-                }
+                    }
 
-                Integer[] futureHealth = new Integer[12];
-                Random random = new Random();
-                for (int i = 0; i < 12; i++) {
-                    futureHealth[i] = random.nextInt(4) + 1;
-                }
-                vo.setFutureHealth(futureHealth);
+                    Integer[] futureHealth = new Integer[12];
+                    Random random = new Random();
+                    for (int i = 0; i < 12; i++) {
+                        futureHealth[i] = random.nextInt(4) + 1;
+                    }
+                    vo.setFutureHealth(futureHealth);
 
-                int max = 100;
-                int min = 80;
+                    int max = 100;
+                    int min = 80;
 
-                double zxd = random.nextInt(max) % (max - min + 1) + min;
-                vo.setZxd(StringUtils.round(zxd, 2));
-                vos.add(vo);
-                id++;
+                    double zxd = random.nextInt(max) % (max - min + 1) + min;
+                    vo.setZxd(StringUtils.round(zxd, 2));
+                    vos.add(vo);
+                    id++;
+                }
             }
         }
 
 
+
+
+
         return vos;
     }
 

+ 55 - 17
web/health/src/main/java/com/gyee/health/service/recommen/RecommenService.java

@@ -7,6 +7,7 @@ import com.gyee.health.model.auto.ProBasicEquipment;
 import com.gyee.health.model.auto.ProBasicEquipmentPoint;
 import com.gyee.health.model.auto.ProEconRecommenMain;
 import com.gyee.health.model.vo.HealthStatusValue;
+import com.gyee.health.model.vo.ProEconRecommenMainVo;
 import com.gyee.health.service.auto.IProBasicEquipmentPointService;
 import com.gyee.health.service.auto.IProEconRecommenMainService;
 import com.gyee.health.util.IRealTimeDataBaseUtil;
@@ -50,9 +51,11 @@ public class RecommenService {
 	 * 获得当日健康推荐检修风机
 	 * @return
 	 */
-	public List<ProEconRecommenMain> getRecommenmainDay1() {
+	public List<ProEconRecommenMainVo> getRecommenmainDay1() {
+
+
+		List<ProEconRecommenMainVo> vos=new ArrayList<>();
 
-		List<ProEconRecommenMain> list=new ArrayList<>();
 
 		Calendar cal = Calendar.getInstance();
 		cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -64,18 +67,51 @@ public class RecommenService {
 		cal.add(Calendar.DAY_OF_MONTH, 1);
 		Date endDate = cal.getTime();
 
-		list=proEconRecommenMainService.getRecommenmainListByStatus("0",beginDate,endDate);
+		List<ProEconRecommenMain> list=proEconRecommenMainService.getRecommenmainListByStatus("0",beginDate,endDate);
+
+		convertVo(vos, list);
+
 
-		return list;
+		return vos;
+	}
+
+	private static void convertVo(List<ProEconRecommenMainVo> vos, List<ProEconRecommenMain> list) {
+		if(!list.isEmpty())
+		{
+			for(ProEconRecommenMain rm: list)
+			{
+				ProEconRecommenMainVo vo=new ProEconRecommenMainVo();
+				vo.setId(rm.getId());
+				vo.setFormulas(rm.getFormulas());
+				vo.setFormulasText(rm.getFormulasText());
+				vo.setIsmain(rm.getIsmain());
+				vo.setOperation(rm.getOperation());
+				vo.setCreateDate(rm.getCreateDate());
+				vo.setReason(rm.getReason());
+				vo.setSpeed(rm.getSpeed());
+				vo.setOperationdate(rm.getOperationdate());
+				vo.setWpId(rm.getWpId());
+				vo.setRecordDate(rm.getRecordDate());
+				vo.setTopThreeFault(rm.getTopThreeFault());
+				vo.setWtId(rm.getWtId());
+				if(StringUtils.notEmp(rm.getWtId()) && CacheContext.wtmap.containsKey(rm.getWtId()))
+				{
+					ProBasicEquipment wt=CacheContext.wtmap.get(rm.getWtId());
+					vo.setWtName(wt.getName());
+					vo.setNemCode(wt.getNemCode());
+				}
+				vos.add(vo);
+			}
+		}
 	}
 
 	/**
 	 * 获得3日健康推荐检修风机
 	 * @return
 	 */
-	public List<ProEconRecommenMain> getRecommenmainDay3() {
+	public List<ProEconRecommenMainVo> getRecommenmainDay3() {
 
-		List<ProEconRecommenMain> list=new ArrayList<>();
+		List<ProEconRecommenMainVo> vos=new ArrayList<>();
 
 		Calendar cal = Calendar.getInstance();
 		cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -87,18 +123,18 @@ public class RecommenService {
 		cal.add(Calendar.DAY_OF_MONTH, 2);
 		Date endDate = cal.getTime();
 
-		list=proEconRecommenMainService.getRecommenmainListByStatus("0",beginDate,endDate);
-
-		return list;
+		List<ProEconRecommenMain> list=proEconRecommenMainService.getRecommenmainListByStatus("0",beginDate,endDate);
+		convertVo(vos, list);
+		return vos;
 	}
 
 	/**
 	 * 获得7日健康推荐检修风机
 	 * @return
 	 */
-	public List<ProEconRecommenMain> getRecommenmainDay7() {
+	public List<ProEconRecommenMainVo> getRecommenmainDay7() {
 
-		List<ProEconRecommenMain> list=new ArrayList<>();
+		List<ProEconRecommenMainVo> vos=new ArrayList<>();
 
 		Calendar cal = Calendar.getInstance();
 		cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -111,9 +147,10 @@ public class RecommenService {
 		cal.add(Calendar.DAY_OF_MONTH, 7);
 		Date endDate = cal.getTime();
 
-		list=proEconRecommenMainService.getRecommenmainListByStatus("0",beginDate,endDate);
+		List<ProEconRecommenMain> list=proEconRecommenMainService.getRecommenmainListByStatus("0",beginDate,endDate);
 
-		return list;
+		convertVo(vos, list);
+		return vos;
 	}
 
 	/**
@@ -165,9 +202,9 @@ public class RecommenService {
 	 * 获得确认检修风机
 	 * @return
 	 */
-	public List<ProEconRecommenMain> recommenConfirmedList() {
+	public List<ProEconRecommenMainVo> recommenConfirmedList() {
 
-		List<ProEconRecommenMain> list=new ArrayList<>();
+		List<ProEconRecommenMainVo> vos=new ArrayList<>();
 
 		Calendar cal = Calendar.getInstance();
 		cal.set(Calendar.HOUR_OF_DAY, 0);
@@ -179,9 +216,10 @@ public class RecommenService {
 		cal.add(Calendar.DAY_OF_MONTH, 7);
 		Date endDate = cal.getTime();
 
-		list=proEconRecommenMainService.getRecommenmainListByStatus("1",beginDate,endDate);
+		List<ProEconRecommenMain> list=proEconRecommenMainService.getRecommenmainListByStatus("1",beginDate,endDate);
 
-		return list;
+		convertVo(vos, list);
+		return vos;
 	}
 
 	/**

+ 44 - 42
web/health/src/main/java/com/gyee/health/util/golden/EdosUtil.java

@@ -1099,49 +1099,51 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
                         getHistsnapSameTiem(pointid, beginDate, pried, resultList);
                     }else
                     {
-                        for (PointData snapItem : list) {
-                            long subTime = snapItem.getPointTime() - pried;
-                            //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
-                            // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
-                            // 则代表该时间节点快照有效,否则为0
-                            String rawUrl = baseURL + "/history/section?null=0&tagNames=" +pointid+ "&ts=" + snapItem.getPointTime() ;
-                            ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
-                            JSONObject jsonObjectSection = sectionResp.getBody();
+//                        for (PointData snapItem : list) {
+//                            long subTime = snapItem.getPointTime() - pried;
+//                            //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
+//                            // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
+//                            // 则代表该时间节点快照有效,否则为0
+//                            String rawUrl = baseURL + "/history/section?null=0&tagNames=" +pointid+ "&ts=" + snapItem.getPointTime() ;
+//                            ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
+//                            JSONObject jsonObjectSection = sectionResp.getBody();
+//
+//                            if (jsonObjectSection != null) {
+//                                List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
+//                                if (sectionlist.size() > 0) {
+//                                    if(sectionlist.get(0).getPointTime()<=snapItem.getPointTime()){
+//                                        resultList.add(snapItem);
+//                                    }
+//                                    else{
+//                                        PointData data = new PointData();
+//                                        data.setEdnaId(pointid);
+//                                        data.setPointTime(snapItem.getPointTime());
+//                                        data.setPointValue("0");
+//                                        data.setPointName("1");
+//                                        data.setPointValueInDouble(0.0);
+//                                        resultList.add(data);
+//                                    }
+//                                } else {
+//                                    PointData data = new PointData();
+//                                    data.setEdnaId(pointid);
+//                                    data.setPointTime(0l);
+//                                    data.setPointValue("0");
+//                                    data.setPointName("1");
+//                                    data.setPointValueInDouble(0.0);
+//                                    resultList.add(data);
+//                                }
+//                            } else {
+//                                PointData data = new PointData();
+//                                data.setEdnaId(pointid);
+//                                data.setPointTime(0l);
+//                                data.setPointValue("0");
+//                                data.setPointName("1");
+//                                data.setPointValueInDouble(0.0);
+//                                resultList.add(data);
+//                            }
+//                        }
 
-                            if (jsonObjectSection != null) {
-                                List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
-                                if (sectionlist.size() > 0) {
-                                    if(sectionlist.get(0).getPointTime()<=snapItem.getPointTime()){
-                                        resultList.add(snapItem);
-                                    }
-                                    else{
-                                        PointData data = new PointData();
-                                        data.setEdnaId(pointid);
-                                        data.setPointTime(snapItem.getPointTime());
-                                        data.setPointValue("0");
-                                        data.setPointName("1");
-                                        data.setPointValueInDouble(0.0);
-                                        resultList.add(data);
-                                    }
-                                } else {
-                                    PointData data = new PointData();
-                                    data.setEdnaId(pointid);
-                                    data.setPointTime(0l);
-                                    data.setPointValue("0");
-                                    data.setPointName("1");
-                                    data.setPointValueInDouble(0.0);
-                                    resultList.add(data);
-                                }
-                            } else {
-                                PointData data = new PointData();
-                                data.setEdnaId(pointid);
-                                data.setPointTime(0l);
-                                data.setPointValue("0");
-                                data.setPointName("1");
-                                data.setPointValueInDouble(0.0);
-                                resultList.add(data);
-                            }
-                        }
+                        resultList=list;
                     }
 
                     return resultList;

+ 2 - 2
web/health/src/main/resources/application-jn.properties

@@ -3,8 +3,8 @@ server.port=8172
 
 #\u670D\u52A1\u540D\u79F0
 spring.application.name=health-hb-provider
-#spring.cloud.nacos.discovery.server-addr=10.81.3.155:8848
-spring.cloud.nacos.discovery.server-addr=127.0.0.1:8870
+spring.cloud.nacos.discovery.server-addr=10.81.3.155:8848
+#spring.cloud.nacos.discovery.server-addr=127.0.0.1:8870
 
 #nacos\u7684\u7528\u6237\u540D\u548C\u5BC6\u7801
 spring.cloud.nacos.username=nacos