Parcourir la source

修正计算服务

shilin il y a 1 an
Parent
commit
c3c85d4fe6
16 fichiers modifiés avec 777 ajouts et 278 suppressions
  1. 2 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/config/XxlJobConfig.java
  2. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo1Service.java
  3. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java
  4. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo3Service.java
  5. 1 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java
  6. 15 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo5Service.java
  7. 33 7
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java
  8. 31 6
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo2Service.java
  9. 34 6
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo3Service.java
  10. 45 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo4Service.java
  11. 36 10
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo5Service.java
  12. 114 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo5UpdateService.java
  13. 416 219
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/CycleCalculationRebuildService.java
  14. 14 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/CycleCalculationService.java
  15. 22 4
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/SaticSchedulePgTask.java
  16. 11 11
      realtime/generationXK-service/src/test/java/com/gyee/generation/RealTest.java

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

@@ -20,7 +20,7 @@ import org.springframework.core.env.Environment;
 @Configuration
 //@PropertySource("classpath:xxl-job-executor.properties")
 //@PropertySource("classpath:xxl-job-executor2.properties")
-@PropertySource("classpath:xxl-job-executor3.properties")
+//@PropertySource("classpath:xxl-job-executor3.properties")
 //@PropertySource("classpath:xxl-job-executor4.properties")
 //@PropertySource("classpath:xxl-job-executor5.properties")
 //@PropertySource("classpath:xxl-job-executorWPLY.properties")
@@ -30,7 +30,7 @@ import org.springframework.core.env.Environment;
 //@PropertySource("classpath:xxl-job-accuracy.properties")
 //@PropertySource("classpath:xxl-job-7001.properties")
 //@PropertySource("classpath:xxl-job-7002.properties")
-//@PropertySource("classpath:xxl-job-7003.properties")
+@PropertySource("classpath:xxl-job-7003.properties")
 //@PropertySource("classpath:xxl-job-executorGF000.properties")
 //@PropertySource("classpath:xxl-job-executorGF001.properties")
 //@PropertySource("classpath:xxl-job-executorGF002.properties")

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

@@ -43,7 +43,7 @@ public class EquipmentInfo1Service {
         Calendar c=Calendar.getInstance();
         c.setTime(recordDate);
 
-        if(c.get(Calendar.MINUTE)==0)
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0)
         {
             c.add(Calendar.DAY_OF_MONTH,-1);
         }

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

