Browse Source

开发和风REdis数据缓存

shilin 2 years ago
parent
commit
1f1911761b
24 changed files with 1395 additions and 78 deletions
  1. 29 1
      realtime/generation-service/src/main/java/com/gyee/generation/GenerationMain.java
  2. 11 9
      realtime/generation-service/src/main/java/com/gyee/generation/config/GeneratorCodeConfig.java
  3. 20 0
      realtime/generation-service/src/main/java/com/gyee/generation/controller/WindturbinetestingpointdiController.java
  4. 20 0
      realtime/generation-service/src/main/java/com/gyee/generation/controller/WindturbinetestingpointdisController.java
  5. 182 59
      realtime/generation-service/src/main/java/com/gyee/generation/init/CacheContext.java
  6. 16 0
      realtime/generation-service/src/main/java/com/gyee/generation/mapper/auto/WindturbinetestingpointdiMapper.java
  7. 16 0
      realtime/generation-service/src/main/java/com/gyee/generation/mapper/auto/WindturbinetestingpointdisMapper.java
  8. 2 2
      realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Meterpoint.java
  9. 81 0
      realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Windturbinetestingpointdi.java
  10. 81 0
      realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Windturbinetestingpointdis.java
  11. 18 0
      realtime/generation-service/src/main/java/com/gyee/generation/model/vo/PointValueVo.java
  12. 439 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/Status_HF_Service.java
  13. 16 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/auto/IWindturbinetestingpointdiService.java
  14. 16 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/auto/IWindturbinetestingpointdisService.java
  15. 20 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/auto/impl/WindturbinetestingpointdiServiceImpl.java
  16. 20 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/auto/impl/WindturbinetestingpointdisServiceImpl.java
  17. 83 0
      realtime/generation-service/src/main/java/com/gyee/generation/task/SaticScheduleTask.java
  18. 116 0
      realtime/generation-service/src/main/java/com/gyee/generation/util/SpringUtils.java
  19. 5 1
      realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisConfig.java
  20. 12 1
      realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisService.java
  21. 71 1
      realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisServiceImpl.java
  22. 117 0
      realtime/generation-service/src/main/resources/application-hf.yml
  23. 1 1
      realtime/generation-service/src/main/resources/application.yml
  24. 3 3
      realtime/generation-service/src/main/resources/xxl-job-executor.properties

+ 29 - 1
realtime/generation-service/src/main/java/com/gyee/generation/GenerationMain.java

