Ver código fonte

历史计算服务修正优化

shilin 2 anos atrás
pai
commit
472d18bff7
40 arquivos alterados com 5498 adições e 693 exclusões
  1. 56 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/config/ThreadPoolTaskConfig.java
  2. 71 71
      realtime/generationXK-service/src/main/java/com/gyee/generation/config/XxlJobConfig.java
  3. 5 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/init/CacheContext.java
  4. 66 37
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo1Service.java
  5. 68 37
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java
  6. 72 39
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo3Service.java
  7. 163 86
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java
  8. 18 241
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo5Service.java
  9. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPutService.java
  10. 2 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitEventnewService.java
  11. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownnewService.java
  12. 2 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/TimelinessRateService.java
  13. 18 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindturbineGoodnessService.java
  14. 150 142
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WtAlysisDayService.java
  15. 4 4
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/SaticSchedulePgTask.java
  16. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/BrownoutsThread.java
  17. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/BrownoutsThreadPool.java
  18. 93 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EconWtAlysisDayThread.java
  19. 302 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EconWtAlysisDayThreadPool.java
  20. 76 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo1Thread.java
  21. 934 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo1ThreadPool.java
  22. 76 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo2Thread.java
  23. 747 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo2ThreadPool.java
  24. 76 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo3Thread.java
  25. 745 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo3ThreadPool.java
  26. 132 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo4Thread.java
  27. 1194 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo4ThreadPool.java
  28. 80 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo5Thread.java
  29. 314 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo5ThreadPool.java
  30. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/GoodnessOfFitThread.java
  31. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/GoodnessOfFitThreadPool.java
  32. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/InputOrOutPutThreadPool.java
  33. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/InputOrOutPutkThread.java
  34. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/MainBrownoutsThread.java
  35. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/MainBrownoutsThreadPool.java
  36. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/ShutdownnewThread.java
  37. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/ShutdownnewThreadPool.java
  38. 2 2
      realtime/generationXK-service/src/main/resources/application-jn.yml
  39. 2 2
      realtime/generationXK-service/src/main/resources/application-xk.yml
  40. 18 15
      realtime/generationXK-service/src/test/java/com/gyee/generation/HealthTest.java

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

@@ -0,0 +1,56 @@
+package com.gyee.generation.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+@Configuration
+public class ThreadPoolTaskConfig {
+    /**
+     *   默认情况下,在创建了线程池后,线程池中的线程数为0,当有任务来之后,就会创建一个线程去执行任务,
+     *	当线程池中的线程数目达到corePoolSize后,就会把到达的任务放到缓存队列当中;
+     *  当队列满了,就继续创建线程,当线程数量大于等于maxPoolSize后,开始使用拒绝策略拒绝
+     */
+
+    /** 核心线程数(默认线程数) */
+    private static final int corePoolSize = 3000;
+    /** 最大线程数 */
+    private static final int maxPoolSize = 10000;
+    /** 允许线程空闲时间(单位:默认为秒) */
+    private static final int keepAliveTime = 1000;
+    /** 缓冲队列大小 */
+    private static final int queueCapacity = 1000;
+    /** 允许等待最长时间 */
+    private static final int awaitTime = 10;
+    /** 线程池名前缀 */
+    private static final String threadNamePrefix = "GYEE-Thread-";
+
+    private ThreadPoolTaskExecutor executor;
+
+    public ThreadPoolTaskExecutor getExecutor(){
+        if (executor == null)
+            executor = taskExecutor();
+
+        return executor;
+    }
+
+
+    private ThreadPoolTaskExecutor taskExecutor(){
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setCorePoolSize(corePoolSize);
+        executor.setMaxPoolSize(maxPoolSize);
+        executor.setQueueCapacity(queueCapacity);
+        executor.setKeepAliveSeconds(keepAliveTime);
+        executor.setThreadNamePrefix(threadNamePrefix);
+        executor.setAwaitTerminationSeconds(awaitTime);
+
+        // 线程池对拒绝任务的处理策略
+        // CallerRunsPolicy:由调用线程(提交任务的线程)处理该任务
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+        // 初始化
+        executor.initialize();
+        return executor;
+    }
+
+}

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

@@ -1,71 +1,71 @@
-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-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();
+//     */
+//
+//
+//}

+ 5 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/init/CacheContext.java

@@ -77,6 +77,7 @@ public class CacheContext implements CommandLineRunner {
     private String runWindpowerstation;
 
     public static List<ProBasicEquipment> wtls = new ArrayList<>();
+    public static List<ProBasicEquipment> wt_fjls = new ArrayList<>();
     public static List<ProBasicProject> pjls = new ArrayList<>();
     public static List<ProBasicLine>  lnls = new ArrayList<>();
     public static List<ProBasicSubStation>  subwpls = new ArrayList<>();
@@ -343,6 +344,10 @@ public class CacheContext implements CommandLineRunner {
                 modelpower.put(wt.getModelId(),equipmentmodel.getPowerProduction().doubleValue());
             }
 
+            if(wt.getId().contains("_F_"))
+            {
+                wt_fjls.add(wt);
+            }
 
             wtmap.put(wt.getId(),wt);
             //标杆风机初始化

+ 66 - 37
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo1Service.java

@@ -10,13 +10,15 @@ import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
 import com.gyee.generation.model.auto.ProEconEquipmentInfoDay1;
 import com.gyee.generation.model.vo.WpType;
 import com.gyee.generation.service.auto.IProEconEquipmentInfoDay1Service;
+import com.gyee.generation.task.thread.EquipmentInfo1Thread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
-import com.gyee.generation.util.statisticcs.Initial;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
 import java.util.stream.Collectors;
 
 @Service
@@ -28,7 +30,8 @@ public class EquipmentInfo1Service {
 
     @Resource
     private IProEconEquipmentInfoDay1Service proEconEquipmentInfoDay1Service;
-
+    @Resource
+    private Executor executor;
     /**
      * 计算设备日信息
      */
@@ -52,47 +55,73 @@ public class EquipmentInfo1Service {
             proEconEquipmentInfoDay1Service.removeByIds(idls);
         }
 
-        List<ProEconEquipmentInfoDay1> dayls=new ArrayList<>();
-
-        for(ProBasicEquipment wt:CacheContext.wtls)
+        Map<String,ProEconEquipmentInfoDay1> pep1map=new HashMap<>();
+        Calendar cl=Calendar.getInstance();
+        cl.setTime(recordDate);
+        if(cl.get(Calendar.DAY_OF_MONTH)!=1)
         {
-            if(CacheContext.wtpAimap.containsKey(wt.getId()))
-            {
-                Map<String, ProBasicEquipmentPoint> pointmap=CacheContext.wtpAimap.get(wt.getId());
-
-                ProEconEquipmentInfoDay1 pewp=new ProEconEquipmentInfoDay1();
-                Initial.initial(pewp);
-                pewp.setCompanyId(wt.getCompanyId());
-                pewp.setWindpowerstationId(wt.getWindpowerstationId());
-                pewp.setLineId(wt.getLineId());
-                pewp.setProjectId(wt.getProjectId());
-                pewp.setRegionId(wt.getRegionId());
-                pewp.setRecordDate(DateUtils.truncate(recordDate));
-                pewp.setWindturbineId(wt.getId());
-                //昨日的统计结果
-                List<ProEconEquipmentInfoDay1> pepid1ls =new ArrayList<>();
-                Calendar cl=Calendar.getInstance();
-                cl.setTime(recordDate);
-                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+            QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",cl.getTime());
+            List<ProEconEquipmentInfoDay1> pep1ls = proEconEquipmentInfoDay1Service.list(queryWrapper2);
+            if(!pep1ls.isEmpty())
+            {
+                for(ProEconEquipmentInfoDay1 pep:pep1ls)
                 {
-                    QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper2 = new QueryWrapper<>();
-                    queryWrapper2.eq("record_date",cl.getTime())
-                            .eq("windturbine_Id",wt.getId());
-                    pepid1ls = proEconEquipmentInfoDay1Service.list(queryWrapper2);
-//                            .stream()
-//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-//                                    && CacheContext.wtmap.containsKey(i.getWindturbineId())
-//                            ).collect(Collectors.toList());
+                    pep1map.put(pep.getWindturbineId(),pep);
                 }
-                extracted(recordDate, end, begin, pointmap, pewp,pepid1ls);
-
-                dayls.add(pewp);
-                // proEconEquipmentInfoDay1Service.save(pewp);
-
             }
 
-
         }
+
+        List<ProEconEquipmentInfoDay1> dayls=new ArrayList<>();
+        final CountDownLatch latch = new CountDownLatch(+CacheContext.wtls.size());
+        for(ProBasicEquipment wt:CacheContext.wtls)
+        {
+//            if(CacheContext.wtpAimap.containsKey(wt.getId()))
+//            {
+//                Map<String, ProBasicEquipmentPoint> pointmap=CacheContext.wtpAimap.get(wt.getId());
+//
+//                ProEconEquipmentInfoDay1 pewp=new ProEconEquipmentInfoDay1();
+//                Initial.initial(pewp);
+//                pewp.setCompanyId(wt.getCompanyId());
+//                pewp.setWindpowerstationId(wt.getWindpowerstationId());
+//                pewp.setLineId(wt.getLineId());
+//                pewp.setProjectId(wt.getProjectId());
+//                pewp.setRegionId(wt.getRegionId());
+//                pewp.setRecordDate(DateUtils.truncate(recordDate));
+//                pewp.setWindturbineId(wt.getId());
+//                //昨日的统计结果
+//                List<ProEconEquipmentInfoDay1> pep1ls =new ArrayList<>();
+////                Calendar cl=Calendar.getInstance();
+////                cl.setTime(recordDate);
+////                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+////                {
+////                    QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper2 = new QueryWrapper<>();
+////                    queryWrapper2.eq("record_date",cl.getTime())
+////                            .eq("windturbine_Id",wt.getId());
+////                    pepid1ls = proEconEquipmentInfoDay1Service.list(queryWrapper2);
+//////                            .stream()
+//////                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//////                                    && CacheContext.wtmap.containsKey(i.getWindturbineId())
+//////                            ).collect(Collectors.toList());
+////                }
+//
+//                if(pep1map.containsKey(wt.getId()))
+//                {
+//                    pep1ls.add(pep1map.get(wt.getId()));
+//                }
+//                extracted(recordDate, end, begin, pointmap, pewp,pep1ls);
+//
+//                dayls.add(pewp);
+//                // proEconEquipmentInfoDay1Service.save(pewp);
+//
+//            }
+
+            new Thread(new EquipmentInfo1Thread(executor,  wt,  pep1map,
+                    recordDate,  end,  begin,dayls,
+                    edosUtil,latch)).start();
+        }
+        latch.await();
         proEconEquipmentInfoDay1Service.saveBatch(dayls);
     }
 

+ 68 - 37
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java

@@ -9,15 +9,17 @@ import com.gyee.generation.model.auto.ProBasicEquipment;
 import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
 import com.gyee.generation.model.auto.ProEconEquipmentInfoDay2;
 import com.gyee.generation.service.auto.IProEconEquipmentInfoDay2Service;
+import com.gyee.generation.task.thread.EquipmentInfo2Thread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
-import com.gyee.generation.util.statisticcs.Initial;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
 import java.util.stream.Collectors;
 
 @Service
@@ -30,7 +32,8 @@ public class EquipmentInfo2Service {
     @Resource
     private IProEconEquipmentInfoDay2Service proEconEquipmentInfoDay2Service;
 
-
+    @Resource
+    private Executor executor;
 
     /**
      * 计算设备日信息
@@ -54,48 +57,76 @@ public class EquipmentInfo2Service {
             proEconEquipmentInfoDay2Service.removeByIds(idls);
 
         }
-        List<ProEconEquipmentInfoDay2> dayls=new ArrayList<>();
-        for(ProBasicEquipment wt:CacheContext.wtls)
+
+        Map<String, ProEconEquipmentInfoDay2> pep2map=new HashMap<>();
+        Calendar cl=Calendar.getInstance();
+        cl.setTime(recordDate);
+        cl.add(Calendar.DAY_OF_MONTH,-1);
+        if(cl.get(Calendar.DAY_OF_MONTH)!=1)
         {
-            if(CacheContext.wtpAimap.containsKey(wt.getId()))
+            QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",cl.getTime());
+            List<ProEconEquipmentInfoDay2> pep2ls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
+            if(!pep2ls.isEmpty())
             {
-
-                ProEconEquipmentInfoDay2 pewp=new ProEconEquipmentInfoDay2();
-                Initial.initial(pewp);
-                pewp.setCompanyId(wt.getCompanyId());
-                pewp.setWindpowerstationId(wt.getWindpowerstationId());
-                pewp.setLineId(wt.getLineId());
-                pewp.setProjectId(wt.getProjectId());
-                pewp.setRegionId(wt.getRegionId());
-                pewp.setRecordDate(DateUtils.truncate(recordDate));
-                pewp.setWindturbineId(wt.getId());
-                //昨日的统计结果
-                List<ProEconEquipmentInfoDay2> pepidls =new ArrayList<>();
-                Calendar cl=Calendar.getInstance();
-                cl.setTime(recordDate);
-                cl.add(Calendar.DAY_OF_MONTH,-1);
-                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
-
+                for(ProEconEquipmentInfoDay2 pep:pep2ls)
                 {
-                    QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
-                    queryWrapper2.eq("record_date",cl.getTime())
-                            .eq("windturbine_Id",wt.getId());
-                    pepidls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
-//                            .stream()
-//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-//                                    && i.getWindturbineId().equals(wt.getId())
-//                            )
-//                            .collect(Collectors.toList());
+                    pep2map.put(pep.getWindturbineId(),pep);
                 }
-                calDetiall( pewp, end, begin, wt,pepidls);
-                calSimple( pewp, end, begin, wt,pepidls);
-                dayls.add(pewp);
-                // proEconEquipmentInfoDay2Service.save(pewp);
-
             }
 
-
         }
+        List<ProEconEquipmentInfoDay2> dayls=new ArrayList<>();
+        final CountDownLatch latch = new CountDownLatch(+CacheContext.wtls.size());
+        for(ProBasicEquipment wt:CacheContext.wtls)
+        {
+//            if(CacheContext.wtpAimap.containsKey(wt.getId()))
+//            {
+//
+//                ProEconEquipmentInfoDay2 pewp=new ProEconEquipmentInfoDay2();
+//                Initial.initial(pewp);
+//                pewp.setCompanyId(wt.getCompanyId());
+//                pewp.setWindpowerstationId(wt.getWindpowerstationId());
+//                pewp.setLineId(wt.getLineId());
+//                pewp.setProjectId(wt.getProjectId());
+//                pewp.setRegionId(wt.getRegionId());
+//                pewp.setRecordDate(DateUtils.truncate(recordDate));
+//                pewp.setWindturbineId(wt.getId());
+//                //昨日的统计结果
+//                List<ProEconEquipmentInfoDay2> pepidls =new ArrayList<>();
+////                Calendar cl=Calendar.getInstance();
+////                cl.setTime(recordDate);
+////                cl.add(Calendar.DAY_OF_MONTH,-1);
+////                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+////                {
+////                    QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
+////                    queryWrapper2.eq("record_date",cl.getTime())
+////                            .eq("windturbine_Id",wt.getId());
+////                    pepidls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
+//////                            .stream()
+//////                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//////                                    && i.getWindturbineId().equals(wt.getId())
+//////                            )
+//////                            .collect(Collectors.toList());
+////                }
+//
+//                if(pep2map.containsKey(wt.getId()))
+//                {
+//                    pepidls.add(pep2map.get(wt.getId()));
+//                }
+//                calDetiall( pewp, end, begin, wt,pepidls);
+//                calSimple( pewp, end, begin, wt,pepidls);
+//                dayls.add(pewp);
+//                // proEconEquipmentInfoDay2Service.save(pewp);
+//
+//            }
+
+
+            new Thread(new EquipmentInfo2Thread(executor,  wt,  pep2map,
+                    recordDate,  end,  begin,dayls,
+                    edosUtil,latch)).start();
+        }
+        latch.await();
         proEconEquipmentInfoDay2Service.saveBatch(dayls);
     }
 

+ 72 - 39
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo3Service.java

@@ -9,13 +9,15 @@ import com.gyee.generation.model.auto.ProBasicEquipment;
 import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
 import com.gyee.generation.model.auto.ProEconEquipmentInfoDay3;
 import com.gyee.generation.service.auto.IProEconEquipmentInfoDay3Service;
+import com.gyee.generation.task.thread.EquipmentInfo3Thread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
-import com.gyee.generation.util.statisticcs.Initial;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
 import java.util.stream.Collectors;
 
 @Service
@@ -29,7 +31,8 @@ public class EquipmentInfo3Service {
     private IProEconEquipmentInfoDay3Service proEconEquipmentInfoDay3Service;
 
 
-
+    @Resource
+    private Executor executor;
 
     /**
      * 计算设备日信息
@@ -54,50 +57,80 @@ public class EquipmentInfo3Service {
             proEconEquipmentInfoDay3Service.removeByIds(idls);
 
         }
-        List<ProEconEquipmentInfoDay3> dayls=new ArrayList<>();
-        for(ProBasicEquipment wt:CacheContext.wtls)
-        {
-            if(CacheContext.wtpAimap.containsKey(wt.getId()))
-            {
-
 
-                ProEconEquipmentInfoDay3 pewp=new ProEconEquipmentInfoDay3();
-                Initial.initial(pewp);
-                pewp.setCompanyId(wt.getCompanyId());
-                pewp.setWindpowerstationId(wt.getWindpowerstationId());
-                pewp.setLineId(wt.getLineId());
-                pewp.setProjectId(wt.getProjectId());
-                pewp.setRegionId(wt.getRegionId());
-                pewp.setRecordDate(DateUtils.truncate(recordDate));
-                pewp.setWindturbineId(wt.getId());
-                //昨日的统计结果
-                List<ProEconEquipmentInfoDay3> pepidls =new ArrayList<>();
-                Calendar cl=Calendar.getInstance();
-                cl.setTime(recordDate);
-                cl.add(Calendar.DAY_OF_MONTH,-1);
-                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
 
+        Map<String,ProEconEquipmentInfoDay3> pep3map=new HashMap<>();
+        Calendar cl=Calendar.getInstance();
+        cl.setTime(recordDate);
+        cl.add(Calendar.DAY_OF_MONTH,-1);
+        if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+        {
+            QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",cl.getTime());
+            List<ProEconEquipmentInfoDay3> pep3ls = proEconEquipmentInfoDay3Service.list(queryWrapper2);
+            if(!pep3ls.isEmpty())
+            {
+                for(ProEconEquipmentInfoDay3 pep:pep3ls)
                 {
-                    QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper2 = new QueryWrapper<>();
-                    queryWrapper2.eq("record_date",cl.getTime())
-                            .eq("windturbine_Id",wt.getId());
-                    pepidls = proEconEquipmentInfoDay3Service.list(queryWrapper2);
-//                            .stream()
-//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-//                                    && i.getWindturbineId().equals(wt.getId())
-//                                  )
-//                            .collect(Collectors.toList());
+                    pep3map.put(pep.getWindturbineId(),pep);
                 }
-                calDetiall( pewp, end, begin,wt,pepidls);
-                calSimple( pewp, end, begin, wt,pepidls);
-                dayls.add(pewp);
-                // proEconEquipmentInfoDay3Service.save(pewp);
-
-
             }
 
-
         }
+            List<ProEconEquipmentInfoDay3> dayls=new ArrayList<>();
+        final CountDownLatch latch = new CountDownLatch(+CacheContext.wtls.size());
+        for(ProBasicEquipment wt:CacheContext.wtls)
+        {
+//            if(CacheContext.wtpAimap.containsKey(wt.getId()))
+//            {
+//
+//
+//                ProEconEquipmentInfoDay3 pewp=new ProEconEquipmentInfoDay3();
+//                Initial.initial(pewp);
+//                pewp.setCompanyId(wt.getCompanyId());
+//                pewp.setWindpowerstationId(wt.getWindpowerstationId());
+//                pewp.setLineId(wt.getLineId());
+//                pewp.setProjectId(wt.getProjectId());
+//                pewp.setRegionId(wt.getRegionId());
+//                pewp.setRecordDate(DateUtils.truncate(recordDate));
+//                pewp.setWindturbineId(wt.getId());
+//                //昨日的统计结果
+//                List<ProEconEquipmentInfoDay3> pepidls =new ArrayList<>();
+////                Calendar cl=Calendar.getInstance();
+////                cl.setTime(recordDate);
+////                cl.add(Calendar.DAY_OF_MONTH,-1);
+////                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+////
+////                {
+////                    QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper2 = new QueryWrapper<>();
+////                    queryWrapper2.eq("record_date",cl.getTime())
+////                            .eq("windturbine_Id",wt.getId());
+////                    pepidls = proEconEquipmentInfoDay3Service.list(queryWrapper2);
+//////                            .stream()
+//////                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//////                                    && i.getWindturbineId().equals(wt.getId())
+//////                                  )
+//////                            .collect(Collectors.toList());
+////                }
+//
+//                if(pep3map.containsKey(wt.getId()))
+//                {
+//                    pepidls.add(pep3map.get(wt.getId()));
+//                }
+//                calDetiall( pewp, end, begin,wt,pepidls);
+//                calSimple( pewp, end, begin, wt,pepidls);
+//                dayls.add(pewp);
+//                // proEconEquipmentInfoDay3Service.save(pewp);
+//
+//
+//            }
+
+
+            new Thread(new EquipmentInfo3Thread(executor,  wt,  pep3map,
+                    recordDate,  end,  begin,dayls,
+                    edosUtil,latch)).start();
+        }
+        latch.await();
         proEconEquipmentInfoDay3Service.saveBatch(dayls);
     }
 

+ 163 - 86
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java

@@ -7,15 +7,17 @@ import com.gyee.common.model.StringUtils;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
 import com.gyee.generation.service.auto.*;
+import com.gyee.generation.task.thread.EquipmentInfo4Thread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
-import com.gyee.generation.util.statisticcs.Initial;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
 import java.util.stream.Collectors;
 
 @Service
@@ -54,7 +56,7 @@ public class EquipmentInfo4Service {
 
 
     @Resource
-    private IProEconStateTransitionRatesService proEconStateTransitionRatesService;
+    private IProEconEquipmentInfoDay5Service proEconEquipmentInfoDay5Service;
 
     @Resource
     private IProEconFaultLiminatedefectsService proEconFaultLiminatedefectsService;
@@ -64,8 +66,9 @@ public class EquipmentInfo4Service {
     private IProEconWindturbineGoodnessService proEconWindturbineGoodnessService;
 
 
+    @Resource
+    private Executor executor;
 
-   
     public void calEquipmentInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
@@ -89,6 +92,49 @@ public class EquipmentInfo4Service {
 
         }
 
+        Map<String,ProEconEquipmentInfoDay2> pep2map=new HashMap<>();
+        Map<String,ProEconEquipmentInfoDay3> pep3map=new HashMap<>();
+        Map<String,ProEconEquipmentInfoDay4> pep4map=new HashMap<>();
+        Calendar cl=Calendar.getInstance();
+        cl.setTime(recordDate);
+        cl.add(Calendar.DAY_OF_MONTH,-1);
+        if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+        {
+            QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("record_date",cl.getTime());
+            List<ProEconEquipmentInfoDay2> pep2ls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
+            if(!pep2ls.isEmpty())
+            {
+                for(ProEconEquipmentInfoDay2 pep:pep2ls)
+                {
+                    pep2map.put(pep.getWindturbineId(),pep);
+                }
+            }
+
+            QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper3 = new QueryWrapper<>();
+            queryWrapper3.eq("record_date",cl.getTime());
+            List<ProEconEquipmentInfoDay3> pep3ls = proEconEquipmentInfoDay3Service.list(queryWrapper3);
+            if(!pep3ls.isEmpty())
+            {
+                for(ProEconEquipmentInfoDay3 pep:pep3ls)
+                {
+                    pep3map.put(pep.getWindturbineId(),pep);
+                }
+            }
+
+            QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper4 = new QueryWrapper<>();
+            queryWrapper4.eq("record_date",cl.getTime());
+            List<ProEconEquipmentInfoDay4> pep4ls = proEconEquipmentInfoDay4Service.list(queryWrapper4);
+            if(!pep4ls.isEmpty())
+            {
+                for(ProEconEquipmentInfoDay4 pep:pep4ls)
+                {
+                    pep4map.put(pep.getWindturbineId(),pep);
+                }
+            }
+
+        }
+
         //获取曲线风机切入风速
         Map<String, ProEconInOrOutSpeedTotal> peioomap = new HashMap<>();
 
@@ -128,75 +174,106 @@ 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());
         for (ProBasicEquipment wt : CacheContext.wtls) {
-            if (CacheContext.wtpAimap.containsKey(wt.getId())) {
-
-
-                ProEconEquipmentInfoDay4 pewp = new ProEconEquipmentInfoDay4();
-                Initial.initial(pewp);
-                pewp.setCompanyId(wt.getCompanyId());
-                pewp.setWindpowerstationId(wt.getWindpowerstationId());
-                pewp.setLineId(wt.getLineId());
-                pewp.setProjectId(wt.getProjectId());
-                pewp.setRegionId(wt.getRegionId());
-                pewp.setRecordDate(DateUtils.truncate(recordDate));
-                pewp.setWindturbineId(wt.getId());
-                //昨日的统计结果
-                List<ProEconEquipmentInfoDay4> pepidls = new ArrayList<>();
-                Calendar cl = Calendar.getInstance();
-                cl.setTime(recordDate);
-                cl.add(Calendar.DAY_OF_MONTH,-1);
-                if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
-
-                    QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper4 = new QueryWrapper<>();
-                    queryWrapper4.eq("record_date",DateUtils.truncate(cl.getTime()))
-                            .eq("windturbine_id",wt.getId());
-                    pepidls = proEconEquipmentInfoDay4Service.list(queryWrapper4);
-//                            .stream()
-//                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-//                                    && i.getWindturbineId().equals(wt.getId())
-//                            )
-//                            .collect(Collectors.toList());
-                }
-
-                //获得当日设备统计2表数据
-                ProEconEquipmentInfoDay2 pepid2 = null;
-                List<ProEconEquipmentInfoDay2> pepid2ls;
-                QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper5 = new QueryWrapper<>();
-                queryWrapper5.eq("record_date",DateUtils.truncate(cl.getTime())).eq("windturbine_id",wt.getId());
-                pepid2ls = proEconEquipmentInfoDay2Service.list(queryWrapper5);
-//                        .stream()
-//                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-//                                && i.getWindturbineId().equals(wt.getId())
-//                        ).collect(Collectors.toList());
-
-                if (!pepid2ls.isEmpty()) {
-                    pepid2 = pepid2ls.get(0);
-                }
-                //获得当日设备统计3表数据
-                ProEconEquipmentInfoDay3 pepid3 = null;
-                List<ProEconEquipmentInfoDay3> pepid3ls;
-                QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper6 = new QueryWrapper<>();
-                queryWrapper6.eq("record_date",DateUtils.truncate(cl.getTime())).eq("windturbine_id",wt.getId());
-                pepid3ls = proEconEquipmentInfoDay3Service.list(queryWrapper6);
-//                        .stream()
-//                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-//                                && i.getWindturbineId().equals(wt.getId())
-//                        ).collect(Collectors.toList());
-
-                if (!pepid3ls.isEmpty()) {
-                    pepid3 = pepid3ls.get(0);
-                }
-
-                calDetiall(peioomap, pewp, end, begin, wt, pepidls, pepid2, pepid3,  wgmap);
-
-                dayls.add(pewp);
-                // proEconEquipmentInfoDay1Service.save(pewp);
-
-            }
-
-
+//            if (CacheContext.wtpAimap.containsKey(wt.getId())) {
+//
+//
+//                ProEconEquipmentInfoDay4 pewp = new ProEconEquipmentInfoDay4();
+//                Initial.initial(pewp);
+//                pewp.setCompanyId(wt.getCompanyId());
+//                pewp.setWindpowerstationId(wt.getWindpowerstationId());
+//                pewp.setLineId(wt.getLineId());
+//                pewp.setProjectId(wt.getProjectId());
+//                pewp.setRegionId(wt.getRegionId());
+//                pewp.setRecordDate(DateUtils.truncate(recordDate));
+//                pewp.setWindturbineId(wt.getId());
+//                //昨日的统计结果
+//                List<ProEconEquipmentInfoDay4> pepidls = new ArrayList<>();
+////                Calendar cl = Calendar.getInstance();
+////                cl.setTime(recordDate);
+////                cl.add(Calendar.DAY_OF_MONTH,-1);
+////                if (cl.get(Calendar.DAY_OF_MONTH) != 1) {
+////
+////                    QueryWrapper<ProEconEquipmentInfoDay4> queryWrapper4 = new QueryWrapper<>();
+////                    queryWrapper4.eq("record_date",DateUtils.truncate(cl.getTime()))
+////                            .eq("windturbine_id",wt.getId());
+////                    pepidls = proEconEquipmentInfoDay4Service.list(queryWrapper4);
+//////                            .stream()
+//////                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//////                                    && i.getWindturbineId().equals(wt.getId())
+//////                            )
+//////                            .collect(Collectors.toList());
+////                }
+////
+////                //获得当日设备统计2表数据
+////                ProEconEquipmentInfoDay2 pepid2 = null;
+////                List<ProEconEquipmentInfoDay2> pepid2ls;
+////                QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper5 = new QueryWrapper<>();
+////                queryWrapper5.eq("record_date",DateUtils.truncate(cl.getTime())).eq("windturbine_id",wt.getId());
+////                pepid2ls = proEconEquipmentInfoDay2Service.list(queryWrapper5);
+//////                        .stream()
+//////                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//////                                && i.getWindturbineId().equals(wt.getId())
+//////                        ).collect(Collectors.toList());
+////
+////                if (!pepid2ls.isEmpty()) {
+////                    pepid2 = pepid2ls.get(0);
+////                }
+////                //获得当日设备统计3表数据
+////                ProEconEquipmentInfoDay3 pepid3 = null;
+////                List<ProEconEquipmentInfoDay3> pepid3ls;
+////                QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper6 = new QueryWrapper<>();
+////                queryWrapper6.eq("record_date",DateUtils.truncate(cl.getTime())).eq("windturbine_id",wt.getId());
+////                pepid3ls = proEconEquipmentInfoDay3Service.list(queryWrapper6);
+//////                        .stream()
+//////                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//////                                && i.getWindturbineId().equals(wt.getId())
+//////                        ).collect(Collectors.toList());
+////
+////                if (!pepid3ls.isEmpty()) {
+////                    pepid3 = pepid3ls.get(0);
+////                }
+//
+//                ProEconEquipmentInfoDay2 pepid2 = null;
+//                ProEconEquipmentInfoDay3 pepid3 = null;
+//
+//                if(pep4map.containsKey(wt.getId()))
+//                {
+//                    pepidls.add(pep4map.get(wt.getId()));
+//                }
+//                if(pep2map.containsKey(wt.getId()))
+//                {
+//                    pepid2=pep2map.get(wt.getId());
+//                }
+//                if(pep3map.containsKey(wt.getId()))
+//                {
+//                    pepid3=pep3map.get(wt.getId());
+//                }
+//                calDetiall(peioomap, pewp, end, begin, wt, pepidls, pepid2, pepid3,  wgmap);
+//
+//                dayls.add(pewp);
+//                // proEconEquipmentInfoDay1Service.save(pewp);
+//
+//            }
+
+
+            new Thread(new EquipmentInfo4Thread(executor,wt, pep2map,
+                    pep3map,
+                    pep4map,
+                    recordDate,  end,  begin,  dayls,
+                    edosUtil, peioomap,
+                    wgmap,
+                    proEconCurveFittingMainService,
+                    proEconEquipmentInfoDay5Service,
+                    proEconFaultLiminatedefectsService,
+                    proEconCurveFittingSubService,
+                    proEconCurveFittMonthMainService,
+                    proEconCurveFittMonthSubService,
+                    proEconCurveFittYearMainService,
+                    proEconCurveFittYearSubService,latch)).start();
         }
+        latch.await();
         proEconEquipmentInfoDay4Service.saveBatch(dayls);
     }
 
@@ -371,19 +448,19 @@ public class EquipmentInfo4Service {
 
 //**************************************************日三率统计****************************************************************/
 
-        QueryWrapper<ProEconStateTransitionRates> queryWrapper2 = new QueryWrapper<>();
+        QueryWrapper<ProEconEquipmentInfoDay5> queryWrapper2 = new QueryWrapper<>();
         queryWrapper2.eq("record_date",begin).eq("windturbine_id",wt.getId());
-        List<ProEconStateTransitionRates> pestrls = proEconStateTransitionRatesService.list(queryWrapper2);
+        List<ProEconEquipmentInfoDay5> pestrls = proEconEquipmentInfoDay5Service.list(queryWrapper2);
 //                .stream()
 //                .filter(i -> i.getRecordDate().compareTo(begin) == 0 && i.getWindturbineId().equals(wt.getId())
 //                ).collect(Collectors.toList());
         //大于3米20分钟转换及时次数
-        DoubleSummaryStatistics timerate8_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate8).summaryStatistics();
+        DoubleSummaryStatistics timerate8_summary = pestrls.stream().mapToDouble(ProEconEquipmentInfoDay5::getTimerate8).summaryStatistics();
         //大于3米20分钟转换及时次数合计
         double timerate8_sum = timerate8_summary.getSum();
 
         //大于3米状态转换总次数次数
-        DoubleSummaryStatistics timerate14_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate14).summaryStatistics();
+        DoubleSummaryStatistics timerate14_summary = pestrls.stream().mapToDouble(ProEconEquipmentInfoDay5::getTimerate14).summaryStatistics();
         //大于3米状态转换总次数合计
         double timerate14_sum = timerate14_summary.getSum();
 
@@ -396,12 +473,12 @@ public class EquipmentInfo4Service {
         }
 
         //20分钟复位及时次数
-        DoubleSummaryStatistics timerate19_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate19).summaryStatistics();
+        DoubleSummaryStatistics timerate19_summary = pestrls.stream().mapToDouble(ProEconEquipmentInfoDay5::getTimerate19).summaryStatistics();
         //20分钟复位及时次数合计
         double timerate19_sum = timerate19_summary.getSum();
 
         //总复位次数
