Przeglądaj źródła

移植停机事件计算服务

shilin 2 lat temu
rodzic
commit
c01e669279
39 zmienionych plików z 2141 dodań i 1142 usunięć
  1. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ActivePowerDataController.java
  2. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/controller/InterruptionController.java
  3. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/controller/InterruptionItemController.java
  4. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ProEconActivePowerDataController.java
  5. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ProEconInterruptionController.java
  6. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ProEconInterruptionItemController.java
  7. 6 2
      realtime/generationXK-service/src/main/java/com/gyee/generation/init/CacheContext.java
  8. 16 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconActivePowerDataMapper.java
  9. 16 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconInterruptionItemMapper.java
  10. 16 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconInterruptionMapper.java
  11. 3 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconShutdowneventMapper.java
  12. 76 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconActivePowerData.java
  13. 70 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconInterruption.java
  14. 63 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconInterruptionItem.java
  15. 6 4
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconShutdownevent.java
  16. 3 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconShutdownEvent2.java
  17. 16 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/StatusItemVo.java
  18. 0 1100
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/FiveLossesService.java
  19. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/LimitEventService.java
  20. 6 6
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/PowerCurveFittingService.java
  21. 980 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownService.java
  22. 16 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconActivePowerDataService.java
  23. 16 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconInterruptionItemService.java
  24. 16 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconInterruptionService.java
  25. 3 3
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconShutdowneventService.java
  26. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconActivePowerDataServiceImpl.java
  27. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconInterruptionItemServiceImpl.java
  28. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconInterruptionServiceImpl.java
  29. 20 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconShutdownEventServiceImpl.java
  30. 0 20
      realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconShutdowneventServiceImpl.java
  31. 1 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/util/LineUtil.java
  32. 97 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtil.java
  33. 5 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtilTd.java
  34. 3 1
      realtime/generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/IEdosUtil.java
  35. 81 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/util/statisticcs/ActivePowerStatistics.java
  36. 133 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/util/statisticcs/StatusStatistics.java
  37. 171 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/util/statisticcs/TheoryPowerStatistics.java
  38. 119 0
      realtime/generationXK-service/src/main/java/com/gyee/generation/util/statisticcs/WindSpeedStatistics.java
  39. 2 1
      realtime/generationXK-service/src/main/resources/application-xk.yml

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ActivePowerDataController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 动态功率数据 前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+@RestController
+@RequestMapping("//active-power-data")
+public class ActivePowerDataController {
+
+}

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/controller/InterruptionController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 根据风电机状态判断通讯中断并记录。 前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+@RestController
+@RequestMapping("//interruption")
+public class InterruptionController {
+
+}

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/controller/InterruptionItemController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 记录通讯中断表中的记录的分解过程。 前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+@RestController
+@RequestMapping("//interruption-item")
+public class InterruptionItemController {
+
+}

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ProEconActivePowerDataController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 动态功率数据 前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+@RestController
+@RequestMapping("//pro-econ-active-power-data")
+public class ProEconActivePowerDataController {
+
+}

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ProEconInterruptionController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 根据风电机状态判断通讯中断并记录。 前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+@RestController
+@RequestMapping("//pro-econ-interruption")
+public class ProEconInterruptionController {
+
+}

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/controller/ProEconInterruptionItemController.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 记录通讯中断表中的记录的分解过程。 前端控制器
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+@RestController
+@RequestMapping("//pro-econ-interruption-item")
+public class ProEconInterruptionItemController {
+
+}

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