@@ -13,7 +13,35 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 @SpringBootApplication
 @MapperScan("com.gyee.generation.mapper")
 public class GenerationMain {
-    public static void main(String[] args) {
+    public static void main(String[] args) throws Exception {
+
         SpringApplication.run(GenerationMain.class,args);
+
+//
+//        Status_HF_Service status_HF_Service= SpringUtils.getBean("status_HF_Service");
+//
+//        Date begin=new Date();
+//        System.out.println("开始欠发状态。。。。。。");
+//        status_HF_Service.calculateQfStatus();
+//        Date end=new Date();
+//        System.out.println("结束欠发状态。。。。。。"+ DateUtils.millisecondDiff(end,begin));
+//
+//        System.out.println("开始故障状态。。。。。。");
+//         begin=new Date();
+//        status_HF_Service.calculateGzStatus();
+//         end=new Date();
+//        System.out.println("结束故障状态。。。。。。"+ DateUtils.millisecondDiff(end,begin));
+//
+//        System.out.println("开始理论发电量。。。。。。");
+//         begin=new Date();
+//        status_HF_Service.calculateLlgl();
+//         end=new Date();
+//        System.out.println("结束理论发电量。。。。。。"+ DateUtils.millisecondDiff(end,begin));
+//
+//        System.out.println("开始场站指标。。。。。。");
+//        begin=new Date();
+//        status_HF_Service.calculateWpPoint();
+//         end=new Date();
+//        System.out.println("结束场站指标。。。。。。"+ DateUtils.millisecondDiff(end,begin));
     }
 }

+ 11 - 9
realtime/generation-service/src/main/java/com/gyee/generation/config/GeneratorCodeConfig.java

@@ -39,8 +39,10 @@ public class GeneratorCodeConfig {
         // 全局配置
         GlobalConfig gc = new GlobalConfig();
         String projectPath = System.getProperty("user.dir");
-        gc.setOutputDir(projectPath + "/src/main/java");
-        gc.setAuthor("谢生杰");
+//        gc.setOutputDir(projectPath + "/src/main/java");
+//        gc.setAuthor("谢生杰");
+        gc.setOutputDir(projectPath+"/realtime/generation-service"+ "/src/main/java");
+        gc.setAuthor("shilin");
         gc.setOpen(false);
         //实体属性 Swagger2 注解
         gc.setSwagger2(false);
@@ -53,15 +55,15 @@ public class GeneratorCodeConfig {
         dsc.setUsername("root");
         dsc.setPassword("root");
         mpg.setDataSource(dsc);*/
-//        dsc.setDriverName("oracle.jdbc.driver.OracleDriver");
-//        dsc.setUsername("gdprod");
-//        dsc.setPassword("gd123");
-//        dsc.setUrl("jdbc:oracle:thin:@10.83.68.165:1521:gdsj");
-
-        dsc.setDriverName("org.postgresql.Driver");
+        dsc.setDriverName("oracle.jdbc.driver.OracleDriver");
         dsc.setUsername("gdprod");
         dsc.setPassword("gd123");
-        dsc.setUrl("jdbc:postgresql://10.81.3.151:5432/wisdom");
+        dsc.setUrl("jdbc:oracle:thin:@10.0.118.71:1521:gdsj");
+
+//        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
realtime/generation-service/src/main/java/com/gyee/generation/controller/WindturbinetestingpointdiController.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 2023-02-01
+ */
+@RestController
+@RequestMapping("//windturbinetestingpointdi")
+public class WindturbinetestingpointdiController {
+
+}

+ 20 - 0
realtime/generation-service/src/main/java/com/gyee/generation/controller/WindturbinetestingpointdisController.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 2023-02-01
+ */
+@RestController
+@RequestMapping("//windturbinetestingpointdis")
+public class WindturbinetestingpointdisController {
+
+}

+ 182 - 59
realtime/generation-service/src/main/java/com/gyee/generation/init/CacheContext.java

@@ -45,126 +45,157 @@ public class CacheContext implements CommandLineRunner {
     private IWindturbinepowerService windturbinepowerService;
     @Resource
     private RedisService redisService;
+    @Resource
+    private IWindturbinetestingpointaiService windturbinetestingpointaiService;
+    @Resource
+    private IWindpowerstationtestingpointService windpowerstationtestingpointService;
+
+    @Resource
+    private IWindturbinepowercurvefittingService windturbinepowercurvefittingService;
     @Value("${runWindpowerstation}")
     private String runWindpowerstation;
-
+    @Resource
+    private IWindturbinetestingpointdisService windturbinetestingpointdisService;
     public static List<Windturbine> wtls = new ArrayList<>();
     public static List<Project> projects = new ArrayList<>();
-    public static List<Line>  lines = new ArrayList<>();
-    public static List<Windpowerstation>  wpls = new ArrayList<>();
-    public static List<Meterpoint>  meterpoints = new ArrayList<>();
-    public static Map<String,Meterpoint>  meterpointMap = new HashMap<>();
-    public static Map<String,List<Project>> wppromap = new HashMap<>();
-    public static Map<String,List<Line>> prolinemap = new HashMap<>();
-    public static Map<String,List<Windturbine>> linewtmap = new HashMap<>();
+    public static List<Line> lines = new ArrayList<>();
+    public static List<Windpowerstation> wpls = new ArrayList<>();
+    public static List<Meterpoint> meterpoints = new ArrayList<>();
+    public static Map<String, Meterpoint> meterpointMap = new HashMap<>();
+    public static Map<String, List<Project>> wppromap = new HashMap<>();
+    public static Map<String, List<Line>> prolinemap = new HashMap<>();
+    public static Map<String, List<Windturbine>> linewtmap = new HashMap<>();
     public static Map<String, Map<String, Windturbinetestingpointnew>> wtpAimap = new HashMap<>();// 风电机测点AI表
-    public static Map<String,Map<String, Windpowerstationpointnew>> linepointmap =new HashMap<>();
-    public static Map<String,Map<String, Windpowerstationpointnew>> propointmap =new HashMap<>();
-    public static Map<String,Map<String, Windpowerstationpointnew>> wppointmap =new HashMap<>();
-    public static Map<String,Project> proMap = new HashMap<>();
-    public static Map<String,List<Windturbinestatusdi>> statusMap = new HashMap<>();
-    public static Map<String,Map<Double,Double>> zbzglMap = new HashMap<>();
-    public static Map<String,Equipmentmodel> modelMap = new HashMap<>();
-    public static Map<String,Map<Double,Double>> zzsglMap = new HashMap<>();
-    public static Map<String,Double> modelpower = new HashMap<>();
+    public static Map<String, Map<String, Windpowerstationpointnew>> linepointmap = new HashMap<>();
+    public static Map<String, Map<String, Windpowerstationpointnew>> propointmap = new HashMap<>();
+    public static Map<String, Map<String, Windpowerstationpointnew>> wppointmap = new HashMap<>();
+    public static Map<String, Project> proMap = new HashMap<>();
+    public static Map<String, List<Windturbinestatusdi>> statusMap = new HashMap<>();
+    public static Map<String, Map<Double, Double>> zbzglMap = new HashMap<>();
+    public static Map<String, Equipmentmodel> modelMap = new HashMap<>();
+    public static Map<String, Map<Double, Double>> zzsglMap = new HashMap<>();
+    public static Map<String, Double> modelpower = new HashMap<>();
+
+    public static Map<String, Integer> redisDbMap = new HashMap<>();
+
+    public static Map<String, Map<String, Windturbinetestingpointai>> wtPointmap = new HashMap<>();// 风电机测点AI表
+
+
+    public static Map<String, Map<String, Windpowerstationtestingpoint>> wpPointmap = new HashMap<>();
+
+    public static Map<String, Map<Double, Windturbinepowercurvefitting>> curveFittingPowerMap = new HashMap<>();
+
+    public static List<Windturbinetestingpointdis> pointdis = new ArrayList<>();
+
     @Override
     public void run(String... args) throws Exception {
         logger.info("缓存开始------------------------------------------------------------");
+
+
+
         List<String> runWpids = Arrays.asList(runWindpowerstation.split(","));
-        logger.info(runWpids.get(0)+"------------------"+runWpids.size());
+        logger.info(runWpids.get(0) + "------------------" + runWpids.size());
 
         List<Equipmentmodel> equipmentmodels = equipmentmodelService.list();
-        equipmentmodels.stream().forEach(e->{
-            modelMap.put(e.getId(),e);
+        equipmentmodels.stream().forEach(e -> {
+            modelMap.put(e.getId(), e);
         });
 
-        wtls = windturbineService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
-        logger.info(wtls.size()+"");
-        wtls.forEach(wt->{
+        wtls = windturbineService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
+        logger.info(wtls.size() + "");
+        wtls.forEach(wt -> {
             Equipmentmodel equipmentmodel = modelMap.get(wt.getModelid());
-            modelpower.put(wt.getId(),equipmentmodel.getPowerproduction());
+            modelpower.put(wt.getId(), equipmentmodel.getPowerproduction());
 
             String wtString = redisService.get(wt.getId());
             Map<String, Windturbinetestingpointnew> stringWindturbinetestingpointnewMap = JSONObject.parseObject(wtString, new TypeReference<Map<String, Windturbinetestingpointnew>>() {
             });
-            wtpAimap.put(wt.getId(),stringWindturbinetestingpointnewMap);
+            wtpAimap.put(wt.getId(), stringWindturbinetestingpointnewMap);
 
-            if (linewtmap.containsKey(wt.getLineid())){
+            if (linewtmap.containsKey(wt.getLineid())) {
                 linewtmap.get(wt.getLineid()).add(wt);
-            }else {
+            } else {
                 List<Windturbine> lines = new ArrayList<>();
                 lines.add(wt);
-                linewtmap.put(wt.getLineid(),lines);
+                linewtmap.put(wt.getLineid(), lines);
             }
         });
 
-        projects = projectService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
-        projects.stream().forEach(p->{
-            proMap.put(p.getId(),p);
-            if (wppromap.containsKey(p.getWindpowerstationid())){
+        projects = projectService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
+        projects.stream().forEach(p -> {
+            proMap.put(p.getId(), p);
+            if (wppromap.containsKey(p.getWindpowerstationid())) {
                 wppromap.get(p.getWindpowerstationid()).add(p);
-            }else {
+            } else {
                 List<Project> prolist = new ArrayList<>();
                 prolist.add(p);
-                wppromap.put(p.getWindpowerstationid(),prolist);
+                wppromap.put(p.getWindpowerstationid(), prolist);
             }
             String pjString = redisService.get(p.getId());
             Map<String, Windpowerstationpointnew> stringWindpowerstationpointnewMap = JSONObject.parseObject(pjString, new TypeReference<Map<String, Windpowerstationpointnew>>() {
             });
-            propointmap.put(p.getId(),stringWindpowerstationpointnewMap);
+            propointmap.put(p.getId(), stringWindpowerstationpointnewMap);
 
         });
 
-        lines = lineService.list().stream().filter(i-> StringUtils.isNotNull(proMap.get(i.getProjectid())) && runWpids.contains(proMap.get(i.getProjectid()).getWindpowerstationid())).collect(Collectors.toList());
-        lines.stream().forEach(l->{
-            if (prolinemap.containsKey(l.getProjectid())){
+        lines = lineService.list().stream().filter(i -> StringUtils.isNotNull(proMap.get(i.getProjectid())) && runWpids.contains(proMap.get(i.getProjectid()).getWindpowerstationid())).collect(Collectors.toList());
+        lines.stream().forEach(l -> {
+            if (prolinemap.containsKey(l.getProjectid())) {
                 prolinemap.get(l.getProjectid()).add(l);
-            }else {
+            } else {
                 List<Line> lineList = new ArrayList<>();
                 lineList.add(l);
-                prolinemap.put(l.getProjectid(),lineList);
+                prolinemap.put(l.getProjectid(), lineList);
             }
             String lnString = redisService.get(l.getId());
             Map<String, Windpowerstationpointnew> stringWindpowerstationpointnewMap = JSONObject.parseObject(lnString, new TypeReference<Map<String, Windpowerstationpointnew>>() {
             });
-            linepointmap.put(l.getId(),stringWindpowerstationpointnewMap);
+            linepointmap.put(l.getId(), stringWindpowerstationpointnewMap);
         });
 
-        wpls = windpowerstationService.list().stream().filter(i->runWpids.contains(i.getId())).collect(Collectors.toList());;
-        meterpoints = meterpointService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
+        wpls = windpowerstationService.list().stream().filter(i -> runWpids.contains(i.getId())).collect(Collectors.toList());
+        ;
+        meterpoints = meterpointService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
         meterpoints.stream().forEach(meterpoint -> {
-            meterpointMap.put(meterpoint.getId(),meterpoint);
+            meterpointMap.put(meterpoint.getId(), meterpoint);
         });
 
 
-        wpls.stream().forEach(wp->{
+        wpls.stream().forEach(wp -> {
             String wpString = redisService.get(wp.getId());
             Map<String, Windpowerstationpointnew> stringMapMap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Windpowerstationpointnew>>() {
             });
-            wppointmap.put(wp.getId(),stringMapMap);
+            wppointmap.put(wp.getId(), stringMapMap);
         });
 
         String sszzt = redisService.get("SSZZT");
-         statusMap = JSONObject.parseObject(sszzt, new TypeReference<Map<String,List<Windturbinestatusdi>>>() {
+        statusMap = JSONObject.parseObject(sszzt, new TypeReference<Map<String, List<Windturbinestatusdi>>>() {
         });
 
 
-
         String zbzgl = redisService.get("ZBZGL");
-        zbzglMap = JSONObject.parseObject(zbzgl, new TypeReference<Map<String,Map<Double,Double>>>() {
+        zbzglMap = JSONObject.parseObject(zbzgl, new TypeReference<Map<String, Map<Double, Double>>>() {
         });
 
-        List<Windturbinepower> windturbinepowerList = windturbinepowerService.list().stream().filter(windturbinepower -> runWindpowerstation.contains(windturbinepower.getWindpowerstationid())).collect(Collectors.toList());
-        windturbinepowerList.stream().forEach(w -> {
-            if (zzsglMap.containsKey(w.getWindturbineid())){
-                zzsglMap.get(w.getWindturbineid()).put(w.getSpeed(),w.getTheorypower());
-            }else {
-                Map<Double,Double> tempMap = new HashMap<>();
-                tempMap.put(w.getSpeed(),w.getTheorypower());
-                zzsglMap.put(w.getWindturbineid(),tempMap);
-            }
+//        List<Windturbinepower> windturbinepowerList = windturbinepowerService.list().stream().filter(windturbinepower -> runWindpowerstation.contains(windturbinepower.getWindpowerstationid())).collect(Collectors.toList());
+//        windturbinepowerList.stream().forEach(w -> {
+//            if (zzsglMap.containsKey(w.getWindturbineid())){
+//                zzsglMap.get(w.getWindturbineid()).put(w.getSpeed(),w.getTheorypower());
+//            }else {
+//                Map<Double,Double> tempMap = new HashMap<>();
+//                tempMap.put(w.getSpeed(),w.getTheorypower());
+//                zzsglMap.put(w.getWindturbineid(),tempMap);
+//            }
+//
+//        });
 
-        });
+        for (int i = 0; i < 8; i++) {
+            Set<String> keys = redisService.keys(i);
+
+            for (String key : keys) {
+                redisDbMap.put(key, i);
+            }
+        }
 
 //        String wpString = redisService.get("PRODUCT-WP");
 //        wppointmap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Map<String, Windpowerstationpointnew>>>() {
@@ -179,6 +210,98 @@ public class CacheContext implements CommandLineRunner {
 //        String wtString = redisService.get("PRODUCT-WT");
 //        wtpAimap = JSONObject.parseObject(wtString, new TypeReference<Map<String, Map<String, Windturbinetestingpointnew>>>() {
 //        });
+        redisService.select(8);
+
+       // initial();
+
+        String wtPointString = redisService.get("wtPointmap");
+        wtPointmap = JSONObject.parseObject(wtPointString, new TypeReference<Map<String, Map<String, Windturbinetestingpointai>>>() {
+        });
+
+        String wpPointString = redisService.get("wpPointmap");
+        wpPointmap = JSONObject.parseObject(wpPointString, new TypeReference<Map<String, Map<String, Windpowerstationtestingpoint>>>() {
+        });
+
+
+        String curveFittingPowerString = redisService.get("curveFittingPowerMap");
+        curveFittingPowerMap = JSONObject.parseObject(curveFittingPowerString, new TypeReference<Map<String, Map<Double, Windturbinepowercurvefitting>>>() {
+        });
+
+
+        String pointdisString = redisService.get("pointdis");
+        pointdis = JSONObject.parseObject(pointdisString, new TypeReference<List<Windturbinetestingpointdis>>() {
+        });
+
+
         logger.info("缓存结束------------------------------------------------------------");
     }
+
+
+    private void initial() {
+
+        List<Windturbinetestingpointai> wtpointlist = windturbinetestingpointaiService.list();
+
+
+        Map<String, Windturbinetestingpointai> map = null;
+
+        if (wtpointlist != null && !wtpointlist.isEmpty()) {
+            for (Windturbinetestingpointai mp : wtpointlist) {
+                if (wtPointmap.containsKey(mp.getWindturbineid())) {
+                    map = wtPointmap.get(mp.getWindturbineid());
+                    map.put(mp.getUniformcode(), mp);
+                } else {
+                    map = new HashMap<String, Windturbinetestingpointai>();
+                    map.put(mp.getUniformcode(), mp);
+                    wtPointmap.put(mp.getWindturbineid(), map);
+                }
+            }
+        }
+
+        String s = JSONObject.toJSONString(wtPointmap);
+        redisService.set("wtPointmap", s);
+
+
+        List<Windpowerstationtestingpoint> list = windpowerstationtestingpointService.list();
+
+        Map<String, Windpowerstationtestingpoint> items = null;
+        if (list != null && !list.isEmpty()) {
+            for (int i = 0; i < list.size(); i++) {
+                Windpowerstationtestingpoint point = list.get(i);
+                if (wpPointmap.containsKey(point.getWindpowerstationid())) {
+                    items = wpPointmap.get(point.getWindpowerstationid());
+                    items.put(point.getUniformcode(), point);
+                } else {
+                    items = new HashMap<String, Windpowerstationtestingpoint>();
+                    wpPointmap.put(point.getWindpowerstationid(), items);
+                    items.put(point.getUniformcode(), point);
+                }
+
+            }
+        }
+        s = JSONObject.toJSONString(wpPointmap);
+        redisService.set("wpPointmap", s);
+
+
+        List<Windturbinepowercurvefitting> econWtPowerCurveFittings = windturbinepowercurvefittingService.list();
+        if (StringUtils.isNotNull(econWtPowerCurveFittings)) {
+            econWtPowerCurveFittings.stream().forEach(curveFitting -> {
+                if (curveFittingPowerMap.containsKey(curveFitting.getWindturbineid())) {
+                    curveFittingPowerMap.get(curveFitting.getWindturbineid()).put(curveFitting.getSpeed(), curveFitting);
+                } else {
+                    Map<Double, Windturbinepowercurvefitting> powerMap = new HashMap<>();
+                    powerMap.put(curveFitting.getSpeed(), curveFitting);
+                    curveFittingPowerMap.put(curveFitting.getWindturbineid(), powerMap);
+                }
+            });
+        }
+
+        s = JSONObject.toJSONString(curveFittingPowerMap);
+        redisService.set("curveFittingPowerMap", s);
+
+
+        pointdis = windturbinetestingpointdisService.list();
+
+        s = JSONObject.toJSONString(pointdis);
+        redisService.set("pointdis", s);
+    }
 }

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

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.Windturbinetestingpointdi;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+public interface WindturbinetestingpointdiMapper extends BaseMapper<Windturbinetestingpointdi> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.Windturbinetestingpointdis;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+public interface WindturbinetestingpointdisMapper extends BaseMapper<Windturbinetestingpointdis> {
+
+}

+ 2 - 2
realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Meterpoint.java

@@ -81,10 +81,10 @@ public class Meterpoint extends Model {
     @TableField("MAGNIFICATIONXS")
     private Double magnificationxs;
 
-    @TableField("OTHERVALUE")
+    @TableField(exist = false)
     private Double othervalue;
 
-    @TableField("OTHERDATE")
+    @TableField(exist = false)
     private Date otherdate;
 
 

+ 81 - 0
realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Windturbinetestingpointdi.java

@@ -0,0 +1,81 @@
+package com.gyee.generation.model.auto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WINDTURBINETESTINGPOINTDI")
+public class Windturbinetestingpointdi extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("MODEL")
+    private String model;
+
+    @TableField("VALUEUNIT")
+    private String valueunit;
+
+    @TableField("ENGLISHNAME")
+    private String englishname;
+
+    @TableField("TYPEID")
+    private String typeid;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("MAXVAL")
+    private BigDecimal maxval;
+
+    @TableField("MINVAL")
+    private BigDecimal minval;
+
+    @TableField("REASONABLEMAXVAL")
+    private BigDecimal reasonablemaxval;
+
+    @TableField("REASONABLEMINVAL")
+    private BigDecimal reasonableminval;
+
+    @TableField("WINDTURBINEID")
+    private String windturbineid;
+
+    @TableField("UNIFORMCODE")
+    private String uniformcode;
+
+    @TableField("SHORTID")
+    private String shortid;
+
+    @TableField("LONGID")
+    private String longid;
+
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    @TableField("REALTIMEID")
+    private String realtimeid;
+
+
+}

+ 81 - 0
realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Windturbinetestingpointdis.java

@@ -0,0 +1,81 @@
+package com.gyee.generation.model.auto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WINDTURBINETESTINGPOINTDIS")
+public class Windturbinetestingpointdis extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("MODEL")
+    private String model;
+
+    @TableField("VALUEUNIT")
+    private String valueunit;
+
+    @TableField("ENGLISHNAME")
+    private String englishname;
+
+    @TableField("TYPEID")
+    private String typeid;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("MAXVAL")
+    private BigDecimal maxval;
+
+    @TableField("MINVAL")
+    private BigDecimal minval;
+
+    @TableField("REASONABLEMAXVAL")
+    private BigDecimal reasonablemaxval;
+
+    @TableField("REASONABLEMINVAL")
+    private BigDecimal reasonableminval;
+
+    @TableField("WINDTURBINEID")
+    private String windturbineid;
+
+    @TableField("UNIFORMCODE")
+    private String uniformcode;
+
+    @TableField("SHORTID")
+    private String shortid;
+
+    @TableField("LONGID")
+    private String longid;
+
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    @TableField("REALTIMEID")
+    private String realtimeid;
+
+
+}

+ 18 - 0
realtime/generation-service/src/main/java/com/gyee/generation/model/vo/PointValueVo.java

@@ -0,0 +1,18 @@
+package com.gyee.generation.model.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+@Data
+public class PointValueVo {
+
+    private String pointid;
+
+    private Double value;
+
+    private Long timestamp;
+
+    private Date datetime;
+
+    private Integer status;
+}

+ 439 - 0
realtime/generation-service/src/main/java/com/gyee/generation/service/Status_HF_Service.java

@@ -0,0 +1,439 @@
+package com.gyee.generation.service;
+
+import com.gyee.common.contant.Contant;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.StringUtils;
+import com.gyee.common.util.DateUtils;
+import com.gyee.common.util.algorithm.Underdelivery;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.*;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import com.gyee.generation.util.redis.RedisService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @ClassName : StatusService
+ * @Author : xieshengjie
+ * @Date: 2022/3/28 14:22
+ * @Description : 状态计算
+ */
+@Service
+public class Status_HF_Service {
+
+    @Resource
+    private IEdosUtil edosUtil;
+
+    @Resource
+    private RedisService redisService;
+
+
+    /**
+     * 判断故障状态
+     *
+     * @throws Exception
+     */
+    public void calculateGzStatus() throws Exception {
+
+        Map<String, Map<String, Object>> pipelinedmap = new HashMap<>();
+        if (!CacheContext.wtls.isEmpty()) {
+
+
+            for (Windturbine wt : CacheContext.wtls) {
+
+
+                if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+                    Map<String, Windturbinetestingpointai> map = CacheContext.wtPointmap.get(wt.getId());
+                    if (map.containsKey(Contant.GZZT)) {
+                        Windturbinetestingpointai pt = map.get(Contant.GZZT);
+                        redisService.select(8);
+
+                        Map<String, Object> pomap = new LinkedHashMap<>();
+
+                        pomap.put("pointid", pt.getId());
+                        Date date = new Date();
+                        pomap.put("value", 0);
+                        pomap.put("timestamp", date.getTime() / 1000);
+                        pomap.put("datetime", DateUtils.toDate(date));
+                        pomap.put("status", 0);
+                        pipelinedmap.put(pt.getId(), pomap);
+                        // redisService.putHashAllObj(pt.getId(),pomap);
+
+                    }
+                }
+
+                if (wt.getModelid().equals("SL1500-77") || wt.getModelid().equals("SL1500-82")) {
+                    List<Windturbinetestingpointdis> disLs = CacheContext.pointdis.stream().filter(i -> i.getWindturbineid().equals(wt.getId()) && i.getUniformcode().equals("ZT001")).collect(Collectors.toList());
+
+                    if (!disLs.isEmpty()) {
+                        Windturbinetestingpointdis key = disLs.get(0);
+                        if (CacheContext.redisDbMap.containsKey(key.getId())) {
+                            int dbnum = CacheContext.redisDbMap.get(key.getId());
+                            redisService.select(dbnum);
+
+                            if (redisService.hasKey(key.getId(), "value")) {
+
+                                double value = 0.0;
+                                try {
+                                    Map<Object, Object> map = redisService.getHashEntries(key.getId());
+                                    if (map.containsKey("value")) {
+                                        value = Double.valueOf((String) map.get("value"));
+                                    }
+                                } catch (Exception e) {
+                                    System.out.println("calculateGzStatus" + "  " + e.getMessage());
+                                }
+
+                                if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+                                    Map<String, Windturbinetestingpointai> map = CacheContext.wtPointmap.get(wt.getId());
+                                    if (map.containsKey(Contant.GZZT)) {
+                                        Windturbinetestingpointai pt = map.get(Contant.GZZT);
+
+                                        if (StringUtils.notEmp(value) && value == 3) {
+                                            redisService.select(8);
+
+
+                                            Map<String, Object> pomap = new LinkedHashMap<>();
+
+                                            pomap.put("pointid", pt.getId());
+                                            Date date = new Date();
+                                            pomap.put("value", 1);
+                                            pomap.put("timestamp", date.getTime() / 1000);
+                                            pomap.put("datetime", DateUtils.toDate(date));
+                                            pomap.put("status", 0);
+
+                                            pipelinedmap.put(pt.getId(), pomap);
+                                            // redisService.putHashAllObj(pt.getId(),pomap);
+
+
+                                        }
+                                    }
+                                }
+
+                            }
+                        }
+
+
+                    }
+                } else {
+                    List<Windturbinetestingpointdis> disLs = CacheContext.pointdis.stream().filter(i -> i.getWindturbineid().equals(wt.getId()) && i.getUniformcode().equals("ZT002")).collect(Collectors.toList());
+
+
+                    if (!disLs.isEmpty()) {
+                        Windturbinetestingpointdis key = disLs.get(0);
+                        if (CacheContext.redisDbMap.containsKey(key.getId())) {
+                            int dbnum = CacheContext.redisDbMap.get(key.getId());
+                            redisService.select(dbnum);
+
+                            if (redisService.hasKey(key.getId(), "value")) {
+                                double value = 0.0;
+                                try {
+
+                                    Map<Object, Object> map = redisService.getHashEntries(key.getId());
+                                    if (map.containsKey("value")) {
+                                        value = Double.valueOf((String) map.get("value"));
+                                    }
+                                } catch (Exception e) {
+                                    System.out.println("calculateGzStatus" + "  " + e.getMessage());
+                                }
+
+
+                                if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+                                    Map<String, Windturbinetestingpointai> map = CacheContext.wtPointmap.get(wt.getId());
+                                    if (map.containsKey(Contant.GZZT)) {
+                                        Windturbinetestingpointai pt = map.get(Contant.GZZT);
+
+                                        if (StringUtils.notEmp(value) && value == 1) {
+                                            redisService.select(8);
+
+
+                                            Map<String, Object> pomap = new LinkedHashMap<>();
+
+                                            pomap.put("pointid", pt.getId());
+                                            Date date = new Date();
+                                            pomap.put("value", 1);
+                                            pomap.put("timestamp", date.getTime() / 1000);
+                                            pomap.put("datetime", DateUtils.toDate(date));
+                                            pomap.put("status", 0);
+                                            pipelinedmap.put(pt.getId(), pomap);
+                                            //redisService.putHashAllObj(pt.getId(),pomap);
+
+
+                                        }
+                                    }
+                                }
+                            }
+
+
+                        }
+
+                    }
+                }
+            }
+
+            redisService.putHashAllPipeObj(pipelinedmap);
+        }
+
+    }
+
+
+    /**
+     * 判断欠发状态
+     *
+     * @throws Exception
+     */
+    public void calculateQfStatus() throws Exception {
+
+        Map<String, Map<String, Object>> pipelinedmap = new HashMap<>();
+        if (!CacheContext.wtls.isEmpty()) {
+            for (Windturbine wt : CacheContext.wtls) {
+
+                if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+                    Map<String, Windturbinetestingpointai> map = CacheContext.wtPointmap.get(wt.getId());
+
+
+                    if (map.containsKey(Contant.RSSQFZT)) {
+                        Windturbinetestingpointai qfpt = map.get(Contant.RSSQFZT);
+                        redisService.select(8);
+                        Map<String, Object> pomap = new LinkedHashMap<>();
+
+                        pomap.put("pointid", qfpt.getId());
+                        Date date = new Date();
+                        pomap.put("value", 0);
+                        pomap.put("timestamp", date.getTime() / 1000);
+                        pomap.put("datetime", DateUtils.toDate(date));
+                        pomap.put("status", 0);
+                        pipelinedmap.put(qfpt.getId(), pomap);
+                        //redisService.putHashAllObj(qfpt.getId(),pomap);
+                    }
+                    if (map.containsKey(Contant.AI130) && map.containsKey(Contant.AI022)) {
+                        Windturbinetestingpointai powerpoint = map.get(Contant.AI130);
+                        Windturbinetestingpointai speedpoint = map.get(Contant.AI022);
+                        if (CacheContext.redisDbMap.containsKey(powerpoint.getId()) && CacheContext.redisDbMap.containsKey(speedpoint.getId())) {
+
+                            int dbnum = CacheContext.redisDbMap.get(powerpoint.getId());
+                            redisService.select(dbnum);
+                            double power = 0.0;
+                            if (redisService.hasKey(powerpoint.getId(), "value")) {
+
+                                try {
+
+                                    Map<Object, Object> tempmap = redisService.getHashEntries(powerpoint.getId());
+                                    if (tempmap.containsKey("value")) {
+                                        power = Double.valueOf((String) tempmap.get("value"));
+                                    }
+                                } catch (Exception e) {
+                                    System.out.println("calculateQfStatus" + "  " + e.getMessage());
+                                }
+
+                            }
+
+
+                            dbnum = CacheContext.redisDbMap.get(speedpoint.getId());
+                            redisService.select(dbnum);
+
+                            double speed = 0.0;
+                            if (redisService.hasKey(speedpoint.getId(), "value")) {
+                                try {
+
+                                    Map<Object, Object> tempmap = redisService.getHashEntries(speedpoint.getId());
+                                    if (tempmap.containsKey("value")) {
+                                        speed = Double.valueOf((String) tempmap.get("value"));
+                                    }
+                                } catch (Exception e) {
+                                    System.out.println("calculateQfStatus" + "  " + e.getMessage());
+                                }
+
+                            }
+
+
+                            if ((speed != 0 && power != 0) && CacheContext.curveFittingPowerMap.containsKey(wt.getId()) && StringUtils.notEmp(power) && StringUtils.notEmp(speed)) {
+                                Map<Double, Windturbinepowercurvefitting> wtcurvemap = CacheContext.curveFittingPowerMap.get(wt.getId());
+
+                                if (wtcurvemap.containsKey(StringUtils.round(speed, 2))) {
+                                    Windturbinepowercurvefitting wtcurve = wtcurvemap.get(StringUtils.round(speed, 2));
+                                    //拟合功率
+                                    Double actualpower = wtcurve.getActualpower();
+
+                                    double qfzt = Underdelivery.underdeliveryStatusReal(power, actualpower);
+                                    if (map.containsKey(Contant.RSSQFZT)) {
+                                        Windturbinetestingpointai qfpt = map.get(Contant.RSSQFZT);
+                                        redisService.select(8);
+
+
+                                        Map<String, Object> pomap = new LinkedHashMap<>();
+
+                                        pomap.put("pointid", qfpt.getId());
+                                        Date date = new Date();
+                                        pomap.put("value", qfzt);
+                                        pomap.put("timestamp", date.getTime() / 1000);
+                                        pomap.put("datetime", DateUtils.toDate(date));
+                                        pomap.put("status", 0);
+                                        pipelinedmap.put(qfpt.getId(), pomap);
+                                        //redisService.putHashAllObj(qfpt.getId(),pomap);
+
+
+                                    }
+                                }
+
+                            }
+
+                        }
+                    }
+                }
+            }
+
+            redisService.putHashAllPipeObj(pipelinedmap);
+        }
+    }
+
+
+    /**
+     * 判断理论功率
+     *
+     * @throws Exception
+     */
+    public void calculateLlgl() throws Exception {
+
+        Map<String, Map<String, Object>> pipelinedmap = new HashMap<>();
+        if (!CacheContext.wtls.isEmpty()) {
+            for (Windturbine wt : CacheContext.wtls) {
+
+                if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+                    Map<String, Windturbinetestingpointai> map = CacheContext.wtPointmap.get(wt.getId());
+                    if (map.containsKey(Contant.LLGL)) {
+                        Windturbinetestingpointai qfpt = map.get(Contant.LLGL);
+                        redisService.select(8);
+
+
+                        Map<String, Object> pomap = new LinkedHashMap<>();
+
+                        pomap.put("pointid", qfpt.getId());
+                        Date date = new Date();
+                        pomap.put("value", 0);
+                        pomap.put("timestamp", date.getTime() / 1000);
+                        pomap.put("datetime", DateUtils.toDate(date));
+                        pomap.put("status", 0);
+                        pipelinedmap.put(qfpt.getId(), pomap);
+                        //  redisService.putHashAllObj(qfpt.getId(),pomap);
+
+                    }
+                }
+
+                if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+                    Map<String, Windturbinetestingpointai> map = CacheContext.wtPointmap.get(wt.getId());
+                    if (map.containsKey(Contant.AI022)) {
+                        Windturbinetestingpointai speedpoint = map.get(Contant.AI022);
+                        if (CacheContext.redisDbMap.containsKey(speedpoint.getId())) {
+
+                            int dbnum = CacheContext.redisDbMap.get(speedpoint.getId());
+                            redisService.select(dbnum);
+                            double speed = 0.0;
+                            if (redisService.hasKey(speedpoint.getId(), "value")) {
+                                try {
+
+                                    Map<Object, Object> tempmap = redisService.getHashEntries(speedpoint.getId());
+                                    if (tempmap.containsKey("value")) {
+                                        speed = Double.valueOf((String) tempmap.get("value"));
+                                    }
+                                } catch (Exception e) {
+                                    System.out.println("calculateLlgl   " + e.getMessage());
+                                }
+                            }
+
+
+                            if (speed != 0 && CacheContext.curveFittingPowerMap.containsKey(wt.getId()) && StringUtils.notEmp(speed)) {
+                                Map<Double, Windturbinepowercurvefitting> wtcurvemap = CacheContext.curveFittingPowerMap.get(wt.getId());
+
+                                if (wtcurvemap.containsKey(StringUtils.round(speed, 2))) {
+                                    Windturbinepowercurvefitting wtcurve = wtcurvemap.get(StringUtils.round(speed, 2));
+                                    //拟合功率
+                                    Double actualpower = wtcurve.getOptimalpower();
+
+                                    if (CacheContext.wtPointmap.containsKey(wt.getId())) {
+
+                                        if (map.containsKey(Contant.LLGL)) {
+                                            Windturbinetestingpointai qfpt = map.get(Contant.LLGL);
+                                            redisService.select(8);
+
+
+                                            Map<String, Object> pomap = new LinkedHashMap<>();
+
+                                            pomap.put("pointid", qfpt.getId());
+                                            Date date = new Date();
+                                            pomap.put("value", actualpower);
+                                            pomap.put("timestamp", date.getTime() / 1000);
+                                            pomap.put("datetime", DateUtils.toDate(date));
+                                            pomap.put("status", 0);
+                                            pipelinedmap.put(qfpt.getId(), pomap);
+                                            //redisService.putHashAllObj(qfpt.getId(),pomap);
+
+
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            redisService.putHashAllPipeObj(pipelinedmap);
+        }
+    }
+
+
+    /**
+     * 转存场站计算指标
+     *
+     * @throws Exception
+     */
+    public void calculateWpPoint() throws Exception {
+        Map<String, Map<String, Object>> pipelinedmap = new HashMap<>();
+        if (!CacheContext.wpls.isEmpty()) {
+            for (Windpowerstation wp : CacheContext.wpls) {
+
+
+                if (CacheContext.wpPointmap.containsKey(wp.getId())) {
+                    Map<String, Windpowerstationtestingpoint> map = CacheContext.wpPointmap.get(wp.getId());
+
+                    List<String> ls = new ArrayList<>();
+
+                    ls.add(map.get("CYDLB").getCode());
+                    ls.add(map.get("RFDLB").getCode());
+                    ls.add(map.get("RFDLC").getCode());
+                    ls.add(map.get("RGZSSDL").getCode());
+                    ls.add(map.get("RJXSSDL").getCode());
+                    ls.add(map.get("RWZSSDL").getCode());
+                    ls.add(map.get("RXDSSDL").getCode());
+                    ls.add(map.get("SSFS").getCode());
+                    ls.add(map.get("SSZGL").getCode());
+                    ls.add(map.get("ZLLGL").getCode());
+                    ls.add(map.get("ZZSGL").getCode());
+                    ls.add(map.get("XDZT").getCode());
+                    ls.add(map.get("RXNSSDL").getCode());
+                    ls.add(map.get("QXPCL").getCode());
+
+                    List<PointData> vos = edosUtil.getRealData(ls);
+                    if (!vos.isEmpty()) {
+                        redisService.select(8);
+                        for (PointData vo : vos) {
+                            Map<String, Object> pomap = new LinkedHashMap<>();
+
+                            pomap.put("pointid", vo.getEdnaId());
+                            pomap.put("value", vo.getPointValueInDouble());
+                            pomap.put("timestamp", vo.getPointTime());
+                            pomap.put("datetime", DateUtils.toDate(new Date(vo.getPointTime())));
+                            pomap.put("status", 0);
+                            pipelinedmap.put(vo.getEdnaId(), pomap);
+                            //redisService.putHashAllObj(vo.getEdnaId(),pomap);
+                        }
+                    }
+
+                }
+            }
+            redisService.putHashAllPipeObj(pipelinedmap);
+        }
+    }
+}

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

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.Windturbinetestingpointdi;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+public interface IWindturbinetestingpointdiService extends IService<Windturbinetestingpointdi> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.Windturbinetestingpointdis;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+public interface IWindturbinetestingpointdisService extends IService<Windturbinetestingpointdis> {
+
+}

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

@@ -0,0 +1,20 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.model.auto.Windturbinetestingpointdi;
+import com.gyee.generation.mapper.auto.WindturbinetestingpointdiMapper;
+import com.gyee.generation.service.auto.IWindturbinetestingpointdiService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+@Service
+public class WindturbinetestingpointdiServiceImpl extends ServiceImpl<WindturbinetestingpointdiMapper, Windturbinetestingpointdi> implements IWindturbinetestingpointdiService {
+
+}

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

@@ -0,0 +1,20 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.model.auto.Windturbinetestingpointdis;
+import com.gyee.generation.mapper.auto.WindturbinetestingpointdisMapper;
+import com.gyee.generation.service.auto.IWindturbinetestingpointdisService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author shilin
+ * @since 2023-02-01
+ */
+@Service
+public class WindturbinetestingpointdisServiceImpl extends ServiceImpl<WindturbinetestingpointdisMapper, Windturbinetestingpointdis> implements IWindturbinetestingpointdisService {
+
+}

+ 83 - 0
realtime/generation-service/src/main/java/com/gyee/generation/task/SaticScheduleTask.java

@@ -36,6 +36,9 @@ public class SaticScheduleTask {
     private FiveLossesService fiveLossesService;
     @Resource
     private SafetyService safetyService;
+
+    @Resource
+    private Status_HF_Service status_HF_Service;
     //3.添加定时任务
     /**
      * 电计量实时计算计算(电量,上网,购网,场用)
@@ -193,10 +196,90 @@ public class SaticScheduleTask {
     @XxlJob("shutdownevent-realtime")
     public void shutdownevent(){
         XxlJobHelper.log("故障事件调度程序执行开始!........");
+
         fiveLossesService.saveShutdownevent();
         XxlJobHelper.log("故障事件调度程序执行完成!........");
     }
 
 
+    /**
+     * 欠发状态
+     * 钟执行一次
+     */
+
+    @XxlJob("calculateQfStatus")
+    public void calculateQfStatus()  {
 
+
+        XxlJobHelper.log("风机欠发状态调度程序执行开始!........");
+        try {
+            while (true)
+            {
+                status_HF_Service.calculateQfStatus();
+                Thread.sleep(180000);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("风机欠发状态调度任务处理完成!........");
+    }
+    /**
+     * 故障状态
+     * 钟执行一次
+     */
+    @XxlJob("calculateGzStatus")
+    public void calculateGzStatus()  {
+
+
+        XxlJobHelper.log("风机故障状态调度程序执行开始!........");
+        try {
+            while (true)
+            {
+                status_HF_Service.calculateGzStatus();
+                Thread.sleep(180000);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("风机故障状态调度任务处理完成!........");
+    }
+    /**
+     * 理论电量
+     * 执行一次
+     */
+    @XxlJob("calculateLlgl")
+    public void calculateLlgl()  {
+
+
+        XxlJobHelper.log("风机理论发电量调度程序执行开始!........");
+        try {
+            while (true)
+            {
+                status_HF_Service.calculateLlgl();
+                Thread.sleep(180000);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("风机理论发电量调度任务处理完成!........");
+    }
+    /**
+     * 故障状态
+     * 每1分钟执行一次
+     */
+    @XxlJob("calculateWpPoint")
+    public void calculateWpPoint()  {
+
+
+        XxlJobHelper.log("场站指标调度程序执行开始!........");
+        try {
+            status_HF_Service.calculateWpPoint();
+            Thread.sleep(500);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("场站指标调度任务处理完成!........");
+    }
 }

+ 116 - 0
realtime/generation-service/src/main/java/com/gyee/generation/util/SpringUtils.java

@@ -0,0 +1,116 @@
+package com.gyee.generation.util;
+
+import org.springframework.aop.framework.AopContext;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.stereotype.Component;
+
+/**
+* spring工具类 方便在非spring管理环境中获取bean
+* @ClassName: SpringUtils
+* @author gyee
+* @date 2019-09-11 11:28
+*
+ */
+@Component
+public final class SpringUtils implements BeanFactoryPostProcessor
+{
+    /** Spring应用上下文环境 */
+    private static ConfigurableListableBeanFactory beanFactory;
+
+    @Override
+    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
+    {
+        SpringUtils.beanFactory = beanFactory;
+    }
+
+    /**
+     * 获取对象
+     *
+     * @param name
+     * @return Object 一个以所给名字注册的bean的实例
+     * @throws BeansException
+     *
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> T getBean(String name) throws BeansException
+    {
+        return (T) beanFactory.getBean(name);
+    }
+
+    /**
+     * 获取类型为requiredType的对象
+     *
+     * @param clz
+     * @return
+     * @throws BeansException
+     *
+     */
+    public static <T> T getBean(Class<T> clz) throws BeansException
+    {
+        T result = (T) beanFactory.getBean(clz);
+        return result;
+    }
+
+    /**
+     * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true
+     *
+     * @param name
+     * @return boolean
+     */
+    public static boolean containsBean(String name)
+    {
+        return beanFactory.containsBean(name);
+    }
+
+    /**
+     * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException)
+     *
+     * @param name
+     * @return boolean
+     * @throws NoSuchBeanDefinitionException
+     *
+     */
+    public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException
+    {
+        return beanFactory.isSingleton(name);
+    }
+
+    /**
+     * @param name
+     * @return Class 注册对象的类型
+     * @throws NoSuchBeanDefinitionException
+     *
+     */
+    public static Class<?> getType(String name) throws NoSuchBeanDefinitionException
+    {
+        return beanFactory.getType(name);
+    }
+
+    /**
+     * 如果给定的bean名字在bean定义中有别名,则返回这些别名
+     *
+     * @param name
+     * @return
+     * @throws NoSuchBeanDefinitionException
+     *
+     */
+    public static String[] getAliases(String name) throws NoSuchBeanDefinitionException
+    {
+        return beanFactory.getAliases(name);
+    }
+
+    /**
+     * 获取aop代理对象
+     * 
+     * @param invoker
+     * @return
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> T getAopProxy(T invoker)
+    {
+        return (T) AopContext.currentProxy();
+    }
+}

+ 5 - 1
realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisConfig.java

@@ -7,6 +7,7 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.data.redis.connection.RedisConnectionFactory;
 import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.GenericToStringSerializer;
 import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
 import org.springframework.data.redis.serializer.StringRedisSerializer;
 
@@ -39,8 +40,11 @@ public class RedisConfig {
         template.setHashKeySerializer(stringRedisSerializer);
         // value序列化方式采用jackson
         template.setValueSerializer(jackson2JsonRedisSerializer);
+
+        GenericToStringSerializer redisSerializer = new GenericToStringSerializer(Object.class);
+
         // hash的value序列化方式采用jackson
-        template.setHashValueSerializer(jackson2JsonRedisSerializer);
+        template.setHashValueSerializer(redisSerializer);
         template.afterPropertiesSet();
         return template;
     }

+ 12 - 1
realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisService.java

@@ -1,5 +1,8 @@
 package com.gyee.generation.util.redis;
 
+import java.util.Map;
+import java.util.Set;
+
 public interface RedisService {
 
     /**
@@ -45,7 +48,15 @@ public interface RedisService {
 
     boolean hasKey(String key);
 
-
+    boolean hasKey(String key,String value);
     void select(Integer dbIndex);
 
+    Set<String> keys(Integer dbIndex);
+
+    Object getHashObj(final String key,final String value);
+
+     void putHashAllObj(final String key,final Map<String,Object> value);
+     Map<Object,Object> getHashEntries(final String key);
+
+     void putHashAllPipeObj(final Map<String,Map<String,Object> >map);
 }

+ 71 - 1
realtime/generation-service/src/main/java/com/gyee/generation/util/redis/RedisServiceImpl.java

@@ -10,16 +10,23 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
 
 @Service("redisService")
 public class RedisServiceImpl implements RedisService {
 
+
+  
     @Resource
     private RedisTemplate<String, ?> redisTemplate;
 
     @Override
     public boolean set(final String key, final String value) {;
+
+        
         boolean result = redisTemplate.execute(new RedisCallback<Boolean>() {
             @Override
             public Boolean doInRedis(RedisConnection connection) throws DataAccessException {
@@ -34,6 +41,7 @@ public class RedisServiceImpl implements RedisService {
 
     @Override
     public String get(final String key) {
+        
         String result = redisTemplate.execute(new RedisCallback<String>() {
             @Override
             public String doInRedis(RedisConnection connection) throws DataAccessException {
@@ -49,11 +57,14 @@ public class RedisServiceImpl implements RedisService {
 
     @Override
     public boolean expire(final String key, long expire) {
+
+        
         return redisTemplate.expire(key, expire, TimeUnit.SECONDS);
     }
 
     @Override
     public boolean remove(final String key) {
+        
         boolean result = redisTemplate.execute(new RedisCallback<Boolean>() {
             @Override
             public Boolean doInRedis(RedisConnection connection) throws DataAccessException {
@@ -67,6 +78,7 @@ public class RedisServiceImpl implements RedisService {
 
     @Override
     public boolean hasKey(final String key) {
+        
         try {
             return redisTemplate.hasKey(key);
         } catch (Exception e) {
@@ -74,7 +86,16 @@ public class RedisServiceImpl implements RedisService {
             return false;
         }
     }
+    @Override
+    public boolean hasKey(String key,String value){
 
+        try {
+            return redisTemplate.opsForHash().hasKey(key,value);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
     @Override
     public void setObject(Object obj) {
         Field[] fields = obj.getClass().getDeclaredFields();
@@ -111,6 +132,7 @@ public class RedisServiceImpl implements RedisService {
     }
 
     public void select(Integer dbIndex) {
+
         if (dbIndex == null || dbIndex > 15 || dbIndex < 0) {
             dbIndex = 0;
         }
@@ -119,7 +141,55 @@ public class RedisServiceImpl implements RedisService {
         jedisConnectionFactory.setDatabase(dbIndex);
         redisTemplate.setConnectionFactory(jedisConnectionFactory);
         jedisConnectionFactory.afterPropertiesSet();
-//        jedisConnectionFactory.resetConnection();
+        jedisConnectionFactory.resetConnection();
+
+    }
+
+
+    public Set<String> keys(Integer dbIndex) {
+        select(dbIndex);
+        return redisTemplate.keys("*");
 
     }
+
+
+    public Object getHashObj(final String key,String value) {
+
+        
+        Object result = redisTemplate.opsForHash().get(key,value);
+        return result;
+    }
+
+    public Map<Object,Object> getHashEntries(final String key) {
+
+
+        Map<Object,Object> result = redisTemplate.opsForHash().entries(key);
+        return result;
+    }
+
+    public void putHashAllObj(final String key,final Map<String,Object> value)
+    {
+        
+        redisTemplate.opsForHash().putAll(key,value);
+    }
+
+    public void putHashAllPipeObj(final Map<String,Map<String,Object> >map)
+    {
+        RedisSerializer keySerializer = redisTemplate.getHashKeySerializer();
+        RedisSerializer valueSerializer = redisTemplate.getHashValueSerializer();
+        redisTemplate.executePipelined((RedisCallback) connection -> {
+            map.forEach((k, v) -> {
+                Map<byte[], byte[]> byteMap =new HashMap<>();
+                v.forEach((k2, v2) -> {
+                             byteMap.put(valueSerializer.serialize(k2),valueSerializer.serialize(v2));
+                        });
+
+                connection.hMSet(keySerializer.serialize( k), byteMap);
+            });
+            return null;
+        });
+    }
+
+
+
 }

+ 117 - 0
realtime/generation-service/src/main/resources/application-hf.yml

@@ -0,0 +1,117 @@
+server:
+  port: 7012
+  servlet:
+    context-path: /
+
+
+spring:
+  main:
+    allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
+  #redis集群
+  redis:
+    host: 10.0.118.70
+    port: 6379
+    timeout: 100000
+#    集群环境打开下面注释,单机不需要打开
+#    cluster:
+#      #集群信息
+#      nodes: 10.83.68.151:6379,10.83.68.152:6379,10.83.68.153:6379,10.83.68.154:6379,10.83.68.155:6379,10.83.68.156:6379,10.83.68.157:6379,10.83.68.158:6379,10.83.68.159:6379
+#      #默认值是5 一般当此值设置过大时,容易报:Too many Cluster redirections
+#      maxRedirects: 3
+    password:
+    application:
+      name: test
+    lettuce:
+      pool:
+        max-active: 10000
+        min-idle: 0
+        max-idle: 10000
+        max-wait: -1
+    database: 0
+  autoconfigure:
+    exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    driver-class-name: oracle.jdbc.driver.OracleDriver
+    url: jdbc:oracle:thin:@10.0.118.71:1521:gdsj
+    username: gdprod
+    password: gd123
+    oracle-schema=:
+    #    type: com.alibaba.druid.pool.DruidDataSource
+    #    url: jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8&serverTimezone=UTC
+    #    username: root
+    #    password: root
+    #    driver-class-name: com.mysql.jdbc.Driver
+    druid:
+      max-active: 20
+      initial-size: 1
+      min-idle: 3
+      max-wait: 60000
+      time-between-eviction-runs-millis: 60000
+      min-evictable-idle-time-millis: 300000
+      test-while-idle: true
+      test-on-borrow: false
+      test-on-return: false
+  servlet:
+    multipart:
+      # 开启 multipart 上传功能
+      enabled: true
+      # 文件写入磁盘的阈值
+      file-size-threshold: 2KB
+      # 最大文件大小
+      max-file-size: 200MB
+      # 最大请求大小
+      max-request-size: 215MB
+
+mybatis-plus:
+  configuration:
+    map-underscore-to-camel-case: true
+    auto-mapping-behavior: full
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+  mapper-locations: classpath*:mapper/**/*Mapper.xml
+  global-config:
+    # 逻辑删除配置
+    db-config:
+      id-type: auto
+      # 删除前
+      logic-not-delete-value: 1
+      # 删除后
+      logic-delete-value: 0
+logging:
+  level:
+    root: info
+    com.example: debug
+#db url
+db:
+  url: http://10.0.118.73:8011/ts
+#参与计算的场站
+runWindpowerstation: TF_FDC,XC_FDC,LH_FDC,FS_FDC,BZ_FDC,XBQ_FDC,DBS_FDC,TZS_FDC
+#计算状态用ai或者di
+clauStatus:
+  ai: GJY03_GC,YLZ01_GC,PTZ02_GC   #配置期次
+  di: GJY01_GC,GJY02_GC,DJY01_GC,DJY02_GC,YF01_GC,YF02_GC,HSM01_GC,PTZ01_GC,ZK01_GC,NJL01_GC,YTY01_GC,PDL01_GC
+#判断数据终端
+second: 1800
+#判断降出力
+AI134: 17.4    #叶轮转速给定
+AI178: 17.4    #转矩给定
+#AI443:容量
+
+#计算电量直接取,如果不是1就是相减算
+typeOfElectric:
+  #直接取
+  direct: GJY02_GC,YF01_GC,YF02_GC,HSM01_GC,PTZ01_GC,ZK01_GC
+
+
+
+
+
+
+
+
+
+
+
+
+
+

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

@@ -1,4 +1,4 @@
 spring:
   profiles:
-    active: jn
+    active: hf
 #    active: td

+ 3 - 3
realtime/generation-service/src/main/resources/xxl-job-executor.properties

@@ -1,5 +1,5 @@
 ### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
-xxl.job.admin.addresses=http://10.81.3.152:8175/xxl-job-admin
+xxl.job.admin.addresses=http://10.0.118.76:8175/xxl-job-admin
 
 ### xxl-job, access token
 xxl.job.accessToken=
@@ -10,9 +10,9 @@ xxl.job.executor.appname=generation-job
 xxl.job.executor.address=
 ### xxl-job executor server-info
 xxl.job.executor.ip=
-xxl.job.executor.port=9101
+xxl.job.executor.port=9201
 ### xxl-job executor log-path
-xxl.job.executor.logpath=E:\\jobs\\generation-job
+xxl.job.executor.logpath=D:\\jobs\\generation-job
 ### xxl-job executor log-retention-days
 xxl.job.executor.logretentiondays=30