xieshengjie 2 éve
szülő
commit
59d58f615d
23 módosított fájl, 720 hozzáadás és 14 törlés
  1. 10 10
      web/gdsx-ghost/src/main/java/com/gyee/ghost/config/GeneratorCodeConfig.java
  2. 20 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/controller/ProEconStationStatusmxController.java
  3. 20 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/controller/ProEconStatusmxController.java
  4. 20 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/controller/ProEconWindturbineStatus2Controller.java
  5. 23 2
      web/gdsx-ghost/src/main/java/com/gyee/ghost/init/CacheContext.java
  6. 16 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/mapper/auto/ProEconStationStatusmxMapper.java
  7. 16 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/mapper/auto/ProEconStatusmxMapper.java
  8. 16 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/mapper/auto/ProEconWindturbineStatus2Mapper.java
  9. 62 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/model/auto/ProEconStationStatusmx.java
  10. 26 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/model/auto/ProEconStatusmx.java
  11. 63 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/model/auto/ProEconWindturbineStatus2.java
  12. 266 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/service/RealtimeService.java
  13. 16 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/IProEconStationStatusmxService.java
  14. 16 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/IProEconStatusmxService.java
  15. 16 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/IProEconWindturbineStatus2Service.java
  16. 20 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/impl/ProEconStationStatusmxServiceImpl.java
  17. 20 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/impl/ProEconStatusmxServiceImpl.java
  18. 20 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/impl/ProEconWindturbineStatus2ServiceImpl.java
  19. 26 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/task/SaticScheduleTask.java
  20. 17 0
      web/gdsx-ghost/src/main/java/com/gyee/ghost/util/realtimesource/EdosUtil.java
  21. 8 1
      web/gdsx-ghost/src/main/java/com/gyee/ghost/util/realtimesource/IEdosUtil.java
  22. 1 0
      web/gdsx-ghost/src/main/resources/application-dev.yml
  23. 2 1
      web/gdsx-ghost/src/test/java/com/gyee/ghost/GhostTest.java

+ 10 - 10
web/gdsx-ghost/src/main/java/com/gyee/ghost/config/GeneratorCodeConfig.java