-        DoubleSummaryStatistics timerate20_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate20).summaryStatistics();
+        DoubleSummaryStatistics timerate20_summary = pestrls.stream().mapToDouble(ProEconEquipmentInfoDay5::getTimerate20).summaryStatistics();
         //总复位次数合计
         double timerate20_sum = timerate20_summary.getSum();
 
@@ -610,7 +687,7 @@ public class EquipmentInfo4Service {
             queryWrapper2 = new QueryWrapper<>();
             queryWrapper2.ge("record_date",monthbiegin).le("record_date",end).eq("windturbine_id",wt.getId());
 
-            pestrls =proEconStateTransitionRatesService.list(queryWrapper2);
+            pestrls =proEconEquipmentInfoDay5Service.list(queryWrapper2);
 //                    .stream()
 //                    .filter(i ->
 //                            (i.getRecordDate().compareTo(monthbiegin) == 0 || i.getRecordDate().after(monthbiegin))
@@ -618,12 +695,12 @@ public class EquipmentInfo4Service {
 //                                    && i.getWindturbineId().equals(wt.getId())
 //                    ).collect(Collectors.toList());
             //大于3米20分钟转换及时次数
-            timerate8_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate8).summaryStatistics();
+            timerate8_summary = pestrls.stream().mapToDouble(ProEconEquipmentInfoDay5::getTimerate8).summaryStatistics();
             //大于3米20分钟转换及时次数合计
             timerate8_sum = timerate8_summary.getSum();
 
             //大于3米状态转换总次数次数
-            timerate14_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate14).summaryStatistics();
+            timerate14_summary = pestrls.stream().mapToDouble(ProEconEquipmentInfoDay5::getTimerate14).summaryStatistics();
             //大于3米状态转换总次数合计
             timerate14_sum = timerate14_summary.getSum();
 
@@ -636,12 +713,12 @@ public class EquipmentInfo4Service {
             }
 
             //20分钟复位及时次数
-            timerate19_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate19).summaryStatistics();
+            timerate19_summary = pestrls.stream().mapToDouble(ProEconEquipmentInfoDay5::getTimerate19).summaryStatistics();
             //20分钟复位及时次数合计
             timerate19_sum = timerate19_summary.getSum();
 
             //总复位次数
-            timerate20_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate20).summaryStatistics();
+            timerate20_summary = pestrls.stream().mapToDouble(ProEconEquipmentInfoDay5::getTimerate20).summaryStatistics();
             //总复位次数合计
             timerate20_sum = timerate20_summary.getSum();
 
@@ -858,7 +935,7 @@ public class EquipmentInfo4Service {
 
             queryWrapper2 = new QueryWrapper<>();
             queryWrapper2.ge("record_date",yearbiegin).le("record_date",end).eq("windturbine_id",wt.getId());
-            pestrls =proEconStateTransitionRatesService.list(queryWrapper2);
+            pestrls =proEconEquipmentInfoDay5Service.list(queryWrapper2);
 //                    .stream()
 //                    .filter(i ->
 //                            (i.getRecordDate().compareTo(yearbiegin) == 0 || i.getRecordDate().after(yearbiegin))
@@ -866,12 +943,12 @@ public class EquipmentInfo4Service {
 //                                    && i.getWindturbineId().equals(wt.getId())
 //                    ).collect(Collectors.toList());
             //大于3米20分钟转换及时次数
-            timerate8_summary =pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate8).summaryStatistics();
+            timerate8_summary =pestrls.stream().mapToDouble(ProEconEquipmentInfoDay5::getTimerate8).summaryStatistics();
             //大于3米20分钟转换及时次数合计
             timerate8_sum = timerate8_summary.getSum();
 
             //大于3米状态转换总次数次数
-            timerate14_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate14).summaryStatistics();
+            timerate14_summary = pestrls.stream().mapToDouble(ProEconEquipmentInfoDay5::getTimerate14).summaryStatistics();
             //大于3米状态转换总次数合计
             timerate14_sum = timerate14_summary.getSum();
 
@@ -884,12 +961,12 @@ public class EquipmentInfo4Service {
             }
 
             //20分钟复位及时次数
-            timerate19_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate19).summaryStatistics();
+            timerate19_summary = pestrls.stream().mapToDouble(ProEconEquipmentInfoDay5::getTimerate19).summaryStatistics();
             //20分钟复位及时次数合计
             timerate19_sum = timerate19_summary.getSum();
 
             //总复位次数
-            timerate20_summary = pestrls.stream().mapToDouble(ProEconStateTransitionRates::getTimerate20).summaryStatistics();
+            timerate20_summary = pestrls.stream().mapToDouble(ProEconEquipmentInfoDay5::getTimerate20).summaryStatistics();
             //总复位次数合计
             timerate20_sum = timerate20_summary.getSum();
 

+ 18 - 241
realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo5Service.java

@@ -1,11 +1,13 @@
 package com.gyee.generation.service;//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.service.auto.*;
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDay5;
+import com.gyee.generation.model.auto.ProEconShutdownEvent2;
+import com.gyee.generation.service.auto.IProEconEquipmentInfoDay5Service;
+import com.gyee.generation.service.auto.IProEconShutdownEvent2Service;
+import com.gyee.generation.task.thread.EquipmentInfo5Thread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.statisticcs.Initial;
@@ -13,6 +15,8 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
 import java.util.stream.Collectors;
 
 @Service