@@ -78,6 +78,10 @@ public class CacheContext implements CommandLineRunner {
     public static Map<String,ProBasicWindturbine> wtmap = new HashMap<>();
 
     public static Map<String,Map<Double,ProBasicModelPower>> modelpowermap = new TreeMap<>();
+
+    public static List<ProBasicModelPower> mpls=new ArrayList<>();
+
+    public static List<ProEconEquipmentmodel> equipmentmodels=new ArrayList<>();
     @Override
     public void run(String... args) throws Exception {
         logger.info("缓存开始------------------------------------------------------------");
@@ -85,11 +89,11 @@ public class CacheContext implements CommandLineRunner {
         logger.info(runWpids.get(0)+"------------------"+runWpids.size());
 
 
-        List<ProEconEquipmentmodel> equipmentmodels = proEconEquipmentmodelService.list();
+        equipmentmodels = proEconEquipmentmodelService.list();
         equipmentmodels.stream().forEach(e->{
             modelMap.put(e.getId(),e);
         });
-        List<ProBasicModelPower> mpls=proBasicModelPowerService.list();
+        mpls=proBasicModelPowerService.list();
         mpls.sort(Comparator.comparing(ProBasicModelPower::getSpeed));
         if(!mpls.isEmpty())
         {

+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconActivePowerDataMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.ProEconActivePowerData;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 动态功率数据 Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+public interface ProEconActivePowerDataMapper extends BaseMapper<ProEconActivePowerData> {
+
+}

+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconInterruptionItemMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.ProEconInterruptionItem;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 记录通讯中断表中的记录的分解过程。 Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+public interface ProEconInterruptionItemMapper extends BaseMapper<ProEconInterruptionItem> {
+
+}

+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconInterruptionMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.ProEconInterruption;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 根据风电机状态判断通讯中断并记录。 Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+public interface ProEconInterruptionMapper extends BaseMapper<ProEconInterruption> {
+
+}

+ 3 - 3
realtime/generationXK-service/src/main/java/com/gyee/generation/mapper/auto/ProEconShutdowneventMapper.java

@@ -1,6 +1,6 @@
 package com.gyee.generation.mapper.auto;
 
-import com.gyee.generation.model.auto.ProEconShutdownevent;
+import com.gyee.generation.model.auto.ProEconShutdownEvent;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 /**
@@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * </p>
  *
  * @author shilin
- * @since 2022-10-21
+ * @since 2022-10-27
  */
-public interface ProEconShutdowneventMapper extends BaseMapper<ProEconShutdownevent> {
+public interface ProEconShutdownEventMapper extends BaseMapper<ProEconShutdownEvent> {
 
 }

+ 76 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconActivePowerData.java

@@ -0,0 +1,76 @@
+package com.gyee.generation.model.auto;
+
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 动态功率数据
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProEconActivePowerData extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private Integer id;
+
+    /**
+     * 风场编号
+     */
+    private String windpowerstationId;
+
+    /**
+     * 风机编号
+     */
+    private String windturbineId;
+
+    /**
+     * 型号编号
+     */
+    private String modelId;
+
+    /**
+     * 时间
+     */
+    private Date recordDate;
+
+    /**
+     * 风速
+     */
+    private Double speed;
+
+    /**
+     * 功率
+     */
+    private Double power;
+
+    /**
+     * 频率
+     */
+    private Double frequency;
+
+    /**
+     * 风机编码
+     */
+    private String windturbineCode;
+
+    /**
+     * 型号名称
+     */
+    private String modelName;
+
+
+}

+ 70 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconInterruption.java

@@ -0,0 +1,70 @@
+package com.gyee.generation.model.auto;
+
+
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+
+import java.util.Date;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 根据风电机状态判断通讯中断并记录。
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProEconInterruption extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @TableId(value = "ID",type = IdType.ASSIGN_ID)
+    private Integer id;
+
+    /**
+     * 风场编号
+     */
+    private String windpowerstationId;
+
+    /**
+     * 风机编号
+     */
+    private String windturbineId;
+
+    /**
+     * 结束时间
+     */
+    private Date stopTime;
+
+    /**
+     * 开始时间
+     */
+    private Date startTime;
+
+    /**
+     * 中断小时数
+     */
+    private Double stopHours;
+
+    /**
+     * 是否处理
+     */
+    private Integer isHandle;
+
+    /**
+     * 工程编号
+     */
+    private String projectId;
+
+
+}

+ 63 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconInterruptionItem.java

@@ -0,0 +1,63 @@
+package com.gyee.generation.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.time.LocalDate;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 记录通讯中断表中的记录的分解过程。
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProEconInterruptionItem extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private Integer id;
+
+    /**
+     * 风场编号
+     */
+    private String windpowerstationId;
+
+    /**
+     * 风机编号
+     */
+    private String windturbineId;
+
+    /**
+     * 结束时间
+     */
+    private LocalDate stopTime;
+
+    /**
+     * 开始时间
+     */
+    private LocalDate startTime;
+
+    /**
+     * 工程编号
+     */
+    private String projectId;
+
+    /**
+     * 状态码
+     */
+    private Integer satusCode;
+
+    /**
+     * 状态描述
+     */
+    private String statusDesc;
+
+
+}

+ 6 - 4
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconShutdownevent.java

@@ -2,7 +2,9 @@ package com.gyee.generation.model.auto;
 
 
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+
 import java.util.Date;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -12,11 +14,11 @@ import lombok.EqualsAndHashCode;
  * </p>
  *
  * @author shilin
- * @since 2022-10-21
+ * @since 2022-10-27
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
-public class ProEconShutdownevent extends Model {
+public class ProEconShutdownEvent extends Model {
 
     private static final long serialVersionUID = 1L;
 
@@ -53,12 +55,12 @@ public class ProEconShutdownevent extends Model {
     /**
      * 损失电量
      */
-    private Double losspower;
+    private Double lossPower;
 
     /**
      * 故障停机、维护停机、限电停机、复位停机
      */
-    private String stoptypeid;
+    private String stoptypeId;
 
     /**
      * 是否处理

+ 3 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/auto/ProEconShutdownEvent2.java

@@ -1,6 +1,8 @@
 package com.gyee.generation.model.auto;
 
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import java.util.Date;
 import lombok.Data;
@@ -23,6 +25,7 @@ public class ProEconShutdownEvent2 extends Model {
     /**
      * 编号
      */
+    @TableId(value = "ID",type = IdType.ASSIGN_ID)
     private String id;
 
     /**

+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/model/vo/StatusItemVo.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.model.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class StatusItemVo {
+
+    public String uniformCode;
+    public String ednaPoint;
+    public Double ednaValue;
+    public Double count;
+}

Plik diff jest za duży
+ 0 - 1100
realtime/generationXK-service/src/main/java/com/gyee/generation/service/FiveLossesService.java


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

@@ -1060,7 +1060,7 @@ public class LimitEventService {
 
     //读取历史数据
     public List<PointData> getHisData(String szPoint, Date startTime, Date endTime) throws Exception {
-        List<PointData> result = edosUtil.getHistoryDatasSnap(szPoint, startTime.getTime() / 1000, endTime.getTime() / 1000, null, 60l);
+        List<PointData> result = edosUtil.getHistoryDatasSnap(szPoint, startTime.getTime() / 1000, endTime.getTime() / 1000);
         if (result.size() == 0) {
             //logger.ErrorFormat(" getHisData(String szPoint={0}, Date startTime={1}, Date endTime={2})", szPoint, startTime, endTime);
             PointData pa = new PointData();

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

@@ -9,7 +9,7 @@ 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.LineUtil;
+import com.gyee.generation.util.math.LineUtil;
 import com.gyee.generation.util.StringUtils;
 import com.gyee.generation.util.realtimesource.IEdosUtil;
 import org.slf4j.Logger;
@@ -50,8 +50,8 @@ public class PowerCurveFittingService {
     private IProEconCurveFittMonthSubService proEconCurveFittMonthSubService;
     @Resource
     private IProEconWtPowerCurveFittingService proEconWtPowerCurveFittingService;
-    
 
+    //inserttype 0表示正常拟合工作,1表示存值到windturbinePowerCurveFitting表
     public void CureFitting(Date nowDate, Date begion, int insertType, String fdcId,  List<String> fdjIds) throws Exception {
 
         //日期变为昨天
@@ -148,7 +148,7 @@ public class PowerCurveFittingService {
 
                 item.setPointIdFS(pointIdFS);
                 item.setPointIdZT(pointIdZT);
-                item.setPointIdGL(pointIdZT);
+                item.setPointIdGL(pointIdGL);
                 //获取标杆风机编号
                 if(CacheContext.wtstandardmap.containsKey(wt.getId()))
                 {
@@ -855,9 +855,9 @@ public class PowerCurveFittingService {
         {
             if (StringUtils.notEmp(pointIdGL) && StringUtils.notEmp(pointIdFS))
             {
-                List<PointData> glpoints =edosUtil.getHistoryDatasSnap(pointIdGL, begin.getTime()/1000, end.getTime()/1000,null,60l);
-                List<PointData> fspoints =edosUtil.getHistoryDatasSnap(pointIdFS, begin.getTime()/1000, end.getTime()/1000,null,60l);
-                List<PointData> ztpoints =edosUtil.getHistoryDatasSnap(pointIdZT, begin.getTime()/1000, end.getTime()/1000,null,60l);
+                List<PointData> glpoints =edosUtil.getHistoryDatasSnap(pointIdGL, begin.getTime()/1000, end.getTime()/1000);
+                List<PointData> fspoints =edosUtil.getHistoryDatasSnap(pointIdFS, begin.getTime()/1000, end.getTime()/1000);
+                List<PointData> ztpoints =edosUtil.getHistoryDatasSnap(pointIdZT, begin.getTime()/1000, end.getTime()/1000);
 
 
                 //var ztpoints2 = GoldenHelper.GetHisData(pointIdZT2, begin, end);

+ 980 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/ShutdownService.java

@@ -0,0 +1,980 @@
+package com.gyee.generation.service;
+
+import com.alibaba.druid.sql.ast.TDDLHint;
+import com.gyee.common.contant.Contant;
+import com.gyee.common.model.DNAVal;
+import com.gyee.common.model.PointData;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.*;
+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 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 ShutdownService {
+
+    private static final Logger log = LoggerFactory.getLogger(ShutdownService.class);
+    @Resource
+    private IEdosUtil edosUtil;
+    private final String  ALARMHISTORY="ALARMHISTORY";
+    @Resource
+    private IProEconWtPowerCurveFittingService proEconWtPowerCurveFittingService;
+    @Resource
+    private IProEconWindturbineStatusService proEconWindturbineStatusService;
+
+    @Resource
+    private IProEconShutdownEventService proEconShutdownEventService;
+
+    @Resource
+    private IProEconShutdownEvent2Service proEconShutdownEvent2Service;
+    @Resource
+    private IProEconInterruptionService proEconInterruptionService;
+
+    @Resource
+    private IProEconInputOrOutputSpeedService proEconInputOrOutputSpeedService;
+
+    @Resource
+    private IProEconActivePowerDataService proEconActivePowerDataService;
+
+
+    private static Logger logger = LoggerFactory.getLogger(ShutdownService.class);
+
+    /// <summary>
+    /// 风机状态测点,key为风机编号
+    /// </summary>
+    private Map<String, ProBasicEquipmentPoint> statusPoints = new HashMap<String, ProBasicEquipmentPoint>();
+    /// <summary>
+    /// 风机功率测点,key为风机编号
+    /// </summary>
+    private Map<String, ProBasicEquipmentPoint> powerPoints = new HashMap<String, ProBasicEquipmentPoint>();
+    /// <summary>
+    /// 风机当前状态,key为风机编号
+    /// </summary>
+    private Map<String, Integer> status = new HashMap<String, Integer>();
+    /// <summary>
+    /// 保存风机信息,key为风机编号
+    /// </summary>
+    private Map<String, ProBasicWindturbine> windTurbines = new HashMap<String, ProBasicWindturbine>();
+
+    /// <summary>
+    /// 风机状态说明,key为状态码,value为状态说明
+    /// </summary>
+    private Map<Integer, String> statusDescription = new HashMap<Integer, String>();
+
+
+    private Date date = new Date();
+
+    Map<String, ProEconWindturbineStatus> oldStatusMap = new HashMap<String, ProEconWindturbineStatus>();
+    Map<String, ProEconShutdownEvent> oldShutdownEvent = new HashMap<String, ProEconShutdownEvent>();
+    Map<String, ProEconInterruption> oldInterrup = new HashMap<String, ProEconInterruption>();
+
+   //新增shutdownevent2 实时
+    Map<String, ProEconShutdownEvent2> oldShutdownEvent2 = new HashMap<String, ProEconShutdownEvent2>();
+
+
+    /// <summary>
+    /// 风机功率 key为风机编号
+    /// </summary>
+    Map<String, ProBasicEquipmentPoint> powerpointMap = new HashMap<String, ProBasicEquipmentPoint>();//功率
+    /// <summary>
+    /// 风机风速 key为风机编号
+    /// </summary>
+    Map<String, ProBasicEquipmentPoint> speedpointMap = new HashMap<String, ProBasicEquipmentPoint>();//风速
+    /// <summary>
+    /// 测风塔风速 key为风场编号
+    /// </summary>
+    Map<String, ProBasicWppoint> gzdpointMap = new HashMap<String, ProBasicWppoint>();//测风塔风速
+    /// <summary>
+    ///
+    /// </summary>
+//    Map<String, Map<Double, ProBasicModelPower>> modelPowerMap = new HashMap<String, Map<Double, ProBasicModelPower>>();
+    //不在从新拟合功率曲线,从数据库中直接取值
+    Map<String, Map<Double, ProEconWtPowerCurveFitting>> modelPowerMap = new HashMap<String, Map<Double, ProEconWtPowerCurveFitting>>();
+    Map<String, ProBasicWindpowerstation> windpowerMap;//风场
+
+
+    @Value("${shutdown.keystr}")
+    private String[] keystr;
+
+    public void Init()
+    {
+        statusDescription.put(0, "待机");
+        statusDescription.put(1, "并网");
+        statusDescription.put(2, "停机");
+        statusDescription.put(3, "通讯中断");
+        statusDescription.put(4, "维护");
+        statusDescription.put(5, "限电");
+
+
+        String[] appStr = new String[keystr.length];
+
+        for (int i = 0; i < keystr.length; i++)
+        {
+            appStr[i] = keystr[i];
+        }
+
+            windpowerMap = CacheContext.wpmap;
+
+        List<ProBasicEquipmentPoint> items=new ArrayList<>();
+        List<ProBasicEquipmentPoint> powerpointList = new ArrayList<>();
+        List<ProBasicEquipmentPoint> speedpointList = new ArrayList<>();
+
+        List<ProBasicWindturbine> 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(Contant.FJ5T))
+            {
+                ProBasicEquipmentPoint mxztPoint = windturbinetestingpointnewMap.get(Contant.FJ5T);
+
+                items.add(mxztPoint);
+            }
+
+            if(windturbinetestingpointnewMap.containsKey(Contant.AI130))
+            {
+                ProBasicEquipmentPoint ygglPoint = windturbinetestingpointnewMap.get(Contant.AI130);
+
+                powerPoints.put(ygglPoint.getCode(),ygglPoint);
+                powerpointList.add(ygglPoint);
+            }
+
+            if(windturbinetestingpointnewMap.containsKey(Contant.AI022))
+            {
+                ProBasicEquipmentPoint mxztPoint = windturbinetestingpointnewMap.get(Contant.AI022);
+
+                speedpointList.add(mxztPoint);
+            }
+
+        });
+
+        //进行测点排序
+        powerpointList.sort(Comparator.comparing(ProBasicEquipmentPoint::getWindturbineId));
+        speedpointList.sort(Comparator.comparing(ProBasicEquipmentPoint::getWindturbineId));
+
+            for (ProBasicEquipmentPoint item : items)
+            {
+                statusPoints.put(item.getWindturbineId(), item);
+                status.put(item.getWindturbineId(), -1);
+            }
+
+
+             windTurbines=CacheContext.wtmap;
+            List<ProBasicWppoint> gzdpointList =new ArrayList<>();
+                CacheContext.wpls.stream().forEach(wp->{
+
+                    Map<String, ProBasicWppoint> wppointsmap = CacheContext.wppointmap.get(wp.getId());
+                    if(wppointsmap.containsKey(Contant.IRRAD))
+                    {
+                        ProBasicWppoint mxztPoint = wppointsmap.get(Contant.IRRAD);
+
+                        gzdpointList.add(mxztPoint);
+                    }
+
+
+
+
+            });
+
+
+
+            for (Integer i = 0; i < powerpointList.size(); i++)
+            {
+                if (powerpointMap.containsKey(powerpointList.get(i).getWindturbineId()))
+                {
+
+                }
+                else
+                {
+                    powerpointMap.put(powerpointList.get(i).getWindturbineId(), powerpointList.get(i));
+                }
+            }
+            for (Integer i = 0; i < speedpointList.size(); i++)
+            {
+                if (speedpointMap.containsKey(speedpointList.get(i).getWindturbineId()))
+                {
+
+                }
+                else
+                {
+                    speedpointMap.put(speedpointList.get(i).getWindturbineId(), speedpointList.get(i));
+                }
+            }
+
+            for (Integer i = 0; i < gzdpointList.size(); i++)
+            {
+                if (gzdpointMap.containsKey(gzdpointList.get(i).getWindpowerstationId()))
+                {
+
+                }
+                else
+                {
+                    gzdpointMap.put(gzdpointList.get(i).getWindpowerstationId(), gzdpointList.get(i));
+                }
+            }
+
+
+        wtls.stream().forEach(wt->{
+
+            List<ProEconWtPowerCurveFitting>  wtpcfidls=proEconWtPowerCurveFittingService.list().stream()
+                    .filter(i->i.getWindturbineId().equals(wt.getId()))
+                    .sorted(Comparator.comparing(ProEconWtPowerCurveFitting::getSpeed)).collect(Collectors.toList());
+
+            Map<Double, ProEconWtPowerCurveFitting> map = new HashMap<Double, ProEconWtPowerCurveFitting>();
+            if(!wtpcfidls.isEmpty())
+            {
+                for(ProEconWtPowerCurveFitting pwpcf:wtpcfidls)
+                {
+                    map.put(pwpcf.getSpeed(),pwpcf);
+                }
+            }
+            modelPowerMap.put(wt.getId(),map);
+
+        });
+
+
+
+    }
+
+
+
+    public void exec() throws Exception {
+        oldStatusMap.clear();
+        oldShutdownEvent.clear();
+        oldInterrup.clear();
+        oldShutdownEvent2.clear();
+
+
+        logger.debug("{0}开始", date);
+        //循环读取所有风机的当前状态,并且给几个缓存字典初始化
+        for (String key : statusPoints.keySet())
+        {
+            //取实时状态数据 赋值给status
+            double power = 0;
+            if (powerPoints.containsKey(key))
+            {
+                power = StringUtils.round(edosUtil.getRealData(powerPoints.get(key).getCode()).getPointValueInDouble(),2);
+
+            }
+            Double value = StringUtils.round(edosUtil.getRealData(statusPoints.get(key).getCode()).getPointValueInDouble(),2);
+
+            if (power > 1)
+            {
+                status.put(key,value == 5 ? 1 : value.intValue());
+
+            }
+            else
+            {
+                status.put(key,value == 5 ? 0 : value.intValue());
+
+            }
+
+            oldStatusMap.put(key, null);
+            oldShutdownEvent.put(key, null);
+            oldInterrup.put(key, null);
+
+           // 新增 shutdownevent2 实时
+            oldShutdownEvent2.put(key, null);
+
+        }
+
+        //读取oracle中 五种小时数、停机记录、中断记录
+
+
+            //读取数据库存在的恢复时间为NULL的数据
+        List<ProEconWindturbineStatus> oldStatusQuery=proEconWindturbineStatusService.list().stream()
+                .filter(i->StringUtils.empty(i.getStartTime()))
+                .sorted(Comparator.comparing(ProEconWindturbineStatus::getStopTime)).collect(Collectors.toList());
+
+            for (ProEconWindturbineStatus oldStatus : oldStatusQuery)
+            {
+                if (oldStatusMap.containsKey(oldStatus.getWindturbineId()))
+                {
+                    oldStatusMap.put(oldStatus.getWindturbineId(),oldStatus);
+                }
+
+            }
+
+        List<ProEconShutdownEvent> oldShutdwonQuery=proEconShutdownEventService.list().stream()
+                .filter(i->StringUtils.empty(i.getStartTime()))
+                .sorted(Comparator.comparing(ProEconShutdownEvent::getStopTime)).collect(Collectors.toList());
+
+            for (ProEconShutdownEvent shutdown : oldShutdwonQuery)
+            {
+                if (oldShutdownEvent.containsKey(shutdown.getWindturbineId()))
+                {
+                    oldShutdownEvent.put(shutdown.getWindturbineId(),shutdown);
+
+                }
+            }
+
+        List<ProEconInterruption> oldInterrupQuery=proEconInterruptionService.list().stream()
+                .filter(i->StringUtils.empty(i.getStartTime()))
+                .sorted(Comparator.comparing(ProEconInterruption::getStopTime)).collect(Collectors.toList());
+
+            for (ProEconInterruption interrup : oldInterrupQuery)
+            {
+                if (oldInterrup.containsKey(interrup.getWindturbineId()))
+                {
+                    oldInterrup.put(interrup.getWindturbineId(),interrup);
+                }
+            }
+            // 新增 shutdownevent2 实时
+
+
+        List<ProEconShutdownEvent2> oldShutdwonQuery2=proEconShutdownEvent2Service.list().stream()
+                .filter(i->StringUtils.empty(i.getStartTime()))
+                .sorted(Comparator.comparing(ProEconShutdownEvent2::getStopTime)).collect(Collectors.toList());
+
+            for (ProEconShutdownEvent2 shutdown : oldShutdwonQuery2)
+            {
+                if (oldShutdownEvent2.containsKey(shutdown.getWindturbineId()))
+                {
+
+
+                    oldShutdownEvent2.put(shutdown.getWindturbineId(),shutdown);
+                }
+            }
+
+
+
+
+            for (String s : oldStatusMap.keySet())
+            {
+                ProEconWindturbineStatus item = oldStatusMap.get(s);
+
+                if (item == null)
+                {
+
+                    //logger.debug("{0}重复加入 风机编号{1}", date,s);
+
+                    ProEconShutdownEvent shutdwonEvent=null;
+                    ProEconInterruption interrup=null;
+
+                        //region 新增 shutdownevent2 实时
+                    ProEconShutdownEvent2 shutdwonEvent2=null;
+
+
+                    item = buildWindturbineStatus(s, date,  shutdwonEvent,  interrup,  shutdwonEvent2);
+
+
+
+                    proEconWindturbineStatusService.save(item);
+
+                    if (shutdwonEvent != null)
+                    {
+                        proEconShutdownEventService.save(shutdwonEvent);
+                    }
+                    if (interrup != null)
+                    {
+                        proEconInterruptionService.save(interrup);
+
+                    }
+
+                     //  新增 shutdownevent2 实时
+                    if (shutdwonEvent2 != null)
+                    {
+                        //20分钟以内的报警数据
+                        Date dtbegin = DateUtils.addMinutes(shutdwonEvent2.getStopTime(),-15);
+                        Date dtend = shutdwonEvent2.getStopTime();
+
+                        Optional<ProEconShutdownEvent2> olditem=proEconShutdownEvent2Service.list().stream()
+                                .filter(i->i.getWindturbineId().equals(s)
+                                        && ( i.getStartTime().compareTo(dtbegin)==0 || i.getStartTime().after(dtbegin))
+                                        && (i.getStartTime().compareTo(dtend)==0 || i.getStartTime().before(dtend))
+
+                                ).sorted(Comparator.comparing(ProEconShutdownEvent2::getStartTime)).findFirst();
+
+                        ProEconShutdownEvent2 temp=null;
+                        if (!olditem.isPresent())
+                        {
+                            proEconShutdownEvent2Service.save(shutdwonEvent2);
+                            temp=olditem.get();
+                        }
+                        else
+                        {
+                            olditem.get().setStartTime(null);
+                            if (null !=temp && !oldShutdownEvent2.containsKey(temp.getWindturbineId()))
+                                oldShutdownEvent2.put(temp.getWindturbineId(), temp);
+
+                        }
+                    }
+
+                    continue;
+                }
+
+
+                Calendar c=Calendar.getInstance();
+                c.setTime(date);
+                if (c.get(Calendar.HOUR_OF_DAY) == 0 &&c.get(Calendar.MINUTE) == 0)
+                {
+                    logger.debug("{0}--整点操作--{1}", s, date);
+
+                    updateAndAddStatus( item);
+                }
+                else if (((Integer)item.getSatusCode()) != status.get(s))
+                {
+                    updateAndAddStatus(item);
+
+                    //    #region 切入切出风速
+                    if (((Integer)item.getSatusCode()) == 0 && status.get(s) == 1)
+                    {
+                        ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
+                        input.setWindturbineId(s);
+                        input.setWindpowerstationId(windTurbines.get(s).getWindpowerstationId());
+                        input.setProjectId(windTurbines.get(s).getProjectId());
+                        input.setLineId(windTurbines.get(s).getLineId());
+                        input.setRecordDate(date);
+                        input.setInputOrOutput(1);
+
+
+                        if (speedpointMap.containsKey(s))
+                        {
+                            double value =edosUtil.getRealData(speedpointMap.get(s).getCode()).getPointValueInDouble();
+                            input.setSpeed(value);
+                        }
+
+                        proEconInputOrOutputSpeedService.save(input);
+
+                    }
+                    else if (((Integer)item.getSatusCode()) == 1 && status.get(s)== 0)
+                    {
+                        ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
+                        input.setWindturbineId(s);
+                        input.setWindpowerstationId(windTurbines.get(s).getWindpowerstationId());
+                        input.setProjectId(windTurbines.get(s).getProjectId());
+                        input.setLineId(windTurbines.get(s).getLineId());
+                        input.setRecordDate(date);
+                        input.setInputOrOutput(0);
+                        if (speedpointMap.containsKey(s))
+                        {
+                            double value =edosUtil.getRealData(speedpointMap.get(s).getCode()).getPointValueInDouble();
+                            input.setSpeed(value);
+                        }
+
+                        proEconInputOrOutputSpeedService.save(input);
+                    }
+
+
+
+                }
+
+                updateAndAddStatus2(item);
+
+            }
+
+        logger.debug("{0}-------结束", date);
+    }
+
+
+
+    /// <summary>
+    /// 计算损失电量
+    /// </summary>
+    /// <param name="entities"></param>
+    /// <param name="status"></param>
+    private void updateAndAddStatus2(ProEconWindturbineStatus status) throws Exception {
+        Integer oldStatus = (Integer)status.getSatusCode();
+        if (oldStatus == 2 || oldStatus == 4)
+        {
+
+            ProEconShutdownEvent ose = oldShutdownEvent.get(status.getWindturbineId());
+            if (ose != null)
+            {
+
+                Double timehour=DateUtils.hoursDiff2(date,ose.getStopTime());
+                Double gc = calcLossPower(ose.getWindturbineId(), ose.getStopTime(), date);
+                ose.setLossPower(gc);
+            }
+           // 新增 shutdownevent2 实时
+            ProEconShutdownEvent2 ose2 = oldShutdownEvent2.get(status.getWindturbineId());
+            if (ose2 != null)
+            {
+                Double timehour=DateUtils.hoursDiff2(date,ose2.getStopTime());
+                Double gc = calcLossPower(ose.getWindturbineId(), ose2.getStopTime(), date);
+                ose2.setLossPower(gc);
+
+            }
+
+        }
+    }
+
+    private void updateAndAddStatus( ProEconWindturbineStatus status) throws Exception {
+        status.setStartTime(date);
+
+        List<PointData> speedDataList1;
+        String type1;
+
+        if (windTurbines.get(status.getWindturbineId()).getWindpowerstationId().indexOf("GDC") >= 0)
+        {
+            String point=gzdpointMap.get(windTurbines.get(status.getWindturbineId()).getWindpowerstationId()).getCode();
+            speedDataList1 =edosUtil.getHistoryDatasSnap(point,status.getStopTime().getTime()/1000,status.getStartTime().getTime()/1000);
+            type1 = "GDC";
+        }
+        else
+        {
+            String point=speedpointMap.get(status.getWindturbineId()).getCode();
+            speedDataList1 =edosUtil.getHistoryDatasSnap(point,status.getStopTime().getTime()/1000,status.getStartTime().getTime()/1000);
+
+            type1 = "FDC";
+
+        }
+
+
+        if (speedDataList1 != null && speedDataList1.size() > 0)
+        {
+            status.setSpeed(speedDataList1.get(0).getPointValueInDouble());
+            DoubleSummaryStatistics summaryStatistics=speedDataList1.stream().mapToDouble(n -> n.getPointValueInDouble()).summaryStatistics();
+            status.setAvgSpeed(summaryStatistics.getAverage());
+        }
+        else
+        {
+            status.setSpeed(0.0);
+            status.setAvgSpeed(0.0);
+        }
+        Double timehour=DateUtils.hoursDiff2(date,status.getStopTime());
+
+
+        status.setStopHours(timehour);
+
+        ProEconShutdownEvent shutdwonEvent = null;
+        ProEconInterruption interrup = null;
+           // #region 新增 shutdownevent2 实时
+        ProEconShutdownEvent2 shutdwonEvent2 = null;
+
+
+        ProEconWindturbineStatus newStatusItem = buildWindturbineStatus(status.getWindturbineId(), date,  shutdwonEvent,  interrup,  shutdwonEvent2);
+
+        proEconWindturbineStatusService.save(newStatusItem);
+
+
+        Integer oldStatus = (Integer)status.getSatusCode();
+        Integer currentStatus = this.status.get(status.getWindturbineId());
+        if (shutdwonEvent != null)
+        {
+
+            if (currentStatus == 2 || currentStatus == 4)
+            {
+                if (oldStatus == 0 || oldStatus == 1 || oldStatus == 3)
+                {
+                    proEconShutdownEventService.save(shutdwonEvent);
+
+                }
+            }
+        }
+        if (interrup != null)
+        {
+            if (currentStatus == 3 && oldStatus != 3)
+            {
+                proEconInterruptionService.save(interrup);
+
+            }
+        }
+       // 新增 shutdownevent2 实时
+        if (shutdwonEvent2 != null)
+        {
+            if (currentStatus == 2 || currentStatus == 4)
+            {
+                if (oldStatus == 0 || oldStatus == 1 || oldStatus == 3)
+                {
+                    Date dtbegin = DateUtils.addMinutes(shutdwonEvent2.getStopTime(),-30);
+                    Date dtend = shutdwonEvent2.getStopTime();
+                    String windTurbineId = shutdwonEvent2.getWindturbineId();
+
+                    Optional<ProEconShutdownEvent2> olditem=proEconShutdownEvent2Service.list().stream()
+                            .filter(i->i.getWindturbineId().equals(windTurbineId)
+                                    && ( i.getStartTime().compareTo(dtbegin)==0 || i.getStartTime().after(dtbegin))
+                                    && (i.getStartTime().compareTo(dtend)==0 || i.getStartTime().before(dtend))
+
+
+                            ).sorted(Comparator.comparing(ProEconShutdownEvent2::getStartTime)).findFirst();
+
+                    ProEconShutdownEvent2 temp=null;
+                    if (!olditem.isPresent())
+                    {
+                        proEconShutdownEvent2Service.save(shutdwonEvent2);
+
+                    }
+                    else
+                    {
+                        temp=olditem.get();
+                        temp.setStartTime(null);
+                        if (!oldShutdownEvent2.containsKey(temp.getWindturbineId()))
+                            oldShutdownEvent2.put(temp.getWindturbineId(), temp);
+                    }
+                }
+            }
+        }
+
+        if (oldStatus == 2 || oldStatus == 4)
+        {
+            if (currentStatus == 0 || currentStatus == 1 || currentStatus == 3)
+            {
+                ProEconShutdownEvent ose = oldShutdownEvent.get(status.getWindturbineId());
+                if (ose != null)
+                {
+                    ose.setStartTime(date);
+
+                    timehour=DateUtils.hoursDiff2(date,ose.getStopTime());
+                    ose.setStopHours(timehour);
+
+                    if (!ose.getStoptypeId().equals("wh"))
+                    {
+                        String s =newMethod( status.getWindturbineId(), DateUtils.addMinutes(ose.getStopTime(),-5), date);
+                        if (StringUtils.notEmp(s))
+                        {
+                            ose.setStoptypeId(s);
+
+                        }
+                    }
+
+                    //Double gc = calcLossPower(ose.WINDTURBINEID, ose.STOPTIME.Value, ose.STARTTIME.Value, ose.STOPHOURS.Value, entities);
+                    //ose.LOSSPOWER = gc;
+                }
+               //  新增 shutdownevent2 实时
+                ProEconShutdownEvent2 ose2 = oldShutdownEvent2.get(status.getWindturbineId());
+                if (ose2 != null)
+                {
+
+                    ose2.setStartTime(date);
+
+                    timehour=DateUtils.hoursDiff2(date,ose.getStopTime());
+                    ose2.setStopHours(timehour);
+
+                    if (ose!=null && !ose.getStoptypeId().equals("wh"))
+                    {
+                        if (ose != null)
+                        {
+                            ose2.setStopTypeId(ose.getStoptypeId());
+                        }
+                        else
+                        {
+                            String s = newMethod( status.getWindturbineId(), DateUtils.addMinutes(ose2.getStopTime(),-5), date);
+                            if (StringUtils.notEmp(s))
+                            {
+                                ose2.setStopTypeId(s);
+                            }
+                        }
+                    }
+                }
+
+
+            }
+        }
+        if (oldStatus == 3 && currentStatus != 3)
+        {
+            ProEconInterruption item = oldInterrup.get(status.getWindturbineId());
+            if (item != null)
+            {
+                item.setStartTime(date);
+
+                timehour=DateUtils.hoursDiff2(date,item.getStopTime());
+                item.setStopHours(timehour);
+
+            }
+        }
+    }
+
+
+
+
+
+    
+
+    private Double calcLossPower(String windturbineId, Date startDate, Date endDate) throws Exception {
+        Double result = 0.0;
+
+        Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+        Map<String, ProBasicEquipmentPoint> wtpointmap=wtpAimap.get(windturbineId);
+
+        Calendar c1=Calendar.getInstance();
+        c1.setTime(startDate);
+        Calendar c2=Calendar.getInstance();
+        c2.setTime(endDate);
+        //判定限电是否跨年
+        if(endDate.after(startDate) && c1.get(Calendar.YEAR)==c2.get(Calendar.YEAR))
+        {
+            //年故障损失电量
+            if(wtpointmap.containsKey(Contant.WTNGZSSDL) )
+            {
+                double beginvalue=0.0;
+                double endvalue=0.0;
+
+                String[] pointid=new String[1];
+                pointid[0]=wtpointmap.get(Contant.WTNGZSSDL).getCode();
+                DNAVal[] xdbegin=edosUtil.getHistMatrix(pointid,Integer.valueOf(String.valueOf(startDate.getTime()/1000)));
+                DNAVal[] xdend=edosUtil.getHistMatrix(pointid,Integer.valueOf(String.valueOf(endDate.getTime()/1000)));
+
+
+                if(xdbegin.length==1 && xdend.length==1)
+                {
+                    beginvalue=xdbegin[0].DValue;
+                    endvalue=xdend[0].DValue;
+
+                    if (endvalue > beginvalue) {
+                        result =result+(endvalue - beginvalue);
+                    }
+                }
+            }
+
+           
+        }else
+        {
+            Calendar c=Calendar.getInstance();
+            c.setTime(DateUtils.truncDay(startDate));
+            c.add(Calendar.DAY_OF_MONTH,1);
+            //获得1月1日零点值
+            Date endtime=c.getTime();
+            //年故障损失电量
+            if(wtpointmap.containsKey(Contant.WTNGZSSDL) )
+            {
+                double beginvalue=0.0;
+                double endvalue=0.0;
+
+                String[] pointid=new String[1];
+                pointid[0]=wtpointmap.get(Contant.WTNGZSSDL).getCode();
+                DNAVal[] xdbegin=edosUtil.getHistMatrix(pointid,Integer.valueOf(String.valueOf(startDate.getTime()/1000)));
+                DNAVal[] xdend=edosUtil.getHistMatrix(pointid,Integer.valueOf(String.valueOf(endtime.getTime()/1000)));
+
+
+                if(xdbegin.length==1 && xdend.length==1)
+                {
+                    beginvalue=xdbegin[0].DValue;
+                    endvalue=xdend[0].DValue;
+
+                    if (endvalue > beginvalue) {
+                        result =result+(endvalue - beginvalue);
+                    }
+                }
+            }
+
+
+
+
+            //日故障损失电量
+            if(wtpointmap.containsKey(Contant.WTNGZSSDL) )
+            {
+
+                double endvalue=0.0;
+
+                String[] pointid=new String[1];
+                pointid[0]=wtpointmap.get(Contant.WTNGZSSDL).getCode();
+                DNAVal[] xdend=edosUtil.getHistMatrix(pointid,Integer.valueOf(String.valueOf(endDate.getTime()/1000)));
+
+
+                if(xdend.length==1)
+                {
+
+                    endvalue=xdend[0].DValue;
+
+                    if (endvalue > 0) {
+                        result =result+endvalue;
+                    }
+                }
+            }
+
+
+        }
+
+
+
+        return result;
+
+    }
+
+
+//    private void buildActivePowerData(Date beginDate,  String windturbineId, Double speed, List<Double> powers,ProEconActivePowerData data)
+//    {
+//
+//        data.setWindturbineId(windturbineId);
+//
+//        DoubleSummaryStatistics summaryStatistics=powers.stream().mapToDouble(n -> n).summaryStatistics();
+//        data.setPower(summaryStatistics.getAverage());
+//        data.setSpeed(speed);
+//        data.setFrequency(Double.valueOf(powers.size()));
+//        data.setRecordDate(beginDate);
+//        data.setModelId(windTurbines.get(windturbineId).getModelId());
+//
+//    }
+
+
+
+//
+//    //读取历史数据
+//    public List<PointData> GetHisData(String szPoint, Date startTime, Date endTime) throws Exception {
+//        List<PointData> result = edosUtil.getHistoryDatasSnap(szPoint, startTime.getTime()/1000, endTime.getTime()/1000);
+//        if (result.size() == 0)
+//        {
+//
+//            PointData pa = new PointData();
+//            pa.setPointValueInDouble(0.0);
+//            result.add(pa);
+//        }
+//        return result;
+//    }
+
+
+    //private ProEconWindturbineStatus buildWindturbineStatus(String windturbineId, Date date, out ProEconShutdownEvent shutdwonEvent,
+    //    out ProEconInterruption interrup, GdsjEntities entities)
+    //{
+    //    shutdwonEvent = null;
+    //    interrup = null;
+
+    //    ProEconWindturbineStatus retValue = new ProEconWindturbineStatus();
+    //    retValue.PROJECTID = windTurbines[windturbineId].PROJECTID;
+    //    retValue.SATUSCODE = status[windturbineId];
+    //    retValue.STATUSDESC = statusDescription[status[windturbineId]];
+    //    retValue.STOPTIME = date;
+    //    retValue.WINDPOWERSTATIONID = windTurbines[windturbineId].WINDPOWERSTATIONID;
+    //    retValue.WINDTURBINEID = windturbineId;
+
+    //    Integer currentStatus = status[windturbineId];
+    //    if (currentStatus == 2 || currentStatus == 4)
+    //    {
+    //        shutdwonEvent = new ProEconShutdownEvent();
+    //        shutdwonEvent.ID = Guid.NewGuid().ToString();
+    //        shutdwonEvent.PROJECTID = retValue.PROJECTID;
+    //        shutdwonEvent.STATUSCODE = currentStatus;
+    //        shutdwonEvent.STOPTIME = date;
+    //        shutdwonEvent.WINDPOWERSTATIONID = retValue.WINDPOWERSTATIONID;
+    //        shutdwonEvent.WINDTURBINEID = windturbineId;
+
+
+    //        if (currentStatus == 2)
+    //        {
+    //            var begin = date.AddMinutes(-5);
+    //            var temp = entities.WARNINGRECORDS.Where(it => it.WARNINGTIME >= begin && it.WARNINGTIME <= date && it.WINDTURBINEID == windturbineId).FirstOrDefault();
+
+    //            shutdwonEvent.STOPTYPEID = currentStatus == 2 ? "gzbmq" : "wh";
+    //            if (temp != null)
+    //            {
+    //                var id = temp.WARNINGID;
+    //                var tempitem = entities.WARNING.Where(it => it.ID == id).FirstOrDefault();
+    //                if (tempitem != null)
+    //                {
+    //                    shutdwonEvent.STOPTYPEID = tempitem.WARNINGCLASSIFYID;
+    //                }
+    //            }
+    //        }
+    //        else
+    //        {
+    //            shutdwonEvent.STOPTYPEID = "wh";
+    //        }
+
+    //        retValue.SHUTDOWNEVENTID = shutdwonEvent.ID;
+    //    }
+    //    if (currentStatus == 3)
+    //    {
+    //        interrup = new ProEconInterruption();
+    //        interrup.PROJECTID = retValue.PROJECTID;
+    //        interrup.STOPTIME = date;
+    //        interrup.WINDPOWERSTATIONID = retValue.WINDPOWERSTATIONID;
+    //        interrup.WINDTURBINEID = windturbineId;
+    //    }
+    //    return retValue;
+    //}
+
+    // 新增 shutdownevent2 实时
+    private ProEconWindturbineStatus buildWindturbineStatus(String windturbineId, Date date,  ProEconShutdownEvent shutdwonEvent,
+                                                      ProEconInterruption interrup,  ProEconShutdownEvent2 shutdwonEvent2)
+    {
+
+
+        ProEconWindturbineStatus retValue = new ProEconWindturbineStatus();
+
+        retValue.setProjectId(windTurbines.get(windturbineId).getProjectId());
+
+        retValue.setSatusCode(status.get(windturbineId));
+        retValue.setStatusDesc(statusDescription.get(status.get(windturbineId)));
+        retValue.setStopTime(date);
+        retValue.setWindpowerstationId(windTurbines.get(windturbineId).getWindpowerstationId());
+        retValue.setWindturbineId(windturbineId);
+
+        Integer currentStatus = status.get(windturbineId);
+        if (currentStatus == 2 || currentStatus == 4)
+        {
+            shutdwonEvent = new ProEconShutdownEvent();
+            shutdwonEvent.setId(StringUtils.getUUID());
+            shutdwonEvent.setProjectId(retValue.getProjectId());
+            shutdwonEvent.setStatusCode(currentStatus);
+            shutdwonEvent.setStopTime(date);
+            shutdwonEvent.setWindpowerstationId(retValue.getWindpowerstationId());
+            shutdwonEvent.setWindturbineId(windturbineId);
+
+
+            shutdwonEvent2 = new ProEconShutdownEvent2();
+            shutdwonEvent2.setId(StringUtils.getUUID());
+            shutdwonEvent2.setProjectId(retValue.getProjectId());
+            shutdwonEvent2.setStatusCode(currentStatus);
+            shutdwonEvent2.setStopTime(date);
+            shutdwonEvent2.setWinpowerstationId(retValue.getWindpowerstationId());
+            shutdwonEvent2.setWindturbineId(windturbineId);
+
+            if (currentStatus == 2)
+            {
+                Date begin =DateUtils.addMinutes(date,-5);
+                Date end = DateUtils.addMinutes(date,5);
+                shutdwonEvent.setStoptypeId(currentStatus == 2 ? "gzbmq" : "wh");
+                shutdwonEvent2.setStopTypeId(currentStatus == 2 ? "gzbmq" : "wh");
+                //读取报警记录表前后五分钟数据,选取第一个报警报警类型
+                String s =newMethod( windturbineId, begin, end);
+                if (StringUtils.notEmp(s))
+                {
+
+                    shutdwonEvent.setStoptypeId(s);
+                    shutdwonEvent2.setStopTypeId(s);
+
+                }
+            }
+            else
+            {
+                shutdwonEvent.setStoptypeId("wh");
+                shutdwonEvent2.setStopTypeId("wh");
+
+            }
+            retValue.setShutdownEventId(shutdwonEvent.getId());
+        }
+        if (currentStatus == 3)
+        {
+            interrup = new ProEconInterruption();
+            interrup.setProjectId(retValue.getProjectId());
+            interrup.setStopTime(date);
+            interrup.setWindpowerstationId(retValue.getWindpowerstationId());
+            interrup.setWindturbineId(windturbineId);
+        }
+        return retValue;
+    }
+
+    //TODO-SL
+
+    /**
+     * 需要添加报警记录关联停机事件方法
+     * @param windturbineId
+     * @param begin
+     * @param end
+     * @return
+     */
+    private static String newMethod( String windturbineId, Date begin, Date end)
+    {
+        String result = "";
+
+        return result;
+    }
+
+}
+
+
+
+
+
+
+

+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconActivePowerDataService.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.ProEconActivePowerData;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 动态功率数据 服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+public interface IProEconActivePowerDataService extends IService<ProEconActivePowerData> {
+
+}

+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconInterruptionItemService.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.ProEconInterruptionItem;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 记录通讯中断表中的记录的分解过程。 服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+public interface IProEconInterruptionItemService extends IService<ProEconInterruptionItem> {
+
+}

+ 16 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconInterruptionService.java

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.ProEconInterruption;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 根据风电机状态判断通讯中断并记录。 服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+public interface IProEconInterruptionService extends IService<ProEconInterruption> {
+
+}

+ 3 - 3
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/IProEconShutdowneventService.java

@@ -1,6 +1,6 @@
 package com.gyee.generation.service.auto;
 
-import com.gyee.generation.model.auto.ProEconShutdownevent;
+import com.gyee.generation.model.auto.ProEconShutdownEvent;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 /**
@@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * </p>
  *
  * @author shilin
- * @since 2022-10-21
+ * @since 2022-10-27
  */
-public interface IProEconShutdowneventService extends IService<ProEconShutdownevent> {
+public interface IProEconShutdownEventService extends IService<ProEconShutdownEvent> {
 
 }

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconActivePowerDataServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.model.auto.ProEconActivePowerData;
+import com.gyee.generation.mapper.auto.ProEconActivePowerDataMapper;
+import com.gyee.generation.service.auto.IProEconActivePowerDataService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 动态功率数据 服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+@Service
+public class ProEconActivePowerDataServiceImpl extends ServiceImpl<ProEconActivePowerDataMapper, ProEconActivePowerData> implements IProEconActivePowerDataService {
+
+}

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconInterruptionItemServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.model.auto.ProEconInterruptionItem;
+import com.gyee.generation.mapper.auto.ProEconInterruptionItemMapper;
+import com.gyee.generation.service.auto.IProEconInterruptionItemService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 记录通讯中断表中的记录的分解过程。 服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+@Service
+public class ProEconInterruptionItemServiceImpl extends ServiceImpl<ProEconInterruptionItemMapper, ProEconInterruptionItem> implements IProEconInterruptionItemService {
+
+}

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconInterruptionServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.model.auto.ProEconInterruption;
+import com.gyee.generation.mapper.auto.ProEconInterruptionMapper;
+import com.gyee.generation.service.auto.IProEconInterruptionService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 根据风电机状态判断通讯中断并记录。 服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+@Service
+public class ProEconInterruptionServiceImpl extends ServiceImpl<ProEconInterruptionMapper, ProEconInterruption> implements IProEconInterruptionService {
+
+}

+ 20 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconShutdownEventServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.model.auto.ProEconShutdownEvent;
+import com.gyee.generation.mapper.auto.ProEconShutdownEventMapper;
+import com.gyee.generation.service.auto.IProEconShutdownEventService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 停机事件 服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2022-10-27
+ */
+@Service
+public class ProEconShutdownEventServiceImpl extends ServiceImpl<ProEconShutdownEventMapper, ProEconShutdownEvent> implements IProEconShutdownEventService {
+
+}

+ 0 - 20
realtime/generationXK-service/src/main/java/com/gyee/generation/service/auto/impl/ProEconShutdowneventServiceImpl.java

@@ -1,20 +0,0 @@
-package com.gyee.generation.service.auto.impl;
-
-import com.gyee.generation.model.auto.ProEconShutdownevent;
-import com.gyee.generation.mapper.auto.ProEconShutdowneventMapper;
-import com.gyee.generation.service.auto.IProEconShutdowneventService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- * 停机事件 服务实现类
- * </p>
- *
- * @author shilin
- * @since 2022-10-21
- */
-@Service
-public class ProEconShutdowneventServiceImpl extends ServiceImpl<ProEconShutdowneventMapper, ProEconShutdownevent> implements IProEconShutdowneventService {
-
-}

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

@@ -1,4 +1,4 @@
-package com.gyee.generation.util;
+package com.gyee.generation.util.math;
 
 import com.gyee.generation.model.vo.PointVo;
 

+ 97 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtil.java

@@ -1333,6 +1333,103 @@ public class EdosUtil implements IEdosUtil {
         }
     }
 
+    @Override
+    public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate) throws Exception {
+        Optional<String> tagName = Optional.ofNullable(pointid);
+        Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
+        Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
+
+        //通过时间区间和时间间隔获取点数
+        Long finalInterval=60l;
+
+        Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
+
+        try {
+            String url = baseURL + "/history/snap?null=0";
+            //tagName 或thingType,thingId,uniformCode可以确定一个标签点
+            if (tagName.isPresent())
+                url = url + "&tagName=" + tagName.get();
+
+            if (startTs.isPresent())
+                url = url + "&startTs=" + startTs.get();
+            if (endTs.isPresent())
+                url = url + "&endTs=" + endTs.get();
+            if (interval.isPresent())
+                url = url + "&interval=" + interval.get();
+
+            ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
+            JSONArray jsonArray = resp.getBody();
+            if (jsonArray != null) {
+                List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray,tagName.get());
+                List<PointData> resultList = new ArrayList<>();
+
+                if(list.isEmpty())
+                {
+
+                    getHistsnapSameTiem(pointid, beginDate, finalInterval, resultList);
+                }else
+                {
+                    for (PointData snapItem : list) {
+                        long subTime = snapItem.getPointTime() - finalInterval;
+                        //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
+                        // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
+                        // 则代表该时间节点快照有效,否则为0
+                        String rawUrl = baseURL + "/history/section?null=0&tagNames=" +pointid+ "&ts=" + snapItem.getPointTime() + "000";
+                        ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
+                        JSONObject jsonObjectSection = sectionResp.getBody();
+
+                        if (jsonObjectSection != null) {
+                            List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
+                            if (sectionlist.size() > 0) {
+                                if(sectionlist.get(0).getPointTime()>=subTime&&sectionlist.get(0).getPointTime()<=snapItem.getPointTime()){
+                                    resultList.add(snapItem);
+                                }
+                                else{
+                                    PointData data = new PointData();
+                                    data.setEdnaId(pointid);
+                                    data.setPointTime(snapItem.getPointTime());
+                                    data.setPointValue("0");
+                                    data.setPointName("1");
+                                    data.setPointValueInDouble(0.0);
+                                    resultList.add(data);
+                                }
+                            } else {
+                                PointData data = new PointData();
+                                data.setEdnaId(pointid);
+                                data.setPointTime(snapItem.getPointTime());
+                                data.setPointValue("0");
+                                data.setPointName("1");
+                                data.setPointValueInDouble(0.0);
+                                resultList.add(data);
+                            }
+                        } else {
+                            PointData data = new PointData();
+                            data.setEdnaId(pointid);
+                            data.setPointTime(snapItem.getPointTime());
+                            data.setPointValue("0");
+                            data.setPointName("1");
+                            data.setPointValueInDouble(0.0);
+                            resultList.add(data);
+                        }
+                    }
+                }
+
+                return resultList;
+            } else {
+                return ErrorRequest.RequestListError(pointid);
+            }
+
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                return ErrorRequest.RequestListError(pointid);
+            } else {
+                throw exception;
+            }
+        }
+
+    }
+
 
     private JSONObject convertRealTimeParamete(RealTimeParameterVo pd) {
         JSONObject jo = new JSONObject();

+ 5 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtilTd.java

@@ -1318,5 +1318,10 @@ public class EdosUtilTd implements IEdosUtil {
 
     }
 
+    @Override
+    public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate) throws Exception {
+        return null;
+    }
+
 
 }

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

