Przeglądaj źródła

计算服务修改

xieshengjie 3 lat temu
rodzic
commit
a27eb3c273
19 zmienionych plików z 1181 dodań i 212 usunięć
  1. 94 1
      common/src/main/java/com/gyee/common/contant/Contant.java
  2. 60 0
      common/src/main/java/com/gyee/common/util/DateUtils.java
  3. 11 11
      common/src/main/resources/application.yml
  4. 3 6
      common/src/test/java/com/gyee/common/CommonMainTest.java
  5. 3 8
      histroy/analysis-histroy-hb/src/main/java/com/gyee/analysis/service/analysis/AnalysisNewService.java
  6. 5 1
      realtime/generation-service/src/main/java/com/gyee/generation/init/CacheContext.java
  7. 2 1
      realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Meterpointvalue.java
  8. 11 17
      realtime/generation-service/src/main/java/com/gyee/generation/service/AverageAndGeneratingService.java
  9. 705 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/FiveLossesService.java
  10. 93 82
      realtime/generation-service/src/main/java/com/gyee/generation/service/GenerationService.java
  11. 1 1
      realtime/generation-service/src/main/java/com/gyee/generation/service/RealtimeSpeedPowerService.java
  12. 7 3
      realtime/generation-service/src/main/java/com/gyee/generation/service/StatusService.java
  13. 17 11
      realtime/generation-service/src/main/java/com/gyee/generation/service/TheorypowerService.java
  14. 18 8
      realtime/generation-service/src/main/java/com/gyee/generation/task/SaticScheduleTask.java
  15. 104 57
      realtime/generation-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtil.java
  16. 30 1
      realtime/generation-service/src/main/java/com/gyee/generation/util/realtimesource/IEdosUtil.java
  17. 2 0
      realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisService.java
  18. 2 1
      realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisServiceImpl.java
  19. 13 3
      realtime/generation-service/src/test/java/com/gyee/generation/GenerationTest.java

+ 94 - 1
common/src/main/java/com/gyee/common/contant/Contant.java

@@ -67,7 +67,7 @@ public class Contant {
     public static final String AI443 = "AI443";//scada有功设定值
 
     public static final String ZTMX = "ZTMX"; //状态明细
-    public static final String FJ5T = "FJ5T"; //五种状态
+    public static final String FJ5T = "FJZT"; //五种状态
     public static final String AI422 = "AI422";  //AI状态码
 
     //明细状态
@@ -97,6 +97,99 @@ public class Contant {
     public static final String BZGL = "BZGL";//风机保证功率
     public static final String ZBZGL = "ZBZGL";//场站保证功率
 
+    //风机日损失电量
+    public static final String WTRDJSSDL ="RDJSSDL-ZS";  //待机损失电量
+    public static final String WTRSTSSDL ="RSTSSDL-ZS"; //手动停机损失电量
+    public static final String WTRXNSSDL = "RXNSSDL-ZS"; //性能损失电量
+    public static final String WTRQXSSDL = "RQXSSDL-ZS";//降出力损失电量
+
+    public static final String WTRGZSSDL = "RGZSSDL-ZS"; //故障损失电量
+    public static final String WTRSZSSDL = "RSZSSDL-ZS"; //受累故障损失电量
+
+    public static final String WTRJXSSDL = "RJXSSDL-ZS";//维护损失电量
+    public static final String WTRLZSSDL = "RLZSSDL-ZS";//受累检修损失电量
+
+    public static final String WTRQFSSDL = "RQFSSDL-ZS";//限电欠发损失电量
+    public static final String WTRXDSSDL = "RXDSSDL-ZS";//限电损失电量
+
+    public static final String WTRWZSSDL = "RWZSSDL-ZS";//电网受累
+    public static final String WTRTZSSDL = "RTZSSDL-ZS";//天气受累
+
+    //风机月损失电量
+    public static final String WTYDJSSDL ="YDJSSDL-ZS";  //待机损失电量
+    public static final String WTYSTSSDL ="YSTSSDL-ZS"; //手动停机损失电量
+    public static final String WTYXNSSDL = "YXNSSDL-ZS"; //性能损失电量
+    public static final String WTYQXSSDL = "YQXSSDL-ZS";//降出力损失电量
+
+    public static final String WTYGZSSDL = "YGZSSDL-ZS"; //故障损失电量
+    public static final String WTYSZSSDL = "YSZSSDL-ZS"; //受累故障损失电量
+
+    public static final String WTYJXSSDL = "YJXSSDL-ZS";//维护损失电量
+    public static final String WTYLZSSDL = "YLZSSDL-ZS";//受累检修损失电量
+
+    public static final String WTYQFSSDL = "YQFSSDL-ZS";//限电欠发损失电量
+    public static final String WTYXDSSDL = "YXDSSDL-ZS";//限电损失电量
+
+    public static final String WTYWZSSDL = "YWZSSDL-ZS";//电网受累
+    public static final String WTYTZSSDL = "YTZSSDL-ZS";//天气受累
+    //风机年损失电量
+    public static final String WTNDJSSDL ="NDJSSDL-ZS";  //待机损失电量
+    public static final String WTNSTSSDL ="NSTSSDL-ZS"; //手动停机损失电量
+    public static final String WTNXNSSDL = "NXNSSDL-ZS"; //性能损失电量
+    public static final String WTNQXSSDL = "NQXSSDL-ZS";//降出力损失电量
+
+    public static final String WTNGZSSDL = "NGZSSDL-ZS"; //故障损失电量
+    public static final String WTNSZSSDL = "NSZSSDL-ZS"; //受累故障损失电量
+
+    public static final String WTNJXSSDL = "NJXSSDL-ZS";//维护损失电量
+    public static final String WTNLZSSDL = "NLZSSDL-ZS";//受累检修损失电量
+
+    public static final String WTNQFSSDL = "NQFSSDL-ZS";//限电欠发损失电量
+    public static final String WTNXDSSDL = "NXDSSDL-ZS";//限电损失电量
+
+    public static final String WTNWZSSDL = "NWZSSDL-ZS";//电网受累
+    public static final String WTNTZSSDL = "NTZSSDL-ZS";//天气受累
+
+    //场站日五损
+    public static final String RSDJZSDL ="RSDJZSDL";  //待机损失电量
+    public static final String RSSTZSDL ="RSSTZSDL"; //手动停机损失电量
+    public static final String RXNZSDL = "RXNZSDL"; //性能损失电量
+    public static final String RSQXZSDL = "RSQXZSDL";//降出力损失电量
+    public static final String RGZZSDL = "RGZZSDL"; //故障损失电量
+    public static final String RSZZSDL = "RSZZSDL"; //受累故障损失电量
+    public static final String RJXZSDL = "RJXZSDL";//维护损失电量
+    public static final String RLZZSDL = "RLZZSDL";//受累检修损失电量
+    public static final String RQFZSDL = "RQFZSDL";//限电欠发损失电量
+    public static final String RXDZSDL = "RXDZSDL";//限电损失电量
+    public static final String RWZZSDL = "RWZZSDL";//电网受累
+    public static final String RTZZSDL = "RTZZSDL";//天气受累
+    //场站月五损
+    public static final String YSDJZSDL ="YSDJZSDL";  //待机损失电量
+    public static final String YSSTZSDL ="YSSTZSDL"; //手动停机损失电量
+    public static final String YXNZSDL = "YXNZSDL"; //性能损失电量
+    public static final String YSQXZSDL = "YSQXZSDL";//降出力损失电量
+    public static final String YGZZSDL = "YGZZSDL"; //故障损失电量
+    public static final String YSZZSDL = "YSZZSDL"; //受累故障损失电量
+    public static final String YJXZSDL = "YJXZSDL";//维护损失电量
+    public static final String YLZZSDL = "YLZZSDL";//受累检修损失电量
+    public static final String YQFZSDL = "YQFZSDL";//限电欠发损失电量
+    public static final String YXDZSDL = "YXDZSDL";//限电损失电量
+    public static final String YWZZSDL = "YWZZSDL";//电网受累
+    public static final String YTZZSDL = "YTZZSDL";//天气受累
+    //场站年五损
+    public static final String NSDJZSDL ="NSDJZSDL";  //待机损失电量
+    public static final String NSSTZSDL ="NSSTZSDL"; //手动停机损失电量
+    public static final String NXNZSDL = "NXNZSDL"; //性能损失电量
+    public static final String NSQXZSDL = "NSQXZSDL";//降出力损失电量
+    public static final String NGZZSDL = "NGZZSDL"; //故障损失电量
+    public static final String NSZZSDL = "NSZZSDL"; //受累故障损失电量
+    public static final String NJXZSDL = "NJXZSDL";//维护损失电量
+    public static final String NLZZSDL = "NLZZSDL";//受累检修损失电量
+    public static final String NQFZSDL = "NQFZSDL";//限电欠发损失电量
+    public static final String NXDZSDL = "NXDZSDL";//限电损失电量
+    public static final String NWZZSDL = "NWZZSDL";//电网受累
+    public static final String NTZZSDL = "NTZZSDL";//天气受累
+
 
 
 

+ 60 - 0
common/src/main/java/com/gyee/common/util/DateUtils.java

@@ -994,6 +994,15 @@ public class DateUtils  {
         calendar.set(Calendar.MILLISECOND,0);
         return calendar.getTime();
     }
+    public static Date getSamedayZero(String date){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(parseDate(date));
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND,0);
+        return calendar.getTime();
+    }
 
     /**
      * 获取当月第一天0点
@@ -1008,6 +1017,16 @@ public class DateUtils  {
         calendar.set(Calendar.MILLISECOND,0);
         return calendar.getTime();
     }
+    public static Date getMonthFirstZero(String date){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(parseDate(date));
+        calendar.set(Calendar.DAY_OF_MONTH,1);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND,0);
+        return calendar.getTime();
+    }
 
     /**
      * 获取当年第一天0点
@@ -1025,6 +1044,19 @@ public class DateUtils  {
         calendar.set(Calendar.MILLISECOND,0);
         return calendar.getTime();
     }
+    public static Date getYearFirstZero(String date){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(parseDate(date));
+        int year = calendar.get(Calendar.YEAR);
+        calendar.set(Calendar.YEAR, year);
+        calendar.set(Calendar.MONTH,0);
+        calendar.set(Calendar.DAY_OF_MONTH,1);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND,0);
+        return calendar.getTime();
+    }
 
     /**
      * 获取当前日期小时数
@@ -1067,4 +1099,32 @@ public class DateUtils  {
         }
         return flag;
     }
+
+    /**
+     * 判断日期是否为本月1号
+     */
+    public static boolean isFirstDayOfMonth(Date date){
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.set(Calendar.DATE,cal.get(Calendar.DATE)+1);
+        if (cal.get(Calendar.DAY_OF_MONTH) == 2){
+            return true;
+        }else {
+            return false;
+        }
+    }
+
+    /**
+     * 判断日期是否为当年第一天
+     */
+    public static boolean isFirstDayOfYear(Date date){
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        int month = cal.get(Calendar.MONTH)+1;
+        if (month == 1 && isFirstDayOfMonth(date)){
+            return true;
+        }else {
+            return false;
+        }
+    }
 }

+ 11 - 11
common/src/main/resources/application.yml

@@ -25,19 +25,19 @@ spring:
   autoconfigure:
     exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
   datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    driver-class-name: oracle.jdbc.OracleDriver
+#    type: com.alibaba.druid.pool.DruidDataSource
+#    driver-class-name: oracle.jdbc.OracleDriver
     #外网
 #    url: jdbc:oracle:thin:@49.4.50.80:1521:gdnxfd
-    url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
-    username: nxfdprod
-    password: gdnxfd123
-    oracle-schema=:
-    #    type: com.alibaba.druid.pool.DruidDataSource
-    #    url: jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8&serverTimezone=UTC
-    #    username: root
-    #    password: root
-    #    driver-class-name: com.mysql.jdbc.Driver
+##    url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
+#    username: nxfdprod
+#    password: gdnxfd123
+#    oracle-schema=:
+    type: com.alibaba.druid.pool.DruidDataSource
+    url: jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8&serverTimezone=UTC
+    username: root
+    password: root
+    driver-class-name: com.mysql.jdbc.Driver
     druid:
       max-active: 20
       initial-size: 1

+ 3 - 6
common/src/test/java/com/gyee/common/CommonMainTest.java

@@ -1,7 +1,6 @@
 package com.gyee.common;
 
 import com.gyee.common.model.algorithm.PointVo;
-import com.gyee.common.util.algorithm.GDJTLineBuild;
 import com.gyee.common.util.algorithm.LineBuild;
 import lombok.extern.slf4j.Slf4j;
 import org.junit.Ignore;