@@ -29,9 +33,10 @@ public class EquipmentInfo5Service {
     private IProEconEquipmentInfoDay5Service proEconEquipmentInfoDay5Service;
 
 
-
+    @Resource
+    private Executor executor;
     public void calEquipmentInfoDay(Date currentDate) throws Exception {
-        resetRate(currentDate);
+        resetRate(DateUtils.truncate(currentDate));
 
 
     }
@@ -47,13 +52,7 @@ public class EquipmentInfo5Service {
         queryWrapper.ge("stop_Time",currentDate).le("stop_Time",endDate)
                 .isNotNull("stop_Type_Id").isNotNull("stop_Hours").ne("stop_Type_Id","wh");
         List<ProEconShutdownEvent2> shutdownevents = proEconShutdownEvent2Service.list(queryWrapper);
-//                .stream().filter(i ->
-//                i.getWinpowerstationId().contains(WpType.FDC.id)
-//                        && (i.getStopTime().compareTo(currentDate) == 0 || i.getStopTime().after(currentDate))
-//                        && (i.getStopTime().compareTo(endDate) == 0 || i.getStopTime().before(endDate))
-//                        && i.getStopTypeId() != null && i.getStopHours() != null
-//                        && !i.getStopTypeId().equals("wh")
-//        ).collect(Collectors.toList());
+
 
 
         Map<String, ProEconEquipmentInfoDay5> rates = new HashMap<>();
@@ -175,8 +174,6 @@ public class EquipmentInfo5Service {
 
             }
 
-
-
         proEconEquipmentInfoDay5Service.saveBatch(dayls);
     }
 
@@ -240,235 +237,15 @@ public class EquipmentInfo5Service {
         Date endDate = DateUtils.addDays(currentDate, 1);
 
 
-
+        final CountDownLatch latch = new CountDownLatch(+CacheContext.wtls.size());
         for (ProBasicEquipment wt : CacheContext.wtls) {
 
-            ProEconEquipmentInfoDay5 rate = rates.get(wt.getId());
-
-            List<PointData> speedDataList = null;
-            List<PointData> statusDataList = null;
-            if (CacheContext.wtpAimap.containsKey(wt.getId())) {
-                Map<String, ProBasicEquipmentPoint> wtpmap = CacheContext.wtpAimap.get(wt.getId());
-                if (wtpmap.containsKey(ContantXk.CJ_SSFS)) {
-                    ProBasicEquipmentPoint point = wtpmap.get(ContantXk.CJ_SSFS);
-                    speedDataList = edosUtil.getHistoryDatasSnap(point.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000);
-                }
-                if (wtpmap.containsKey(ContantXk.MXZT)) {
-                    ProBasicEquipmentPoint point = wtpmap.get(ContantXk.MXZT);
-                    statusDataList = edosUtil.getHistoryDatasSnap(point.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000);
-                }
-
-            }
-
-
-
-            if (speedDataList != null && statusDataList != null && statusDataList.size() == speedDataList.size() && !speedDataList.isEmpty()) {
-
-                double laststatus = -1;
-                Date begin = new Date();
-                for (int i = 0; i < speedDataList.size(); i++) {
-
-                    double status = statusDataList.get(i).getPointValueInDouble();
-                    double speed = speedDataList.get(i).getPointValueInDouble();
-                    if (i == 0) {
-                        begin = new Date(speedDataList.get(i).getPointTime());
-                        laststatus = status;
-                    }
-
-                    if (speed <= 3.0) {
-                        if (laststatus != status &&
-                                (status == stateDescription1.get(3.0) || status == stateDescription2.get(3.0))) {
-
-                            Date end = new Date(speedDataList.get(i).getPointTime());
-                            double zhcs = DateUtils.hoursDiff2(begin, end);
-                            if (zhcs < 0.25)//5分钟
-                            {
-
-                                double temp = rate.getTimerate1();
-                                temp = temp + 1;
-                                rate.setTimerate1(temp);
-
-                                temp = rate.getTimerate2();
-                                temp = temp + 1;
-                                rate.setTimerate2(temp);
-
-                                temp = rate.getTimerate3();
-                                temp = temp + 1;
-                                rate.setTimerate3(temp);
-
-                                temp = rate.getTimerate4();
-                                temp = temp + 1;
-                                rate.setTimerate4(temp);
-
-                            } else if (zhcs < 0.33)//10分钟
-                            {
-                                double temp = rate.getTimerate2();
-                                temp = temp + 1;
-                                rate.setTimerate2(temp);
-
-                                temp = rate.getTimerate3();
-                                temp = temp + 1;
-                                rate.setTimerate3(temp);
-
-                                temp = rate.getTimerate4();
-                                temp = temp + 1;
-                                rate.setTimerate4(temp);
-                            } else if (zhcs < 0.42)//15分钟
-                            {
-                                double temp = rate.getTimerate3();
-                                temp = temp + 1;
-                                rate.setTimerate3(temp);
-
-                                temp = rate.getTimerate4();
-                                temp = temp + 1;
-                                rate.setTimerate4(temp);
-                            } else if (zhcs < 0.5)//20分钟
-                            {
-                                double temp = rate.getTimerate4();
-                                temp = temp + 1;
-                                rate.setTimerate4(temp);
-                            }
-
-
-                            double temp = rate.getTimerate13();
-                            temp = temp + 1;
-                            rate.setTimerate13(temp);
-                        }
-
-                        laststatus = status;
-                        begin = new Date(speedDataList.get(i).getPointTime());
-                    } else if (speed <= 4.0 && speed > 3.0) {
-                        if (laststatus != status &&
-                                (status == stateDescription1.get(3.5) || status == stateDescription2.get(3.5))) {
-
-                            Date end = new Date(speedDataList.get(i).getPointTime());
-                            double zhcs = DateUtils.hoursDiff2(begin, end);
-                            if (zhcs < 0.25)//5分钟
-                            {
-
-                                double temp = rate.getTimerate5();
-                                temp = temp + 1;
-                                rate.setTimerate5(temp);
-
-                                temp = rate.getTimerate6();
-                                temp = temp + 1;
-                                rate.setTimerate6(temp);
-
-                                temp = rate.getTimerate7();
-                                temp = temp + 1;
-                                rate.setTimerate7(temp);
-
-                                temp = rate.getTimerate8();
-                                temp = temp + 1;
-                                rate.setTimerate8(temp);
-                            } else if (zhcs < 0.33)//10分钟
-                            {
-
-                                double temp = rate.getTimerate6();
-                                temp = temp + 1;
-                                rate.setTimerate6(temp);
-
-                                temp = rate.getTimerate7();
-                                temp = temp + 1;
-                                rate.setTimerate7(temp);
-
-                                temp = rate.getTimerate8();
-                                temp = temp + 1;
-                                rate.setTimerate8(temp);
-                            } else if (zhcs < 0.42)//15分钟
-                            {
-                                double temp = rate.getTimerate7();
-                                temp = temp + 1;
-                                rate.setTimerate7(temp);
-
-                                temp = rate.getTimerate8();
-                                temp = temp + 1;
-                                rate.setTimerate8(temp);
-
-                            } else if (zhcs < 0.5)//20分钟
-                            {
-                                double temp = rate.getTimerate8();
-                                temp = temp + 1;
-                                rate.setTimerate8(temp);
-                            }
-
-                            //}
-                            double temp = rate.getTimerate14();
-                            temp = temp + 1;
-                            rate.setTimerate14(temp);
-
-                        }
-
-                        laststatus = status;
-                        begin = new Date(speedDataList.get(i).getPointTime());
-                    } else {
-                        if (laststatus != status &&
-                                (status == stateDescription1.get(4.0) || status == stateDescription2.get(4.0))) {
-
-                            Date end = new Date(speedDataList.get(i).getPointTime());
-                            double zhcs = DateUtils.hoursDiff2(begin, end);
-                            if (zhcs < 0.25)//5分钟
-                            {
-
-                                double temp = rate.getTimerate9();
-                                temp = temp + 1;
-                                rate.setTimerate9(temp);
-
-                                temp = rate.getTimerate10();
-                                temp = temp + 1;
-                                rate.setTimerate10(temp);
-
-                                temp = rate.getTimerate11();
-                                temp = temp + 1;
-                                rate.setTimerate11(temp);
-
-                                temp = rate.getTimerate12();
-                                temp = temp + 1;
-                                rate.setTimerate12(temp);
-                            } else if (zhcs < 0.33)//10分钟
-                            {
-
-                                double temp = rate.getTimerate10();
-                                temp = temp + 1;
-                                rate.setTimerate10(temp);
-
-                                temp = rate.getTimerate11();
-                                temp = temp + 1;
-                                rate.setTimerate11(temp);
-
-                                temp = rate.getTimerate12();
-                                temp = temp + 1;
-                                rate.setTimerate12(temp);
-                            } else if (zhcs < 0.42)//15分钟
-                            {
-
-                                double temp = rate.getTimerate11();
-                                temp = temp + 1;
-                                rate.setTimerate11(temp);
-
-                                temp = rate.getTimerate12();
-                                temp = temp + 1;
-                                rate.setTimerate12(temp);
-                            } else if (zhcs < 0.5)//20分钟
-                            {
-                                double temp = rate.getTimerate12();
-                                temp = temp + 1;
-                                rate.setTimerate12(temp);
-                            }
-
-                            double temp = rate.getTimerate15();
-                            temp = temp + 1;
-                            rate.setTimerate15(temp);
-
-
-                            laststatus = status;
-                            begin = new Date(speedDataList.get(i).getPointTime());
-                        }
-                    }
-                }
-
-            }
+            new Thread(new EquipmentInfo5Thread(executor, wt,rates,
+                    endDate,  beginDate,
+                    edosUtil, stateDescription1,
+                    stateDescription2,latch)).start();
         }
+        latch.await();
 
 
     }

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

@@ -7,7 +7,7 @@ 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.InputOrOutPutkThread;
+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;

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

@@ -8,8 +8,8 @@ import com.gyee.generation.service.auto.IProEconBrownoutsEvent2Service;
 import com.gyee.generation.service.auto.IProEconBrownoutsEventService;
 import com.gyee.generation.service.auto.IProEconMainBrownouts2Service;
 import com.gyee.generation.service.auto.IProEconMainBrownoutsService;
-import com.gyee.generation.task.BrownoutsThread;
-import com.gyee.generation.task.MainBrownoutsThread;
+import com.gyee.generation.task.thread.BrownoutsThread;
+import com.gyee.generation.task.thread.MainBrownoutsThread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import org.slf4j.Logger;

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

@@ -9,7 +9,7 @@ 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.ShutdownnewThread;
+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;

+ 2 - 1
realtime/generationXK-service/src/main/java/com/gyee/generation/service/TimelinessRateService.java

@@ -69,7 +69,8 @@ public class TimelinessRateService {
             proEconFaultLiminatedefectsService.removeByIds(deleteitems);
         }
         QueryWrapper<ProEconShutdownEvent> queryWrapper2 = new QueryWrapper<>();
-        queryWrapper2.ge("stop_Time",begin).le("stop_Time",end);
+        queryWrapper2.ge("stop_Time",begin).le("stop_Time",end)
+                .isNotNull("stoptype_id").isNotNull("stop_Hours").ne("stoptype_id","wh");
         List<ProEconShutdownEvent> st2 = proEconShutdownEventService.list(queryWrapper2);
 //                .stream()
 //                .filter(i ->

+ 18 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindturbineGoodnessService.java

@@ -7,7 +7,7 @@ import com.gyee.generation.model.auto.ProEconEquipmentInfoDay1;
 import com.gyee.generation.model.auto.ProEconWindturbineGoodness;
 import com.gyee.generation.service.auto.IProEconEquipmentInfoDay1Service;
 import com.gyee.generation.service.auto.IProEconWindturbineGoodnessService;
-import com.gyee.generation.task.GoodnessOfFitThread;
+import com.gyee.generation.task.thread.GoodnessOfFitThread;
 import com.gyee.generation.util.DateUtils;
 import org.springframework.stereotype.Service;
 
@@ -152,7 +152,23 @@ public class WindturbineGoodnessService {
             vo.setYearTop(i+1);
         }
         System.out.println("拟合优度风机存储数量"+vos.size());
-        proEconWindturbineGoodnessService.saveOrUpdateBatch(vos);
+
+        List<ProEconWindturbineGoodness> templs=new ArrayList<>();
+        for(ProEconWindturbineGoodness vo:vos)
+        {
+            templs.add(vo);
+            if(templs.size()==100)
+            {
+                proEconWindturbineGoodnessService.saveOrUpdateBatch(templs);
+                templs=new ArrayList<>();
+            }
+        }
+
+        if(!templs.isEmpty())
+        {
+            proEconWindturbineGoodnessService.saveOrUpdateBatch(templs);
+        }
+
         System.out.println("拟合优度风机存储结束");
     }
 

+ 150 - 142
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WtAlysisDayService.java

@@ -7,15 +7,15 @@ import com.gyee.common.model.StringUtils;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
 import com.gyee.generation.service.auto.*;