@@ -261,6 +261,8 @@ public interface IEdosUtil {
     public DNAVal[] getHistMatrix(String[] nameList, int tTime) throws Exception;
 
 
-    public void sendMultiRealTimeParamete(List<RealTimeParameterVo> pointls) throws Exception ;
+    public void sendMultiRealTimeParamete(List<RealTimeParameterVo> pointls) throws Exception;
+
+    public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate) throws Exception;
 
 }

+ 81 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/util/statisticcs/ActivePowerStatistics.java

@@ -0,0 +1,81 @@
+package com.gyee.generation.util.statisticcs;
+
+import com.gyee.common.contant.Contant;
+import com.gyee.generation.model.auto.ProBasicWindturbine;
+import com.gyee.generation.model.vo.StatusItemVo;
+
+import java.util.Date;
+import java.util.Map;
+
+public class ActivePowerStatistics extends  StatusStatistics{
+
+    public ActivePowerStatistics(Map<String, ProBasicWindturbine> windTurbines, Date date)
+    {
+            super(windTurbines, date);
+    }
+    
+    @Override
+    public  void addPointValue(String windTurbineId, double value)
+    {
+        ProBasicWindturbine wt = windTurbines.get(windTurbineId);
+        
+
+        if (dic.containsKey(wt.getWindpowerstationId()) && dic.get(wt.getWindpowerstationId()).containsKey(Contant.SSZGL)) {
+
+            Map<String, StatusItemVo> tempmap=dic.get(wt.getWindpowerstationId());
+            Double tempvalue= tempmap.get(Contant.SSZGL).getEdnaValue();
+            tempvalue++;
+            tempmap.get(Contant.SSZGL).setEdnaValue(tempvalue);
+
+
+        }
+        if (dic.containsKey(wt.getLineId()) && dic.get(wt.getLineId()).containsKey(Contant.SSZGL)) {
+
+            Map<String, StatusItemVo> tempmap=dic.get(wt.getLineId());
+            Double tempvalue= tempmap.get(Contant.SSZGL).getEdnaValue();
+            tempvalue++;
+            tempmap.get(Contant.SSZGL).setEdnaValue(tempvalue);
+
+
+        }
+        if (dic.containsKey(wt.getProjectId()) && dic.get(wt.getProjectId()).containsKey(Contant.SSZGL)) {
+
+            Map<String, StatusItemVo> tempmap=dic.get(wt.getProjectId());
+            Double tempvalue= tempmap.get(Contant.SSZGL).getEdnaValue();
+            tempvalue++;
+            tempmap.get(Contant.SSZGL).setEdnaValue(tempvalue);
+
+
+        }
+        if (dic.containsKey("0") && dic.get("0").containsKey(Contant.SSZGL)) {
+
+            Map<String, StatusItemVo> tempmap=dic.get("0");
+            Double tempvalue= tempmap.get(Contant.SSZGL).getEdnaValue();
+            tempvalue++;
+            tempmap.get(Contant.SSZGL).setEdnaValue(tempvalue);
+
+
+        }
+        if (wt.getWindpowerstationId().indexOf("FDC")>=0) {
+            if (dic.containsKey("-1") && dic.get("-1").containsKey(Contant.SSZGL)) {
+
+                Map<String, StatusItemVo> tempmap=dic.get("-1");
+                Double tempvalue= tempmap.get(Contant.SSZGL).getEdnaValue();
+                tempvalue++;
+                tempmap.get(Contant.SSZGL).setEdnaValue(tempvalue);
+
+            }
+        } else {
+            if (dic.containsKey("-2") && dic.get("-2").containsKey(Contant.SSZGL)) {
+
+                Map<String, StatusItemVo> tempmap=dic.get("-2");
+                Double tempvalue= tempmap.get(Contant.SSZGL).getEdnaValue();
+                tempvalue++;
+                tempmap.get(Contant.SSZGL).setEdnaValue(tempvalue);
+
+            }
+        }
+
+    }
+
+}