@@ -48,11 +48,11 @@ public class GeneratorCodeConfig {
 
         // 数据源配置
         DataSourceConfig dsc = new DataSourceConfig();
-//        dsc.setUrl("jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true");
-//        dsc.setDriverName("com.mysql.jdbc.Driver");
-//        dsc.setUsername("root");
-//        dsc.setPassword("root");
-//        mpg.setDataSource(dsc);
+        dsc.setUrl("jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true");
+        dsc.setDriverName("com.mysql.jdbc.Driver");
+        dsc.setUsername("root");
+        dsc.setPassword("root");
+        mpg.setDataSource(dsc);
 
 //        dsc.setDriverName("oracle.jdbc.driver.OracleDriver");
 //        dsc.setUsername("gdprod");
@@ -60,11 +60,11 @@ public class GeneratorCodeConfig {
 //        dsc.setUrl("jdbc:oracle:thin:@10.83.68.165:1521:gdsj");
 //        mpg.setDataSource(dsc);
 
-        dsc.setDriverName("org.postgresql.Driver");
-        dsc.setUsername("gdprod");
-        dsc.setPassword("gd123");
-        dsc.setUrl("jdbc:postgresql://10.81.3.151:5432/wisdom");
-        mpg.setDataSource(dsc);
+//        dsc.setDriverName("org.postgresql.Driver");
+//        dsc.setUsername("gdprod");
+//        dsc.setPassword("gd123");
+//        dsc.setUrl("jdbc:postgresql://10.81.3.151:5432/wisdom");
+//        mpg.setDataSource(dsc);
 
 
 

+ 20 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/controller/ProEconStationStatusmxController.java

@@ -0,0 +1,20 @@
+package com.gyee.ghost.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+@RestController
+@RequestMapping("//pro-econ-station-statusmx")
+public class ProEconStationStatusmxController {
+
+}

+ 20 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/controller/ProEconStatusmxController.java

@@ -0,0 +1,20 @@
+package com.gyee.ghost.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+@RestController
+@RequestMapping("//pro-econ-statusmx")
+public class ProEconStatusmxController {
+
+}

+ 20 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/controller/ProEconWindturbineStatus2Controller.java

@@ -0,0 +1,20 @@
+package com.gyee.ghost.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+@RestController
+@RequestMapping("//pro-econ-windturbine-status2")
+public class ProEconWindturbineStatus2Controller {
+
+}

+ 23 - 2
web/gdsx-ghost/src/main/java/com/gyee/ghost/init/CacheContext.java

@@ -3,7 +3,9 @@ package com.gyee.ghost.init;
 
 
 import com.gyee.common.model.StringUtils;
+import com.gyee.common.util.DateUtils;
 import com.gyee.ghost.model.auto.*;
+import com.gyee.ghost.service.RealtimeService;
 import com.gyee.ghost.service.auto.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -27,7 +29,8 @@ import java.util.Map;
 public class CacheContext implements CommandLineRunner {
 
 
-
+    @Resource
+    private RealtimeService realtimeService;
     @Resource
     private IWindturbineService windturbineService;
     @Resource
@@ -42,6 +45,8 @@ public class CacheContext implements CommandLineRunner {
     private IFreedomService freedomService;
     @Resource
     private IEquipmentmodelService equipmentmodelService;
+    @Resource
+    private IProEconStatusmxService proEconStatusmxService;
 
     public static List<Windturbine> wtls = new ArrayList<>();
     public static Map<String,Windturbine> wtmap = new HashMap<>();
@@ -51,7 +56,9 @@ public class CacheContext implements CommandLineRunner {
     public static Map<String,String> stopmap = new HashMap<>();
 
     public static Map<String,Map<String, Windturbinetestingpointai>> wtpAimap = new HashMap();
-    public static Map<String,Double> wtcap = new HashMap();
+    public static Map<String,Double> wtcap = new HashMap<>();
+
+    public static Map<Integer,String> statusmxMap = new HashMap<>();
 
 //    public static Map<String,String> freedomMap = new HashMap<>();
 
@@ -99,9 +106,23 @@ public class CacheContext implements CommandLineRunner {
             promap.put(project.getId(),project);
         });
 
+        List<ProEconStatusmx> statusmxList = proEconStatusmxService.list();
+        statusmxList.stream().forEach(mx->{
+            statusmxMap.put(mx.getId(),mx.getName());
+        });
+
 //        List<Freedom> freedoms = freedomService.list();
 //        freedoms.stream().forEach(f->{
 //            freedomMap.put(f.getId(),f.getName());
 //        });
+
+
+        String yesterday = DateUtils.getYesterdayStr("yyyy-MM-dd");
+        try {
+//            realtimeService.saveWindturbineStatus2();
+            realtimeService.saveWindstationStatus(yesterday,yesterday);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 }

+ 16 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/mapper/auto/ProEconStationStatusmxMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.ghost.mapper.auto;
+
+import com.gyee.ghost.model.auto.ProEconStationStatusmx;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+public interface ProEconStationStatusmxMapper extends BaseMapper<ProEconStationStatusmx> {
+
+}

+ 16 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/mapper/auto/ProEconStatusmxMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.ghost.mapper.auto;
+
+import com.gyee.ghost.model.auto.ProEconStatusmx;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+public interface ProEconStatusmxMapper extends BaseMapper<ProEconStatusmx> {
+
+}

+ 16 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/mapper/auto/ProEconWindturbineStatus2Mapper.java

@@ -0,0 +1,16 @@
+package com.gyee.ghost.mapper.auto;
+
+import com.gyee.ghost.model.auto.ProEconWindturbineStatus2;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+public interface ProEconWindturbineStatus2Mapper extends BaseMapper<ProEconWindturbineStatus2> {
+
+}

+ 62 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/model/auto/ProEconStationStatusmx.java

@@ -0,0 +1,62 @@
+package com.gyee.ghost.model.auto;
+
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.time.LocalDate;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProEconStationStatusmx extends Model {
+
+    private static final long serialVersionUID = 1L;
+    @TableId(value = "ID",type = IdType.INPUT)
+    private String id;
+
+    @TableField("windPowerStation_Id")
+    private String windpowerstationId;
+
+    @TableField("windTurbine_Id")
+    private String windturbineId;
+
+    @TableField("recorddate")
+    private Date recorddate;
+
+
+
+    @TableField("stop_Hours")
+    private Double stopHours;
+
+    @TableField("loss_Power")
+    private Double lossPower;
+
+
+
+    @TableField("project_Id")
+    private String projectId;
+
+    @TableField("satus_Code")
+    private Integer satusCode;
+
+    @TableField("status_Desc")
+    private String statusDesc;
+    @TableField("avg_speed")
+    private Double avgSpeed;
+
+
+}

+ 26 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/model/auto/ProEconStatusmx.java

@@ -0,0 +1,26 @@
+package com.gyee.ghost.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProEconStatusmx extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    private Integer id;
+
+    private String name;
+
+
+}

+ 63 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/model/auto/ProEconWindturbineStatus2.java

@@ -0,0 +1,63 @@
+package com.gyee.ghost.model.auto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProEconWindturbineStatus2 extends Model {
+
+    private static final long serialVersionUID = 1L;
+    @TableId(value = "ID",type = IdType.INPUT)
+    private String id;
+
+    @TableField("windPowerStation_Id")
+    private String windpowerstationId;
+
+    @TableField("windTurbine_Id")
+    private String windturbineId;
+
+    @TableField("stop_Time")
+    private Date stopTime;
+
+    @TableField("start_Time")
+    private Date startTime;
+
+    @TableField("stop_Hours")
+    private Double stopHours;
+
+    @TableField("loss_Power")
+    private Double lossPower;
+
+    @TableField("shutdown_Event_Id")
+    private String shutdownEventId;
+
+    @TableField("project_Id")
+    private String projectId;
+
+    @TableField("satus_Code")
+    private Integer satusCode;
+
+    @TableField("status_Desc")
+    private String statusDesc;
+
+    private Double speed;
+
+    private Double avgSpeed;
+
+
+}

+ 266 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/service/RealtimeService.java

@@ -0,0 +1,266 @@
+package com.gyee.ghost.service;/*
+@author   谢生杰
+@date   2022/10/25-10:33
+*/
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.gyee.common.contant.Contant;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.common.util.CommonUtils;
+import com.gyee.common.util.DateUtils;
+import com.gyee.common.util.DoubleUtils;
+import com.gyee.ghost.init.CacheContext;
+import com.gyee.ghost.model.auto.ProEconStationStatusmx;
+import com.gyee.ghost.model.auto.ProEconWindturbineStatus2;
+import com.gyee.ghost.model.auto.Windturbine;
+import com.gyee.ghost.model.auto.Windturbinetestingpointai;
+import com.gyee.ghost.service.auto.IProEconStationStatusmxService;
+import com.gyee.ghost.service.auto.IProEconStatusmxService;
+import com.gyee.ghost.service.auto.IProEconWindturbineStatus2Service;
+import com.gyee.ghost.util.realtimesource.IEdosUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.ibatis.annotations.Update;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+@Slf4j
+public class RealtimeService {
+
+    @Resource
+    private IProEconWindturbineStatus2Service proEconWindturbineStatus2Service;
+    @Resource
+    private IProEconStationStatusmxService proEconStationStatusmxService;
+    @Resource
+    private IEdosUtil edosUtil;
+
+    public void saveWindturbineStatus2() {
+
+        List<ProEconWindturbineStatus2> resultList = new ArrayList<>();
+
+        List<Windturbine> wtls = CacheContext.wtls;
+        Map<Integer, String> statusmxMap = CacheContext.statusmxMap;
+
+        Map<String, Map<String, Windturbinetestingpointai>> wtpAimap = CacheContext.wtpAimap;
+
+        Date samedayZero = DateUtils.getSamedayZero();
+        Date currentDate = DateUtils.getCurrentDate();
+//        Date befroeDate = DateUtils.addSeconds(currentDate, -1);
+        Date befroeDate = DateUtils.addMinutes(currentDate,-5);
+
+        wtls.stream().forEach(wt->{
+
+            Map<String, Windturbinetestingpointai> stringWindturbinetestingpointaiMap = wtpAimap.get(wt.getId());
+            Windturbinetestingpointai windturbinetestingpointai = stringWindturbinetestingpointaiMap.get(Contant.ZTMX);
+            Windturbinetestingpointai windturbinetestingpointaifs = stringWindturbinetestingpointaiMap.get(Contant.AI022);
+            try {
+                PointData realData = edosUtil.getRealData(windturbinetestingpointai);
+
+                double aDouble = realData.getPointValueInDouble();
+
+                PointData sectionData = edosUtil.getSectionData(windturbinetestingpointai, befroeDate.getTime());
+                double tempDouble = sectionData.getPointValueInDouble();
+                double speed = edosUtil.getRealData(windturbinetestingpointaifs).getPointValueInDouble();
+                if (aDouble != tempDouble){
+                    ProEconWindturbineStatus2 proEconWindturbineStatus2 = new ProEconWindturbineStatus2();
+                    proEconWindturbineStatus2.setId(CommonUtils.getUUID());
+                    proEconWindturbineStatus2.setWindpowerstationId(wt.getWindpowerstationid());
+                    proEconWindturbineStatus2.setWindturbineId(wt.getId());
+                    proEconWindturbineStatus2.setStopTime(DateUtils.parseLongToDate(realData.getPointTime()*1000));
+                    proEconWindturbineStatus2.setStartTime(DateUtils.parseLongToDate(realData.getPointTime()*1000));
+                    proEconWindturbineStatus2.setStopHours(DateUtils.hoursDiff2(proEconWindturbineStatus2.getStopTime(), proEconWindturbineStatus2.getStartTime()));
+                    proEconWindturbineStatus2.setLossPower(0.0);
+                    proEconWindturbineStatus2.setShutdownEventId("");
+                    proEconWindturbineStatus2.setProjectId(wt.getProjectid());
+                    proEconWindturbineStatus2.setSatusCode(new Double(aDouble).intValue());
+                    proEconWindturbineStatus2.setSpeed(speed);
+                    proEconWindturbineStatus2.setAvgSpeed(0.0);
+                    String statusName = statusmxMap.get(new Double(aDouble).intValue());
+                    proEconWindturbineStatus2.setStatusDesc(statusName);
+                    resultList.add(proEconWindturbineStatus2);
+
+                    QueryWrapper<ProEconWindturbineStatus2> qw = new QueryWrapper<>();
+                    qw.eq("windTurbine_Id",wt.getId());
+                    qw.orderByDesc("start_Time");
+                    ProEconWindturbineStatus2 proEconWindturbineStatus21 = proEconWindturbineStatus2Service.getBaseMapper().selectOne(qw);
+                    if (StringUtils.isNotNull(proEconWindturbineStatus21)){
+                        proEconWindturbineStatus21.setStopTime(DateUtils.parseLongToDate(realData.getPointTime()*1000));
+                        proEconWindturbineStatus21.setLossPower(0.0);
+                        proEconWindturbineStatus21.setSpeed(speed);
+                        proEconWindturbineStatus21.setAvgSpeed(0.0);
+                        resultList.add(proEconWindturbineStatus21);
+                    }
+
+                }else {
+                    QueryWrapper<ProEconWindturbineStatus2> qw = new QueryWrapper<>();
+                    qw.eq("windTurbine_Id",wt.getId());
+                    qw.orderByDesc("start_Time");
+                    ProEconWindturbineStatus2 proEconWindturbineStatus21 = proEconWindturbineStatus2Service.getBaseMapper().selectOne(qw);
+                    if (StringUtils.isNotNull(proEconWindturbineStatus21)){
+                        proEconWindturbineStatus21.setStopTime(DateUtils.parseLongToDate(realData.getPointTime()*1000));
+                        proEconWindturbineStatus21.setStopHours(DateUtils.hoursDiff2(proEconWindturbineStatus21.getStopTime(), proEconWindturbineStatus21.getStartTime()));
+                        proEconWindturbineStatus21.setLossPower(0.0);
+                        proEconWindturbineStatus21.setSpeed(speed);
+                        proEconWindturbineStatus21.setAvgSpeed(0.0);
+                        resultList.add(proEconWindturbineStatus21);
+                    }else{
+                        ProEconWindturbineStatus2 proEconWindturbineStatus2 = new ProEconWindturbineStatus2();
+                        proEconWindturbineStatus2.setId(CommonUtils.getUUID());
+                        proEconWindturbineStatus2.setWindpowerstationId(wt.getWindpowerstationid());
+                        proEconWindturbineStatus2.setWindturbineId(wt.getId());
+                        proEconWindturbineStatus2.setStopTime(DateUtils.parseLongToDate(realData.getPointTime()*1000));
+                        proEconWindturbineStatus2.setStartTime(DateUtils.parseLongToDate(realData.getPointTime()*1000));
+                        proEconWindturbineStatus2.setStopHours(DateUtils.hoursDiff2(proEconWindturbineStatus2.getStopTime(), proEconWindturbineStatus2.getStartTime()));
+                        proEconWindturbineStatus2.setLossPower(0.0);
+                        proEconWindturbineStatus2.setShutdownEventId("");
+                        proEconWindturbineStatus2.setProjectId(wt.getProjectid());
+                        proEconWindturbineStatus2.setSatusCode(new Double(aDouble).intValue());
+                        proEconWindturbineStatus2.setSpeed(speed);
+                        proEconWindturbineStatus2.setAvgSpeed(0.0);
+                        String statusName = statusmxMap.get(new Double(aDouble).intValue());
+                        proEconWindturbineStatus2.setStatusDesc(statusName);
+                        resultList.add(proEconWindturbineStatus2);
+                    }
+
+                }
+
+
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+        });
+
+        proEconWindturbineStatus2Service.saveOrUpdateBatch(resultList);
+
+    }
+
+    public void saveWindstationStatus(String beginDate,String endDate) {
+        List<ProEconStationStatusmx> resultList = new ArrayList<>();
+        List<String> days = DateUtils.getDays(beginDate, endDate);
+        List<Windturbine> wtls = CacheContext.wtls;
+        Map<Integer, String> statusmxMap = CacheContext.statusmxMap;
+        Set<Integer> status = statusmxMap.keySet();
+
+        Map<String, Map<String, Windturbinetestingpointai>> wtpAimap = CacheContext.wtpAimap;
+
+        Date samedayZero = DateUtils.getSamedayZero();
+        Date currentDate = DateUtils.getCurrentDate();
+//        Date befroeDate = DateUtils.addSeconds(currentDate,-1);
+//        Date befroeDate = DateUtils.addMinutes(currentDate,-5);
+        days.forEach(day->{
+            Date date = DateUtils.parseDate(day);
+            Date addday = DateUtils.addMinutes(date, 1);
+            wtls.stream().forEach(wt->{
+                Map<String, Windturbinetestingpointai> stringWindturbinetestingpointaiMap = wtpAimap.get(wt.getId());
+                Windturbinetestingpointai windturbinetestingpointai = stringWindturbinetestingpointaiMap.get(Contant.ZTMX);
+                Windturbinetestingpointai windturbinetestingpointaifs = stringWindturbinetestingpointaiMap.get(Contant.AI022);
+                try {
+                    List<PointData> historyDatasSnap = edosUtil.getHistoryDatasSnap(windturbinetestingpointai, date.getTime() / 1000, addday.getTime() / 1000, null, 60l);
+                    status.stream().forEach(sta->{
+                        int minutes = historyDatasSnap.stream().filter(i -> i.getPointValueInDouble() == sta).collect(Collectors.toList()).size();
+                        ProEconStationStatusmx proEconStationStatusmx = new ProEconStationStatusmx();
+                        proEconStationStatusmx.setId(CommonUtils.getUUID());
+                        proEconStationStatusmx.setProjectId(wt.getProjectid());
+                        proEconStationStatusmx.setWindpowerstationId(wt.getWindpowerstationid());
+                        proEconStationStatusmx.setWindturbineId(wt.getId());
+                        proEconStationStatusmx.setRecorddate(date);
+                        proEconStationStatusmx.setStopHours(DoubleUtils.keepPrecision(new Double(minutes).intValue()/60,2));
+                        proEconStationStatusmx.setLossPower(0.0);
+                        proEconStationStatusmx.setSatusCode(sta);
+                        proEconStationStatusmx.setStatusDesc(statusmxMap.get(sta));
+                        proEconStationStatusmx.setAvgSpeed(0.0);
+//                        proEconStationStatusmxService.save(proEconStationStatusmx);
+                        resultList.add(proEconStationStatusmx);
+                    });
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+
+            });
+        });
+
+        proEconStationStatusmxService.saveBatch(resultList);
+
+
+
+//        List<Windturbine> wtls = CacheContext.wtls;
+//        Map<Integer, String> statusmxMap = CacheContext.statusmxMap;
+//        Set<Integer> status = statusmxMap.keySet();
+//        List<String> days = DateUtils.getDays(beginDate, endDate);
+//        days.forEach(day->{
+//            Date date = DateUtils.parseDate1(day);
+//            Date addDay = DateUtils.addDays(date, 1);
+//
+//            wtls.stream().forEach(wt->{
+//                QueryWrapper<ProEconWindturbineStatus2> qw = new QueryWrapper<>();
+//                qw.eq("windTurbine_Id",wt.getId());
+//                qw.ge("start_Time",date).lt("start_Time",addDay);
+//                List<ProEconWindturbineStatus2> proEconWindturbineStatus2s = proEconWindturbineStatus2Service.list(qw);
+//                if (StringUtils.isNotNull(proEconWindturbineStatus2s)){
+//                    status.stream().forEach(sta->{
+//                        List<ProEconWindturbineStatus2> collect = proEconWindturbineStatus2s.stream().filter(i -> i.getSatusCode() == sta).collect(Collectors.toList());
+//                        if (StringUtils.isNotNull(collect)){
+//                            double sum = collect.stream().mapToDouble(ProEconWindturbineStatus2::getStopHours).sum();
+//                            ProEconStationStatusmx proEconStationStatusmx = new ProEconStationStatusmx();
+//                            proEconStationStatusmx.setId(CommonUtils.getUUID());
+//                            proEconStationStatusmx.setProjectId(wt.getProjectid());
+//                            proEconStationStatusmx.setWindpowerstationId(wt.getWindpowerstationid());
+//                            proEconStationStatusmx.setWindturbineId(wt.getId());
+//                            proEconStationStatusmx.setRecorddate(date);
+//                            proEconStationStatusmx.setStopHours(sum);
+//                            proEconStationStatusmx.setLossPower(0.0);
+//                            proEconStationStatusmx.setSatusCode(sta);
+//                            proEconStationStatusmx.setStatusDesc(statusmxMap.get(sta));
+//                            proEconStationStatusmx.setAvgSpeed(0.0);
+//                        }else{
+//
+//                        }
+//                    });
+//                }else{
+//
+//                }
+//                qw.clear();
+//                qw.eq("windTurbine_Id",wt.getId());
+//                qw.ge("stop_Time",date).lt("start_Time",addDay);
+//
+//                proEconWindturbineStatus2s.stream().forEach(data->{
+//
+//                });
+//
+//
+//            });
+//
+//        });
+
+
+
+
+
+
+    }
+
+    /**
+     * 获取两日期间日期list
+     *
+     * @param beginDate
+     * @param endDate
+     * @return
+     */
+    private List<String> getDays(String beginDate, String endDate) {
+        List<String> days = null;
+        if (StringUtils.isNotEmpty(beginDate) && StringUtils.isNotEmpty(endDate)) {
+            days = DateUtils.getDays(beginDate, endDate);
+        } else {
+            days = new ArrayList<>();
+            days.add(DateUtils.getYesterdayStr("yyyy-MM-dd"));
+        }
+        return days;
+    }
+}

+ 16 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/IProEconStationStatusmxService.java

@@ -0,0 +1,16 @@
+package com.gyee.ghost.service.auto;
+
+import com.gyee.ghost.model.auto.ProEconStationStatusmx;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+public interface IProEconStationStatusmxService extends IService<ProEconStationStatusmx> {
+
+}

+ 16 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/IProEconStatusmxService.java

@@ -0,0 +1,16 @@
+package com.gyee.ghost.service.auto;
+
+import com.gyee.ghost.model.auto.ProEconStatusmx;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+public interface IProEconStatusmxService extends IService<ProEconStatusmx> {
+
+}

+ 16 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/IProEconWindturbineStatus2Service.java

@@ -0,0 +1,16 @@
+package com.gyee.ghost.service.auto;
+
+import com.gyee.ghost.model.auto.ProEconWindturbineStatus2;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+public interface IProEconWindturbineStatus2Service extends IService<ProEconWindturbineStatus2> {
+
+}

+ 20 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/impl/ProEconStationStatusmxServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.ghost.service.auto.impl;
+
+import com.gyee.ghost.model.auto.ProEconStationStatusmx;
+import com.gyee.ghost.mapper.auto.ProEconStationStatusmxMapper;
+import com.gyee.ghost.service.auto.IProEconStationStatusmxService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+@Service
+public class ProEconStationStatusmxServiceImpl extends ServiceImpl<ProEconStationStatusmxMapper, ProEconStationStatusmx> implements IProEconStationStatusmxService {
+
+}

+ 20 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/impl/ProEconStatusmxServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.ghost.service.auto.impl;
+
+import com.gyee.ghost.model.auto.ProEconStatusmx;
+import com.gyee.ghost.mapper.auto.ProEconStatusmxMapper;
+import com.gyee.ghost.service.auto.IProEconStatusmxService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+@Service
+public class ProEconStatusmxServiceImpl extends ServiceImpl<ProEconStatusmxMapper, ProEconStatusmx> implements IProEconStatusmxService {
+
+}

+ 20 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/impl/ProEconWindturbineStatus2ServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.ghost.service.auto.impl;
+
+import com.gyee.ghost.model.auto.ProEconWindturbineStatus2;
+import com.gyee.ghost.mapper.auto.ProEconWindturbineStatus2Mapper;
+import com.gyee.ghost.service.auto.IProEconWindturbineStatus2Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-10-25
+ */
+@Service
+public class ProEconWindturbineStatus2ServiceImpl extends ServiceImpl<ProEconWindturbineStatus2Mapper, ProEconWindturbineStatus2> implements IProEconWindturbineStatus2Service {
+
+}

+ 26 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/task/SaticScheduleTask.java

@@ -2,6 +2,7 @@ package com.gyee.ghost.task;
 
 
 import com.gyee.common.util.DateUtils;
+import com.gyee.ghost.service.RealtimeService;
 import com.gyee.ghost.service.auto.GhostService;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.scheduling.annotation.EnableScheduling;
@@ -21,6 +22,8 @@ public class SaticScheduleTask {
 
     @Resource
     private GhostService ghostService;
+    @Resource
+    private RealtimeService realtimeService;
 
     /**
      * 风电统计分析
@@ -50,4 +53,27 @@ public class SaticScheduleTask {
     }
 
 
+    //或直接指定时间间隔,例如:5秒
+    @Scheduled(fixedRate=300000)
+    private void status() {
+        try {
+            realtimeService.saveWindturbineStatus2();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Scheduled(cron = "0 0 1 * * ?")
+    //或直接指定时间间隔,例如:5秒
+    //@Scheduled(fixedRate=5000)
+    private void statustj() {
+        String yesterday = DateUtils.getYesterdayStr("yyyy-MM-dd");
+        try {
+            realtimeService.saveWindstationStatus(yesterday,yesterday);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
 }

+ 17 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/util/realtimesource/EdosUtil.java

@@ -320,6 +320,23 @@ public class EdosUtil implements IEdosUtil {
     }
 
     @Override
+    public PointData getSectionData(Windturbinetestingpointai point, Long date) throws Exception {
+        String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getId() + "&ts=" + date;
+
+        ResponseEntity<JSONObject> resp = restTemplate.getForEntity(rawUrl, JSONObject.class);
+        JSONObject jsonArray = resp.getBody();
+        if (StringUtils.isNotEmpty(jsonArray)){
+            List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
+            if (list.size() > 0)
+                return list.get(0);
+            else
+                return ErrorRequest.RequestError(point.getCode());
+        } else {
+            return ErrorRequest.RequestError(point.getCode());
+        }
+    }
+
+    @Override
     public List<PointData> getHistoryDatasSnap(Windturbinetestingpointai point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
         if (point==null){
             System.out.println(1111);

+ 8 - 1
web/gdsx-ghost/src/main/java/com/gyee/ghost/util/realtimesource/IEdosUtil.java

@@ -50,7 +50,14 @@ public interface IEdosUtil {
      * @throws Exception
      */
     public PointData getRealData(Windturbinetestingpointai point) throws Exception;
-
+    /**
+     * 通过风机测点获得测点切面数据
+     * @param point 只是用了code字段,作为唯一标识
+     * @param date 时间
+     * @return
+     * @throws Exception
+     */
+    public PointData getSectionData(Windturbinetestingpointai point,Long date) throws Exception;
     /**
      * 通过风机测点获得历史快照
      * @param point  只是用了id字段,作为唯一标识

+ 1 - 0
web/gdsx-ghost/src/main/resources/application-dev.yml

@@ -106,3 +106,4 @@ db:
   url: http://11.0.118.58:8011/ts
 
 
+

+ 2 - 1
web/gdsx-ghost/src/test/java/com/gyee/ghost/GhostTest.java

@@ -22,6 +22,7 @@ public class GhostTest {
 
     @Test
     public void test1(){
-        ghostService.saveNature("2021-07-01","2021-07-01");
+        double a = 1/2;
+        System.out.println();
     }
 }