+import com.gyee.generation.task.thread.EconWtAlysisDayThread;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
-import com.gyee.generation.util.statisticcs.Initial;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
 import java.util.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -38,7 +38,8 @@ public class WtAlysisDayService {
     @Resource
     private IProEconEquipmentInfoDay4Service proEconEquipmentInfoDay4Service;
 
-
+    @Resource
+    private Executor executor;
     private Map<String, ProEconEquipmentInfoDay1> queryEquipmentInfoDay1(Date recordDate) {
 
         QueryWrapper<ProEconEquipmentInfoDay1> queryWrapper = new QueryWrapper<>();
@@ -123,147 +124,154 @@ public class WtAlysisDayService {
         Map<String, ProEconEquipmentInfoDay4> eqday4map = queryEquipmentInfoDay4(recordDate);
 
         List<ProEconWtAlysisDay> dayls=new ArrayList<>();
-
+        final CountDownLatch latch = new CountDownLatch(+CacheContext.wtls.size());
         for(ProBasicEquipment wt:CacheContext.wtls)
         {
-            ProEconWtAlysisDay pewp=new ProEconWtAlysisDay();
-            Initial.initial(pewp);
-            pewp.setRecordDate(DateUtils.truncate(recordDate));
-            pewp.setWindturbineId(wt.getId());
-
-            if(eqday1map.containsKey(wt.getId()))
-            {
-                ProEconEquipmentInfoDay1 dayinfo= eqday1map.get(wt.getId());
-
-                pewp.setRfdl(dayinfo.getRfdl());
-                pewp.setRpjfs(dayinfo.getRpjfs());
-                pewp.setRpjgl(dayinfo.getRpjgl());
-                pewp.setRyfdl(dayinfo.getRllfdl());
-
-
-                double gzss=dayinfo.getRgzssdl();
-                double jxss=dayinfo.getRjxssdl();
-                double xnss=dayinfo.getRxnssdl();
-                double xdss=dayinfo.getRxdtjssdl()+dayinfo.getRxdjclssdl();
-                double slss=dayinfo.getRcwsltqssdl()+dayinfo.getRcwsldwssdl();
-
-                double ssdl=gzss+jxss+xnss+xdss+slss;
-                pewp.setRssdl(StringUtils.round(ssdl,2));
-
-                pewp.setYfdl(dayinfo.getYfdl());
-                pewp.setYpjfs(dayinfo.getYpjfs());
-                pewp.setYpjgl(dayinfo.getYpjgl());
-                pewp.setYyfdl(dayinfo.getYllfdl());
-
-
-                gzss=dayinfo.getYgzssdl();
-                jxss=dayinfo.getYjxssdl();
-                xnss=dayinfo.getYxnssdl();
-                xdss=dayinfo.getYxdtjssdl()+dayinfo.getYxdjclssdl();
-                slss=dayinfo.getYcwsltqssdl()+dayinfo.getYcwsldwssdl();
-
-                ssdl=gzss+jxss+xnss+xdss+slss;
-                pewp.setYssdl(StringUtils.round(ssdl,2));
-
-                pewp.setNfdl(dayinfo.getNfdl());
-                pewp.setNpjfs(dayinfo.getNpjfs());
-                pewp.setNpjgl(dayinfo.getNpjgl());
-                pewp.setNyfdl(dayinfo.getNllfdl());
-
-
-                gzss=dayinfo.getNgzssdl();
-                jxss=dayinfo.getNjxssdl();
-                xnss=dayinfo.getNxnssdl();
-                xdss=dayinfo.getNxdtjssdl()+dayinfo.getNxdjclssdl();
-                slss=dayinfo.getNcwsltqssdl()+dayinfo.getNcwsldwssdl();
-
-                ssdl=gzss+jxss+xnss+xdss+slss;
-                pewp.setNssdl(StringUtils.round(ssdl,2));
-
-            }
-
-
-            if(eqday2map.containsKey(wt.getId()))
-            {
-                ProEconEquipmentInfoDay2 dayinfo= eqday2map.get(wt.getId());
-                pewp.setRyxxs(dayinfo.getRyxxs());
-                pewp.setRgzxs(dayinfo.getRgztjxs());
-                pewp.setRjxxs(dayinfo.getRjxtjxs());
-                pewp.setRzdxs(dayinfo.getRxdxs());
-                pewp.setRzdxs(dayinfo.getRtxzdxs());
-
-                int dayTimes=24;
-                double sbklyl =  new BigDecimal(dayTimes-dayinfo.getRgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
-                pewp.setRsbklyl(StringUtils.round(sbklyl, 2));
-
-                pewp.setYyxxs(dayinfo.getYyxxs());
-                pewp.setYgzxs(dayinfo.getYgztjxs());
-                pewp.setYjxxs(dayinfo.getYjxtjxs());
-                pewp.setYzdxs(dayinfo.getYxdxs());
-                pewp.setYzdxs(dayinfo.getYtxzdxs());
-                c.setTime(recordDate);
-                int days=c.get(Calendar.DAY_OF_MONTH);
-                dayTimes=24*days;
-                sbklyl =  new BigDecimal(dayTimes-dayinfo.getYgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
-                pewp.setYsbklyl(StringUtils.round(sbklyl, 2));
-
-                pewp.setNyxxs(dayinfo.getNyxxs());
-                pewp.setNgzxs(dayinfo.getNgztjxs());
-                pewp.setNjxxs(dayinfo.getNjxtjxs());
-                pewp.setNzdxs(dayinfo.getNxdxs());
-                pewp.setNzdxs(dayinfo.getNtxzdxs());
-
-                days=c.get(Calendar.DAY_OF_YEAR);
-                dayTimes=24*days;
-                sbklyl =  new BigDecimal(dayTimes-dayinfo.getNgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
-                pewp.setNsbklyl(StringUtils.round(sbklyl, 2));
-            }
-
-            if(eqday3map.containsKey(wt.getId()))
-            {
-                ProEconEquipmentInfoDay3 dayinfo= eqday3map.get(wt.getId());
-                pewp.setRtjcs(dayinfo.getRgztjcs()+dayinfo.getRjxtjcs());
-                pewp.setYtjcs(dayinfo.getYgztjcs()+dayinfo.getYjxtjcs());
-                pewp.setNtjcs(dayinfo.getNgztjcs()+dayinfo.getNjxtjcs());
-
-            }
-
-            if(eqday4map.containsKey(wt.getId()))
-            {
-                ProEconEquipmentInfoDay4 dayinfo= eqday4map.get(wt.getId());
-                pewp.setRnhyd(dayinfo.getRnhyd());
-                pewp.setRsjbz(dayinfo.getRqxpcbbzsj());
-                pewp.setRyxfs(dayinfo.getRyxfss());
-
-                pewp.setYnhyd(dayinfo.getYnhyd());
-                pewp.setYsjbz(dayinfo.getYqxpcbbzsj());
-                pewp.setYyxfs(dayinfo.getYyxfss());
-
-                pewp.setNnhyd(dayinfo.getNnhyd());
-                pewp.setNsjbz(dayinfo.getNqxpcbbzsj());
-                pewp.setNyxfs(dayinfo.getNyxfss());
-
-            }
-            //昨日的统计结果
-            List<ProEconWtAlysisDay> pepidls =new ArrayList<>();
-            Calendar cl=Calendar.getInstance();
-            cl.setTime(recordDate);
-            cl.add(Calendar.DAY_OF_MONTH,-1);
-            if(cl.get(Calendar.DAY_OF_MONTH)!=1)
-            {
-                QueryWrapper<ProEconWtAlysisDay> queryWrapper2 = new QueryWrapper<>();
-               queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime())).eq("windTurbine_Id",wt.getId());
-               pepidls = proEconWtAlysisDayService.list(queryWrapper2);
-//                        .stream()
-//                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
-//                                && i.getWindturbineId().equals(wt.getId())
-//                        )
-//                        .collect(Collectors.toList());
-            }
-            calSimple(pewp, end, begin, wt, pepidls);
-            dayls.add(pewp);
-
+//            ProEconWtAlysisDay pewp=new ProEconWtAlysisDay();
+//            Initial.initial(pewp);
+//            pewp.setRecordDate(DateUtils.truncate(recordDate));
+//            pewp.setWindturbineId(wt.getId());
+//
+//            if(eqday1map.containsKey(wt.getId()))
+//            {
+//                ProEconEquipmentInfoDay1 dayinfo= eqday1map.get(wt.getId());
+//
+//                pewp.setRfdl(dayinfo.getRfdl());
+//                pewp.setRpjfs(dayinfo.getRpjfs());
+//                pewp.setRpjgl(dayinfo.getRpjgl());
+//                pewp.setRyfdl(dayinfo.getRllfdl());
+//
+//
+//                double gzss=dayinfo.getRgzssdl();
+//                double jxss=dayinfo.getRjxssdl();
+//                double xnss=dayinfo.getRxnssdl();
+//                double xdss=dayinfo.getRxdtjssdl()+dayinfo.getRxdjclssdl();
+//                double slss=dayinfo.getRcwsltqssdl()+dayinfo.getRcwsldwssdl();
+//
+//                double ssdl=gzss+jxss+xnss+xdss+slss;
+//                pewp.setRssdl(StringUtils.round(ssdl,2));
+//
+//                pewp.setYfdl(dayinfo.getYfdl());
+//                pewp.setYpjfs(dayinfo.getYpjfs());
+//                pewp.setYpjgl(dayinfo.getYpjgl());
+//                pewp.setYyfdl(dayinfo.getYllfdl());
+//
+//
+//                gzss=dayinfo.getYgzssdl();
+//                jxss=dayinfo.getYjxssdl();
+//                xnss=dayinfo.getYxnssdl();
+//                xdss=dayinfo.getYxdtjssdl()+dayinfo.getYxdjclssdl();
+//                slss=dayinfo.getYcwsltqssdl()+dayinfo.getYcwsldwssdl();
+//
+//                ssdl=gzss+jxss+xnss+xdss+slss;
+//                pewp.setYssdl(StringUtils.round(ssdl,2));
+//
+//                pewp.setNfdl(dayinfo.getNfdl());
+//                pewp.setNpjfs(dayinfo.getNpjfs());
+//                pewp.setNpjgl(dayinfo.getNpjgl());
+//                pewp.setNyfdl(dayinfo.getNllfdl());
+//
+//
+//                gzss=dayinfo.getNgzssdl();
+//                jxss=dayinfo.getNjxssdl();
+//                xnss=dayinfo.getNxnssdl();
+//                xdss=dayinfo.getNxdtjssdl()+dayinfo.getNxdjclssdl();
+//                slss=dayinfo.getNcwsltqssdl()+dayinfo.getNcwsldwssdl();
+//
+//                ssdl=gzss+jxss+xnss+xdss+slss;
+//                pewp.setNssdl(StringUtils.round(ssdl,2));
+//
+//            }
+//
+//
+//            if(eqday2map.containsKey(wt.getId()))
+//            {
+//                ProEconEquipmentInfoDay2 dayinfo= eqday2map.get(wt.getId());
+//                pewp.setRyxxs(dayinfo.getRyxxs());
+//                pewp.setRgzxs(dayinfo.getRgztjxs());
+//                pewp.setRjxxs(dayinfo.getRjxtjxs());
+//                pewp.setRzdxs(dayinfo.getRxdxs());
+//                pewp.setRzdxs(dayinfo.getRtxzdxs());
+//
+//                int dayTimes=24;
+//                double sbklyl =  new BigDecimal(dayTimes-dayinfo.getRgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
+//                pewp.setRsbklyl(StringUtils.round(sbklyl, 2));
+//
+//                pewp.setYyxxs(dayinfo.getYyxxs());
+//                pewp.setYgzxs(dayinfo.getYgztjxs());
+//                pewp.setYjxxs(dayinfo.getYjxtjxs());
+//                pewp.setYzdxs(dayinfo.getYxdxs());
+//                pewp.setYzdxs(dayinfo.getYtxzdxs());
+//                c.setTime(recordDate);
+//                int days=c.get(Calendar.DAY_OF_MONTH);
+//                dayTimes=24*days;
+//                sbklyl =  new BigDecimal(dayTimes-dayinfo.getYgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
+//                pewp.setYsbklyl(StringUtils.round(sbklyl, 2));
+//
+//                pewp.setNyxxs(dayinfo.getNyxxs());
+//                pewp.setNgzxs(dayinfo.getNgztjxs());
+//                pewp.setNjxxs(dayinfo.getNjxtjxs());
+//                pewp.setNzdxs(dayinfo.getNxdxs());
+//                pewp.setNzdxs(dayinfo.getNtxzdxs());
+//
+//                days=c.get(Calendar.DAY_OF_YEAR);
+//                dayTimes=24*days;
+//                sbklyl =  new BigDecimal(dayTimes-dayinfo.getNgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
+//                pewp.setNsbklyl(StringUtils.round(sbklyl, 2));
+//            }
+//
+//            if(eqday3map.containsKey(wt.getId()))
+//            {
+//                ProEconEquipmentInfoDay3 dayinfo= eqday3map.get(wt.getId());
+//                pewp.setRtjcs(dayinfo.getRgztjcs()+dayinfo.getRjxtjcs());
+//                pewp.setYtjcs(dayinfo.getYgztjcs()+dayinfo.getYjxtjcs());
+//                pewp.setNtjcs(dayinfo.getNgztjcs()+dayinfo.getNjxtjcs());
+//
+//            }
+//
+//            if(eqday4map.containsKey(wt.getId()))
+//            {
+//                ProEconEquipmentInfoDay4 dayinfo= eqday4map.get(wt.getId());
+//                pewp.setRnhyd(dayinfo.getRnhyd());
+//                pewp.setRsjbz(dayinfo.getRqxpcbbzsj());
+//                pewp.setRyxfs(dayinfo.getRyxfss());
+//
+//                pewp.setYnhyd(dayinfo.getYnhyd());
+//                pewp.setYsjbz(dayinfo.getYqxpcbbzsj());
+//                pewp.setYyxfs(dayinfo.getYyxfss());
+//
+//                pewp.setNnhyd(dayinfo.getNnhyd());
+//                pewp.setNsjbz(dayinfo.getNqxpcbbzsj());
+//                pewp.setNyxfs(dayinfo.getNyxfss());
+//
+//            }
+//            //昨日的统计结果
+//            List<ProEconWtAlysisDay> pepidls =new ArrayList<>();
+//            Calendar cl=Calendar.getInstance();
+//            cl.setTime(recordDate);
+//            cl.add(Calendar.DAY_OF_MONTH,-1);
+//            if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+//            {
+//                QueryWrapper<ProEconWtAlysisDay> queryWrapper2 = new QueryWrapper<>();
+//               queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime())).eq("windTurbine_Id",wt.getId());
+//               pepidls = proEconWtAlysisDayService.list(queryWrapper2);
+////                        .stream()
+////                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+////                                && i.getWindturbineId().equals(wt.getId())
+////                        )
+////                        .collect(Collectors.toList());
+//            }
+//            calSimple(pewp, end, begin, wt, pepidls);
+//            dayls.add(pewp);
+//
+            new Thread(new EconWtAlysisDayThread(executor,wt,  eqday1map,
+                    eqday2map,
+                    eqday3map,
+                    eqday4map,
+                    recordDate,  end,  begin,  dayls,
+                    edosUtil, c, proEconWtAlysisDayService,latch)).start();
         }
+        latch.await();
         proEconWtAlysisDayService.saveBatch(dayls);
     }
 

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

@@ -386,11 +386,11 @@ public class SaticSchedulePgTask {
 
         equipmentInfo5Service.calEquipmentInfoDay(date);
 
-        equipmentInfoDayTopService.calEquipmentInfoDayTop(new Date());
-        equipmentInfoDayTopService.calEquipmentInfoMonthTop(new Date());
-        equipmentInfoDayTopService.calEquipmentInfoYearTop(new Date());
+        equipmentInfoDayTopService.calEquipmentInfoDayTop(date);
+        equipmentInfoDayTopService.calEquipmentInfoMonthTop(date);
+        equipmentInfoDayTopService.calEquipmentInfoYearTop(date);
 
-        wtAlysisDayService.calEquipmentInfoDay(new Date());
+        wtAlysisDayService.calEquipmentInfoDay(date);
 
         XxlJobHelper.log("设备指标调度程序执行完成!........");
 

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

@@ -1,4 +1,4 @@
-package com.gyee.generation.task;
+package com.gyee.generation.task.thread;
 
 import com.gyee.common.model.PointData;
 import com.gyee.generation.model.auto.ProEconBrownoutsEvent;

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

@@ -1,4 +1,4 @@
-package com.gyee.generation.task;
+package com.gyee.generation.task.thread;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;

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

@@ -0,0 +1,93 @@
+package com.gyee.generation.task.thread;
+
+import com.gyee.generation.model.auto.*;
+import com.gyee.generation.service.auto.IProEconWtAlysisDayService;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class EconWtAlysisDayThread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private ProBasicEquipment wt;
+	private   Map<String, ProEconEquipmentInfoDay1> eqday1map;
+	private   Map<String, ProEconEquipmentInfoDay2> eqday2map;
+	private   Map<String, ProEconEquipmentInfoDay3> eqday3map;
+	private   Map<String, ProEconEquipmentInfoDay4> eqday4map;
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconWtAlysisDay> dayls;
+	private IEdosUtil edosUtil;
+	private Calendar c;
+
+	private IProEconWtAlysisDayService proEconWtAlysisDayService;
+
+	private CountDownLatch latch;
+
+	public EconWtAlysisDayThread(Executor executor, ProBasicEquipment wt, Map<String, ProEconEquipmentInfoDay1> eqday1map,
+								 Map<String, ProEconEquipmentInfoDay2> eqday2map,
+								 Map<String, ProEconEquipmentInfoDay3> eqday3map,
+								 Map<String, ProEconEquipmentInfoDay4> eqday4map,
+								 Date recordDate, Date end, Date begin, List<ProEconWtAlysisDay> dayls,
+								 IEdosUtil edosUtil,Calendar c,IProEconWtAlysisDayService proEconWtAlysisDayService,
+                                 CountDownLatch latch	) {
+		this.executor = executor;
+		this.wt = wt;
+		this.eqday1map = eqday1map;
+		this.eqday2map = eqday2map;
+		this.eqday3map = eqday3map;
+		this.eqday4map = eqday4map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+		this.c = c;
+		this.proEconWtAlysisDayService = proEconWtAlysisDayService;
+		this.latch = latch;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wt.getId();
+		logger.info("分析数据统计务创建任务并提交到线程池中:" + wt.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new EconWtAlysisDayThreadPool(task,
+				wt,  eqday1map,
+				 eqday2map,
+				 eqday3map,
+				 eqday4map,
+				 recordDate,  end,  begin,  dayls,
+				 edosUtil, c, proEconWtAlysisDayService));
+
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		}finally {
+			latch.countDown();
+		}
+	}
+}

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

@@ -0,0 +1,302 @@
+package com.gyee.generation.task.thread;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.*;
+import com.gyee.generation.service.auto.IProEconWtAlysisDayService;
+import com.gyee.generation.util.DateUtils;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import com.gyee.generation.util.statisticcs.Initial;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+import java.util.concurrent.Callable;
+
+public class EconWtAlysisDayThreadPool implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+	private static final long serialVersionUID = 0;
+
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private ProBasicEquipment wt;
+	private   Map<String, ProEconEquipmentInfoDay1> eqday1map;
+	private   Map<String, ProEconEquipmentInfoDay2> eqday2map;
+	private   Map<String, ProEconEquipmentInfoDay3> eqday3map;
+	private   Map<String, ProEconEquipmentInfoDay4> eqday4map;
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconWtAlysisDay> dayls;
+	private IEdosUtil edosUtil;
+	private Calendar c;
+
+	private IProEconWtAlysisDayService proEconWtAlysisDayService;
+
+	public EconWtAlysisDayThreadPool(Object tasks, ProBasicEquipment wt, Map<String, ProEconEquipmentInfoDay1> eqday1map,
+									 Map<String, ProEconEquipmentInfoDay2> eqday2map,
+									 Map<String, ProEconEquipmentInfoDay3> eqday3map,
+									 Map<String, ProEconEquipmentInfoDay4> eqday4map,
+                                     Date recordDate, Date end, Date begin, List<ProEconWtAlysisDay> dayls,
+                                     IEdosUtil edosUtil,Calendar c,IProEconWtAlysisDayService proEconWtAlysisDayService
+	) {
+
+		this.threadPoolTaskData = tasks;
+		this.wt = wt;
+		this.eqday1map = eqday1map;
+		this.eqday2map = eqday2map;
+		this.eqday3map = eqday3map;
+		this.eqday4map = eqday4map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+		this.c = c;
+		this.proEconWtAlysisDayService = proEconWtAlysisDayService;
+	}
+
+	public synchronized String call() throws Exception {
+
+
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		try {
+			ProEconWtAlysisDay pewp=new ProEconWtAlysisDay();
+			Initial.initial(pewp);
+			pewp.setRecordDate(DateUtils.truncate(recordDate));
+			pewp.setWindturbineId(wt.getId());
+
+			if(eqday1map.containsKey(wt.getId()))
+			{
+				ProEconEquipmentInfoDay1 dayinfo= eqday1map.get(wt.getId());
+
+				pewp.setRfdl(dayinfo.getRfdl());
+				pewp.setRpjfs(dayinfo.getRpjfs());
+				pewp.setRpjgl(dayinfo.getRpjgl());
+				pewp.setRyfdl(dayinfo.getRllfdl());
+
+
+				double gzss=dayinfo.getRgzssdl();
+				double jxss=dayinfo.getRjxssdl();
+				double xnss=dayinfo.getRxnssdl();
+				double xdss=dayinfo.getRxdtjssdl()+dayinfo.getRxdjclssdl();
+				double slss=dayinfo.getRcwsltqssdl()+dayinfo.getRcwsldwssdl();
+
+				double ssdl=gzss+jxss+xnss+xdss+slss;
+				pewp.setRssdl(StringUtils.round(ssdl,2));
+
+				pewp.setYfdl(dayinfo.getYfdl());
+				pewp.setYpjfs(dayinfo.getYpjfs());
+				pewp.setYpjgl(dayinfo.getYpjgl());
+				pewp.setYyfdl(dayinfo.getYllfdl());
+
+
+				gzss=dayinfo.getYgzssdl();
+				jxss=dayinfo.getYjxssdl();
+				xnss=dayinfo.getYxnssdl();
+				xdss=dayinfo.getYxdtjssdl()+dayinfo.getYxdjclssdl();
+				slss=dayinfo.getYcwsltqssdl()+dayinfo.getYcwsldwssdl();
+
+				ssdl=gzss+jxss+xnss+xdss+slss;
+				pewp.setYssdl(StringUtils.round(ssdl,2));
+
+				pewp.setNfdl(dayinfo.getNfdl());
+				pewp.setNpjfs(dayinfo.getNpjfs());
+				pewp.setNpjgl(dayinfo.getNpjgl());
+				pewp.setNyfdl(dayinfo.getNllfdl());
+
+
+				gzss=dayinfo.getNgzssdl();
+				jxss=dayinfo.getNjxssdl();
+				xnss=dayinfo.getNxnssdl();
+				xdss=dayinfo.getNxdtjssdl()+dayinfo.getNxdjclssdl();
+				slss=dayinfo.getNcwsltqssdl()+dayinfo.getNcwsldwssdl();
+
+				ssdl=gzss+jxss+xnss+xdss+slss;
+				pewp.setNssdl(StringUtils.round(ssdl,2));
+
+			}
+
+
+			if(eqday2map.containsKey(wt.getId()))
+			{
+				ProEconEquipmentInfoDay2 dayinfo= eqday2map.get(wt.getId());
+				pewp.setRyxxs(dayinfo.getRyxxs());
+				pewp.setRgzxs(dayinfo.getRgztjxs());
+				pewp.setRjxxs(dayinfo.getRjxtjxs());
+				pewp.setRzdxs(dayinfo.getRxdxs());
+				pewp.setRzdxs(dayinfo.getRtxzdxs());
+
+				int dayTimes=24;
+				double sbklyl =  new BigDecimal(dayTimes-dayinfo.getRgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
+				pewp.setRsbklyl(StringUtils.round(sbklyl, 2));
+
+				pewp.setYyxxs(dayinfo.getYyxxs());
+				pewp.setYgzxs(dayinfo.getYgztjxs());
+				pewp.setYjxxs(dayinfo.getYjxtjxs());
+				pewp.setYzdxs(dayinfo.getYxdxs());
+				pewp.setYzdxs(dayinfo.getYtxzdxs());
+				c.setTime(recordDate);
+				int days=c.get(Calendar.DAY_OF_MONTH);
+				dayTimes=24*days;
+				sbklyl =  new BigDecimal(dayTimes-dayinfo.getYgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
+				pewp.setYsbklyl(StringUtils.round(sbklyl, 2));
+
+				pewp.setNyxxs(dayinfo.getNyxxs());
+				pewp.setNgzxs(dayinfo.getNgztjxs());
+				pewp.setNjxxs(dayinfo.getNjxtjxs());
+				pewp.setNzdxs(dayinfo.getNxdxs());
+				pewp.setNzdxs(dayinfo.getNtxzdxs());
+
+				days=c.get(Calendar.DAY_OF_YEAR);
+				dayTimes=24*days;
+				sbklyl =  new BigDecimal(dayTimes-dayinfo.getNgztjxs()).divide(new BigDecimal(dayTimes), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();//风机平均设备可利用率
+				pewp.setNsbklyl(StringUtils.round(sbklyl, 2));
+			}
+
+			if(eqday3map.containsKey(wt.getId()))
+			{
+				ProEconEquipmentInfoDay3 dayinfo= eqday3map.get(wt.getId());
+				pewp.setRtjcs(dayinfo.getRgztjcs()+dayinfo.getRjxtjcs());
+				pewp.setYtjcs(dayinfo.getYgztjcs()+dayinfo.getYjxtjcs());
+				pewp.setNtjcs(dayinfo.getNgztjcs()+dayinfo.getNjxtjcs());
+
+			}
+
+			if(eqday4map.containsKey(wt.getId()))
+			{
+				ProEconEquipmentInfoDay4 dayinfo= eqday4map.get(wt.getId());
+				pewp.setRnhyd(dayinfo.getRnhyd());
+				pewp.setRsjbz(dayinfo.getRqxpcbbzsj());
+				pewp.setRyxfs(dayinfo.getRyxfss());
+
+				pewp.setYnhyd(dayinfo.getYnhyd());
+				pewp.setYsjbz(dayinfo.getYqxpcbbzsj());
+				pewp.setYyxfs(dayinfo.getYyxfss());
+
+				pewp.setNnhyd(dayinfo.getNnhyd());
+				pewp.setNsjbz(dayinfo.getNqxpcbbzsj());
+				pewp.setNyxfs(dayinfo.getNyxfss());
+
+			}
+			//昨日的统计结果
+			List<ProEconWtAlysisDay> pepidls =new ArrayList<>();
+			Calendar cl=Calendar.getInstance();
+			cl.setTime(recordDate);
+			cl.add(Calendar.DAY_OF_MONTH,-1);
+			if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+			{
+				QueryWrapper<ProEconWtAlysisDay> queryWrapper2 = new QueryWrapper<>();
+				queryWrapper2.eq("record_date",DateUtils.truncate(cl.getTime())).eq("windTurbine_Id",wt.getId());
+				pepidls = proEconWtAlysisDayService.list(queryWrapper2);
+//                        .stream()
+//                        .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+//                                && i.getWindturbineId().equals(wt.getId())
+//                        )
+//                        .collect(Collectors.toList());
+			}
+			calSimple(pewp, end, begin, wt, pepidls);
+			dayls.add(pewp);
+
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+	private void calSimple(ProEconWtAlysisDay pewp, Date end, Date begin, ProBasicEquipment wt, List<ProEconWtAlysisDay> pepidls) throws Exception {
+
+//*******************************************日信息统计*********************************************************/
+
+		double lastState=-1;//上一分钟状态
+
+
+		double bbhcs=0;//不饱和次数
+
+		Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+
+
+		Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+		if(aimap.containsKey(ContantXk.SSQFZT))
+		{
+
+			ProBasicEquipmentPoint point=aimap.get(ContantXk.SSQFZT);
+			//按照分钟时间进行统计状态快照值
+			List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+			if(!pointls.isEmpty()) {
+				for (PointData po : pointls) {
+
+					if (po.getPointValueInDouble() >=3) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//实时欠发大于等于3的次数加1
+							bbhcs++;
+						}
+
+					}
+
+				}
+
+			}
+
+		}
+		//日不饱和次数
+		pewp.setRbbhcs(bbhcs);
+
+		//*******************************************日信息统计*********************************************************/
+
+		//*******************************************月信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			pewp.setYbbhcs(pewp.getRbbhcs());
+
+		}else
+		{
+			ProEconWtAlysisDay pepid=pepidls.get(0);
+
+			pewp.setYbbhcs(StringUtils.round(pepid.getYbbhcs()+pewp.getRbbhcs(),2));
+
+		}
+		//*******************************************月信息统计*********************************************************/
+
+		//*******************************************年信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			pewp.setNbbhcs(pewp.getRbbhcs());
+
+		}else
+		{
+
+
+			ProEconWtAlysisDay pepid=pepidls.get(0);
+			pewp.setNbbhcs(StringUtils.round(pepid.getNbbhcs()+pewp.getRbbhcs(),2));
+
+		}
+		//*******************************************年信息统计*********************************************************/
+	}
+
+}

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

@@ -0,0 +1,76 @@
+package com.gyee.generation.task.thread;
+
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDay1;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class EquipmentInfo1Thread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private ProBasicEquipment wt;
+	private   Map<String,ProEconEquipmentInfoDay1> pep1map;
+
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay1> dayls;
+	private IEdosUtil edosUtil;
+
+	private CountDownLatch latch;
+
+	public EquipmentInfo1Thread(Executor executor, ProBasicEquipment wt, Map<String,ProEconEquipmentInfoDay1> pep1map,
+								Date recordDate, Date end, Date begin,List<ProEconEquipmentInfoDay1> dayls,
+								IEdosUtil edosUtil,
+                                CountDownLatch latch	) {
+		this.executor = executor;
+		this.wt = wt;
+		this.pep1map = pep1map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+		this.latch = latch;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wt.getId();
+		logger.info("设备1计算服务创建任务并提交到线程池中:" + wt.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new EquipmentInfo1ThreadPool(task,
+				 wt,  pep1map,
+				 recordDate,  end,  begin,dayls,
+				 edosUtil));
+
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		}finally {
+			latch.countDown();
+		}
+	}
+}

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