@@ -12,7 +11,6 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
-import javax.annotation.Resource;
 import java.util.List;
 
 /**
@@ -37,9 +35,8 @@ class CommonMainTest {
 
     @Test
     public void test1(){
-        double[] arrX = {1,3,5,7,3,6,5};
-        double[] arrY = {2,3,5,1,6,7,8};
-        List<PointVo> pointVos = LineBuild.buildLine(arrX, arrY, 7, 4, 2.5);
-        List<PointVo> pointVoss = GDJTLineBuild.buildLine(arrX, arrY);
+        double[] arrX = {0,0,0,0,1,3,5,7,3,6,5};
+        double[] arrY = {0,-3,-5,-8,2,3,5,1,6,7,8};
+        List<PointVo> pointVos = LineBuild.buildLine(arrX, arrY, arrX.length, 20, 0.01);
     }
 }

+ 3 - 8
histroy/analysis-histroy-hb/src/main/java/com/gyee/analysis/service/analysis/AnalysisNewService.java

@@ -12,14 +12,7 @@ import com.gyee.common.util.DoubleUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.beans.IntrospectionException;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.math.BigDecimal;
 import java.util.*;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
 /**
@@ -567,7 +560,9 @@ public class AnalysisNewService {
                                 i.getMetersort().equals("主") && i.getMetertype().equals("出线") && i.getUniformcode().equals("FXYG") && i.getProjectid().contains(project.getId())
                         )).collect(Collectors.toList());
                 String[] lineids = fcswmeter.get(0).getLineid().split("\\|");
-                Double fcfdl = Arrays.stream(lineids).map(lineid -> wpmeterMap.get(project.getWindpowerstationid()).stream().filter(j -> j.getMetersort().equals("主") && j.getMetertype().equals("进线") && j.getUniformcode().equals("ZXYG") && j.getLineid().equals(lineid)).findFirst().get()).mapToDouble(linemeterpoint2 -> currentDay.stream().filter(currentBdz -> currentBdz.getMeterid().equals(linemeterpoint2.getId())).findFirst().get().getDayvaluemodify()).sum();
+                Double fcfdl = Arrays.stream(lineids).map(lineid ->
+                        wpmeterMap.get(project.getWindpowerstationid()).stream().filter(j -> j.getMetersort().equals("主") && j.getMetertype().equals("进线") && j.getUniformcode().equals("ZXYG") && j.getLineid().equals(lineid)).findFirst().get())
+                        .mapToDouble(linemeterpoint2 -> currentDay.stream().filter(currentBdz -> currentBdz.getMeterid().equals(linemeterpoint2.getId())).findFirst().get().getDayvaluemodify()).sum();
 
                 Double dayvaluesw = currentDay.stream().filter(currentBdz -> fcswmeter.contains(meterMap.get(currentBdz.getMeterid()))).mapToDouble(Analysissubtablebottom::getDayvaluemodify).sum();
                 Double dayvaluegw = currentDay.stream().filter(currentBdz -> fcgwmeter.contains(meterMap.get(currentBdz.getMeterid()))).mapToDouble(Analysissubtablebottom::getDayvaluemodify).sum();

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

@@ -53,6 +53,7 @@ public class CacheContext implements CommandLineRunner {
     public static List<Line>  lines = new ArrayList<>();
     public static List<Windpowerstation>  wpls = new ArrayList<>();
     public static List<Meterpoint>  meterpoints = new ArrayList<>();
+    public static Map<String,Meterpoint>  meterpointMap = new HashMap<>();
     public static Map<String,List<Project>> wppromap = new HashMap<>();
     public static Map<String,List<Line>> prolinemap = new HashMap<>();
     public static Map<String,List<Windturbine>> linewtmap = new HashMap<>();
@@ -120,7 +121,10 @@ public class CacheContext implements CommandLineRunner {
         });
 
         wpls = windpowerstationService.list().stream().filter(i->runWpids.contains(i.getId())).collect(Collectors.toList());;
-        meterpoints = meterpointService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());;
+        meterpoints = meterpointService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
+        meterpoints.stream().forEach(meterpoint -> {
+            meterpointMap.put(meterpoint.getId(),meterpoint);
+        });
 
 
         wpls.stream().forEach(wp->{

+ 2 - 1
realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Meterpointvalue.java

@@ -1,5 +1,6 @@
 package com.gyee.generation.model.auto;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -24,7 +25,7 @@ public class Meterpointvalue extends Model {
 
     private static final long serialVersionUID = 1L;
 
-    @TableId("ID")
+    @TableId(value = "ID",type = IdType.ASSIGN_ID)
     private Long id;
 
     @TableField("RECORDDATE")

+ 11 - 17
realtime/generation-service/src/main/java/com/gyee/generation/service/AverageAndGeneratingService.java

@@ -1,11 +1,11 @@
 package com.gyee.generation.service;
 
-import com.gyee.benchmarkinghistroy.util.realtimesource.IEdosUtil;
 import com.gyee.common.contant.Contant;
 import com.gyee.common.model.PointData;
 import com.gyee.common.util.DateUtils;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
@@ -29,6 +29,7 @@ public class AverageAndGeneratingService {
     private Map<String, List<Project>> wppromap;
     private Map<String, List<Line>> prolinemap;
     private Map<String, List<Windturbine>> linewtmap;
+    private Date tomorrow;
     private List<Windturbine> wtls;
     private Map<String, Map<String, Windpowerstationpointnew>> wppointmap;
     private Map<String, Map<String, Windpowerstationpointnew>> linepointmap;
@@ -54,6 +55,7 @@ public class AverageAndGeneratingService {
         propointmap = CacheContext.propointmap;
         wtpAimap = CacheContext.wtpAimap;
         linewtmap = CacheContext.linewtmap;
+        tomorrow = DateUtils.addDays(samedayZero,1);
     }
 
     /**
@@ -149,28 +151,20 @@ public class AverageAndGeneratingService {
                             Double yfdl = 0.0;
                             Double nfdl = 0.0;
                             if (direct.contains(wt.getProjectid())){
-                                rfdl = edosUtil.getRealData(ai064).getPointValueInDouble();
-                                yfdl = edosUtil.getRealData(ai138).getPointValueInDouble();
-                                nfdl = edosUtil.getRealData(ai139).getPointValueInDouble();
+                                rfdl = edosUtil.getSectionData(ai064,tomorrow.getTime()).getPointValueInDouble();
+                                yfdl = edosUtil.getSectionData(ai138,tomorrow.getTime()).getPointValueInDouble();
+                                nfdl = edosUtil.getSectionData(ai139,tomorrow.getTime()).getPointValueInDouble();
                             }else{
                                 Double currentValue = 0.0;
                                 Double samedayValue = 0.0;
                                 Double monthFirstValue = 0.0;
                                 Double yearFirstValue = 0.0;
-                                PointData realData = edosUtil.getRealData(ai064);
+                                PointData realData = edosUtil.getSectionData(ai064,tomorrow.getTime());
                                 currentValue = realData.getPointValueInDouble();
-                                Optional<PointData> samedayfirst = edosUtil.getHistoryDatasSnap(ai064, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, 0l).stream().findFirst();
-                                if (samedayfirst.isPresent()){
-                                    samedayValue = samedayfirst.get().getPointValueInDouble();
-                                }
-                                Optional<PointData> monthfirst = edosUtil.getHistoryDatasSnap(ai064, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, 0l).stream().findFirst();
-                                if (monthfirst.isPresent()){
-                                    monthFirstValue = monthfirst.get().getPointValueInDouble();
-                                }
-                                Optional<PointData> yearfirst = edosUtil.getHistoryDatasSnap(ai064, yearFirstZero.getTime() / 1000, yearFirstZero.getTime() / 1000, 1l, 0l).stream().findFirst();
-                                if (yearfirst.isPresent()){
-                                    yearFirstValue = yearfirst.get().getPointValueInDouble();
-                                }
+                                samedayValue = edosUtil.getSectionData(ai064,samedayZero.getTime()).getPointValueInDouble();
+                                monthFirstValue = edosUtil.getSectionData(ai064,monthFirstZero.getTime()).getPointValueInDouble();
+                                yearFirstValue = edosUtil.getSectionData(ai064,yearFirstZero.getTime()).getPointValueInDouble();
+
                                 rfdl = currentValue - samedayValue;
                                 yfdl = currentValue - monthFirstValue;
                                 nfdl = currentValue - yearFirstValue;

+ 705 - 0
realtime/generation-service/src/main/java/com/gyee/generation/service/FiveLossesService.java

@@ -0,0 +1,705 @@
+package com.gyee.generation.service;
+
+import com.gyee.common.contant.Contant;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.common.util.DateUtils;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.*;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+
+/**
+ * @ClassName : FiveLossesService
+ * @Author : xieshengjie
+ * @Date: 2022/5/2 16:13
+ * @Description : 五项损失
+ */
+@Service
+public class FiveLossesService {
+    @Resource
+    private IEdosUtil edosUtil;
+    private List<Windturbine> wtls;
+    private Map<String, Map<String, Windturbinetestingpointnew>> wtpAimap;
+    private Date samedayZero;
+    private Date currentDate;
+    private Date tomorrow;
+    private List<Windpowerstation> wpls;
+    private Map<String, List<Project>> wppromap;
+    private Map<String, List<Line>> prolinemap;
+    private Map<String, List<Windturbine>> linewtmap;
+    private Map<String, Map<String, Windpowerstationpointnew>> wppointmap;
+    private Map<String, Map<String, Windpowerstationpointnew>> linepointmap;
+    private Map<String, Map<String, Windpowerstationpointnew>> propointmap;
+
+    private void init(){
+        wpls = CacheContext.wpls;
+        wtls = CacheContext.wtls;
+        wppromap = CacheContext.wppromap;
+        prolinemap = CacheContext.prolinemap;
+        wppointmap = CacheContext.wppointmap;
+        linepointmap = CacheContext.linepointmap;
+        propointmap = CacheContext.propointmap;
+        wtpAimap = CacheContext.wtpAimap;
+        linewtmap = CacheContext.linewtmap;
+        samedayZero = DateUtils.getSamedayZero();
+        currentDate = DateUtils.getCurrentDate();
+        tomorrow = DateUtils.addDays(samedayZero,1);
+    }
+
+
+    public void lossesReal() throws Exception {
+        init();
+        wtDaylossesReal();
+        wtMonthYearlossesReal();
+        wpDaylossesReal();
+    }
+
+    /**
+     * 场站五损
+     */
+    private void wpDaylossesReal() throws Exception {
+        List<PointData> resultList = new ArrayList<>();
+        wpls.stream().forEach(wp->{
+            List<Project> projects = wppromap.get(wp.getId());
+            Map<String, Windpowerstationpointnew> wppointnewMap = wppointmap.get(wp.getId());
+            AtomicReference<Double> wpdaydjloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpmonthdjloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpyeardjloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpdaysdtjloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpmonthsdtjloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpyearsdtjloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpdayxnloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpmonthxnloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpyearxnloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpdayfdjclloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpmonthfdjclloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpyearfdjclloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpdaygzloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpmonthgzloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpyeargzloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpdaygzslloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpmonthgzslloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpyeargzslloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpdaywhloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpmonthwhloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpyearwhloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpdaywhslloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpmonthwhslloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpyearwhslloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpdayxdtjloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpmonthxdtjloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpyearxdtjloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpdayxdjclloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpmonthxdjclloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpyearxdjclloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpdaydwslloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpmonthdwslloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpyeardwslloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpdayhjslloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpmonthhjslloss = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpyearhjslloss = new AtomicReference<>(0.0);
+            projects.stream().forEach(project -> {
+                List<Line> lines = prolinemap.get(project.getId());
+                Map<String, Windpowerstationpointnew> projectpointnewMap = propointmap.get(project.getId());
+                AtomicReference<Double> projectdaydjloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectmonthdjloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectyeardjloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectdaysdtjloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectmonthsdtjloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectyearsdtjloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectdayxnloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectmonthxnloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectyearxnloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectdayfdjclloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectmonthfdjclloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectyearfdjclloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectdaygzloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectmonthgzloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectyeargzloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectdaygzslloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectmonthgzslloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectyeargzslloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectdaywhloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectmonthwhloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectyearwhloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectdaywhslloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectmonthwhslloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectyearwhslloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectdayxdtjloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectmonthxdtjloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectyearxdtjloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectdayxdjclloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectmonthxdjclloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectyearxdjclloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectdaydwslloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectmonthdwslloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectyeardwslloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectdayhjslloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectmonthhjslloss = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectyearhjslloss = new AtomicReference<>(0.0);
+                lines.stream().forEach(line -> {
+                    List<Windturbine> windturbines = linewtmap.get(line.getId());
+                    Map<String, Windpowerstationpointnew> linepointnewMap = linepointmap.get(line.getId());
+                    AtomicReference<Double> linedaydjloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linemonthdjloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> lineyeardjloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linedaysdtjloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linemonthsdtjloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> lineyearsdtjloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linedayxnloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linemonthxnloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> lineyearxnloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linedayfdjclloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linemonthfdjclloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> lineyearfdjclloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linedaygzloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linemonthgzloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> lineyeargzloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linedaygzslloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linemonthgzslloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> lineyeargzslloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linedaywhloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linemonthwhloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> lineyearwhloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linedaywhslloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linemonthwhslloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> lineyearwhslloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linedayxdtjloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linemonthxdtjloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> lineyearxdtjloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linedayxdjclloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linemonthxdjclloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> lineyearxdjclloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linedaydwslloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linemonthdwslloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> lineyeardwslloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linedayhjslloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linemonthhjslloss = new AtomicReference<>(0.0);
+                    AtomicReference<Double> lineyearhjslloss = new AtomicReference<>(0.0);
+                    windturbines.stream().forEach(wt->{
+                        Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
+                        //待机
+                        Windturbinetestingpointnew dayDjPoint = windturbinetestingpointnewMap.get(Contant.WTRDJSSDL);
+                        Windturbinetestingpointnew monthDjPoint = windturbinetestingpointnewMap.get(Contant.WTYDJSSDL);
+                        Windturbinetestingpointnew yearDjPoint = windturbinetestingpointnewMap.get(Contant.WTNDJSSDL);
+                        geneLineloss(linedaydjloss, linemonthdjloss, lineyeardjloss, dayDjPoint, monthDjPoint, yearDjPoint);
+                        //手动停机
+                        Windturbinetestingpointnew daySdtjPoint = windturbinetestingpointnewMap.get(Contant.WTRSTSSDL);
+                        Windturbinetestingpointnew monthSdtjPoint = windturbinetestingpointnewMap.get(Contant.WTYSTSSDL);
+                        Windturbinetestingpointnew yearSdtjPoint = windturbinetestingpointnewMap.get(Contant.WTNSTSSDL);
+                        geneLineloss(linedaysdtjloss, linemonthsdtjloss, lineyearsdtjloss, daySdtjPoint, monthSdtjPoint, yearSdtjPoint);
+                        //性能
+                        Windturbinetestingpointnew dayXnPoint = windturbinetestingpointnewMap.get(Contant.WTRXNSSDL);
+                        Windturbinetestingpointnew monthXnPoint = windturbinetestingpointnewMap.get(Contant.WTYXNSSDL);
+                        Windturbinetestingpointnew yearXnPoint = windturbinetestingpointnewMap.get(Contant.WTNXNSSDL);
+                        geneLineloss(linedayxnloss, linemonthxnloss, lineyearxnloss, dayXnPoint, monthXnPoint, yearXnPoint);
+                        //发电降出力
+                        Windturbinetestingpointnew dayFdjclPoint = windturbinetestingpointnewMap.get(Contant.WTRQXSSDL);
+                        Windturbinetestingpointnew monthFdjclPoint = windturbinetestingpointnewMap.get(Contant.WTYQXSSDL);
+                        Windturbinetestingpointnew yearFdjclPoint = windturbinetestingpointnewMap.get(Contant.WTNQXSSDL);
+                        geneLineloss(linedayfdjclloss, linemonthfdjclloss, lineyearfdjclloss, dayFdjclPoint, monthFdjclPoint, yearFdjclPoint);
+                        //故障
+                        Windturbinetestingpointnew dayGzPoint = windturbinetestingpointnewMap.get(Contant.WTRGZSSDL);
+                        Windturbinetestingpointnew monthGzPoint = windturbinetestingpointnewMap.get(Contant.WTYGZSSDL);
+                        Windturbinetestingpointnew yearGzPoint = windturbinetestingpointnewMap.get(Contant.WTNGZSSDL);
+                        geneLineloss(linedaygzloss, linemonthgzloss, lineyeargzloss, dayGzPoint, monthGzPoint, yearGzPoint);
+                        //故障受累
+                        Windturbinetestingpointnew dayGzslPoint = windturbinetestingpointnewMap.get(Contant.WTRSZSSDL);
+                        Windturbinetestingpointnew monthGzslPoint = windturbinetestingpointnewMap.get(Contant.WTYSZSSDL);
+                        Windturbinetestingpointnew yearGzslPoint = windturbinetestingpointnewMap.get(Contant.WTNSZSSDL);
+                        geneLineloss(linedaygzslloss, linemonthgzslloss, lineyeargzslloss, dayGzslPoint, monthGzslPoint, yearGzslPoint);
+                        //维护
+                        Windturbinetestingpointnew dayWhPoint = windturbinetestingpointnewMap.get(Contant.WTRJXSSDL);
+                        Windturbinetestingpointnew monthWhPoint = windturbinetestingpointnewMap.get(Contant.WTYJXSSDL);
+                        Windturbinetestingpointnew yearWhPoint = windturbinetestingpointnewMap.get(Contant.WTNJXSSDL);
+                        geneLineloss(linedaywhloss, linemonthwhloss, lineyearwhloss, dayWhPoint, monthWhPoint, yearWhPoint);
+                        //维护受累
+                        Windturbinetestingpointnew dayWhslPoint = windturbinetestingpointnewMap.get(Contant.WTRLZSSDL);
+                        Windturbinetestingpointnew monthWhslPoint = windturbinetestingpointnewMap.get(Contant.WTYLZSSDL);
+                        Windturbinetestingpointnew yearWhslPoint = windturbinetestingpointnewMap.get(Contant.WTNLZSSDL);
+                        geneLineloss(linedaywhslloss, linemonthwhslloss, lineyearwhslloss, dayWhslPoint, monthWhslPoint, yearWhslPoint);
+                        //限电降出力
+                        Windturbinetestingpointnew dayXdjclPoint = windturbinetestingpointnewMap.get(Contant.WTRQFSSDL);
+                        Windturbinetestingpointnew monthXdjclPoint = windturbinetestingpointnewMap.get(Contant.WTYQFSSDL);
+                        Windturbinetestingpointnew yearXdjclPoint = windturbinetestingpointnewMap.get(Contant.WTNQFSSDL);
+                        geneLineloss(linedayxdjclloss, linemonthxdjclloss, lineyearxdjclloss, dayXdjclPoint, monthXdjclPoint, yearXdjclPoint);
+                        //限电停机
+                        Windturbinetestingpointnew dayXdtjPoint = windturbinetestingpointnewMap.get(Contant.WTRXDSSDL);
+                        Windturbinetestingpointnew monthXdtjPoint = windturbinetestingpointnewMap.get(Contant.WTYXDSSDL);
+                        Windturbinetestingpointnew yearXdtjPoint = windturbinetestingpointnewMap.get(Contant.WTNXDSSDL);
+                        geneLineloss(linedayxdtjloss, linemonthxdtjloss, lineyearxdtjloss, dayXdtjPoint, monthXdtjPoint, yearXdtjPoint);
+                        //电网受累
+                        Windturbinetestingpointnew dayDwslPoint = windturbinetestingpointnewMap.get(Contant.WTRWZSSDL);
+                        Windturbinetestingpointnew monthDwslPoint = windturbinetestingpointnewMap.get(Contant.WTYWZSSDL);
+                        Windturbinetestingpointnew yearDwslPoint = windturbinetestingpointnewMap.get(Contant.WTNWZSSDL);
+                        geneLineloss(linedaydwslloss, linemonthdwslloss, lineyeardwslloss, dayDwslPoint, monthDwslPoint, yearDwslPoint);
+                        //环境受累
+                        Windturbinetestingpointnew dayHjslPoint = windturbinetestingpointnewMap.get(Contant.WTRTZSSDL);
+                        Windturbinetestingpointnew monthHjslPoint = windturbinetestingpointnewMap.get(Contant.WTYTZSSDL);
+                        Windturbinetestingpointnew yearHjslPoint = windturbinetestingpointnewMap.get(Contant.WTNTZSSDL);
+                        geneLineloss(linedayhjslloss, linemonthhjslloss, lineyearhjslloss, dayHjslPoint, monthHjslPoint, yearHjslPoint);
+                    });
+                    //待机
+                    addWpPoint(resultList, linepointnewMap.get(Contant.RSDJZSDL), linedaydjloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.YSDJZSDL), linemonthdjloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.NSDJZSDL), lineyeardjloss);
+                    projectdaydjloss.updateAndGet(v->new Double((double) (v + linedaydjloss.get())));
+                    projectmonthdjloss.updateAndGet(v->new Double((double) (v + linemonthdjloss.get())));
+                    projectyeardjloss.updateAndGet(v->new Double((double) (v + lineyeardjloss.get())));
+                    //手动停机
+                    addWpPoint(resultList, linepointnewMap.get(Contant.RSSTZSDL), linedaysdtjloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.YSSTZSDL), linemonthsdtjloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.NSSTZSDL), lineyearsdtjloss);
+                    projectdaysdtjloss.updateAndGet(v->new Double((double) (v + linedaysdtjloss.get())));
+                    projectmonthsdtjloss.updateAndGet(v->new Double((double) (v + linemonthsdtjloss.get())));
+                    projectyearsdtjloss.updateAndGet(v->new Double((double) (v + lineyearsdtjloss.get())));
+                    //性能
+                    addWpPoint(resultList, linepointnewMap.get(Contant.RXNZSDL), linedayxnloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.YXNZSDL), linemonthxnloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.NXNZSDL), lineyearxnloss);
+                    projectdayxnloss.updateAndGet(v->new Double((double) (v + linedayxnloss.get())));
+                    projectmonthxnloss.updateAndGet(v->new Double((double) (v + linemonthxnloss.get())));
+                    projectyearxnloss.updateAndGet(v->new Double((double) (v + lineyearxnloss.get())));
+                    //发电降出力
+                    addWpPoint(resultList, linepointnewMap.get(Contant.RSQXZSDL), linedayfdjclloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.YSQXZSDL), linemonthfdjclloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.NSQXZSDL), lineyearfdjclloss);
+                    projectdayfdjclloss.updateAndGet(v->new Double((double) (v + linedayfdjclloss.get())));
+                    projectmonthfdjclloss.updateAndGet(v->new Double((double) (v + linemonthfdjclloss.get())));
+                    projectyearfdjclloss.updateAndGet(v->new Double((double) (v + lineyearfdjclloss.get())));
+                    //故障
+                    addWpPoint(resultList, linepointnewMap.get(Contant.RGZZSDL), linedaygzloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.YGZZSDL), linemonthgzloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.NGZZSDL), lineyeargzloss);
+                    projectdaygzloss.updateAndGet(v->new Double((double) (v + linedaygzloss.get())));
+                    projectmonthgzloss.updateAndGet(v->new Double((double) (v + linemonthgzloss.get())));
+                    projectyeargzloss.updateAndGet(v->new Double((double) (v + lineyeargzloss.get())));
+                    //故障受累
+                    addWpPoint(resultList, linepointnewMap.get(Contant.RSZZSDL), linedaygzslloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.YSZZSDL), linemonthgzslloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.NSZZSDL), lineyeargzslloss);
+                    projectdaygzslloss.updateAndGet(v->new Double((double) (v + linedaygzslloss.get())));
+                    projectmonthgzslloss.updateAndGet(v->new Double((double) (v + linemonthgzslloss.get())));
+                    projectyeargzslloss.updateAndGet(v->new Double((double) (v + lineyeargzslloss.get())));
+                    //维护
+                    addWpPoint(resultList, linepointnewMap.get(Contant.RJXZSDL), linedaywhloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.YJXZSDL), linemonthwhloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.NJXZSDL), lineyearwhloss);
+                    projectdaywhloss.updateAndGet(v->new Double((double) (v + linedaywhloss.get())));
+                    projectmonthwhloss.updateAndGet(v->new Double((double) (v + linemonthwhloss.get())));
+                    projectyearwhloss.updateAndGet(v->new Double((double) (v + lineyearwhloss.get())));
+                    //维护受累
+                    addWpPoint(resultList, linepointnewMap.get(Contant.RLZZSDL), linedaywhslloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.YLZZSDL), linemonthwhslloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.NLZZSDL), lineyearwhslloss);
+                    projectdaywhslloss.updateAndGet(v->new Double((double) (v + linedaywhslloss.get())));
+                    projectmonthwhslloss.updateAndGet(v->new Double((double) (v + linemonthwhslloss.get())));
+                    projectyearwhslloss.updateAndGet(v->new Double((double) (v + lineyearwhslloss.get())));
+                    //限电降出力
+                    addWpPoint(resultList, linepointnewMap.get(Contant.RQFZSDL), linedayxdjclloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.YQFZSDL), linemonthxdjclloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.NQFZSDL), lineyearxdjclloss);
+                    projectdayxdjclloss.updateAndGet(v->new Double((double) (v + linedayxdjclloss.get())));
+                    projectmonthxdjclloss.updateAndGet(v->new Double((double) (v + linemonthxdjclloss.get())));
+                    projectyearxdjclloss.updateAndGet(v->new Double((double) (v + lineyearxdjclloss.get())));
+                    //限电停机
+                    addWpPoint(resultList, linepointnewMap.get(Contant.RXDZSDL), linedayxdtjloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.YXDZSDL), linemonthxdtjloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.NXDZSDL), lineyearxdtjloss);
+                    projectdayxdtjloss.updateAndGet(v->new Double((double) (v + linedayxdtjloss.get())));
+                    projectmonthxdtjloss.updateAndGet(v->new Double((double) (v + linemonthxdtjloss.get())));
+                    projectyearxdtjloss.updateAndGet(v->new Double((double) (v + lineyearxdtjloss.get())));
+                    //电网受累
+                    addWpPoint(resultList, linepointnewMap.get(Contant.RWZZSDL), linedaydwslloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.YWZZSDL), linemonthdwslloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.NWZZSDL), lineyeardwslloss);
+                    projectdaydwslloss.updateAndGet(v->new Double((double) (v + linedaydwslloss.get())));
+                    projectmonthdwslloss.updateAndGet(v->new Double((double) (v + linemonthdwslloss.get())));
+                    projectyeardwslloss.updateAndGet(v->new Double((double) (v + lineyeardwslloss.get())));
+                    //环境受累
+                    addWpPoint(resultList, linepointnewMap.get(Contant.RTZZSDL), linedayhjslloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.YTZZSDL), linemonthhjslloss);
+                    addWpPoint(resultList, linepointnewMap.get(Contant.NTZZSDL), lineyearhjslloss);
+                    projectdayhjslloss.updateAndGet(v->new Double((double) (v + linedayhjslloss.get())));
+                    projectmonthhjslloss.updateAndGet(v->new Double((double) (v + linemonthhjslloss.get())));
+                    projectyearhjslloss.updateAndGet(v->new Double((double) (v + lineyearhjslloss.get())));
+                });
+                //待机
+                addWpPoint(resultList, projectpointnewMap.get(Contant.RSDJZSDL), projectdaydjloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.YSDJZSDL), projectmonthdjloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.NSDJZSDL), projectyeardjloss);
+                wpdaydjloss.updateAndGet(v->new Double((double) (v + projectdaydjloss.get())));
+                wpmonthdjloss.updateAndGet(v->new Double((double) (v + projectmonthdjloss.get())));
+                wpyeardjloss.updateAndGet(v->new Double((double) (v + projectyeardjloss.get())));
+                //手动停机
+                addWpPoint(resultList, projectpointnewMap.get(Contant.RSSTZSDL), projectdaysdtjloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.YSSTZSDL), projectmonthsdtjloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.NSSTZSDL), projectyearsdtjloss);
+                wpdaysdtjloss.updateAndGet(v->new Double((double) (v + projectdaysdtjloss.get())));
+                wpmonthsdtjloss.updateAndGet(v->new Double((double) (v + projectmonthsdtjloss.get())));
+                wpyearsdtjloss.updateAndGet(v->new Double((double) (v + projectyearsdtjloss.get())));
+                //性能
+                addWpPoint(resultList, projectpointnewMap.get(Contant.RXNZSDL), projectdayxnloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.YXNZSDL), projectmonthxnloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.NXNZSDL), projectyearxnloss);
+                wpdayxnloss.updateAndGet(v->new Double((double) (v + projectdayxnloss.get())));
+                wpmonthxnloss.updateAndGet(v->new Double((double) (v + projectmonthxnloss.get())));
+                wpyearxnloss.updateAndGet(v->new Double((double) (v + projectyearxnloss.get())));
+                //发电降出力
+                addWpPoint(resultList, projectpointnewMap.get(Contant.RSQXZSDL), projectdayfdjclloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.YSQXZSDL), projectmonthfdjclloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.NSQXZSDL), projectyearfdjclloss);
+                wpdayfdjclloss.updateAndGet(v->new Double((double) (v + projectdayfdjclloss.get())));
+                wpmonthfdjclloss.updateAndGet(v->new Double((double) (v + projectmonthfdjclloss.get())));
+                wpyearfdjclloss.updateAndGet(v->new Double((double) (v + projectyearfdjclloss.get())));
+                //故障
+                addWpPoint(resultList, projectpointnewMap.get(Contant.RGZZSDL), projectdaygzloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.YGZZSDL), projectmonthgzloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.NGZZSDL), projectyeargzloss);
+                wpdaygzloss.updateAndGet(v->new Double((double) (v + projectdaygzloss.get())));
+                wpmonthgzloss.updateAndGet(v->new Double((double) (v + projectmonthgzloss.get())));
+                wpyeargzloss.updateAndGet(v->new Double((double) (v + projectyeargzloss.get())));
+                //故障受累
+                addWpPoint(resultList, projectpointnewMap.get(Contant.RSZZSDL), projectdaygzslloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.YSZZSDL), projectmonthgzslloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.NSZZSDL), projectyeargzslloss);
+                wpdaygzslloss.updateAndGet(v->new Double((double) (v + projectdaygzslloss.get())));
+                wpmonthgzslloss.updateAndGet(v->new Double((double) (v + projectmonthgzslloss.get())));
+                wpyeargzslloss.updateAndGet(v->new Double((double) (v + projectyeargzslloss.get())));
+                //维护
+                addWpPoint(resultList, projectpointnewMap.get(Contant.RJXZSDL), projectdaywhloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.YJXZSDL), projectmonthwhloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.NJXZSDL), projectyearwhloss);
+                wpdaywhloss.updateAndGet(v->new Double((double) (v + projectdaywhloss.get())));
+                wpmonthwhloss.updateAndGet(v->new Double((double) (v + projectmonthwhloss.get())));
+                wpyearwhloss.updateAndGet(v->new Double((double) (v + projectyearwhloss.get())));
+                //维护受累
+                addWpPoint(resultList, projectpointnewMap.get(Contant.RLZZSDL), projectdaywhslloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.YLZZSDL), projectmonthwhslloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.NLZZSDL), projectyearwhslloss);
+                wpdaywhslloss.updateAndGet(v->new Double((double) (v + projectdaywhslloss.get())));
+                wpmonthwhslloss.updateAndGet(v->new Double((double) (v + projectmonthwhslloss.get())));
+                wpyearwhslloss.updateAndGet(v->new Double((double) (v + projectyearwhslloss.get())));
+                //限电降出力
+                addWpPoint(resultList, projectpointnewMap.get(Contant.RQFZSDL), projectdayxdjclloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.YQFZSDL), projectmonthxdjclloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.NQFZSDL), projectyearxdjclloss);
+                wpdayxdjclloss.updateAndGet(v->new Double((double) (v + projectdayxdjclloss.get())));
+                wpmonthxdjclloss.updateAndGet(v->new Double((double) (v + projectmonthxdjclloss.get())));
+                wpyearxdjclloss.updateAndGet(v->new Double((double) (v + projectyearxdjclloss.get())));
+                //限电停机
+                addWpPoint(resultList, projectpointnewMap.get(Contant.RXDZSDL), projectdayxdtjloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.YXDZSDL), projectmonthxdtjloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.NXDZSDL), projectyearxdtjloss);
+                wpdayxdtjloss.updateAndGet(v->new Double((double) (v + projectdayxdtjloss.get())));
+                wpmonthxdtjloss.updateAndGet(v->new Double((double) (v + projectmonthxdtjloss.get())));
+                wpyearxdtjloss.updateAndGet(v->new Double((double) (v + projectyearxdtjloss.get())));
+                //电网受累
+                addWpPoint(resultList, projectpointnewMap.get(Contant.RWZZSDL), projectdaydwslloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.YWZZSDL), projectmonthdwslloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.NWZZSDL), projectyeardwslloss);
+                wpdaydwslloss.updateAndGet(v->new Double((double) (v + projectdaydwslloss.get())));
+                wpmonthdwslloss.updateAndGet(v->new Double((double) (v + projectmonthdwslloss.get())));
+                wpyeardwslloss.updateAndGet(v->new Double((double) (v + projectyeardwslloss.get())));
+                //环境受累
+                addWpPoint(resultList, projectpointnewMap.get(Contant.RTZZSDL), projectdayhjslloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.YTZZSDL), projectmonthhjslloss);
+                addWpPoint(resultList, projectpointnewMap.get(Contant.NTZZSDL), projectyearhjslloss);
+                wpdayhjslloss.updateAndGet(v->new Double((double) (v + projectdayhjslloss.get())));
+                wpmonthhjslloss.updateAndGet(v->new Double((double) (v + projectmonthhjslloss.get())));
+                wpyearhjslloss.updateAndGet(v->new Double((double) (v + projectyearhjslloss.get())));
+            });
+            //待机
+            addWpPoint(resultList, wppointnewMap.get(Contant.RSDJZSDL), wpdaydjloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.YSDJZSDL), wpmonthdjloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.NSDJZSDL), wpyeardjloss);
+            //手动停机
+            addWpPoint(resultList, wppointnewMap.get(Contant.RSSTZSDL), wpdaysdtjloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.YSSTZSDL), wpmonthsdtjloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.NSSTZSDL), wpyearsdtjloss);
+
+            //性能
+            addWpPoint(resultList, wppointnewMap.get(Contant.RXNZSDL), wpdayxnloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.YXNZSDL), wpmonthxnloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.NXNZSDL), wpyearxnloss);
+            //发电降出力
+            addWpPoint(resultList, wppointnewMap.get(Contant.RSQXZSDL), wpdayfdjclloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.YSQXZSDL), wpmonthfdjclloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.NSQXZSDL), wpyearfdjclloss);
+             //故障
+            addWpPoint(resultList, wppointnewMap.get(Contant.RGZZSDL), wpdaygzloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.YGZZSDL), wpmonthgzloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.NGZZSDL), wpyeargzloss);
+                //故障受累
+            addWpPoint(resultList, wppointnewMap.get(Contant.RSZZSDL), wpdaygzslloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.YSZZSDL), wpmonthgzslloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.NSZZSDL), wpyeargzslloss);
+            //维护
+            addWpPoint(resultList, wppointnewMap.get(Contant.RJXZSDL), wpdaywhloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.YJXZSDL), wpmonthwhloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.NJXZSDL), wpyearwhloss);
+            //维护受累
+            addWpPoint(resultList, wppointnewMap.get(Contant.RLZZSDL), wpdaywhslloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.YLZZSDL), wpmonthwhslloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.NLZZSDL), wpyearwhslloss);
+            //限电降出力
+            addWpPoint(resultList, wppointnewMap.get(Contant.RQFZSDL), wpdayxdjclloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.YQFZSDL), wpmonthxdjclloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.NQFZSDL), wpyearxdjclloss);
+                //限电停机
+            addWpPoint(resultList, wppointnewMap.get(Contant.RXDZSDL), wpdayxdtjloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.YXDZSDL), wpmonthxdtjloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.NXDZSDL), wpyearxdtjloss);
+            //电网受累
+            addWpPoint(resultList, wppointnewMap.get(Contant.RWZZSDL), wpdaydwslloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.YWZZSDL), wpmonthdwslloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.NWZZSDL), wpyeardwslloss);
+              //环境受累
+            addWpPoint(resultList, wppointnewMap.get(Contant.RTZZSDL), wpdayhjslloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.YTZZSDL), wpmonthhjslloss);
+            addWpPoint(resultList, wppointnewMap.get(Contant.NTZZSDL), wpyearhjslloss);
+        });
+        edosUtil.sendMultiPoint(resultList);
+    }
+
+    private void addWpPoint(List<PointData> resultList, Windpowerstationpointnew pointnew, AtomicReference<Double> linedaydjloss) {
+        PointData wpPointData = createWpPointData(pointnew, linedaydjloss.get());
+        resultList.add(wpPointData);
+    }
+
+
+    private void geneLineloss(AtomicReference<Double> linedaydjloss, AtomicReference<Double> linemonthdjloss, AtomicReference<Double> lineyeardjloss, Windturbinetestingpointnew dayDjPoint, Windturbinetestingpointnew monthDjPoint, Windturbinetestingpointnew yearDjPoint) {
+        double wtdaydj = 0.0;
+        double wtmonthdj = 0.0;
+        double wtyeardj = 0.0;
+        try {
+            wtdaydj = edosUtil.getSectionData(dayDjPoint,tomorrow.getTime()).getPointValueInDouble();
+            wtmonthdj = edosUtil.getSectionData(monthDjPoint,tomorrow.getTime()).getPointValueInDouble();
+            wtyeardj = edosUtil.getSectionData(yearDjPoint,tomorrow.getTime()).getPointValueInDouble();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        double finalWtdaydj = wtdaydj;
+        linedaydjloss.updateAndGet(v -> new Double((double) (v + finalWtdaydj)));
+        double finalWtmonthdj = wtmonthdj;
+        linemonthdjloss.updateAndGet(v -> new Double((double) (v + finalWtmonthdj)));
+        double finalWtyeardj = wtyeardj;
+        lineyeardjloss.updateAndGet(v -> new Double((double) (v + finalWtyeardj)));
+    }
+
+    /**
+     * 风机日五损
+     * @throws Exception
+     */
+    private void wtDaylossesReal() throws Exception {
+        List<PointData> resultList = new ArrayList<>();
+        wtls.stream().forEach(wt->{
+            Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
+            Windturbinetestingpointnew powerPoint = windturbinetestingpointnewMap.get(Contant.AI130);
+            Windturbinetestingpointnew ztmxPoint = windturbinetestingpointnewMap.get(Contant.ZTMX);
+            Windturbinetestingpointnew bzglPoint = windturbinetestingpointnewMap.get(Contant.BZGL);
+            Windturbinetestingpointnew zsglPoint = windturbinetestingpointnewMap.get(Contant.ZSGL);
+            Windturbinetestingpointnew rfdlPoint = windturbinetestingpointnewMap.get(Contant.ZSGL);
+            List<PointData> powerDatasSnap = null;
+            List<PointData> ztmxDatasSnap = null;
+            List<PointData> bzglDatasSnap = null;
+            List<PointData> zsglDatasSnap = null;
+            try {
+                powerDatasSnap = edosUtil.getHistoryDatasSnap(powerPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, null, 60l);
+                ztmxDatasSnap = edosUtil.getHistoryDatasSnap(ztmxPoint,samedayZero.getTime()/1000,currentDate.getTime()/1000,null,60l);
+                bzglDatasSnap = edosUtil.getHistoryDatasSnap(bzglPoint,samedayZero.getTime()/1000,currentDate.getTime()/1000,null,60l);
+                zsglDatasSnap = edosUtil.getHistoryDatasSnap(zsglPoint,samedayZero.getTime()/1000,currentDate.getTime()/1000,null,60l);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            if (StringUtils.isNotEmpty(ztmxDatasSnap)){
+                //待机损失
+                generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 0.0,resultList,windturbinetestingpointnewMap.get(Contant.WTRDJSSDL));
+                //手动停机
+                generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 1.0,resultList,windturbinetestingpointnewMap.get(Contant.WTRSTSSDL));
+                //并网损失电量
+                generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 2.0,resultList,windturbinetestingpointnewMap.get(Contant.WTRXNSSDL));
+                //发电降出力
+                generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 3.0,resultList,windturbinetestingpointnewMap.get(Contant.WTRQXSSDL));
+                //限电降出力
+                generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 4.0,resultList,windturbinetestingpointnewMap.get(Contant.WTRQFSSDL));
+                //限电停机
+                generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 5.0,resultList,windturbinetestingpointnewMap.get(Contant.WTRXDSSDL));
+                //故障
+                generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 6.0,resultList,windturbinetestingpointnewMap.get(Contant.WTRGZSSDL));
+                //故障受累
+                generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 7.0,resultList,windturbinetestingpointnewMap.get(Contant.WTRSZSSDL));
+                //检修
+                generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 8.0,resultList,windturbinetestingpointnewMap.get(Contant.WTRJXSSDL));
+                //检修受累
+                generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 9.0,resultList,windturbinetestingpointnewMap.get(Contant.WTRLZSSDL));
+                //电网受累
+                generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 10.0,resultList,windturbinetestingpointnewMap.get(Contant.WTRWZSSDL));
+                //环境受累
+                generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 11.0,resultList,windturbinetestingpointnewMap.get(Contant.WTRTZSSDL));
+            }
+        });
+        edosUtil.sendMultiPoint(resultList);
+    }
+
+
+    private PointData createWpPointData(Windpowerstationpointnew linepointnew, double linespeed) {
+        PointData pointData = new PointData();
+        pointData.setEdnaId(linepointnew.getCode());
+        pointData.setPointTime(currentDate.getTime());
+        pointData.setPointName(linepointnew.getName());
+        pointData.setPointValue(String.valueOf(linespeed));
+        pointData.setPointValueInDouble(linespeed);
+        return pointData;
+    }
+
+    /**
+     * 风机月、年五损
+     * @throws Exception
+     */
+    private void wtMonthYearlossesReal() throws Exception {
+        List<PointData> resultList = new ArrayList<>();
+        boolean firstDayOfMonth = DateUtils.isFirstDayOfMonth(currentDate);
+        boolean firstDayOfYear = DateUtils.isFirstDayOfYear(currentDate);
+        wtls.stream().forEach(wt->{
+            Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
+            //待机
+            Windturbinetestingpointnew dayDjPoint = windturbinetestingpointnewMap.get(Contant.WTRDJSSDL);
+            Windturbinetestingpointnew monthDjPoint = windturbinetestingpointnewMap.get(Contant.WTYDJSSDL);
+            Windturbinetestingpointnew yearDjPoint = windturbinetestingpointnewMap.get(Contant.WTNDJSSDL);
+            geneMonthOrYearLoss(resultList, dayDjPoint,monthDjPoint,firstDayOfMonth);
+            geneMonthOrYearLoss(resultList, dayDjPoint,yearDjPoint,firstDayOfYear);
+            //手动停机
+            Windturbinetestingpointnew daySdtjPoint = windturbinetestingpointnewMap.get(Contant.WTRSTSSDL);
+            Windturbinetestingpointnew monthSdtjPoint = windturbinetestingpointnewMap.get(Contant.WTYSTSSDL);
+            Windturbinetestingpointnew yearSdtjPoint = windturbinetestingpointnewMap.get(Contant.WTNSTSSDL);
+            geneMonthOrYearLoss(resultList, daySdtjPoint,monthSdtjPoint,firstDayOfMonth);
+            geneMonthOrYearLoss(resultList, daySdtjPoint,yearSdtjPoint,firstDayOfYear);
+            //性能
+            Windturbinetestingpointnew dayXnPoint = windturbinetestingpointnewMap.get(Contant.WTRXNSSDL);
+            Windturbinetestingpointnew monthXnPoint = windturbinetestingpointnewMap.get(Contant.WTYXNSSDL);
+            Windturbinetestingpointnew yearXnPoint = windturbinetestingpointnewMap.get(Contant.WTNXNSSDL);
+            geneMonthOrYearLoss(resultList, dayXnPoint,monthXnPoint,firstDayOfMonth);
+            geneMonthOrYearLoss(resultList, dayXnPoint,yearXnPoint,firstDayOfYear);
+            //发电降出力
+            Windturbinetestingpointnew dayFdjclPoint = windturbinetestingpointnewMap.get(Contant.WTRQXSSDL);
+            Windturbinetestingpointnew monthFdjclPoint = windturbinetestingpointnewMap.get(Contant.WTYQXSSDL);
+            Windturbinetestingpointnew yearFdjclPoint = windturbinetestingpointnewMap.get(Contant.WTNQXSSDL);
+            geneMonthOrYearLoss(resultList, dayFdjclPoint,monthFdjclPoint,firstDayOfMonth);
+            geneMonthOrYearLoss(resultList, dayFdjclPoint,yearFdjclPoint,firstDayOfYear);
+            //故障
+            Windturbinetestingpointnew dayGzPoint = windturbinetestingpointnewMap.get(Contant.WTRGZSSDL);
+            Windturbinetestingpointnew monthGzPoint = windturbinetestingpointnewMap.get(Contant.WTYGZSSDL);
+            Windturbinetestingpointnew yearGzPoint = windturbinetestingpointnewMap.get(Contant.WTNGZSSDL);
+            geneMonthOrYearLoss(resultList, dayGzPoint,monthGzPoint,firstDayOfMonth);
+            geneMonthOrYearLoss(resultList, dayGzPoint,yearGzPoint,firstDayOfYear);
+            //故障受累
+            Windturbinetestingpointnew dayGzslPoint = windturbinetestingpointnewMap.get(Contant.WTRSZSSDL);
+            Windturbinetestingpointnew monthGzslPoint = windturbinetestingpointnewMap.get(Contant.WTYSZSSDL);
+            Windturbinetestingpointnew yearGzslPoint = windturbinetestingpointnewMap.get(Contant.WTNSZSSDL);
+            geneMonthOrYearLoss(resultList, dayGzslPoint,monthGzslPoint,firstDayOfMonth);
+            geneMonthOrYearLoss(resultList, dayGzslPoint,yearGzslPoint,firstDayOfYear);
+            //维护
+            Windturbinetestingpointnew dayWhPoint = windturbinetestingpointnewMap.get(Contant.WTRJXSSDL);
+            Windturbinetestingpointnew monthWhPoint = windturbinetestingpointnewMap.get(Contant.WTYJXSSDL);
+            Windturbinetestingpointnew yearWhPoint = windturbinetestingpointnewMap.get(Contant.WTNJXSSDL);
+            geneMonthOrYearLoss(resultList, dayWhPoint,monthWhPoint,firstDayOfMonth);
+            geneMonthOrYearLoss(resultList, dayWhPoint,yearWhPoint,firstDayOfYear);
+            //维护受累
+            Windturbinetestingpointnew dayWhslPoint = windturbinetestingpointnewMap.get(Contant.WTRLZSSDL);
+            Windturbinetestingpointnew monthWhslPoint = windturbinetestingpointnewMap.get(Contant.WTYLZSSDL);
+            Windturbinetestingpointnew yearWhslPoint = windturbinetestingpointnewMap.get(Contant.WTNLZSSDL);
+            geneMonthOrYearLoss(resultList, dayWhslPoint,monthWhslPoint,firstDayOfMonth);
+            geneMonthOrYearLoss(resultList, dayWhslPoint,yearWhslPoint,firstDayOfYear);
+            //限电降出力
+            Windturbinetestingpointnew dayXdjclPoint = windturbinetestingpointnewMap.get(Contant.WTRQFSSDL);
+            Windturbinetestingpointnew monthXdjclPoint = windturbinetestingpointnewMap.get(Contant.WTYQFSSDL);
+            Windturbinetestingpointnew yearXdjclPoint = windturbinetestingpointnewMap.get(Contant.WTNQFSSDL);
+            geneMonthOrYearLoss(resultList, dayXdjclPoint,monthXdjclPoint,firstDayOfMonth);
+            geneMonthOrYearLoss(resultList, dayXdjclPoint,yearXdjclPoint,firstDayOfYear);
+            //限电停机
+            Windturbinetestingpointnew dayXdtjPoint = windturbinetestingpointnewMap.get(Contant.WTRXDSSDL);
+            Windturbinetestingpointnew monthXdtjPoint = windturbinetestingpointnewMap.get(Contant.WTYXDSSDL);
+            Windturbinetestingpointnew yearXdtjPoint = windturbinetestingpointnewMap.get(Contant.WTNXDSSDL);
+            geneMonthOrYearLoss(resultList, dayXdtjPoint,monthXdtjPoint,firstDayOfMonth);
+            geneMonthOrYearLoss(resultList, dayXdtjPoint,yearXdtjPoint,firstDayOfYear);
+            //电网受累
+            Windturbinetestingpointnew dayDwslPoint = windturbinetestingpointnewMap.get(Contant.WTRWZSSDL);
+            Windturbinetestingpointnew monthDwslPoint = windturbinetestingpointnewMap.get(Contant.WTYWZSSDL);
+            Windturbinetestingpointnew yearDwslPoint = windturbinetestingpointnewMap.get(Contant.WTNWZSSDL);
+            geneMonthOrYearLoss(resultList, dayDwslPoint,monthDwslPoint,firstDayOfMonth);
+            geneMonthOrYearLoss(resultList, dayDwslPoint,yearDwslPoint,firstDayOfYear);
+            //环境受累
+            Windturbinetestingpointnew dayHjslPoint = windturbinetestingpointnewMap.get(Contant.WTRTZSSDL);
+            Windturbinetestingpointnew monthHjslPoint = windturbinetestingpointnewMap.get(Contant.WTYTZSSDL);
+            Windturbinetestingpointnew yearHjslPoint = windturbinetestingpointnewMap.get(Contant.WTNTZSSDL);
+            geneMonthOrYearLoss(resultList, dayHjslPoint,monthHjslPoint,firstDayOfMonth);
+            geneMonthOrYearLoss(resultList, dayHjslPoint,yearHjslPoint,firstDayOfYear);
+        });
+        edosUtil.sendMultiPoint(resultList);
+    }
+
+
+
+    private void geneMonthOrYearLoss(List<PointData> resultList,Windturbinetestingpointnew dayPoint,Windturbinetestingpointnew monthPoint,boolean firstDayOfMonthOrYear) {
+        Double dayValue = 0.0;
+        Double yestodayMonth = 0.0;
+        try {
+            if (!firstDayOfMonthOrYear){
+                yestodayMonth = edosUtil.getSectionData(monthPoint, DateUtils.getYesterdayEnd().getTime()).getPointValueInDouble();
+            }
+            dayValue = edosUtil.getSectionData(dayPoint,tomorrow.getTime()).getPointValueInDouble();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Double monthValue = dayValue + yestodayMonth;
+        resultList.add(createWtPointData(monthPoint,monthValue));
+    }
+
+    private void generalLoss(List<PointData> ztmxDatasSnap, List<PointData> bzglDatasSnap, List<PointData> zsglDatasSnap, List<PointData> powerDatasSnap,Double statusValue,List<PointData> resultList,Windturbinetestingpointnew point) {
+        List<PointData> pointDataList = ztmxDatasSnap.stream().filter(zt -> zt.getPointValueInDouble() == statusValue).collect(Collectors.toList());
+        Double bzss = 0.0;
+        Double zsss = 0.0;
+        if (statusValue == 2.0 || statusValue == 3.0 || statusValue == 4.0){
+            for (int i=0;i<pointDataList.size();i++){
+                double bzgl = bzglDatasSnap.get(i).getPointValueInDouble();
+                double zsgl = zsglDatasSnap.get(i).getPointValueInDouble();
+                double power = powerDatasSnap.get(i).getPointValueInDouble();
+                bzss += (bzgl-power);
+                zsss += (zsgl-power);
+            }
+        }else {
+            for (int i=0;i<pointDataList.size();i++){
+                double bzgl = bzglDatasSnap.get(i).getPointValueInDouble();
+                double zsgl = zsglDatasSnap.get(i).getPointValueInDouble();
+                bzss += bzgl;
+                zsss += zsgl;
+            }
+        }
+        bzss = bzss /60;
+        zsss = zsss/60;
+        //待有历史改为用自算损失
+        PointData wtPointData = createWtPointData(point, bzss);
+        resultList.add(wtPointData);
+    }
+
+
+    private PointData createWtPointData(Windturbinetestingpointnew fjfdl, Double rfdl) {
+        PointData pointData = new PointData();
+        pointData.setEdnaId(fjfdl.getCode());
+        pointData.setPointName(fjfdl.getName());
+        pointData.setPointTime(currentDate.getTime());
+        pointData.setPointValueInDouble(rfdl);
+        pointData.setPointValue(String.valueOf(rfdl));
+        return pointData;
+    }
+}

