Browse Source

Merge remote-tracking branch 'origin/master'

wangchangsheng 2 years ago
parent
commit
d56d39f85b
21 changed files with 2412 additions and 1192 deletions
  1. 11 1
      realtime/generationXK-service/pom.xml
  2. 8 9
      realtime/generationXK-service/src/main/java/com/gyee/generation/GenerationMain.java
  3. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java
  4. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java
  5. 5 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo5Service.java
  6. 1 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfoDayTopService.java
  7. 29 33
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/GoodnessOfFitService.java
  8. 70 72
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPutService.java
  9. 72 69
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitEventService.java
  10. 40 677
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitService.java
  11. 1600 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeService.java
  12. 172 145
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingService.java
  13. 119 163
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownService.java
  14. 5 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/initialpoint/InitialPointGoldenXkByEqService.java
  15. 264 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/SaticSchedulePgTask.java
  16. 8 8
      realtime/generationXK-service/src/main/resources/application-xk.yml
  17. 1 1
      realtime/generationXK-service/src/main/resources/application.yml
  18. 0 6
      web/backmanagerconfig/src/main/java/com/gyee/backconfig/config/CacheContext.java
  19. 2 0
      web/backmanagerconfig/src/main/java/com/gyee/backconfig/controller/NewtreeController.java
  20. 1 1
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/WindpowerstationPGService.java
  21. 2 2
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/websocket/WpInfoPushService.java

+ 11 - 1
realtime/generationXK-service/pom.xml

@@ -14,7 +14,11 @@
 
 
     <dependencies>
-
+        <dependency>
+            <groupId>com.opencsv</groupId>
+            <artifactId>opencsv</artifactId>
+            <version>4.4</version>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
@@ -106,6 +110,12 @@
             <version>3.17</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.1.1</version>
+            <scope>test</scope>
+        </dependency>
 
 
     </dependencies>

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

@@ -1,7 +1,6 @@
 package com.gyee.generation;
 
 import com.gyee.generation.service.initialpoint.InitialPointGoldenXkByEqService;
-import com.gyee.generation.service.initialpoint.InitialPointGoldenXkService;
 import com.gyee.generation.util.SpringUtils;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
@@ -31,15 +30,15 @@ public class GenerationMain {
 //        InitialPointGoldenXkService.initalFc();
 //        System.out.println("结束导出风场测点。。。。。。");
 
-//        InitialPointGoldenXkByEqService initialPointGoldenXkByEqService= SpringUtils.getBean("initialPointGoldenXkByEqService");
-//
-//        System.out.println("开始导出风机测点。。。。。。");
-//        initialPointGoldenXkByEqService.initalFj();
-//        System.out.println("结束导出风机测点。。。。。。");
+        InitialPointGoldenXkByEqService initialPointGoldenXkByEqService= SpringUtils.getBean("initialPointGoldenXkByEqService");
 
-//        System.out.println("开始导出风场测点。。。。。。");
-//        initialPointGoldenXkByEqService.initalFc();
-//        System.out.println("结束导出风场测点。。。。。。");
+        System.out.println("开始导出风机测点。。。。。。");
+        initialPointGoldenXkByEqService.initalFj();
+        System.out.println("结束导出风机测点。。。。。。");
+
+        System.out.println("开始导出风场测点。。。。。。");
+        initialPointGoldenXkByEqService.initalFc();
+        System.out.println("结束导出风场测点。。。。。。");
 
     }
 }

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