@@ -0,0 +1,934 @@
+package com.gyee.generation.task.thread;
+
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDay1;
+import com.gyee.generation.model.vo.WpType;
+import com.gyee.generation.util.DateUtils;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import com.gyee.generation.util.statisticcs.Initial;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.util.*;
+import java.util.concurrent.Callable;
+
+public class EquipmentInfo1ThreadPool implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+	private static final long serialVersionUID = 0;
+
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private ProBasicEquipment wt;
+	private   Map<String,ProEconEquipmentInfoDay1> pep1map;
+
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay1> dayls;
+	private IEdosUtil edosUtil;
+
+	public EquipmentInfo1ThreadPool(Object tasks, ProBasicEquipment wt, Map<String,ProEconEquipmentInfoDay1> pep1map,
+									Date recordDate, Date end, Date begin,List<ProEconEquipmentInfoDay1> dayls,
+									IEdosUtil edosUtil
+	) {
+
+		this.threadPoolTaskData = tasks;
+		this.wt = wt;
+		this.pep1map = pep1map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+	}
+
+	public synchronized String call() throws Exception {
+
+
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		try {
+
+			if(CacheContext.wtpAimap.containsKey(wt.getId()))
+			{
+				Map<String, ProBasicEquipmentPoint> pointmap=CacheContext.wtpAimap.get(wt.getId());
+
+				ProEconEquipmentInfoDay1 pewp=new ProEconEquipmentInfoDay1();
+				Initial.initial(pewp);
+				pewp.setCompanyId(wt.getCompanyId());
+				pewp.setWindpowerstationId(wt.getWindpowerstationId());
+				pewp.setLineId(wt.getLineId());
+				pewp.setProjectId(wt.getProjectId());
+				pewp.setRegionId(wt.getRegionId());
+				pewp.setRecordDate(DateUtils.truncate(recordDate));
+				pewp.setWindturbineId(wt.getId());
+				//昨日的统计结果
+				List<ProEconEquipmentInfoDay1> pep1ls =new ArrayList<>();
+
+				if(pep1map.containsKey(wt.getId()))
+				{
+					pep1ls.add(pep1map.get(wt.getId()));
+				}
+				extracted(recordDate, end, begin, pointmap, pewp,pep1ls);
+
+				dayls.add(pewp);
+				// proEconEquipmentInfoDay1Service.save(pewp);
+
+			}
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+	private void extracted(Date recordDate, Date end, Date begin,Map<String, ProBasicEquipmentPoint> pointmap, ProEconEquipmentInfoDay1 pewp,List<ProEconEquipmentInfoDay1> pepid1ls) throws Exception {
+
+
+		if(pewp.getWindpowerstationId().contains(WpType.FDC.id))
+		{
+			//*******************************************日信息统计*********************************************************/
+			if(pointmap.containsKey(ContantXk.RPJFS))
+			{
+				ProBasicEquipmentPoint point= pointmap.get(ContantXk.RPJFS);
+				List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+				if(!pointls.isEmpty())
+				{
+					DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+					//日最大风速
+					pewp.setRzdfs(summaryStatistics.getMax());
+					//日最小风速
+					pewp.setRzxfs(summaryStatistics.getMin());
+					//日平均风速
+					pewp.setRpjfs(summaryStatistics.getAverage());
+				}
+
+			}
+		}else
+		{
+			//*******************************************日信息统计*********************************************************/
+			if(pointmap.containsKey(ContantXk.RPJGZD))
+			{
+				ProBasicEquipmentPoint point= pointmap.get(ContantXk.RPJGZD);
+				List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+				if(!pointls.isEmpty())
+				{
+					DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+					//日最大风速
+					pewp.setRzdfs(summaryStatistics.getMax());
+					//日最小风速
+					pewp.setRzxfs(summaryStatistics.getMin());
+					//日平均风速
+					pewp.setRpjfs(summaryStatistics.getAverage());
+				}
+
+			}
+		}
+
+
+
+		if(pointmap.containsKey(ContantXk.RPJGL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RPJGL);
+			List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+			if(!pointls.isEmpty())
+			{
+				DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+				//日最大功率
+				pewp.setRzdgl(summaryStatistics.getMax());
+				//日最小功率
+				pewp.setRzxgl(summaryStatistics.getMin());
+				//日平均功率
+				pewp.setRpjgl(summaryStatistics.getAverage());
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.RFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RFDL);
+
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日发电量
+				pewp.setRfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RKYDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RKYDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日可用电量
+				pewp.setRkydl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.RLLFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RLLFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日理论发电量
+				pewp.setRllfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.RGZSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RGZSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日故障损失电量
+				pewp.setRgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RCNSLGZSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RCNSLGZSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日场内受累故障损失电量
+				pewp.setRcnslgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RJXSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RJXSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日检修损失电量
+				pewp.setRjxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RCNSLJXSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RCNSLJXSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日场内受累检修损失电量
+				pewp.setRcnsljxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RDJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RDJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日待机损失电量
+				pewp.setRdjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RQXJCLSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RQXJCLSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日缺陷降出力损失电量
+				pewp.setRqxjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RSDTJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RSDTJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日手动停机损失电量
+				pewp.setRsdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RXNSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RXNSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日性能损失电量
+				pewp.setRxnssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RXDTJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RXDTJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日限电停机损失电量
+				pewp.setRxdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.RXDJCLSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RXDJCLSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日限电降出力损失电量
+				pewp.setRxdjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RCWSLDWSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RCWSLDWSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日场外受累电网损失电量
+				pewp.setRcwsldwssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RCWSLTQSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RCWSLTQSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日场外受累天气损失电量
+				pewp.setRcwsltqssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RZFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RZFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日增发电量
+				pewp.setRzfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.RQFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RQFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日欠发电量
+				pewp.setRqfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.RZHD))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.RZHD);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//日自耗电
+				pewp.setRzhd(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+//*******************************************日信息统计*********************************************************/
+
+//*******************************************月信息统计*********************************************************/
+
+		if(pepid1ls.isEmpty())
+		{
+			setPowerandSpeedMonth(pewp);
+		}else
+		{
+
+
+
+			if(pointmap.containsKey(ContantXk.YPJFS))
+			{
+				ProBasicEquipmentPoint point= pointmap.get(ContantXk.YPJFS);
+				List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+				if(!pointls.isEmpty())
+				{
+					DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+					//月最大风速
+					pewp.setYzdfs(summaryStatistics.getMax());
+					//月最小风速
+					pewp.setYzxfs(summaryStatistics.getMin());
+					//月平均风速
+					pewp.setYpjfs(summaryStatistics.getAverage());
+				}
+
+			}
+
+			if(pointmap.containsKey(ContantXk.YPJGL))
+			{
+				ProBasicEquipmentPoint point= pointmap.get(ContantXk.YPJGL);
+				List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+				if(!pointls.isEmpty())
+				{
+					DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+					//月最大功率
+					pewp.setYzdgl(summaryStatistics.getMax());
+					//月最小功率
+					pewp.setYzxgl(summaryStatistics.getMin());
+					//月平均功率
+					pewp.setYpjgl(summaryStatistics.getAverage());
+				}
+			}
+
+		}
+
+
+
+		if(pointmap.containsKey(ContantXk.YFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YFDL);
+
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月发电量
+				pewp.setYfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YKYDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YKYDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月可用电量
+				pewp.setYkydl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.YLLFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YLLFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月理论发电量
+				pewp.setYllfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.YGZSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YGZSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月故障损失电量
+				pewp.setYgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YCNSLGZSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YCNSLGZSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月场内受累故障损失电量
+				pewp.setYcnslgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YJXSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YJXSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月检修损失电量
+				pewp.setYjxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YCNSLJXSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YCNSLJXSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月场内受累检修损失电量
+				pewp.setYcnsljxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YDJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YDJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月待机损失电量
+				pewp.setYdjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YQXJCLSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YQXJCLSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月缺陷降出力损失电量
+				pewp.setYqxjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YSDTJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YSDTJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月手动停机损失电量
+				pewp.setYsdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YXNSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YXNSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月性能损失电量
+				pewp.setYxnssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YXDTJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YXDTJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月限电停机损失电量
+				pewp.setYxdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.YXDJCLSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YXDJCLSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月限电降出力损失电量
+				pewp.setYxdjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YCWSLDWSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YCWSLDWSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月场外受累电网损失电量
+				pewp.setYcwsldwssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YCWSLTQSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YCWSLTQSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月场外受累天气损失电量
+				pewp.setYcwsltqssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YZFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YZFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月增发电量
+				pewp.setYzfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.YQFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YQFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月欠发电量
+				pewp.setYqfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.YZHD))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.YZHD);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//月自耗电
+				pewp.setYzhd(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+//*******************************************月信息统计*********************************************************/
+
+//*******************************************年信息统计*********************************************************/
+		if(pepid1ls.isEmpty())
+		{
+			setPowerandSpeedYear(pewp);
+		}else
+		{
+
+			if(pointmap.containsKey(ContantXk.NPJFS))
+			{
+				ProBasicEquipmentPoint point= pointmap.get(ContantXk.NPJFS);
+				List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+				if(!pointls.isEmpty())
+				{
+					DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+					//年最大风速
+					pewp.setNzdfs(summaryStatistics.getMax());
+					//年最小风速
+					pewp.setNzxfs(summaryStatistics.getMin());
+					//年平均风速
+					pewp.setNpjfs(summaryStatistics.getAverage());
+				}
+
+			}
+
+			if(pointmap.containsKey(ContantXk.NPJGL))
+			{
+				ProBasicEquipmentPoint point= pointmap.get(ContantXk.NPJFS);
+				List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+				if(!pointls.isEmpty())
+				{
+					DoubleSummaryStatistics summaryStatistics=pointls.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
+					//年最大功率
+					pewp.setNzdgl(summaryStatistics.getMax());
+					//年最小功率
+					pewp.setNzxgl(summaryStatistics.getMin());
+					//年平均功率
+					pewp.setNpjgl(summaryStatistics.getAverage());
+				}
+			}
+
+		}
+
+		if(pointmap.containsKey(ContantXk.NFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NFDL);
+
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年发电量
+				pewp.setNfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NKYDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NKYDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年可用电量
+				pewp.setNkydl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.NLLFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NLLFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年理论发电量
+				pewp.setNllfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.NGZSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NGZSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年故障损失电量
+				pewp.setNgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NCNSLGZSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NCNSLGZSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年场内受累故障损失电量
+				pewp.setNcnslgzssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NJXSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NJXSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年检修损失电量
+				pewp.setNjxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NCNSLJXSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NCNSLJXSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年场内受累检修损失电量
+				pewp.setNcnsljxssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NDJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NDJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年待机损失电量
+				pewp.setNdjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NQXJCLSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NQXJCLSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年缺陷降出力损失电量
+				pewp.setNqxjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NSDTJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NSDTJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年手动停机损失电量
+				pewp.setNsdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NXNSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NXNSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年性能损失电量
+				pewp.setNxnssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NXDTJSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NXDTJSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年限电停机损失电量
+				pewp.setNxdtjssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+
+		if(pointmap.containsKey(ContantXk.NXDJCLSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NXDJCLSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年限电降出力损失电量
+				pewp.setNxdjclssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NCWSLDWSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NCWSLDWSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年场外受累电网损失电量
+				pewp.setNcwsldwssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NCWSLTQSSDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NCWSLTQSSDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年场外受累天气损失电量
+				pewp.setNcwsltqssdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NZFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NZFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年增发电量
+				pewp.setNzfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+
+		if(pointmap.containsKey(ContantXk.NQFDL))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NQFDL);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年欠发电量
+				pewp.setNqfdl(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+		if(pointmap.containsKey(ContantXk.NZHD))
+		{
+			ProBasicEquipmentPoint point= pointmap.get(ContantXk.NZHD);
+			PointData pointValue=edosUtil.getHistMatrix(point.getNemCode(), recordDate.getTime()/1000);
+			if(StringUtils.notEmp(pointValue))
+			{
+				//年自耗电
+				pewp.setNzhd(StringUtils.round(pointValue.getPointValueInDouble(),2));
+
+			}
+		}
+	}
+
+	private void setPowerandSpeedYear(ProEconEquipmentInfoDay1 pewp) {
+		//年最大风速
+		pewp.setNzdfs(pewp.getRzdfs());
+		//年最小风速
+		pewp.setNzxfs(pewp.getRzxfs());
+		//年平均风速
+		pewp.setNpjfs(pewp.getRpjfs());
+
+		//年最大功率
+		pewp.setNzdgl(pewp.getRzdgl());
+		//年最小功率
+		pewp.setNzxgl(pewp.getRzxgl());
+		//年平均功率
+		pewp.setNpjgl(pewp.getRpjgl());
+
+	}
+
+	private void setPowerandSpeedMonth(ProEconEquipmentInfoDay1 pewp) {
+
+		//月最大风速
+		pewp.setYzdfs(pewp.getRzdfs());
+		//月最小风速
+		pewp.setYzxfs(pewp.getRzxfs());
+		//月平均风速
+		pewp.setYpjfs(pewp.getRpjfs());
+
+		//月最大功率
+		pewp.setYzdgl(pewp.getRzdgl());
+		//月最小功率
+		pewp.setYzxgl(pewp.getRzxgl());
+		//月平均功率
+		pewp.setYpjgl(pewp.getRpjgl());
+	}
+}

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

@@ -0,0 +1,76 @@
+package com.gyee.generation.task.thread;
+
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDay2;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class EquipmentInfo2Thread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private ProBasicEquipment wt;
+	private   Map<String,ProEconEquipmentInfoDay2> pep2map;
+
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay2> dayls;
+	private IEdosUtil edosUtil;
+
+	private CountDownLatch latch;
+
+	public EquipmentInfo2Thread(Executor executor, ProBasicEquipment wt, Map<String,ProEconEquipmentInfoDay2> pep2map,
+                                Date recordDate, Date end, Date begin, List<ProEconEquipmentInfoDay2> dayls,
+                                IEdosUtil edosUtil,
+                                CountDownLatch latch	) {
+		this.executor = executor;
+		this.wt = wt;
+		this.pep2map = pep2map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+		this.latch = latch;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wt.getId();
+		logger.info("设备2计算服务创建任务并提交到线程池中:" + wt.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new EquipmentInfo2ThreadPool(task,
+				 wt,  pep2map,
+				 recordDate,  end,  begin,dayls,
+				 edosUtil));
+
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		}finally {
+			latch.countDown();
+		}
+	}
+}

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