+ 93 - 82
realtime/generation-service/src/main/java/com/gyee/generation/service/GenerationService.java

@@ -1,7 +1,6 @@
 package com.gyee.generation.service;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.gyee.benchmarkinghistroy.util.realtimesource.IEdosUtil;
 import com.gyee.common.contant.Contant;
 import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
@@ -10,6 +9,7 @@ import com.gyee.common.util.DoubleUtils;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
 import com.gyee.generation.service.auto.IMeterpointvalueService;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.stereotype.Service;
@@ -53,12 +53,13 @@ public class GenerationService {
         Date monthFirstZero = DateUtils.getMonthFirstZero();
         Date yearFirstZero = DateUtils.getYearFirstZero();
         Date currentDate = DateUtils.getCurrentDate();
+        Date tomorrow = DateUtils.addDays(samedayZero,1);
 
         lines.stream().forEach(line->{
             Map<String, Windpowerstationpointnew> linemap = linepointmap.get(line.getId());
             //线路发电量
             Optional<Meterpoint> fdlOptional = meterpoints.stream().filter(me -> me.getLineid().equals(line.getId()) &&  me.getUniformcode().equals("ZXYG") && me.getMetertype().equals("进线") && me.getMetersort().equals("主")).findFirst();
-            computeFdl(fdlList, samedayZero, monthFirstZero, yearFirstZero, currentDate, linemap, fdlOptional);
+            computeFdl(fdlList, tomorrow,samedayZero, monthFirstZero, yearFirstZero, currentDate, linemap, fdlOptional);
         });
         wpls.stream().forEach(wp->{
             Map<String, Windpowerstationpointnew> wpmap = wppointmap.get(wp.getId());
@@ -92,23 +93,31 @@ public class GenerationService {
                     Map<String, Windpowerstationpointnew> linemap = linepointmap.get(line.getId());
                     //线路发电量
                     Optional<Meterpoint> fdlOptional = meterpoints.stream().filter(me -> me.getLineid().equals(line.getId()) &&   me.getUniformcode().equals("ZXYG") && me.getMetertype().equals("进线") && me.getMetersort().equals("主")).findFirst();
-                    lineFdl(resultList, samedayZero, monthFirstZero, yearFirstZero, currentDate, qcrfdl, qcyfdl, qcnfdl, linemap, fdlOptional);
+                    lineFdl(resultList,tomorrow, samedayZero, monthFirstZero, yearFirstZero, currentDate, qcrfdl, qcyfdl, qcnfdl, linemap, fdlOptional);
                     log.info(line.getName()+"电计量电量计算完毕!");
                     //线路上网电量
-                    Optional<Meterpoint> swdlOptional = meterpoints.stream().filter(me -> me.getLineid().equals(line.getId()) &&   me.getUniformcode().equals("ZXYG") && me.getMetertype().equals("出线") && me.getMetersort().equals("主") && me.getLineid().contains(line.getId())).findFirst();
-                    lineOrtherdl(fdlList,resultList, linepointmap, samedayZero, monthFirstZero, yearFirstZero, currentDate, qcrswdl, qcyswdl, qcnswdl, line, linemap, swdlOptional,Contant.SWDLB,Contant.SWDLY,Contant.SWDLN);
+                    Optional<Meterpoint> swdlOptional= null;
+                    Optional<Meterpoint> gwdlOptional=null;
+                    if (wp.getId().equals("GJY_FDC")){
+                        swdlOptional = meterpoints.stream().filter(me ->   me.getUniformcode().equals("ZXYG") && me.getMetertype().equals("主变高压侧") && me.getMetersort().equals("主") && me.getLineid().contains(line.getId())).findFirst();
+                        gwdlOptional = meterpoints.stream().filter(me ->  me.getUniformcode().equals("FXYG") && me.getMetertype().equals("主变高压侧") && me.getMetersort().equals("主") && me.getLineid().contains(line.getId())).findFirst();
+                    }else{
+                        swdlOptional = meterpoints.stream().filter(me ->   me.getUniformcode().equals("ZXYG") && me.getMetertype().equals("出线") && me.getMetersort().equals("主") && me.getLineid().contains(line.getId())).findFirst();
+                        gwdlOptional = meterpoints.stream().filter(me ->  me.getUniformcode().equals("FXYG") && me.getMetertype().equals("出线") && me.getMetersort().equals("主") && me.getLineid().contains(line.getId())).findFirst();
+                    }
+                     lineOrtherdl(fdlList,tomorrow,resultList, linepointmap, samedayZero, monthFirstZero, yearFirstZero, currentDate, qcrswdl, qcyswdl, qcnswdl, line, linemap, swdlOptional,Contant.SWDLB,Contant.SWDLY,Contant.SWDLN);
                     log.info(line.getName()+"上网电量计算完毕!");
                     //线路购网电量
-                    Optional<Meterpoint> gwdlOptional = meterpoints.stream().filter(me -> me.getLineid().equals(line.getId()) &&   me.getUniformcode().equals("FXYG") && me.getMetertype().equals("出线") && me.getMetersort().equals("主") && me.getLineid().contains(line.getId())).findFirst();
-                    lineOrtherdl(fdlList,resultList, linepointmap, samedayZero, monthFirstZero, yearFirstZero, currentDate, qcrgwdl, qcygwdl, qcngwdl, line, linemap, gwdlOptional,Contant.GWGWB,Contant.GWGWY,Contant.GWGWN);
+                    lineOrtherdl(fdlList,tomorrow,resultList, linepointmap, samedayZero, monthFirstZero, yearFirstZero, currentDate, qcrgwdl, qcygwdl, qcngwdl, line, linemap, gwdlOptional,Contant.GWGWB,Contant.GWGWY,Contant.GWGWN);
                     log.info(line.getName()+"工网购网电量计算完毕!");
                     //厂用电量
-                    Optional<Meterpoint> zybOptional = meterpoints.stream().filter(me -> me.getLineid().equals(line.getId()) &&   me.getUniformcode().equals("ZXYG") && me.getMetertype().equals("站用变") && me.getMetersort().equals("主") && me.getLineid().contains(line.getId())).findFirst();
-                    lineOrtherdl(fdlList,resultList, linepointmap, samedayZero, monthFirstZero, yearFirstZero, currentDate, qcrcydl, qcycydl, qcncydl, line, linemap, zybOptional,Contant.CYDLB,Contant.CYDLY,Contant.CYDLN);
+                    Optional<Meterpoint> zybOptional = meterpoints.stream().filter(me->   me.getUniformcode().equals("ZXYG") && me.getMetertype().equals("站用变") && me.getMetersort().equals("主") && me.getLineid().contains(line.getId())).findFirst();
+                    lineOrtherdl(fdlList,tomorrow,resultList, linepointmap, samedayZero, monthFirstZero, yearFirstZero, currentDate, qcrcydl, qcycydl, qcncydl, line, linemap, zybOptional,Contant.CYDLB,Contant.CYDLY,Contant.CYDLN);
                     log.info(line.getName()+"场用电量计算完毕!");
                     //农网购网电量
                     setZero(resultList,currentDate,linemap,Contant.NWGWB,Contant.NWGWY,Contant.NWGWN);
                     log.info(line.getName()+"农网购网电量计算完毕!");
+
                 });
                 //期次发电量
                 projectFdl(resultList, currentDate, fcrfdl, fcyfdl, fcnfdl, projectmap, qcrfdl, qcyfdl, qcnfdl);
@@ -149,52 +158,38 @@ public class GenerationService {
 
     /**
      * 存储meterpointvalue表
+     * 实时+0点算前一天
      */
-    public void saveMeterpointValue(String beginDate,String endDate){
+    public void saveMeterpointValueRealtime(String beginDate,String endDate){
         List<Meterpoint> meterpoints = CacheContext.meterpoints;
-        Date samedayZero = DateUtils.getSamedayZero();
-        Date monthFirstZero = DateUtils.getMonthFirstZero();
-        Date yearFirstZero = DateUtils.getYearFirstZero();
-        Date currentDate = DateUtils.getCurrentDate();
-        int hour = DateUtils.getCurrentHour();
-
         List<String> days = DateUtils.getDays(beginDate, endDate);
-
         days.stream().forEach(day->{
+            Date samedayZero = DateUtils.getSamedayZero(day);
+            Date monthFirstZero = DateUtils.getMonthFirstZero(day);
+            Date yearFirstZero = DateUtils.getYearFirstZero(day);
+            Date date = DateUtils.addDays(samedayZero, 1);
             List<Meterpointvalue> resultList = new ArrayList<>();
-            Date date = DateUtils.parseDate(day);
             QueryWrapper<Meterpointvalue> qw = new QueryWrapper();
             qw.eq("recorddate",date);
-//            meterpointvalueService.remove(qw);
+            meterpointvalueService.remove(qw);
             meterpoints.stream().forEach(meterpoint -> {
                 String meterid = meterpoint.getId();
                 Double magnification = meterpoint.getMagnification();
                 Double xs = meterpoint.getXs();
                 Meterpointvalue meterpointvalue = new Meterpointvalue();
-                Date date1 = DateUtils.addDays(date, 1);
-                meterpointvalue.setRecorddate(date1);
+
+                meterpointvalue.setRecorddate(date);
                 meterpointvalue.setMeterid(meterpoint.getId());
                 Double real = 0.0;
                 Double sameday = 0.0;
                 Double month = 0.0;
                 Double year = 0.0;
                 try {
-                    Optional<PointData> first = edosUtil.getHistoryDatasSnap(meterid, date1.getTime() / 1000, date1.getTime() / 1000, 1l, null).stream().findFirst();
-                    if (first.isPresent()){
-                        real = first.get().getPointValueInDouble();
-                    }
-                    Optional<PointData> dayFirst = edosUtil.getHistoryDatasSnap(meterid, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, null).stream().findFirst();
-                    if (dayFirst.isPresent()){
-                        sameday = dayFirst.get().getPointValueInDouble();
-                    }
-                    Optional<PointData> monthFirst = edosUtil.getHistoryDatasSnap(meterid, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
-                    if (monthFirst.isPresent()){
-                        month = monthFirst.get().getPointValueInDouble();
-                    }
-                    Optional<PointData> yearFirst = edosUtil.getHistoryDatasSnap(meterid, yearFirstZero.getTime() / 1000, yearFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
-                    if (yearFirst.isPresent()){
-                        year = yearFirst.get().getPointValueInDouble();
-                    }
+                    real = edosUtil.getSectionData(meterid,date.getTime()).getPointValueInDouble();
+                    sameday = edosUtil.getSectionData(meterid,samedayZero.getTime()).getPointValueInDouble();
+                    month = edosUtil.getSectionData(meterid,monthFirstZero.getTime()).getPointValueInDouble();
+                    year = edosUtil.getSectionData(meterid,yearFirstZero.getTime()).getPointValueInDouble();
+
                 } catch (Exception e) {
                     e.printStackTrace();
                 }
@@ -206,9 +201,9 @@ public class GenerationService {
                 meterpointvalue.setDay4(DoubleUtils.keepPrecision(sameday/xs,4));
                 meterpointvalue.setNow(DoubleUtils.keepPrecision(real/xs,2));
                 meterpointvalue.setNow4(DoubleUtils.keepPrecision(real/xs,4));
-                Double yearvalue = (real - year) * magnification;
-                Double monthvalue = (real - month) * magnification;
-                Double dayvalue = (real - sameday) * magnification;
+                Double yearvalue = (real/xs - year/xs) * magnification;
+                Double monthvalue = (real/xs - month/xs) * magnification;
+                Double dayvalue = (real/xs - sameday/xs) * magnification;
                 meterpointvalue.setYearvalue(yearvalue);
                 meterpointvalue.setMonthvalue(monthvalue);
                 meterpointvalue.setDayvalue(dayvalue);
@@ -216,6 +211,46 @@ public class GenerationService {
             });
             meterpointvalueService.saveBatch(resultList);
         });
+
+
+
+    }
+
+    public void updateMeterpointValueHistory(String beginDate,String endDate){
+        List<Meterpointvalue> resultLsit = new ArrayList<>();
+        Map<String,Meterpoint> meterpointMap = CacheContext.meterpointMap;
+        List<String> days = DateUtils.getDays(beginDate, endDate);
+        days.stream().forEach(day->{
+            Date date = DateUtils.parseDate(beginDate);
+            Date date1 = DateUtils.addDays(date, 1);
+            Date date2= DateUtils.addDays(date1, 1);
+            QueryWrapper<Meterpointvalue> qw = new QueryWrapper<>();
+            qw.eq("recorddate",date1);
+            List<Meterpointvalue> meterpointvalues = meterpointvalueService.list(qw);
+
+            meterpointvalues.stream().forEach(meterpointvalue -> {
+                Meterpoint meterpoint = meterpointMap.get(meterpointvalue.getMeterid());
+                Double magnification = meterpoint.getMagnification();
+                Double xs = meterpoint.getXs();
+                Double real = 0.0;
+
+                try {
+                    real = edosUtil.getSectionData(meterpointvalue.getMeterid(),date1.getTime()).getPointValueInDouble();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                Double yearvalue = (real/xs - meterpointvalue.getYear4()) * magnification;
+                Double monthvalue = (real/xs - meterpointvalue.getMonth4()) * magnification;
+                Double dayvalue = (real/xs - meterpointvalue.getDay4()) * magnification;
+                meterpointvalue.setNow(DoubleUtils.keepPrecision(real,2));
+                meterpointvalue.setNow4(DoubleUtils.keepPrecision(real,4));
+                meterpointvalue.setYearvalue(yearvalue);
+                meterpointvalue.setMonthvalue(monthvalue);
+                meterpointvalue.setDayvalue(dayvalue);
+                resultLsit.add(meterpointvalue);
+            });
+            meterpointvalueService.saveOrUpdateBatch(resultLsit);
+        });
     }
 
 
@@ -320,7 +355,7 @@ public class GenerationService {
         percentageMap.put("npercentage",npercentage);
         return percentageMap;
     }
-    private void lineOrtherdl(List<PointData> fdlList,List<PointData> resultList, Map<String, Map<String, Windpowerstationpointnew>> linepointmap, Date samedayZero, Date monthFirstZero, Date yearFirstZero, Date currentDate, AtomicReference<Double> qcrswdl, AtomicReference<Double> qcyswdl, AtomicReference<Double> qcnswdl, Line line, Map<String, Windpowerstationpointnew> linemap, Optional<Meterpoint> optionalMeterpoint,String rcode,String ycode,String ncode) {
+    private void lineOrtherdl(List<PointData> fdlList,Date tomorrow,List<PointData> resultList, Map<String, Map<String, Windpowerstationpointnew>> linepointmap, Date samedayZero, Date monthFirstZero, Date yearFirstZero, Date currentDate, AtomicReference<Double> qcrswdl, AtomicReference<Double> qcyswdl, AtomicReference<Double> qcnswdl, Line line, Map<String, Windpowerstationpointnew> linemap, Optional<Meterpoint> optionalMeterpoint,String rcode,String ycode,String ncode) {
         if (optionalMeterpoint.isPresent()){
             Meterpoint swdlMeterpoint = optionalMeterpoint.get();
             //获取电量百分比,算其他电量
@@ -332,19 +367,11 @@ public class GenerationService {
             Double month = 0.0;
             Double year = 0.0;
             try {
-                real = edosUtil.getRealData(pointid).getPointValueInDouble();
-                Optional<PointData> dayFirst = edosUtil.getHistoryDatasSnap(pointid, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, null).stream().findFirst();
-                if (dayFirst.isPresent()){
-                    sameday = dayFirst.get().getPointValueInDouble();
-                }
-                Optional<PointData> monthFirst = edosUtil.getHistoryDatasSnap(pointid, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
-                if (monthFirst.isPresent()){
-                    month = monthFirst.get().getPointValueInDouble();
-                }
-                Optional<PointData> yearFirst = edosUtil.getHistoryDatasSnap(pointid, yearFirstZero.getTime() / 1000, yearFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
-                if (yearFirst.isPresent()){
-                    year = yearFirst.get().getPointValueInDouble();
-                }
+                real = edosUtil.getSectionData(pointid,tomorrow.getTime()).getPointValueInDouble();
+                sameday = edosUtil.getSectionData(pointid,samedayZero.getTime()).getPointValueInDouble();
+                month = edosUtil.getSectionData(pointid,monthFirstZero.getTime()).getPointValueInDouble();
+                year = edosUtil.getSectionData(pointid,yearFirstZero.getTime()).getPointValueInDouble();
+
                 Double magnification = optionalMeterpoint.get().getMagnification();
                 Double xs = optionalMeterpoint.get().getXs();
 
@@ -383,7 +410,7 @@ public class GenerationService {
             }
         }
     }
-    private void computeFdl(List<PointData> fdlList, Date samedayZero, Date monthFirstZero, Date yearFirstZero, Date currentDate, Map<String, Windpowerstationpointnew> linemap, Optional<Meterpoint> fdlOptional) {
+    private void computeFdl(List<PointData> fdlList, Date tomorrow,Date samedayZero, Date monthFirstZero, Date yearFirstZero, Date currentDate, Map<String, Windpowerstationpointnew> linemap, Optional<Meterpoint> fdlOptional) {
         if (fdlOptional.isPresent()){
             String pointid = fdlOptional.get().getId();
             Double real = 0.0;
@@ -391,19 +418,11 @@ public class GenerationService {
             Double month = 0.0;
             Double year = 0.0;
             try {
-                real = edosUtil.getRealData(pointid).getPointValueInDouble();
-                Optional<PointData> dayFirst = edosUtil.getHistoryDatasSnap(pointid, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, null).stream().findFirst();
-                if (dayFirst.isPresent()){
-                    sameday = dayFirst.get().getPointValueInDouble();
-                }
-                Optional<PointData> monthFirst = edosUtil.getHistoryDatasSnap(pointid, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
-                if (monthFirst.isPresent()){
-                    month = monthFirst.get().getPointValueInDouble();
-                }
-                Optional<PointData> yearFirst = edosUtil.getHistoryDatasSnap(pointid, yearFirstZero.getTime() / 1000, yearFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
-                if (yearFirst.isPresent()){
-                    year = yearFirst.get().getPointValueInDouble();
-                }
+                real = edosUtil.getSectionData(pointid,tomorrow.getTime()).getPointValueInDouble();
+                sameday = edosUtil.getSectionData(pointid,samedayZero.getTime()).getPointValueInDouble();
+                month = edosUtil.getSectionData(pointid,monthFirstZero.getTime()).getPointValueInDouble();
+                year = edosUtil.getSectionData(pointid,yearFirstZero.getTime()).getPointValueInDouble();
+
                 Double magnification = fdlOptional.get().getMagnification();
                 Double xs = fdlOptional.get().getXs();
                 double xlrfdl = (real - sameday) * magnification / xs;
@@ -439,7 +458,7 @@ public class GenerationService {
         }
     }
 
-    private void lineFdl(List<PointData> resultList, Date samedayZero, Date monthFirstZero, Date yearFirstZero, Date currentDate, AtomicReference<Double> qcrfdl, AtomicReference<Double> qcyfdl, AtomicReference<Double> qcnfdl, Map<String, Windpowerstationpointnew> linemap, Optional<Meterpoint> optionalMeterpoint) {
+    private void lineFdl(List<PointData> resultList, Date tomorrow,Date samedayZero, Date monthFirstZero, Date yearFirstZero, Date currentDate, AtomicReference<Double> qcrfdl, AtomicReference<Double> qcyfdl, AtomicReference<Double> qcnfdl, Map<String, Windpowerstationpointnew> linemap, Optional<Meterpoint> optionalMeterpoint) {
         if (optionalMeterpoint.isPresent()){
             String pointid = optionalMeterpoint.get().getId();
             Double real = 0.0;
@@ -447,19 +466,11 @@ public class GenerationService {
             Double month = 0.0;
             Double year = 0.0;
             try {
-                real = edosUtil.getRealData(pointid).getPointValueInDouble();
-                Optional<PointData> dayFirst = edosUtil.getHistoryDatasSnap(pointid, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, null).stream().findFirst();
-                if (dayFirst.isPresent()){
-                    sameday = dayFirst.get().getPointValueInDouble();
-                }
-                Optional<PointData> monthFirst = edosUtil.getHistoryDatasSnap(pointid, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
-                if (monthFirst.isPresent()){
-                    month = monthFirst.get().getPointValueInDouble();
-                }
-                Optional<PointData> yearFirst = edosUtil.getHistoryDatasSnap(pointid, yearFirstZero.getTime() / 1000, yearFirstZero.getTime() / 1000, 1l, null).stream().findFirst();
-                if (yearFirst.isPresent()){
-                    year = yearFirst.get().getPointValueInDouble();
-                }
+                real = edosUtil.getSectionData(pointid,tomorrow.getTime()).getPointValueInDouble();
+                sameday = edosUtil.getSectionData(pointid,samedayZero.getTime()).getPointValueInDouble();
+                month = edosUtil.getSectionData(pointid,monthFirstZero.getTime()).getPointValueInDouble();
+                year = edosUtil.getSectionData(pointid,yearFirstZero.getTime()).getPointValueInDouble();
+
                 Double magnification = optionalMeterpoint.get().getMagnification();
                 Double xs = optionalMeterpoint.get().getXs();
                 double xlrfdl = (real - sameday) * magnification / xs;

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

@@ -1,11 +1,11 @@
 package com.gyee.generation.service;
 
-import com.gyee.benchmarkinghistroy.util.realtimesource.IEdosUtil;
 import com.gyee.common.contant.Contant;
 import com.gyee.common.model.PointData;
 import com.gyee.common.util.DateUtils;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;

+ 7 - 3
realtime/generation-service/src/main/java/com/gyee/generation/service/StatusService.java

@@ -1,12 +1,12 @@
 package com.gyee.generation.service;
 
-import com.gyee.benchmarkinghistroy.util.realtimesource.IEdosUtil;
 import com.gyee.common.contant.Contant;
 import com.gyee.common.model.PointData;
 import com.gyee.common.model.StringUtils;
 import com.gyee.common.util.DateUtils;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
@@ -82,6 +82,7 @@ public class StatusService {
                 Map<String, Windturbinetestingpointnew> stringWindturbinetestingpointnewMap = wtpAimap.get(wt.getId());
                 Windturbinetestingpointnew ztmxPoint = stringWindturbinetestingpointnewMap.get(Contant.ZTMX);
                 Windturbinetestingpointnew fj5tPoint = stringWindturbinetestingpointnewMap.get(Contant.FJ5T);
+                Windturbinetestingpointnew ai130 = stringWindturbinetestingpointnewMap.get(Contant.AI130);
                 String[] interruption = Contant.INTERRUPTION.split(",");
                 List<String> interruptionList = new ArrayList<>();
                 Arrays.stream(interruption).forEach(i->{
@@ -100,7 +101,7 @@ public class StatusService {
                     else {
                         List<PointData> interruptionRealData = edosUtil.getRealData(interruptionList);
                         List<PointData> collect = interruptionRealData.stream().filter(i -> Math.abs(currentDate.getTime() - i.getPointTime()) / 1000 > Integer.parseInt(second)).collect(Collectors.toList());
-                        if (StringUtils.isEmpty(collect)){
+                        if (collect.size()!=interruptionRealData.size()){
                             Double ztmx = edosUtil.getRealData(ztmxPoint).getPointValueInDouble();
                             if (ztmx == 7 || ztmx == 9 || ztmx == 10 || ztmx == 11 || ztmx == 4 || ztmx == 5 ){     //手打状态
                                 mxstatus = ztmx;
@@ -150,7 +151,10 @@ public class StatusService {
                             }
                             if (mxstatus == 2){
                                 boolean isJcl = isJcl(wt, stringWindturbinetestingpointnewMap);
-                                if (isJcl){
+                                double power = edosUtil.getRealData(ai130).getPointValueInDouble();
+                                if (power<=0){
+                                    mxstatus=0.0;
+                                }else if (isJcl){
                                     mxstatus = 3.0;
                                 }
                             }

+ 17 - 11
realtime/generation-service/src/main/java/com/gyee/generation/service/TheorypowerService.java

@@ -3,7 +3,6 @@ package com.gyee.generation.service;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.gyee.benchmarkinghistroy.util.realtimesource.IEdosUtil;
 import com.gyee.common.contant.Contant;
 import com.gyee.common.model.PointData;
 import com.gyee.common.model.algorithm.PointVo;
@@ -14,6 +13,7 @@ import com.gyee.common.util.algorithm.LineBuild;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
 import com.gyee.generation.service.auto.IWindturbinepowerService;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
 import com.gyee.generation.util.redis.RedisService;
 import org.springframework.stereotype.Service;
 
@@ -85,11 +85,10 @@ public class TheorypowerService {
                     Windpowerstationpointnew linebzglpoint = linepointnewMap.get(Contant.ZBZGL);
                     Windpowerstationpointnew linezsglpoint = linepointnewMap.get(Contant.ZZSGL);
                     linewtmap.get(line.getId()).stream().forEach(wt->{
-//                        Map<Double, Double> zsglMap = zzsglMap.get(wt.getId());
-                        redisService.select(1);
-                        String s = redisService.get(wt.getId());
-                        Map<Double, Double> zsglMap = JSONObject.parseObject(s, new TypeReference<Map<Double, Double>>() {
+                        String zzsglString = redisService.get("ZZSGL");
+                        Map<String,Map<Double, Double>> zszglMap = JSONObject.parseObject(zzsglString, new TypeReference<Map<String,Map<Double,Double>>>() {
                         });
+                        Map<Double, Double> zsglMap = zszglMap.get(wt.getId());
                         Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
                         Windturbinetestingpointnew speedPointnew = windturbinetestingpointnewMap.get(Contant.AI022);
                         Windturbinetestingpointnew wtzsgl = windturbinetestingpointnewMap.get(Contant.ZSGL);
@@ -168,13 +167,19 @@ public class TheorypowerService {
             Windturbinetestingpointnew speedPoint = windturbinetestingpointnewMap.get(Contant.AI022);
             Windturbinetestingpointnew powerPoint = windturbinetestingpointnewMap.get(Contant.AI130);
             List<PointVo> pointVoList = new ArrayList<>();
+            List<PointVo> tempList = new ArrayList<>();
             try {
                 List<PointData> speedpoints =  edosUtil.getHistoryDatasSnap(speedPoint, begin.getTime()/1000 , date.getTime()/1000 , null, 3600l);
                 List<PointData> powerpoints = edosUtil.getHistoryDatasSnap(powerPoint, begin.getTime()/1000 , date.getTime()/1000 , null, 3600l);
-                Collections.sort(speedpoints, Comparator.comparing(PointData::getPointValueInDouble));
-                Collections.sort(powerpoints, Comparator.comparing(PointData::getPointValueInDouble));
-                double[] speeds = speedpoints.stream().map(i -> i.getPointValueInDouble()).mapToDouble(Double::doubleValue).toArray();
-                double[] powers = powerpoints.stream().map(i -> i.getPointValueInDouble()).mapToDouble(Double::doubleValue).toArray();
+                for (int x = 0;x<speedpoints.size();x++){
+                    PointVo vo = new PointVo();
+                    vo.setX(speedpoints.get(x).getPointValueInDouble());
+                    vo.setY(powerpoints.get(x).getPointValueInDouble());
+                    tempList.add(vo);
+                }
+                Collections.sort(tempList.stream().filter(i->i.getY()>=0).collect(Collectors.toList()), Comparator.comparing(PointVo::getX));
+                double[] speeds = tempList.stream().map(i -> i.getX()).mapToDouble(Double::doubleValue).toArray();
+                double[] powers = tempList.stream().map(i -> i.getY()).mapToDouble(Double::doubleValue).toArray();
                 pointVoList = LineBuild.buildLine(speeds, powers, speeds.length, 20, 0.01);
             } catch (Exception e) {
                 e.printStackTrace();
@@ -190,15 +195,16 @@ public class TheorypowerService {
             });
         });
         windturbinepowerService.saveBatch(resultList);
+        Map<String,Map<Double,Double>> zzsglMap = new HashMap<>();
         wtls.stream().forEach(wt->{
             List<Windturbinepower> windturbinepowers = resultList.stream().filter(p -> p.getWindturbineid().equals(wt.getId())).collect(Collectors.toList());
             Map<Double,Double> doubleMap = new HashMap<>();
             windturbinepowers.stream().forEach(w->{
                 doubleMap.put(w.getSpeed(),w.getTheorypower());
             });
-            redisService.select(1);
-            redisService.set(wt.getId(), JSONObject.toJSONString(doubleMap));
+            zzsglMap.put(wt.getId(),doubleMap);
         });
+        redisService.set("ZZSGL", JSONObject.toJSONString(zzsglMap));
 
     }
 

+ 18 - 8
realtime/generation-service/src/main/java/com/gyee/generation/task/SaticScheduleTask.java

@@ -32,6 +32,8 @@ public class SaticScheduleTask {
     private RealtimeSpeedPowerService realtimeSpeedPowerService;
     @Resource
     private TheorypowerService theorypowerService;
+    @Resource
+    private FiveLossesService fiveLossesService;
     //3.添加定时任务
     /**
      * 电计量实时计算计算(电量,上网,购网,场用)
@@ -39,19 +41,15 @@ public class SaticScheduleTask {
      */
 
     @XxlJob("electricityMetering-realtime")
-    public void configureTasks1()  {
+    public void electricityMetering()  {
 
 
         XxlJobHelper.log("电计量实时调度程序执行开始!........");
-
         try {
-            System.out.println(11111111);
-//            generationService.saveGenerationDatas();
+            generationService.saveGenerationDatas();
         } catch (Exception e) {
-
             e.printStackTrace();
         }
-
         XxlJobHelper.log("电计量实时调度任务处理完成!........");
     }
 
@@ -65,7 +63,7 @@ public class SaticScheduleTask {
         XxlJobHelper.log("电计量历史1调度程序执行开始!........");
         String date = DateUtils.toDate1(DateUtils.getCurrentDate());
         try {
-            generationService.saveMeterpointValue(date,date);
+            generationService.saveMeterpointValueRealtime(date,date);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -82,7 +80,7 @@ public class SaticScheduleTask {
         XxlJobHelper.log("电计量历史2调度程序执行开始!........");
         String yesterdayStr = DateUtils.getYesterdayStr("yyyy-MM-dd");
         try {
-            generationService.saveMeterpointValue(yesterdayStr,yesterdayStr);
+            generationService.saveMeterpointValueRealtime(yesterdayStr,yesterdayStr);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -157,6 +155,18 @@ public class SaticScheduleTask {
 
     }
 
+    /**
+     * 计算损失电量
+     * 1小时一次(*:20)
+     * @throws Exception
+     */
+    @XxlJob("losses-realtime")
+    public void losses() throws Exception {
+            XxlJobHelper.log("损失电量调度程序执行开始!........");
+            fiveLossesService.lossesReal();
+            XxlJobHelper.log("损失电量调度程序执行完成!........");
+    }
+
 
 
 }

+ 104 - 57
realtime/generation-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtil.java

@@ -3,7 +3,6 @@ package com.gyee.generation.util.realtimesource;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.gyee.benchmarkinghistroy.util.realtimesource.IEdosUtil;
 import com.gyee.common.model.DNAStatVal;
 import com.gyee.common.model.DNAVal;
 import com.gyee.common.model.PointData;
@@ -29,8 +28,6 @@ public class EdosUtil implements IEdosUtil {
     private RestTemplate restTemplate =new RestTemplate();
     @Value("${db.url}")
     private String baseURL;
-//    private static String baseURL = "http://10.155.32.4:8011/ts";
-//    private static String baseURL = "http://10.65.79.30:8019/ts";
     @Override
     public PointData getRealData(Windpowerstationpointnew point) throws Exception {
         try {
@@ -70,6 +67,57 @@ public class EdosUtil implements IEdosUtil {
         }
     }
 
+    @Override
+    public PointData getSectionData(String point, Long date) throws Exception {
+        String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point + "&ts=" + date;
+
+        ResponseEntity<JSONObject> resp = restTemplate.getForEntity(rawUrl, JSONObject.class);
+        JSONObject jsonArray = resp.getBody();
+        if (StringUtils.isNotEmpty(jsonArray)){
+            List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
+            if (list.size() > 0)
+                return list.get(0);
+            else
+                return ErrorRequest.RequestError(point);
+        } else {
+            return ErrorRequest.RequestError(point);
+        }
+    }
+
+    @Override
+    public PointData getSectionData(Windpowerstationpointnew point, Long date) throws Exception {
+        String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getCode() + "&ts=" + date;
+
+        ResponseEntity<JSONObject> resp = restTemplate.getForEntity(rawUrl, JSONObject.class);
+        JSONObject jsonArray = resp.getBody();
+        if (StringUtils.isNotEmpty(jsonArray)){
+            List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
+            if (list.size() > 0)
+                return list.get(0);
+            else
+                return ErrorRequest.RequestError(point.getCode());
+        } else {
+            return ErrorRequest.RequestError(point.getCode());
+        }
+    }
+
+    @Override
+    public PointData getSectionData(Windturbinetestingpointnew point, Long date) throws Exception {
+        String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getCode() + "&ts=" + date;
+
+        ResponseEntity<JSONObject> resp = restTemplate.getForEntity(rawUrl, JSONObject.class);
+        JSONObject jsonArray = resp.getBody();
+        if (StringUtils.isNotEmpty(jsonArray)){
+            List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
+            if (list.size() > 0)
+                return list.get(0);
+            else
+                return ErrorRequest.RequestError(point.getCode());
+        } else {
+            return ErrorRequest.RequestError(point.getCode());
+        }
+    }
+
 
     @Override
     public List<PointData> getHistoryDatasSnap(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
@@ -744,60 +792,59 @@ public class EdosUtil implements IEdosUtil {
 	            if (jsonArray != null) {
 	                List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray,tagName.get());
 	                List<PointData> resultList = new ArrayList<>();
-	                return list;
-//
-//	                if(list.isEmpty())
-//	                {
-//
-//	                	getHistsnapSameTiem(pointid, beginDate, pried, resultList);
-//	                }else
-//	                {
-//	                	 for (PointData snapItem : list) {
-//	 	                    long subTime = snapItem.getPointTime() - pried;
-//	 	                    //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
-//	 	                    // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
-//	 	                    // 则代表该时间节点快照有效,否则为0
-//	 	                    String rawUrl = baseURL + "/history/section?null=0&tagNames=" +pointid+ "&ts=" + snapItem.getPointTime() + "000";
-//	 	                    ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
-//	 	                    JSONObject jsonObjectSection = sectionResp.getBody();
-//
-//	 	                    if (jsonObjectSection != null) {
-//	 	                        List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
-//	 	                        if (sectionlist.size() > 0) {
-//	 	                            if(sectionlist.get(0).getPointTime()>=subTime&&sectionlist.get(0).getPointTime()<=snapItem.getPointTime()){
-//	 	                                resultList.add(snapItem);
-//	 	                            }
-//	 	                            else{
-//	 	                                PointData data = new PointData();
-//	 	                                data.setEdnaId(pointid);
-//	 	                                data.setPointTime(snapItem.getPointTime());
-//	 	                                data.setPointValue("0");
-//	 	                                data.setPointName("1");
-//	 	                                data.setPointValueInDouble(0.0);
-//	 	                                resultList.add(data);
-//	 	                            }
-//	 	                        } else {
-//	 	                            PointData data = new PointData();
-//	 	                            data.setEdnaId(pointid);
-//	 	                            data.setPointTime(snapItem.getPointTime());
-//	 	                            data.setPointValue("0");
-//	 	                            data.setPointName("1");
-//	 	                            data.setPointValueInDouble(0.0);
-//	 	                            resultList.add(data);
-//	 	                        }
-//	 	                    } else {
-//	 	                        PointData data = new PointData();
-//	 	                        data.setEdnaId(pointid);
-//	 	                        data.setPointTime(snapItem.getPointTime());
-//	 	                        data.setPointValue("0");
-//	 	                        data.setPointName("1");
-//	 	                        data.setPointValueInDouble(0.0);
-//	 	                        resultList.add(data);
-//	 	                    }
-//	 	                }
-//	                }
-//
-//	                return resultList;
+
+	                if(list.isEmpty())
+	                {
+
+	                	getHistsnapSameTiem(pointid, beginDate, pried, resultList);
+	                }else
+	                {
+	                	 for (PointData snapItem : list) {
+	 	                    long subTime = snapItem.getPointTime() - pried;
+	 	                    //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
+	 	                    // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
+	 	                    // 则代表该时间节点快照有效,否则为0
+	 	                    String rawUrl = baseURL + "/history/section?null=0&tagNames=" +pointid+ "&ts=" + snapItem.getPointTime() + "000";
+	 	                    ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
+	 	                    JSONObject jsonObjectSection = sectionResp.getBody();
+
+	 	                    if (jsonObjectSection != null) {
+	 	                        List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
+	 	                        if (sectionlist.size() > 0) {
+	 	                            if(sectionlist.get(0).getPointTime()>=subTime&&sectionlist.get(0).getPointTime()<=snapItem.getPointTime()){
+	 	                                resultList.add(snapItem);
+	 	                            }
+	 	                            else{
+	 	                                PointData data = new PointData();
+	 	                                data.setEdnaId(pointid);
+	 	                                data.setPointTime(snapItem.getPointTime());
+	 	                                data.setPointValue("0");
+	 	                                data.setPointName("1");
+	 	                                data.setPointValueInDouble(0.0);
+	 	                                resultList.add(data);
+	 	                            }
+	 	                        } else {
+	 	                            PointData data = new PointData();
+	 	                            data.setEdnaId(pointid);
+	 	                            data.setPointTime(snapItem.getPointTime());
+	 	                            data.setPointValue("0");
+	 	                            data.setPointName("1");
+	 	                            data.setPointValueInDouble(0.0);
+	 	                            resultList.add(data);
+	 	                        }
+	 	                    } else {
+	 	                        PointData data = new PointData();
+	 	                        data.setEdnaId(pointid);
+	 	                        data.setPointTime(snapItem.getPointTime());
+	 	                        data.setPointValue("0");
+	 	                        data.setPointName("1");
+	 	                        data.setPointValueInDouble(0.0);
+	 	                        resultList.add(data);
+	 	                    }
+	 	                }
+	                }
+
+	                return resultList;
 	            } else {
 	                return ErrorRequest.RequestListError(pointid);
 	            }

+ 30 - 1
realtime/generation-service/src/main/java/com/gyee/generation/util/realtimesource/IEdosUtil.java

@@ -1,4 +1,4 @@
-package com.gyee.benchmarkinghistroy.util.realtimesource;
+package com.gyee.generation.util.realtimesource;
 
 
 import com.gyee.common.model.DNAStatVal;
@@ -21,6 +21,35 @@ public interface IEdosUtil {
 	 */
     public PointData getRealData(Windpowerstationpointnew point) throws Exception;
 
+
+    /**
+     * 通过风场测点获得测点切面数据
+     * @param point 只是用了code字段,作为唯一标识
+     * @param date 时间
+     * @return
+     * @throws Exception
+     */
+    public PointData getSectionData(String point,Long date) throws Exception;
+
+
+    /**
+     * 通过风场测点获得测点切面数据
+     * @param point 只是用了code字段,作为唯一标识
+     * @param date 时间
+     * @return
+     * @throws Exception
+     */
+    public PointData getSectionData(Windpowerstationpointnew point,Long date) throws Exception;
+
+    /**
+     * 通过风机测点获得测点切面数据
+     * @param point 只是用了code字段,作为唯一标识
+     * @param date 时间
+     * @return
+     * @throws Exception
+     */
+    public PointData getSectionData(Windturbinetestingpointnew point,Long date) throws Exception;
+
     /**
      * 通过风场测点获得测点历史快照数据
      * @param point 只是用了code字段,作为唯一标识

+ 2 - 0
realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisService.java

@@ -10,6 +10,8 @@ public interface RedisService {
      */
     boolean set(String key, String value);
 
+
+
     /**
      * get获取数据
      * @param key

+ 2 - 1
realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisServiceImpl.java

@@ -19,7 +19,7 @@ public class RedisServiceImpl implements RedisService {
     private RedisTemplate<String, ?> redisTemplate;
 
     @Override
-    public boolean set(final String key, final String value) {
+    public boolean set(final String key, final String value) {;
         boolean result = redisTemplate.execute(new RedisCallback<Boolean>() {
             @Override
             public Boolean doInRedis(RedisConnection connection) throws DataAccessException {
@@ -31,6 +31,7 @@ public class RedisServiceImpl implements RedisService {
         return result;
     }
 
+
     @Override
     public String get(final String key) {
         String result = redisTemplate.execute(new RedisCallback<String>() {

+ 13 - 3
realtime/generation-service/src/test/java/com/gyee/generation/GenerationTest.java

@@ -7,6 +7,7 @@ import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.Windturbinetestingpointnew;
 import com.gyee.generation.service.*;
 import com.gyee.generation.util.realtimesource.EdosUtil;
+import com.gyee.generation.util.redis.RedisService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -39,15 +40,20 @@ public class GenerationTest {
     private TheorypowerService theorypowerService;
     @Resource
     private EdosUtil edosUtil;
+    @Resource
+    private RedisService redisService;
+    @Resource
+    private FiveLossesService fiveLossesService;
     @Test
     public void test1() throws Exception {
-//        generationService.saveMeterpointValue("2022-03-25","2022-03-25");
 //        averageAndGeneratingService.saveAvespeedAndAvepowerAndScada();
 //        statusService.calculateStatus();
 //        realtimeSpeedPowerService.calculateRealtimeSpeedPower();
-
+//        generationService.saveMeterpointValueRealtime();
 //        theorypowerService.fittingPower();
-        theorypowerService.theropower();
+//        theorypowerService.theropower();
+//        averageAndGeneratingService.saveAvespeedAndAvepowerAndScada();
+        fiveLossesService.lossesReal();
     }
 
 
@@ -71,4 +77,8 @@ public class GenerationTest {
 
         List<PointVo> pointVoList = LineBuild.buildLine(speeds, powers, speeds.length, 20, 0.01);
     }
+
+    @Test
+    public void test3() throws Exception {
+    }
 }