@@ -41,7 +41,7 @@ public class EquipmentInfo2Service {
     public void calEquipmentInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
-        if (c.get(Calendar.MINUTE) == 0) {
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
             c.add(Calendar.DAY_OF_MONTH, -1);
         }
 

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

@@ -40,7 +40,7 @@ public class EquipmentInfo3Service {
     public void calEquipmentInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
         c.setTime(recordDate);
-        if(c.get(Calendar.MINUTE)==0)
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0)
         {
             c.add(Calendar.DAY_OF_MONTH,-1);
         }

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

@@ -72,8 +72,7 @@ public class EquipmentInfo4Service {
     public void calEquipmentInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
-        if(c.get(Calendar.MINUTE)==0)
-        {
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
             c.add(Calendar.DAY_OF_MONTH,-1);
         }
 

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

@@ -44,11 +44,23 @@ public class EquipmentInfo5Service {
      * 复位及时率
      */
     public void resetRate(Date currentDate) throws Exception {
-        //调度时间是第二天,currentDate 是第一天,
-        Date endDate = DateUtils.addDays(currentDate, 1);
+
+        Calendar c = Calendar.getInstance();
+        c.setTime(currentDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
+        c.set(Calendar.HOUR_OF_DAY, 23);
+        c.set(Calendar.MINUTE, 59);
+        c.set(Calendar.SECOND, 59);
+        Date endDate = c.getTime();
+
+        Date begin = DateUtils.truncate(c.getTime());
+
 
         QueryWrapper<ProEconShutdownEvent2> queryWrapper = new QueryWrapper<>();
-        queryWrapper.ge("stop_Time",currentDate).le("stop_Time",endDate)
+        queryWrapper.ge("stop_Time",begin).le("stop_Time",endDate)
                 .isNotNull("stop_Type_Id").ne("stop_Type_Id","wh").isNotNull("stop_Hours");
         List<ProEconShutdownEvent2> shutdownevents = proEconShutdownEvent2Service.list(queryWrapper);
 

+ 33 - 7
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java

@@ -35,6 +35,15 @@ public class WindPowerInfo1Service {
      */
     public void calRegionInfoDay(Date recordDate) throws Exception {
 
+        Calendar c = Calendar.getInstance();
+        c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
+
+
+        recordDate = DateUtils.truncate(c.getTime());
         QueryWrapper<ProEconPowerstationInfoDay1> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
         List<ProEconPowerstationInfoDay1> wpinfodayls = proEconPowerstationInfoDay1Service.list(queryWrapper);
@@ -168,6 +177,16 @@ public class WindPowerInfo1Service {
      * 计算公司日信息
      */
     public void calCompanyInfoDay(Date recordDate) {
+
+        Calendar c = Calendar.getInstance();
+        c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
+
+
+        recordDate = DateUtils.truncate(c.getTime());
         QueryWrapper<ProEconPowerstationInfoDay1> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.wp.getValue());
         List<ProEconPowerstationInfoDay1> wpinfodayls = proEconPowerstationInfoDay1Service.list(queryWrapper);
@@ -555,10 +574,13 @@ public class WindPowerInfo1Service {
     public void calWindpowerInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
 
-        Date end = c.getTime();
 
-        Date begin = DateUtils.truncate(c.getTime());
+        recordDate = DateUtils.truncate(c.getTime());
 
 
         Map<String,List<ProEconEquipmentInfoDay1>> pep1map=new HashMap<>();
@@ -659,12 +681,13 @@ public class WindPowerInfo1Service {
     public void calProjectInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
 
-        Date end = c.getTime();
-
-        Date begin = DateUtils.truncate(c.getTime());
 
 
+        recordDate = DateUtils.truncate(c.getTime());
 
 
         Map<String,List<ProEconEquipmentInfoDay1>> pep1map=new HashMap<>();
@@ -770,10 +793,13 @@ public class WindPowerInfo1Service {
     public void calLineInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
 
-        Date end = c.getTime();
 
-        Date begin = DateUtils.truncate(c.getTime());
+        recordDate = DateUtils.truncate(c.getTime());
 
 
 

+ 31 - 6
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo2Service.java

@@ -34,7 +34,15 @@ public class WindPowerInfo2Service {
      * 计算区域日信息
      */
     public void calRegionInfoDay(Date recordDate) {
+        Calendar c = Calendar.getInstance();
+        c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
 
+
+        recordDate = DateUtils.truncate(c.getTime());
         QueryWrapper<ProEconPowerstationInfoDay2> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
         List<ProEconPowerstationInfoDay2> wpinfodayls = proEconPowerstationInfoDay2Service.list(queryWrapper);
@@ -164,6 +172,15 @@ public class WindPowerInfo2Service {
      * 计算公司日信息
      */
     public void calCompanyInfoDay(Date recordDate) {
+        Calendar c = Calendar.getInstance();
+        c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
+
+
+        recordDate = DateUtils.truncate(c.getTime());
         QueryWrapper<ProEconPowerstationInfoDay2> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.wp.getValue());
         List<ProEconPowerstationInfoDay2> wpinfodayls = proEconPowerstationInfoDay2Service.list(queryWrapper);
@@ -391,11 +408,13 @@ public class WindPowerInfo2Service {
     public void calWindpowerInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
 
-        Date end = c.getTime();
 
-        Date begin = DateUtils.truncate(c.getTime());
 
+        recordDate = DateUtils.truncate(c.getTime());
 
 
 
@@ -514,10 +533,13 @@ public class WindPowerInfo2Service {
     public void calProjectInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
 
-        Date end = c.getTime();
 
-        Date begin = DateUtils.truncate(c.getTime());
+        recordDate = DateUtils.truncate(c.getTime());
 
 
         Map<String,List<ProEconEquipmentInfoDay2>> pep2map=new HashMap<>();
@@ -637,10 +659,13 @@ public class WindPowerInfo2Service {
     public void calLineInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
 
-        Date end = c.getTime();
 
-        Date begin = DateUtils.truncate(c.getTime());
+        recordDate = DateUtils.truncate(c.getTime());
 
         Map<String,List<ProEconEquipmentInfoDay2>> pep2map=new HashMap<>();
         QueryWrapper<ProEconEquipmentInfoDay2> queryWrapper1 = new QueryWrapper<>();

+ 34 - 6
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo3Service.java

@@ -35,6 +35,16 @@ public class WindPowerInfo3Service {
      */
     public void calRegionInfoDay(Date recordDate) {
 
+        Calendar c = Calendar.getInstance();
+        c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
+
+
+        recordDate = DateUtils.truncate(c.getTime());
+
         QueryWrapper<ProEconPowerstationInfoDay3> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
         List<ProEconPowerstationInfoDay3> wpinfodayls = IProEconPoproEconPowerstationInfoDay3Service.list(queryWrapper);
@@ -164,6 +174,15 @@ public class WindPowerInfo3Service {
      * 计算公司日信息
      */
     public void calCompanyInfoDay(Date recordDate) {
+        Calendar c = Calendar.getInstance();
+        c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
+
+
+        recordDate = DateUtils.truncate(c.getTime());
         QueryWrapper<ProEconPowerstationInfoDay3> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.wp.getValue());
         List<ProEconPowerstationInfoDay3> wpinfodayls = IProEconPoproEconPowerstationInfoDay3Service.list(queryWrapper);
@@ -391,10 +410,13 @@ public class WindPowerInfo3Service {
     public void calWindpowerInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
 
-        Date end = c.getTime();
 
-        Date begin = DateUtils.truncate(c.getTime());
+        recordDate = DateUtils.truncate(c.getTime());
 
 
 
@@ -514,10 +536,13 @@ public class WindPowerInfo3Service {
     public void calProjectInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
 
-        Date end = c.getTime();
 
-        Date begin = DateUtils.truncate(c.getTime());
+        recordDate = DateUtils.truncate(c.getTime());
 
 
         Map<String,List<ProEconEquipmentInfoDay3>> pep2map=new HashMap<>();
@@ -637,10 +662,13 @@ public class WindPowerInfo3Service {
     public void calLineInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
 
-        Date end = c.getTime();
 
-        Date begin = DateUtils.truncate(c.getTime());
+        recordDate = DateUtils.truncate(c.getTime());
 
         Map<String,List<ProEconEquipmentInfoDay3>> pep2map=new HashMap<>();
         QueryWrapper<ProEconEquipmentInfoDay3> queryWrapper1 = new QueryWrapper<>();

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

@@ -43,7 +43,15 @@ public class WindPowerInfo4Service {
      * 计算区域日信息
      */
     public void calRegionInfoDay(Date recordDate) {
+        Calendar c = Calendar.getInstance();
+        c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
 
+
+
+        recordDate = DateUtils.truncate(c.getTime());
         QueryWrapper<ProEconPowerstationInfoDay4> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("record_date", DateUtils.truncate(recordDate)).eq("location", Location.cp.getValue());
         List<ProEconPowerstationInfoDay4> wpinfodayls = proEconPowerstationInfoDay4Service.list(queryWrapper);
@@ -175,6 +183,15 @@ public class WindPowerInfo4Service {
      * 计算公司日信息
      */
     public void calCompanyInfoDay(Date recordDate) {
+        Calendar c = Calendar.getInstance();
+        c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
+
+
+        recordDate = DateUtils.truncate(c.getTime());
 
         QueryWrapper<ProEconPowerstationInfoDay4> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("record_date", DateUtils.truncate(recordDate)).eq("location", Location.wp.getValue());
@@ -418,14 +435,20 @@ public class WindPowerInfo4Service {
     public void calWindpowerInfoDay(Date recordDate) {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
 
+        c.set(Calendar.HOUR_OF_DAY, 23);
+        c.set(Calendar.MINUTE, 59);
+        c.set(Calendar.SECOND, 59);
         Date end = c.getTime();
 
         Date begin = DateUtils.truncate(c.getTime());
 
 
-//        List<ProEconPowerstationInfoDay4> wpinfodayls = new ArrayList<>();
 
+        recordDate = DateUtils.truncate(c.getTime());
 
         List<String> wpls=new ArrayList<>();
         List<ProEconPowerstationInfoDay4> dayls = new ArrayList<>();
@@ -553,11 +576,22 @@ public class WindPowerInfo4Service {
     public void calProjectInfoDay(Date recordDate) {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
 
+        c.set(Calendar.HOUR_OF_DAY, 23);
+        c.set(Calendar.MINUTE, 59);
+        c.set(Calendar.SECOND, 59);
         Date end = c.getTime();
 
         Date begin = DateUtils.truncate(c.getTime());
 
+
+
+        recordDate = DateUtils.truncate(c.getTime());
+
+
         List<String > pjls=new ArrayList<>();
         List<ProEconPowerstationInfoDay4> dayls = new ArrayList<>();
         for (ProBasicProject pj : CacheContext.pjls) {
@@ -687,11 +721,21 @@ public class WindPowerInfo4Service {
     public void calLineInfoDay(Date recordDate) {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
 
+        c.set(Calendar.HOUR_OF_DAY, 23);
+        c.set(Calendar.MINUTE, 59);
+        c.set(Calendar.SECOND, 59);
         Date end = c.getTime();
 
         Date begin = DateUtils.truncate(c.getTime());
 
+
+
+        recordDate = DateUtils.truncate(c.getTime());
+
         List<String > lnls=new ArrayList<>();
         List<ProEconPowerstationInfoDay4> dayls = new ArrayList<>();
         for (ProBasicLine ln : CacheContext.lnls) {

+ 36 - 10
realtime/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo5Service.java

@@ -35,6 +35,16 @@ public class WindPowerInfo5Service {
      */
     public void calRegionInfoDay(Date recordDate) {
 
+        Calendar c = Calendar.getInstance();
+        c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
+
+        recordDate = DateUtils.truncate(c.getTime());
+
+
         QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.cp.getValue());
         List<ProEconPowerstationInfoDay5> wpinfodayls = proEconPowerstationInfoDay5Service.list(queryWrapper);
@@ -162,6 +172,17 @@ public class WindPowerInfo5Service {
      */
     public void calCompanyInfoDay(Date recordDate) {
 
+        Calendar c = Calendar.getInstance();
+        c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
+
+
+        recordDate = DateUtils.truncate(c.getTime());
+
+
         QueryWrapper<ProEconPowerstationInfoDay5> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("record_date",DateUtils.truncate(recordDate)).eq("location",Location.wp.getValue());
         List<ProEconPowerstationInfoDay5> wpinfodayls = proEconPowerstationInfoDay5Service.list(queryWrapper);
@@ -343,13 +364,14 @@ public class WindPowerInfo5Service {
     public void calWindpowerInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
 
-//        Date end=c.getTime();
-//
-//        Date begin= DateUtils.truncate(c.getTime());
 
+        recordDate = DateUtils.truncate(c.getTime());
 
-//        List<ProEconPowerstationInfoDay5> wpinfodayls=new ArrayList<>();
 
 
         List<String> wpls=new ArrayList<>();
@@ -440,11 +462,13 @@ public class WindPowerInfo5Service {
     public void calProjectInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
 
-//        Date end=c.getTime();
-//
-//        Date begin= DateUtils.truncate(c.getTime());
 
+        recordDate = DateUtils.truncate(c.getTime());
         List<String > pjls=new ArrayList<>();
         List<ProEconPowerstationInfoDay5> dayls=new ArrayList<>();
         for (ProBasicProject pj : CacheContext.pjls) {
@@ -536,11 +560,13 @@ public class WindPowerInfo5Service {
     public void calLineInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0){
+            c.add(Calendar.DAY_OF_MONTH,-1);
+        }
+
 
-//        Date end=c.getTime();
-//
-//        Date begin= DateUtils.truncate(c.getTime());
 
+        recordDate = DateUtils.truncate(c.getTime());
         List<String > lnls=new ArrayList<>();
         List<ProEconPowerstationInfoDay5> dayls=new ArrayList<>();
         for (ProBasicLine ln : CacheContext.lnls) {

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

@@ -128,7 +128,7 @@ public class WindPowerInfo5UpdateService {
                     {
                         ProEconPowerstationInfoDay5 day5=pepid1ls.get(0);
                         c = Calendar.getInstance();
-                        List<PointData>  list=extracted(c.getTime(), pointmap, day5);
+                        List<PointData>  list=extracted2(c.getTime(), pointmap, day5);
                         wtResultList.addAll(list);
 
                     }
@@ -187,7 +187,7 @@ public class WindPowerInfo5UpdateService {
                         {
                             ProEconPowerstationInfoDay5 day5=pepid1ls.get(0);
                             c = Calendar.getInstance();
-                            List<PointData>  list=extracted(c.getTime(), pointmap, day5);
+                            List<PointData>  list=extracted2(c.getTime(), pointmap, day5);
                             wtResultList.addAll(list);
                         }
 
@@ -482,7 +482,119 @@ public class WindPowerInfo5UpdateService {
 
 }
 
+    private List<PointData> extracted2(Date recordDate, Map<String, ProBasicPowerstationPoint> pointmap,ProEconPowerstationInfoDay5 lastday5 ) throws Exception {
+        //*******************************************日信息统计*********************************************************/
+
+        double rfdlsyz = null!=lastday5.getRfdldb()?lastday5.getRfdldb():0.0;
+        double rswdlsyz = null!=lastday5.getRswdldb()?lastday5.getRswdldb():0.0;
+        double rgwgwdlsyz =  null!=lastday5.getRgwgwdldb()?lastday5.getRgwgwdldb():0.0;
+        double rnwgwdlsyz = null!=lastday5.getRnwgwdldb()?lastday5.getRnwgwdldb():0.0;
+        double rcydlsyz = 0.0;
+
+
+
+        List<PointData> wtResultList = new ArrayList<>();
+
+
+
+
+
+//*******************************************月信息统计*********************************************************/
+
+        double yfdlsyz =  null!=lastday5.getYfdldb()?lastday5.getYfdldb():0.0;
+        double yswdlsyz =  null!=lastday5.getYswdldb()?lastday5.getYswdldb():0.0;
+        double ygwgwdlsyz = null!=lastday5.getYgwgwdldb()?lastday5.getYgwgwdldb():0.0;
+        double ynwgwdlsyz = null!=lastday5.getYnwgwdldb()?lastday5.getYnwgwdldb():0.0;
+        double ycydlsyz = 0.0;
+
+
+
+
+        if (pointmap.containsKey(ContantXk.YFDLSYZ) && StringUtils.notEmp( lastday5.getYfdldb()) && lastday5.getYfdldb()>0) {
+            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.YFDLSYZ);
+            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
+        }
+
+        if (pointmap.containsKey(ContantXk.YFDL) && StringUtils.notEmp( lastday5.getYfdldb()) && lastday5.getYfdldb()>0) {
+            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.YFDL);
+            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
+        }
+        if (pointmap.containsKey(ContantXk.YSWDL)&& StringUtils.notEmp( lastday5.getYswdldb()) && lastday5.getYswdldb()>0) {
+            ProBasicPowerstationPoint rswdlPoint = pointmap.get(ContantXk.YSWDL);
+            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYswdldb(), rswdlPoint.getNemCode(), rswdlPoint.getName()));
+        }
+
+        if (pointmap.containsKey(ContantXk.YGWGWDL)&& StringUtils.notEmp( lastday5.getYgwgwdldb()) && lastday5.getYgwgwdldb()>0) {
+            ProBasicPowerstationPoint rgwdlpoint = pointmap.get(ContantXk.YGWGWDL);
+            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYgwgwdldb(), rgwdlpoint.getNemCode(), rgwdlpoint.getName()));
+        }
+
+        if (pointmap.containsKey(ContantXk.YNWGWDL)&& StringUtils.notEmp( lastday5.getYnwgwdldb()) && lastday5.getYnwgwdldb()>0) {
+            ProBasicPowerstationPoint rnwgwdlpoint = pointmap.get(ContantXk.YNWGWDL);
+            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getYnwgwdldb(), rnwgwdlpoint.getNemCode(), rnwgwdlpoint.getName()));
+        }
+
+
 
+        if (pointmap.containsKey(ContantXk.YCYDL)&& StringUtils.notEmp( ycydlsyz) && ycydlsyz>0) {
+            ProBasicPowerstationPoint rcydlpoint = pointmap.get(ContantXk.YCYDL);
+            ycydlsyz=StringUtils.round(yfdlsyz - yswdlsyz + ygwgwdlsyz + ynwgwdlsyz, 2);
+            wtResultList.add(PointUtil.createPointData(recordDate, ycydlsyz, rcydlpoint.getNemCode(), rcydlpoint.getName()));
+
+        }
+
+
+
+
+//*******************************************月信息统计*********************************************************/
+
+//*******************************************年信息统计*********************************************************/
+        double nfdlsyz = null!=lastday5.getYfdldb()?lastday5.getNfdldb():0.0;
+        double nswdlsyz = null!=lastday5.getYfdldb()?lastday5.getNswdldb():0.0;
+        double ngwgwdlsyz =null!=lastday5.getYfdldb()?lastday5.getNgwgwdldb():0.0;
+        double nnwgwdlsyz = null!=lastday5.getYfdldb()?lastday5.getNnwgwdldb():0.0;
+        double ncydlsyz = 0.0;
+
+
+
+
+        if (pointmap.containsKey(ContantXk.NFDLSYZ)&& StringUtils.notEmp( lastday5.getNfdldb()) && lastday5.getNfdldb()>0) {
+            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.NFDLSYZ);
+            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
+        }
+
+        if (pointmap.containsKey(ContantXk.NFDL) && StringUtils.notEmp( lastday5.getNfdldb()) && lastday5.getNfdldb()>0) {
+            ProBasicPowerstationPoint rfdlPoint = pointmap.get(ContantXk.NFDL);
+            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNfdldb(), rfdlPoint.getNemCode(), rfdlPoint.getName()));
+        }
+        if (pointmap.containsKey(ContantXk.NSWDL) && StringUtils.notEmp( lastday5.getNswdldb()) && lastday5.getNswdldb()>0) {
+            ProBasicPowerstationPoint rswdlPoint = pointmap.get(ContantXk.NSWDL);
+            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNswdldb(), rswdlPoint.getNemCode(), rswdlPoint.getName()));
+        }
+
+        if (pointmap.containsKey(ContantXk.NGWGWDL) && StringUtils.notEmp( lastday5.getNgwgwdldb()) && lastday5.getNgwgwdldb()>0) {
+            ProBasicPowerstationPoint rgwdlpoint = pointmap.get(ContantXk.NGWGWDL);
+            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNgwgwdldb(), rgwdlpoint.getNemCode(), rgwdlpoint.getName()));
+        }
+
+        if (pointmap.containsKey(ContantXk.NNWGWDL) && StringUtils.notEmp( lastday5.getNnwgwdldb()) && lastday5.getNnwgwdldb()>0) {
+            ProBasicPowerstationPoint rnwgwdlpoint = pointmap.get(ContantXk.NNWGWDL);
+            wtResultList.add(PointUtil.createPointData(recordDate, lastday5.getNnwgwdldb(), rnwgwdlpoint.getNemCode(), rnwgwdlpoint.getName()));
+        }
+
+
+
+        if (pointmap.containsKey(ContantXk.NCYDL) && StringUtils.notEmp(ncydlsyz) && ncydlsyz>0) {
+            ProBasicPowerstationPoint ncydlpoint = pointmap.get(ContantXk.NCYDL);
+            ncydlsyz=StringUtils.round(nfdlsyz - nswdlsyz + ngwgwdlsyz + nnwgwdlsyz, 2);
+            wtResultList.add(PointUtil.createPointData(recordDate, ncydlsyz, ncydlpoint.getNemCode(), ncydlpoint.getName()));
+
+        }
+
+
+        return wtResultList;
+
+    }
 }
 
 

+ 416 - 219
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/CycleCalculationRebuildService.java

@@ -1,17 +1,21 @@
 package com.gyee.generation.service.realtimelibrary;
 
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.common.util.DateUtils;
 import com.gyee.common.util.DoubleUtils;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
-import com.gyee.generation.model.vo.ExcelVo;
-import com.gyee.generation.util.ExcelExport;
+import com.gyee.generation.model.vo.CurveType;
+import com.gyee.generation.model.vo.PowerVo;
 import com.gyee.generation.util.PointUtil;
 import com.gyee.generation.util.StringUtils;
+import com.gyee.generation.util.math.LightToTheoreticalPower;
 import com.gyee.generation.util.math.PowerIntegration;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
+import com.gyee.generation.util.redis.RedisService;
 import lombok.SneakyThrows;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -19,7 +23,6 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
@@ -38,6 +41,10 @@ public class CycleCalculationRebuildService {
     @Value("${notCalculatePower}")
     private String notCalculatePower;
 
+    @Resource
+    private RedisService redisService;
+    @Resource
+    private LightToTheoreticalPower lightToTheoreticalPower;
     @SneakyThrows
     public void saveCyle(Date currentDate) throws Exception {
 
@@ -45,25 +52,18 @@ public class CycleCalculationRebuildService {
         List<String> runWpids = Arrays.asList(notCalculatePower.split(","));
 
 
-        Calendar cal= Calendar.getInstance();
-
         int day = DateUtils.getDay(currentDate);
         int month = DateUtils.getMonth(currentDate);
-        Date date = currentDate;
+        Date date = DateUtils.addMinutes(currentDate, -5);
         Date date15age = DateUtils.addMinutes(currentDate, -15);
 
-
         Date samedayZero = DateUtils.truncate(currentDate);
         Date samedayZeroAdd15 = DateUtils.addMinutes(samedayZero, 15);
 
-        cal.setTime(currentDate);
-        cal.set(Calendar.DAY_OF_MONTH,1);
-
-        Date monthFirstZero=DateUtils.truncate(cal.getTime());
+        Date monthFirstZero = DateUtils.getMonthFirstZero();
         Date monthFirstZeroAdd15 = DateUtils.addMinutes(monthFirstZero, 15);
-        cal.set(Calendar.DAY_OF_YEAR,1);
-        cal.set(Calendar.MONTH,0);
-        Date yearFirstZero =DateUtils.truncate(cal.getTime());
+
+        Date yearFirstZero = DateUtils.getYearFirstZero();
         Date yearFirstZeroAdd15 = DateUtils.addMinutes(yearFirstZero, 15);
 
 
@@ -86,6 +86,10 @@ public class CycleCalculationRebuildService {
 
             Map<String, Double> dataMap = new HashMap<>();
             Map<String, ProBasicEquipmentPoint> equipmentPointMap = wtpAimap.get(wt.getId());
+
+            Map<String, ProBasicPowerstationPoint> wpPointMap = wppointmap.get(wt.getWindpowerstationId());
+
+            ProBasicPowerstationPoint gzdPoint=wpPointMap.get("GCGZQD");
             ProBasicEquipmentPoint ssfsPoint = equipmentPointMap.get(ContantXk.CJ_SSFS);
             ProBasicEquipmentPoint ssglPoint = equipmentPointMap.get(ContantXk.CJ_SSGL);
             ProBasicEquipmentPoint rssfdlPoint = equipmentPointMap.get(ContantXk.CJ_FDL);
@@ -188,6 +192,7 @@ public class CycleCalculationRebuildService {
                 double ssztmx = edosUtil.getRealData(mxztPoint).getPointValueInDouble();
 
                 if (ssztmx == 12 || ssztmx == 13) {
+                    
                     continue;
 
                 } else {
@@ -198,16 +203,38 @@ public class CycleCalculationRebuildService {
                     double yearfirstfdl = edosUtil.getSectionData(rssfdlPoint, yearFirstZero.getTime()).getPointValueInDouble() * rssfdlPoint.getCoefficient();
                     double date15agofdl = edosUtil.getSectionData(rssfdlPoint, date15age.getTime()).getPointValueInDouble() * rssfdlPoint.getCoefficient();
 
+
+                    Calendar c=Calendar.getInstance();
+                    c.setTime(currentDate);
+                    if(c.get(Calendar.DAY_OF_MONTH)!=1)
+                    {
+                        c.add(Calendar.DAY_OF_MONTH,-1);
+                        c.set(Calendar.HOUR_OF_DAY,23);
+                        c.set(Calendar.MINUTE,59);
+                    }
+
+                    double yssfdl = edosUtil.getSectionData(yfdlPoint, c.getTime().getTime()).getPointValueInDouble() ;
+                    double nssfdl = edosUtil.getSectionData(nfdlPoint, c.getTime().getTime()).getPointValueInDouble();
+
                     double rfdl = ssfdl - zerofdl;
 
                     if (rfdl <= 0 || rfdl > modelpower.get(wt.getModelId()) * 24 * 1.5) {
                         rfdl = 0;
-                        List<PointData> ssglList = edosUtil.getHistoryDatasSnap(ssglPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, null, 1800l);
+                        List<PointData> ssglList = edosUtil.getHistoryDatasSnap(ssglPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, null, 900l);
 
                         if (!ssglList.isEmpty()) {
                             Map<Integer, Double> map = new HashMap<>();
+                            int time=0;
                             for (int i = 0; i < ssglList.size(); i++) {
-                                map.put(i, ssglList.get(i).getPointValueInDouble());
+
+                                double modelvalue= modelpower.get(wt.getModelId())*1.5;
+
+                                if(ssglList.get(i).getPointValueInDouble() >0 && ssglList.get(i).getPointValueInDouble()<modelvalue)
+                                {
+                                    map.put(time, ssglList.get(i).getPointValueInDouble());
+                                    time++;
+                                }
+
                             }
                             PowerIntegration pi = new PowerIntegration();
 
@@ -216,36 +243,47 @@ public class CycleCalculationRebuildService {
 
                     }
 
-//                        if(wt.getWindpowerstationId().equals("SXJ_KGDL_TZ_GDC_STA"))
-//                        {
-//                            System.out.println("");
-//                        }
 
-                    double yfdl = ssfdl - monthfirstfdl;
+
+                    double yfdl = yssfdl - monthfirstfdl;
+                    if(c.get(Calendar.DAY_OF_MONTH)==1)
+                    {
+                        yfdl=rfdl;
+                    }else {
+                        yfdl=yfdl+rfdl;
+                    }
+
                     if (yfdl <= 0 || yfdl < rfdl || yfdl > modelpower.get(wt.getModelId()) * 24 * 31 * 1.5) {
                         yfdl = rfdl * day;
                     }
 
-                    double nfdl = ssfdl - yearfirstfdl;
+                    double nfdl = nssfdl - yearfirstfdl;
+
+
+                    if(c.get(Calendar.DAY_OF_MONTH)==1 && c.get(Calendar.MONTH)==0)
+                    {
+                        nfdl=rfdl;
+                    }else {
+                        nfdl=nfdl+rfdl;
+                    }
                     if (nfdl <= 0 || nfdl < yfdl || nfdl > modelpower.get(wt.getModelId()) * 24 * 31 * 12 * 1.5) {
                         nfdl = yfdl * month;
                     }
+
+
+
+
 //
 //                        if(wt.getWindpowerstationId().equals("SXJ_KGDL_YTY_FDC_STA"))
 //                        {
 //                            System.out.println("");
 //                        }
                     if (!runWpids.contains(wt.getWindpowerstationId())) {
-
                         wtResultList.add(PointUtil.createPointData(date, rfdl, rfdlPoint.getNemCode(), rfdlPoint.getName()));
                         wtResultList.add(PointUtil.createPointData(date, yfdl, yfdlPoint.getNemCode(), yfdlPoint.getName()));
                         wtResultList.add(PointUtil.createPointData(date, nfdl, nfdlPoint.getNemCode(), nfdlPoint.getName()));
                     }
 
-//                    wtResultList.add(PointUtil.createPointData(date, rfdl, rfdlPoint.getNemCode(), rfdlPoint.getName()));
-//                    wtResultList.add(PointUtil.createPointData(date, yfdl, yfdlPoint.getNemCode(), yfdlPoint.getName()));
-//                    wtResultList.add(PointUtil.createPointData(date, nfdl, nfdlPoint.getNemCode(), nfdlPoint.getName()));
-
                     double fdl15 = ssfdl - date15agofdl;
                     wtResultList.add(PointUtil.createPointData(date, fdl15, fdl15Point.getNemCode(), fdl15Point.getName()));
 
@@ -265,7 +303,7 @@ public class CycleCalculationRebuildService {
                     wtResultList.add(PointUtil.createPointData(date, zhd15, zhd15Point.getNemCode(), zhd15Point.getName()));
 
 
-                    List<PointData> ssfsList = edosUtil.getHistStat(ssfsPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, null, 1800l, 2);
+                    List<PointData> ssfsList = edosUtil.getHistStat(ssfsPoint, date15age.getTime() / 1000, currentDate.getTime() / 1000, 1l, 900l, 2);
                     Optional<PointData> ssfsFirst = ssfsList.stream().findFirst();
                     if (ssfsFirst.isPresent()) {
                         double value = ssfsFirst.get().getPointValueInDouble();
@@ -280,19 +318,19 @@ public class CycleCalculationRebuildService {
                         }
 
                     }
-                    List<PointData> ssglList = edosUtil.getHistStat(ssglPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, null, 1800l, 2);
+                    List<PointData> ssglList = edosUtil.getHistStat(ssglPoint, date15age.getTime() / 1000, currentDate.getTime() / 1000, 1l, 900l, 2);
                     Optional<PointData> ssglFirst = ssglList.stream().findFirst();
                     if (ssglFirst.isPresent()) {
                         dataMap.put("pjgl", ssglFirst.get().getPointValueInDouble());
                     }
-//                    List<PointData> kyglList = edosUtil.getHistStat(kyglPoint, date15age.getTime() / 1000, currentDate.getTime() / 1000, 1l, 1800l, 2);
+//                    List<PointData> kyglList = edosUtil.getHistStat(kyglPoint, date15age.getTime() / 1000, currentDate.getTime() / 1000, 1l, 900l, 2);
 //                    Optional<PointData> kyglFirst = kyglList.stream().findFirst();
 //                    if (kyglFirst.isPresent()) {
 //                        dataMap.put("kydl", kyglFirst.get().getPointValueInDouble());
 //                    }
 
                     dataMap.put("kydl", 0.0);
-                    List<PointData> zsglList = edosUtil.getHistStat(zsglPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, null, 1800l, 2);
+                    List<PointData> zsglList = edosUtil.getHistStat(zsglPoint, date15age.getTime() / 1000, currentDate.getTime() / 1000, 1l, 900l, 2);
                     Optional<PointData> zsglFirst = zsglList.stream().findFirst();
                     if (zsglFirst.isPresent()) {
                         dataMap.put("zsdl", zsglFirst.get().getPointValueInDouble());
@@ -302,41 +340,110 @@ public class CycleCalculationRebuildService {
 //                    List<PointData> ssglPointDatas = edosUtil.getHistoryDatasSnap(ssglPoint, date15age.getTime() / 1000, currentDate.getTime() / 1000, null, 60l);
                     //拟合功率
 //                    List<PointData> zsglPointDatas = edosUtil.getHistoryDatasSnap(zsglPoint, date15age.getTime() / 1000, currentDate.getTime() / 1000, null, 60l);
-                    List<PointData> mxztPointDatas = edosUtil.getHistoryDatasSnap(mxztPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, null, 1800l);
-                    long count=mxztPointDatas.size();
-                    //实时功率平均值
-                    List<PointData> ssglPointDatas = edosUtil.getHistStat(ssglPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, count, 1800l, 2);
-                    //实时风速平均值
-                    List<PointData> pjfsointDatas = edosUtil.getHistStat(ssfsPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, count, 1800l, 2);
-
-//                 if(wt.getId().equals("SXJ_KGDL_GJY_F_WT_0033_EQ"))
-//                {
-//                    System.out.println("");
-//                }
                     //故障
-                    double gzss = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 4,wt);
+                    double gzss =0.0;
                     //故障受累
-                    double gzsl = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 5,wt);
+                    double gzsl =0.0;
                     //检修
-                    double jxss = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 6,wt);
+                    double jxss=0.0;
                     //检修受累
-                    double jxsl = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 7,wt);
+                    double jxsl =0.0;
                     //待机
-                    double djss = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 0,wt)*0.1;
+                    double djss=0.0;
                     //手动停机
-                    double sdtj = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 1,wt)*0.1;
+                    double sdtj =0.0;
                     //性能
-                    double xnss = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 2,wt)*0.1;
+                    double xnss =0.0;
                     //发电降出力
-                    double fdjcl = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 3,wt)*0.1;
+                    double fdjcl =0.0;
                     //限电降出力
-                    double xdjcl = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 8,wt);
+                    double xdjcl =0.0;
                     //限电停机
-                    double xdtj = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 9,wt);
+                    double xdtj =0.0;
                     //电网受累
-                    double dwsl = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 10,wt);
+                    double dwsl =0.0;
                     //环境受累
-                    double hjsl = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 11,wt);
+                    double hjsl =0.0;
+                    if(wt.getId().contains("_F_"))
+                    {
+                        List<PointData> mxztPointDatas = edosUtil.getHistoryDatasSnap(mxztPoint, date15age.getTime() / 1000, currentDate.getTime() / 1000, null, 60l);
+
+                        //实时功率平均值
+                        List<PointData> ssglPointDatas = edosUtil.getHistStat(ssglPoint, date15age.getTime() / 1000, currentDate.getTime() / 1000, 15l, 60l, 2);
+                        //实时风速平均值
+                        List<PointData> pjfsointDatas = edosUtil.getHistStat(ssfsPoint, date15age.getTime() / 1000, currentDate.getTime() / 1000, 15l, 60l, 2);
+                        //故障
+                        gzss = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 4,wt);
+                        //故障受累
+                        gzsl = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 5,wt);
+                        //检修
+                        jxss = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 6,wt);
+                        //检修受累
+                        jxsl = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 7,wt);
+                        //待机
+                        djss = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 0,wt)*0.1;
+                        //手动停机
+                        sdtj = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 1,wt)*0.1;
+                        //性能
+                        xnss = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 2,wt)*0.1;
+                        //发电降出力
+                        fdjcl = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 3,wt)*0.1;
+                        //限电降出力
+                        xdjcl = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 8,wt);
+                        //限电停机
+                        xdtj = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 9,wt);
+                        //电网受累
+                        dwsl = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 10,wt);
+                        //环境受累
+                        hjsl = generalLossBySpeed(mxztPointDatas, pjfsointDatas, ssglPointDatas, 11,wt);
+                    }
+                    else
+                    {
+                        List<PointData> mxztPointDatas = edosUtil.getHistoryDatasSnap(mxztPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, null, 60l);
+                        List<PointData> rfdlPointDatas = edosUtil.getHistoryDatasSnap(rfdlPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, null, 60l);
+                        List<PointData> gzdPointDatas = edosUtil.getHistoryDatasSnap(gzdPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, null, 60l);
+
+//                        if(wt.getId().equals("SXJ_KGDL_JR_G_IN_0304_EQ"))
+//                        {
+//                            System.out.println("");
+//                        }
+                        if(CacheContext.modelMap.containsKey(wt.getModelId()))
+                        {
+                            if(!rfdlPointDatas.isEmpty() &&rfdlPointDatas.size()>=2 )
+                            {
+                                rfdlPointDatas.get(0).setPointValueInDouble(rfdlPointDatas.get(1).getPointValueInDouble());
+                            }
+                            ProEconEquipmentmodel model=CacheContext.modelMap.get(wt.getModelId());
+                            PowerVo vo= lightToTheoreticalPower.calculateEnergy(rfdlPointDatas, gzdPointDatas, mxztPointDatas,gzdPoint.getNemCode(),model.getPowerProduction());
+                            //故障
+                            gzss = vo.getRgzssdl();
+                            //故障受累
+                            gzsl = vo.getRcnslgzssdl();
+                            //检修
+                            jxss = vo.getRjxssdl();
+                            //检修受累
+                            jxsl = vo.getRcnsljxssdl();
+                            //待机
+                            djss = vo.getRdjssdl();
+                            //手动停机
+                            sdtj = vo.getRsdtjssdl();
+                            //性能
+                            xnss = vo.getRxnssdl();
+                            //发电降出力
+                            fdjcl = vo.getRqxjclssdl();
+                            //限电降出力
+                            xdjcl = vo.getRxdjclssdl();
+                            //限电停机
+                            xdtj = vo.getRxdtjssdl();
+                            //电网受累
+                            dwsl = vo.getRcwsldwssdl();
+                            //环境受累
+                            hjsl = vo.getRcwsltqssdl();
+
+                        }
+
+                    }
+
 
                     double rgzss = 0;
                     double rgzsl = 0;
@@ -429,10 +536,64 @@ public class CycleCalculationRebuildService {
                                 lsfs = 0;
                             }
                             rpjfs = DoubleUtils.ave(lsfs, dataMap.get("pjfs"));
+
+                            double lsgl = edosUtil.getSectionData(rpjglPoint, currentDate.getTime()).getPointValueInDouble();
+                            rpjgl = DoubleUtils.ave(lsgl, dataMap.get("pjgl"));
+                            double lskydl = edosUtil.getSectionData(rkydlPoint, currentDate.getTime()).getPointValueInDouble();
+                            rkydl = DoubleUtils.sum(lskydl, dataMap.get("kydl"));
+                            double lslldlzs = edosUtil.getSectionData(rlldlzsPoint, currentDate.getTime()).getPointValueInDouble();
+                            rzsdl = DoubleUtils.sum(lslldlzs, dataMap.get("zsdl"));
+                            double lsgzss = edosUtil.getSectionData(rgzssPoint, currentDate.getTime()).getPointValueInDouble();
+                            rgzss = DoubleUtils.sum(lsgzss, gzss);
+                            double lsgzsl = edosUtil.getSectionData(rgzslPoint, currentDate.getTime()).getPointValueInDouble();
+                            rgzsl = DoubleUtils.sum(lsgzsl, gzsl);
+                            double lsjxss = edosUtil.getSectionData(rjxssPoint, currentDate.getTime()).getPointValueInDouble();
+                            rjxss = DoubleUtils.sum(lsjxss, jxss);
+                            double lsjxsl = edosUtil.getSectionData(rjxslPoint, currentDate.getTime()).getPointValueInDouble();
+                            rjxsl = DoubleUtils.sum(lsjxsl, jxsl);
+
+                            double lsdjss = edosUtil.getSectionData(rdjssPoint, currentDate.getTime()).getPointValueInDouble();
+                            rdjss = DoubleUtils.sum(lsdjss, djss);;
+                            double lssdtj = edosUtil.getSectionData(rsdtjPoint, currentDate.getTime()).getPointValueInDouble();
+                            rsdtj = DoubleUtils.sum(lssdtj, sdtj);;
+                            double lsxnss = edosUtil.getSectionData(rxnssPoint, currentDate.getTime()).getPointValueInDouble();
+                            rxnss = DoubleUtils.sum(lsxnss, xnss);;
+
+                            double lsfdjcl = edosUtil.getSectionData(rfdjclPoint, currentDate.getTime()).getPointValueInDouble();
+                            rfdjcl = DoubleUtils.sum(lsfdjcl, fdjcl);
+
+                            double lsxdjcl = edosUtil.getSectionData(rxdjclPoint, currentDate.getTime()).getPointValueInDouble();
+                            rxdjcl = DoubleUtils.sum(lsxdjcl, xdjcl);
+                            double lsxdtj = edosUtil.getSectionData(rxdtjPoint, currentDate.getTime()).getPointValueInDouble();
+                            rxdtj = DoubleUtils.sum(lsxdtj, xdtj);
+                            double lsdwsl = edosUtil.getSectionData(rdwslPoint, currentDate.getTime()).getPointValueInDouble();
+                            rdwsl = DoubleUtils.sum(lsdwsl, dwsl);
+                            double lshjsl = edosUtil.getSectionData(rhjslPoint, currentDate.getTime()).getPointValueInDouble();
+                            rhjsl = DoubleUtils.sum(lshjsl, hjsl);
+
+//                            if (currentDate.getTime() < samedayZeroAdd15.getTime()) {
+//                                rgzss = gzss;
+//                                rgzsl = gzsl;
+//                                rjxss = jxss;
+//                                rjxsl = jxsl;
+//                                rdjss = djss;
+//                                rsdtj = sdtj;
+//                                rxnss = xnss;
+//                                rfdjcl = fdjcl;
+//                                rxdjcl = xdjcl;
+//                                rxdtj = xdtj;
+//                                rdwsl = dwsl;
+//                                rhjsl = hjsl;
+//                            }
+                            double temp = rgzss + rgzsl + rjxss + rjxsl + rdjss + rsdtj + rxnss + rfdjcl + rxdjcl + rxdtj + rdwsl + rhjsl;
+                            if (temp >= 0) {
+                                rqfdl = temp;
+                            } else {
+                                rzfdl = Math.abs(temp);
+                            }
                         } else {
 
-                            Date tempdate=DateUtils.truncate(currentDate);
-                            List<PointData> pointls=edosUtil.getHistoryDatasSnap(ssfsPoint.getNemCode(), tempdate.getTime()/1000, currentDate.getTime()/1000);
+                            List<PointData> pointls = edosUtil.getHistoryDatasSnap(gzdPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, null, 60l);
                             if(!pointls.isEmpty())
                             {
                                 List<PointData> filterls=new ArrayList<>();
@@ -453,51 +614,40 @@ public class CycleCalculationRebuildService {
                                     //累计光照度
                                     rpjfs = new BigDecimal(avg * hours).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
 
+
+                                    dataMap.put("pjfs",rpjfs);
                                 }
 
                             }
+
+                            double lsgl = edosUtil.getSectionData(rpjglPoint, currentDate.getTime()).getPointValueInDouble();
+                            rpjgl = DoubleUtils.ave(lsgl, dataMap.get("pjgl"));
+                            double lskydl = edosUtil.getSectionData(rkydlPoint, currentDate.getTime()).getPointValueInDouble();
+                            rkydl = DoubleUtils.sum(lskydl, dataMap.get("kydl"));
+                            double lslldlzs = edosUtil.getSectionData(rlldlzsPoint, currentDate.getTime()).getPointValueInDouble();
+                            rzsdl = DoubleUtils.sum(lslldlzs, dataMap.get("zsdl"));
+                            double lsgzss = edosUtil.getSectionData(rgzssPoint, currentDate.getTime()).getPointValueInDouble();
+
+                            rgzss = gzss;
+                            rgzsl = gzsl;
+                            rjxss = jxss;
+                            rjxsl = jxsl;
+                            rdjss = djss;
+                            rsdtj = sdtj;
+                            rxnss = xnss;
+                            rfdjcl = fdjcl;
+                            rxdjcl =xdjcl;
+                            rxdtj = xdtj;
+                            rdwsl = dwsl;
+                            rhjsl =hjsl;
+                            double temp = rgzss + rgzsl + rjxss + rjxsl + rdjss + rsdtj + rxnss + rfdjcl + rxdjcl + rxdtj + rdwsl + rhjsl;
+                            if (temp >= 0) {
+                                rqfdl = temp;
+                            } else {
+                                rzfdl = Math.abs(temp);
+                            }
                         }
-                        double lsgl = edosUtil.getSectionData(rpjglPoint, currentDate.getTime()).getPointValueInDouble();
-                        rpjgl = DoubleUtils.ave(lsgl, dataMap.get("pjgl"));
-                        double lskydl = edosUtil.getSectionData(rkydlPoint, currentDate.getTime()).getPointValueInDouble();
-                        rkydl = DoubleUtils.sum(lskydl, dataMap.get("kydl"));
-                        double lslldlzs = edosUtil.getSectionData(rlldlzsPoint, currentDate.getTime()).getPointValueInDouble();
-                        rzsdl = DoubleUtils.sum(lslldlzs, dataMap.get("zsdl"));
-                        double lsgzss = edosUtil.getSectionData(rgzssPoint, currentDate.getTime()).getPointValueInDouble();
-                        rgzss = DoubleUtils.sum(lsgzss, gzss);
-                        double lsgzsl = edosUtil.getSectionData(rgzslPoint, currentDate.getTime()).getPointValueInDouble();
-                        rgzsl = DoubleUtils.sum(lsgzsl, gzsl);
-                        double lsjxss = edosUtil.getSectionData(rjxssPoint, currentDate.getTime()).getPointValueInDouble();
-                        rjxss = DoubleUtils.sum(lsjxss, jxss);
-                        double lsjxsl = edosUtil.getSectionData(rjxslPoint, currentDate.getTime()).getPointValueInDouble();
-                        rjxsl = DoubleUtils.sum(lsjxsl, jxsl);
-
-                        double lsdjss = edosUtil.getSectionData(rdjssPoint, currentDate.getTime()).getPointValueInDouble();
-                        rdjss = DoubleUtils.sum(lsdjss, djss)*0.1;
-                        double lssdtj = edosUtil.getSectionData(rsdtjPoint, currentDate.getTime()).getPointValueInDouble();
-                        rsdtj = DoubleUtils.sum(lssdtj, sdtj)*0.1;
-                        double lsxnss = edosUtil.getSectionData(rxnssPoint, currentDate.getTime()).getPointValueInDouble();
-                        rxnss = DoubleUtils.sum(lsxnss, xnss)*0.1;
-
-                        double lsfdjcl = edosUtil.getSectionData(rfdjclPoint, currentDate.getTime()).getPointValueInDouble();
-                        rfdjcl = DoubleUtils.sum(lsfdjcl, fdjcl)*0.1;
-
-
-
-                        double lsxdjcl = edosUtil.getSectionData(rxdjclPoint, currentDate.getTime()).getPointValueInDouble();
-                        rxdjcl = DoubleUtils.sum(lsxdjcl, xdjcl);
-                        double lsxdtj = edosUtil.getSectionData(rxdtjPoint, currentDate.getTime()).getPointValueInDouble();
-                        rxdtj = DoubleUtils.sum(lsxdtj, xdtj);
-                        double lsdwsl = edosUtil.getSectionData(rdwslPoint, currentDate.getTime()).getPointValueInDouble();
-                        rdwsl = DoubleUtils.sum(lsdwsl, dwsl);
-                        double lshjsl = edosUtil.getSectionData(rhjslPoint, currentDate.getTime()).getPointValueInDouble();
-                        rhjsl = DoubleUtils.sum(lshjsl, hjsl);
-                        double temp = rgzss + rgzsl + rjxss + rjxsl + rdjss + rsdtj + rxnss + rfdjcl + rxdjcl + rxdtj + rdwsl + rhjsl;
-                        if (temp >= 0) {
-                            rqfdl = temp;
-                        } else {
-                            rzfdl = Math.abs(temp);
-                        }
+
                     }
                     if (date.getTime() > monthFirstZero.getTime() && date.getTime() <= monthFirstZeroAdd15.getTime()) {
                         ypjfs = dataMap.get("pjfs");
@@ -535,27 +685,29 @@ public class CycleCalculationRebuildService {
                             }
                             ypjfs = DoubleUtils.ave(lsfs, dataMap.get("pjfs"));
                         } else {
-//                            double lsfs = edosUtil.getSectionData(ypjgzdPoint, currentDate.getTime()).getPointValueInDouble();
-//                            ypjfs = DoubleUtils.ave(lsfs, dataMap.get("pjfs"));
-
-                            Date tempdate=DateUtils.truncate(currentDate);
-                            Calendar c=new GregorianCalendar();
-                            c.setTime(tempdate);
-                            c.set(Calendar.DAY_OF_MONTH,1);
-                            List<PointData> pointls=edosUtil.getHistoryDatasSnap(rpjgzdPoint.getNemCode(), tempdate.getTime()/1000, currentDate.getTime()/1000,null,24*60*60l);
-                            if(!pointls.isEmpty())
-                            {
-                                double value=0.0;
-                                for(PointData po:pointls)
-                                {
-                                    if(po.getPointValueInDouble()>10)
-                                    {
-                                        value=value+po.getPointValueInDouble();
-                                    }
-                                }
-                                //累计光照度
-                                ypjfs = new BigDecimal(value).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
-                            }
+                            double lsfs = edosUtil.getSectionData(ypjgzdPoint, currentDate.getTime()).getPointValueInDouble();
+                            ypjfs = DoubleUtils.sum(lsfs, dataMap.get("pjfs"));
+
+//                            Date tempdate=DateUtils.truncate(currentDate);
+//                            Calendar c=new GregorianCalendar();
+//                            c.setTime(tempdate);
+//                            c.set(Calendar.DAY_OF_MONTH,1);
+//                            List<PointData> pointls=edosUtil.getHistoryDatasSnap(rpjgzdPoint.getNemCode(), tempdate.getTime()/1000, currentDate.getTime()/1000,null,24*60*60l);
+//                            if(!pointls.isEmpty())
+//                            {
+//                                double value=0.0;
+//                                for(PointData po:pointls)
+//                                {
+//                                    if(po.getPointValueInDouble()>10)
+//                                    {
+//                                       value=value+po.getPointValueInDouble();
+//                                    }
+//                                }
+//                                //累计光照度
+//                                ypjfs = new BigDecimal(value).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
+//                            }
+//
+
                         }
 
                         double lsgl = edosUtil.getSectionData(ypjglPoint, currentDate.getTime()).getPointValueInDouble();
@@ -632,24 +784,9 @@ public class CycleCalculationRebuildService {
                             }
                             npjfs = DoubleUtils.ave(lsfs, dataMap.get("pjfs"));
                         } else {
-//                            double lsfs = edosUtil.getSectionData(npjgzdPoint, currentDate.getTime()).getPointValueInDouble();
-//                            npjfs = DoubleUtils.ave(lsfs, dataMap.get("pjfs"));
-
-                            Date tempdate=DateUtils.truncate(currentDate);
-                            Calendar c=new GregorianCalendar();
-                            c.setTime(tempdate);
-                            c.set(Calendar.DAY_OF_YEAR,1);
-                            List<PointData> pointls=edosUtil.getHistoryDatasSnap(rpjgzdPoint.getNemCode(), tempdate.getTime()/1000, currentDate.getTime()/1000,null,24*60*60l);
-                            if(!pointls.isEmpty()) {
-                                double value = 0.0;
-                                for (PointData po : pointls) {
-                                    if (po.getPointValueInDouble() > 10) {
-                                        value = value + po.getPointValueInDouble();
-                                    }
-                                }
-                                //累计光照度
-                                npjfs = new BigDecimal(value).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
-                            }
+                            double lsfs = edosUtil.getSectionData(npjgzdPoint, currentDate.getTime()).getPointValueInDouble();
+                            npjfs=DoubleUtils.sum(lsfs, dataMap.get("pjfs"));
+
                         }
 
                         double lsgl = edosUtil.getSectionData(npjglPoint, currentDate.getTime()).getPointValueInDouble();
@@ -832,27 +969,7 @@ public class CycleCalculationRebuildService {
             }
 //        });
         }
-
-
-//        String[] arr = new String[]{"测点编号", "数值", "时间"};
-//        String heardName = "电量测点";
-//
-//        List<ExcelVo> vos=new ArrayList<>();
-//        if(!wtResultList.isEmpty())
-//        {
-//            for(PointData po:wtResultList)
-//            {
-//                ExcelVo vo=new ExcelVo();
-//                vo.setId(po.getEdnaId());
-//                vo.setValue(po.getPointValueInDouble());
-//                vo.setDate(new Date(po.getPointTime()));
-//                vos.add(vo);
-//            }
-//        }
-////        //调用Excel导出工具类
-////        ExcelExport.exportToPath(vos, arr, heardName, 6, "电量测点"+DateUtils.toDate1(currentDate));
-
-        edosUtil.updatePoint(wtResultList);
+        edosUtil.sendMultiPoint(wtResultList);
 
 
         List<PointData> lineResultList = new ArrayList<>();
@@ -1151,7 +1268,6 @@ public class CycleCalculationRebuildService {
                 ProBasicEquipmentPoint qfdl15Point = equipmentPointMap.get(ContantXk.QFDL15);
                 ProBasicEquipmentPoint zfdl15Point = equipmentPointMap.get(ContantXk.ZFDL15);
                 ProBasicEquipmentPoint llfdl15Point = equipmentPointMap.get(ContantXk.LLFDL15);
-
                 ProBasicEquipmentPoint mxztPoint = equipmentPointMap.get(ContantXk.MXZT);
 
                 double ssztmx = 0;
@@ -1990,23 +2106,7 @@ public class CycleCalculationRebuildService {
             lineResultList.add(PointUtil.createPointData(date, zfdl15.get(), wpzfdl15Point.getNemCode(), wpzfdl15Point.getName()));
             lineResultList.add(PointUtil.createPointData(date, llfdl15.get(), wpllfdl15Point.getNemCode(), wpllfdl15Point.getName()));
         });
-
-
-//        if(!lineResultList.isEmpty())
-//        {
-//            for(PointData po:lineResultList)
-//            {
-//                ExcelVo vo=new ExcelVo();
-//                vo.setId(po.getEdnaId());
-//                vo.setValue(po.getPointValueInDouble());
-//                vo.setDate(new Date(po.getPointTime()));
-//                vos.add(vo);
-//            }
-//        }
-
-
-
-        edosUtil.updatePoint(lineResultList);
+        edosUtil.sendMultiPoint(lineResultList);
 
         List<PointData> projectResultList = new ArrayList<>();
         pjls.stream().forEach(project -> {
@@ -3124,22 +3224,7 @@ public class CycleCalculationRebuildService {
             projectResultList.add(PointUtil.createPointData(date, zfdl15.get(), wpzfdl15Point.getNemCode(), wpzfdl15Point.getName()));
             projectResultList.add(PointUtil.createPointData(date, llfdl15.get(), wpllfdl15Point.getNemCode(), wpllfdl15Point.getName()));
         });
-
-
-//        if(!projectResultList.isEmpty())
-//        {
-//            for(PointData po:projectResultList)
-//            {
-//                ExcelVo vo=new ExcelVo();
-//                vo.setId(po.getEdnaId());
-//                vo.setValue(po.getPointValueInDouble());
-//                vo.setDate(new Date(po.getPointTime()));
-//                vos.add(vo);
-//            }
-//        }
-//        //调用Excel导出工具类
-//        ExcelExport.exportToPath(vos, arr, heardName, 6, "电量测点"+DateUtils.toDate1(currentDate));
-        edosUtil.updatePoint(projectResultList);
+        edosUtil.sendMultiPoint(projectResultList);
 
         List<PointData> windpowerResultList = new ArrayList<>();
         wpls.stream().forEach(wp -> {
@@ -4258,30 +4343,7 @@ public class CycleCalculationRebuildService {
             windpowerResultList.add(PointUtil.createPointData(date, zfdl15.get(), wpzfdl15Point.getNemCode(), wpzfdl15Point.getName()));
             windpowerResultList.add(PointUtil.createPointData(date, llfdl15.get(), wpllfdl15Point.getNemCode(), wpllfdl15Point.getName()));
         });
-
-
-//        if(!windpowerResultList.isEmpty())
-//        {
-//            for(PointData po:windpowerResultList)
-//            {
-//                ExcelVo vo=new ExcelVo();
-//                vo.setId(po.getEdnaId());
-//                vo.setValue(po.getPointValueInDouble());
-//                vo.setDate(new Date(po.getPointTime()));
-//                vos.add(vo);
-//            }
-//        }
-//        Calendar c= Calendar.getInstance();
-//        c.setTime(currentDate);
-//        c.set(Calendar.HOUR_OF_DAY,23);
-//        c.set(Calendar.MINUTE,59);
-//        c.set(Calendar.SECOND,59);
-//
-//        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//
-//        //调用Excel导出工具类
-//        ExcelExport.exportToPath(vos, arr, heardName, 6, df.format(c.getTime()));
-        edosUtil.updatePoint(windpowerResultList);
+        edosUtil.sendMultiPoint(windpowerResultList);
     }
 
     private double generalLoss(List<PointData> ztmxDatasSnap, List<PointData> zsglDatasSnap, List<PointData> powerDatasSnap, double statusValue) {
@@ -4320,9 +4382,123 @@ public class CycleCalculationRebuildService {
         return zsss;
     }
 
+//    private double generalLossBySpeed(List<PointData> ztmxDatasSnap, List<PointData> speedDatasSnap, List<PointData> powerDatasSnap, double statusValue,ProBasicEquipment wt) {
+//        List<PointData> pointDataList = ztmxDatasSnap.stream().filter(zt -> zt.getPointValueInDouble() == statusValue).collect(Collectors.toList());
+//
+//        Double zsss = 0.0;
+//        if (ztmxDatasSnap.size() == speedDatasSnap.size() && speedDatasSnap.size() == powerDatasSnap.size()) {
+//
+//            PowerIntegration powerIntegration=new PowerIntegration();
+//            Map<Integer, Double> powerData=new HashMap<>();
+//            if (statusValue == 2.0 || statusValue == 3.0 || statusValue == 8.0) {
+//
+//                int time=0;
+//                for (int i = 0; i < ztmxDatasSnap.size(); i++) {
+//                    for (int j = 0; j < pointDataList.size(); j++) {
+//                        if (pointDataList.get(j).getPointTime().equals(ztmxDatasSnap.get(i).getPointTime())) {
+//                            double pjfs = StringUtils.round(speedDatasSnap.get(i).getPointValueInDouble(),2);
+//                            double power = powerDatasSnap.get(i).getPointValueInDouble();
+//
+//                            if (CacheContext.theoreticalPowerMap.containsKey(wt.getModelId()))
+//                            {
+//                                Map<Double,ProBasicModelPowerRd> valuemap=CacheContext.theoreticalPowerMap.get(wt.getModelId());
+//                                if(valuemap.containsKey(pjfs))
+//                                {
+//                                    double bzgl=  valuemap.get(pjfs).getTheoryPower();
+//
+//                                    if (power > 0) {
+//                                        double temp1 = bzgl - power;
+//                                        if (temp1 > 0) {
+////                                            zsss += temp1;
+//                                            powerData.put(time,temp1);
+//                                            time++;
+//                                        }
+//                                    }
+//                                }
+//                            }
+//                        }
+//                    }
+//                }
+////                zsss = zsss / pointDataList.size() >= 0 ? zsss / pointDataList.size() : 0;
+//            } else {
+//                int time=0;
+//                for (int i = 0; i < ztmxDatasSnap.size(); i++) {
+//                    for (int j = 0; j < pointDataList.size(); j++) {
+//                        if (pointDataList.get(j).getPointTime().equals(ztmxDatasSnap.get(i).getPointTime())) {
+//
+//
+//                            double pjfs = StringUtils.round(speedDatasSnap.get(i).getPointValueInDouble(),2);
+//                            if (CacheContext.theoreticalPowerMap.containsKey(wt.getModelId()))
+//                            {
+//                                Map<Double,ProBasicModelPowerRd> valuemap=CacheContext.theoreticalPowerMap.get(wt.getModelId());
+//                                if(valuemap.containsKey(pjfs))
+//                                {
+//                                    double bzgl=  valuemap.get(pjfs).getTheoryPower();
+//
+//                                    powerData.put(time,bzgl);
+//                                    time++;
+//
+//                                }
+//                            }
+//
+//
+//
+//
+//                        }
+//                    }
+//                }
+//
+//            }
+////            zsss = zsss / pointDataList.size() >= 0 ? zsss / pointDataList.size() : 0;
+//            double timeInterval=BigDecimal.valueOf(1).divide(new BigDecimal(120), 2, RoundingMode.HALF_EVEN).doubleValue();
+//            zsss= powerIntegration.calculateEnergy(powerData, timeInterval);
+//        }
+//
+//        return zsss;
+//    }
 
     private double generalLossBySpeed(List<PointData> ztmxDatasSnap, List<PointData> speedDatasSnap, List<PointData> powerDatasSnap, double statusValue,ProBasicEquipment wt) {
         List<PointData> pointDataList = ztmxDatasSnap.stream().filter(zt -> zt.getPointValueInDouble() == statusValue).collect(Collectors.toList());
+
+        Map<Double,Double> powerMap=new HashMap<>();
+        if (redisService.hasKey(CurveType.monthCurve.id+"_"+wt.getId())){
+            String cp0String = redisService.get(CurveType.monthCurve.id+"_"+wt.getId());
+            List<ProEconWtCurveFittingMonth>   powerList = JSONObject.parseObject(cp0String, new TypeReference< List<ProEconWtCurveFittingMonth>>() {
+            });
+            if(!powerList.isEmpty())
+            {
+                powerList.stream().forEach(curveFitting->{
+
+                    powerMap.put(curveFitting.getSpeed(),curveFitting.getActualPower());
+
+                });
+            }
+        }else
+        {
+            if(CacheContext.wpwtmap.containsKey(wt.getWindpowerstationId()))
+            {
+                List<ProBasicEquipment> wtls=CacheContext.wpwtmap.get(wt.getWindpowerstationId());
+                for(ProBasicEquipment w:wtls)
+                {
+                    if (wt.getModelId().equals(w.getModelId()) && redisService.hasKey(CurveType.monthCurve.id+"_"+wt.getId())){
+                        String cp0String = redisService.get(CurveType.monthCurve.id+"_"+wt.getId());
+                        List<ProEconWtCurveFittingMonth>   powerList = JSONObject.parseObject(cp0String, new TypeReference< List<ProEconWtCurveFittingMonth>>() {
+                        });
+                        if(!powerList.isEmpty())
+                        {
+                            powerList.stream().forEach(curveFitting->{
+
+                                powerMap.put(curveFitting.getSpeed(),curveFitting.getActualPower());
+
+                            });
+
+                            break;
+                        }
+                    }
+
+                }
+            }
+        }
         Double zsss = 0.0;
         if (ztmxDatasSnap.size() == speedDatasSnap.size() && speedDatasSnap.size() == powerDatasSnap.size()) {
 
@@ -4337,7 +4513,20 @@ public class CycleCalculationRebuildService {
                             double pjfs = StringUtils.round(speedDatasSnap.get(i).getPointValueInDouble(),2);
                             double power = powerDatasSnap.get(i).getPointValueInDouble();
 
-                            if (CacheContext.theoreticalPowerMap.containsKey(wt.getModelId()))
+                            if(powerMap.containsKey(pjfs))
+                            {
+                                double bzgl=  powerMap.get(pjfs);
+
+                                if (power > 0) {
+                                    double temp1 = bzgl - power;
+                                    if (temp1 > 0) {
+//                                            zsss += temp1;
+                                        powerData.put(time,temp1);
+                                        time++;
+                                    }
+                                }
+
+                            }else if (CacheContext.theoreticalPowerMap.containsKey(wt.getModelId()))
                             {
                                 Map<Double,ProBasicModelPowerRd> valuemap=CacheContext.theoreticalPowerMap.get(wt.getModelId());
                                 if(valuemap.containsKey(pjfs))
@@ -4366,7 +4555,15 @@ public class CycleCalculationRebuildService {
 
 
                             double pjfs = StringUtils.round(speedDatasSnap.get(i).getPointValueInDouble(),2);
-                            if (CacheContext.theoreticalPowerMap.containsKey(wt.getModelId()))
+
+                            if(powerMap.containsKey(pjfs))
+                            {
+                                double bzgl=  powerMap.get(pjfs);
+
+                                powerData.put(time,bzgl);
+                                time++;
+
+                            }else if (CacheContext.theoreticalPowerMap.containsKey(wt.getModelId()))
                             {
                                 Map<Double,ProBasicModelPowerRd> valuemap=CacheContext.theoreticalPowerMap.get(wt.getModelId());
                                 if(valuemap.containsKey(pjfs))
@@ -4378,14 +4575,14 @@ public class CycleCalculationRebuildService {
 
                                 }
                             }
-
                         }
                     }
                 }
 
             }
 //            zsss = zsss / pointDataList.size() >= 0 ? zsss / pointDataList.size() : 0;
-            zsss= powerIntegration.calculateEnergy(powerData, 5/60);
+            double timeInterval=BigDecimal.valueOf(1).divide(new BigDecimal(120), 2, RoundingMode.HALF_EVEN).doubleValue();
+            zsss= powerIntegration.calculateEnergy(powerData, timeInterval);
         }
 
         return zsss;

+ 14 - 2
realtime/generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/CycleCalculationService.java

@@ -51,8 +51,20 @@ public class CycleCalculationService {
 
         List<String> runWpids = Arrays.asList(notCalculatePower.split(","));
 
+        Calendar c=Calendar.getInstance();
+
+        if(c.get(Calendar.HOUR_OF_DAY)==0 && c.get(Calendar.MINUTE)==0)
+        {
+            c.add(Calendar.DAY_OF_MONTH,-1);
+            c.set(Calendar.HOUR_OF_DAY, 23);
+            c.set(Calendar.MINUTE, 59);
+            c.set(Calendar.SECOND, 59);
+        }
+
+
+
+        Date currentDate = c.getTime();
 
-        Date currentDate = DateUtils.getCurrentDate();
         int day = DateUtils.getDay(currentDate);
         int month = DateUtils.getMonth(currentDate);
         Date date = DateUtils.addMinutes(currentDate, -5);
@@ -204,7 +216,7 @@ public class CycleCalculationService {
                     double date15agofdl = edosUtil.getSectionData(rssfdlPoint, date15age.getTime()).getPointValueInDouble() * rssfdlPoint.getCoefficient();
 
 
-                    Calendar c=Calendar.getInstance();
+                    c=Calendar.getInstance();
                     c.setTime(currentDate);
                     if(c.get(Calendar.DAY_OF_MONTH)!=1)
                     {

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

@@ -3,7 +3,6 @@ package com.gyee.generation.task;
 
 import com.gyee.common.util.DateUtils;
 import com.gyee.generation.service.*;
-import com.gyee.generation.service.Irradiationinput.IrradiationinputService;
 import com.gyee.generation.service.StationPower.StationPowerService;
 import com.gyee.generation.util.math.AvailablePowerAccuracyCalculator;
 import com.gyee.generation.util.math.PowerPredictionErrorCalculator;
@@ -15,6 +14,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
+import java.util.Calendar;
 import java.util.Date;
 
 /**
@@ -98,8 +98,27 @@ public class SaticSchedulePgTask {
     @Resource
     private AnalysisNewService analysisNewService;
 
+
     @Resource
-    private IrradiationinputService irradiationinputService;
+    private WindPowerInfo5UpdateService windPowerInfo5UpdateService;
+
+    @XxlJob("windPowerInfo5Update")
+    public void windPowerInfo5Update() {
+
+
+        XxlJobHelper.log("同步电计量电量调度程序执行开始!........");
+        try {
+            Calendar c = Calendar.getInstance();
+            windPowerInfo5UpdateService.calProjectInfoDay(c.getTime());
+            windPowerInfo5UpdateService.calWindpowerInfoDay(c.getTime());
+
+            windPowerInfo5UpdateService.calWindpowerInfoDayCurry();
+            windPowerInfo5UpdateService.calProjectInfoDayCurry();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("同步电计量电量调度任务处理完成!........");
+    }
 
     /**
      * 缓存Redis散点图数据
@@ -209,8 +228,7 @@ public class SaticSchedulePgTask {
         XxlJobHelper.log("停机记录调度程序执行开始!........");
 
         try {
-            while(true)
-            {
+            while (true) {
                 Date begin = new Date();
                 System.out.println("停机记录调度程序执行开始!。。。。。。");
 

+ 11 - 11
realtime/generationXK-service/src/test/java/com/gyee/generation/RealTest.java

@@ -29,30 +29,30 @@ public class RealTest {
 //        CacheService cacheService= SpringUtils.getBean("cacheService");
 //        cacheService.initRedisCache();
 //
-//        c.set(Calendar.DAY_OF_MONTH,1);
-//
-//        c.set(Calendar.HOUR_OF_DAY, 23);
-//        c.set(Calendar.MINUTE, 59);
-//        c.set(Calendar.SECOND, 59);
-//
+        c.set(Calendar.DAY_OF_MONTH,1);
+
+        c.set(Calendar.HOUR_OF_DAY, 23);
+        c.set(Calendar.MINUTE, 59);
+        c.set(Calendar.SECOND, 59);
+
+
 //
-////
-//        c.setTime(DateUtils.truncate(c.getTime()));
+        c.setTime(DateUtils.truncate(c.getTime()));
 
         begin=new Date();
         System.out.println("设备指标记录调度程序执行开始!。。。。。。");
 
-//        cycleCalculationRebuildService.saveCyle(c.getTime());
+        cycleCalculationRebuildService.saveCyle(c.getTime());
 //        for(int i=0;i<19;i++)
 //        {
 //        realtimeService.savaRealtimeTargetWp();
-        statusService.middleStatusReal();
+//        statusService.middleStatusReal();
 //       statusService.startStatusReal();
 //        calculationService.calWp();
 //        cycleCalculationService.saveCyle();
 
         c.add(Calendar.DAY_OF_MONTH,1);
-
+        System.out.println(c.getTime());
             System.out.println("完成一次!。。。。。。");
 //        }