Просмотр исходного кода

信控集控服务错误修改

shilin 3 лет назад
Родитель
Сommit
61341c0cea
14 измененных файлов с 1949 добавлено и 702 удалено
  1. 8 9
      realtime/generationXK-service/src/main/java/com/gyee/generation/GenerationMain.java
  2. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo2Service.java
  3. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo4Service.java
  4. 5 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/EquipmentInfo5Service.java
  5. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/InputOrOutPutService.java
  6. 6 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitEventService.java
  7. 40 677
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitService.java
  8. 1600 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeService.java
  9. 4 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingService.java
  10. 5 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownService.java
  11. 5 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/initialpoint/InitialPointGoldenXkByEqService.java
  12. 264 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/task/SaticSchedulePgTask.java
  13. 8 8
      realtime/generationXK-service/src/main/resources/application-xk.yml
  14. 1 1
      realtime/generationXK-service/src/main/resources/application.yml

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

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

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

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

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

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

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

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

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

@@ -27,7 +27,7 @@ public class InputOrOutPutService {
     @Resource
     private IProEconInputOrOutputSpeedService proEconInputOrOutputSpeedService;
 
-    public void InputOrOutput(Date currentDate) {
+    public void inputOrOutput(Date currentDate) {
         currentDate = DateUtils.truncDay(currentDate);
         Date end = currentDate;
         Date daybegin = DateUtils.addDays(currentDate, -1);

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

@@ -358,7 +358,9 @@ public class LimitEventService {
         wplDictionary.get(key).add(windtubineId);
     }
 
-    public void exec() throws Exception {
+    public void execBrownouts() throws Exception {
+
+        init();
         //风场限电事件
         windpowerEvent.clear();
         //风机限电事件
@@ -517,7 +519,9 @@ public class LimitEventService {
 
 
 //限电事件当天
-    public void exec2() throws Exception {
+    public void execBrownouts2() throws Exception {
+
+        init();
         //风场限电事件
         windpowerEvent2.clear();
         //风机限电事件

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

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

+ 1600 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingByTimeService.java

@@ -0,0 +1,1600 @@
+package com.gyee.generation.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.*;
+import com.gyee.generation.model.vo.CureFittingVo;
+import com.gyee.generation.model.vo.PointVo;
+import com.gyee.generation.model.vo.PointfVo;
+import com.gyee.generation.service.auto.*;
+import com.gyee.generation.util.DateUtils;
+import com.gyee.generation.util.StringUtils;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import com.gyee.generation.util.realtimesource.math.LineUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class PowerCurveFittingByTimeService {
+
+    private static final Logger logger = LoggerFactory.getLogger(PowerCurveFittingByTimeService.class);
+    @Resource
+    private IEdosUtil edosUtil;
+
+    @Value("${curvefitting.dimension}")
+    private Integer dimension;
+    @Value("${curvefitting.scale}")
+    private Double scale;
+    @Value("${initialcode}")
+    private String initialcode;
+    public Map<String, Double> windturbineCapacity;
+
+    @Resource
+    private IProEconWtCurveFittingMonthService proEconWtCurveFittingMonthService;
+
+    @Resource
+    private IProEconWtCurveFittingYearService proEconWtCurveFittingYearService;
+    @Resource
+    private IProEconWtCurveFittingService proEconWtCurveFittingService;
+
+    @Resource
+    private IProEconCurveFittingMainService proEconCurveFittingMainService;
+    @Resource
+    private IProEconCurveFittingSubService proEconCurveFittingSubService;
+    @Resource
+    private IProEconCurveFittMonthMainService proEconCurveFittMonthMainService;
+    @Resource
+    private IProEconCurveFittMonthSubService proEconCurveFittMonthSubService;
+    @Resource
+    private IProEconWtPowerCurveFittingService proEconWtPowerCurveFittingService;
+
+    @Resource
+    private IProEconCurveFittYearSubService proEconCurveFittYearSubService;
+    @Resource
+    private IProEconCurveFittYearMainService proEconCurveFittYearMainService;
+
+
+    public void cureFittingDay(Date recordDate) throws Exception {
+        //日期变为昨天
+        Date end = DateUtils.addDays(DateUtils.truncDay(recordDate), -1);
+
+        Calendar c = Calendar.getInstance();
+        c.setTime(end);
+
+        Date begin = DateUtils.addDays(end, -6);
+
+
+
+        Map<String, CureFittingVo> windMap = new HashMap<>();
+
+        //初始化风机装机容量
+
+        if (windturbineCapacity == null) {
+            windturbineCapacity = new HashMap<>();
+            Map<String, ProEconEquipmentmodel> modelMap = CacheContext.modelMap;
+            for (ProBasicEquipment windturbine : CacheContext.wtls) {
+                if (modelMap.containsKey(windturbine.getModelId())) {
+                    windturbineCapacity.put(windturbine.getId(), modelMap.get(windturbine.getModelId()).getPowerProduction());
+                }
+            }
+        }
+
+        for (ProBasicEquipment wt : CacheContext.wtls) {
+            String windturbineId = wt.getId();
+
+
+            Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(wt.getId());
+            //设备有功功率
+            String pointIdGL = windturbinetestingpointnewMap.get(ContantXk.CJ_SSGL).getNemCode();
+            //设备明细状态
+            String pointIdZT = windturbinetestingpointnewMap.get(ContantXk.MXZT).getNemCode();
+
+            String pointIdFS;
+            if (wt.getWindpowerstationId().contains("GDC")) {   //测风塔70米风速
+
+                if (windturbinetestingpointnewMap.containsKey(ContantXk.FCCFTFS70)) {
+                    ProBasicEquipmentPoint point = windturbinetestingpointnewMap.get(ContantXk.FCCFTFS70);
+
+                    if (StringUtils.notEmp(point.getNemCode()) && !point.getNemCode().equals(initialcode)) {
+                        pointIdFS = windturbinetestingpointnewMap.get(ContantXk.FCCFTFS70).getNemCode();
+                    } else {
+                        pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
+                    }
+                } else {
+                    pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
+                }
+
+
+            } else {   //设备风速
+                pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
+            }
+
+
+            CureFittingVo item = new CureFittingVo();
+
+            item.setPointIdFS(pointIdFS);
+            item.setPointIdZT(pointIdZT);
+            item.setPointIdGL(pointIdGL);
+
+            //获取标杆风机编号
+            if (CacheContext.wtstandardmap.containsKey(wt.getId())) {
+                item.setStandardId(CacheContext.wtstandardmap.get(wt.getId()));
+            } else {
+                item.setStandardId(wt.getId());
+            }
+
+            windMap.put(windturbineId, item);
+        }
+
+
+        for (String key : windMap.keySet()) {
+            //初始化集合
+            windMap.get(key).setYsjglPoints(new ArrayList<>());
+            windMap.get(key).setYzyglPoints(new ArrayList<>());
+            windMap.get(key).setRsjglPoints(new ArrayList<>());
+            windMap.get(key).setRzyglPoints(new ArrayList<>());
+            windMap.get(key).setNsjglPoints(new ArrayList<>());
+            windMap.get(key).setNzyglPoints(new ArrayList<>());
+
+
+            if (windMap.get(key).getPointIdGL() == null || windMap.get(key).getPointIdFS() == null || windMap.get(key).getPointIdZT() == null) {
+                logger.info(key);
+                continue;
+            }
+
+
+            //拟合日功率曲线
+            curveFittingBuilder(begin, end, dimension, scale, windMap.get(key).getPointIdGL(), windMap.get(key).getPointIdFS(), windMap.get(key).getPointIdZT(), windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), key);
+            List<PointVo> 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);
+
+        }
+
+
+        for (String key : windMap.keySet()) {
+
+            Double modelpower = 1500.0;
+            if (windturbineCapacity.containsKey(key)) {
+                modelpower = windturbineCapacity.get(key);
+            }
+
+
+            //日的昨天
+            List<PointVo> dayLastMonthPoints = new ArrayList<>();
+            //日的去年同期
+            List<PointVo> dayLastYearPoints = new ArrayList<>();
+            //日标准功率
+            List<PointVo> dayStandardPoints = new ArrayList<>();
+            //保证功率
+            List<PointVo> bzglpowerPoints = new ArrayList<>();
+
+
+            if (CacheContext.wtstandardmap.containsKey(key)) {
+                String standardId = CacheContext.wtstandardmap.get(key);
+                if (StringUtils.notEmp(standardId)) {
+                    if (windMap.containsKey(key)) {
+
+                        dayStandardPoints = windMap.get(standardId).getRsjglPoints();
+                    }
+                }
+            }
+
+
+//*********************************************日曲线偏差上个日和上一年记录**********************************************************/
+            Date d1 = DateUtils.addDays(recordDate, -1);
+            Date d2 = DateUtils.addYears(recordDate, -1);
+
+            List<ProEconWtCurveFitting> wcfls = proEconWtCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
+                    i.getRecordDate().compareTo(d1) == 0).sorted(Comparator.comparing(ProEconWtCurveFitting::getSpeed)).collect(Collectors.toList());
+
+
+            dayBuildPoints(wcfls, dayLastMonthPoints);
+
+
+            wcfls = proEconWtCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
+                    i.getRecordDate().compareTo(d2) == 0).sorted(Comparator.comparing(ProEconWtCurveFitting::getSpeed)).collect(Collectors.toList());
+
+            //与轶总的原始代码对比不一致,临时修改测试
+            dayBuildPoints(wcfls, dayLastMonthPoints);
+//*********************************************日曲线偏差上个月和上一年记录**********************************************************/
+            if (CacheContext.wtmap.containsKey(key)) {
+                String modelid = CacheContext.wtmap.get(key).getModelId();
+                if (StringUtils.notEmp(modelid)) {
+                    //获取模型功率曲线
+                    if (CacheContext.modelpowermap.containsKey(modelid)) {
+                        for (Double speed : CacheContext.modelpowermap.get(modelid).keySet()) {
+                            PointVo point = new PointVo();
+                            point.setX(speed);
+                            point.setY(CacheContext.modelpowermap.get(modelid).get(speed).getEnsurePower());
+
+                            bzglpowerPoints.add(point);
+                        }
+                    }
+                }
+            }
+//*********************************************年曲线偏差记录**********************************************************/
+
+
+            //*********************************************当日曲线偏差记录**********************************************************/
+            Optional<ProEconCurveFittingMain> cfmdayo = proEconCurveFittingMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
+                    && i.getRecordDate().compareTo(recordDate) == 0).findFirst();
+            ProEconCurveFittingMain cfmday;
+
+            if (cfmdayo.isPresent()) {
+                cfmday = cfmdayo.get();
+                QueryWrapper<ProEconCurveFittingMain> wrapper = new QueryWrapper<>();
+                wrapper.eq("id", cfmday.getId());
+                proEconCurveFittingMainService.remove(wrapper);
+            }
+
+            cfmday = new ProEconCurveFittingMain();
+            cfmday.setWindturbineId(key);
+            cfmday.setRecordDate(recordDate);
+
+
+            //日---实际/最优
+            cfmday.setDeviationRate1(pcl(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower));
+            //日---实际/保证
+            cfmday.setDeviationRate2(pcl(windMap.get(key).getRsjglPoints(), bzglpowerPoints, modelpower));
+            //日---最优/保证
+            cfmday.setDeviationRate3(pcl(windMap.get(key).getRzyglPoints(), bzglpowerPoints, modelpower));
+            //日---实际/上日实际
+            cfmday.setMonthDeviationRate(pcl(windMap.get(key).getRsjglPoints(), dayLastMonthPoints, modelpower));
+            //日---实际/同期实际
+            cfmday.setYearDeviationRate(pcl(windMap.get(key).getRsjglPoints(), dayLastYearPoints, modelpower));
+            //日---实际/标杆实际
+            cfmday.setStandardDeviationRate(pcl(windMap.get(key).getRsjglPoints(), dayStandardPoints, modelpower));
+
+
+            proEconCurveFittingMainService.save(cfmday);
+            //*********************************************当日曲线偏差记录**********************************************************/
+            pLCBuild(key, recordDate, windMap, modelpower, 3, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints);
+            pLCBuild(key, recordDate, windMap, modelpower, 4, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints);
+            pLCBuild(key, recordDate, windMap, modelpower, 5, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints);
+            pLCBuild(key, recordDate, windMap, modelpower, 6, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints);
+            pLCBuild(key, recordDate, windMap, modelpower, 7, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints);
+            pLCBuild(key, recordDate, windMap, modelpower, 8, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints);
+            pLCBuild(key, recordDate, windMap, modelpower, 9, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints);
+            pLCBuild(key, recordDate, windMap, modelpower, 10, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints);
+            pLCBuild(key, recordDate, windMap, modelpower, 11, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints);
+            pLCBuild(key, recordDate, windMap, modelpower, 12, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints);
+            pLCBuild(key, recordDate, windMap, modelpower, 13, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints);
+            pLCBuild(key, recordDate, windMap, modelpower, 3, bzglpowerPoints, dayLastMonthPoints, dayLastYearPoints, dayStandardPoints);
+
+
+            insertPoints(recordDate,  windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), key);
+
+            logger.info(key);
+//
+//            logger.info(String.format("{1}:更新sqlserver数据库记录数:{0}", z, new Date()));
+
+
+        }
+    }
+
+    public void cureFittingMonth(Date recordDate) throws Exception {
+        //日期变为昨天
+        Date end = DateUtils.addDays(DateUtils.truncDay(recordDate), -1);
+
+        Calendar c = Calendar.getInstance();
+        c.setTime(recordDate);
+        int day_year = c.get(Calendar.YEAR);
+        int day_month = c.get(Calendar.MONTH) + 1;
+
+        c.set(Calendar.DAY_OF_MONTH, 1);
+        Date begin = c.getTime();
+
+        //上个月
+        c.setTime(DateUtils.addMonths(begin, -1));
+        int month_year = c.get(Calendar.YEAR);
+        int month_month = c.get(Calendar.MONTH) + 1;
+
+        //去年同期
+        c.setTime(DateUtils.addYears(begin, -1));
+        int year_year = c.get(Calendar.YEAR);
+        int year_month = c.get(Calendar.MONTH) + 1;
+
+        Map<String, CureFittingVo> windMap = new HashMap<>();
+
+        if (windturbineCapacity == null) {
+            windturbineCapacity = new HashMap<>();
+            Map<String, ProEconEquipmentmodel> modelMap = CacheContext.modelMap;
+            for (ProBasicEquipment windturbine : CacheContext.wtls) {
+                if (modelMap.containsKey(windturbine.getModelId())) {
+                    windturbineCapacity.put(windturbine.getId(), modelMap.get(windturbine.getModelId()).getPowerProduction());
+                }
+            }
+        }
+
+        for (ProBasicEquipment wt : CacheContext.wtls) {
+            String windturbineId = wt.getId();
+
+
+            Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(wt.getId());
+            //设备有功功率
+            String pointIdGL = windturbinetestingpointnewMap.get(ContantXk.CJ_SSGL).getNemCode();
+            //设备明细状态
+            String pointIdZT = windturbinetestingpointnewMap.get(ContantXk.MXZT).getNemCode();
+
+            String pointIdFS;
+            if (wt.getWindpowerstationId().contains("GDC")) {   //测风塔70米风速
+
+                if (windturbinetestingpointnewMap.containsKey(ContantXk.FCCFTFS70)) {
+                    ProBasicEquipmentPoint point = windturbinetestingpointnewMap.get(ContantXk.FCCFTFS70);
+
+                    if (StringUtils.notEmp(point.getNemCode()) && !point.getNemCode().equals(initialcode)) {
+                        pointIdFS = windturbinetestingpointnewMap.get(ContantXk.FCCFTFS70).getNemCode();
+                    } else {
+                        pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
+                    }
+                } else {
+                    pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
+                }
+
+
+            } else {   //设备风速
+                pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
+            }
+
+
+            CureFittingVo item = new CureFittingVo();
+
+            item.setPointIdFS(pointIdFS);
+            item.setPointIdZT(pointIdZT);
+            item.setPointIdGL(pointIdGL);
+
+            //获取标杆风机编号
+            if (CacheContext.wtstandardmap.containsKey(wt.getId())) {
+                item.setStandardId(CacheContext.wtstandardmap.get(wt.getId()));
+            } else {
+                item.setStandardId(wt.getId());
+            }
+
+            windMap.put(windturbineId, item);
+        }
+
+        for (String key : windMap.keySet()) {
+            //初始化集合
+            windMap.get(key).setYsjglPoints(new ArrayList<>());
+            windMap.get(key).setYzyglPoints(new ArrayList<>());
+            windMap.get(key).setRsjglPoints(new ArrayList<>());
+            windMap.get(key).setRzyglPoints(new ArrayList<>());
+            windMap.get(key).setNsjglPoints(new ArrayList<>());
+            windMap.get(key).setNzyglPoints(new ArrayList<>());
+
+            if (windMap.get(key).getPointIdGL() == null || windMap.get(key).getPointIdFS() == null || windMap.get(key).getPointIdZT() == null) {
+                logger.info(key);
+                continue;
+            }
+
+            //拟合月功率曲线
+            curveFittingBuilder(begin, 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);
+
+        }
+
+        for (String key : windMap.keySet()) {
+
+            Double modelpower = 1500.0;
+            if (windturbineCapacity.containsKey(key)) {
+                modelpower = windturbineCapacity.get(key);
+            }
+
+
+            //月的上月
+            List<PointVo> monthLastMonthPoints = new ArrayList<>();
+            //月的去年同期
+            List<PointVo> monthLastYearPoints = new ArrayList<>();
+            //月标准功率
+            List<PointVo> monthStandardPoints = new ArrayList<>();
+
+
+            //保证功率
+            List<PointVo> bzglpowerPoints = new ArrayList<>();
+
+
+            if (CacheContext.wtstandardmap.containsKey(key)) {
+                String standardId = CacheContext.wtstandardmap.get(key);
+                if (StringUtils.notEmp(standardId)) {
+                    if (windMap.containsKey(key)) {
+
+                        monthStandardPoints = windMap.get(standardId).getYsjglPoints();
+
+                    }
+                }
+            }
+            String stringyear = String.valueOf(day_year);
+            String stringmonth = String.valueOf(day_month);
+
+            String stringyear2 = String.valueOf(month_year);
+            String stringmonth2 = String.valueOf(month_month);
+
+            String stringyear3 = String.valueOf(year_year);
+            String stringmonth3 = String.valueOf(year_month);
+
+
+//*********************************************月曲线偏差上个月和上一年记录**********************************************************/
+
+            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 = proEconWtCurveFittingMonthService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
+                    i.getYear().equals(stringyear3) && i.getMonth().equals(stringmonth3)).sorted(Comparator.comparing(ProEconWtCurveFittingMonth::getSpeed)).collect(Collectors.toList());
+
+            monthBuildPoints(wcfmls, monthLastYearPoints);
+//*********************************************月曲线偏差上个月和上一年记录**********************************************************/
+
+            if (CacheContext.wtmap.containsKey(key)) {
+                String modelid = CacheContext.wtmap.get(key).getModelId();
+                if (StringUtils.notEmp(modelid)) {
+                    //获取模型功率曲线
+                    if (CacheContext.modelpowermap.containsKey(modelid)) {
+                        for (Double speed : CacheContext.modelpowermap.get(modelid).keySet()) {
+                            PointVo point = new PointVo();
+                            point.setX(speed);
+                            point.setY(CacheContext.modelpowermap.get(modelid).get(speed).getEnsurePower());
+
+                            bzglpowerPoints.add(point);
+                        }
+                    }
+                }
+            }
+//*********************************************年曲线偏差记录**********************************************************/
+
+
+//*********************************************当月曲线偏差记录**********************************************************/
+            Optional<ProEconCurveFittMonthMain> cfmmontho = proEconCurveFittMonthMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
+                    && i.getYear().equals(stringyear) && i.getMonth().equals(stringmonth)).findFirst();
+            ProEconCurveFittMonthMain cfmmonth;
+            if (cfmmontho.isPresent()) {
+                cfmmonth = cfmmontho.get();
+
+                QueryWrapper<ProEconCurveFittMonthMain> wrapper = new QueryWrapper<>();
+                wrapper.eq("id", cfmmonth.getId());
+                proEconCurveFittMonthMainService.remove(wrapper);
+            }
+
+
+            cfmmonth = new ProEconCurveFittMonthMain();
+            cfmmonth.setWindturbineId(key);
+            cfmmonth.setYear(String.valueOf(day_year));
+            cfmmonth.setMonth(String.valueOf(day_month));
+
+            //月---实际/最优
+            cfmmonth.setDeviationRate1(pcl(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower));
+            //月---实际/保证
+            cfmmonth.setDeviationRate2(pcl(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower));
+            //月---最优/保证
+            cfmmonth.setDeviationRate3(pcl(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower));
+            //月---实际/上月实际
+            cfmmonth.setMonthDeviationRate(pcl(windMap.get(key).getYsjglPoints(), monthLastMonthPoints, modelpower));
+            //月---实际/同期实际
+            cfmmonth.setYearDeviationRate(pcl(windMap.get(key).getYsjglPoints(), monthLastYearPoints, modelpower));
+            //月---实际/标杆实际
+            cfmmonth.setStandardDeviationRate(pcl(windMap.get(key).getYsjglPoints(), monthStandardPoints, modelpower));
+
+
+            proEconCurveFittMonthMainService.save(cfmmonth);
+
+            //*********************************************当月曲线偏差记录**********************************************************/
+
+            pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 3, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints);
+            pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 4, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints);
+            pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 5, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints);
+            pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 6, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints);
+            pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 7, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints);
+            pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 8, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints);
+            pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 9, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints);
+            pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 10, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints);
+            pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 11, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints);
+            pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 12, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints);
+            pLCBuild(key, stringyear, stringmonth, windMap, modelpower, 12, bzglpowerPoints, monthLastMonthPoints, monthLastYearPoints, monthStandardPoints);
+
+
+            insertPoints(stringyear, stringmonth, windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), key);
+
+            insertPoints2( windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), key);
+
+            logger.info(key);
+//
+//            logger.info(String.format("{1}:更新sqlserver数据库记录数:{0}", z, new Date()));
+
+
+        }
+
+    }
+
+
+    public void cureFittingYear(Date recordDate) throws Exception {
+        //日期变为昨天
+        Date end = DateUtils.addDays(DateUtils.truncDay(recordDate), -1);
+
+        Calendar c = Calendar.getInstance();
+
+        c.setTime(recordDate);
+        int day_year = c.get(Calendar.YEAR);
+
+
+        c.set(Calendar.DAY_OF_MONTH, 1);
+        c.set(Calendar.MONTH, 0);
+        Date begin = c.getTime();
+
+
+        //去年同期
+        c.setTime(DateUtils.addYears(begin, -1));
+        int year_year = c.get(Calendar.YEAR);
+
+
+        Map<String, CureFittingVo> windMap = new HashMap<>();
+
+        if (windturbineCapacity == null) {
+            windturbineCapacity = new HashMap<>();
+            Map<String, ProEconEquipmentmodel> modelMap = CacheContext.modelMap;
+            for (ProBasicEquipment windturbine : CacheContext.wtls) {
+                if (modelMap.containsKey(windturbine.getModelId())) {
+                    windturbineCapacity.put(windturbine.getId(), modelMap.get(windturbine.getModelId()).getPowerProduction());
+                }
+            }
+        }
+
+        for (ProBasicEquipment wt : CacheContext.wtls) {
+            String windturbineId = wt.getId();
+
+
+            Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(wt.getId());
+            //设备有功功率
+            String pointIdGL = windturbinetestingpointnewMap.get(ContantXk.CJ_SSGL).getNemCode();
+            //设备明细状态
+            String pointIdZT = windturbinetestingpointnewMap.get(ContantXk.MXZT).getNemCode();
+
+            String pointIdFS;
+            if (wt.getWindpowerstationId().contains("GDC")) {   //测风塔70米风速
+
+                if (windturbinetestingpointnewMap.containsKey(ContantXk.FCCFTFS70)) {
+                    ProBasicEquipmentPoint point = windturbinetestingpointnewMap.get(ContantXk.FCCFTFS70);
+
+                    if (StringUtils.notEmp(point.getNemCode()) && !point.getNemCode().equals(initialcode)) {
+                        pointIdFS = windturbinetestingpointnewMap.get(ContantXk.FCCFTFS70).getNemCode();
+                    } else {
+                        pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
+                    }
+                } else {
+                    pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
+                }
+
+
+            } else {   //设备风速
+                pointIdFS = windturbinetestingpointnewMap.get(ContantXk.CJ_SSFS).getNemCode();
+            }
+
+
+            CureFittingVo item = new CureFittingVo();
+
+            item.setPointIdFS(pointIdFS);
+            item.setPointIdZT(pointIdZT);
+            item.setPointIdGL(pointIdGL);
+
+            //获取标杆风机编号
+            if (CacheContext.wtstandardmap.containsKey(wt.getId())) {
+                item.setStandardId(CacheContext.wtstandardmap.get(wt.getId()));
+            } else {
+                item.setStandardId(wt.getId());
+            }
+
+            windMap.put(windturbineId, item);
+        }
+
+        for (String key : windMap.keySet()) {
+            //初始化集合
+            windMap.get(key).setYsjglPoints(new ArrayList<>());
+            windMap.get(key).setYzyglPoints(new ArrayList<>());
+            windMap.get(key).setRsjglPoints(new ArrayList<>());
+            windMap.get(key).setRzyglPoints(new ArrayList<>());
+            windMap.get(key).setNsjglPoints(new ArrayList<>());
+            windMap.get(key).setNzyglPoints(new ArrayList<>());
+
+            if (windMap.get(key).getPointIdGL() == null || windMap.get(key).getPointIdFS() == null || windMap.get(key).getPointIdZT() == null) {
+                logger.info(key);
+                continue;
+            }
+
+
+            //拟合年功率曲线
+            curveFittingBuilder(begin, end, dimension, scale, windMap.get(key).getPointIdGL(), windMap.get(key).getPointIdFS(), windMap.get(key).getPointIdZT(), windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), key);
+            List<PointVo> 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()) {
+
+            Double modelpower = 1500.0;
+            if (windturbineCapacity.containsKey(key)) {
+                modelpower = windturbineCapacity.get(key);
+            }
+
+            //年的上月
+            List<PointVo> yearLastMonthPoints = new ArrayList<>();
+            //年的去年同期
+            List<PointVo> yearLastYearPoints;
+            //年标准功率
+            List<PointVo> yearStandardPoints = new ArrayList<>();
+
+
+
+
+            //日的昨天
+
+            //保证功率
+            List<PointVo> bzglpowerPoints = new ArrayList<>();
+
+
+            if (CacheContext.wtstandardmap.containsKey(key)) {
+                String standardId = CacheContext.wtstandardmap.get(key);
+                if (StringUtils.notEmp(standardId)) {
+                    if (windMap.containsKey(key)) {
+                        yearStandardPoints = windMap.get(standardId).getNsjglPoints();
+
+                    }
+                }
+            }
+
+            String stringyear = String.valueOf(day_year);
+
+
+            String stringyear3 = String.valueOf(year_year);
+
+
+            // /*********************************************年曲线偏差上个月和上一年记录**********************************************************/
+
+
+            List<ProEconWtCurveFittingYear> wcfyls = proEconWtCurveFittingYearService.list().stream().filter(i -> i.getWindturbineId().equals(key) &&
+                    i.getYear().equals(stringyear3)).sorted(Comparator.comparing(ProEconWtCurveFittingYear::getSpeed)).collect(Collectors.toList());
+
+            //与轶总的原始代码对比不一致,新增代码修改测试
+            yearBuildPoints(wcfyls, yearLastMonthPoints);
+            yearLastYearPoints = yearLastMonthPoints;
+
+//*********************************************年曲线偏差上个月和上一年记录**********************************************************/
+
+            if (CacheContext.wtmap.containsKey(key)) {
+                String modelid = CacheContext.wtmap.get(key).getModelId();
+                if (StringUtils.notEmp(modelid)) {
+                    //获取模型功率曲线
+                    if (CacheContext.modelpowermap.containsKey(modelid)) {
+                        for (Double speed : CacheContext.modelpowermap.get(modelid).keySet()) {
+                            PointVo point = new PointVo();
+                            point.setX(speed);
+                            point.setY(CacheContext.modelpowermap.get(modelid).get(speed).getEnsurePower());
+
+                            bzglpowerPoints.add(point);
+                        }
+                    }
+                }
+            }
+//*********************************************年曲线偏差记录**********************************************************/
+
+//*********************************************当年曲线偏差记录**********************************************************/
+            Optional<ProEconCurveFittYearMain> cfmyearo = proEconCurveFittYearMainService.list().stream().filter(i -> i.getWindturbineId().equals(key)
+                    && i.getYear().equals(stringyear)).findFirst();
+            ProEconCurveFittYearMain cfmyear;
+            if (cfmyearo.isPresent()) {
+                cfmyear = cfmyearo.get();
+
+                QueryWrapper<ProEconCurveFittMonthMain> wrapper = new QueryWrapper<>();
+                wrapper.eq("id", cfmyear.getId());
+                proEconCurveFittMonthMainService.remove(wrapper);
+            }
+
+
+            cfmyear = new ProEconCurveFittYearMain();
+            cfmyear.setWindturbineId(key);
+            cfmyear.setYear(String.valueOf(day_year));
+
+
+            //年---实际/最优
+            cfmyear.setDeviationRate1(pcl(windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), modelpower));
+            //年---实际/保证
+            cfmyear.setDeviationRate2(pcl(windMap.get(key).getNsjglPoints(), bzglpowerPoints, modelpower));
+            //年---最优/保证
+            cfmyear.setDeviationRate3(pcl(windMap.get(key).getNzyglPoints(), bzglpowerPoints, modelpower));
+            //年---实际/上月实际
+            cfmyear.setMonthDeviationRate(pcl(windMap.get(key).getNsjglPoints(), yearLastMonthPoints, modelpower));
+            //年---实际/同期实际
+            cfmyear.setYearDeviationRate(pcl(windMap.get(key).getNsjglPoints(), yearLastYearPoints, modelpower));
+            //年---实际/标杆实际
+            cfmyear.setStandardDeviationRate(pcl(windMap.get(key).getNsjglPoints(), yearStandardPoints, modelpower));
+
+
+            proEconCurveFittYearMainService.save(cfmyear);
+
+//*********************************************当年曲线偏差记录**********************************************************/
+
+            pLCBuild(key, stringyear, windMap, modelpower, 3, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
+            pLCBuild(key, stringyear, windMap, modelpower, 4, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
+            pLCBuild(key, stringyear, windMap, modelpower, 5, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
+            pLCBuild(key, stringyear, windMap, modelpower, 6, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
+            pLCBuild(key, stringyear, windMap, modelpower, 7, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
+            pLCBuild(key, stringyear, windMap, modelpower, 8, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
+            pLCBuild(key, stringyear, windMap, modelpower, 9, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
+            pLCBuild(key, stringyear, windMap, modelpower, 10, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
+            pLCBuild(key, stringyear, windMap, modelpower, 11, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
+            pLCBuild(key, stringyear, windMap, modelpower, 12, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
+            pLCBuild(key, stringyear, windMap, modelpower, 12, bzglpowerPoints, yearLastMonthPoints, yearLastYearPoints, yearStandardPoints);
+
+
+            insertPoints(stringyear, windMap.get(key).getNsjglPoints(), windMap.get(key).getNzyglPoints(), key);
+
+            logger.info(key);
+//
+//            logger.info(String.format("{1}:更新sqlserver数据库记录数:{0}", z, new Date()));
+
+
+        }
+    }
+
+
+    public void pLCBuild(String key, Date current, Map<String, CureFittingVo> windMap, Double modelpower, double speed,
+                         List<PointVo> bzglpowerPoints, List<PointVo> lastMonthPoints, List<PointVo> lastYearPoints, List<PointVo> lastStandardPoints
+    ) {
+
+        String speedStr = String.valueOf(speed);
+
+//*********************************************当日曲线偏差子表记录**********************************************************/
+        Optional<ProEconCurveFittingSub> cfmso = proEconCurveFittingSubService.list().stream().filter(i -> i.getWindturbineId().equals(key)
+                && i.getRecordDate().compareTo(current) == 0 && i.getSpeed().equals(speedStr)).findFirst();
+        ProEconCurveFittingSub cfms;
+
+        if (cfmso.isPresent()) {
+            cfms = cfmso.get();
+
+            QueryWrapper<ProEconCurveFittingSub> wrapper = new QueryWrapper<>();
+            wrapper.eq("id", cfms.getId());
+            proEconCurveFittingSubService.remove(wrapper);
+        }
+
+        cfms = new ProEconCurveFittingSub();
+        cfms.setWindturbineId(key);
+        cfms.setSpeed(String.valueOf(speed));
+        cfms.setRecordDate(current);
+
+
+        cfms.setDeviationRate1(pcl2(windMap.get(key).getRsjglPoints(), windMap.get(key).getRzyglPoints(), modelpower, speed));
+        //日---实际/保证
+        cfms.setDeviationRate2(pcl2(windMap.get(key).getRsjglPoints(), bzglpowerPoints, modelpower, speed));
+        //日---最优/保证
+        cfms.setDeviationRate3(pcl2(windMap.get(key).getRzyglPoints(), bzglpowerPoints, modelpower, speed));
+        //日---实际/上日实际
+        cfms.setMonthDeviationRate(pcl2(windMap.get(key).getRsjglPoints(), lastMonthPoints, modelpower, speed));
+        //日---实际/同期实际
+        cfms.setYearDeviationRate(pcl2(windMap.get(key).getRsjglPoints(), lastYearPoints, modelpower, speed));
+        //日---实际/标杆实际
+        cfms.setStandardDeviationRate(pcl2(windMap.get(key).getRsjglPoints(), lastStandardPoints, modelpower, speed));
+
+        proEconCurveFittingSubService.save(cfms);
+//*********************************************当日曲线偏差子表记录**********************************************************/
+    }
+
+    public void pLCBuild(String key, String stringyear, String stringmonth, Map<String, CureFittingVo> windMap, Double modelpower, double speed,
+                         List<PointVo> bzglpowerPoints, List<PointVo> lastMonthPoints, List<PointVo> lastYearPoints, List<PointVo> lastStandardPoints
+    ) {
+        String speedStr = String.valueOf(speed);
+
+        //*********************************************当月曲线偏差子表记录**********************************************************/
+
+        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;
+
+        if (cfmsmontho.isPresent()) {
+            cfmsmonth = cfmsmontho.get();
+
+            QueryWrapper<ProEconCurveFittMonthSub> wrapper = new QueryWrapper<>();
+            wrapper.eq("id", cfmsmonth.getId());
+            proEconCurveFittMonthSubService.remove(wrapper);
+        }
+
+        cfmsmonth = new ProEconCurveFittMonthSub();
+        cfmsmonth.setWindturbineId(key);
+        cfmsmonth.setYear(stringyear);
+        cfmsmonth.setMonth(stringmonth);
+        cfmsmonth.setSpeed(String.valueOf(speed));
+
+        proEconCurveFittMonthSubService.save(cfmsmonth);
+
+        //月---实际/最优
+        cfmsmonth.setDeviationRate1(pcl2(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower, speed));
+        //月---实际/保证
+        cfmsmonth.setDeviationRate2(pcl2(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower, speed));
+        //月---最优/保证
+        cfmsmonth.setDeviationRate3(pcl2(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower, speed));
+        //月---实际/上月实际
+        cfmsmonth.setMonthDeviationRate(pcl2(windMap.get(key).getYsjglPoints(), lastMonthPoints, modelpower, speed));
+        //月---实际/同期实际
+        cfmsmonth.setYearDeviationRate(pcl2(windMap.get(key).getYsjglPoints(), lastYearPoints, modelpower, speed));
+        //月---实际/标杆实际
+        cfmsmonth.setStandardDeviationRate(pcl2(windMap.get(key).getYsjglPoints(), lastStandardPoints, modelpower, speed));
+
+        proEconCurveFittMonthSubService.save(cfmsmonth);
+//*********************************************当月曲线偏差子表记录**********************************************************/
+    }
+
+    public void pLCBuild(String key, String stringyear, Map<String, CureFittingVo> windMap, Double modelpower, double speed,
+                         List<PointVo> bzglpowerPoints, List<PointVo> lastMonthPoints, List<PointVo> lastYearPoints, List<PointVo> lastStandardPoints
+    ) {
+        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;
+
+        if (cfmsyearo.isPresent()) {
+            cfmsyear = cfmsyearo.get();
+
+            QueryWrapper<ProEconCurveFittYearSub> wrapper = new QueryWrapper<>();
+            wrapper.eq("id", cfmsyear.getId());
+            proEconCurveFittYearSubService.remove(wrapper);
+        }
+
+        cfmsyear = new ProEconCurveFittYearSub();
+        cfmsyear.setWindturbineId(key);
+        cfmsyear.setYear(stringyear);
+        cfmsyear.setSpeed(String.valueOf(speed));
+
+        proEconCurveFittYearSubService.save(cfmsyear);
+
+        //年---实际/最优
+        cfmsyear.setDeviationRate1(pcl2(windMap.get(key).getYsjglPoints(), windMap.get(key).getYzyglPoints(), modelpower, speed));
+        //年---实际/保证
+        cfmsyear.setDeviationRate2(pcl2(windMap.get(key).getYsjglPoints(), bzglpowerPoints, modelpower, speed));
+        //年---最优/保证
+        cfmsyear.setDeviationRate3(pcl2(windMap.get(key).getYzyglPoints(), bzglpowerPoints, modelpower, speed));
+        //年---实际/上月实际
+        cfmsyear.setMonthDeviationRate(pcl2(windMap.get(key).getYsjglPoints(), lastMonthPoints, modelpower, speed));
+        //年---实际/同期实际
+        cfmsyear.setYearDeviationRate(pcl2(windMap.get(key).getYsjglPoints(), lastYearPoints, modelpower, speed));
+        //年---实际/标杆实际
+        cfmsyear.setStandardDeviationRate(pcl2(windMap.get(key).getYsjglPoints(), lastStandardPoints, modelpower, speed));
+
+        proEconCurveFittYearSubService.save(cfmsyear);
+//*********************************************当年曲线偏差子表记录**********************************************************/
+    }
+
+
+    private void insertPoints(Date current, List<PointVo> sjglls, List<PointVo> zyglls, String windturbineId) {
+
+        //*********************************************当日曲线偏差记录**********************************************************/
+        List<Integer> wtcfidls = proEconWtCurveFittingService.list().stream().filter(i -> i.getWindturbineId().equals(windturbineId) &&
+                i.getRecordDate().compareTo(current) == 0).map(ProEconWtCurveFitting::getId).collect(Collectors.toList());
+
+
+        for (int i = 0; i < wtcfidls.size(); i++) {
+            proEconWtCurveFittingService.removeByIds(wtcfidls);
+        }
+
+        if (sjglls.size() == zyglls.size()) {
+            for (int i = 0; i < sjglls.size(); i++) {
+                ProEconWtCurveFitting item = new ProEconWtCurveFitting();
+                item.setWindturbineId(windturbineId);
+
+                if (CacheContext.wtmap.containsKey(windturbineId)) {
+                    ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
+                    if (wt.getWindpowerstationId().contains("GDC")) {
+                        continue;
+                        // item.SPEED = Double.Truncate(pointsF2[i].X);
+                    } else {
+                        boolean l = String.valueOf(sjglls.get(i).getX()).contains(".");
+                        if (l) {
+                            continue;
+                        }
+                        item.setSpeed(sjglls.get(i).getX());
+
+                    }
+
+
+                    item.setActualPower(sjglls.get(i).getY());
+                    item.setOptimalPower(zyglls.get(i).getY());
+                    item.setRecordDate(current);
+
+                    proEconWtCurveFittingService.save(item);
+
+                }
+
+            }
+        } else {
+            logger.warn(String.format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, sjglls.size(), zyglls.size()));
+
+            for (int i = 0; i < sjglls.size(); i++) {
+                ProEconWtCurveFitting item = new ProEconWtCurveFitting();
+                item.setWindturbineId(windturbineId);
+
+                if (CacheContext.wtmap.containsKey(windturbineId)) {
+                    ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
+                    if (wt.getWindpowerstationId().contains("GDC")) {
+                        continue;
+                        //item.SPEED = Double.Truncate(pointsF2[i].X);
+                    } else {
+                        boolean l = String.valueOf(sjglls.get(i).getX()).contains(".");
+                        if (l) {
+                            continue;
+                        }
+                        item.setSpeed(sjglls.get(i).getX());
+                    }
+
+
+                    int finalI = i;
+                    OptionalDouble op = zyglls.stream().filter(x -> Objects.equals(x.getX(), sjglls.get(finalI).getX())).mapToDouble(PointVo::getY).findFirst();
+
+                    if (op.isPresent()) {
+                        item.setOptimalPower(op.getAsDouble());
+                    } else {
+                        item.setOptimalPower(0.0);
+                    }
+
+                    item.setActualPower(sjglls.get(i).getY());
+                    item.setRecordDate(current);
+                    proEconWtCurveFittingService.save(item);
+                }
+
+            }
+            //*********************************************当日曲线偏差记录**********************************************************/
+        }
+    }
+
+
+    private void insertPoints(String year, String month, List<PointVo> sjglls, List<PointVo> zyglls, String windturbineId) {
+
+        //*********************************************当月曲线偏差记录**********************************************************/
+        List<Integer> wtcfmmonthidls = proEconWtCurveFittingMonthService.list().stream().filter(i -> i.getWindturbineId().equals(windturbineId) &&
+                i.getYear().equals(year) && i.getMonth().equals(month)).map(ProEconWtCurveFittingMonth::getId).collect(Collectors.toList());
+
+
+        for (int i = 0; i < wtcfmmonthidls.size(); i++) {
+            proEconWtCurveFittingMonthService.removeByIds(wtcfmmonthidls);
+        }
+
+        if (sjglls.size() == zyglls.size()) {
+            for (int i = 0; i < sjglls.size(); i++) {
+                ProEconWtCurveFittingMonth item = new ProEconWtCurveFittingMonth();
+
+                item.setWindturbineId(windturbineId);
+                if (CacheContext.wtmap.containsKey(windturbineId)) {
+                    ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
+                    if (wt.getWindpowerstationId().contains("GDC")) {
+                        continue;
+                        // item.SPEED = Double.Truncate(pointsF1[i].X);
+                    } else {
+                        item.setSpeed(sjglls.get(i).getX());
+
+                    }
+                    item.setActualPower(sjglls.get(i).getY());
+                    item.setOptimalPower(zyglls.get(i).getY());
+                    item.setYear(String.valueOf(year));
+                    item.setMonth(String.valueOf(month));
+
+                    proEconWtCurveFittingMonthService.save(item);
+                }
+
+            }
+        } else {
+            logger.warn(String.format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, sjglls.size(), zyglls.size()));
+
+
+            for (int i = 0; i < sjglls.size(); i++) {
+                ProEconWtCurveFittingMonth item = new ProEconWtCurveFittingMonth();
+                item.setWindturbineId(windturbineId);
+                if (CacheContext.wtmap.containsKey(windturbineId)) {
+
+                    ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
+                    if (wt.getWindpowerstationId().contains("GDC")) {
+                        continue;
+                        //item.SPEED = Double.Truncate(pointsF1[i].X);
+                    } else {
+
+                        item.setSpeed(sjglls.get(i).getX());
+                    }
+                    item.setActualPower(sjglls.get(i).getY());
+
+                    int finalI = i;
+                    OptionalDouble op = zyglls.stream().filter(x -> Objects.equals(x.getX(), sjglls.get(finalI).getX())).mapToDouble(PointVo::getY).findFirst();
+
+                    if (op.isPresent()) {
+                        item.setOptimalPower(op.getAsDouble());
+                    } else {
+                        item.setOptimalPower(0.0);
+                    }
+
+                    item.setYear(String.valueOf(year));
+                    item.setMonth(String.valueOf(month));
+
+                    proEconWtCurveFittingMonthService.save(item);
+                }
+
+            }
+        }
+        //*********************************************当月曲线偏差记录**********************************************************/
+
+
+    }
+
+    private void insertPoints(String year,  List<PointVo> sjglls, List<PointVo> zyglls, String windturbineId) {
+        //*********************************************当年曲线偏差记录**********************************************************/
+        List<Integer> wtcfmyearidls = proEconWtCurveFittingYearService.list().stream().filter(i -> i.getWindturbineId().equals(windturbineId) &&
+                i.getYear().equals(year)).map(ProEconWtCurveFittingYear::getId).collect(Collectors.toList());
+
+        for (int i = 0; i < wtcfmyearidls.size(); i++) {
+            proEconWtCurveFittingYearService.removeByIds(wtcfmyearidls);
+        }
+
+        if (sjglls.size() == zyglls.size()) {
+            for (int i = 0; i < sjglls.size(); i++) {
+                ProEconWtCurveFittingYear item = new ProEconWtCurveFittingYear();
+
+                item.setWindturbineId(windturbineId);
+                if (CacheContext.wtmap.containsKey(windturbineId)) {
+                    ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
+                    if (wt.getWindpowerstationId().contains("GDC")) {
+                        continue;
+                        // item.SPEED = Double.Truncate(pointsF1[i].X);
+                    } else {
+                        item.setSpeed(sjglls.get(i).getX());
+
+                    }
+                    item.setActualPower(sjglls.get(i).getY());
+                    item.setOptimalPower(zyglls.get(i).getY());
+                    item.setYear(String.valueOf(year));
+
+                    proEconWtCurveFittingYearService.save(item);
+                }
+
+            }
+        } else {
+            logger.warn(String.format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, sjglls.size(), zyglls.size()));
+
+
+            for (int i = 0; i < sjglls.size(); i++) {
+                ProEconWtCurveFittingYear item = new ProEconWtCurveFittingYear();
+                item.setWindturbineId(windturbineId);
+                if (CacheContext.wtmap.containsKey(windturbineId)) {
+
+                    ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
+                    if (wt.getWindpowerstationId().contains("GDC")) {
+                        continue;
+                        //item.SPEED = Double.Truncate(pointsF1[i].X);
+                    } else {
+
+                        item.setSpeed(sjglls.get(i).getX());
+                    }
+                    item.setActualPower(sjglls.get(i).getY());
+
+                    int finalI = i;
+                    OptionalDouble op = zyglls.stream().filter(x -> Objects.equals(x.getX(), sjglls.get(finalI).getX())).mapToDouble(PointVo::getY).findFirst();
+
+                    if (op.isPresent()) {
+                        item.setOptimalPower(op.getAsDouble());
+                    } else {
+                        item.setOptimalPower(0.0);
+                    }
+
+                    item.setYear(String.valueOf(year));
+
+                    proEconWtCurveFittingYearService.save(item);
+                }
+
+            }
+        }
+        //*********************************************当年曲线偏差记录**********************************************************/
+
+
+    }
+    private void insertPoints2(List<PointVo> monthSjglls, List<PointVo> monthZyglls, String windturbineId) {
+
+
+        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++) {
+            proEconWtPowerCurveFittingService.removeByIds(wtpcfidls);
+        }
+
+        if (monthSjglls.size() == monthZyglls.size()) {
+            for (int i = 0; i < monthSjglls.size(); i++) {
+                ProEconWtPowerCurveFitting item = new ProEconWtPowerCurveFitting();
+
+                item.setWindturbineId(windturbineId);
+
+                if (CacheContext.wtmap.containsKey(windturbineId)) {
+
+                    ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
+                    if (wt.getWindpowerstationId().contains("GDC")) {
+                        continue;
+                        // item.SPEED = Double.Truncate(pointsF1[i].X);
+                    } else {
+                        boolean l = String.valueOf(monthSjglls.get(i).getX()).contains(".");
+                        if (l) {
+                            continue;
+                        }
+                        item.setSpeed(monthSjglls.get(i).getX());
+                    }
+
+
+                    item.setActualPower(monthSjglls.get(i).getY());
+                    item.setOptimalPower(monthZyglls.get(i).getY());
+
+
+                    proEconWtPowerCurveFittingService.save(item);
+                }
+
+            }
+        } else {
+
+            logger.warn(String.format("下标不一致的风机编号:{0},实际功率:{1},最有功率:{2}", windturbineId, monthSjglls.size(), monthZyglls.size()));
+
+            for (int i = 0; i < monthSjglls.size(); i++) {
+                ProEconWtPowerCurveFitting item = new ProEconWtPowerCurveFitting();
+
+                item.setWindturbineId(windturbineId);
+
+                if (CacheContext.wtmap.containsKey(windturbineId)) {
+
+                    ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
+                    if (wt.getWindpowerstationId().contains("GDC")) {
+                        continue;
+                        //item.SPEED = Double.Truncate(pointsF1[i].X);
+                    } else {
+                        boolean l = String.valueOf(monthSjglls.get(i).getX()).contains(".");
+                        if (l) {
+                            continue;
+                        }
+                        item.setSpeed(monthSjglls.get(i).getX());
+                    }
+
+
+                    item.setActualPower(monthSjglls.get(i).getY());
+                    int finalI = i;
+                    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());
+                    } else {
+                        item.setOptimalPower(0.0);
+                    }
+
+
+                    proEconWtPowerCurveFittingService.save(item);
+                }
+
+            }
+        }
+    }
+
+    private void yearBuildPoints(List<ProEconWtCurveFittingYear> data, List<PointVo> points) {
+        if (data != null) {
+            for (ProEconWtCurveFittingYear datum : data) {
+                PointVo point = new PointVo();
+                point.setX(datum.getSpeed());
+                point.setY(datum.getActualPower());
+                points.add(point);
+            }
+        }
+    }
+
+    private void monthBuildPoints(List<ProEconWtCurveFittingMonth> data, List<PointVo> points) {
+        if (data != null) {
+            for (ProEconWtCurveFittingMonth datum : data) {
+                PointVo point = new PointVo();
+                point.setX(datum.getSpeed());
+                point.setY(datum.getActualPower());
+                points.add(point);
+            }
+        }
+    }
+
+    private void dayBuildPoints(List<ProEconWtCurveFitting> data, List<PointVo> points) {
+        if (data != null) {
+            for (ProEconWtCurveFitting datum : data) {
+                PointVo point = new PointVo();
+                point.setX(datum.getSpeed());
+                point.setY(datum.getActualPower());
+                points.add(point);
+            }
+        }
+    }
+
+    //曲线偏差率
+    private double pcl(List<PointVo> points1, List<PointVo> points2, Double modelpower) {
+        double result = -0;
+        double pc = 0;
+        if (points1 != null && points1.size() != 0 && points2 != null && points2.size() != 0) {
+            double count = 0;
+            double sum = 0;
+            double max = modelpower;
+            for (PointVo point : points1) {
+                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();
+                }
+            }
+            sum = Math.sqrt(sum);
+            count = Math.sqrt(count);
+            max = max * count;
+            if (max != 0) {
+                result = sum / max * 100;
+            }
+
+            if (pc < 0) {
+                result = 0 - result;
+            }
+        }
+        return result;
+    }
+
+    //曲线偏差率2
+    private double pcl2(List<PointVo> points1, List<PointVo> points2, Double modelpower, double speed) {
+        double minSpeed = speed;
+        double maxSpeed = minSpeed + 1;
+        double result = -0;
+        double pc = 0;
+        if (points1 != null && points1.size() != 0 && points2 != null && points2.size() != 0) {
+            double count = 0;
+            double sum = 0;
+            double max = modelpower;
+            for (PointVo point : points1) {
+                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();
+                }
+            }
+            sum = Math.sqrt(sum);
+            count = Math.sqrt(count);
+            max = max * count;
+            if (max != 0) {
+                result = sum / max * 100;
+            }
+
+            if (pc < 0) {
+                result = 0 - result;
+            }
+        }
+        return result;
+    }
+
+    //todo-sl 添加数据筛选
+    private boolean filterData(PointData gl, PointData fs, PointData zt, double maxvalue, String windturbineId) throws Exception {
+        if (StringUtils.notEmp(gl)) {
+            //判定功率是否超过最大值
+            if (gl.getPointValueInDouble() > maxvalue) {
+                return false;
+            }
+        }
+
+        if (StringUtils.notEmp(fs)) {
+            //判定功率是否超过最大值
+            if (gl.getPointValueInDouble() > 25) {
+                return false;
+            }
+        }
+
+        //判定状态不为运行的进行过滤
+        if (zt.getPointValueInDouble() != 2) {
+            return false;
+        }
+
+
+        //设置时间为10分钟前,10钟前有停机事件数据进行过滤
+        Calendar c = Calendar.getInstance();
+        c.setTimeInMillis(zt.getPointTime());
+        Date end = c.getTime();
+        c.add(Calendar.MINUTE, -10);
+        Date bedin = c.getTime();
+        List<PointData> points = edosUtil.getHistoryDatasSnap(zt.getEdnaId(), bedin.getTime() / 1000, end.getTime() / 1000);
+        if (!points.isEmpty()) {
+            for (PointData p : points) {
+                if (p.getPointValueInDouble() == 4) {
+
+                    return false;
+                }
+
+            }
+
+        }
+
+        //设置时间为10分钟后,运行后10分钟数据进行过滤
+        c = Calendar.getInstance();
+        c.setTimeInMillis(zt.getPointTime());
+        bedin = c.getTime();
+        c.add(Calendar.MINUTE, 10);
+        end = c.getTime();
+        points = edosUtil.getHistoryDatasSnap(zt.getEdnaId(), bedin.getTime() / 1000, end.getTime() / 1000);
+        if (!points.isEmpty()) {
+            for (PointData p : points) {
+                if (p.getPointValueInDouble() != 2) {
+                    return false;
+
+                }
+
+            }
+
+        }
+        Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+        Map<String, ProBasicEquipmentPoint> wtpointmap = wtpAimap.get(windturbineId);
+        //与保证功率进行对比,偏差大于25%的进行过滤
+        List<String> pointid = new ArrayList<>();
+
+        pointid.add(wtpointmap.get(ContantXk.BZGL).getNemCode());
+        List<PointData> value = edosUtil.getHistMatrix(pointid, gl.getPointTime() / 1000);
+
+
+        if (null != value && value.size() > 0) {
+            double bzgl = value.get(0).getPointValueInDouble();
+            double sjgl = gl.getPointValueInDouble();
+
+            double temp = Math.abs(sjgl - bzgl);
+            if (temp > sjgl * 0.25) {
+                return false;
+            }
+        }
+
+        //欠发状态大于2过滤掉
+        pointid = new ArrayList<>();
+
+        pointid.add(wtpointmap.get(ContantXk.LSQFZT).getNemCode());
+        value = edosUtil.getHistMatrix(pointid, gl.getPointTime() / 1000);
+        if (null != value && value.size() > 0) {
+            double qfzt = value.get(0).getPointValueInDouble();
+
+            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 = 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)) {
+                List<PointData> glpointstemp = edosUtil.getHistoryDatasSnap(pointIdGL, begin.getTime() / 1000, end.getTime() / 1000);
+                List<PointData> fspointstemp = edosUtil.getHistoryDatasSnap(pointIdFS, begin.getTime() / 1000, end.getTime() / 1000);
+                List<PointData> ztpointstemp = edosUtil.getHistoryDatasSnap(pointIdZT, begin.getTime() / 1000, end.getTime() / 1000);
+
+
+                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()) {
+                    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));
+                            fspoints.add(fspointstemp.get(i));
+                            ztpoints.add(ztpointstemp.get(i));
+                        }
+                    }
+                }
+
+
+                if (glpoints.size() != fspoints.size() || glpoints.size() != ztpoints.size()) {
+                    for (int i = 0; i < fspoints.size(); i++) {
+                        double x = fspoints.get(i).getPointValueInDouble();
+                        double y = -1;
+                        double z = -1;
+
+                        int finalI1 = i;
+                        List<PointData> yArray = glpoints.stream().filter(it -> it.getPointTime().compareTo(fspoints.get(finalI1).getPointTime()) == 0).collect(Collectors.toList());
+                        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.size() > 0) {
+
+                            z = yArray.get(i).getPointValueInDouble();
+                        }
+
+
+                        Double x1 = StringUtils.round(x, 2);
+                        Double y1 = y;
+
+
+                        boolean b = true;
+
+                        if (CacheContext.wtmap.containsKey(windturbineId)) {
+
+                            ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
+                            if (wt.getWindpowerstationId().contains("GDC")) {
+                                b = (x >= 0 && y > 0);
+                            } else {
+                                if (z == 2) {
+
+                                    b = (x >= 0 && x <= 30 && y >= 0 && y <= maxPower);
+
+                                    if (b) {
+                                        if (x > 3 && y <= 0) {
+                                            b = false;
+                                        }
+                                        if (x <= 3 && y > 0) {
+                                            b = false;
+                                        }
+                                    }
+
+                                } else {
+                                    b = false;
+                                }
+                            }
+
+                        }
+
+                        if (b) {
+                            sjglnhpoints.add(new PointfVo(x1, y1));
+
+                            if (zyglnhpoints.containsKey(x1)) {
+                                if (zyglnhpoints.get(x1).getY() < y1) {
+                                    zyglnhpoints.put(x1, new PointfVo(x1, y1));
+
+                                }
+                            } else {
+                                zyglnhpoints.put(x1, new PointfVo(x1, y1));
+                            }
+
+
+                        }
+
+
+                    }
+                } else {
+
+                    for (int i = 0; i < fspoints.size(); i++) {
+                        double x = fspoints.get(i).getPointValueInDouble();
+                        double y = glpoints.get(i).getPointValueInDouble();
+                        double z = ztpoints.get(i).getPointValueInDouble();
+
+
+                        Double x1 = StringUtils.round(x, 2);
+                        Double y1 = y;
+
+
+                        boolean b = true;
+                        if (CacheContext.wtmap.containsKey(windturbineId)) {
+
+                            ProBasicEquipment wt = CacheContext.wtmap.get(windturbineId);
+                            if (wt.getWindpowerstationId().contains("GDC")) {
+                                b = (x >= 0 && y > 0);
+                            } else {
+                                if (z == 2) {
+
+                                    b = (x >= 0 && x <= 30 && y >= 0 && y <= maxPower);
+
+                                    if (b) {
+                                        if (x > 3 && y <= 0) {
+                                            b = false;
+                                        }
+                                        if (x <= 3 && y > 0) {
+                                            b = false;
+                                        }
+                                    }
+
+                                } else {
+                                    b = false;
+                                }
+                            }
+                        }
+
+                        if (b) {
+                            sjglnhpoints.add(new PointfVo(x1, y1));
+
+                            if (zyglnhpoints.containsKey(x1)) {
+                                if (zyglnhpoints.get(x1).getY() < y1) {
+                                    zyglnhpoints.put(x1, new PointfVo(x1, y1));
+
+                                }
+                            } else {
+                                zyglnhpoints.put(x1, new PointfVo(x1, y1));
+                            }
+
+                        }
+                    }
+                }
+                sjglnhpoints.add(new PointfVo(0.0, 0.0));
+
+                sjglnhpoints = sjglnhpoints.stream().filter(it -> it.getX() >= 3).sorted(Comparator.comparing(PointfVo::getX)).collect(Collectors.toList());
+
+                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.size() != 0) {
+                    buildMyPoints(sjglPoints, scale);
+                }
+
+
+                if (!zyglnhpoints.containsKey(0.0))
+                    zyglnhpoints.put(0.0, new PointfVo(0.0, 0.0));
+
+                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.size() != 0) {
+                    buildMyPoints(zyglPoints, scale);
+                }
+            }
+        }
+    }
+
+    private static void buildMyPoints(List<PointVo> sjglPoints, double scale) {
+        int coefficient = 1;
+        int dec = 0;
+        int smax = 25;
+        if (scale == 0.01) {
+            coefficient = 100;
+            dec = 2;
+        }
+        if (scale == 0.1) {
+            coefficient = 10;
+            dec = 1;
+        }
+
+        smax *= 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();
+        }
+
+
+        for (double i = 0; i < min; i += 1) {
+            PointVo point = new PointVo();
+            point.setX(StringUtils.round(i / coefficient, dec));
+            point.setY(0.0);
+
+            sjglPoints.add(point);
+        }
+
+
+        for (double i = smax; i > max; i -= 1) {
+            PointVo point = new PointVo();
+            point.setX(StringUtils.round(i / coefficient, dec));
+            point.setY(maxval);
+
+            sjglPoints.add(point);
+        }
+    }
+
+}

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

