Browse Source

优化后台算法

shilin 1 year ago
parent
commit
e552272fae
39 changed files with 5354 additions and 2454 deletions
  1. 3 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/GenerationMain.java
  2. 5 5
      realtime/generationXK-service/src/main/java/com/gyee/generation/config/ThreadPoolTaskConfig.java
  3. 73 71
      realtime/generationXK-service/src/main/java/com/gyee/generation/config/XxlJobConfig.java
  4. 79 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/StatusDetailValue.java
  5. 65 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/StatusValue.java
  6. 17 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo1Service.java
  7. 17 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java
  8. 17 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo3Service.java
  9. 19 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java
  10. 17 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo5Service.java
  11. 69 6
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo6Service.java
  12. 79 211
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfoDayTopService.java
  13. 1508 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPut2Service.java
  14. 233 13
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPutService.java
  15. 144 1087
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitEventService.java
  16. 1036 91
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitEventnewService.java
  17. 171 10
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeGfService.java
  18. 168 10
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeService.java
  19. 505 565
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownService.java
  20. 432 272
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownnewService.java
  21. 51 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java
  22. 50 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo2Service.java
  23. 51 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo3Service.java
  24. 50 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo4Service.java
  25. 48 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo5Service.java
  26. 18 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WpwindDayInfoService.java
  27. 18 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WtAlysisDayService.java
  28. 17 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WtwindDayInfoService.java
  29. 112 43
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/SaticSchedulePgTask.java
  30. 4 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/BrownoutsThread.java
  31. 37 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/BrownoutsThreadPool.java
  32. 1 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo4ThreadPool.java
  33. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo5Thread.java
  34. 34 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/MainBrownoutsThreadPool.java
  35. 66 4
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/ShutdownnewThreadPool.java
  36. 31 7
      realtime/generationXK-service/src/main/resources/application-jn.yml
  37. 25 0
      realtime/generationXK-service/src/main/resources/xxl-job-executor2.properties
  38. 25 0
      realtime/generationXK-service/src/main/resources/xxl-job-executor3.properties
  39. 58 26
      realtime/generationXK-service/src/test/java/com/gyee/generation/HealthTest.java

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