@@ -0,0 +1,747 @@
+package com.gyee.generation.task.thread;
+
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDay2;
+import com.gyee.generation.util.DateUtils;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import com.gyee.generation.util.statisticcs.Initial;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+public class EquipmentInfo2ThreadPool implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+	private static final long serialVersionUID = 0;
+
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private ProBasicEquipment wt;
+	private   Map<String,ProEconEquipmentInfoDay2> pep2map;
+
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay2> dayls;
+	private IEdosUtil edosUtil;
+
+	public EquipmentInfo2ThreadPool(Object tasks, ProBasicEquipment wt, Map<String,ProEconEquipmentInfoDay2> pep2map,
+                                    Date recordDate, Date end, Date begin, List<ProEconEquipmentInfoDay2> dayls,
+                                    IEdosUtil edosUtil
+	) {
+
+		this.threadPoolTaskData = tasks;
+		this.wt = wt;
+		this.pep2map = pep2map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+	}
+
+	public synchronized String call() throws Exception {
+
+
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		try {
+			if(CacheContext.wtpAimap.containsKey(wt.getId()))
+			{
+
+				ProEconEquipmentInfoDay2 pewp=new ProEconEquipmentInfoDay2();
+				Initial.initial(pewp);
+				pewp.setCompanyId(wt.getCompanyId());
+				pewp.setWindpowerstationId(wt.getWindpowerstationId());
+				pewp.setLineId(wt.getLineId());
+				pewp.setProjectId(wt.getProjectId());
+				pewp.setRegionId(wt.getRegionId());
+				pewp.setRecordDate(DateUtils.truncate(recordDate));
+				pewp.setWindturbineId(wt.getId());
+				//昨日的统计结果
+				List<ProEconEquipmentInfoDay2> pepidls =new ArrayList<>();
+//                Calendar cl=Calendar.getInstance();
+//                cl.setTime(recordDate);
+//                cl.add(Calendar.DAY_OF_MONTH,-1);
+//                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+//                {
+//                    QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper2 = new QueryWrapper<>();
+//                    queryWrapper2.eq("record_date",cl.getTime())
+//                            .eq("windturbine_Id",wt.getId());
+//                    pepidls = proEconEquipmentInfoDay2Service.list(queryWrapper2);
+////                            .stream()
+////                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+////                                    && i.getWindturbineId().equals(wt.getId())
+////                            )
+////                            .collect(Collectors.toList());
+//                }
+
+				if(pep2map.containsKey(wt.getId()))
+				{
+					pepidls.add(pep2map.get(wt.getId()));
+				}
+				calDetiall( pewp, end, begin, wt,pepidls);
+				calSimple( pewp, end, begin, wt,pepidls);
+				dayls.add(pewp);
+				// proEconEquipmentInfoDay2Service.save(pewp);
+
+			}
+
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+	private void calDetiall(ProEconEquipmentInfoDay2 pewp, Date end, Date begin, ProBasicEquipment wt, List<ProEconEquipmentInfoDay2> pepidls) throws Exception {
+		//        //                0	待机
+//                1	手动停机
+//                2	正常发电
+//                3	发电降出力
+//                4	故障
+//                5	故障受累
+//                6	检修
+//                7	检修受累
+//                8	限电降出力
+//                9	限电停机
+//                10	电网受累
+//                11	环境受累
+//                12	通讯中断
+//                13	设备离线
+
+		double lastState;//上一分钟状态
+
+		double djsc=0;//待机时长
+		double sdtjsc=0;//手动停机时长
+		double zcfdsc=0;//正常发电时长
+		double fdjclsc=0;//发电降出力时长
+		double gzsc=0;//故障时长
+		double gzslsc=0;//故障受累时长
+		double jxsc=0;//检修时长
+		double jxslsc=0;//检修受累时长
+		double xdjclsc=0;//限电降出力时长
+		double xdtjsc=0;//限电停机时长
+		double dwslsc=0;//电网受累时长
+		double hjslsc=0;//环境受累时长
+		double txzdsc=0;//通讯中断时长
+		double sblxsc=0;//设备离线时长
+
+		Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+
+
+		lastState=-1;//上一分钟状态
+		Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+
+		if(aimap.containsKey(ContantXk.MXZT))
+		{
+
+			ProBasicEquipmentPoint point=aimap.get(ContantXk.MXZT);
+			//按照分钟时间进行统计状态快照值
+			List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+			if(!pointls.isEmpty())
+			{
+				for(PointData po :pointls)
+				{
+
+					if(po.getPointValueInDouble()==0)
+					{
+
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+						//待机时长加1分钟
+						djsc++;
+					}else  if(po.getPointValueInDouble()==1)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//手动停机时长加1分钟
+						sdtjsc++;
+					}else  if(po.getPointValueInDouble()==2)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+						//正常发电时长加1分钟
+						zcfdsc++;
+					}else  if(po.getPointValueInDouble()==3)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//发电降出力时长加1分钟
+						fdjclsc++;
+					}else  if(po.getPointValueInDouble()==4)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//故障时长加1分钟
+						gzsc++;
+					}else  if(po.getPointValueInDouble()==5)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//故障受累时长加1分钟
+						gzslsc++;
+					}else  if(po.getPointValueInDouble()==6)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//检修时长加1分钟
+						jxsc++;
+					}else  if(po.getPointValueInDouble()==7)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//检修受累时长加1分钟
+						jxslsc++;
+					}else  if(po.getPointValueInDouble()==8)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//限电降出力时长加1分钟
+						xdjclsc++;
+					}else  if(po.getPointValueInDouble()==9)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//限电停机时长加1分钟
+						xdtjsc++;
+					}else  if(po.getPointValueInDouble()==10)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//电网受累时长加1分钟
+						dwslsc++;
+					}else  if(po.getPointValueInDouble()==11)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+						//环境受累时长加1分钟
+						hjslsc++;
+					}else  if(po.getPointValueInDouble()==12)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+						//通讯中断时长加1分钟
+						txzdsc++;
+					}else  if(po.getPointValueInDouble()==13)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+
+						}
+
+						//设备离线时长加1分钟
+						sblxsc++;
+					}
+
+				}
+
+
+
+			}
+
+		}
+
+		//日合计故障小时(明细)
+		pewp.setRgzxsmx(new BigDecimal(gzsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计场内受累故障小时(明细)
+		pewp.setRcnslgzxsmx(new BigDecimal(gzslsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计检修小时(明细)
+		pewp.setRjxxsmx(new BigDecimal(jxsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计场内受累检修小时(明细)
+		pewp.setRcnsljxxsmx(new BigDecimal(jxslsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计待机小时(明细)
+		pewp.setRdjxsmx(new BigDecimal(djsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计缺陷降出力小时(明细)
+		pewp.setRqxjclxsmx(new BigDecimal(fdjclsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计手动停机小时(明细)
+		pewp.setRsdtjxsmx(new BigDecimal(sdtjsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计性能小时(明细)
+		pewp.setRbwxsmx(new BigDecimal(zcfdsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计限电停机小时(明细)
+		pewp.setRxdtjxsmx(new BigDecimal(xdtjsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计限电降出力小时(明细)
+		pewp.setRxdjclxsmx(new BigDecimal(xdjclsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计场外受累电网小时(明细)
+		pewp.setRcwsldwxsmx(new BigDecimal(dwslsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计场外受累电网小时(明细)
+		pewp.setRcwsltqxsmx(new BigDecimal(hjslsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计通讯中断小时(明细)
+		pewp.setRtxzdxsmx(new BigDecimal(txzdsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计离线小时(明细)
+		pewp.setRlxxsmx(new BigDecimal(sblxsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+
+
+
+//*******************************************日信息统计*********************************************************/
+
+//*******************************************月信息统计*********************************************************/
+
+		if(pepidls.isEmpty())
+		{
+			setLossHoursMonth(pewp);
+
+		}else
+		{
+
+
+			ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
+
+			//月合计故障小时(明细)
+			pewp.setYgzxsmx(StringUtils.round(pepid.getYgzxsmx()+pewp.getRgzxsmx(),2));
+			//月合计场内受累故障小时(明细)
+			pewp.setYcnslgzxsmx(StringUtils.round(pepid.getYcnslgzxsmx()+pewp.getRcnslgzxsmx(),2));
+			//月合计检修小时(明细)
+			pewp.setYjxxsmx(StringUtils.round(pepid.getYjxxsmx()+pewp.getRjxxsmx(),2));
+			//月合计场内受累检修小时(明细)
+			pewp.setYcnsljxxsmx(StringUtils.round( pepid.getYcnsljxxsmx()+pewp.getRcnsljxxsmx(),2));
+			//月合计待机小时(明细)
+			pewp.setYdjxsmx(StringUtils.round(pepid.getYdjxsmx()+pewp.getRdjxsmx(),2));
+			//月合计缺陷降出力小时(明细)
+			pewp.setYqxjclxsmx(StringUtils.round(pepid.getYqxjclxsmx()+pewp.getRqxjclxsmx(),2));
+			//月合计手动停机小时(明细)
+			pewp.setYsdtjxsmx(StringUtils.round(pepid.getYsdtjxsmx()+pewp.getRsdtjxsmx(),2));
+			//月合计性能小时(明细)
+			pewp.setYbwxsmx(StringUtils.round(pepid.getYbwxsmx()+pewp.getRbwxsmx(),2));
+			//月合计限电停机小时(明细)
+			pewp.setYxdtjxsmx(StringUtils.round(pepid.getYxdtjxsmx()+pewp.getRxdtjxsmx(),2));
+			//月合计限电降出力小时(明细)
+			pewp.setYxdjclxsmx(StringUtils.round(pepid.getYxdjclxsmx()+pewp.getRxdjclxsmx(),2));
+			//月合计场外受累电网小时(明细)
+			pewp.setYcwsldwxsmx(StringUtils.round(pepid.getYcwsldwxsmx()+pewp.getRcwsldwxsmx(),2));
+			//月合计场外受累电网小时(明细)
+			pewp.setYcwsltqxsmx(StringUtils.round(pepid.getYcwsltqxsmx()+pewp.getRcwsltqxsmx(),2));
+			//月合计通讯中断小时(明细)
+			pewp.setYtxzdxsmx(StringUtils.round(pepid.getYtxzdxsmx()+pewp.getRtxzdxsmx(),2));
+			//月合计离线小时(明细)
+			pewp.setYlxxsmx(StringUtils.round(pepid.getYlxxsmx()+pewp.getRlxxsmx(),2));
+
+		}
+
+
+
+//*******************************************月信息统计*********************************************************/
+
+//*******************************************年信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			setLossHoursYear(pewp);
+		}else
+		{
+
+			ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
+
+			//年合计故障小时(明细)
+			pewp.setNgzxsmx(StringUtils.round(pepid.getNgzxsmx()+pewp.getRgzxsmx(),2));
+			//年合计场内受累故障小时(明细)
+			pewp.setNcnslgzxsmx(StringUtils.round(pepid.getNcnslgzxsmx()+pewp.getRcnslgzxsmx(),2));
+			//年合计检修小时(明细)
+			pewp.setNjxxsmx(StringUtils.round(pepid.getNjxxsmx()+pewp.getRjxxsmx(),2));
+			//年合计场内受累检修小时(明细)
+			pewp.setNcnsljxxsmx(StringUtils.round( pepid.getNcnsljxxsmx()+pewp.getRcnsljxxsmx(),2));
+			//年合计待机小时(明细)
+			pewp.setNdjxsmx(StringUtils.round(pepid.getNdjxsmx()+pewp.getRdjxsmx(),2));
+			//年合计缺陷降出力小时(明细)
+			pewp.setNqxjclxsmx(StringUtils.round(pepid.getNqxjclxsmx()+pewp.getRqxjclxsmx(),2));
+			//年合计手动停机小时(明细)
+			pewp.setNsdtjxsmx(StringUtils.round(pepid.getNsdtjxsmx()+pewp.getRsdtjxsmx(),2));
+			//年合计性能小时(明细)
+			pewp.setNbwxsmx(StringUtils.round(pepid.getNbwxsmx()+pewp.getRbwxsmx(),2));
+			//年合计限电停机小时(明细)
+			pewp.setNxdtjxsmx(StringUtils.round(pepid.getNxdtjxsmx()+pewp.getRxdtjxsmx(),2));
+			//年合计限电降出力小时(明细)
+			pewp.setNxdjclxsmx(StringUtils.round(pepid.getNxdjclxsmx()+pewp.getRxdjclxsmx(),2));
+			//年合计场外受累电网小时(明细)
+			pewp.setNcwsldwxsmx(StringUtils.round(pepid.getNcwsldwxsmx()+pewp.getRcwsldwxsmx(),2));
+			//年合计场外受累电网小时(明细)
+			pewp.setNcwsltqxsmx(StringUtils.round(pepid.getNcwsltqxsmx()+pewp.getRcwsltqxsmx(),2));
+			//年合计通讯中断小时(明细)
+			pewp.setNtxzdxsmx(StringUtils.round(pepid.getNtxzdxsmx()+pewp.getRtxzdxsmx(),2));
+			//年合计离线小时(明细)
+			pewp.setNlxxsmx(StringUtils.round(pepid.getNlxxsmx()+pewp.getRlxxsmx(),2));
+
+		}
+
+
+	}
+
+	private static void setLossHoursYear(ProEconEquipmentInfoDay2 pewp) {
+		//年合计故障小时(明细)
+		pewp.setNgzxsmx(pewp.getRgzxsmx());
+		//年合计场内受累故障小时(明细)
+		pewp.setNcnslgzxsmx(pewp.getRcnslgzxsmx());
+		//年合计检修小时(明细)
+		pewp.setNjxxsmx(pewp.getRjxxsmx());
+		//年合计场内受累检修小时(明细)
+		pewp.setNcnsljxxsmx(pewp.getRcnsljxxsmx());
+		//年合计待机小时(明细)
+		pewp.setNdjxsmx(pewp.getRdjxsmx());
+		//年合计缺陷降出力小时(明细)
+		pewp.setNqxjclxsmx(pewp.getRqxjclxsmx());
+		//年合计手动停机小时(明细)
+		pewp.setNsdtjxsmx(pewp.getRsdtjxsmx());
+		//年合计性能小时(明细)
+		pewp.setNbwxsmx(pewp.getRbwxsmx());
+		//年合计限电停机小时(明细)
+		pewp.setNxdtjxsmx(pewp.getRxdtjxsmx());
+		//年合计限电降出力小时(明细)
+		pewp.setNxdjclxsmx(pewp.getRxdjclxsmx());
+		//年合计场外受累电网小时(明细)
+		pewp.setNcwsldwxsmx(pewp.getRcwsldwxsmx());
+		//年合计场外受累电网小时(明细)
+		pewp.setNcwsltqxsmx(pewp.getRcwsltqxsmx());
+		//年合计通讯中断小时(明细)
+		pewp.setNtxzdxsmx(pewp.getRtxzdxsmx());
+		//年合计离线小时(明细)
+		pewp.setNlxxsmx(pewp.getRlxxsmx());
+	}
+
+	private static void setLossHoursMonth(ProEconEquipmentInfoDay2 pewp) {
+		//月合计故障小时(明细)
+		pewp.setYgzxsmx(pewp.getRgzxsmx());
+		//月合计场内受累故障小时(明细)
+		pewp.setYcnslgzxsmx(pewp.getRcnslgzxsmx());
+		//月合计检修小时(明细)
+		pewp.setYjxxsmx(pewp.getRjxxsmx());
+		//月合计场内受累检修小时(明细)
+		pewp.setYcnsljxxsmx(pewp.getRcnsljxxsmx());
+		//月合计待机小时(明细)
+		pewp.setYdjxsmx(pewp.getRdjxsmx());
+		//月合计缺陷降出力小时(明细)
+		pewp.setYqxjclxsmx(pewp.getRqxjclxsmx());
+		//月合计手动停机小时(明细)
+		pewp.setYsdtjxsmx(pewp.getRsdtjxsmx());
+		//月合计性能小时(明细)
+		pewp.setYbwxsmx(pewp.getRbwxsmx());
+		//月合计限电停机小时(明细)
+		pewp.setYxdtjxsmx(pewp.getRxdtjxsmx());
+		//月合计限电降出力小时(明细)
+		pewp.setYxdjclxsmx(pewp.getRxdjclxsmx());
+		//月合计场外受累电网小时(明细)
+		pewp.setYcwsldwxsmx(pewp.getRcwsldwxsmx());
+		//月合计场外受累电网小时(明细)
+		pewp.setYcwsltqxsmx(pewp.getRcwsltqxsmx());
+		//月合计通讯中断小时(明细)
+		pewp.setYtxzdxsmx(pewp.getRtxzdxsmx());
+		//月合计离线小时(明细)
+		pewp.setYlxxsmx(pewp.getRlxxsmx());
+	}
+
+
+	private static void setLossHoursMonthSimple(ProEconEquipmentInfoDay2 pewp) {
+		//月合计待机小时
+		pewp.setYdjxs(pewp.getRdjxs());
+		//月合计维护停机小时
+		pewp.setYjxtjxs(pewp.getRjxtjxs());
+		// 月合计故障停机小时
+		pewp.setYgztjxs(pewp.getRgztjxs());
+		//月合计运行小时
+		pewp.setYyxxs(pewp.getRyxxs());
+		//月合计限电小时
+		pewp.setYxdxs(pewp.getRxdxs());
+		//月合计通讯中断小时
+		pewp.setYtxzdxs(pewp.getRtxzdxs());
+		//月合计受累小时
+		pewp.setYslxs(pewp.getRslxs());
+	}
+
+	private static void setLossHoursYearSimple(ProEconEquipmentInfoDay2 pewp) {
+		//年合计待机小时
+		pewp.setNdjxs(pewp.getRdjxs());
+		//年合计维护停机小时
+		pewp.setNjxtjxs(pewp.getRjxtjxs());
+		// 年合计故障小时
+		pewp.setNgztjxs(pewp.getRgztjxs());
+		//年合计运行小时
+		pewp.setNyxxs(pewp.getRyxxs());
+		//年合计限电小时
+		pewp.setNxdxs(pewp.getRxdxs());
+		//年合计通讯中断小时
+		pewp.setNtxzdxs(pewp.getRtxzdxs());
+		//年合计受累小时
+		pewp.setNslxs(pewp.getRslxs());
+	}
+
+	private void calSimple(ProEconEquipmentInfoDay2 pewp, Date end, Date begin, ProBasicEquipment wt, List<ProEconEquipmentInfoDay2> pepidls) throws Exception {
+//        0	待机
+//        1	运行
+//        2	故障
+//        3	检修
+//        4	限电
+//        5	受累
+//        6	离线
+//*******************************************日信息统计*********************************************************/
+
+		double lastState=-1;//上一分钟状态
+
+
+		double djsc=0;//待机时长
+		double zcfdsc=0;//正常发电时长
+		double gzsc=0;//故障时长
+		double jxsc=0;//检修时长
+		double xdtjsc=0;//限电停机时长
+		double slsc=0;//受累时长
+		double txzdsc=0;//通讯中断时长
+
+
+
+		Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+
+
+		Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+		if(aimap.containsKey(ContantXk.SBZT))
+		{
+
+			ProBasicEquipmentPoint point=aimap.get(ContantXk.SBZT);
+			//按照分钟时间进行统计状态快照值
+			List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+			if(!pointls.isEmpty()) {
+				for (PointData po : pointls) {
+
+					if (po.getPointValueInDouble() == 0) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+						//待机时长加1分钟
+						djsc++;
+					} else if (po.getPointValueInDouble() == 1) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+						//正常发电时长加1分钟
+						zcfdsc++;
+					} else if (po.getPointValueInDouble() == 2) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+						//故障时长加1分钟
+						gzsc++;
+					} else if (po.getPointValueInDouble() == 3) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+
+						//检修时长加1分钟
+						jxsc++;
+
+					} else if (po.getPointValueInDouble() == 4) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+
+						//限电停机时长加1分钟
+						xdtjsc++;
+					} else if (po.getPointValueInDouble() == 5) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+
+						//受累时长加1分钟
+						slsc++;
+
+					} else if (po.getPointValueInDouble() == 6) {
+						if (lastState != po.getPointValueInDouble()) {
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+
+						}
+						//通讯中断时长加1分钟
+						txzdsc++;
+					}
+
+				}
+
+			}
+
+
+
+		}
+
+
+
+		//日合计待机小时
+		pewp.setRdjxs(new BigDecimal(gzsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计维护停机小时
+		pewp.setRjxtjxs(new BigDecimal(jxsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		// 日合计待机小时
+		pewp.setRdjxs(new BigDecimal(djsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计运行小时
+		pewp.setRyxxs(new BigDecimal(zcfdsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计限电小时
+		pewp.setRxdxs(new BigDecimal(xdtjsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计通讯中断小时
+		pewp.setRtxzdxs(new BigDecimal(txzdsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+		//日合计受累小时
+		pewp.setRslxs(new BigDecimal(slsc).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue());
+
+
+		//*******************************************日信息统计*********************************************************/
+
+		//*******************************************月信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			setLossHoursMonthSimple(pewp);
+
+		}else
+		{
+
+			ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
+
+			//月合计待机小时
+			pewp.setYdjxs(StringUtils.round(pepid.getYdjxs()+pewp.getRdjxs(),2));
+			//月合计维护停机小时
+			pewp.setYjxtjxs(StringUtils.round(pepid.getYjxtjxs()+pewp.getRjxtjxs(),2));
+			// 月合计故障小时
+			pewp.setYgztjxs(StringUtils.round(pepid.getYgztjxs()+pewp.getRgztjxs(),2));
+			//月合计运行小时
+			pewp.setYyxxs(StringUtils.round(pepid.getYyxxs()+pewp.getRyxxs(),2));
+			//月合计限电小时
+			pewp.setYxdxs(StringUtils.round(pepid.getYxdxs()+pewp.getRxdxs(),2));
+			//月合计通讯中断小时
+			pewp.setYtxzdxs(StringUtils.round(pepid.getYtxzdxs()+pewp.getRtxzdxs(),2));
+			//月合计受累小时
+			pewp.setYslxs(StringUtils.round(pepid.getYslxs()+pewp.getRslxs(),2));
+
+		}
+		//*******************************************月信息统计*********************************************************/
+
+		//*******************************************年信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			setLossHoursYearSimple(pewp);
+
+		}else
+		{
+			ProEconEquipmentInfoDay2 pepid=pepidls.get(0);
+
+			//年合计待机小时
+			pewp.setNdjxs(StringUtils.round(pepid.getNdjxs()+pewp.getRdjxs(),2));
+			//年合计维护停机小时
+			pewp.setNjxtjxs(StringUtils.round(pepid.getNjxtjxs()+pewp.getRjxtjxs(),2));
+			// 年合计故障小时
+			pewp.setNgztjxs(StringUtils.round(pepid.getNgztjxs()+pewp.getRgztjxs(),2));
+			//年合计运行小时
+			pewp.setNyxxs(StringUtils.round(pepid.getNyxxs()+pewp.getRyxxs(),2));
+			//年合计限电小时
+			pewp.setNxdxs(StringUtils.round(pepid.getNxdxs()+pewp.getRxdxs(),2));
+			//年合计通讯中断小时
+			pewp.setNtxzdxs(StringUtils.round(pepid.getNtxzdxs()+pewp.getRtxzdxs(),2));
+			//年合计受累小时
+			pewp.setNslxs(StringUtils.round(pepid.getNslxs()+pewp.getRslxs(),2));
+
+		}
+		//*******************************************年信息统计*********************************************************/
+	}
+}

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

@@ -0,0 +1,76 @@
+package com.gyee.generation.task.thread;
+
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDay3;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class EquipmentInfo3Thread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private ProBasicEquipment wt;
+	private   Map<String, ProEconEquipmentInfoDay3> pep3map;
+
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay3> dayls;
+	private IEdosUtil edosUtil;
+
+	private CountDownLatch latch;
+
+	public EquipmentInfo3Thread(Executor executor, ProBasicEquipment wt, Map<String,ProEconEquipmentInfoDay3> pep3map,
+                                Date recordDate, Date end, Date begin, List<ProEconEquipmentInfoDay3> dayls,
+                                IEdosUtil edosUtil,
+                                CountDownLatch latch	) {
+		this.executor = executor;
+		this.wt = wt;
+		this.pep3map = pep3map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+		this.latch = latch;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wt.getId();
+		logger.info("设备3计算服务创建任务并提交到线程池中:" + wt.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new EquipmentInfo3ThreadPool(task,
+				 wt,  pep3map,
+				 recordDate,  end,  begin,dayls,
+				 edosUtil));
+
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		}finally {
+			latch.countDown();
+		}
+	}
+}

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

@@ -0,0 +1,745 @@
+package com.gyee.generation.task.thread;
+
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDay3;
+import com.gyee.generation.util.DateUtils;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import com.gyee.generation.util.statisticcs.Initial;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+public class EquipmentInfo3ThreadPool implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+	private static final long serialVersionUID = 0;
+
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private ProBasicEquipment wt;
+	private   Map<String,ProEconEquipmentInfoDay3> pep3map;
+
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay3> dayls;
+	private IEdosUtil edosUtil;
+
+	public EquipmentInfo3ThreadPool(Object tasks, ProBasicEquipment wt, Map<String, ProEconEquipmentInfoDay3> pep3map,
+                                    Date recordDate, Date end, Date begin, List<ProEconEquipmentInfoDay3> dayls,
+                                    IEdosUtil edosUtil
+	) {
+
+		this.threadPoolTaskData = tasks;
+		this.wt = wt;
+		this.pep3map = pep3map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+	}
+
+	public synchronized String call() throws Exception {
+
+
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		try {
+			if(CacheContext.wtpAimap.containsKey(wt.getId()))
+			{
+
+
+				ProEconEquipmentInfoDay3 pewp=new ProEconEquipmentInfoDay3();
+				Initial.initial(pewp);
+				pewp.setCompanyId(wt.getCompanyId());
+				pewp.setWindpowerstationId(wt.getWindpowerstationId());
+				pewp.setLineId(wt.getLineId());
+				pewp.setProjectId(wt.getProjectId());
+				pewp.setRegionId(wt.getRegionId());
+				pewp.setRecordDate(DateUtils.truncate(recordDate));
+				pewp.setWindturbineId(wt.getId());
+				//昨日的统计结果
+				List<ProEconEquipmentInfoDay3> pepidls =new ArrayList<>();
+//                Calendar cl=Calendar.getInstance();
+//                cl.setTime(recordDate);
+//                cl.add(Calendar.DAY_OF_MONTH,-1);
+//                if(cl.get(Calendar.DAY_OF_MONTH)!=1)
+//
+//                {
+//                    QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper2 = new QueryWrapper<>();
+//                    queryWrapper2.eq("record_date",cl.getTime())
+//                            .eq("windturbine_Id",wt.getId());
+//                    pepidls = proEconEquipmentInfoDay3Service.list(queryWrapper2);
+////                            .stream()
+////                            .filter(i -> i.getRecordDate().compareTo(DateUtils.truncate(cl.getTime())) == 0
+////                                    && i.getWindturbineId().equals(wt.getId())
+////                                  )
+////                            .collect(Collectors.toList());
+//                }
+
+				if(pep3map.containsKey(wt.getId()))
+				{
+					pepidls.add(pep3map.get(wt.getId()));
+				}
+				calDetiall( pewp, end, begin,wt,pepidls);
+				calSimple( pewp, end, begin, wt,pepidls);
+				dayls.add(pewp);
+				// proEconEquipmentInfoDay3Service.save(pewp);
+
+
+			}
+
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+	private void calDetiall(ProEconEquipmentInfoDay3 pewp, Date end, Date begin, ProBasicEquipment wt, List<ProEconEquipmentInfoDay3> pepidls) throws Exception {
+		//        //                0	待机
+//                1	手动停机
+//                2	正常发电
+//                3	发电降出力
+//                4	故障
+//                5	故障受累
+//                6	检修
+//                7	检修受累
+//                8	限电降出力
+//                9	限电停机
+//                10	电网受累
+//                11	环境受累
+//                12	通讯中断
+//                13	设备离线
+
+		double lastState;//上一分钟状态
+
+		double djcs=0;//待机时长
+		double sdtjcs=0;//手动停机时长
+		double zcfdcs=0;//正常发电时长
+		double fdjclcs=0;//发电降出力时长
+		double gzcs=0;//故障时长
+		double gzslcs=0;//故障受累时长
+		double jxcs=0;//检修时长
+		double jxslcs=0;//检修受累时长
+		double xdjclcs=0;//限电降出力时长
+		double xdtjcs=0;//限电停机时长
+		double dwslcs=0;//电网受累时长
+		double hjslcs=0;//环境受累时长
+		double txzdcs=0;//通讯中断时长
+		double sblxcs=0;//设备离线时长
+
+		Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+
+
+
+		lastState=-1;//上一分钟状态
+		Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+		if(aimap.containsKey(ContantXk.MXZT))
+		{
+
+			ProBasicEquipmentPoint point=aimap.get(ContantXk.MXZT);
+			//按照分钟时间进行统计状态快照值
+			List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+			if(!pointls.isEmpty())
+			{
+				for(PointData po :pointls)
+				{
+
+					if(po.getPointValueInDouble()==0)
+					{
+
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//待机时长加1
+							djcs++;
+						}
+
+					}else  if(po.getPointValueInDouble()==1)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//手动停机时长加1
+							sdtjcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==2)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//正常发电时长加1
+							zcfdcs++;
+						}
+
+					}else  if(po.getPointValueInDouble()==3)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//发电降出力时长加1
+							fdjclcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==4)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//故障时长加1
+							gzcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==5)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//故障受累时长加1
+							gzslcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==6)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//检修时长加1
+							jxcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==7)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//检修受累时长加1
+							jxslcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==8)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//限电降出力时长加1
+							xdjclcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==9)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//限电停机时长加1
+							xdtjcs++;
+						}
+
+						//限电停机时长加1
+						xdtjcs++;
+					}else  if(po.getPointValueInDouble()==10)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//电网受累时长加1
+							dwslcs++;
+						}
+
+
+					}else  if(po.getPointValueInDouble()==11)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//环境受累时长加1
+							hjslcs++;
+						}
+
+					}else  if(po.getPointValueInDouble()==12)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//通讯中断时长加1
+							txzdcs++;
+						}
+
+					}else  if(po.getPointValueInDouble()==13)
+					{
+						if(lastState!=po.getPointValueInDouble())
+						{
+
+							//将当前状态保存到上一分钟状态
+							lastState=po.getPointValueInDouble();
+							//设备离线时长加1
+							sblxcs++;
+						}
+
+
+					}
+
+				}
+
+			}
+
+		}
+
+
+		//日合计故障次数(明细)
+		pewp.setRgzcsmx(gzcs);
+		//日合计场内受累故障次数(明细)
+		pewp.setRcnslgzcsmx(gzslcs);
+		//日合计检修次数(明细)
+		pewp.setRjxcsmx(jxcs);
+		//日合计场内受累检修次数(明细)
+		pewp.setRcnsljxcsmx(jxslcs);
+		//日合计待机次数(明细)
+		pewp.setRdjcsmx(djcs);
+		//日合计缺陷降出力次数(明细)
+		pewp.setRqxjclcsmx(fdjclcs);
+		//日合计手动停机次数(明细)
+		pewp.setRsdtjcsmx(sdtjcs);
+		//日合计性能次数(明细)
+		pewp.setRbwcsmx(zcfdcs);
+		//日合计限电停机次数(明细)
+		pewp.setRxdtjcsmx(xdtjcs);
+		//日合计限电降出力次数(明细)
+		pewp.setRxdjclcsmx(xdjclcs);
+		//日合计场外受累电网次数(明细)
+		pewp.setRcwsldwcsmx(dwslcs);
+		//日合计场外受累电网次数(明细)
+		pewp.setRcwsltqcsmx(hjslcs);
+		//日合计通讯中断次数(明细)
+		pewp.setRtxzdcsmx(txzdcs);
+		//日合计离线次数(明细)
+		pewp.setRlxcsmx(sblxcs);
+
+//*******************************************日信息统计*********************************************************/
+
+//*******************************************月信息统计*********************************************************/
+
+		if(pepidls.isEmpty())
+		{
+			setLossHoursMonth(pewp);
+
+		}else
+		{
+
+
+			ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
+
+			//月合计故障次数(明细)
+			pewp.setYgzcsmx(StringUtils.round(pepid.getYgzcsmx()+pewp.getRgzcsmx(),2));
+			//月合计场内受累故障次数(明细)
+			pewp.setYcnslgzcsmx(StringUtils.round(pepid.getYcnslgzcsmx()+pewp.getRcnslgzcsmx(),2));
+			//月合计检修次数(明细)
+			pewp.setYjxcsmx(StringUtils.round(pepid.getYjxcsmx()+pewp.getRjxcsmx(),2));
+			//月合计场内受累检修次数(明细)
+			pewp.setYcnsljxcsmx(StringUtils.round( pepid.getYcnsljxcsmx()+pewp.getRcnsljxcsmx(),2));
+			//月合计待机次数(明细)
+			pewp.setYdjcsmx(StringUtils.round(pepid.getYdjcsmx()+pewp.getRdjcsmx(),2));
+			//月合计缺陷降出力次数(明细)
+			pewp.setYqxjclcsmx(StringUtils.round(pepid.getYqxjclcsmx()+pewp.getRqxjclcsmx(),2));
+			//月合计手动停机次数(明细)
+			pewp.setYsdtjcsmx(StringUtils.round(pepid.getYsdtjcsmx()+pewp.getRsdtjcsmx(),2));
+			//月合计性能次数(明细)
+			pewp.setYbwcsmx(StringUtils.round(pepid.getYbwcsmx()+pewp.getRbwcsmx(),2));
+			//月合计限电停机次数(明细)
+			pewp.setYxdtjcsmx(StringUtils.round(pepid.getYxdtjcsmx()+pewp.getRxdtjcsmx(),2));
+			//月合计限电降出力次数(明细)
+			pewp.setYxdjclcsmx(StringUtils.round(pepid.getYxdjclcsmx()+pewp.getRxdjclcsmx(),2));
+			//月合计场外受累电网次数(明细)
+			pewp.setYcwsldwcsmx(StringUtils.round(pepid.getYcwsldwcsmx()+pewp.getRcwsldwcsmx(),2));
+			//月合计场外受累电网次数(明细)
+			pewp.setYcwsltqcsmx(StringUtils.round(pepid.getYcwsltqcsmx()+pewp.getRcwsltqcsmx(),2));
+			//月合计通讯中断次数(明细)
+			pewp.setYtxzdcsmx(StringUtils.round(pepid.getYtxzdcsmx()+pewp.getRtxzdcsmx(),2));
+			//月合计离线次数(明细)
+			pewp.setYlxcsmx(StringUtils.round(pepid.getYlxcsmx()+pewp.getRlxcsmx(),2));
+
+		}
+
+
+
+//*******************************************月信息统计*********************************************************/
+
+//*******************************************年信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			setLossHoursYear(pewp);
+		}else
+		{
+
+			ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
+
+			//年合计故障次数(明细)
+			pewp.setNgzcsmx(StringUtils.round(pepid.getNgzcsmx()+pewp.getRgzcsmx(),2));
+			//年合计场内受累故障次数(明细)
+			pewp.setNcnslgzcsmx(StringUtils.round(pepid.getNcnslgzcsmx()+pewp.getRcnslgzcsmx(),2));
+			//年合计检修次数(明细)
+			pewp.setNjxcsmx(StringUtils.round(pepid.getNjxcsmx()+pewp.getRjxcsmx(),2));
+			//年合计场内受累检修次数(明细)
+			pewp.setNcnsljxcsmx(StringUtils.round( pepid.getNcnsljxcsmx()+pewp.getRcnsljxcsmx(),2));
+			//年合计待机次数(明细)
+			pewp.setNdjcsmx(StringUtils.round(pepid.getNdjcsmx()+pewp.getRdjcsmx(),2));
+			//年合计缺陷降出力次数(明细)
+			pewp.setNqxjclcsmx(StringUtils.round(pepid.getNqxjclcsmx()+pewp.getRqxjclcsmx(),2));
+			//年合计手动停机次数(明细)
+			pewp.setNsdtjcsmx(StringUtils.round(pepid.getNsdtjcsmx()+pewp.getRsdtjcsmx(),2));
+			//年合计性能次数(明细)
+			pewp.setNbwcsmx(StringUtils.round(pepid.getNbwcsmx()+pewp.getRbwcsmx(),2));
+			//年合计限电停机次数(明细)
+			pewp.setNxdtjcsmx(StringUtils.round(pepid.getNxdtjcsmx()+pewp.getRxdtjcsmx(),2));
+			//年合计限电降出力次数(明细)
+			pewp.setNxdjclcsmx(StringUtils.round(pepid.getNxdjclcsmx()+pewp.getRxdjclcsmx(),2));
+			//年合计场外受累电网次数(明细)
+			pewp.setNcwsldwcsmx(StringUtils.round(pepid.getNcwsldwcsmx()+pewp.getRcwsldwcsmx(),2));
+			//年合计场外受累电网次数(明细)
+			pewp.setNcwsltqcsmx(StringUtils.round(pepid.getNcwsltqcsmx()+pewp.getRcwsltqcsmx(),2));
+			//年合计通讯中断次数(明细)
+			pewp.setNtxzdcsmx(StringUtils.round(pepid.getNtxzdcsmx()+pewp.getRtxzdcsmx(),2));
+			//年合计离线次数(明细)
+			pewp.setNlxcsmx(StringUtils.round(pepid.getNlxcsmx()+pewp.getRlxcsmx(),2));
+
+		}
+
+
+	}
+
+	private static void setLossHoursYear(ProEconEquipmentInfoDay3 pewp) {
+		//年合计故障次数(明细)
+		pewp.setNgzcsmx(pewp.getRgzcsmx());
+		//年合计场内受累故障次数(明细)
+		pewp.setNcnslgzcsmx(pewp.getRcnslgzcsmx());
+		//年合计检修次数(明细)
+		pewp.setNjxcsmx(pewp.getRjxcsmx());
+		//年合计场内受累检修次数(明细)
+		pewp.setNcnsljxcsmx(pewp.getRcnsljxcsmx());
+		//年合计待机次数(明细)
+		pewp.setNdjcsmx(pewp.getRdjcsmx());
+		//年合计缺陷降出力次数(明细)
+		pewp.setNqxjclcsmx(pewp.getRqxjclcsmx());
+		//年合计手动停机次数(明细)
+		pewp.setNsdtjcsmx(pewp.getRsdtjcsmx());
+		//年合计性能次数(明细)
+		pewp.setNbwcsmx(pewp.getRbwcsmx());
+		//年合计限电停机次数(明细)
+		pewp.setNxdtjcsmx(pewp.getRxdtjcsmx());
+		//年合计限电降出力次数(明细)
+		pewp.setNxdjclcsmx(pewp.getRxdjclcsmx());
+		//年合计场外受累电网次数(明细)
+		pewp.setNcwsldwcsmx(pewp.getRcwsldwcsmx());
+		//年合计场外受累电网次数(明细)
+		pewp.setNcwsltqcsmx(pewp.getRcwsltqcsmx());
+		//年合计通讯中断次数(明细)
+		pewp.setNtxzdcsmx(pewp.getRtxzdcsmx());
+		//年合计离线次数(明细)
+		pewp.setNlxcsmx(pewp.getRlxcsmx());
+	}
+
+	private static void setLossHoursMonth(ProEconEquipmentInfoDay3 pewp) {
+		//月合计故障次数(明细)
+		pewp.setYgzcsmx(pewp.getRgzcsmx());
+		//月合计场内受累故障次数(明细)
+		pewp.setYcnslgzcsmx(pewp.getRcnslgzcsmx());
+		//月合计检修次数(明细)
+		pewp.setYjxcsmx(pewp.getRjxcsmx());
+		//月合计场内受累检修次数(明细)
+		pewp.setYcnsljxcsmx(pewp.getRcnsljxcsmx());
+		//月合计待机次数(明细)
+		pewp.setYdjcsmx(pewp.getRdjcsmx());
+		//月合计缺陷降出力次数(明细)
+		pewp.setYqxjclcsmx(pewp.getRqxjclcsmx());
+		//月合计手动停机次数(明细)
+		pewp.setYsdtjcsmx(pewp.getRsdtjcsmx());
+		//月合计性能次数(明细)
+		pewp.setYbwcsmx(pewp.getRbwcsmx());
+		//月合计限电停机次数(明细)
+		pewp.setYxdtjcsmx(pewp.getRxdtjcsmx());
+		//月合计限电降出力次数(明细)
+		pewp.setYxdjclcsmx(pewp.getRxdjclcsmx());
+		//月合计场外受累电网次数(明细)
+		pewp.setYcwsldwcsmx(pewp.getRcwsldwcsmx());
+		//月合计场外受累电网次数(明细)
+		pewp.setYcwsltqcsmx(pewp.getRcwsltqcsmx());
+		//月合计通讯中断次数(明细)
+		pewp.setYtxzdcsmx(pewp.getRtxzdcsmx());
+		//月合计离线次数(明细)
+		pewp.setYlxcsmx(pewp.getRlxcsmx());
+	}
+
+
+	private static void setLossHoursMonthSimple(ProEconEquipmentInfoDay3 pewp) {
+		//月合计待机次数
+		pewp.setYdjcs(pewp.getRdjcs());
+		//月合计维护停机次数
+		pewp.setYjxtjcs(pewp.getRjxtjcs());
+		// 月合计故障停机次数
+		pewp.setYgztjcs(pewp.getRgztjcs());
+		//月合计运行次数
+		pewp.setYyxcs(pewp.getRyxcs());
+		//月合计限电次数
+		pewp.setYxdcs(pewp.getRxdcs());
+		//月合计通讯中断次数
+		pewp.setYtxzdcs(pewp.getRtxzdcs());
+		//月合计受累次数
+		pewp.setYslcs(pewp.getRslcs());
+	}
+
+	private static void setLossHoursYearSimple(ProEconEquipmentInfoDay3 pewp) {
+		//年合计待机次数
+		pewp.setNdjcs(pewp.getRdjcs());
+		//年合计维护停机次数
+		pewp.setNjxtjcs(pewp.getRjxtjcs());
+		// 年合计故障次数
+		pewp.setNgztjcs(pewp.getRgztjcs());
+		//年合计运行次数
+		pewp.setNyxcs(pewp.getRyxcs());
+		//年合计限电次数
+		pewp.setNxdcs(pewp.getRxdcs());
+		//年合计通讯中断次数
+		pewp.setNtxzdcs(pewp.getRtxzdcs());
+		//年合计受累次数
+		pewp.setNslcs(pewp.getRslcs());
+	}
+
+	private void calSimple(ProEconEquipmentInfoDay3 pewp, Date end, Date begin, ProBasicEquipment wt, List<ProEconEquipmentInfoDay3> pepidls) throws Exception {
+//        0	待机
+//        1	运行
+//        2	故障
+//        3	检修
+//        4	限电
+//        5	受累
+//        6	离线
+//*******************************************日信息统计*********************************************************/
+
+		double lastState=-1;//上一分钟状态
+
+
+		double djcs=0;//待机时长
+		double zcfdcs=0;//正常发电时长
+		double gzcs=0;//故障时长
+		double jxcs=0;//检修时长
+		double xdtjcs=0;//限电停机时长
+		double slsc=0;//受累时长
+		double txzdcs=0;//通讯中断时长
+
+
+
+		Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+
+
+		Map<String, ProBasicEquipmentPoint> aimap=wtpAimap.get(wt.getId());
+		if(aimap.containsKey(ContantXk.SBZT))
+		{
+
+			ProBasicEquipmentPoint point=aimap.get(ContantXk.SBZT);
+			//按照分钟时间进行统计状态快照值
+			List<PointData> pointls=edosUtil.getHistoryDatasSnap(point.getNemCode(), begin.getTime()/1000, end.getTime()/1000);
+			if(!pointls.isEmpty()) {
+				for (PointData po : pointls) {
+
+					if (po.getPointValueInDouble() == 0) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//待机时长加1
+							djcs++;
+						}
+
+					} else if (po.getPointValueInDouble() == 1) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//正常发电时长加1
+							zcfdcs++;
+						}
+
+					} else if (po.getPointValueInDouble() == 2) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//故障时长加1
+							gzcs++;
+						}
+
+					} else if (po.getPointValueInDouble() == 3) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//检修时长加1
+							jxcs++;
+						}
+					} else if (po.getPointValueInDouble() == 4) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//限电停机时长加1
+							xdtjcs++;
+						}
+					} else if (po.getPointValueInDouble() == 5) {
+						if (lastState != po.getPointValueInDouble()) {
+
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//受累时长加1
+							slsc++;
+						}
+
+					} else if (po.getPointValueInDouble() == 6) {
+						if (lastState != po.getPointValueInDouble()) {
+							//将当前状态保存到上一分钟状态
+							lastState = po.getPointValueInDouble();
+							//通讯中断时长加1
+							txzdcs++;
+						}
+
+					}
+
+				}
+
+			}
+
+		}
+
+
+
+		//日合计待机次数
+		pewp.setRdjcs(gzcs);
+		//日合计维护停机次数
+		pewp.setRjxtjcs(jxcs);
+		// 日合计待机次数
+		pewp.setRdjcs(djcs);
+		//日合计运行次数
+		pewp.setRyxcs(zcfdcs);
+		//日合计限电次数
+		pewp.setRxdcs(xdtjcs);
+		//日合计通讯中断次数
+		pewp.setRtxzdcs(txzdcs);
+		//日合计受累次数
+		pewp.setRslcs(slsc);
+
+
+		//*******************************************日信息统计*********************************************************/
+
+		//*******************************************月信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			setLossHoursMonthSimple(pewp);
+
+		}else
+		{
+
+
+			ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
+
+
+			//月合计待机次数
+			pewp.setYdjcs(StringUtils.round(pepid.getYdjcs()+pewp.getRdjcs(),2));
+			//月合计维护停机次数
+			pewp.setYjxtjcs(StringUtils.round(pepid.getYjxtjcs()+pewp.getRjxtjcs(),2));
+			// 月合计故障次数
+			pewp.setYgztjcs(StringUtils.round(pepid.getYgztjcs()+pewp.getRgztjcs(),2));
+			//月合计运行次数
+			pewp.setYyxcs(StringUtils.round(pepid.getYyxcs()+pewp.getRyxcs(),2));
+			//月合计限电次数
+			pewp.setYxdcs(StringUtils.round(pepid.getYxdcs()+pewp.getRxdcs(),2));
+			//月合计通讯中断次数
+			pewp.setYtxzdcs(StringUtils.round(pepid.getYtxzdcs()+pewp.getRtxzdcs(),2));
+			//月合计受累次数
+			pewp.setYslcs(StringUtils.round(pepid.getYslcs()+pewp.getRslcs(),2));
+
+		}
+		//*******************************************月信息统计*********************************************************/
+
+		//*******************************************年信息统计*********************************************************/
+		if(pepidls.isEmpty())
+		{
+			setLossHoursYearSimple(pewp);
+
+		}else
+		{
+
+
+			ProEconEquipmentInfoDay3 pepid=pepidls.get(0);
+
+
+			//年合计待机次数
+			pewp.setNdjcs(StringUtils.round(pepid.getNdjcs()+pewp.getRdjcs(),2));
+			//年合计维护停机次数
+			pewp.setNjxtjcs(StringUtils.round(pepid.getNjxtjcs()+pewp.getRjxtjcs(),2));
+			// 年合计故障次数
+			pewp.setNgztjcs(StringUtils.round(pepid.getNgztjcs()+pewp.getRgztjcs(),2));
+			//年合计运行次数
+			pewp.setNyxcs(StringUtils.round(pepid.getNyxcs()+pewp.getRyxcs(),2));
+			//年合计限电次数
+			pewp.setNxdcs(StringUtils.round(pepid.getNxdcs()+pewp.getRxdcs(),2));
+			//年合计通讯中断次数
+			pewp.setNtxzdcs(StringUtils.round(pepid.getNtxzdcs()+pewp.getRtxzdcs(),2));
+			//年合计受累次数
+			pewp.setNslcs(StringUtils.round(pepid.getNslcs()+pewp.getRslcs(),2));
+
+		}
+		//*******************************************年信息统计*********************************************************/
+	}
+
+
+
+}

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