@@ -168,7 +168,8 @@ public class PowerCurveFittingService {
             windMap.get(key).setYzyglPoints(new ArrayList<>());
             windMap.get(key).setRsjglPoints(new ArrayList<>());
             windMap.get(key).setRzyglPoints(new ArrayList<>());
-
+            windMap.get(key).setNsjglPoints(new ArrayList<>());
+            windMap.get(key).setNzyglPoints(new ArrayList<>());
 
             if (windMap.get(key).getPointIdGL() == null || windMap.get(key).getPointIdFS() == null || windMap.get(key).getPointIdZT() == null) {
                 logger.info(key);
@@ -234,12 +235,14 @@ public class PowerCurveFittingService {
                 String standardId = CacheContext.wtstandardmap.get(key);
                 if (StringUtils.notEmp(standardId)) {
                     if (windMap.containsKey(key)) {
+                        yearStandardPoints = windMap.get(standardId).getNsjglPoints();
                         monthStandardPoints = windMap.get(standardId).getYsjglPoints();
                         dayStandardPoints = windMap.get(standardId).getRsjglPoints();
                     }
                 }
             }
 
+
             String stringyear = String.valueOf(year);
             String stringmonth = String.valueOf(month);
 

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

@@ -225,7 +225,11 @@ public class ShutdownService {
 
 
 
-    public void exec() throws Exception {
+    public void execShutdown() throws Exception {
+
+        init();
+
+
         oldStatusMap.clear();
         oldShutdownEvent.clear();
         oldInterrup.clear();

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

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

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

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

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

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

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

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