+ 133 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/util/statisticcs/StatusStatistics.java

@@ -0,0 +1,133 @@
+package com.gyee.generation.util.statisticcs;
+
+import com.gyee.common.contant.Contant;
+import com.gyee.common.model.PointData;
+import com.gyee.generation.model.auto.ProBasicWindturbine;
+import com.gyee.generation.model.auto.ProBasicWppoint;
+import com.gyee.generation.model.vo.StatusItemVo;
+
+import java.util.*;
+
+public abstract class StatusStatistics {
+    private static Map<Integer, String> statusToUniformCode = new HashMap<Integer, String>();
+
+    static  {
+        statusToUniformCode.put(0, Contant.DJTS);
+        statusToUniformCode.put(1, Contant.YXTS);
+        statusToUniformCode.put(2, Contant.GZTJ);
+        statusToUniformCode.put(3, Contant.TXZD);
+        statusToUniformCode.put(4, Contant.WHTJ);
+
+         //   #region 新增限电台数
+        statusToUniformCode.put(5, Contant.XDTS);
+        statusToUniformCode.put(6, Contant.XDTS);
+
+    }
+
+    protected Map<String, Map<String, StatusItemVo>> dic = new HashMap<String, Map<String, StatusItemVo>>();
+    protected Map<String, ProBasicWindturbine> windTurbines;
+    protected Date date;
+
+    public StatusStatistics(Map<String, ProBasicWindturbine> windTurbines, Date date) {
+        this.windTurbines = windTurbines;
+        this.date = date;
+    }
+
+    public void addInitData(ProBasicWppoint wpstp) {
+        Map<String, StatusItemVo> items = null;
+        if (dic.containsKey(wpstp.getWindpowerstationId())) {
+            items = dic.get(wpstp.getWindpowerstationId());
+        } else {
+            items = new HashMap<String, StatusItemVo>();
+            dic.put(wpstp.getWindpowerstationId(), items);
+        }
+            //#region EDNA转EDOS
+        //StatusItemVo item = new StatusItemVo { UniformCode = wpstp.UNIFORMCODE, EdnaPoint = wpstp.SHORTID, EdnaValue = 0, size = 0 };
+        StatusItemVo item = new StatusItemVo();
+        item.setUniformCode(wpstp.getUniformCode());
+        item.setEdnaValue(0.0);
+        item.setEdnaPoint(wpstp.getCode());
+        item.setCount(0.0);
+
+
+        items.put(item.getUniformCode(), item);
+    }
+
+    public   void addPointValue(String windTurbineId, Double value) {
+        ProBasicWindturbine wt = windTurbines.get(windTurbineId);
+
+        if (!statusToUniformCode.containsKey(value.intValue())){
+            return;
+        }
+
+
+        if (dic.containsKey(wt.getWindpowerstationId()) && dic.get(wt.getWindpowerstationId()).containsKey(statusToUniformCode.get(value.intValue()))) {
+
+            Map<String, StatusItemVo> tempmap=dic.get(wt.getWindpowerstationId());
+            Double tempvalue= tempmap.get(statusToUniformCode.get(value.intValue())).getEdnaValue();
+            tempvalue++;
+            tempmap.get(statusToUniformCode.get(value.intValue())).setEdnaValue(tempvalue);
+
+        }
+        if (dic.containsKey(wt.getLineId()) && dic.get(wt.getLineId()).containsKey(statusToUniformCode.get(value.intValue()))) {
+
+            Map<String, StatusItemVo> tempmap=dic.get(wt.getLineId());
+            Double tempvalue= tempmap.get(statusToUniformCode.get(value.intValue())).getEdnaValue();
+            tempvalue++;
+            tempmap.get(statusToUniformCode.get(value.intValue())).setEdnaValue(tempvalue);
+
+        }
+        if (dic.containsKey(wt.getProjectId()) && dic.get(wt.getProjectId()).containsKey(statusToUniformCode.get(value.intValue()))) {
+
+            Map<String, StatusItemVo> tempmap=dic.get(wt.getProjectId());
+            Double tempvalue= tempmap.get(statusToUniformCode.get(value.intValue())).getEdnaValue();
+            tempvalue++;
+            tempmap.get(statusToUniformCode.get(value.intValue())).setEdnaValue(tempvalue);
+
+        }
+        if (dic.containsKey("0") && dic.get("0").containsKey(statusToUniformCode.get(value.intValue()))) {
+
+            Map<String, StatusItemVo> tempmap=dic.get("0");
+            Double tempvalue= tempmap.get(statusToUniformCode.get(value.intValue())).getEdnaValue();
+            tempvalue++;
+            tempmap.get(statusToUniformCode.get(value.intValue())).setEdnaValue(tempvalue);
+
+        }
+        if (wt.getWindpowerstationId().indexOf("FDC")>=0) {
+            if (dic.containsKey("-1") && dic.get("-1").containsKey(statusToUniformCode.get(value.intValue()))) {
+
+                Map<String, StatusItemVo> tempmap=dic.get("-1");
+                Double tempvalue= tempmap.get(statusToUniformCode.get(value.intValue())).getEdnaValue();
+                tempvalue++;
+                tempmap.get(statusToUniformCode.get(value.intValue())).setEdnaValue(tempvalue);
+            }
+        } else {
+            if (dic.containsKey("-2") && dic.get("-2").containsKey(statusToUniformCode.get(value.intValue()))) {
+
+                Map<String, StatusItemVo> tempmap=dic.get("-2");
+                Double tempvalue= tempmap.get(statusToUniformCode.get(value.intValue())).getEdnaValue();
+                tempvalue++;
+                tempmap.get(statusToUniformCode.get(value.intValue())).setEdnaValue(tempvalue);
+            }
+        }
+
+
+    }
+
+    public  List<PointData> getRealParameter() {
+        java.util.List<PointData> retValue = new ArrayList<PointData>();
+        for (String mkey : dic.keySet()) {
+            for (String skey : dic.get(mkey).keySet()) {
+                StatusItemVo item =dic.get(mkey).get(skey);
+                PointData p = new PointData();
+                p.setPointValueInDouble(item.getEdnaValue());
+                p.setEdnaId(item.getEdnaPoint());
+                p.setPointTime(date.getTime()/1000);
+                retValue.add(p);
+            }
+        }
+        return retValue;
+    }
+
+    public abstract void addPointValue(String windTurbineId, double value);
+}