@@ -0,0 +1,132 @@
+package com.gyee.generation.task.thread;
+
+import com.gyee.generation.model.auto.*;
+import com.gyee.generation.service.auto.*;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class EquipmentInfo4Thread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private ProBasicEquipment wt;
+	private   Map<String, ProEconEquipmentInfoDay2> pep2map;
+	private   Map<String,ProEconEquipmentInfoDay3> pep3map;
+	private   Map<String, ProEconEquipmentInfoDay4> pep4map;
+	private Date recordDate;
+	private Date end;
+
+	private Date begin;
+	private List<ProEconEquipmentInfoDay4> dayls;
+	private IEdosUtil edosUtil;
+
+	private Map<String, ProEconInOrOutSpeedTotal> peioomap;
+
+	private Map<String,ProEconWindturbineGoodness> wgmap;
+
+	private IProEconCurveFittingMainService proEconCurveFittingMainService;
+
+	private IProEconEquipmentInfoDay5Service proEconEquipmentInfoDay5Service;
+
+	private IProEconFaultLiminatedefectsService proEconFaultLiminatedefectsService;
+
+	private IProEconCurveFittingSubService proEconCurveFittingSubService;
+
+	private IProEconCurveFittMonthMainService proEconCurveFittMonthMainService;
+
+	private IProEconCurveFittMonthSubService proEconCurveFittMonthSubService;
+
+	private IProEconCurveFittYearMainService proEconCurveFittYearMainService;
+
+
+	private IProEconCurveFittYearSubService proEconCurveFittYearSubService;
+
+	private CountDownLatch latch;
+
+	public EquipmentInfo4Thread(Executor executor,ProBasicEquipment wt,Map<String, ProEconEquipmentInfoDay2> pep2map,
+								Map<String, ProEconEquipmentInfoDay3> pep3map,
+								Map<String, ProEconEquipmentInfoDay4> pep4map,
+								Date recordDate, Date end, Date begin, List<ProEconEquipmentInfoDay4> dayls,
+								IEdosUtil edosUtil,Map<String, ProEconInOrOutSpeedTotal> peioomap,
+								Map<String,ProEconWindturbineGoodness> wgmap,
+								IProEconCurveFittingMainService proEconCurveFittingMainService,
+								IProEconEquipmentInfoDay5Service proEconEquipmentInfoDay5Service,
+								IProEconFaultLiminatedefectsService proEconFaultLiminatedefectsService,
+								IProEconCurveFittingSubService proEconCurveFittingSubService,
+								IProEconCurveFittMonthMainService proEconCurveFittMonthMainService,
+								IProEconCurveFittMonthSubService proEconCurveFittMonthSubService,
+								IProEconCurveFittYearMainService proEconCurveFittYearMainService,
+								IProEconCurveFittYearSubService proEconCurveFittYearSubService,
+                                CountDownLatch latch	) {
+		this.executor = executor;
+		this.wt = wt;
+		this.pep2map = pep2map;
+		this.pep3map = pep3map;
+		this.pep4map = pep4map;
+		this.recordDate = recordDate;
+		this.end = end;
+		this.begin = begin;
+		this.dayls = dayls;
+		this.edosUtil = edosUtil;
+		this.peioomap = peioomap;
+		this.wgmap = wgmap;
+		this.proEconCurveFittingMainService=proEconCurveFittingMainService;
+		this.proEconEquipmentInfoDay5Service=proEconEquipmentInfoDay5Service;
+		this.proEconFaultLiminatedefectsService=proEconFaultLiminatedefectsService;
+		this.proEconCurveFittingSubService=proEconCurveFittingSubService;
+		this.proEconCurveFittMonthMainService=proEconCurveFittMonthMainService;
+		this.proEconCurveFittMonthSubService=proEconCurveFittMonthSubService;
+		this.proEconCurveFittYearMainService=proEconCurveFittYearMainService;
+		this.proEconCurveFittYearSubService=proEconCurveFittYearSubService;
+		this.latch = latch;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wt.getId();
+		logger.info("设备4计算服务创建任务并提交到线程池中:" + wt.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new EquipmentInfo4ThreadPool(task,
+				 wt, pep2map,
+				 pep3map,
+				 pep4map,
+				 recordDate,  end,  begin,  dayls,
+				 edosUtil, peioomap,
+				 wgmap,
+				 proEconCurveFittingMainService,
+				 proEconEquipmentInfoDay5Service,
+				 proEconFaultLiminatedefectsService,
+				 proEconCurveFittingSubService,
+				 proEconCurveFittMonthMainService,
+				 proEconCurveFittMonthSubService,
+				 proEconCurveFittYearMainService,
+				 proEconCurveFittYearSubService));
+
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		}finally {
+			latch.countDown();
+		}
+	}
+}

