浏览代码

信控集控服务错误修改

shilin 2 年之前
父节点
当前提交
058e0f36e6

+ 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>

+ 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

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

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

+ 66 - 67
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,7 +353,7 @@ 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);
     }
@@ -452,7 +451,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 +463,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 +494,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 {
@@ -618,7 +617,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 +671,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 +688,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 +725,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 +750,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 +766,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 +789,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 +806,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 +856,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 +895,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 +908,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 +924,8 @@ public class LimitEventService {
             //年限电欠发损失电量
             if(wtpointmap.containsKey(ContantXk.NXDTJSSDL) )
             {
-                double beginvalue=0.0;
-                double endvalue=0.0;
+                double beginvalue;
+                double endvalue;
 
 
 
@@ -950,8 +949,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 +978,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 +1001,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 +1027,7 @@ public class LimitEventService {
             if(wtpointmap.containsKey(ContantXk.NXDTJSSDL) )
             {
 
-                double endvalue=0.0;
+                double endvalue;
 
 
 
@@ -1052,8 +1051,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 +1109,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 +1136,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());
 

+ 168 - 144
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,10 +164,10 @@ 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<>());
 
 
             if (windMap.get(key).getPointIdGL() == null || windMap.get(key).getPointIdFS() == null || windMap.get(key).getPointIdZT() == null) {
@@ -177,11 +177,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,30 +204,30 @@ 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)) {
@@ -237,7 +249,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 +259,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 +283,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 +305,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 +326,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 +361,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 +395,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 +445,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 +467,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 +504,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 +537,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 +572,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 +597,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 +605,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 +620,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 +639,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 +665,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 +673,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 +689,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 +708,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 +739,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 +750,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 +764,7 @@ public class PowerCurveFittingService {
                 }
 
             }
-            /*********************************************当日曲线偏差记录**********************************************************/
+            //*********************************************当日曲线偏差记录**********************************************************/
         }
     }
 
@@ -761,7 +772,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 +790,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 +822,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 +834,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 +852,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 +863,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 +874,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 +890,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 +922,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 +954,11 @@ public class PowerCurveFittingService {
             }
         }
 
-        //判定状态不为运行的进行过滤
-        if (zt.getPointValueInDouble() != 2) {
-            return false;
+        if (StringUtils.notEmp(fs)) {
+            //判定功率是否超过最大值
+            if (gl.getPointValueInDouble() > 25) {
+                return false;
+            }
         }
 
         //判定状态不为运行的进行过滤
@@ -953,6 +966,8 @@ public class PowerCurveFittingService {
             return false;
         }
 
+
+
         //设置时间为10分钟前,10钟前有停机事件数据进行过滤
         Calendar c = Calendar.getInstance();
         c.setTimeInMillis(zt.getPointTime());
@@ -1015,18 +1030,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 +1051,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 +1067,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 +1141,7 @@ public class PowerCurveFittingService {
 
 
                         Double x1 = StringUtils.round(x, 2);
-                        Double y1 = (Double) y;
+                        Double y1 =  y;
 
 
                         boolean b = true;
@@ -1176,30 +1189,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 +1231,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();

+ 114 - 162
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()
@@ -258,16 +243,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 +335,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 +348,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 +391,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 +416,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 +453,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 +469,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 +501,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 +510,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 +524,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 +600,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 +637,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 +652,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 +683,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 +712,7 @@ public class ShutdownService {
             if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
             {
 
-                double endvalue=0.0;
+                double endvalue;
 
 
                 List<String> pointid=new ArrayList<>();
@@ -801,7 +757,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 +766,7 @@ public class ShutdownService {
             shutdwonEvent.setWindturbineId(windturbineId);
 
 
-            shutdwonEvent2 = new ProEconShutdownEvent2();
+
             shutdwonEvent2.setId(StringUtils.getUUID());
             shutdwonEvent2.setProjectId(retValue.getProjectId());
             shutdwonEvent2.setStatusCode(currentStatus);
@@ -822,8 +778,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 +800,7 @@ public class ShutdownService {
         }
         if (currentStatus == 12)
         {
-            interrup = new ProEconInterruption();
+
             interrup.setProjectId(retValue.getProjectId());
             interrup.setStopTime(date);
             interrup.setWindpowerstationId(retValue.getWindpowerstationId());
@@ -857,12 +813,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 = "";