+ 171 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/util/statisticcs/TheoryPowerStatistics.java

@@ -0,0 +1,171 @@
+package com.gyee.generation.util.statisticcs;
+
+import com.gyee.common.contant.Contant;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
+import com.gyee.generation.model.auto.ProBasicWindturbine;
+import com.gyee.generation.model.vo.StatusItemVo;
+
+import java.util.*;
+
+public class TheoryPowerStatistics extends  StatusStatistics{
+
+    public TheoryPowerStatistics(Map<String, ProBasicWindturbine> windTurbines, Date date)
+    {
+            super(windTurbines, date);
+    }
+
+    protected Map<String, Map<String, StatusItemVo>> dicWindturbine = new HashMap<String, Map<String, StatusItemVo>>();
+    public  void addPointValue(String windTurbineId, double value, String powerKey)
+    {
+        ProBasicWindturbine wt = windTurbines.get(windTurbineId);
+        
+
+        if (dic.containsKey(wt.getWindpowerstationId()) && dic.get(wt.getWindpowerstationId()).containsKey(Contant.SSZGL)) {
+
+            Map<String, StatusItemVo> tempmap=dic.get(wt.getWindpowerstationId());
+            Double tempvalue= tempmap.get(Contant.SSZGL).getEdnaValue();
+            tempvalue++;
+            tempmap.get(Contant.SSZGL).setEdnaValue(tempvalue);
+
+
+        }
+        if (dic.containsKey(wt.getLineId()) && dic.get(wt.getLineId()).containsKey(Contant.SSZGL)) {
+
+            Map<String, StatusItemVo> tempmap=dic.get(wt.getLineId());
+            Double tempvalue= tempmap.get(Contant.SSZGL).getEdnaValue();
+            tempvalue++;
+            tempmap.get(Contant.SSZGL).setEdnaValue(tempvalue);
+
+
+        }
+        if (dic.containsKey(wt.getProjectId()) && dic.get(wt.getProjectId()).containsKey(Contant.SSZGL)) {
+
+            Map<String, StatusItemVo> tempmap=dic.get(wt.getProjectId());
+            Double tempvalue= tempmap.get(Contant.SSZGL).getEdnaValue();
+            tempvalue++;
+            tempmap.get(Contant.SSZGL).setEdnaValue(tempvalue);
+
+
+        }
+        if (dic.containsKey("0") && dic.get("0").containsKey(Contant.SSZGL)) {
+
+            Map<String, StatusItemVo> tempmap=dic.get("0");
+            Double tempvalue= tempmap.get(Contant.SSZGL).getEdnaValue();
+            tempvalue++;
+            tempmap.get(Contant.SSZGL).setEdnaValue(tempvalue);
+
+
+        }
+        if (wt.getWindpowerstationId().indexOf("FDC")>=0) {
+            if (dic.containsKey("-1") && dic.get("-1").containsKey(Contant.SSZGL)) {
+
+                Map<String, StatusItemVo> tempmap=dic.get("-1");
+                Double tempvalue= tempmap.get(Contant.SSZGL).getEdnaValue();
+                tempvalue++;
+                tempmap.get(Contant.SSZGL).setEdnaValue(tempvalue);
+
+            }
+        } else {
+            if (dic.containsKey("-2") && dic.get("-2").containsKey(Contant.SSZGL)) {
+
+                Map<String, StatusItemVo> tempmap=dic.get("-2");
+                Double tempvalue= tempmap.get(Contant.SSZGL).getEdnaValue();
+                tempvalue++;
+                tempmap.get(Contant.SSZGL).setEdnaValue(tempvalue);
+
+            }
+        }
+
+    }
+
+
+    public  void addInitWindTrubineData(ProBasicEquipmentPoint ais)
+    {
+        Map<String, StatusItemVo> items = null;
+        if (dicWindturbine.containsKey(ais.getWindturbineId()))
+        {
+            items = dicWindturbine.get(ais.getWindturbineId());
+        }
+        else
+        {
+            items = new HashMap<String, StatusItemVo>();
+            dicWindturbine.put(ais.getWindturbineId(), items);
+        }
+        
+        StatusItemVo item = new StatusItemVo();
+        item.setUniformCode(ais.getUniformCode());
+        item.setEdnaValue(0.0);
+        item.setEdnaPoint(ais.getCode());
+        item.setCount(0.0);
+
+
+        items.put(item.getUniformCode(), item);
+    }
+    public void addWindturbinePointValue(String windTurbineId, double value, String powerKey)
+    {
+        if (dicWindturbine.containsKey(windTurbineId))
+        {
+            dicWindturbine.get(windTurbineId).get(powerKey).setEdnaValue(value);
+        }
+    }
+    @Override
+    public List<PointData> getRealParameter()
+    {
+        java.util.List<PointData> retValue = new ArrayList<PointData>();
+        for (String mkey : dic.keySet())
+        {
+            for (String skey : dic.get(mkey).keySet())
+            {
+                StatusItemVo item = dic.get(mkey).get(skey);
+
+                if (item.getCount() != 0)
+                {
+                    PointData p = new PointData();
+
+                    p.setPointValueInDouble(item.getEdnaValue());
+                    p.setEdnaId(item.getEdnaPoint());
+                    p.setPointTime(date.getTime()/1000);
+                    retValue.add(p);
+                }
+            }
+        }
+
+
+        for (String mkey : dic.keySet())
+
+        {
+            for (String skey : dic.get(mkey).keySet())
+            {
+                StatusItemVo item = dic.get(mkey).get(skey);
+                PointData p = new PointData();
+
+                p.setPointValueInDouble(item.getEdnaValue());
+                p.setEdnaId(item.getEdnaPoint());
+                p.setPointTime(date.getTime()/1000);
+                retValue.add(p);
+            }
+        }
+        for (String mkey : dicWindturbine.keySet())
+        {
+            for (String skey : dicWindturbine.get(mkey).keySet())
+            {
+                StatusItemVo item = dicWindturbine.get(mkey).get(skey);
+                PointData p = new PointData();
+
+                p.setPointValueInDouble(item.getEdnaValue());
+                p.setEdnaId(item.getEdnaPoint());
+                p.setPointTime(date.getTime()/1000);
+                retValue.add(p);
+            }
+        }
+        return retValue;
+    }
+
+    @Override
+    public void addPointValue(String windTurbineId, double value) {
+
+    }
+
+}