Diferenças do arquivo suprimidas por serem muito extensas
+ 1194 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/task/thread/EquipmentInfo4ThreadPool.java


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

@@ -0,0 +1,80 @@
+package com.gyee.generation.task.thread;
+
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDay5;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+public class EquipmentInfo5Thread implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private ProBasicEquipment wt;
+	private   Map<String, ProEconEquipmentInfoDay5> rates;
+
+	private Map<Double, Double> stateDescription1;
+	private Map<Double, Double> stateDescription2;
+	private Date recordDate;
+	private Date endDate;
+
+	private Date beginDate;
+
+	private IEdosUtil edosUtil;
+
+	private CountDownLatch latch;
+
+	public EquipmentInfo5Thread(Executor executor, ProBasicEquipment wt, Map<String, ProEconEquipmentInfoDay5> rates,
+								Date endDate, Date beginDate,
+								IEdosUtil edosUtil, Map<Double, Double> stateDescription1,
+								Map<Double, Double> stateDescription2,
+                                CountDownLatch latch	) {
+
+		this.executor = executor;
+		this.wt = wt;
+		this.rates = rates;
+		this.endDate = endDate;
+		this.beginDate = beginDate;
+		this.edosUtil = edosUtil;
+		this.stateDescription1 = stateDescription1;
+		this.stateDescription2 = stateDescription2;
+		this.latch = latch;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wt.getId();
+		logger.info("设备4计算服务创建任务并提交到线程池中:" + wt.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new EquipmentInfo5ThreadPool(task,
+				 wt,  rates,
+				   endDate,  beginDate,
+				 edosUtil, stateDescription1,
+				 stateDescription2));
+
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get();
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		}finally {
+			latch.countDown();
+		}
+	}
+}

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

@@ -0,0 +1,314 @@
+package com.gyee.generation.task.thread;
+
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
+import com.gyee.generation.model.auto.ProEconEquipmentInfoDay5;
+import com.gyee.generation.util.DateUtils;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+public class EquipmentInfo5ThreadPool implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+	private static final long serialVersionUID = 0;
+
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private ProBasicEquipment wt;
+	private   Map<String, ProEconEquipmentInfoDay5> rates;
+
+	private Map<Double, Double> stateDescription1;
+	private Map<Double, Double> stateDescription2;
+	private Date recordDate;
+	private Date endDate;
+
+	private Date beginDate;
+
+	private IEdosUtil edosUtil;
+
+
+
+	public EquipmentInfo5ThreadPool(Object tasks, ProBasicEquipment wt, Map<String, ProEconEquipmentInfoDay5> rates,
+                                    Date endDate, Date beginDate,
+                                    IEdosUtil edosUtil, Map<Double, Double> stateDescription1,
+									Map<Double, Double> stateDescription2
+	) {
+
+		this.threadPoolTaskData = tasks;
+		this.wt = wt;
+		this.rates = rates;
+
+		this.endDate = endDate;
+		this.beginDate = beginDate;
+
+		this.edosUtil = edosUtil;
+		this.stateDescription1 = stateDescription1;
+		this.stateDescription2 = stateDescription2;
+
+	}
+
+	public synchronized String call() throws Exception {
+
+
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		try {
+			ProEconEquipmentInfoDay5 rate = rates.get(wt.getId());
+
+			List<PointData> speedDataList = null;
+			List<PointData> statusDataList = null;
+			if (CacheContext.wtpAimap.containsKey(wt.getId())) {
+				Map<String, ProBasicEquipmentPoint> wtpmap = CacheContext.wtpAimap.get(wt.getId());
+				if (wtpmap.containsKey(ContantXk.CJ_SSFS)) {
+					ProBasicEquipmentPoint point = wtpmap.get(ContantXk.CJ_SSFS);
+					speedDataList = edosUtil.getHistoryDatasSnap(point.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000);
+				}
+				if (wtpmap.containsKey(ContantXk.MXZT)) {
+					ProBasicEquipmentPoint point = wtpmap.get(ContantXk.MXZT);
+					statusDataList = edosUtil.getHistoryDatasSnap(point.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000);
+				}
+
+			}
+
+
+
+			if (speedDataList != null && statusDataList != null && statusDataList.size() == speedDataList.size() && !speedDataList.isEmpty()) {
+
+				double laststatus = -1;
+				Date begin = new Date();
+				for (int i = 0; i < speedDataList.size(); i++) {
+
+					double status = statusDataList.get(i).getPointValueInDouble();
+					double speed = speedDataList.get(i).getPointValueInDouble();
+					if (i == 0) {
+						begin = new Date(speedDataList.get(i).getPointTime());
+						laststatus = status;
+					}
+
+					if (speed <= 3.0) {
+						if (laststatus != status &&
+								(status == stateDescription1.get(3.0) || status == stateDescription2.get(3.0))) {
+
+							Date end = new Date(speedDataList.get(i).getPointTime());
+							double zhcs = DateUtils.hoursDiff2(begin, end);
+							if (zhcs < 0.25)//5分钟
+							{
+
+								double temp = rate.getTimerate1();
+								temp = temp + 1;
+								rate.setTimerate1(temp);
+
+								temp = rate.getTimerate2();
+								temp = temp + 1;
+								rate.setTimerate2(temp);
+
+								temp = rate.getTimerate3();
+								temp = temp + 1;
+								rate.setTimerate3(temp);
+
+								temp = rate.getTimerate4();
+								temp = temp + 1;
+								rate.setTimerate4(temp);
+
+							} else if (zhcs < 0.33)//10分钟
+							{
+								double temp = rate.getTimerate2();
+								temp = temp + 1;
+								rate.setTimerate2(temp);
+
+								temp = rate.getTimerate3();
+								temp = temp + 1;
+								rate.setTimerate3(temp);
+
+								temp = rate.getTimerate4();
+								temp = temp + 1;
+								rate.setTimerate4(temp);
+							} else if (zhcs < 0.42)//15分钟
+							{
+								double temp = rate.getTimerate3();
+								temp = temp + 1;
+								rate.setTimerate3(temp);
+
+								temp = rate.getTimerate4();
+								temp = temp + 1;
+								rate.setTimerate4(temp);
+							} else if (zhcs < 0.5)//20分钟
+							{
+								double temp = rate.getTimerate4();
+								temp = temp + 1;
+								rate.setTimerate4(temp);
+							}
+
+
+							double temp = rate.getTimerate13();
+							temp = temp + 1;
+							rate.setTimerate13(temp);
+						}
+
+						laststatus = status;
+						begin = new Date(speedDataList.get(i).getPointTime());
+					} else if (speed <= 4.0 && speed > 3.0) {
+						if (laststatus != status &&
+								(status == stateDescription1.get(3.5) || status == stateDescription2.get(3.5))) {
+
+							Date end = new Date(speedDataList.get(i).getPointTime());
+							double zhcs = DateUtils.hoursDiff2(begin, end);
+							if (zhcs < 0.25)//5分钟
+							{
+
+								double temp = rate.getTimerate5();
+								temp = temp + 1;
+								rate.setTimerate5(temp);
+
+								temp = rate.getTimerate6();
+								temp = temp + 1;
+								rate.setTimerate6(temp);
+
+								temp = rate.getTimerate7();
+								temp = temp + 1;
+								rate.setTimerate7(temp);
+
+								temp = rate.getTimerate8();
+								temp = temp + 1;
+								rate.setTimerate8(temp);
+							} else if (zhcs < 0.33)//10分钟
+							{
+
+								double temp = rate.getTimerate6();
+								temp = temp + 1;
+								rate.setTimerate6(temp);
+
+								temp = rate.getTimerate7();
+								temp = temp + 1;
+								rate.setTimerate7(temp);
+
+								temp = rate.getTimerate8();
+								temp = temp + 1;
+								rate.setTimerate8(temp);
+							} else if (zhcs < 0.42)//15分钟
+							{
+								double temp = rate.getTimerate7();
+								temp = temp + 1;
+								rate.setTimerate7(temp);
+
+								temp = rate.getTimerate8();
+								temp = temp + 1;
+								rate.setTimerate8(temp);
+
+							} else if (zhcs < 0.5)//20分钟
+							{
+								double temp = rate.getTimerate8();
+								temp = temp + 1;
+								rate.setTimerate8(temp);
+							}
+
+							//}
+							double temp = rate.getTimerate14();
+							temp = temp + 1;
+							rate.setTimerate14(temp);
+
+						}
+
+						laststatus = status;
+						begin = new Date(speedDataList.get(i).getPointTime());
+					} else {
+						if (laststatus != status &&
+								(status == stateDescription1.get(4.0) || status == stateDescription2.get(4.0))) {
+
+							Date end = new Date(speedDataList.get(i).getPointTime());
+							double zhcs = DateUtils.hoursDiff2(begin, end);
+							if (zhcs < 0.25)//5分钟
+							{
+
+								double temp = rate.getTimerate9();
+								temp = temp + 1;
+								rate.setTimerate9(temp);
+
+								temp = rate.getTimerate10();
+								temp = temp + 1;
+								rate.setTimerate10(temp);
+
+								temp = rate.getTimerate11();
+								temp = temp + 1;
+								rate.setTimerate11(temp);
+
+								temp = rate.getTimerate12();
+								temp = temp + 1;
+								rate.setTimerate12(temp);
+							} else if (zhcs < 0.33)//10分钟
+							{
+
+								double temp = rate.getTimerate10();
+								temp = temp + 1;
+								rate.setTimerate10(temp);
+
+								temp = rate.getTimerate11();
+								temp = temp + 1;
+								rate.setTimerate11(temp);
+
+								temp = rate.getTimerate12();
+								temp = temp + 1;
+								rate.setTimerate12(temp);
+							} else if (zhcs < 0.42)//15分钟
+							{
+
+								double temp = rate.getTimerate11();
+								temp = temp + 1;
+								rate.setTimerate11(temp);
+
+								temp = rate.getTimerate12();
+								temp = temp + 1;
+								rate.setTimerate12(temp);
+							} else if (zhcs < 0.5)//20分钟
+							{
+								double temp = rate.getTimerate12();
+								temp = temp + 1;
+								rate.setTimerate12(temp);
+							}
+
+							double temp = rate.getTimerate15();
+							temp = temp + 1;
+							rate.setTimerate15(temp);
+
+
+							laststatus = status;
+							begin = new Date(speedDataList.get(i).getPointTime());
+						}
+					}
+				}
+
+			}
+
+		} catch (Exception e) {
+
+			e.printStackTrace();
+		}
+
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+
+
+}
+

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

@@ -1,4 +1,4 @@
-package com.gyee.generation.task;
+package com.gyee.generation.task.thread;
 
 import com.gyee.generation.model.auto.ProEconEquipmentInfoDay1;
 import com.gyee.generation.model.auto.ProEconWindturbineGoodness;

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

@@ -1,4 +1,4 @@
-package com.gyee.generation.task;
+package com.gyee.generation.task.thread;
 
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.ProBasicEquipment;

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

@@ -1,4 +1,4 @@
-package com.gyee.generation.task;
+package com.gyee.generation.task.thread;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;

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

@@ -1,4 +1,4 @@
-package com.gyee.generation.task;
+package com.gyee.generation.task.thread;
 
 import com.gyee.generation.model.auto.ProBasicEquipment;
 import com.gyee.generation.service.auto.IProEconInputOrOutputSpeedService;

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

@@ -1,4 +1,4 @@
-package com.gyee.generation.task;
+package com.gyee.generation.task.thread;
 
 import com.gyee.common.model.PointData;
 import com.gyee.generation.model.auto.*;

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

@@ -1,4 +1,4 @@
-package com.gyee.generation.task;
+package com.gyee.generation.task.thread;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;

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

@@ -1,4 +1,4 @@
-package com.gyee.generation.task;
+package com.gyee.generation.task.thread;
 
 import com.gyee.common.model.PointData;
 import com.gyee.generation.model.auto.ProEconInterruption;

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

@@ -1,4 +1,4 @@
-package com.gyee.generation.task;
+package com.gyee.generation.task.thread;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;

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

@@ -88,9 +88,9 @@ logging:
     com.example: debug
 #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
-  url: http://10.81.3.152:8098/ts
-  #url: http://124.70.75.91: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

+ 2 - 2
realtime/generationXK-service/src/main/resources/application-xk.yml

@@ -87,8 +87,8 @@ logging:
     com.example: debug
 #db url
 db:
-  #url: http://127.0.0.1:8011/ts
-  url: http://192.168.11.250:8011/ts
+  url1: http://127.0.0.1:8011/ts
+  url2: http://192.168.11.250:8011/ts
   #url: http://124.70.75.91:8011/ts
 #参与计算的场站
 #runWindpowerstation: SD_GDDL_WHWD_FDC_STA,SD_GDDL_WHXQ_FDC_STA,SD_GDDL_RZLX_FDC_STA,SD_GDDL_QDJN_FDC_STA,SD_SXNY_FXFC_FDC_STA,SD_SXNY_LXLN_FDC_STA,SD_SXNY_LQJS_FDC_STA,SD_SXNY_ZYFS_FDC_STA,SD_LYDL_BH2_FDC_STA,SD_GDDL_RZWL_FDC_STA,SD_SXNY_PLHS_FDC_STA,SD_SXNY_ZYXD_FDC_STA,SD_GDDL_DZXJ_FDC_STA,SD_GDDL_XTTA_FDC_STA,SD_GDDL_WFZC_FDC_STA,SD_SXNY_JNSS_FDC_STA,SD_SXNY_WFBH_FDC_STA,SD_LYDL_CG_FDC_STA,SD_LYDL_FJ_FDC_STA,SD_LYDL_YS_FDC_STA,SD_SXNY_JNCQ_FDC_STA,SD_LYDL_BH1_FDC_STA,SD_GHTZ_HZJ_GDC_STA

+ 18 - 15
realtime/generationXK-service/src/test/java/com/gyee/generation/HealthTest.java

@@ -1,5 +1,8 @@
 package com.gyee.generation;
 
+import com.gyee.generation.service.WindturbineGoodnessService;
+import com.gyee.generation.util.DateUtils;
+import com.gyee.generation.util.SpringUtils;
 import org.springframework.boot.SpringApplication;
 
 import java.util.Calendar;
@@ -10,15 +13,15 @@ public class HealthTest {
 
     public static void main(String[] args) throws Exception {
         SpringApplication.run(GenerationMain.class, args);
-
+        Calendar c = Calendar.getInstance();
         Date begin=null;
         Date end=null;
 //        CacheService cacheService= SpringUtils.getBean("cacheService");
 //        cacheService.initRedisCache();
 //
 //
-        Calendar c = Calendar.getInstance();
-        //
+
+//        //
 //        System.out.println("故障转换率记录调度程序执行开始!。。。。。。");
 //        TimelinessRateService timelinessRateService = SpringUtils.getBean("timelinessRateService");
 //        timelinessRateService.failRate(c.getTime());
@@ -164,24 +167,24 @@ public class HealthTest {
 //
 //        equipmentInfo5Service.calEquipmentInfoDay(c.getTime());
 //
-//        equipmentInfoDayTopService.calEquipmentInfoDayTop(new Date());
-//        equipmentInfoDayTopService.calEquipmentInfoMonthTop(new Date());
-//        equipmentInfoDayTopService.calEquipmentInfoYearTop(new Date());
+//        equipmentInfoDayTopService.calEquipmentInfoDayTop(c.getTime());
+//        equipmentInfoDayTopService.calEquipmentInfoMonthTop(c.getTime());
+//        equipmentInfoDayTopService.calEquipmentInfoYearTop(c.getTime());
 //
-//        wtAlysisDayService.calEquipmentInfoDay(new Date());
+//        wtAlysisDayService.calEquipmentInfoDay(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("功率一致性系数和拟合优度调度程序执行结束!。。。。。。");
+        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();