@@ -34,7 +34,7 @@ public class EquipmentInfo2Service {
     /**
      * 计算设备日信息
      */
-    public void calEquipmentInfoDay2(Date recordDate) throws Exception {
+    public void calEquipmentInfoDay(Date recordDate) throws Exception {
         Calendar c=Calendar.getInstance();
         c.setTime(recordDate);
 

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

@@ -58,7 +58,7 @@ public class EquipmentInfo4Service {
    
 
    
-    public void calEquipmentInfo4Day(Date recordDate) throws Exception {
+    public void calEquipmentInfoDay(Date recordDate) throws Exception {
         Calendar c = Calendar.getInstance();
         c.setTime(recordDate);
 

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

@@ -42,6 +42,11 @@ public class EquipmentInfo5Service {
     @Resource
     private IProEconShutdownEventService proEconShutdownEventService;
 
+    public void calEquipmentInfoDay(Date currentDate) throws Exception {
+        resetRate(currentDate);
+        stateRate(currentDate);
+        failRate(currentDate);
+    }
     /**
      * 复位及时率
      */

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

@@ -8,8 +8,6 @@ import com.gyee.generation.service.auto.IProEconEquipmentInfoDay2Service;
 import com.gyee.generation.service.auto.IProEconEquipmentInfoDay4Service;
 import com.gyee.generation.service.auto.IProEconEquipmentInfoDayTopService;
 import com.gyee.generation.util.DateUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -21,7 +19,7 @@ import java.util.stream.Collectors;
 @Service
 public class EquipmentInfoDayTopService {
 
-    private static final Logger logger = LoggerFactory.getLogger(EquipmentInfoDayTopService.class);
+//    private static final Logger logger = LoggerFactory.getLogger(EquipmentInfoDayTopService.class);
 
     @Resource
     private IProEconEquipmentInfoDay1Service proEconEquipmentInfoDay1Service;

+ 29 - 33
realtime/generationXK-service/src/main/java/com/gyee/generation/service/GoodnessOfFitService.java

@@ -3,17 +3,16 @@ package com.gyee.generation.service;
 
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
-
 import com.gyee.generation.init.CacheContext;
-import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
+import com.gyee.generation.model.auto.ProEconWtCurveFittingMonth;
 import com.gyee.generation.model.vo.FitClassVo;
 import com.gyee.generation.model.vo.StatData;
-import com.gyee.generation.service.auto.*;
+import com.gyee.generation.service.auto.IProEconWtCurveFittingMonthService;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -24,15 +23,14 @@ import java.util.stream.Collectors;
 public class GoodnessOfFitService {
 
 
-        private static final Logger logger = LoggerFactory.getLogger(GoodnessOfFitService.class);
+//        private static final Logger logger = LoggerFactory.getLogger(GoodnessOfFitService.class);
         @Resource
         private IEdosUtil edosUtil;
         @Resource
         private IProEconWtCurveFittingMonthService proEconWtCurveFittingMonthService;
 
     public Map<String,Map<String,Double>> goodnessOfFit(Date nowDate) throws Exception {
-        Date current = DateUtils.addDays(nowDate,-1);
-        Date startDate = current;
+        Date startDate = DateUtils.addDays(nowDate,-1);
         Date endDate =new Date();
 
 
@@ -50,13 +48,13 @@ public class GoodnessOfFitService {
 
         Map<String,Map<String,Double>> resultmap =new HashMap<>();
 
-        Map<String, FitClassVo> theMapY = new HashMap<String, FitClassVo>();
-        Map<String, FitClassVo> theMapM = new HashMap<String, FitClassVo>();
-        Map<String, FitClassVo> theMapD = new HashMap<String, FitClassVo>();
+        Map<String, FitClassVo> theMapY = new HashMap<>();
+        Map<String, FitClassVo> theMapM = new HashMap<>();
+        Map<String, FitClassVo> theMapD = new HashMap<>();
 
-        List<FitClassVo> theList = new ArrayList<FitClassVo>();
+        List<FitClassVo> theList = new ArrayList<>();
 
-           List<ProEconWtCurveFittingMonth> powerList = null;
+           List<ProEconWtCurveFittingMonth> powerList;
 
             powerList = proEconWtCurveFittingMonthService.list().stream().filter(i->i.getMonth().equals(month)
                 && i.getYear().equals(year)).collect(Collectors.toList());
@@ -73,17 +71,17 @@ public class GoodnessOfFitService {
                 //月数据筛选日分钟间隔
                 Map<String, ProBasicEquipmentPoint> wtpointmap= CacheContext.wtpAimap.get(wt.getId());
                 ProBasicEquipmentPoint fspoint=wtpointmap.get(ContantXk.CJ_SSFS);
-                List<PointData>  fsls=edosUtil.getHistStat(fspoint.getNemCode(),startDate.getTime()/1000,endDate.getTime()/1000,null,900l, StatData.AVG.getValue());
+                List<PointData>  fsls=edosUtil.getHistStat(fspoint.getNemCode(),startDate.getTime()/1000,endDate.getTime()/1000,null, 900L, StatData.AVG.getValue());
 
                 ProBasicEquipmentPoint glpoint=wtpointmap.get(ContantXk.CJ_SSGL);
-                List<PointData>  glls=edosUtil.getHistStat(glpoint.getNemCode(),startDate.getTime()/1000,endDate.getTime()/1000,null,900l, StatData.AVG.getValue());
+                List<PointData>  glls=edosUtil.getHistStat(glpoint.getNemCode(),startDate.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
 
                 if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
                 {
                     for(int i=0;i<fsls.size();i++)
                     {
                         PointData fspd=fsls.get(i);
-                        PointData glpd=fsls.get(i);
+                        PointData glpd=glls.get(i);
                         FitClassVo po=new FitClassVo();
                         po.setWindturbineId(wt.getId());
                         po.setModelId(wt.getModelId());
@@ -96,15 +94,15 @@ public class GoodnessOfFitService {
                 }
 
                 //月数据筛选15分钟间隔
-                fsls=edosUtil.getHistStat(fspoint.getNemCode(),startDateM.getTime()/1000,endDate.getTime()/1000,null,900l, StatData.AVG.getValue());
-                glls=edosUtil.getHistStat(glpoint.getNemCode(),startDateM.getTime()/1000,endDate.getTime()/1000,null,900l, StatData.AVG.getValue());
+                fsls=edosUtil.getHistStat(fspoint.getNemCode(),startDateM.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
+                glls=edosUtil.getHistStat(glpoint.getNemCode(),startDateM.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
 
                 if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
                 {
                     for(int i=0;i<fsls.size();i++)
                     {
                         PointData fspd=fsls.get(i);
-                        PointData glpd=fsls.get(i);
+                        PointData glpd=glls.get(i);
                         FitClassVo po=new FitClassVo();
                         po.setWindturbineId(wt.getId());
                         po.setModelId(wt.getModelId());
@@ -116,15 +114,15 @@ public class GoodnessOfFitService {
                     }
                 }
                 //年数据筛选15分钟间隔
-                fsls=edosUtil.getHistStat(fspoint.getNemCode(),startDateY.getTime()/1000,endDate.getTime()/1000,null,900l, StatData.AVG.getValue());
-                glls=edosUtil.getHistStat(glpoint.getNemCode(),startDateY.getTime()/1000,endDate.getTime()/1000,null,900l, StatData.AVG.getValue());
+                fsls=edosUtil.getHistStat(fspoint.getNemCode(),startDateY.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
+                glls=edosUtil.getHistStat(glpoint.getNemCode(),startDateY.getTime()/1000,endDate.getTime()/1000,null,900L, StatData.AVG.getValue());
 
                 if(!fsls.isEmpty() && !glls.isEmpty() && fsls.size()==glls.size())
                 {
                     for(int i=0;i<fsls.size();i++)
                     {
                         PointData fspd=fsls.get(i);
-                        PointData glpd=fsls.get(i);
+                        PointData glpd=glls.get(i);
                         FitClassVo po=new FitClassVo();
                         po.setWindturbineId(wt.getId());
                         po.setModelId(wt.getModelId());
@@ -219,7 +217,7 @@ public class GoodnessOfFitService {
 
         for (FitClassVo item : fitsY)
         {
-            Double speed = 0.0;
+            Double speed;
             if (windpowerstationId.contains("GDC"))
             {
                 speed = item.getSpeed();
@@ -257,9 +255,9 @@ public class GoodnessOfFitService {
                     {
                         Double finalSpeed = speed;
                         OptionalDouble tempp=powerList.stream()
-                                .filter(i-> i.getSpeed()== finalSpeed &&  i.getWindturbineId().equals(windturbineId))
-                                .mapToDouble(x->x.getOptimalPower()).findFirst();
-                        Double  p =0.0;
+                                .filter(i-> Objects.equals(i.getSpeed(), finalSpeed) &&  i.getWindturbineId().equals(windturbineId))
+                                .mapToDouble(ProEconWtCurveFittingMonth::getOptimalPower).findFirst();
+                        double p;
 
                         if (tempp.isPresent())
                         {
@@ -272,18 +270,15 @@ public class GoodnessOfFitService {
                             DoubleSummaryStatistics summaryStatistics=powerList.stream().filter(i->i.getWindturbineId().equals(windturbineId))
                                     .mapToDouble(ProEconWtCurveFittingMonth::getSpeed).summaryStatistics();
 
-                            Double max = summaryStatistics.getMax();
+                            double max = summaryStatistics.getMax();
                             if (speed > max)
                             {
                                 summaryStatistics=powerList.stream().filter(i->i.getWindturbineId().equals(windturbineId)).mapToDouble(ProEconWtCurveFittingMonth::getActualPower).summaryStatistics();
                                 p = summaryStatistics.getMax();
 
-                                if (p != null)
-                                {
-                                    Double epower = p.doubleValue();
+                                Double epower = p;
 
-                                    buildtheMap(theMap, theList, windpowerstationId, item, speed, epower);
-                                }
+                                buildtheMap(theMap, theList, windpowerstationId, item, speed, epower);
                             }
 
                         }
@@ -311,7 +306,8 @@ public class GoodnessOfFitService {
             vo.setSpeed(item.getSpeed()+speed);
             vo.setPower(item.getPower()+value1);
             vo.setEpower(item.getEpower()+value2);
-            vo.setNumber(number++);
+            number=number+1;
+            vo.setNumber(number);
             theMap.put(item.getWindturbineId(),vo);
         }
         else

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

@@ -27,7 +27,7 @@ public class InputOrOutPutService {
     @Resource
     private IProEconInputOrOutputSpeedService proEconInputOrOutputSpeedService;
 
-    public void InputOrOutput(Date currentDate) {
+    public void inputOrOutput(Date currentDate) {
         currentDate = DateUtils.truncDay(currentDate);
         Date end = currentDate;
         Date daybegin = DateUtils.addDays(currentDate, -1);
@@ -35,8 +35,6 @@ public class InputOrOutPutService {
         Calendar c = Calendar.getInstance();
         c.setTime(daybegin);
 
-        int year = c.get(Calendar.YEAR);
-        int month = c.get(Calendar.MONTH) + 1;
 
         c.set(Calendar.DAY_OF_MONTH, 1);
         Date monthbegin = c.getTime();
@@ -122,64 +120,64 @@ public class InputOrOutPutService {
         //总小风切入
         DoubleSummaryStatistics summaryStatistics = items.stream()
                 .filter(i -> StringUtils.notEmp(i.getDayInputSmall()) && i.getDayInputSmall() > 0)
-                .mapToDouble(n -> n.getDayInputSmall()).summaryStatistics();
+                .mapToDouble(ProEconInOrOutSpeedTotal::getDayInputSmall).summaryStatistics();
         total1.setInputSmall(summaryStatistics.getAverage());
         //总小风切入最大值
         summaryStatistics = items.stream()
                 .filter(i -> StringUtils.notEmp(i.getDayInputSmallMax()) && i.getDayInputSmallMax() > 0)
-                .mapToDouble(n -> n.getDayInputSmallMax()).summaryStatistics();
+                .mapToDouble(ProEconInOrOutSpeedTotal::getDayInputSmallMax).summaryStatistics();
         total1.setInputSmallMax(summaryStatistics.getMax());
         //总小风切入最小值
         summaryStatistics = items.stream()
                 .filter(i -> StringUtils.notEmp(i.getDayInputSmallMin()) && i.getDayInputSmallMin() > 0)
-                .mapToDouble(n -> n.getDayInputSmallMin()).summaryStatistics();
+                .mapToDouble(ProEconInOrOutSpeedTotal::getDayInputSmallMin).summaryStatistics();
         total1.setInputSmallMin(summaryStatistics.getMin());
         //总大风切入
         summaryStatistics = items.stream()
                 .filter(i -> StringUtils.notEmp(i.getDayInputBig()) && i.getDayInputBig() > 0)
-                .mapToDouble(n -> n.getDayInputBig()).summaryStatistics();
+                .mapToDouble(ProEconInOrOutSpeedTotal::getDayInputBig).summaryStatistics();
         total1.setInputBig(summaryStatistics.getAverage());
         //总大风切入最大值
         summaryStatistics = items.stream()
                 .filter(i -> StringUtils.notEmp(i.getDayInputBigMax()) && i.getDayInputBigMax() > 0)
-                .mapToDouble(n -> n.getDayInputBigMax()).summaryStatistics();
+                .mapToDouble(ProEconInOrOutSpeedTotal::getDayInputBigMax).summaryStatistics();
         total1.setInputBigMax(summaryStatistics.getMax());
         //总大风切入最小值
         summaryStatistics = items.stream()
                 .filter(i -> StringUtils.notEmp(i.getDayInputBigMin()) && i.getDayInputBigMin() > 0)
-                .mapToDouble(n -> n.getDayInputBigMin()).summaryStatistics();
+                .mapToDouble(ProEconInOrOutSpeedTotal::getDayInputBigMin).summaryStatistics();
         total1.setInputBigMin(summaryStatistics.getMin());
 
         //总小风切出
         summaryStatistics = items.stream()
                 .filter(i -> StringUtils.notEmp(i.getDayOutputSmall()) && i.getDayOutputSmall() > 0)
-                .mapToDouble(n -> n.getDayOutputSmall()).summaryStatistics();
+                .mapToDouble(ProEconInOrOutSpeedTotal::getDayOutputSmall).summaryStatistics();
         total1.setOutputSmall(summaryStatistics.getAverage());
         //总小风切出最大值
         summaryStatistics = items.stream()
                 .filter(i -> StringUtils.notEmp(i.getDayOutputSmallMax()) && i.getDayOutputSmallMax() > 0)
-                .mapToDouble(n -> n.getDayOutputSmallMax()).summaryStatistics();
+                .mapToDouble(ProEconInOrOutSpeedTotal::getDayOutputSmallMax).summaryStatistics();
         total1.setOutputSmallMax(summaryStatistics.getMax());
         //总小风切出最小值
         summaryStatistics = items.stream()
                 .filter(i -> StringUtils.notEmp(i.getDayOutputSmallMin()) && i.getDayOutputSmallMin() > 0)
-                .mapToDouble(n -> n.getDayOutputSmallMin()).summaryStatistics();
+                .mapToDouble(ProEconInOrOutSpeedTotal::getDayOutputSmallMin).summaryStatistics();
         total1.setOutputSmallMin(summaryStatistics.getMin());
 
         //总大风切出
         summaryStatistics = items.stream()
                 .filter(i -> StringUtils.notEmp(i.getDayOutputBig()) && i.getDayOutputBig() > 0)
-                .mapToDouble(n -> n.getDayOutputBig()).summaryStatistics();
+                .mapToDouble(ProEconInOrOutSpeedTotal::getDayOutputBig).summaryStatistics();
         total1.setOutputBig(summaryStatistics.getAverage());
         //总大风切出最大值
         summaryStatistics = items.stream()
                 .filter(i -> StringUtils.notEmp(i.getDayOutputBigMax()) && i.getDayOutputBigMax() > 0)
-                .mapToDouble(n -> n.getDayOutputBigMax()).summaryStatistics();
+                .mapToDouble(ProEconInOrOutSpeedTotal::getDayOutputBigMax).summaryStatistics();
         total1.setOutputBigMax(summaryStatistics.getMax());
         //总大风切出最小值
         summaryStatistics = items.stream()
                 .filter(i -> StringUtils.notEmp(i.getDayOutputBigMin()) && i.getDayOutputBigMin() > 0)
-                .mapToDouble(n -> n.getDayOutputBigMin()).summaryStatistics();
+                .mapToDouble(ProEconInOrOutSpeedTotal::getDayOutputBigMin).summaryStatistics();
         total1.setOutputBigMin(summaryStatistics.getMin());
 
 
@@ -250,7 +248,7 @@ public class InputOrOutPutService {
     }
 
     private void buildDay(Date end, Date daybegin, String windturbineId, ProEconInOrOutSpeedTotal total1, ProEconInOrOutSpeedTotal2 total2) {
-        Integer count = 0;
+        int count;
 
 
         List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list().stream()
@@ -337,7 +335,7 @@ public class InputOrOutPutService {
 
         DoubleSummaryStatistics summaryStatistics = inputrecordList.stream().filter(i ->
                         i.getSpeed() > 0 && i.getSpeed() < 5)
-                .mapToDouble(n -> n.getSpeed()).summaryStatistics();
+                .mapToDouble(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
 
         total1.setDayInputSmall(summaryStatistics.getAverage());
         total1.setDayInputSmallMax(summaryStatistics.getMax());
@@ -345,20 +343,20 @@ public class InputOrOutPutService {
 
         summaryStatistics = inputrecordList.stream().filter(i ->
                         i.getSpeed() > 18 && i.getSpeed() < 30)
-                .mapToDouble(n -> n.getSpeed()).summaryStatistics();
+                .mapToDouble(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
 
         total1.setDayInputBig(summaryStatistics.getAverage());
         total1.setDayInputBigMax(summaryStatistics.getMax());
         total1.setDayInputBigMin(summaryStatistics.getMin());
 
 
-        total2.setDaya1(Double.valueOf(A1List.size()));
-        total2.setDaya2(Double.valueOf(A2List.size()));
-        total2.setDaya3(Double.valueOf(A3List.size()));
-        total2.setDaya4(Double.valueOf(A4List.size()));
-        total2.setDaya5(Double.valueOf(A5List.size()));
-        total2.setDaya6(Double.valueOf(A6List.size()));
-        total2.setDaya7(Double.valueOf(A7List.size()));
+        total2.setDaya1((double) A1List.size());
+        total2.setDaya2((double) A2List.size());
+        total2.setDaya3((double) A3List.size());
+        total2.setDaya4((double) A4List.size());
+        total2.setDaya5((double) A5List.size());
+        total2.setDaya6((double) A6List.size());
+        total2.setDaya7((double) A7List.size());
 
 
         count = A1List.size() + A2List.size() + A3List.size() + A4List.size() + A5List.size() + A6List.size() + A7List.size();
@@ -409,7 +407,7 @@ public class InputOrOutPutService {
 
         summaryStatistics = outputrecordList.stream().filter(i ->
                         i.getSpeed() > 0 && i.getSpeed() < 5)
-                .mapToDouble(n -> n.getSpeed()).summaryStatistics();
+                .mapToDouble(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
 
         total1.setDayOutputSmall(summaryStatistics.getAverage());
         total1.setDayOutputSmallMax(summaryStatistics.getMax());
@@ -417,20 +415,20 @@ public class InputOrOutPutService {
 
         summaryStatistics = outputrecordList.stream().filter(i ->
                         i.getSpeed() > 18 && i.getSpeed() < 30)
-                .mapToDouble(n -> n.getSpeed()).summaryStatistics();
+                .mapToDouble(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
 
         total1.setDayOutputBig(summaryStatistics.getAverage());
         total1.setDayOutputBigMax(summaryStatistics.getMax());
         total1.setDayOutputBigMin(summaryStatistics.getMin());
 
 
-        total2.setDaya1(Double.valueOf(B1List.size()));
-        total2.setDaya2(Double.valueOf(B2List.size()));
-        total2.setDaya3(Double.valueOf(B3List.size()));
-        total2.setDaya4(Double.valueOf(B4List.size()));
-        total2.setDaya5(Double.valueOf(B5List.size()));
-        total2.setDaya6(Double.valueOf(B6List.size()));
-        total2.setDaya7(Double.valueOf(B7List.size()));
+        total2.setDaya1((double) B1List.size());
+        total2.setDaya2((double) B2List.size());
+        total2.setDaya3((double) B3List.size());
+        total2.setDaya4((double) B4List.size());
+        total2.setDaya5((double) B5List.size());
+        total2.setDaya6((double) B6List.size());
+        total2.setDaya7((double) B7List.size());
 
         count = B1List.size() + B2List.size() + B3List.size() + B4List.size() + B5List.size() + B6List.size() + B7List.size();
 
@@ -463,7 +461,7 @@ public class InputOrOutPutService {
     }
 
     private void buildMonth(Date end, Date monthbegin, String windturbineId, ProEconInOrOutSpeedTotal total1, ProEconInOrOutSpeedTotal2 total2) {
-        Integer count = 0;
+        int count;
 
         List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list().stream()
                 .filter(i -> i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
@@ -546,7 +544,7 @@ public class InputOrOutPutService {
 
         DoubleSummaryStatistics summaryStatistics = inputrecordList.stream().filter(i ->
                         i.getSpeed() > 0 && i.getSpeed() < 5)
-                .mapToDouble(n -> n.getSpeed()).summaryStatistics();
+                .mapToDouble(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
 
         total1.setMonthInputSmall(summaryStatistics.getAverage());
         total1.setMonthInputSmallMax(summaryStatistics.getMax());
@@ -554,20 +552,20 @@ public class InputOrOutPutService {
 
         summaryStatistics = inputrecordList.stream().filter(i ->
                         i.getSpeed() > 18 && i.getSpeed() < 30)
-                .mapToDouble(n -> n.getSpeed()).summaryStatistics();
+                .mapToDouble(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
 
         total1.setMonthInputBig(summaryStatistics.getAverage());
         total1.setMonthInputBigMax(summaryStatistics.getMax());
         total1.setMonthInputBigMin(summaryStatistics.getMin());
 
 
-        total2.setMontha1(Double.valueOf(A1List.size()));
-        total2.setMontha2(Double.valueOf(A2List.size()));
-        total2.setMontha3(Double.valueOf(A3List.size()));
-        total2.setMontha4(Double.valueOf(A4List.size()));
-        total2.setMontha5(Double.valueOf(A5List.size()));
-        total2.setMontha6(Double.valueOf(A6List.size()));
-        total2.setMontha7(Double.valueOf(A7List.size()));
+        total2.setMontha1((double) A1List.size());
+        total2.setMontha2((double) A2List.size());
+        total2.setMontha3((double) A3List.size());
+        total2.setMontha4((double) A4List.size());
+        total2.setMontha5((double) A5List.size());
+        total2.setMontha6((double) A6List.size());
+        total2.setMontha7((double) A7List.size());
 
 
         count = A1List.size() + A2List.size() + A3List.size() + A4List.size() + A5List.size() + A6List.size() + A7List.size();
@@ -618,7 +616,7 @@ public class InputOrOutPutService {
 
         summaryStatistics = outputrecordList.stream().filter(i ->
                         i.getSpeed() > 0 && i.getSpeed() < 5)
-                .mapToDouble(n -> n.getSpeed()).summaryStatistics();
+                .mapToDouble(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
 
         total1.setMonthOutputSmall(summaryStatistics.getAverage());
         total1.setMonthOutputSmallMax(summaryStatistics.getMax());
@@ -626,20 +624,20 @@ public class InputOrOutPutService {
 
         summaryStatistics = outputrecordList.stream().filter(i ->
                         i.getSpeed() > 18 && i.getSpeed() < 30)
-                .mapToDouble(n -> n.getSpeed()).summaryStatistics();
+                .mapToDouble(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
 
         total1.setMonthOutputBig(summaryStatistics.getAverage());
         total1.setMonthOutputBigMax(summaryStatistics.getMax());
         total1.setMonthOutputBigMin(summaryStatistics.getMin());
 
 
-        total2.setMontha1(Double.valueOf(B1List.size()));
-        total2.setMontha2(Double.valueOf(B2List.size()));
-        total2.setMontha3(Double.valueOf(B3List.size()));
-        total2.setMontha4(Double.valueOf(B4List.size()));
-        total2.setMontha5(Double.valueOf(B5List.size()));
-        total2.setMontha6(Double.valueOf(B6List.size()));
-        total2.setMontha7(Double.valueOf(B7List.size()));
+        total2.setMontha1((double) B1List.size());
+        total2.setMontha2((double) B2List.size());
+        total2.setMontha3((double) B3List.size());
+        total2.setMontha4((double) B4List.size());
+        total2.setMontha5((double) B5List.size());
+        total2.setMontha6((double) B6List.size());
+        total2.setMontha7((double) B7List.size());
 
         count = B1List.size() + B2List.size() + B3List.size() + B4List.size() + B5List.size() + B6List.size() + B7List.size();
 
@@ -672,7 +670,7 @@ public class InputOrOutPutService {
     }
 
     private void buildyear(Date end, Date yearbegin, String windturbineId, ProEconInOrOutSpeedTotal total1, ProEconInOrOutSpeedTotal2 total2) {
-        Integer count = 0;
+        int count;
         List<ProEconInputOrOutputSpeed> recordList = proEconInputOrOutputSpeedService.list().stream()
                 .filter(i -> i.getWindturbineId().equals(windturbineId) && StringUtils.notEmp(i.getSpeed())
                         && (i.getRecordDate().compareTo(yearbegin) == 0 || i.getRecordDate().after(yearbegin))
@@ -754,7 +752,7 @@ public class InputOrOutPutService {
 
         DoubleSummaryStatistics summaryStatistics = inputrecordList.stream().filter(i ->
                         i.getSpeed() > 0 && i.getSpeed() < 5)
-                .mapToDouble(n -> n.getSpeed()).summaryStatistics();
+                .mapToDouble(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
 
         total1.setYearInputSmall(summaryStatistics.getAverage());
         total1.setYearInputSmallMax(summaryStatistics.getMax());
@@ -762,20 +760,20 @@ public class InputOrOutPutService {
 
         summaryStatistics = inputrecordList.stream().filter(i ->
                         i.getSpeed() > 18 && i.getSpeed() < 30)
-                .mapToDouble(n -> n.getSpeed()).summaryStatistics();
+                .mapToDouble(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
 
         total1.setYearInputBig(summaryStatistics.getAverage());
         total1.setYearInputBigMax(summaryStatistics.getMax());
         total1.setYearInputBigMin(summaryStatistics.getMin());
 
 
-        total2.setYeara1(Double.valueOf(A1List.size()));
-        total2.setYeara2(Double.valueOf(A2List.size()));
-        total2.setYeara3(Double.valueOf(A3List.size()));
-        total2.setYeara4(Double.valueOf(A4List.size()));
-        total2.setYeara5(Double.valueOf(A5List.size()));
-        total2.setYeara6(Double.valueOf(A6List.size()));
-        total2.setYeara7(Double.valueOf(A7List.size()));
+        total2.setYeara1((double) A1List.size());
+        total2.setYeara2((double) A2List.size());
+        total2.setYeara3((double) A3List.size());
+        total2.setYeara4((double) A4List.size());
+        total2.setYeara5((double) A5List.size());
+        total2.setYeara6((double) A6List.size());
+        total2.setYeara7((double) A7List.size());
 
 
         count = A1List.size() + A2List.size() + A3List.size() + A4List.size() + A5List.size() + A6List.size() + A7List.size();
@@ -826,7 +824,7 @@ public class InputOrOutPutService {
 
         summaryStatistics = outputrecordList.stream().filter(i ->
                         i.getSpeed() > 0 && i.getSpeed() < 5)
-                .mapToDouble(n -> n.getSpeed()).summaryStatistics();
+                .mapToDouble(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
 
         total1.setYearOutputSmall(summaryStatistics.getAverage());
         total1.setYearOutputSmallMax(summaryStatistics.getMax());
@@ -834,20 +832,20 @@ public class InputOrOutPutService {
 
         summaryStatistics = outputrecordList.stream().filter(i ->
                         i.getSpeed() > 18 && i.getSpeed() < 30)
-                .mapToDouble(n -> n.getSpeed()).summaryStatistics();
+                .mapToDouble(ProEconInputOrOutputSpeed::getSpeed).summaryStatistics();
 
         total1.setYearOutputBig(summaryStatistics.getAverage());
         total1.setYearOutputBigMax(summaryStatistics.getMax());
         total1.setYearOutputBigMin(summaryStatistics.getMin());
 
 
-        total2.setYeara1(Double.valueOf(B1List.size()));
-        total2.setYeara2(Double.valueOf(B2List.size()));
-        total2.setYeara3(Double.valueOf(B3List.size()));
-        total2.setYeara4(Double.valueOf(B4List.size()));
-        total2.setYeara5(Double.valueOf(B5List.size()));
-        total2.setYeara6(Double.valueOf(B6List.size()));
-        total2.setYeara7(Double.valueOf(B7List.size()));
+        total2.setYeara1((double) B1List.size());
+        total2.setYeara2((double) B2List.size());
+        total2.setYeara3((double) B3List.size());
+        total2.setYeara4((double) B4List.size());
+        total2.setYeara5((double) B5List.size());
+        total2.setYeara6((double) B6List.size());
+        total2.setYeara7((double) B7List.size());
 
         count = B1List.size() + B2List.size() + B3List.size() + B4List.size() + B5List.size() + B6List.size() + B7List.size();
 

+ 72 - 69
realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitEventService.java

@@ -3,7 +3,6 @@ package com.gyee.generation.service;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
 
-import com.gyee.common.model.DNAStatVal;
 import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
@@ -42,8 +41,8 @@ public class LimitEventService {
     private IEdosUtil edosUtil;
 
 
-    //风机保证功率
-    private Map<String, String> bzglDictionary;
+//    //风机保证功率
+//    private Map<String, String> bzglDictionary;
 
 
     //<风场编号,风场状态点编号>
@@ -90,28 +89,28 @@ public class LimitEventService {
 
     public void init() {
 
-        windPowerDictionary = new HashMap<String, String>();
-        windTurbineDictionary = new HashMap<String, Map<String, String>>();
-        wplDictionary = new HashMap<String, List<String>>();
+        windPowerDictionary = new HashMap<>();
+        windTurbineDictionary = new HashMap<>();
+        wplDictionary = new HashMap<>();
 
-        windpowerEvent = new HashMap<String, ProEconMainBrownouts>();
-        windturbineEvent = new HashMap<String, ProEconBrownoutsEvent>();
+        windpowerEvent = new HashMap<>();
+        windturbineEvent = new HashMap<>();
 
-        windpowerEvent2 = new HashMap<String, ProEconMainBrownouts2>();
-        windturbineEvent2 = new HashMap<String, ProEconBrownoutsEvent2>();
+        windpowerEvent2 = new HashMap<>();
+        windturbineEvent2 = new HashMap<>();
 
-        speedDictionary = new HashMap<String, String>();
-        powerDictionary = new HashMap<String, String>();
+        speedDictionary = new HashMap<>();
+        powerDictionary = new HashMap<>();
 
-        wSpeedDictionary = new HashMap<String, String>();
-        wPowerDictionary = new HashMap<String, String>();
-        bzglDictionary = new HashMap<String, String>();
+        wSpeedDictionary = new HashMap<>();
+        wPowerDictionary = new HashMap<>();
+//        bzglDictionary = new HashMap<String, String>();
 
-        windturbinePowerProduction = new HashMap<String, Double>();
+        windturbinePowerProduction = new HashMap<>();
 
-        nhDictionary = new HashMap<String, String>();
+        nhDictionary = new HashMap<>();
 
-        nhxdDictionary = new HashMap<String, String>();
+        nhxdDictionary = new HashMap<>();
 
 
         Map<String, ProBasicPowerstationPoint> tempWindPower = new HashMap<>();
@@ -148,11 +147,11 @@ public class LimitEventService {
         Map<String, ProBasicEquipmentPoint> tempPower = new HashMap<>();
         Map<String, ProBasicEquipmentPoint> tempnh = new HashMap<>();
         Map<String, ProBasicEquipmentPoint> tempxd = new HashMap<>();
-        Map<String, ProBasicEquipmentPoint> tempbzglDictionary = new HashMap<>();
+//        Map<String, ProBasicEquipmentPoint> tempbzglDictionary = new HashMap<>();
 
         List<ProBasicEquipment> wtls = CacheContext.wtls;
         Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
-        wtls.stream().forEach(wt -> {
+        wtls.forEach(wt -> {
             if (wt.getWindpowerstationId().contains("FDC")) {
                 //风机状态
                 Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
@@ -181,10 +180,10 @@ public class LimitEventService {
                     tempxd.put(wt.getId(), point);
                 }
 
-                if (windturbinetestingpointnewMap.containsKey(ContantXk.BZGL)) {
-                    ProBasicEquipmentPoint point = windturbinetestingpointnewMap.get(ContantXk.BZGL);
-                    tempbzglDictionary.put(wt.getId(), point);
-                }
+//                if (windturbinetestingpointnewMap.containsKey(ContantXk.BZGL)) {
+//                    ProBasicEquipmentPoint point = windturbinetestingpointnewMap.get(ContantXk.BZGL);
+//                    tempbzglDictionary.put(wt.getId(), point);
+//                }
             }
 
         });
@@ -203,9 +202,9 @@ public class LimitEventService {
                 powerDictionary.put(key, tempPower.get(key).getNemCode());
             }
 
-            if (tempbzglDictionary.containsKey(key)) {
-                bzglDictionary.put(key, tempbzglDictionary.get(key).getNemCode());
-            }
+//            if (tempbzglDictionary.containsKey(key)) {
+//                bzglDictionary.put(key, tempbzglDictionary.get(key).getNemCode());
+//            }
 
             if (tempnh.containsKey(key)) {
                 nhDictionary.put(key, tempnh.get(key).getNemCode());
@@ -228,11 +227,11 @@ public class LimitEventService {
                             && i.getWindpowerstationId().equals(key))
                     .sorted(Comparator.comparing(ProEconMainBrownouts::getStopTime)).collect(Collectors.toList());
 
-            if (tempMain != null && tempMain.size() > 0) {
-                for (int i = 0; i < tempMain.size(); i++) {
+            if (tempMain.size() > 0) {
+                for (ProEconMainBrownouts proEconMainBrownouts : tempMain) {
                     QueryWrapper<ProEconMainBrownouts> wrapper = new QueryWrapper<>();
-                    wrapper.eq("id", tempMain.get(i).getId());
-                    String mainId = tempMain.get(i).getId();
+                    wrapper.eq("id", proEconMainBrownouts.getId());
+                    String mainId = proEconMainBrownouts.getId();
                     proEconMainBrownoutsService.remove(wrapper);
                     List<String> tempSub = proEconBrownoutsEventService.list().stream().filter(x -> StringUtils.empty(x.getMainId().equals(mainId)))
                             .map(ProEconBrownoutsEvent::getId).collect(Collectors.toList());
@@ -267,11 +266,11 @@ public class LimitEventService {
                     .sorted(Comparator.comparing(ProEconMainBrownouts2::getStopTime)).collect(Collectors.toList());
 
 
-            if (tempMain2 != null && tempMain2.size() > 0) {
-                for (int i = 0; i < tempMain2.size(); i++) {
+            if (tempMain2.size() > 0) {
+                for (ProEconMainBrownouts2 proEconMainBrownouts2 : tempMain2) {
                     QueryWrapper<ProEconMainBrownouts2> wrapper = new QueryWrapper<>();
-                    wrapper.eq("id", tempMain2.get(i).getId());
-                    String mainId = tempMain2.get(i).getId();
+                    wrapper.eq("id", proEconMainBrownouts2.getId());
+                    String mainId = proEconMainBrownouts2.getId();
                     proEconMainBrownouts2Service.remove(wrapper);
 
                     List<String> tempSub2 = proEconBrownoutsEvent2Service.list().stream().filter(x -> x.getMainId().equals(mainId))
@@ -315,7 +314,7 @@ public class LimitEventService {
 
             if (tempWindTurbine.containsKey(item.getId())) {
                 if (!windTurbineDictionary.containsKey(item.getWindpowerstationId())) {
-                    windTurbineDictionary.put(item.getWindpowerstationId(), new HashMap<String, String>());
+                    windTurbineDictionary.put(item.getWindpowerstationId(), new HashMap<>());
                 }
                 windTurbineDictionary.get(item.getWindpowerstationId()).put(item.getId(), tempWindTurbine.get(item.getId()).getId());
             }
@@ -354,12 +353,14 @@ public class LimitEventService {
 
     private void newMethod(String key, String windtubineId) {
         if (!wplDictionary.containsKey(key)) {
-            wplDictionary.put(key, new ArrayList<String>());
+            wplDictionary.put(key, new ArrayList<>());
         }
         wplDictionary.get(key).add(windtubineId);
     }
 
-    public void exec() throws Exception {
+    public void execBrownouts() throws Exception {
+
+        init();
         //风场限电事件
         windpowerEvent.clear();
         //风机限电事件
@@ -452,7 +453,7 @@ public class LimitEventService {
                                         // 风机限电进行时
                                         if (windturbineEvent.get(wkey).getMainId().equals(main.getId())) {
                                             double temp = main.getLossPower();
-                                            double tempvulue = buildBrownoutsEvent(new Date(0), key, wkey, dt);
+                                            double tempvulue = buildBrownoutsEvent(new Date(0), wkey, dt);
                                             main.setLossPower(StringUtils.round(temp + tempvulue, 2));
                                         } else {
                                             deleteSub(windturbineEvent.get(wkey));
@@ -464,7 +465,7 @@ public class LimitEventService {
                                         //风机限电结束时
                                         if (windturbineEvent.get(wkey).getMainId().equals(main.getId())) {
                                             double temp = main.getLossPower();
-                                            double tempvulue = buildBrownoutsEvent(dt, key, wkey, dt);
+                                            double tempvulue = buildBrownoutsEvent(dt, wkey, dt);
                                             main.setLossPower(StringUtils.round(temp + tempvulue, 2));
                                             windturbineEvent.put(wkey, null);
                                         } else {
@@ -495,7 +496,7 @@ public class LimitEventService {
                                     if (windturbineEvent.get(wkey).getMainId().equals(main.getId())) {
 
                                         double temp = main.getLossPower();
-                                        double tempvulue = buildBrownoutsEvent(dt, key, wkey, dt);
+                                        double tempvulue = buildBrownoutsEvent(dt, wkey, dt);
                                         main.setLossPower(StringUtils.round(temp + tempvulue, 2));
                                         windturbineEvent.put(wkey, null);
                                     } else {
@@ -518,7 +519,9 @@ public class LimitEventService {
 
 
 //限电事件当天
-    public void exec2() throws Exception {
+    public void execBrownouts2() throws Exception {
+
+        init();
         //风场限电事件
         windpowerEvent2.clear();
         //风机限电事件
@@ -618,7 +621,7 @@ public class LimitEventService {
                                         if (windturbineEvent2.get(wkey).getMainId().equals(main.getId())) {
                                             double temp = main.getLossPower();
 
-                                            double tempvulue = buildBrownoutsEvent2(new Date(0), key, wkey, dt);
+                                            double tempvulue = buildBrownoutsEvent2(new Date(0), wkey, dt);
                                             main.setLossPower(StringUtils.round(temp + tempvulue, 2));
                                             windturbineEvent2.put(wkey, null);
                                         } else {
@@ -672,7 +675,7 @@ public class LimitEventService {
                                             if (windturbineEvent2.get(wkey).getMainId().equals(main.getId())) {
                                                 double temp = main.getLossPower();
 
-                                                double tempvulue = buildBrownoutsEvent2(new Date(0), key, wkey, dt);
+                                                double tempvulue = buildBrownoutsEvent2(new Date(0), wkey, dt);
                                                 main.setLossPower(StringUtils.round(temp + tempvulue, 2));
                                                 windturbineEvent2.put(wkey, null);
                                             } else {
@@ -689,7 +692,7 @@ public class LimitEventService {
                                             if (windturbineEvent2.get(wkey).getMainId().equals(main.getId())) {
                                                 double temp = main.getLossPower();
 
-                                                double tempvulue = buildBrownoutsEvent2(dt, key, wkey, dt);
+                                                double tempvulue = buildBrownoutsEvent2(dt, wkey, dt);
                                                 main.setLossPower(StringUtils.round(temp + tempvulue, 2));
                                                 windturbineEvent2.put(wkey, null);
                                             } else {
@@ -726,7 +729,7 @@ public class LimitEventService {
                                     if (windturbineEvent2.get(wkey).getMainId().equals(main.getId())) {
                                         double temp = main.getLossPower();
 
-                                        double tempvulue = buildBrownoutsEvent2(dt, key, wkey, dt);
+                                        double tempvulue = buildBrownoutsEvent2(dt, wkey, dt);
                                         main.setLossPower(StringUtils.round(temp + tempvulue, 2));
                                         windturbineEvent2.put(wkey, null);
                                     } else {
@@ -751,7 +754,7 @@ public class LimitEventService {
     }
 
 
-    private Double buildBrownoutsEvent(Date dt, String key, String wkey, Date nowdt) throws Exception {
+    private Double buildBrownoutsEvent(Date dt, String wkey, Date nowdt) throws Exception {
         ProEconBrownoutsEvent sub = windturbineEvent.get(wkey);
         if (!(dt.compareTo(new Date(0)) == 0)) {
             sub.setStartTime(dt);
@@ -767,7 +770,7 @@ public class LimitEventService {
 
 
         sub.setStopHours(DateUtils.hoursDiff1(nowdt, sub.getStopTime()));
-        double losspower = calcLossPower(wkey, sub.getStopTime(), nowdt, (double) sub.getStopHours(), windturbinePowerProduction.get(wkey));//需要修改
+        double losspower = calcLossPower(wkey, sub.getStopTime(), nowdt);//需要修改
 
         sub.setLossPower(losspower);
 
@@ -790,7 +793,7 @@ public class LimitEventService {
     }
 
 
-    private Double buildBrownoutsEvent2(Date dt, String key, String wkey, Date nowdt) throws Exception {
+    private Double buildBrownoutsEvent2(Date dt, String wkey, Date nowdt) throws Exception {
 
 
         ProEconBrownoutsEvent2 sub = windturbineEvent2.get(wkey);
@@ -807,7 +810,7 @@ public class LimitEventService {
 
 
         sub.setStopHours(DateUtils.hoursDiff1(nowdt, sub.getStopTime()));
-        double losspower = calcLossPower(wkey, sub.getStopTime(), nowdt, (double) sub.getStopHours(), windturbinePowerProduction.get(wkey));//需要修改
+        double losspower = calcLossPower(wkey, sub.getStopTime(), nowdt);//需要修改
 
         sub.setLossPower(losspower);
 
@@ -857,7 +860,7 @@ public class LimitEventService {
 
         long pried= DateUtils.secondsDiff(DateUtils.addMinutes(dt, -5),dt);
 
-        List<PointData> hsls = edosUtil.getHistStat(powerDictionary.get(wkey), DateUtils.addMinutes(dt, -5).getTime() / 1000, dt.getTime() / 1000, 1l,pried,StatData.MAX.getValue());
+        List<PointData> hsls = edosUtil.getHistStat(powerDictionary.get(wkey), DateUtils.addMinutes(dt, -5).getTime() / 1000, dt.getTime() / 1000, 1L,pried,StatData.MAX.getValue());
         if (StringUtils.notEmp(hsls) && hsls.size() >0) {
             sub.setThisLoad(hsls.get(0).getPointValueInDouble());
 
@@ -896,7 +899,7 @@ public class LimitEventService {
 
 
         long pried= DateUtils.secondsDiff(DateUtils.addMinutes(dt, -5),dt);
-        List<PointData> hsls = edosUtil.getHistStat(powerDictionary.get(wkey), DateUtils.addMinutes(dt, -5).getTime() / 1000, dt.getTime() / 1000, 1l,pried,StatData.MAX.getValue());
+        List<PointData> hsls = edosUtil.getHistStat(powerDictionary.get(wkey), DateUtils.addMinutes(dt, -5).getTime() / 1000, dt.getTime() / 1000, 1L,pried,StatData.MAX.getValue());
         if (StringUtils.notEmp(hsls) && hsls.size() >0) {
             sub.setThisLoad(hsls.get(0).getPointValueInDouble());
 
@@ -909,8 +912,8 @@ public class LimitEventService {
 
 
     //修改后的限电损失统计,通过时序数据库历史切面计算
-    private Double calcLossPower(String windturbineId, Date startDate, Date endDate, double hours, Double maxPower) throws Exception {
-        Double result = 0.0;
+    private Double calcLossPower(String windturbineId, Date startDate, Date endDate) throws Exception {
+        double result = 0.0;
 
         Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
         Map<String, ProBasicEquipmentPoint> wtpointmap=wtpAimap.get(windturbineId);
@@ -925,8 +928,8 @@ public class LimitEventService {
             //年限电欠发损失电量
             if(wtpointmap.containsKey(ContantXk.NXDTJSSDL) )
             {
-                double beginvalue=0.0;
-                double endvalue=0.0;
+                double beginvalue;
+                double endvalue;
 
 
 
@@ -950,8 +953,8 @@ public class LimitEventService {
             //年限电损失电量
             if(wtpointmap.containsKey(ContantXk.NXDJCLSSDL) )
             {
-                double beginvalue=0.0;
-                double endvalue=0.0;
+                double beginvalue;
+                double endvalue;
 
                 List<String> pointid=new ArrayList<>();
                 pointid.add(wtpointmap.get(ContantXk.NXDJCLSSDL).getNemCode());
@@ -979,13 +982,13 @@ public class LimitEventService {
             //年限电欠发损失电量
             if(wtpointmap.containsKey(ContantXk.NXDTJSSDL) )
             {
-                double beginvalue=0.0;
-                double endvalue=0.0;
+                double beginvalue;
+                double endvalue;
 
                 List<String> pointid=new ArrayList<>();
                 pointid.add(wtpointmap.get(ContantXk.NXDTJSSDL).getNemCode());
                 List<PointData> xdbegin=edosUtil.getHistMatrix(pointid,startDate.getTime()/1000);
-                List<PointData> xdend=edosUtil.getHistMatrix(pointid,endDate.getTime()/1000);
+                List<PointData> xdend=edosUtil.getHistMatrix(pointid,endtime.getTime()/1000);
 
 
                 if(xdbegin.size()==1 && xdend.size()==1)
@@ -1002,13 +1005,13 @@ public class LimitEventService {
             //年限电损失电量
             if(wtpointmap.containsKey(ContantXk.NXDJCLSSDL) )
             {
-                double beginvalue=0.0;
-                double endvalue=0.0;
+                double beginvalue;
+                double endvalue;
 
                 List<String> pointid=new ArrayList<>();
                 pointid.add(wtpointmap.get(ContantXk.NXDJCLSSDL).getNemCode());
                 List<PointData> xdbegin=edosUtil.getHistMatrix(pointid,startDate.getTime()/1000);
-                List<PointData> xdend=edosUtil.getHistMatrix(pointid,endDate.getTime()/1000);
+                List<PointData> xdend=edosUtil.getHistMatrix(pointid,endtime.getTime()/1000);
 
 
                 if(xdbegin.size()==1 && xdend.size()==1)
@@ -1028,7 +1031,7 @@ public class LimitEventService {
             if(wtpointmap.containsKey(ContantXk.NXDTJSSDL) )
             {
 
-                double endvalue=0.0;
+                double endvalue;
 
 
 
@@ -1052,8 +1055,8 @@ public class LimitEventService {
             //日限电损失电量
             if(wtpointmap.containsKey(ContantXk.NXDJCLSSDL) )
             {
-                double beginvalue=0.0;
-                double endvalue=0.0;
+
+                double endvalue;
 
 
                 List<String> pointid=new ArrayList<>();
@@ -1110,7 +1113,7 @@ public class LimitEventService {
 
 
         long pried= DateUtils.secondsDiff(DateUtils.addMinutes(dt, -5),dt);
-        List<PointData> hsls = edosUtil.getHistStat(wPowerDictionary.get(key), DateUtils.addMinutes(dt, -5).getTime() / 1000, dt.getTime() / 1000, 1l,pried,StatData.MAX.getValue());
+        List<PointData> hsls = edosUtil.getHistStat(wPowerDictionary.get(key), DateUtils.addMinutes(dt, -5).getTime() / 1000, dt.getTime() / 1000, 1L,pried,StatData.MAX.getValue());
         if (StringUtils.notEmp(hsls) && hsls.size() >0) {
             main.setThisLoad(hsls.get(0).getPointValueInDouble());
 
@@ -1137,7 +1140,7 @@ public class LimitEventService {
 
 
         long pried= DateUtils.secondsDiff(DateUtils.addMinutes(dt, -5),dt);
-        List<PointData> hsls = edosUtil.getHistStat(wPowerDictionary.get(key), DateUtils.addMinutes(dt, -5).getTime() / 1000, dt.getTime() / 1000, 1l,pried,StatData.MAX.getValue());
+        List<PointData> hsls = edosUtil.getHistStat(wPowerDictionary.get(key), DateUtils.addMinutes(dt, -5).getTime() / 1000, dt.getTime() / 1000, 1L,pried,StatData.MAX.getValue());
         if (StringUtils.notEmp(hsls) && hsls.size() >0) {
             main.setThisLoad(hsls.get(0).getPointValueInDouble());
 

+ 40 - 677
realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitService.java

@@ -1,17 +1,12 @@
 package com.gyee.generation.service;
 
 import com.gyee.common.contant.ContantXk;
-import com.gyee.common.model.DNAStatVal;
 import com.gyee.common.model.PointData;
 import com.gyee.generation.init.CacheContext;
-import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
 import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
 import com.gyee.generation.model.auto.ProBasicPowerstationPoint;
-import com.gyee.generation.model.auto.ProEconLineElectrical;
-import com.gyee.generation.model.vo.RealTimeParameterVo;
-import com.gyee.generation.model.vo.SLWindpowerVo;
 import com.gyee.generation.model.vo.StatData;
-import com.gyee.generation.service.auto.IProEconLineElectricalService;
 import com.gyee.generation.util.DateUtils;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
@@ -19,477 +14,13 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.*;
-import java.util.function.Function;
-import java.util.stream.Collectors;
 
 @Service
 public  class LimitService {
 
     @Resource
-    private IProEconLineElectricalService proEconLineElectricalService;
-
-
-    
-
-    @Resource
     private IEdosUtil edosUtil;
-   // 受累
-
-    Map<String, SLWindpowerVo> sl;
-
-    Map<String, Integer> slvalue;
-
-    Map<String, ProBasicEquipmentPoint> windSL;
-
-    public void execStatuSL() throws Exception {
-
-
-
-        if (sl == null)
-            initsl();
-        else
-        {
-
-            Map<String, Integer> slv = new HashMap<String, Integer>();
-            Date dt =new Date();
-            Map<String, RealTimeParameterVo> rList = new HashMap<String, RealTimeParameterVo>();
-            for (SLWindpowerVo item : sl.values())
-            {
-
-
-                //事故总
-                if (item.getACCIDENTSIGNAL().size() > 0)
-                {
-                    for (String key : item.getACCIDENTSIGNAL().keySet())
-                    {
-                        Double cx = 0.0;
-                        cx = edosUtil.getRealData(key).getPointValueInDouble();
-                        if (cx == 1)
-                        {
-                            for (String  windturbineid : item.getACCIDENTSIGNAL().get(key))
-                            {
-                                BuilderSL(dt, rList, key, windturbineid, slv, 3);
-                            }
-                        }
-                    }
-                }
-
-
-
-
-                //出线断路器判断
-                if (item.getNETOUTCODE().size() > 0)
-                {
-                    for (String key : item.getNETOUTCODE().keySet())
-                    {
-                        Double cx = 1.0;
-                        cx = edosUtil.getRealData(key).getPointValueInDouble();
-                        if (cx == 0)
-                        {
-                            for (String  windturbineid : item.getNETOUTCODE().get(key))
-                            {
-                                BuilderSL(dt, rList, key, windturbineid, slv, 4);
-                            }
-                        }
-                    }
-                }
-                else
-                {
-                    //主变高压侧
-                    if (item.getNETHIGHCODE().size() > 0)
-                    {
-                        for (String key : item.getNETHIGHCODE().keySet())
-                        {
-                            Double cx = 1.0;
-                            cx = edosUtil.getRealData(key).getPointValueInDouble();
-                            if (cx == 0)
-                            {
-                                for (String windturbineid : item.getNETHIGHCODE().get(key))
-                                {
-                                    BuilderSL(dt, rList, key, windturbineid, slv, 4);
-                                }
-                            }
-                            else
-                            {
-
-                                if (item.getPTCURRENTCODE().containsKey(key) && item.getPTCURRENT().containsKey(key))
-                                {
-                                    String code = item.getPTCURRENTCODE().get(key);
-                                    Double max = item.getPTCURRENT().get(key);
-                                    cx =edosUtil.getRealData(code).getPointValueInDouble();
-
-                                    if (cx > max)
-                                    {
-                                        for (String windturbineid : item.getNETOUTCODE().get(key))
-                                        {
-                                            BuilderSL(dt, rList, key, windturbineid, slv, 4);
-                                        }
-                                    }
-                                }
-                                if (item.getPTVOLTAGECODE().containsKey(key) && item.getPTVOLTAGEHIGH().containsKey(key) && item.getPTVOLTAGELOW().containsKey(key))
-                                {
-                                    String code = item.getPTVOLTAGECODE().get(key);
-                                    Double max = item.getPTVOLTAGEHIGH().get(key);
-                                    Double min = item.getPTVOLTAGELOW().get(key);
-                                    cx =edosUtil.getRealData(code).getPointValueInDouble();
-
-                                    if (cx > max || cx < min)
-                                    {
-                                        for (String windturbineid : item.getNETOUTCODE().get(key))
-                                        {
-                                            BuilderSL(dt, rList, key, windturbineid, slv, 4);
-                                        }
-                                    }
-                                }
-
-                            }
-                        }
-                    }
-                }
-
-
-
-
-                //主变高压侧断路器判断
-                if (item.getNETHIGHCODE().size() > 0)
-                {
-                    for (String key : item.getNETHIGHCODE().keySet())
-                    {
-                        Double cx = 1.0;
-                        cx =edosUtil.getRealData(key).getPointValueInDouble();
-                        if (cx == 0)
-                        {
-                            for (String windturbineid : item.getNETHIGHCODE().get(key))
-                            {
-                                BuilderSL(dt, rList, key, windturbineid, slv, 2);
-                            }
-                        }
-                    }
-                }
-
-
-
-                //主变低压侧断路器判断
-                if (item.getNETLOWCODE().size() > 0)
-                {
-                    for (String key : item.getNETLOWCODE().keySet())
-                    {
-                        Double cx = 1.0;
-                        cx =edosUtil.getRealData(key).getPointValueInDouble();
-                        if (cx == 0)
-                        {
-                            for (String windturbineid : item.getNETLOWCODE().get(key))
-                            {
-                                BuilderSL(dt, rList, key, windturbineid, slv, 2);
-                            }
-                        }
-                    }
-                }
-
-
-                //进线断路器判断
-                if (item.getLINECODE().size() > 0)
-                {
-                    for (String key : item.getLINECODE().keySet())
-                    {
-                        Double cx = 1.0;
-                        cx =edosUtil.getRealData(key).getPointValueInDouble();
-                        if (cx == 0)
-                        {
-                            for (String windturbineid : item.getLINECODE().get(key))
-                            {
-                                BuilderSL(dt, rList, key, windturbineid, slv, 2);
-                            }
-                        }
-                    }
-                }
-            }
-
-//            List<PointData> pols=new ArrayList<>();
-            for (String key : windSL.keySet())
-            {
-
-                double t =edosUtil.getRealData(windSL.get(key).getNemCode()).getPointValueInDouble();
-                if (!slv.containsKey(key))
-                {
-
-                    if (slvalue.get(key) != 0)
-                    {
-                        slvalue.put(key,0);
-
-                        if (t == 2 || t == 3 || t == 4)
-                        {
-                            RealTimeParameterVo rt = new RealTimeParameterVo();
-
-                            rt.setPoint(windSL.get(key).getNemCode());
-                            rt.setTime(dt);
-                            rt.setInsertValue(0.0);
-                            rList.put(key, rt);
-
-//                            PointData po=new PointData();
-//                            po.setEdnaId(windSL.get(key).getId());
-//                            po.setPointTime(dt.getTime());
-//                            po.setPointValueInDouble(0.0);
-//                            pols.add(po);
-                        }
-                    }
-                }
-
-            }
-            if (rList.size() > 0)
-            {
-                //批量插入测点
-                edosUtil.sendMultiRealTimeParamete(rList.values().stream().collect(Collectors.toList()));
-//                ednaHelper.AddRealtimeEDNA(rList.Values.ToList());
-            }
-
-        }
-    }
-
-    private void BuilderSL(Date dt, Map<String, RealTimeParameterVo> rList, String key, String windturbineid, Map<String, Integer> slv, Integer i)
-    {
-
-        if (!slv.containsKey(windturbineid))
-        {
-            slv.put(windturbineid, i);
-            if (i != 3)
-            {
-                if (windSL.containsKey(windturbineid))
-                {
-                    if (slvalue.containsKey(windturbineid))
-                    {
-                        if (slvalue.get(windturbineid) != i)
-                        {
-                            RealTimeParameterVo rt = new RealTimeParameterVo();
-                            rt.setPoint(windSL.get(windturbineid).getNemCode());
-                            rt.setTime(dt);
-                            rt.setInsertValue(i);
-
-
-
-                            if (!rList.containsKey(windturbineid))
-                            {
-                                slvalue.put(windturbineid,i);
-
-                                rList.put(windturbineid, rt);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        else
-        {
-            if (slv.get(windturbineid) == 3)
-            {
-                i = 3;
-            }
-
-            if (windSL.containsKey(windturbineid))
-            {
-                if (slvalue.containsKey(windturbineid))
-                {
-                    if (slvalue.get(windturbineid) != i)
-                    {
-                        RealTimeParameterVo rt = new RealTimeParameterVo();
-                        rt.setPoint(windSL.get(windturbineid).getNemCode());
-                        rt.setTime(dt);
-                        rt.setInsertValue(i);
-
-
-
-                        if (!rList.containsKey(windturbineid))
-                        {
-                            slvalue.put(windturbineid,i);
-
-                            rList.put(windturbineid, rt);
-                        }
-                    }
-
-                }
-            }
-        }
-    }
-
-    private void initsl()
-    {
-        sl = new HashMap<String, SLWindpowerVo>();
-        slvalue = new HashMap<String, Integer>();
-
-            //var electrical = entity.ProEconLineElectrical.ToList();
-        List<ProBasicEquipment> wtls= CacheContext.wtls;
-        Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap=CacheContext.wtpAimap;
-        Map<String, ProEconLineElectrical> electrical = proEconLineElectricalService.list().stream().collect(Collectors.toMap(ProEconLineElectrical::getLineId, Function.identity()));
-        wtls.stream().forEach(wt->{
-            if(wt.getWindpowerstationId().contains("FDC"))
-            {
-                Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
-                if(windturbinetestingpointnewMap.containsKey(ContantXk.GPZT))
-                {
-                    ProBasicEquipmentPoint xdslPoint = windturbinetestingpointnewMap.get(ContantXk.GPZT);
-                    windSL.put(wt.getId(),xdslPoint);
-                }
-
-            }
-
-        });
-
-            for (String key : windSL.keySet())
-            {
-
-                if (!CacheContext.wtmap.containsKey(key))
-                {
-                    continue;
-                }
-                ProBasicEquipment item = CacheContext.wtmap.get(key);
-
-                slvalue.put(item.getId(), 0);
-
-
-                if (!electrical.containsKey(item.getLineId()))
-                {
-                    continue;
-                }
-                ProEconLineElectrical line = electrical.get(item.getLineId());
-
-                if (sl.containsKey(item.getWindpowerstationId()))
-                {
-                    SLWindpowerVo s = sl.get(item.getWindpowerstationId());
-                    initialsl(item, line, s);
-
-                }
-                else
-                {
-
-                    sl.put(item.getWindpowerstationId(), new SLWindpowerVo());
-                    SLWindpowerVo s = sl.get(item.getWindpowerstationId());
-                    s.setLINECODE(new HashMap<String, List<String>>());
-                    s.setNETLOWCODE(new HashMap<String, List<String>>());
-                    s.setNETHIGHCODE(new HashMap<String, List<String>>());
-                    s.setNETOUTCODE(new HashMap<String, List<String>>());
-                    s.setPTVOLTAGEHIGH(new HashMap<String, Double>());
-                    s.setPTVOLTAGELOW(new HashMap<String, Double>());
-                    s.setPTCURRENT(new HashMap<String, Double>());
-                    s.setPTCURRENTCODE(new HashMap<String, String>());
-                    s.setPTVOLTAGECODE(new HashMap<String, String>());
-                    s.setACCIDENTSIGNAL(new HashMap<String, List<String>>());
-
-                    initialsl(item, line, s);
-                }
-            }
-
-
-
-    }
-
-    private static void initialsl(ProBasicEquipment windturbine, ProEconLineElectrical item, SLWindpowerVo s)
-    {
-        //进线断路器
-        if (s.getLINECODE().containsKey(item.getLineCode()))
-        {
-            List<String> t = s.getLINECODE().get(item.getLineCode());
-            t.add(windturbine.getId());
-        }
-        else
-        {
-            List<String> t = new ArrayList<String>();
-            t.add(windturbine.getId());
-            s.getLINECODE().put(item.getLineCode(), t);
-        }
-        //主变低压测
-        if (s.getNETLOWCODE().containsKey(item.getNetLowCode()))
-        {
-            List<String> t = s.getNETLOWCODE().get(item.getNetLowCode());
-            t.add(windturbine.getId());
-        }
-        else
-        {
-            List<String> t = new ArrayList<String>();
-             t.add(windturbine.getId());
-            s.getNETLOWCODE().put(item.getNetLowCode(), t);
-        }
-        //主变高压侧
-        if (s.getNETHIGHCODE().containsKey(item.getNetHighCode()))
-        {
-            List<String> t = s.getNETHIGHCODE().get(item.getNetHighCode());
-             t.add(windturbine.getId());
-        }
-        else
-        {
-            List<String> t = new ArrayList<String>();
-             t.add(windturbine.getId());
-            s.getNETHIGHCODE().put(item.getNetHighCode(), t);
-
-
-            if (!s.getPTCURRENTCODE().containsKey(item.getNetHighCode()))
-            {
-                if (item.getPtcurrentCode() != null)
-                {
-                    s.getPTCURRENTCODE().put(item.getNetHighCode(), item.getPtcurrentCode());
-                }
-            }
-            if (!s.getPTVOLTAGECODE().containsKey(item.getNetHighCode()))
-            {
-                if (item.getPtvoltageCode() != null)
-                {
-                    s.getPTVOLTAGECODE().put(item.getNetHighCode(), item.getPtvoltageCode());
-                }
-            }
-
-
-            if (!s.getPTVOLTAGEHIGH().containsKey(item.getNetHighCode()))
-            {
-                if (item.getPtvoltageHigh() != null)
-                {
-                    s.getPTVOLTAGEHIGH().put(item.getNetHighCode(), item.getPtvoltageHigh().doubleValue());
-                }
-            }
-            if (!s.getPTVOLTAGELOW().containsKey(item.getNetHighCode()))
-            {
-                if (item.getPtvoltageLow() != null)
-                {
-                    s.getPTVOLTAGELOW().put(item.getNetHighCode(),  item.getPtvoltageLow().doubleValue());
-                }
-            }
-            if (!s.getPTCURRENTCODE().containsKey(item.getNetHighCode()))
-            {
-                if (item.getPtcurrent() != null)
-                {
-                    s.getPTCURRENT().put(item.getNetHighCode(), item.getPtcurrent().doubleValue());
-                }
-            }
-
-        }
-        //出线
-        if (s.getNETOUTCODE().containsKey(item.getNetOutCode()))
-        {
-            List<String> t = s.getNETOUTCODE().get(item.getNetOutCode());
-             t.add(windturbine.getId());
-        }
-        else
-        {
-            List<String> t = new ArrayList<String>();
-             t.add(windturbine.getId());
-            s.getNETOUTCODE().put(item.getNetOutCode(), t);
-        }
-
-        //事故总
-        if (s.getACCIDENTSIGNAL().containsKey(item.getAccidentSignal()))
-        {
-            List<String> t = s.getACCIDENTSIGNAL().get(item.getAccidentSignal());
-             t.add(windturbine.getId());
-        }
-        else
-        {
-            List<String> t = new ArrayList<String>();
-             t.add(windturbine.getId());
-            s.getACCIDENTSIGNAL().put(item.getAccidentSignal(), t);
-        }
-
-    }
-
-
-        //region AGC监视限电
+    //AGC监视限电
 
     //限电
     static Map<String, ProBasicEquipmentPoint> WindTurbineE;
@@ -500,9 +31,6 @@ public  class LimitService {
     //限电状态
     static Map<String, Map<String, ProBasicEquipmentPoint>> WindTurbineD;
 
-    //限电受累
-    static Map<String, Map<String, ProBasicEquipmentPoint>> WindTurbineXDSL;
-
 
     //AGC限电指令
     static Map<String, ProBasicPowerstationPoint> WindPowerAGC;
@@ -614,7 +142,7 @@ public  class LimitService {
 
             Date begin = DateUtils.addMinutes(time,-8);
 
-            List<RealTimeParameterVo> projectRT = new ArrayList<RealTimeParameterVo>();
+            List<PointData> projectRT = new ArrayList<PointData>();
 
 
 
@@ -735,21 +263,22 @@ public  class LimitService {
                         {
                             val = 1.0;
                         }
-                        RealTimeParameterVo rt = new RealTimeParameterVo();
+                        PointData rt = new PointData();
 
-                        rt.setPoint(WindTurbineD.get(item).get(key).getNemCode());
-                        rt.setTime(time);
-                        rt.setInsertValue(val);
+
+                        rt.setEdnaId(WindTurbineD.get(item).get(key).getNemCode());
+                        rt.setPointTime(time.getTime());
+                        rt.setPointValueInDouble(val);
                         projectRT.add(rt);
                         //}
 
                     }
 
-                    RealTimeParameterVo fcrt = new RealTimeParameterVo();
+                    PointData fcrt = new PointData();
 
-                    fcrt.setPoint(WindPowerXDZT.get(item).getNemCode());
-                    fcrt.setTime(time);
-                    fcrt.setInsertValue(0.0);
+                    fcrt.setEdnaId(WindPowerXDZT.get(item).getNemCode());
+                    fcrt.setPointTime(time.getTime());
+                    fcrt.setPointValueInDouble(0.0);
                     projectRT.add(fcrt);
 
                 }
@@ -840,30 +369,32 @@ public  class LimitService {
                             {
                                 val = 1.0;
                             }
-                            RealTimeParameterVo rt = new RealTimeParameterVo();
+                            PointData rt = new PointData();
 
-                            rt.setPoint(WindTurbineD.get(item).get(key).getNemCode());
-                            rt.setTime(time);
-                            rt.setInsertValue(val);
+                            rt.setEdnaId(WindTurbineD.get(item).get(key).getNemCode());
+                            rt.setPointTime(time.getTime());
+                            rt.setPointValueInDouble(0.0);
                             projectRT.add(rt);
                             
 
                             //}
 
                         }
-                        RealTimeParameterVo fcrt = new RealTimeParameterVo();
-  
-                        fcrt.setPoint(WindPowerXDZT.get(item).getNemCode());
-                        fcrt.setTime(time);
-                        fcrt.setInsertValue(0.0);
+                        PointData fcrt = new PointData();
+
+
+                        fcrt.setEdnaId(WindPowerXDZT.get(item).getNemCode());
+                        fcrt.setPointTime(time.getTime());
+                        fcrt.setPointValueInDouble(0.0);
                         projectRT.add(fcrt);
                     }
                     else
                     {
-                        RealTimeParameterVo fcrt = new RealTimeParameterVo();
-                        fcrt.setPoint(WindPowerXDZT.get(item).getNemCode());
-                        fcrt.setTime(time);
-                        fcrt.setInsertValue(1.0);
+                        PointData fcrt = new PointData();
+
+                        fcrt.setEdnaId(WindPowerXDZT.get(item).getNemCode());
+                        fcrt.setPointTime(time.getTime());
+                        fcrt.setPointValueInDouble(1.0);
                         projectRT.add(fcrt);
 
                         for (String key : WindTurbineD.get(item).keySet())
@@ -945,54 +476,15 @@ public  class LimitService {
                             {
                                 val = 1.0;
                             }
-                            RealTimeParameterVo rt = new RealTimeParameterVo();
-
-                            rt.setPoint(WindTurbineD.get(item).get(key).getNemCode());
-                            rt.setTime(time);
-                            rt.setInsertValue(val);
-                            projectRT.add(rt);
+                            PointData rt = new PointData();
 
 
+                            rt.setEdnaId(WindTurbineD.get(item).get(key).getNemCode());
+                            rt.setPointTime(time.getTime());
+                            rt.setPointValueInDouble(val);
+                            projectRT.add(rt);
 
 
-                            //if (d == 0d)
-                            //{
-                            //    boolean t = false;
-                            //    if (statuspointDictionary.containsKey(key))
-                            //    {
-                            //        Double start = edosUtil.getRealData(statuspointDictionary[key].ID);
-                            //        if (start != 1)
-                            //        {
-                            //            t = true;
-                            //        }
-
-                            //        else
-                            //        {
-
-                            //            if (WindTurbineE.containsKey(key))
-                            //            {
-                            //                String ids = WindTurbineE[key].ID;
-                            //                if (ids != null && ids.Length > 0)
-                            //                    t = BuildRetValue(new String[] { ids });
-                            //            }
-
-                            //        }
-                            //    }
-
-                            //    if (t)
-                            //    {
-                            //        var val = edosUtil.getRealData(WindTurbineD[item][key].ID);
-
-                            //        if (val != 2 && val != 3 && val != 4 && val != 5)
-                            //        {
-                            //            RealTimeParameterVo rt = new RealTimeParameterVo();
-                            //            rt.point = WindTurbineD[item][key].ID; ;
-                            //            rt.time = time;
-                            //            rt.InsertValue = 1.0;
-                            //            projectRT.Add(rt);
-                            //        }
-                            //    }
-                            //}
                         }
                     }
                 }
@@ -1000,109 +492,23 @@ public  class LimitService {
             }
             if (projectRT.size() > 0)
             {
-                edosUtil.sendMultiRealTimeParamete(projectRT);
+                edosUtil.sendMultiPoint(projectRT);
 
             }
         }
     }
 
 
-    private boolean BuildRetValue(String[] Ids) throws Exception {
-        boolean b = false;
-//        Double[] values = new Double[Ids.length];
-
-        List<PointData> values=edosUtil.getRealData(Ids);
-//        ednaHelper.GetRtValueList(Ids.Length, Ids, values);
-        for (PointData item : values)
-        {
-            if (item.getPointValueInDouble() != 0)
-            {
-                b = true;
-                break;
-            }
-        }
-
-        return b;
-    }
-
-
-
 
 
-
-    List<ProBasicEquipmentPoint> WindTurbineXD;
     Map<String, ProBasicEquipmentPoint> WindturbineXDSL;
-    public void execStatus2() throws Exception {
-        if (WindTurbineXD == null || WindturbineXDSL == null)
-        {
-
-            List<ProBasicEquipment> wtls= CacheContext.wtls;
-            Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap=CacheContext.wtpAimap;
-            wtls.stream().forEach(wt->{
-                Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
-                if(windturbinetestingpointnewMap.containsKey(ContantXk.GPZT))
-                {
-                    ProBasicEquipmentPoint xdslPoint = windturbinetestingpointnewMap.get(ContantXk.GPZT);
-                    WindturbineXDSL.put(wt.getId(),xdslPoint);
-                }
-                if(windturbinetestingpointnewMap.containsKey(ContantXk.XDZT))
-                {
-                    ProBasicEquipmentPoint xdztPoint = windturbinetestingpointnewMap.get(ContantXk.XDZT);
-                    WindTurbineXD.add(xdztPoint);
-                }
-            });
-              
-        }
-        else
-        {
-            Date dt = new Date();
-            List<RealTimeParameterVo> insertRt = new ArrayList<RealTimeParameterVo>();
-            for (ProBasicEquipmentPoint xd : WindTurbineXD)
-            {
-                String key = xd.getWindturbineId();
-
-//                if (key == "KB01_010")
-//                {
-//                    Console.WriteLine("1");
-//                }
-                String point = xd.getNemCode();//重点注意!!!!
-                Double val = 0.0;
-
-                if (WindturbineXDSL.containsKey(key))
-                {
-                    Double ret = edosUtil.getRealData(WindturbineXDSL.get(key).getNemCode()).getPointValueInDouble();
 
-                    if (ret == 1)
-                    {
-                        val = 1.0;
-                    }
-                    //else
-                    //{
-                    //    val = 0.0;
-                    //}
-                }
-                RealTimeParameterVo rt = new RealTimeParameterVo();
-
-
-                rt.setPoint(point);
-                rt.setTime(dt);
-                rt.setInsertValue(val);
-                insertRt.add(rt);
-                
-            }
-            edosUtil.sendMultiRealTimeParamete(insertRt);
-        }
-
-    }
 
 
     Map<String, List<String>> WindturbineQXDic;
     List<ProBasicEquipmentPoint> WindTurbineQX;
     Map<String, ProBasicEquipmentPoint> WindturbineQXDic2;
-    Map<String, ProBasicEquipmentPoint> WindturbineQXDic3;
-
 
-    //Map<String, ProBasicEquipmentPoint> WindturbineQXDic4;
     public void execStatus() throws Exception {
 
 
@@ -1142,22 +548,6 @@ public  class LimitService {
                     wtpointls.add(point);
                 }
 
-//                if(windturbinetestingpointnewMap.containsKey(ContantXk.CJ_ZSGD))
-//                {
-//                    ProBasicEquipmentPoint point = windturbinetestingpointnewMap.get(ContantXk.CJ_ZSGD);
-//                    WindturbineQXDic3.put(wt.getId(),point);
-//                }
-//
-//                if(windturbinetestingpointnewMap.containsKey(ContantXk.DI11139))
-//                {
-//                    ProBasicEquipmentPoint point = windturbinetestingpointnewMap.get(ContantXk.DI11139);
-//                    WindturbineQXDic2.put(wt.getNemCode(),point);
-//                }
-//                if(windturbinetestingpointnewMap.containsKey(ContantXk.DI10923))
-//                {
-//                    ProBasicEquipmentPoint point = windturbinetestingpointnewMap.get(ContantXk.DI10923);
-//                    WindturbineQXDic2.put(wt.getNemCode(),point);
-//                }
 
                 if(windturbinetestingpointnewMap.containsKey(ContantXk.XDZT))
                 {
@@ -1180,21 +570,12 @@ public  class LimitService {
         else
         {
             Date dt =new Date();
-            List<RealTimeParameterVo> insertRt = new ArrayList<RealTimeParameterVo>();
+            List<PointData> insertRt = new ArrayList<PointData>();
             for (ProBasicEquipmentPoint item : WindTurbineQX)
             {
                 String key = item.getWindturbineId();
                 String  windows = item.getWindpowerstationId();
-                //if (windows == "KB_FDC" || windows == "CL_FDC")
-                //{
-                //    Console.WriteLine(key);
-                //    continue;
-                //}
-//                if (key == "CL01_001" )
-//                {
-//                    Console.WriteLine(key);
-//
-//                }
+
                 String point = item.getNemCode();//重点注意!!!!
                 Double val = 0.0;
                 if (CacheContext.wtmap.containsKey(key) && WindturbineQXDic.containsKey(key))
@@ -1239,38 +620,20 @@ public  class LimitService {
                     }
 
 
-                    //if (WindturbineQXDic3.containsKey(key))
-                    //{
-                    //    var k = edosUtil.getRealData(WindturbineQXDic3[key].ID);
-                    //    if (modelid.contains("UP77-1500") || modelid.contains("UP82-1500"))
-                    //    {
-                    //        if (k >= 90)
-                    //        {
-                    //            b = true;
-                    //        }
-                    //        else
-                    //        {
-                    //            b = false;
-                    //        }
-                    //    }
-                    //}
-
-
                     val = b ? 0.0 : 1.0;
 
-                    RealTimeParameterVo rt = new RealTimeParameterVo();
-
-                    rt.setPoint(point);
-                    rt.setTime(dt);
-                    rt.setInsertValue(val);
+                    PointData rt = new PointData();
 
+                    rt.setEdnaId(point);
+                    rt.setPointTime(dt.getTime());
+                    rt.setPointValueInDouble(val);
                     insertRt.add(rt);
 
 
                 }
             }
 
-            edosUtil.sendMultiRealTimeParamete(insertRt);
+            edosUtil.sendMultiPoint(insertRt);
             this.execStatusAGCxd();
             //this.execStatuSL();
 

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


+ 172 - 145
realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingService.java

@@ -98,13 +98,13 @@ public class PowerCurveFittingService {
         int month3 = c.get(Calendar.MONTH) + 1;
 
 
-        Map<String, CureFittingVo> windMap = new HashMap<String, CureFittingVo>();
+        Map<String, CureFittingVo> windMap = new HashMap<>();
 
 
         //初始化风机装机容量
 
         if (windturbineCapacity == null) {
-            windturbineCapacity = new HashMap<String, Double>();
+            windturbineCapacity = new HashMap<>();
             Map<String, ProEconEquipmentmodel> modelMap = CacheContext.modelMap;
             for (ProBasicEquipment windturbine : wtls) {
                 if (modelMap.containsKey(windturbine.getModelId())) {
@@ -124,7 +124,7 @@ public class PowerCurveFittingService {
             //设备明细状态
             String pointIdZT = windturbinetestingpointnewMap.get(ContantXk.MXZT).getNemCode();
 
-            String pointIdFS = "";
+            String pointIdFS;
             if (wt.getWindpowerstationId().contains("GDC")) {   //测风塔70米风速
 
                 if (windturbinetestingpointnewMap.containsKey(ContantXk.FCCFTFS70)) {
@@ -164,11 +164,12 @@ public class PowerCurveFittingService {
 
         for (String key : windMap.keySet()) {
             //初始化集合
-            windMap.get(key).setYsjglPoints(new ArrayList<PointVo>());
-            windMap.get(key).setYzyglPoints(new ArrayList<PointVo>());
-            windMap.get(key).setRsjglPoints(new ArrayList<PointVo>());
-            windMap.get(key).setRzyglPoints(new ArrayList<PointVo>());
-
+            windMap.get(key).setYsjglPoints(new ArrayList<>());
+            windMap.get(key).setYzyglPoints(new ArrayList<>());
+            windMap.get(key).setRsjglPoints(new ArrayList<>());
+            windMap.get(key).setRzyglPoints(new ArrayList<>());
+            windMap.get(key).setNsjglPoints(new ArrayList<>());
+            windMap.get(key).setNzyglPoints(new ArrayList<>());
 
             if (windMap.get(key).getPointIdGL() == null || windMap.get(key).getPointIdFS() == null || windMap.get(key).getPointIdZT() == null) {
                 logger.info(key);
@@ -177,11 +178,23 @@ public class PowerCurveFittingService {
 
             //拟合月功率曲线
             curveFittingBuilder(begin1, end, dimension, scale, windMap.get(key).getPointIdGL(), windMap.get(key).getPointIdFS(), windMap.get(key).getPointIdZT(), windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), key);
+
+            List<PointVo> vos= windMap.get(key).getYsjglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
+            windMap.get(key).setYsjglPoints(vos);
+            vos=windMap.get(key).getYzyglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
+            windMap.get(key).setYzyglPoints(vos);
             //拟合日功率曲线
             curveFittingBuilder(begin2, end, dimension, scale, windMap.get(key).getPointIdGL(), windMap.get(key).getPointIdFS(), windMap.get(key).getPointIdZT(), windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), key);
+            vos= windMap.get(key).getRsjglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
+            windMap.get(key).setRsjglPoints(vos);
+            vos=windMap.get(key).getRzyglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
+            windMap.get(key).setRzyglPoints(vos);
             //拟合年功率曲线
             curveFittingBuilder(begin3, end, dimension, scale, windMap.get(key).getPointIdGL(), windMap.get(key).getPointIdFS(), windMap.get(key).getPointIdZT(), windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), key);
-
+            vos= windMap.get(key).getNsjglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
+            windMap.get(key).setNsjglPoints(vos);
+            vos=windMap.get(key).getNzyglPoints().stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
+            windMap.get(key).setNzyglPoints(vos);
         }
 
         for (String key : windMap.keySet()) {
@@ -192,42 +205,44 @@ public class PowerCurveFittingService {
             }
 
 //            //年的上月
-            List<PointVo> yearLastMonthPoints = new ArrayList<PointVo>();
+            List<PointVo> yearLastMonthPoints = new ArrayList<>();
 //            //年的去年同期
-            List<PointVo> yearLastYearPoints = new ArrayList<PointVo>();
+            List<PointVo> yearLastYearPoints;
 //            //年标准功率
-            List<PointVo> yearStandardPoints = new ArrayList<PointVo>();
+            List<PointVo> yearStandardPoints = new ArrayList<>();
 
 
             //月的上月
-            List<PointVo> monthLastMonthPoints = new ArrayList<PointVo>();
+            List<PointVo> monthLastMonthPoints = new ArrayList<>();
             //月的去年同期
-            List<PointVo> monthLastYearPoints = new ArrayList<PointVo>();
+            List<PointVo> monthLastYearPoints = new ArrayList<>();
             //月标准功率
-            List<PointVo> monthStandardPoints = new ArrayList<PointVo>();
+            List<PointVo> monthStandardPoints = new ArrayList<>();
 
 
             //日的昨天
-            List<PointVo> dayLastMonthPoints = new ArrayList<PointVo>();
+            List<PointVo> dayLastMonthPoints = new ArrayList<>();
             //日的去年同期
-            List<PointVo> dayLastYearPoints = new ArrayList<PointVo>();
+            List<PointVo> dayLastYearPoints = new ArrayList<>();
             //日标准功率
-            List<PointVo> dayStandardPoints = new ArrayList<PointVo>();
+            List<PointVo> dayStandardPoints = new ArrayList<>();
 
             //保证功率
-            List<PointVo> bzglpowerPoints = new ArrayList<PointVo>();
+            List<PointVo> bzglpowerPoints = new ArrayList<>();
 
 
             if (CacheContext.wtstandardmap.containsKey(key)) {
                 String standardId = CacheContext.wtstandardmap.get(key);
                 if (StringUtils.notEmp(standardId)) {
                     if (windMap.containsKey(key)) {
+                        yearStandardPoints = windMap.get(standardId).getNsjglPoints();
                         monthStandardPoints = windMap.get(standardId).getYsjglPoints();
                         dayStandardPoints = windMap.get(standardId).getRsjglPoints();
                     }
                 }
             }
 
+
             String stringyear = String.valueOf(year);
             String stringmonth = String.valueOf(month);
 
@@ -237,7 +252,7 @@ public class PowerCurveFittingService {
             String stringyear3 = String.valueOf(year3);
             String stringmonth3 = String.valueOf(month3);
 
-            /*********************************************年曲线偏差上个月和上一年记录**********************************************************/
+           // /*********************************************年曲线偏差上个月和上一年记录**********************************************************/
 
 
             List<ProEconWtCurveFittingYear> wcfyls = proEconWtCurveFittingYearService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
@@ -247,22 +262,21 @@ public class PowerCurveFittingService {
             yearBuildPoints(wcfyls, yearLastMonthPoints);
             yearLastYearPoints = yearLastMonthPoints;
 
-/*********************************************年曲线偏差上个月和上一年记录**********************************************************/
-/*********************************************月曲线偏差上个月和上一年记录**********************************************************/
+//*********************************************年曲线偏差上个月和上一年记录**********************************************************/
+//*********************************************月曲线偏差上个月和上一年记录**********************************************************/
 
             List<ProEconWtCurveFittingMonth> wcfmls = proEconWtCurveFittingMonthService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
                     i.getYear().equals(stringyear2) && i.getMonth().equals(stringmonth2)).sorted(Comparator.comparing(ProEconWtCurveFittingMonth::getSpeed)).collect(Collectors.toList());
 
             monthBuildPoints(wcfmls, monthLastMonthPoints);
 
-            wcfmls = null;
             wcfmls = proEconWtCurveFittingMonthService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
                     i.getYear().equals(stringyear3) && i.getMonth().equals(stringmonth3)).collect(Collectors.toList());
             wcfmls.sort(Comparator.comparing(ProEconWtCurveFittingMonth::getSpeed));
 
             monthBuildPoints(wcfmls, monthLastYearPoints);
-/*********************************************月曲线偏差上个月和上一年记录**********************************************************/
-/*********************************************日曲线偏差上个月和上一年记录**********************************************************/
+//*********************************************月曲线偏差上个月和上一年记录**********************************************************/
+//*********************************************日曲线偏差上个月和上一年记录**********************************************************/
             Date d1 = DateUtils.addDays(current, -1);
             Date d2 = DateUtils.addYears(current, -1);
 
@@ -272,13 +286,13 @@ public class PowerCurveFittingService {
 
             dayBuildPoints(wcfls, dayLastMonthPoints);
 
-            wcfls = null;
+            
             wcfls = proEconWtCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
                     i.getRecordDate().compareTo(d2) == 0).collect(Collectors.toList());
 
             //与轶总的原始代码对比不一致,临时修改测试
             dayBuildPoints(wcfls, dayLastMonthPoints);
-/*********************************************日曲线偏差上个月和上一年记录**********************************************************/
+//*********************************************日曲线偏差上个月和上一年记录**********************************************************/
             if (CacheContext.wtmap.containsKey(key)) {
                 String modelid = CacheContext.wtmap.get(key).getModelId();
                 if (StringUtils.notEmp(modelid)) {
@@ -294,12 +308,12 @@ public class PowerCurveFittingService {
                     }
                 }
             }
-/*********************************************年曲线偏差记录**********************************************************/
+//*********************************************年曲线偏差记录**********************************************************/
 
-/*********************************************当年曲线偏差记录**********************************************************/
+//*********************************************当年曲线偏差记录**********************************************************/
             Optional<ProEconCurveFittYearMain> cfmyearo = proEconCurveFittYearMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
                     && i.getYear().equals(stringyear)).findFirst();
-            ProEconCurveFittYearMain cfmyear = null;
+            ProEconCurveFittYearMain cfmyear;
             if (cfmyearo.isPresent()) {
                 cfmyear = cfmyearo.get();
 
@@ -315,26 +329,26 @@ public class PowerCurveFittingService {
 
 
             //年---实际/最优
-            cfmyear.setDeviationRate1((Double) pcl(windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), modelpower));
+            cfmyear.setDeviationRate1(pcl(windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), modelpower));
             //年---实际/保证
-            cfmyear.setDeviationRate2((Double) pcl(windMap.get(key).getNsjglPoints(), bzglpowerPoints, modelpower));
+            cfmyear.setDeviationRate2( pcl(windMap.get(key).getNsjglPoints(), bzglpowerPoints, modelpower));
             //年---最优/保证
-            cfmyear.setDeviationRate3((Double) pcl(windMap.get(key).getNzyglPoints(), bzglpowerPoints, modelpower));
+            cfmyear.setDeviationRate3( pcl(windMap.get(key).getNzyglPoints(), bzglpowerPoints, modelpower));
             //年---实际/上月实际
-            cfmyear.setMonthDeviationRate((Double) pcl(windMap.get(key).getNsjglPoints(), yearLastMonthPoints, modelpower));
+            cfmyear.setMonthDeviationRate( pcl(windMap.get(key).getNsjglPoints(), yearLastMonthPoints, modelpower));
             //年---实际/同期实际
-            cfmyear.setYearDeviationRate((Double) pcl(windMap.get(key).getNsjglPoints(), yearLastYearPoints, modelpower));
+            cfmyear.setYearDeviationRate( pcl(windMap.get(key).getNsjglPoints(), yearLastYearPoints, modelpower));
             //年---实际/标杆实际
-            cfmyear.setStandardDeviationRate((Double) pcl(windMap.get(key).getNsjglPoints(), yearStandardPoints, modelpower));
+            cfmyear.setStandardDeviationRate( pcl(windMap.get(key).getNsjglPoints(), yearStandardPoints, modelpower));
 
 
             proEconCurveFittYearMainService.save(cfmyear);
 
-/*********************************************当年曲线偏差记录**********************************************************/
-/*********************************************当月曲线偏差记录**********************************************************/
+//*********************************************当年曲线偏差记录**********************************************************/
+//*********************************************当月曲线偏差记录**********************************************************/
             Optional<ProEconCurveFittMonthMain> cfmmontho = proEconCurveFittMonthMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
                     && i.getYear().equals(stringyear) && i.getMonth().equals(stringmonth)).findFirst();
-            ProEconCurveFittMonthMain cfmmonth = null;
+            ProEconCurveFittMonthMain cfmmonth;
             if (cfmmontho.isPresent()) {
                 cfmmonth = cfmmontho.get();
 
@@ -350,26 +364,26 @@ public class PowerCurveFittingService {
             cfmmonth.setMonth(String.valueOf(month));
 
             //月---实际/最优
-            cfmmonth.setDeviationRate1((Double) pcl(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower));
+            cfmmonth.setDeviationRate1( pcl(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower));
             //月---实际/保证
-            cfmmonth.setDeviationRate2((Double) pcl(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower));
+            cfmmonth.setDeviationRate2( pcl(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower));
             //月---最优/保证
-            cfmmonth.setDeviationRate3((Double) pcl(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower));
+            cfmmonth.setDeviationRate3( pcl(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower));
             //月---实际/上月实际
-            cfmmonth.setMonthDeviationRate((Double) pcl(windMap.get(key).getYsjglPoints(), monthLastMonthPoints, modelpower));
+            cfmmonth.setMonthDeviationRate( pcl(windMap.get(key).getYsjglPoints(), monthLastMonthPoints, modelpower));
             //月---实际/同期实际
-            cfmmonth.setYearDeviationRate((Double) pcl(windMap.get(key).getYsjglPoints(), monthLastYearPoints, modelpower));
+            cfmmonth.setYearDeviationRate( pcl(windMap.get(key).getYsjglPoints(), monthLastYearPoints, modelpower));
             //月---实际/标杆实际
-            cfmmonth.setStandardDeviationRate((Double) pcl(windMap.get(key).getYsjglPoints(), monthStandardPoints, modelpower));
+            cfmmonth.setStandardDeviationRate( pcl(windMap.get(key).getYsjglPoints(), monthStandardPoints, modelpower));
 
 
             proEconCurveFittMonthMainService.save(cfmmonth);
 
-            /*********************************************当月曲线偏差记录**********************************************************/
-            /*********************************************当日曲线偏差记录**********************************************************/
+            //*********************************************当月曲线偏差记录**********************************************************/
+            //*********************************************当日曲线偏差记录**********************************************************/
             Optional<ProEconCurveFittingMain> cfmdayo = proEconCurveFittingMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
                     && i.getRecordDate().compareTo(current) == 0).findFirst();
-            ProEconCurveFittingMain cfmday = null;
+            ProEconCurveFittingMain cfmday ;
 
             if (cfmdayo.isPresent()) {
                 cfmday = cfmdayo.get();
@@ -384,21 +398,21 @@ public class PowerCurveFittingService {
 
 
             //日---实际/最优
-            cfmday.setDeviationRate1((Double) pcl(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower));
+            cfmday.setDeviationRate1( pcl(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower));
             //日---实际/保证
-            cfmday.setDeviationRate2((Double) pcl(windMap.get(key).getRsjglPoints(), bzglpowerPoints, modelpower));
+            cfmday.setDeviationRate2( pcl(windMap.get(key).getRsjglPoints(), bzglpowerPoints, modelpower));
             //日---最优/保证
-            cfmday.setDeviationRate3((Double) pcl(windMap.get(key).getRzyglPoints(), bzglpowerPoints, modelpower));
+            cfmday.setDeviationRate3( pcl(windMap.get(key).getRzyglPoints(), bzglpowerPoints, modelpower));
             //日---实际/上日实际
-            cfmday.setMonthDeviationRate((Double) pcl(windMap.get(key).getRsjglPoints(), dayLastMonthPoints, modelpower));
+            cfmday.setMonthDeviationRate( pcl(windMap.get(key).getRsjglPoints(), dayLastMonthPoints, modelpower));
             //日---实际/同期实际
-            cfmday.setYearDeviationRate((Double) pcl(windMap.get(key).getRsjglPoints(), dayLastYearPoints, modelpower));
+            cfmday.setYearDeviationRate( pcl(windMap.get(key).getRsjglPoints(), dayLastYearPoints, modelpower));
             //日---实际/标杆实际
-            cfmday.setStandardDeviationRate((Double) pcl(windMap.get(key).getRsjglPoints(), dayStandardPoints, modelpower));
+            cfmday.setStandardDeviationRate( pcl(windMap.get(key).getRsjglPoints(), dayStandardPoints, modelpower));
 
 
             proEconCurveFittingMainService.save(cfmday);
-            /*********************************************当日曲线偏差记录**********************************************************/
+            //*********************************************当日曲线偏差记录**********************************************************/
             pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 3, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
             pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 4, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
             pLCBuild(key, stringyear, stringmonth, current, windMap, modelpower, 5, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
@@ -434,11 +448,11 @@ public class PowerCurveFittingService {
 
         String speedStr = String.valueOf(speed);
 
-        /*********************************************当年曲线偏差子表记录**********************************************************/
+        //*********************************************当年曲线偏差子表记录**********************************************************/
 
         Optional<ProEconCurveFittYearSub> cfmsyearo = proEconCurveFittYearSubService.list().stream().filter(i -> i.getWindturbineId().equals(key)
                 && i.getYear().equals(stringyear) && i.getSpeed().equals(speedStr)).findFirst();
-        ProEconCurveFittYearSub cfmsyear = null;
+        ProEconCurveFittYearSub cfmsyear;
 
         if (cfmsyearo.isPresent()) {
             cfmsyear = cfmsyearo.get();
@@ -456,25 +470,25 @@ public class PowerCurveFittingService {
         proEconCurveFittYearSubService.save(cfmsyear);
 
         //年---实际/最优
-        cfmsyear.setDeviationRate1((Double) pcl2(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower, speed));
+        cfmsyear.setDeviationRate1( pcl2(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower, speed));
         //年---实际/保证
-        cfmsyear.setDeviationRate2((Double) pcl2(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower, speed));
+        cfmsyear.setDeviationRate2( pcl2(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower, speed));
         //年---最优/保证
-        cfmsyear.setDeviationRate3((Double) pcl2(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower, speed));
+        cfmsyear.setDeviationRate3( pcl2(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower, speed));
         //年---实际/上月实际
-        cfmsyear.setMonthDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), monthLastMonthPoints, modelpower, speed));
+        cfmsyear.setMonthDeviationRate( pcl2(windMap.get(key).getYsjglPoints(), yearLastMonthPoints, modelpower, speed));
         //年---实际/同期实际
-        cfmsyear.setYearDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), monthLastYearPoints, modelpower, speed));
+        cfmsyear.setYearDeviationRate( pcl2(windMap.get(key).getYsjglPoints(), yearLastYearPoints, modelpower, speed));
         //年---实际/标杆实际
-        cfmsyear.setStandardDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), monthStandardPoints, modelpower, speed));
+        cfmsyear.setStandardDeviationRate( pcl2(windMap.get(key).getYsjglPoints(), yearStandardPoints, modelpower, speed));
 
         proEconCurveFittYearSubService.save(cfmsyear);
-/*********************************************当年曲线偏差子表记录**********************************************************/
-/*********************************************当月曲线偏差子表记录**********************************************************/
+//*********************************************当年曲线偏差子表记录**********************************************************/
+//*********************************************当月曲线偏差子表记录**********************************************************/
 
         Optional<ProEconCurveFittMonthSub> cfmsmontho = proEconCurveFittMonthSubService.list().stream().filter(i -> i.getWindturbineId().equals(key)
                 && i.getYear().equals(stringyear) && i.getMonth().equals(stringmonth) && i.getSpeed().equals(speedStr)).findFirst();
-        ProEconCurveFittMonthSub cfmsmonth = null;
+        ProEconCurveFittMonthSub cfmsmonth ;
 
         if (cfmsmontho.isPresent()) {
             cfmsmonth = cfmsmontho.get();
@@ -493,24 +507,24 @@ public class PowerCurveFittingService {
         proEconCurveFittMonthSubService.save(cfmsmonth);
 
         //月---实际/最优
-        cfmsmonth.setDeviationRate1((Double) pcl2(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower, speed));
+        cfmsmonth.setDeviationRate1( pcl2(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower, speed));
         //月---实际/保证
-        cfmsmonth.setDeviationRate2((Double) pcl2(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower, speed));
+        cfmsmonth.setDeviationRate2( pcl2(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower, speed));
         //月---最优/保证
-        cfmsmonth.setDeviationRate3((Double) pcl2(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower, speed));
+        cfmsmonth.setDeviationRate3( pcl2(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower, speed));
         //月---实际/上月实际
-        cfmsmonth.setMonthDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), monthLastMonthPoints, modelpower, speed));
+        cfmsmonth.setMonthDeviationRate( pcl2(windMap.get(key).getYsjglPoints(), monthLastMonthPoints, modelpower, speed));
         //月---实际/同期实际
-        cfmsmonth.setYearDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), monthLastYearPoints, modelpower, speed));
+        cfmsmonth.setYearDeviationRate( pcl2(windMap.get(key).getYsjglPoints(), monthLastYearPoints, modelpower, speed));
         //月---实际/标杆实际
-        cfmsmonth.setStandardDeviationRate((Double) pcl2(windMap.get(key).getYsjglPoints(), monthStandardPoints, modelpower, speed));
+        cfmsmonth.setStandardDeviationRate( pcl2(windMap.get(key).getYsjglPoints(), monthStandardPoints, modelpower, speed));
 
         proEconCurveFittMonthSubService.save(cfmsmonth);
-/*********************************************当月曲线偏差子表记录**********************************************************/
-/*********************************************当日曲线偏差子表记录**********************************************************/
+//*********************************************当月曲线偏差子表记录**********************************************************/
+//*********************************************当日曲线偏差子表记录**********************************************************/
         Optional<ProEconCurveFittingSub> cfmso = proEconCurveFittingSubService.list().stream().filter(i -> i.getWindturbineId().equals(key)
                 && i.getRecordDate().compareTo(current) == 0 && i.getSpeed().equals(speedStr)).findFirst();
-        ProEconCurveFittingSub cfms = null;
+        ProEconCurveFittingSub cfms ;
 
         if (cfmso.isPresent()) {
             cfms = cfmso.get();
@@ -526,27 +540,27 @@ public class PowerCurveFittingService {
         cfms.setRecordDate(current);
 
 
-        cfms.setDeviationRate1((Double) pcl2(windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), modelpower, speed));
+        cfms.setDeviationRate1( pcl2(windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), modelpower, speed));
         //日---实际/保证
-        cfms.setDeviationRate2((Double) pcl2(windMap.get(key).getRsjglPoints(), bzglpowerPoints, modelpower, speed));
+        cfms.setDeviationRate2( pcl2(windMap.get(key).getRsjglPoints(), bzglpowerPoints, modelpower, speed));
         //日---最优/保证
-        cfms.setDeviationRate3((Double) pcl2(windMap.get(key).getRzyglPoints(), bzglpowerPoints, modelpower, speed));
+        cfms.setDeviationRate3( pcl2(windMap.get(key).getRzyglPoints(), bzglpowerPoints, modelpower, speed));
         //日---实际/上日实际
-        cfms.setMonthDeviationRate((Double) pcl2(windMap.get(key).getRsjglPoints(), dayLastMonthPoints, modelpower, speed));
+        cfms.setMonthDeviationRate( pcl2(windMap.get(key).getRsjglPoints(), dayLastMonthPoints, modelpower, speed));
         //日---实际/同期实际
-        cfms.setYearDeviationRate((Double) pcl2(windMap.get(key).getRsjglPoints(), dayLastYearPoints, modelpower, speed));
+        cfms.setYearDeviationRate( pcl2(windMap.get(key).getRsjglPoints(), dayLastYearPoints, modelpower, speed));
         //日---实际/标杆实际
-        cfms.setStandardDeviationRate((Double) pcl2(windMap.get(key).getRsjglPoints(), dayStandardPoints, modelpower, speed));
+        cfms.setStandardDeviationRate( pcl2(windMap.get(key).getRsjglPoints(), dayStandardPoints, modelpower, speed));
 
         proEconCurveFittingSubService.save(cfms);
-/*********************************************当日曲线偏差子表记录**********************************************************/
+//*********************************************当日曲线偏差子表记录**********************************************************/
     }
 
 
     private void insertPoints(Date current, String year, String month, List<PointVo> monthSjglls, List<PointVo> monthZyglls, List<PointVo> daySjglls, List<PointVo> dayZyglls, List<PointVo> yearSjglls, List<PointVo> yearZyglls, String windturbineId) {
-        /*********************************************当年曲线偏差记录**********************************************************/
+        //*********************************************当年曲线偏差记录**********************************************************/
         List<Integer> wtcfmyearidls = proEconWtCurveFittingYearService.list().stream().filter(i -> i.getWindturbineId().equals(windturbineId) &&
-                i.getYear().equals(year)).map(i -> i.getId()).collect(Collectors.toList());
+                i.getYear().equals(year)).map(ProEconWtCurveFittingYear::getId).collect(Collectors.toList());
 
         for (int i = 0; i < wtcfmyearidls.size(); i++) {
             proEconWtCurveFittingYearService.removeByIds(wtcfmyearidls);
@@ -561,7 +575,7 @@ public class PowerCurveFittingService {
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
                     if (wt.getWindpowerstationId().contains("GDC")) {
                         continue;
-                        // item.SPEED = Double.Truncate((Double)pointsF1[i].X);
+                        // item.SPEED = Double.Truncate(pointsF1[i].X);
                     } else {
                         item.setSpeed(yearSjglls.get(i).getX());
 
@@ -586,7 +600,7 @@ public class PowerCurveFittingService {
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
                     if (wt.getWindpowerstationId().contains("GDC")) {
                         continue;
-                        //item.SPEED = Double.Truncate((Double)pointsF1[i].X);
+                        //item.SPEED = Double.Truncate(pointsF1[i].X);
                     } else {
 
                         item.setSpeed(yearSjglls.get(i).getX());
@@ -594,7 +608,7 @@ public class PowerCurveFittingService {
                     item.setActualPower(yearSjglls.get(i).getY());
 
                     int finalI = i;
-                    OptionalDouble op = yearZyglls.stream().filter(x -> x.getX() == yearSjglls.get(finalI).getX()).mapToDouble(x -> x.getY()).findFirst();
+                    OptionalDouble op = yearZyglls.stream().filter(x -> Objects.equals(x.getX(), yearSjglls.get(finalI).getX())).mapToDouble(PointVo::getY).findFirst();
 
                     if (op.isPresent()) {
                         item.setOptimalPower(op.getAsDouble());
@@ -609,10 +623,10 @@ public class PowerCurveFittingService {
 
             }
         }
-        /*********************************************当年曲线偏差记录**********************************************************/
-        /*********************************************当月曲线偏差记录**********************************************************/
+        //*********************************************当年曲线偏差记录**********************************************************/
+        //*********************************************当月曲线偏差记录**********************************************************/
         List<Integer> wtcfmmonthidls = proEconWtCurveFittingMonthService.list().stream().filter(i -> i.getWindturbineId().equals(windturbineId) &&
-                i.getYear().equals(year) && i.getMonth().equals(month)).map(i -> i.getId()).collect(Collectors.toList());
+                i.getYear().equals(year) && i.getMonth().equals(month)).map(ProEconWtCurveFittingMonth::getId).collect(Collectors.toList());
 
 
         for (int i = 0; i < wtcfmmonthidls.size(); i++) {
@@ -628,7 +642,7 @@ public class PowerCurveFittingService {
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
                     if (wt.getWindpowerstationId().contains("GDC")) {
                         continue;
-                        // item.SPEED = Double.Truncate((Double)pointsF1[i].X);
+                        // item.SPEED = Double.Truncate(pointsF1[i].X);
                     } else {
                         item.setSpeed(monthSjglls.get(i).getX());
 
@@ -654,7 +668,7 @@ public class PowerCurveFittingService {
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
                     if (wt.getWindpowerstationId().contains("GDC")) {
                         continue;
-                        //item.SPEED = Double.Truncate((Double)pointsF1[i].X);
+                        //item.SPEED = Double.Truncate(pointsF1[i].X);
                     } else {
 
                         item.setSpeed(monthSjglls.get(i).getX());
@@ -662,7 +676,7 @@ public class PowerCurveFittingService {
                     item.setActualPower(monthSjglls.get(i).getY());
 
                     int finalI = i;
-                    OptionalDouble op = monthZyglls.stream().filter(x -> x.getX() == monthSjglls.get(finalI).getX()).mapToDouble(x -> x.getY()).findFirst();
+                    OptionalDouble op = monthZyglls.stream().filter(x -> Objects.equals(x.getX(), monthSjglls.get(finalI).getX())).mapToDouble(PointVo::getY).findFirst();
 
                     if (op.isPresent()) {
                         item.setOptimalPower(op.getAsDouble());
@@ -678,8 +692,8 @@ public class PowerCurveFittingService {
 
             }
         }
-        /*********************************************当月曲线偏差记录**********************************************************/
-        /*********************************************当日曲线偏差记录**********************************************************/
+        //*********************************************当月曲线偏差记录**********************************************************/
+        //*********************************************当日曲线偏差记录**********************************************************/
         List<Integer> wtcfidls = proEconWtCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(windturbineId) &&
                 i.getRecordDate().compareTo(current) == 0).map(ProEconWtCurveFitting::getId).collect(Collectors.toList());
 
@@ -697,7 +711,7 @@ public class PowerCurveFittingService {
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
                     if (wt.getWindpowerstationId().contains("GDC")) {
                         continue;
-                        // item.SPEED = Double.Truncate((Double)pointsF2[i].X);
+                        // item.SPEED = Double.Truncate(pointsF2[i].X);
                     } else {
                         boolean l = String.valueOf(daySjglls.get(i).getX()).contains(".");
                         if (l) {
@@ -728,7 +742,7 @@ public class PowerCurveFittingService {
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
                     if (wt.getWindpowerstationId().contains("GDC")) {
                         continue;
-                        //item.SPEED = Double.Truncate((Double)pointsF2[i].X);
+                        //item.SPEED = Double.Truncate(pointsF2[i].X);
                     } else {
                         boolean l = String.valueOf(daySjglls.get(i).getX()).contains(".");
                         if (l) {
@@ -739,7 +753,7 @@ public class PowerCurveFittingService {
 
 
                     int finalI = i;
-                    OptionalDouble op = dayZyglls.stream().filter(x -> x.getX() == daySjglls.get(finalI).getX()).mapToDouble(x -> x.getY()).findFirst();
+                    OptionalDouble op = dayZyglls.stream().filter(x -> Objects.equals(x.getX(), daySjglls.get(finalI).getX())).mapToDouble(PointVo::getY).findFirst();
 
                     if (op.isPresent()) {
                         item.setOptimalPower(op.getAsDouble());
@@ -753,7 +767,7 @@ public class PowerCurveFittingService {
                 }
 
             }
-            /*********************************************当日曲线偏差记录**********************************************************/
+            //*********************************************当日曲线偏差记录**********************************************************/
         }
     }
 
@@ -761,7 +775,7 @@ public class PowerCurveFittingService {
     private void insertPoints2(Date current, String year, String month, List<PointVo> monthSjglls, List<PointVo> monthZyglls, List<PointVo> daySjglls, List<PointVo> dayZyglls, List<PointVo> yearSjglls, List<PointVo> yearZyglls, String windturbineId) {
 
 
-        List<Integer> wtpcfidls = proEconWtPowerCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(windturbineId)).map(i -> i.getId()).collect(Collectors.toList());
+        List<Integer> wtpcfidls = proEconWtPowerCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(windturbineId)).map(ProEconWtPowerCurveFitting::getId).collect(Collectors.toList());
 
 
         for (int i = 0; i < wtpcfidls.size(); i++) {
@@ -779,7 +793,7 @@ public class PowerCurveFittingService {
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
                     if (wt.getWindpowerstationId().contains("GDC")) {
                         continue;
-                        // item.SPEED = Double.Truncate((Double)pointsF1[i].X);
+                        // item.SPEED = Double.Truncate(pointsF1[i].X);
                     } else {
                         boolean l = String.valueOf(monthSjglls.get(i).getX()).contains(".");
                         if (l) {
@@ -811,7 +825,7 @@ public class PowerCurveFittingService {
                     ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
                     if (wt.getWindpowerstationId().contains("GDC")) {
                         continue;
-                        //item.SPEED = Double.Truncate((Double)pointsF1[i].X);
+                        //item.SPEED = Double.Truncate(pointsF1[i].X);
                     } else {
                         boolean l = String.valueOf(monthSjglls.get(i).getX()).contains(".");
                         if (l) {
@@ -823,7 +837,7 @@ public class PowerCurveFittingService {
 
                     item.setActualPower(monthSjglls.get(i).getY());
                     int finalI = i;
-                    OptionalDouble op = monthZyglls.stream().filter(x -> x.getX() == monthSjglls.get(finalI).getX()).mapToDouble(x -> x.getY()).findFirst();
+                    OptionalDouble op = monthZyglls.stream().filter(x -> Objects.equals(x.getX(), monthSjglls.get(finalI).getX())).mapToDouble(PointVo::getY).findFirst();
 
                     if (op.isPresent()) {
                         item.setOptimalPower(op.getAsDouble());
@@ -841,10 +855,10 @@ public class PowerCurveFittingService {
 
     private void yearBuildPoints(List<ProEconWtCurveFittingYear> data, List<PointVo> points) {
         if (data != null) {
-            for (int i = 0; i < data.size(); i++) {
+            for (ProEconWtCurveFittingYear datum : data) {
                 PointVo point = new PointVo();
-                point.setX(data.get(i).getSpeed());
-                point.setY(data.get(i).getActualPower());
+                point.setX(datum.getSpeed());
+                point.setY(datum.getActualPower());
                 points.add(point);
             }
         }
@@ -852,10 +866,10 @@ public class PowerCurveFittingService {
 
     private void monthBuildPoints(List<ProEconWtCurveFittingMonth> data, List<PointVo> points) {
         if (data != null) {
-            for (int i = 0; i < data.size(); i++) {
+            for (ProEconWtCurveFittingMonth datum : data) {
                 PointVo point = new PointVo();
-                point.setX(data.get(i).getSpeed());
-                point.setY(data.get(i).getActualPower());
+                point.setX(datum.getSpeed());
+                point.setY(datum.getActualPower());
                 points.add(point);
             }
         }
@@ -863,10 +877,10 @@ public class PowerCurveFittingService {
 
     private void dayBuildPoints(List<ProEconWtCurveFitting> data, List<PointVo> points) {
         if (data != null) {
-            for (int i = 0; i < data.size(); i++) {
+            for (ProEconWtCurveFitting datum : data) {
                 PointVo point = new PointVo();
-                point.setX(data.get(i).getSpeed());
-                point.setY(data.get(i).getActualPower());
+                point.setX(datum.getSpeed());
+                point.setY(datum.getActualPower());
                 points.add(point);
             }
         }
@@ -879,10 +893,10 @@ public class PowerCurveFittingService {
         if (points1 != null && points1.size() != 0 && points2 != null && points2.size() != 0) {
             double count = 0;
             double sum = 0;
-            double max = (double) modelpower;
+            double max = modelpower;
             for (PointVo point : points1) {
-                List<PointVo> item = points2.stream().filter(it -> it.getX() == point.getX()).collect(Collectors.toList());
-                if (item != null && item.size() > 0) {
+                List<PointVo> item = points2.stream().filter(it -> Objects.equals(it.getX(), point.getX())).collect(Collectors.toList());
+                if (item.size() > 0) {
                     sum += Math.pow((point.getY() - item.get(0).getY()), 2);
                     count++;
                     pc += point.getY() - item.get(0).getY();
@@ -911,10 +925,10 @@ public class PowerCurveFittingService {
         if (points1 != null && points1.size() != 0 && points2 != null && points2.size() != 0) {
             double count = 0;
             double sum = 0;
-            double max = (double) modelpower;
+            double max = modelpower;
             for (PointVo point : points1) {
-                List<PointVo> item = points2.stream().filter(it -> it.getX() == point.getX()).collect(Collectors.toList());
-                if (item != null && item.size() > 0 && item.get(0).getX() >= minSpeed && item.get(0).getX() < maxSpeed) {
+                List<PointVo> item = points2.stream().filter(it -> Objects.equals(it.getX(), point.getX())).collect(Collectors.toList());
+                if (item.size() > 0 && item.get(0).getX() >= minSpeed && item.get(0).getX() < maxSpeed) {
                     sum += Math.pow((point.getY() - item.get(0).getY()), 2);
                     count++;
                     pc += point.getY() - item.get(0).getY();
@@ -943,9 +957,11 @@ public class PowerCurveFittingService {
             }
         }
 
-        //判定状态不为运行的进行过滤
-        if (zt.getPointValueInDouble() != 2) {
-            return false;
+        if (StringUtils.notEmp(fs)) {
+            //判定功率是否超过最大值
+            if (gl.getPointValueInDouble() > 25) {
+                return false;
+            }
         }
 
         //判定状态不为运行的进行过滤
@@ -953,6 +969,8 @@ public class PowerCurveFittingService {
             return false;
         }
 
+
+
         //设置时间为10分钟前,10钟前有停机事件数据进行过滤
         Calendar c = Calendar.getInstance();
         c.setTimeInMillis(zt.getPointTime());
@@ -1015,18 +1033,16 @@ public class PowerCurveFittingService {
         if (null != value && value.size() > 0) {
             double qfzt = value.get(0).getPointValueInDouble();
 
-            if (qfzt > 2) {
-                return false;
-            }
+            return !(qfzt > 2);
         }
         return true;
     }
 
     //功率曲线拟合
     public void curveFittingBuilder(Date begin, Date end, int dimension, double scale, String pointIdGL, String pointIdFS, String pointIdZT, List<PointVo> sjglPoints, List<PointVo> zyglPoints, String windturbineId) throws Exception {
-        double maxPower = (double) windturbineCapacity.get(windturbineId) * 1.3;
-        List<PointfVo> sjglnhpoints = new ArrayList<PointfVo>();
-        Map<Double, PointfVo> zyglnhpoints = new HashMap<Double, PointfVo>();
+        double maxPower = windturbineCapacity.get(windturbineId) * 1.3;
+        List<PointfVo> sjglnhpoints = new ArrayList<>();
+        Map<Double, PointfVo> zyglnhpoints = new HashMap<>();
 
         if (end.after(begin)) {
             if (StringUtils.notEmp(pointIdGL) && StringUtils.notEmp(pointIdFS)) {
@@ -1038,7 +1054,7 @@ public class PowerCurveFittingService {
                 List<PointData> glpoints = new ArrayList<>();
                 List<PointData> fspoints = new ArrayList<>();
                 List<PointData> ztpoints = new ArrayList<>();
-                if (glpointstemp.isEmpty() && fspointstemp.isEmpty() && ztpointstemp.isEmpty() && glpointstemp.size() == fspointstemp.size() && fspointstemp.size() == ztpointstemp.size()) {
+                if (!glpointstemp.isEmpty() && !fspointstemp.isEmpty() && !ztpointstemp.isEmpty() && glpointstemp.size() == fspointstemp.size() && fspointstemp.size() == ztpointstemp.size()) {
                     for (int i = 0; i < glpointstemp.size(); i++) {
                         if (filterData(glpointstemp.get(i), fspointstemp.get(i), ztpointstemp.get(i), maxPower, windturbineId)) {
                             glpoints.add(glpointstemp.get(i));
@@ -1054,24 +1070,24 @@ public class PowerCurveFittingService {
                         double x = fspoints.get(i).getPointValueInDouble();
                         double y = -1;
                         double z = -1;
-                        double z1 = -1;
+
                         int finalI1 = i;
                         List<PointData> yArray = glpoints.stream().filter(it -> it.getPointTime().compareTo(fspoints.get(finalI1).getPointTime()) == 0).collect(Collectors.toList());
-                        if (yArray != null && yArray.size() > 0) {
+                        if (yArray.size() > 0) {
 
                             y = yArray.get(i).getPointValueInDouble();
                         }
 
                         int finalI = i;
                         yArray = ztpoints.stream().filter(it -> it.getPointTime().compareTo(fspoints.get(finalI).getPointTime()) == 0).collect(Collectors.toList());
-                        if (yArray != null && yArray.size() > 0) {
+                        if (yArray.size() > 0) {
 
                             z = yArray.get(i).getPointValueInDouble();
                         }
 
 
                         Double x1 = StringUtils.round(x, 2);
-                        Double y1 = (Double) y;
+                        Double y1 =  y;
 
 
                         boolean b = true;
@@ -1128,7 +1144,7 @@ public class PowerCurveFittingService {
 
 
                         Double x1 = StringUtils.round(x, 2);
-                        Double y1 = (Double) y;
+                        Double y1 =  y;
 
 
                         boolean b = true;
@@ -1176,30 +1192,28 @@ public class PowerCurveFittingService {
 
                 sjglnhpoints = sjglnhpoints.stream().filter(it -> it.getX() >= 3).sorted(Comparator.comparing(PointfVo::getX)).collect(Collectors.toList());
 
-                List<PointVo> temp = LineUtil.buildLine(sjglnhpoints.stream().mapToDouble(i -> i.getX()).toArray(), sjglnhpoints.stream().mapToDouble(i -> i.getY()).toArray(), sjglnhpoints.size(), dimension, scale);
+                List<PointVo> temp = LineUtil.buildLine(sjglnhpoints.stream().mapToDouble(PointfVo::getX).toArray(), sjglnhpoints.stream().mapToDouble(PointfVo::getY).toArray(), sjglnhpoints.size(), dimension, scale);
 
                 sjglPoints.addAll(temp);
-                if (sjglPoints != null && sjglPoints.size() != 0) {
+                if (sjglPoints.size() != 0) {
                     buildMyPoints(sjglPoints, scale);
                 }
 
 
-                if (!zyglnhpoints.containsKey(0))
+                if (!zyglnhpoints.containsKey(0.0))
                     zyglnhpoints.put(0.0, new PointfVo(0.0, 0.0));
 
-                List<PointfVo> FF = zyglnhpoints.values().stream().filter(it -> it.getX() >= 3).sorted(Comparator.comparing(PointfVo::getX)).collect(Collectors.toList());
-                if (FF != null && FF.size() != 0) {
-                    temp = LineUtil.buildLine(FF.stream().mapToDouble(i -> i.getX()).toArray(), FF.stream().mapToDouble(i -> i.getY()).toArray(), FF.size(), dimension, scale);
+                List<PointfVo> zygltemp = zyglnhpoints.values().stream().filter(it -> it.getX() >= 3).sorted(Comparator.comparing(PointfVo::getX)).collect(Collectors.toList());
+                if (zygltemp.size() != 0) {
+                    temp = LineUtil.buildLine(zygltemp.stream().mapToDouble(PointfVo::getX).toArray(), zygltemp.stream().mapToDouble(PointfVo::getY).toArray(), zygltemp.size(), dimension, scale);
                 }
                 zyglPoints.addAll(temp);
-                if (zyglPoints != null && zyglPoints.size() != 0) {
+                if (zyglPoints.size() != 0) {
                     buildMyPoints(zyglPoints, scale);
                 }
 
 
-                sjglPoints = sjglPoints.stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
 
-                zyglPoints = zyglPoints.stream().filter(it -> it.getX() >= 0 && it.getX() <= 25).sorted(Comparator.comparing(PointVo::getX)).collect(Collectors.toList());
             }
         }
     }
@@ -1220,10 +1234,23 @@ public class PowerCurveFittingService {
         smax *= coefficient;
 
 
-        double min = sjglPoints.stream().min((a, b) -> a.getX().compareTo(b.getX())).get().getX() * coefficient;
-        double max = sjglPoints.stream().max((a, b) -> a.getX().compareTo(b.getX())).get().getX() * coefficient;
+        double min =0.0;
+        double max=0.0;
+        double maxval =0.0;
+        if(sjglPoints.stream().min(Comparator.comparing(PointVo::getX)).isPresent())
+        {
+             min = sjglPoints.stream().min(Comparator.comparing(PointVo::getX)).get().getX() * coefficient;
+
+        }
+        if(sjglPoints.stream().max(Comparator.comparing(PointVo::getX)).isPresent())
+        {
+             max = sjglPoints.stream().max(Comparator.comparing(PointVo::getX)).get().getX() * coefficient;
+        }
+        if(sjglPoints.stream().max(Comparator.comparing(PointVo::getY)).isPresent())
+        {
+            maxval = sjglPoints.stream().max(Comparator.comparing(PointVo::getY)).get().getY();
+        }
 
-        double maxval = sjglPoints.stream().max((a, b) -> a.getY().compareTo(b.getY())).get().getY();
 
         for (double i = 0; i < min; i += 1) {
             PointVo point = new PointVo();

+ 119 - 163
realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownService.java

@@ -10,7 +10,6 @@ import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -20,11 +19,10 @@ import java.util.stream.Collectors;
 @Service
 public class ShutdownService {
 
-    private static final Logger log = LoggerFactory.getLogger(ShutdownService.class);
+
     @Resource
     private IEdosUtil edosUtil;
-    @Resource
-    private IProEconWtPowerCurveFittingService proEconWtPowerCurveFittingService;
+
     @Resource
     private IProEconWindturbineStatusService proEconWindturbineStatusService;
 
@@ -38,64 +36,58 @@ public class ShutdownService {
 
     @Resource
     private IProEconInputOrOutputSpeedService proEconInputOrOutputSpeedService;
-    @Resource
-    private IProBasicModelPowerRdService proBasicModelPowerRdService;
 
 
 
-    private static Logger logger = LoggerFactory.getLogger(ShutdownService.class);
+
+    public static Logger logger = LoggerFactory.getLogger(ShutdownService.class);
 
     /// <summary>
     /// 风机状态测点,key为风机编号
     /// </summary>
-    private Map<String, ProBasicEquipmentPoint> statusPoints = new HashMap<String, ProBasicEquipmentPoint>();
+    public Map<String, ProBasicEquipmentPoint> statusPoints = new HashMap<>();
     /// <summary>
     /// 风机功率测点,key为风机编号
     /// </summary>
-    private Map<String, ProBasicEquipmentPoint> powerPoints = new HashMap<String, ProBasicEquipmentPoint>();
+    public Map<String, ProBasicEquipmentPoint> powerPoints = new HashMap<>();
     /// <summary>
     /// 风机当前状态,key为风机编号
     /// </summary>
-    private Map<String, Integer> status = new HashMap<String, Integer>();
+    public Map<String, Integer> status = new HashMap<>();
     /// <summary>
     /// 保存风机信息,key为风机编号
     /// </summary>
-    private Map<String, ProBasicEquipment> windTurbines = new HashMap<String, ProBasicEquipment>();
+    public Map<String, ProBasicEquipment> windTurbines = new HashMap<>();
 
     /// <summary>
     /// 风机状态说明,key为状态码,value为状态说明
     /// </summary>
-    private Map<Integer, String> statusDescription = new HashMap<Integer, String>();
+    public Map<Integer, String> statusDescription = new HashMap<>();
 
 
-    private Date date = new Date();
+    public Date date = new Date();
 
-    Map<String, ProEconWindturbineStatus> oldStatusMap = new HashMap<String, ProEconWindturbineStatus>();
-    Map<String, ProEconShutdownEvent> oldShutdownEvent = new HashMap<String, ProEconShutdownEvent>();
-    Map<String, ProEconInterruption> oldInterrup = new HashMap<String, ProEconInterruption>();
+    Map<String, ProEconWindturbineStatus> oldStatusMap = new HashMap<>();
+    Map<String, ProEconShutdownEvent> oldShutdownEvent = new HashMap<>();
+    Map<String, ProEconInterruption> oldInterrup = new HashMap<>();
 
    //新增shutdownevent2 实时
-    Map<String, ProEconShutdownEvent2> oldShutdownEvent2 = new HashMap<String, ProEconShutdownEvent2>();
+    Map<String, ProEconShutdownEvent2> oldShutdownEvent2 = new HashMap<>();
 
 
     /// <summary>
     /// 风机功率 key为风机编号
     /// </summary>
-    Map<String, ProBasicEquipmentPoint> powerpointMap = new HashMap<String, ProBasicEquipmentPoint>();//功率
+    Map<String, ProBasicEquipmentPoint> powerpointMap = new HashMap<>();//功率
     /// <summary>
     /// 风机风速 key为风机编号
     /// </summary>
-    Map<String, ProBasicEquipmentPoint> speedpointMap = new HashMap<String, ProBasicEquipmentPoint>();//风速
+    Map<String, ProBasicEquipmentPoint> speedpointMap = new HashMap<>();//风速
     /// <summary>
     /// 测风塔风速 key为风场编号
     /// </summary>
-    Map<String, ProBasicPowerstationPoint> gzdpointMap = new HashMap<String, ProBasicPowerstationPoint>();//测风塔风速
-    /// <summary>
-    ///
-    /// </summary>
-//    Map<String, Map<Double, ProBasicModelPower>> modelPowerMap = new HashMap<String, Map<Double, ProBasicModelPower>>();
-    //不在从新拟合功率曲线,从数据库中直接取值
-    Map<String, Map<Double, ProBasicModelPowerRd>> modelPowerMap = new HashMap<String, Map<Double, ProBasicModelPowerRd>>();
+    Map<String, ProBasicPowerstationPoint> gzdpointMap = new HashMap<>();//测风塔风速
+
     Map<String, ProBasicPowerstation> windpowerMap;//风场
 
 
@@ -135,7 +127,7 @@ public class ShutdownService {
         List<ProBasicEquipment> wtls= CacheContext.wtls;
         Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap=CacheContext.wtpAimap;
         //筛选风机对应测点
-        wtls.stream().forEach(wt->{
+        wtls.forEach(wt->{
             Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
             if(windturbinetestingpointnewMap.containsKey(ContantXk.MXZT))
             {
@@ -174,7 +166,7 @@ public class ShutdownService {
 
             windTurbines=CacheContext.wtmap;
             List<ProBasicPowerstationPoint> gzdpointList =new ArrayList<>();
-                CacheContext.wpls.stream().forEach(wp->{
+                CacheContext.wpls.forEach(wp->{
 
                     Map<String, ProBasicPowerstationPoint> wppointsmap = CacheContext.wppointmap.get(wp.getId());
                     if(wppointsmap.containsKey(ContantXk.FCCFTFS70))
@@ -186,29 +178,22 @@ public class ShutdownService {
             });
 
 
-
-            for (Integer i = 0; i < powerpointList.size(); i++)
-            {
-                if (!powerpointMap.containsKey(powerpointList.get(i).getWindturbineId()))
-                {
-                    powerpointMap.put(powerpointList.get(i).getWindturbineId(), powerpointList.get(i));
-                }
+        for (ProBasicEquipmentPoint proBasicEquipmentPoint : powerpointList) {
+            if (!powerpointMap.containsKey(proBasicEquipmentPoint.getWindturbineId())) {
+                powerpointMap.put(proBasicEquipmentPoint.getWindturbineId(), proBasicEquipmentPoint);
             }
-            for (Integer i = 0; i < speedpointList.size(); i++)
-            {
-                if (!speedpointMap.containsKey(speedpointList.get(i).getWindturbineId()))
-                {
-                    speedpointMap.put(speedpointList.get(i).getWindturbineId(), speedpointList.get(i));
-                }
+        }
+        for (ProBasicEquipmentPoint proBasicEquipmentPoint : speedpointList) {
+            if (!speedpointMap.containsKey(proBasicEquipmentPoint.getWindturbineId())) {
+                speedpointMap.put(proBasicEquipmentPoint.getWindturbineId(), proBasicEquipmentPoint);
             }
+        }
 
-            for (Integer i = 0; i < gzdpointList.size(); i++)
-            {
-                if (!gzdpointMap.containsKey(gzdpointList.get(i).getWindpowerstationId()))
-                {
-                    gzdpointMap.put(gzdpointList.get(i).getWindpowerstationId(), gzdpointList.get(i));
-                }
+        for (ProBasicPowerstationPoint proBasicPowerstationPoint : gzdpointList) {
+            if (!gzdpointMap.containsKey(proBasicPowerstationPoint.getWindpowerstationId())) {
+                gzdpointMap.put(proBasicPowerstationPoint.getWindpowerstationId(), proBasicPowerstationPoint);
             }
+        }
 
 
 //        List<ProBasicModelPowerRd>  pbmprls=proBasicModelPowerRdService.list().stream()
@@ -240,7 +225,11 @@ public class ShutdownService {
 
 
 
-    public void exec() throws Exception {
+    public void execShutdown() throws Exception {
+
+        init();
+
+
         oldStatusMap.clear();
         oldShutdownEvent.clear();
         oldInterrup.clear();
@@ -258,16 +247,16 @@ public class ShutdownService {
                 power = StringUtils.round(edosUtil.getRealData(powerPoints.get(key).getNemCode()).getPointValueInDouble(),4);
 
             }
-            Double value = StringUtils.round(edosUtil.getRealData(statusPoints.get(key).getNemCode()).getPointValueInDouble(),4);
+            double value = StringUtils.round(edosUtil.getRealData(statusPoints.get(key).getNemCode()).getPointValueInDouble(),4);
 
             if (power > 1)
             {
-                status.put(key,value == 9 ? 1 : value.intValue());
+                status.put(key,value == 9 ? 1 : (int) value);
 
             }
             else
             {
-                status.put(key,value == 9 ? 0 : value.intValue());
+                status.put(key,value == 9 ? 0 : (int) value);
 
             }
 
@@ -350,11 +339,11 @@ public class ShutdownService {
 
                     //logger.debug("{0}重复加入 风机编号{1}", date,s);
 
-                    ProEconShutdownEvent shutdwonEvent=null;
-                    ProEconInterruption interrup=null;
+                    ProEconShutdownEvent shutdwonEvent=new ProEconShutdownEvent();
+                    ProEconInterruption interrup=new ProEconInterruption();
 
                     //新增 shutdownevent2 实时
-                    ProEconShutdownEvent2 shutdwonEvent2=null;
+                    ProEconShutdownEvent2 shutdwonEvent2=new ProEconShutdownEvent2();
 
 
                     item = buildWindturbineStatus(s, date,  shutdwonEvent,  interrup,  shutdwonEvent2);
@@ -363,44 +352,35 @@ public class ShutdownService {
 
                     proEconWindturbineStatusService.save(item);
 
-                    if (shutdwonEvent != null)
-                    {
-                        proEconShutdownEventService.save(shutdwonEvent);
-                    }
-                    if (interrup != null)
-                    {
-                        proEconInterruptionService.save(interrup);
+                    proEconShutdownEventService.save(shutdwonEvent);
 
-                    }
+                    proEconInterruptionService.save(interrup);
 
                      //  新增 shutdownevent2 实时
-                    if (shutdwonEvent2 != null)
-                    {
-                        //20分钟以内的报警数据
-                        Date dtbegin = DateUtils.addMinutes(shutdwonEvent2.getStopTime(),-15);
-                        Date dtend = shutdwonEvent2.getStopTime();
+                    //20分钟以内的报警数据
+                    Date dtbegin = DateUtils.addMinutes(shutdwonEvent2.getStopTime(),-15);
+                    Date dtend = shutdwonEvent2.getStopTime();
 
-                        Optional<ProEconShutdownEvent2> olditemo=proEconShutdownEvent2Service.list().stream()
-                                .filter(i->i.getWindturbineId().equals(s)
-                                        && ( i.getStartTime().compareTo(dtbegin)==0 || i.getStartTime().after(dtbegin))
-                                        && (i.getStartTime().compareTo(dtend)==0 || i.getStartTime().before(dtend))
+                    Optional<ProEconShutdownEvent2> olditemo= proEconShutdownEvent2Service.list().stream()
+                            .filter(i -> i.getWindturbineId().equals(s)
+                                    && (i.getStartTime().compareTo(dtbegin) == 0 || i.getStartTime().after(dtbegin))
+                                    && (i.getStartTime().compareTo(dtend) == 0 || i.getStartTime().before(dtend))
 
-                                ).sorted(Comparator.comparing(ProEconShutdownEvent2::getStartTime)).findFirst();
+                            ).min(Comparator.comparing(ProEconShutdownEvent2::getStartTime));
 
-                        ProEconShutdownEvent2 lditem=null;
-                        if (!olditemo.isPresent())
-                        {
-                            proEconShutdownEvent2Service.save(shutdwonEvent2);
+                    ProEconShutdownEvent2 lditem;
+                    if (!olditemo.isPresent())
+                    {
+                        proEconShutdownEvent2Service.save(shutdwonEvent2);
 
-                        }
-                        else
-                        {
-                            lditem=olditemo.get();
-                            lditem.setStartTime(null);
-                            if (null !=lditem && !oldShutdownEvent2.containsKey(lditem.getWindturbineId()))
-                                oldShutdownEvent2.put(lditem.getWindturbineId(), lditem);
+                    }
+                    else
+                    {
+                        lditem=olditemo.get();
+                        lditem.setStartTime(null);
+                        if (!oldShutdownEvent2.containsKey(lditem.getWindturbineId()))
+                            oldShutdownEvent2.put(lditem.getWindturbineId(), lditem);
 
-                        }
                     }
 
                     continue;
@@ -415,12 +395,12 @@ public class ShutdownService {
 
                     updateAndAddStatus( item);
                 }
-                else if (((Integer)item.getSatusCode()) != status.get(s))
+                else if (!Objects.equals(item.getSatusCode(), status.get(s)))
                 {
                     updateAndAddStatus(item);
 
                     //    #region 切入切出风速
-                    if (((Integer)item.getSatusCode()) == 0 && status.get(s) == 2)
+                    if (item.getSatusCode() == 0 && status.get(s) == 2)
                     {
                         ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
                         input.setWindturbineId(s);
@@ -440,7 +420,7 @@ public class ShutdownService {
                         proEconInputOrOutputSpeedService.save(input);
 
                     }
-                    else if (((Integer)item.getSatusCode()) == 1 && status.get(s)== 0)
+                    else if (item.getSatusCode() == 1 && status.get(s)== 0)
                     {
                         ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
                         input.setWindturbineId(s);
@@ -477,7 +457,7 @@ public class ShutdownService {
     /// <param name="entities"></param>
     /// <param name="status"></param>
     private void updateAndAddStatus2(ProEconWindturbineStatus status) throws Exception {
-        Integer oldStatus = (Integer)status.getSatusCode();
+        Integer oldStatus = status.getSatusCode();
         if (oldStatus == 4 || oldStatus == 6)
         {
 
@@ -493,7 +473,7 @@ public class ShutdownService {
             if (ose2 != null)
             {
 
-                Double gc = calcLossPower(ose.getWindturbineId(), ose2.getStopTime(), date);
+                Double gc = calcLossPower(ose2.getWindturbineId(), ose2.getStopTime(), date);
                 ose2.setLossPower(gc);
 
             }
@@ -525,7 +505,7 @@ public class ShutdownService {
         if (speedDataList1 != null && speedDataList1.size() > 0)
         {
             status.setSpeed(speedDataList1.get(0).getPointValueInDouble());
-            DoubleSummaryStatistics summaryStatistics=speedDataList1.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
+            DoubleSummaryStatistics summaryStatistics=speedDataList1.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
             status.setAvgSpeed(summaryStatistics.getAverage());
         }
         else
@@ -534,13 +514,13 @@ public class ShutdownService {
             status.setAvgSpeed(0.0);
         }
 
-        Double timehour=DateUtils.hoursDiff2(date,status.getStopTime());
+        double timehour=DateUtils.hoursDiff2(date,status.getStopTime());
         status.setStopHours(timehour);
 
-        ProEconShutdownEvent shutdwonEvent = null;
-        ProEconInterruption interrup = null;
+        ProEconShutdownEvent shutdwonEvent = new ProEconShutdownEvent();
+        ProEconInterruption interrup = new ProEconInterruption();
            // #region 新增 shutdownevent2 实时
-        ProEconShutdownEvent2 shutdwonEvent2 = null;
+        ProEconShutdownEvent2 shutdwonEvent2 = new ProEconShutdownEvent2();
 
 
         ProEconWindturbineStatus newStatusItem = buildWindturbineStatus(status.getWindturbineId(), date,  shutdwonEvent,  interrup,  shutdwonEvent2);
@@ -548,60 +528,51 @@ public class ShutdownService {
         proEconWindturbineStatusService.save(newStatusItem);
 
 
-        Integer oldStatus = (Integer)status.getSatusCode();
+        Integer oldStatus = status.getSatusCode();
         Integer currentStatus = this.status.get(status.getWindturbineId());
-        if (shutdwonEvent != null)
-        {
 
-            if (currentStatus == 4 || currentStatus == 6)
+        if (currentStatus == 4 || currentStatus == 6)
+        {
+            if (oldStatus == 0 || oldStatus == 1 || oldStatus == 12)
             {
-                if (oldStatus == 0 || oldStatus == 1 || oldStatus == 12)
-                {
-                    proEconShutdownEventService.save(shutdwonEvent);
+                proEconShutdownEventService.save(shutdwonEvent);
 
-                }
             }
         }
-        if (interrup != null)
+        if (currentStatus == 12 && oldStatus != 12)
         {
-            if (currentStatus == 12 && oldStatus != 12)
-            {
-                proEconInterruptionService.save(interrup);
+            proEconInterruptionService.save(interrup);
 
-            }
         }
-       // 新增 shutdownevent2 实时
-        if (shutdwonEvent2 != null)
+        // 新增 shutdownevent2 实时
+        if (currentStatus == 4 || currentStatus == 6)
         {
-            if (currentStatus == 4 || currentStatus == 6)
+            if (oldStatus == 0 || oldStatus == 1 || oldStatus == 12)
             {
-                if (oldStatus == 0 || oldStatus == 1 || oldStatus == 12)
-                {
-                    Date dtbegin = DateUtils.addMinutes(shutdwonEvent2.getStopTime(),-30);
-                    Date dtend = shutdwonEvent2.getStopTime();
-                    String windTurbineId = shutdwonEvent2.getWindturbineId();
+                Date dtbegin = DateUtils.addMinutes(shutdwonEvent2.getStopTime(),-30);
+                Date dtend = shutdwonEvent2.getStopTime();
+                String windTurbineId = shutdwonEvent2.getWindturbineId();
 
-                    Optional<ProEconShutdownEvent2> olditem=proEconShutdownEvent2Service.list().stream()
-                            .filter(i->i.getWindturbineId().equals(windTurbineId)
-                                    && ( i.getStartTime().compareTo(dtbegin)==0 || i.getStartTime().after(dtbegin))
-                                    && (i.getStartTime().compareTo(dtend)==0 || i.getStartTime().before(dtend))
+                Optional<ProEconShutdownEvent2> olditem= proEconShutdownEvent2Service.list().stream()
+                        .filter(i -> i.getWindturbineId().equals(windTurbineId)
+                                && (i.getStartTime().compareTo(dtbegin) == 0 || i.getStartTime().after(dtbegin))
+                                && (i.getStartTime().compareTo(dtend) == 0 || i.getStartTime().before(dtend))
 
 
-                            ).sorted(Comparator.comparing(ProEconShutdownEvent2::getStartTime)).findFirst();
+                        ).min(Comparator.comparing(ProEconShutdownEvent2::getStartTime));
 
-                    ProEconShutdownEvent2 temp=null;
-                    if (!olditem.isPresent())
-                    {
-                        proEconShutdownEvent2Service.save(shutdwonEvent2);
+                ProEconShutdownEvent2 temp;
+                if (!olditem.isPresent())
+                {
+                    proEconShutdownEvent2Service.save(shutdwonEvent2);
 
-                    }
-                    else
-                    {
-                        temp=olditem.get();
-                        temp.setStartTime(null);
-                        if (!oldShutdownEvent2.containsKey(temp.getWindturbineId()))
-                            oldShutdownEvent2.put(temp.getWindturbineId(), temp);
-                    }
+                }
+                else
+                {
+                    temp=olditem.get();
+                    temp.setStartTime(null);
+                    if (!oldShutdownEvent2.containsKey(temp.getWindturbineId()))
+                        oldShutdownEvent2.put(temp.getWindturbineId(), temp);
                 }
             }
         }
@@ -633,28 +604,17 @@ public class ShutdownService {
                 }
                //  新增 shutdownevent2 实时
                 ProEconShutdownEvent2 ose2 = oldShutdownEvent2.get(status.getWindturbineId());
-                if (ose2 != null)
+                if (ose2 != null  )
                 {
 
                     ose2.setStartTime(date);
 
-                    timehour=DateUtils.hoursDiff2(date,ose.getStopTime());
+                    timehour=DateUtils.hoursDiff2(date,ose2.getStopTime());
                     ose2.setStopHours(timehour);
 
                     if (ose!=null && !ose.getStoptypeId().equals("wh"))
                     {
-                        if (ose != null)
-                        {
-                            ose2.setStopTypeId(ose.getStoptypeId());
-                        }
-                        else
-                        {
-                            String s = newMethod( status.getWindturbineId(), DateUtils.addMinutes(ose2.getStopTime(),-5), date);
-                            if (StringUtils.notEmp(s))
-                            {
-                                ose2.setStopTypeId(s);
-                            }
-                        }
+                        ose2.setStopTypeId(ose.getStoptypeId());
                     }
                 }
 
@@ -681,7 +641,7 @@ public class ShutdownService {
 
 
     private Double calcLossPower(String windturbineId, Date startDate, Date endDate) throws Exception {
-        Double result = 0.0;
+        double result = 0.0;
 
         Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
         Map<String, ProBasicEquipmentPoint> wtpointmap=wtpAimap.get(windturbineId);
@@ -696,8 +656,8 @@ public class ShutdownService {
             //年故障损失电量
             if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
             {
-                double beginvalue=0.0;
-                double endvalue=0.0;
+                double beginvalue;
+                double endvalue;
 
                 List<String> pointid=new ArrayList<>();
                 pointid.add(wtpointmap.get(ContantXk.NGZSSDL).getNemCode());
@@ -727,15 +687,15 @@ public class ShutdownService {
             //年故障损失电量
             if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
             {
-                double beginvalue=0.0;
-                double endvalue=0.0;
+                double beginvalue;
+                double endvalue;
 
 
 
                 List<String> pointid=new ArrayList<>();
                 pointid.add(wtpointmap.get(ContantXk.NGZSSDL).getNemCode());
                 List<PointData> xdbegin=edosUtil.getHistMatrix(pointid,startDate.getTime()/1000);
-                List<PointData> xdend=edosUtil.getHistMatrix(pointid,endDate.getTime()/1000);
+                List<PointData> xdend=edosUtil.getHistMatrix(pointid,endtime.getTime()/1000);
 
 
                 if(xdbegin.size()==1 && xdend.size()==1)
@@ -756,7 +716,7 @@ public class ShutdownService {
             if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
             {
 
-                double endvalue=0.0;
+                double endvalue;
 
 
                 List<String> pointid=new ArrayList<>();
@@ -801,7 +761,7 @@ public class ShutdownService {
         Integer currentStatus = status.get(windturbineId);
         if (currentStatus == 4 || currentStatus == 6)
         {
-            shutdwonEvent = new ProEconShutdownEvent();
+
             shutdwonEvent.setId(StringUtils.getUUID());
             shutdwonEvent.setProjectId(retValue.getProjectId());
             shutdwonEvent.setStatusCode(currentStatus);
@@ -810,7 +770,7 @@ public class ShutdownService {
             shutdwonEvent.setWindturbineId(windturbineId);
 
 
-            shutdwonEvent2 = new ProEconShutdownEvent2();
+
             shutdwonEvent2.setId(StringUtils.getUUID());
             shutdwonEvent2.setProjectId(retValue.getProjectId());
             shutdwonEvent2.setStatusCode(currentStatus);
@@ -822,8 +782,8 @@ public class ShutdownService {
             {
                 Date begin =DateUtils.addMinutes(date,-5);
                 Date end = DateUtils.addMinutes(date,5);
-                shutdwonEvent.setStoptypeId(currentStatus == 4 ? "gzbmq" : "wh");
-                shutdwonEvent2.setStopTypeId(currentStatus == 4 ? "gzbmq" : "wh");
+                shutdwonEvent.setStoptypeId("gzbmq");
+                shutdwonEvent2.setStopTypeId("gzbmq");
                 //读取报警记录表前后五分钟数据,选取第一个报警报警类型
                 String s =newMethod( windturbineId, begin, end);
                 if (StringUtils.notEmp(s))
@@ -844,7 +804,7 @@ public class ShutdownService {
         }
         if (currentStatus == 12)
         {
-            interrup = new ProEconInterruption();
+
             interrup.setProjectId(retValue.getProjectId());
             interrup.setStopTime(date);
             interrup.setWindpowerstationId(retValue.getWindpowerstationId());
@@ -857,12 +817,8 @@ public class ShutdownService {
 
     /**
      *
-     * @param windturbineId
-     * @param begin
-     * @param end
-     * @return
      */
-    private static String newMethod( String windturbineId, Date begin, Date end)
+    private  String newMethod( String windturbineId, Date begin, Date end)
     {
         String result = "";
 

+ 5 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/initialpoint/InitialPointGoldenXkByEqService.java

@@ -750,7 +750,12 @@ public class InitialPointGoldenXkByEqService implements IinitialPoint {
                     for (int i = 0; i < ls.size(); i++) {
 
 
+
                         ProEconTestingPoint stp = ls.get(i);
+                        if(!stp.getTypeId().contains("jsfw") && !stp.getModel().equals(wt.getModelId()))
+                        {
+                            continue;
+                        }
                         StringBuilder sb = new StringBuilder();
 //                        sb.append(wp.getPhoto());
 

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

@@ -0,0 +1,264 @@
+//package com.gyee.generation.task;
+//
+//
+//import com.gyee.common.util.DateUtils;
+//import com.gyee.generation.init.CacheContext;
+//import com.gyee.generation.service.*;
+//import com.xxl.job.core.context.XxlJobHelper;
+//import com.xxl.job.core.handler.annotation.XxlJob;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.springframework.stereotype.Component;
+//
+//import javax.annotation.Resource;
+//import java.util.Date;
+//
+///**
+// * @ClassName : SaticScheduleTask
+// * @Description : 调度
+// */
+//
+//
+//@Component
+//public class SaticSchedulePgTask {
+//
+//    private static Logger logger = LoggerFactory.getLogger(SaticSchedulePgTask.class);
+//
+//    @Resource
+//    private InputOrOutPutService inputOrOutPutService;
+//    @Resource
+//    private LimitEventService limitEventService;
+//    @Resource
+//    private PowerCurveFittingService powerCurveFittingService;
+//    @Resource
+//    private ShutdownService shutdownService;
+//    @Resource
+//    private WindPowerInfo1Service windPowerInfo1Service;
+//    @Resource
+//    private WindPowerInfo2Service windPowerInfo2Service;
+//    @Resource
+//    private WindPowerInfo3Service windPowerInfo3Service;
+//    @Resource
+//    private WindPowerInfo4Service windPowerInfo4Service;
+//    @Resource
+//    private WindPowerInfo5Service windPowerInfo5Service;
+//    @Resource
+//    private WindPowerInfo6Service windPowerInfo6Service;
+//    @Resource
+//    private EquipmentInfo1Service equipmentInfo1Service;
+//    @Resource
+//    private EquipmentInfo2Service equipmentInfo2Service;
+//    @Resource
+//    private EquipmentInfo3Service equipmentInfo3Service;
+//    @Resource
+//    private EquipmentInfo4Service equipmentInfo4Service;
+//    @Resource
+//    private EquipmentInfo5Service equipmentInfo5Service;
+//    @Resource
+//    private EquipmentInfoDayTopService equipmentInfoDayTopService;
+//    //3.添加定时任务
+//    /**
+//     * 切入切出统计
+//     * 每天执行一次
+//     */
+//
+//    @XxlJob("inputOrOutPut_PG")
+//    public void inputOrOutPut_PG()  {
+//
+//
+//        XxlJobHelper.log("切入切出统计调度程序执行开始!........");
+//        try {
+//            inputOrOutPutService.inputOrOutput(new Date());
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//        XxlJobHelper.log("切入切出统计调度任务处理完成!........");
+//    }
+//
+//    /**
+//     * 停机记录
+//     * 每15分钟执行一次
+//     */
+//    @XxlJob("shutdown_PG")
+//    public void shutdown_PG()  {
+//
+//        XxlJobHelper.log("停机记录调度程序执行开始!........");
+//
+//        try {
+//            shutdownService.execShutdown();
+//            limitEventService.execBrownouts2();
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//        XxlJobHelper.log("停机记录调度任务处理完成!........");
+//    }
+//
+//    /**
+//     * 限电停机记录
+//     * 每15分钟执行一次
+//     */
+//    @XxlJob("brownouts_PG")
+//    public void brownouts_PG()  {
+//
+//        XxlJobHelper.log("限电停机记录调度程序执行开始!........");
+//
+//        try {
+//            limitEventService.execBrownouts();
+//            limitEventService.execBrownouts2();
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//        XxlJobHelper.log("限电停机记录调度任务处理完成!........");
+//    }
+//
+//    /**
+//     * 日、月、年功率曲线拟合
+//     * 每天执行一次
+//     */
+//    @XxlJob("powerCurveFitting_PG")
+//    public void powerCurveFitting_PG()  {
+//
+//        XxlJobHelper.log("日、月、年功率曲线拟合调度程序执行开始!........");
+//
+//        Date date=new Date();
+//        try {
+//            powerCurveFittingService.cureFitting(date,DateUtils.truncate(date),0, CacheContext.wtls);
+//
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//
+//        XxlJobHelper.log("日、月、年功率曲线拟合调度任务处理完成!........");
+//    }
+//
+//    /**
+//     * 设备指标统计
+//     *  15分钟只执行一次
+//     *
+//     */
+//    @XxlJob("equipment_PowerInfo_PG")
+//    public void equipment_PowerInfo_PG() throws Exception {
+//
+//        XxlJobHelper.log("项目指标调度程序执行开始!........");
+//        Date date=new Date();
+//
+//        equipmentInfo1Service.calEquipmentInfoDay(date);
+//        equipmentInfo2Service.calEquipmentInfoDay(date);
+//        equipmentInfo3Service.calEquipmentInfoDay(date);
+//        equipmentInfo4Service.calEquipmentInfoDay(date);
+//        equipmentInfo5Service.calEquipmentInfoDay(date);
+//
+//
+//        XxlJobHelper.log("项目指标调度程序执行完成!........");
+//
+//    }
+//    /**
+//     * 线路指标统计
+//     *  15分钟只执行一次
+//     *
+//     */
+//    @XxlJob("Line_PowerInfo_PG")
+//    public void Line_PowerInfo_PG() throws Exception {
+//
+//            XxlJobHelper.log("线路指标调度程序执行开始!........");
+//
+//            Date date=new Date();
+//
+//            windPowerInfo1Service.calLineInfoDay(date);
+//            windPowerInfo2Service.calLineInfoDay(date);
+//            windPowerInfo3Service.calLineInfoDay(date);
+//            windPowerInfo4Service.calLineInfoDay(date);
+//            windPowerInfo5Service.calLineInfoDay(date);
+//            windPowerInfo6Service.calLineInfoDay(date);
+//
+//          XxlJobHelper.log("线路指标调度程序执行完成!........");
+//
+//    }
+//
+//    /**
+//     * 线路指标统计
+//     *  15分钟只执行一次
+//     *
+//     */
+//    @XxlJob("project_PowerInfo_PG")
+//    public void project_PowerInfo_PG() throws Exception {
+//
+//        XxlJobHelper.log("项目指标调度程序执行开始!........");
+//        Date date=new Date();
+//
+//        windPowerInfo1Service.calProjectInfoDay(date);
+//        windPowerInfo2Service.calProjectInfoDay(date);
+//        windPowerInfo3Service.calProjectInfoDay(date);
+//        windPowerInfo4Service.calProjectInfoDay(date);
+//        windPowerInfo5Service.calProjectInfoDay(date);
+//        windPowerInfo6Service.calProjectInfoDay(date);
+//
+//        XxlJobHelper.log("项目指标调度程序执行完成!........");
+//
+//    }
+//
+//
+//    /**
+//     * 区域、公司、场站指标统计
+//     *  15分钟只执行一次
+//     *
+//     */
+//    @XxlJob("station_PowerInfo_PG")
+//    public void station_PowerInfo_PG() throws Exception {
+//
+//        XxlJobHelper.log("场站指标统计调度程序执行开始!........");
+//        Date date=new Date();
+//
+//        windPowerInfo1Service.calWindpowerInfoDay(date);
+//        windPowerInfo2Service.calWindpowerInfoDay(date);
+//        windPowerInfo3Service.calWindpowerInfoDay(date);
+//        windPowerInfo4Service.calWindpowerInfoDay(date);
+//        windPowerInfo5Service.calWindpowerInfoDay(date);
+//        windPowerInfo6Service.calWindpowerInfoDay(date);
+//
+//        XxlJobHelper.log("场站指标统计调度程序执行完成!........");
+//        XxlJobHelper.log("公司指标统计调度程序执行开始!........");
+//
+//
+//        windPowerInfo1Service.calWindpowerInfoDay(date);
+//        windPowerInfo2Service.calWindpowerInfoDay(date);
+//        windPowerInfo3Service.calWindpowerInfoDay(date);
+//        windPowerInfo4Service.calWindpowerInfoDay(date);
+//        windPowerInfo5Service.calWindpowerInfoDay(date);
+//        windPowerInfo6Service.calWindpowerInfoDay(date);
+//
+//        XxlJobHelper.log("公司指标统计调度程序执行完成!........");
+//        XxlJobHelper.log("区域指标统计调度程序执行开始!........");
+//
+//
+//        windPowerInfo1Service.calWindpowerInfoDay(date);
+//        windPowerInfo2Service.calWindpowerInfoDay(date);
+//        windPowerInfo3Service.calWindpowerInfoDay(date);
+//        windPowerInfo4Service.calWindpowerInfoDay(date);
+//        windPowerInfo5Service.calWindpowerInfoDay(date);
+//        windPowerInfo6Service.calWindpowerInfoDay(date);
+//
+//        XxlJobHelper.log("区域统计调度程序执行完成!........");
+//
+//    }
+//
+//    /**
+//     * 等级评估统计
+//     * 每天执行一次
+//     */
+//
+//    @XxlJob("equipmentInfoDayTop_PG")
+//    public void equipmentInfoDayTop_PG()  {
+//
+//
+//        XxlJobHelper.log("等级评估统计调度程序执行开始!........");
+//        try {
+//            equipmentInfoDayTopService.calEquipmentInfoDayTop(new Date());
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//        XxlJobHelper.log("等级评估统计调度任务处理完成!........");
+//    }
+//
+//
+//}

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

@@ -9,7 +9,7 @@ spring:
     allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
   #redis集群
   redis:
-    host: 120.46.148.180
+    host: 192.168.11.250
     port: 6379
     timeout: 100000
     #    集群环境打开下面注释,单机不需要打开
@@ -27,18 +27,18 @@ spring:
         min-idle: 0
         max-idle: 8
         max-wait: -1
-    database: 0
+    database: 9
   autoconfigure:
     exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
     driver-class-name: org.postgresql.Driver
-#    url: jdbc:postgresql://192.168.11.248:5432/eng_mctl
-#    username: postgres
-#    password: postgres
-    url: jdbc:postgresql://120.46.148.180:5432/postgres
-    username: gdprod
-    password: gd123
+    url: jdbc:postgresql://192.168.11.248:5432/IMS_NEM_SD
+    username: postgres
+    password: postgres
+#    url: jdbc:postgresql://120.46.148.180:5432/postgres
+#    username: gdprod
+#    password: gd123
     oracle-schema=:
     #    type: com.alibaba.druid.pool.DruidDataSource
     #    url: jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8&serverTimezone=UTC

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

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: dev
+    active: xk
 #    active: xk
 
 #    active: td

+ 0 - 6
web/backmanagerconfig/src/main/java/com/gyee/backconfig/config/CacheContext.java

@@ -6,8 +6,6 @@ import com.gyee.backconfig.model.auto.*;
 import com.gyee.backconfig.service.auto.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.CommandLineRunner;
-import org.springframework.cache.Cache;
-import org.springframework.cache.CacheManager;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -26,10 +24,6 @@ import java.util.Map;
 @Component
 public class CacheContext implements CommandLineRunner {
 
-
-
-
-
     @Autowired
     private IRegionService regionService;//区域
 

+ 2 - 0
web/backmanagerconfig/src/main/java/com/gyee/backconfig/controller/NewtreeController.java

@@ -4,6 +4,7 @@ import com.gyee.backconfig.config.R;
 import com.gyee.backconfig.model.auto.Companys;
 import com.gyee.backconfig.service.NewtreeService;
 import com.gyee.common.model.StringUtils;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -21,6 +22,7 @@ public class NewtreeController {
      *
      * @return
      */
+    @Scheduled(cron = "*/5 * * * * ?")
     @GetMapping(value = "/treels")
     @ResponseBody
     @CrossOrigin(origins = "*", maxAge = 3600)

+ 1 - 1
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/WindpowerstationPGService.java

@@ -712,7 +712,7 @@ public class WindpowerstationPGService implements BaseService<WindpowerstationPG
         tcsd.put("sdgsgfzjrl", MathUtil.twoBit(sdqjnysum));
         tcsd.put("sdgsfd", sdqjnyfd.size());
         tcsd.put("sdgsfdzjrl", MathUtil.twoBit(sdqjnyfdsum));
-        tcsd.put("sdgszjrl", MathUtil.twoBit(sdqjnysum + sdqjnyfdsum));
+        tcsd.put("sdgszzjrl", MathUtil.twoBit(sdqjnysum + sdqjnyfdsum));
 
         List<Map> tcjh = new ArrayList<>();
         tcjh.add(tcsx);

+ 2 - 2
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/websocket/WpInfoPushService.java

@@ -210,7 +210,7 @@ public class WpInfoPushService {
                 //SCADA发电量
                 scadafdl = StringUtils.round(jczblist.get(9).getPointValueInDouble(), 2);
                 //jczbmap.put("scadafdl",scadafdl );
-                vo.setScadafdl(scadafdl);
+                vo.setScadafdl(scadafdl/10000);
                 //预测功率
                 double ycgl = StringUtils.round(jczblist.get(10).getPointValueInDouble(), 2);
 
@@ -648,7 +648,7 @@ public class WpInfoPushService {
 
                 //wxssmap.put("rslssdl", rslssdl);
                 vo.setSlss(rslssdl);
-                vo.setLlfdl(MathUtil.twoBit(scadafdl + rjxssdl + rgzssdl + rqfssdl + rxdssdl + rslssdl));
+                vo.setLlfdl(MathUtil.twoBit(scadafdl + rjxssdl + rgzssdl + rqfssdl + rxdssdl + rslssdl)/10000);
 
             } else {