+ 119 - 0
realtime/generationXK-service/src/main/java/com/gyee/generation/util/statisticcs/WindSpeedStatistics.java

@@ -0,0 +1,119 @@
+package com.gyee.generation.util.statisticcs;
+
+import com.gyee.common.contant.Contant;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.generation.model.auto.ProBasicWindturbine;
+import com.gyee.generation.model.vo.StatusItemVo;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Map;
+import java.util.List;
+
+public class WindSpeedStatistics extends  StatusStatistics{
+
+    public WindSpeedStatistics(Map<String, ProBasicWindturbine> windTurbines, Date date)
+    {
+            super(windTurbines, date);
+    }
+    
+    @Override
+    public  void addPointValue(String windTurbineId, double value)
+    {
+        ProBasicWindturbine wt = windTurbines.get(windTurbineId);
+
+
+        if (dic.containsKey(wt.getWindpowerstationId()) && dic.get(wt.getWindpowerstationId()).containsKey(Contant.SSFS)) {
+
+            Map<String, StatusItemVo> tempmap=dic.get(wt.getWindpowerstationId());
+            Double tempvalue= tempmap.get(Contant.SSFS).getEdnaValue();
+            tempvalue++;
+            tempmap.get(Contant.SSFS).setEdnaValue(tempvalue);
+            Double tempcount= tempmap.get(Contant.SSFS).getCount();
+            tempcount++;
+            tempmap.get(Contant.SSFS).setCount(tempcount);
+
+        }
+        if (dic.containsKey(wt.getLineId()) && dic.get(wt.getLineId()).containsKey(Contant.SSFS)) {
+
+            Map<String, StatusItemVo> tempmap=dic.get(wt.getLineId());
+            Double tempvalue= tempmap.get(Contant.SSFS).getEdnaValue();
+            tempvalue++;
+            tempmap.get(Contant.SSFS).setEdnaValue(tempvalue);
+            Double tempcount= tempmap.get(Contant.SSFS).getCount();
+            tempcount++;
+            tempmap.get(Contant.SSFS).setCount(tempcount);
+
+        }
+        if (dic.containsKey(wt.getProjectId()) && dic.get(wt.getProjectId()).containsKey(Contant.SSFS)) {
+
+            Map<String, StatusItemVo> tempmap=dic.get(wt.getProjectId());
+            Double tempvalue= tempmap.get(Contant.SSFS).getEdnaValue();
+            tempvalue++;
+            tempmap.get(Contant.SSFS).setEdnaValue(tempvalue);
+            Double tempcount= tempmap.get(Contant.SSFS).getCount();
+            tempcount++;
+            tempmap.get(Contant.SSFS).setCount(tempcount);
+
+        }
+        if (dic.containsKey("0") && dic.get("0").containsKey(Contant.SSFS)) {
+
+            Map<String, StatusItemVo> tempmap=dic.get("0");
+            Double tempvalue= tempmap.get(Contant.SSFS).getEdnaValue();
+            tempvalue++;
+            tempmap.get(Contant.SSFS).setEdnaValue(tempvalue);
+            Double tempcount= tempmap.get(Contant.SSFS).getCount();
+            tempcount++;
+            tempmap.get(Contant.SSFS).setCount(tempcount);
+
+        }
+        if (wt.getWindpowerstationId().indexOf("FDC")>=0) {
+            if (dic.containsKey("-1") && dic.get("-1").containsKey(Contant.SSFS)) {
+
+                Map<String, StatusItemVo> tempmap=dic.get("-1");
+                Double tempvalue= tempmap.get(Contant.SSFS).getEdnaValue();
+                tempvalue++;
+                tempmap.get(Contant.SSFS).setEdnaValue(tempvalue);
+                Double tempcount= tempmap.get(Contant.SSFS).getCount();
+                tempcount++;
+                tempmap.get(Contant.SSFS).setCount(tempcount);
+            }
+        } else {
+            if (dic.containsKey("-2") && dic.get("-2").containsKey(Contant.SSFS)) {
+
+                Map<String, StatusItemVo> tempmap=dic.get("-2");
+                Double tempvalue= tempmap.get(Contant.SSFS).getEdnaValue();
+                tempvalue++;
+                tempmap.get(Contant.SSFS).setEdnaValue(tempvalue);
+                Double tempcount= tempmap.get(Contant.SSFS).getCount();
+                tempcount++;
+                tempmap.get(Contant.SSFS).setCount(tempcount);
+            }
+        }
+
+    }
+    @Override
+    public  List<PointData> getRealParameter()
+    {
+        java.util.List<PointData> retValue = new ArrayList<PointData>();
+        for (String mkey : dic.keySet())
+        {
+            for (String skey : dic.get(mkey).keySet())
+            {
+                StatusItemVo item = dic.get(mkey).get(skey);
+
+                if (item.getCount() != 0)
+                {
+                    PointData p = new PointData();
+
+                    p.setPointValueInDouble(StringUtils.round(item.getEdnaValue() / item.getCount(),2));
+                    p.setEdnaId(item.getEdnaPoint());
+                    p.setPointTime(date.getTime()/1000);
+                    retValue.add(p);
+                }
+            }
+        }
+        return retValue;
+    }
+}

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

@@ -103,7 +103,8 @@ curvefitting:
   dimension: 20
   #尺度
   scale: 0.01
-
+shutdown:
+  keystr: test1,test2