Forráskód Böngészése

计算服务修改

xieshengjie 2 éve
szülő
commit
943aed2458
100 módosított fájl, 6745 hozzáadás és 108 törlés
  1. 20 0
      cache/src/main/java/com/gyee/cache/controller/RegionsController.java
  2. 14 7
      cache/src/main/java/com/gyee/cache/init/CacheContext.java
  3. 16 0
      cache/src/main/java/com/gyee/cache/mapper/auto/RegionsMapper.java
  4. 1 9
      cache/src/main/java/com/gyee/cache/model/auto/Region.java
  5. 28 0
      cache/src/main/java/com/gyee/cache/model/auto/Regions.java
  6. 16 0
      cache/src/main/java/com/gyee/cache/service/auto/IRegionsService.java
  7. 20 0
      cache/src/main/java/com/gyee/cache/service/auto/impl/RegionsServiceImpl.java
  8. 7 1
      common/src/main/java/com/gyee/common/contant/Contant.java
  9. 1 0
      histroy/analysis-histroy-hb/src/main/java/com/gyee/analysis/service/analysis/AnalysisNewService.java
  10. 54 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/AverageAndGeneratingService.java
  11. 32 10
      realtime/generation-service/src/main/java/com/gyee/generation/service/FiveLossesService.java
  12. 82 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/SafetyService.java
  13. 0 69
      realtime/generation-service/src/main/java/com/gyee/generation/service/UnderissuanceService.java
  14. 25 6
      realtime/generation-service/src/main/java/com/gyee/generation/task/SaticScheduleTask.java
  15. 1 1
      realtime/generation-service/src/main/resources/application-jn.yml
  16. 5 1
      realtime/generation-service/src/test/java/com/gyee/generation/GenerationTest.java
  17. 107 0
      realtime/generationregion-service/pom.xml
  18. 20 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/RegionrealtimeMain.java
  19. 148 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/config/GeneratorCodeConfig.java
  20. 68 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/config/XxlJobConfig.java
  21. 20 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/controller/RegionController.java
  22. 20 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/controller/RegionsController.java
  23. 20 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/controller/WindpowerstationController.java
  24. 20 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/controller/WindpowerstationpointnewController.java
  25. 20 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/controller/WindturbinetestingpointnewController.java
  26. 102 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/init/CacheContext.java
  27. 16 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/mapper/auto/RegionMapper.java
  28. 16 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/mapper/auto/RegionsMapper.java
  29. 16 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/mapper/auto/WindpowerstationMapper.java
  30. 16 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/mapper/auto/WindpowerstationpointnewMapper.java
  31. 16 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/mapper/auto/WindturbinetestingpointnewMapper.java
  32. 28 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/model/auto/Region.java
  33. 28 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/model/auto/Regions.java
  34. 62 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/model/auto/Windpowerstation.java
  35. 56 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/model/auto/Windpowerstationpointnew.java
  36. 58 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/model/auto/Windturbinetestingpointnew.java
  37. 2145 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/RegionRealtimeService.java
  38. 16 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/IRegionService.java
  39. 16 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/IRegionsService.java
  40. 16 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/IWindpowerstationService.java
  41. 16 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/IWindpowerstationpointnewService.java
  42. 16 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/IWindturbinetestingpointnewService.java
  43. 20 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/impl/RegionServiceImpl.java
  44. 20 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/impl/RegionsServiceImpl.java
  45. 20 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/impl/WindpowerstationServiceImpl.java
  46. 20 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/impl/WindpowerstationpointnewServiceImpl.java
  47. 20 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/impl/WindturbinetestingpointnewServiceImpl.java
  48. 48 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/task/SaticScheduleTask.java
  49. 48 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/ApiGolden.java
  50. 1316 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/EdosUtil.java
  51. 27 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/GoldenConfig.java
  52. 262 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/IEdosUtil.java
  53. 34 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/StringUtil.java
  54. 28 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BaseTsQuery.java
  55. 38 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BasicTsData.java
  56. 29 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BasicTsPoint.java
  57. 24 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BlobTsData.java
  58. 22 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BlobWriteTsData.java
  59. 24 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BooleanTsData.java
  60. 19 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BooleanWriteTsData.java
  61. 18 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/Coordinate.java
  62. 26 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/CoordinateTsData.java
  63. 21 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/CoordinateWriteTsData.java
  64. 30 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/DoubleStatData.java
  65. 25 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/DoubleTsData.java
  66. 19 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/DoubleWriteTsData.java
  67. 38 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/ErrorRequest.java
  68. 27 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/GeneralTsData.java
  69. 8 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/Interpolation.java
  70. 206 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/JsonObjectHelper.java
  71. 24 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/LongTsData.java
  72. 20 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/LongWriteTsData.java
  73. 24 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/StringTsData.java
  74. 34 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/StringUtil.java
  75. 20 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/StringWriteTsData.java
  76. 15 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/TsData.java
  77. 15 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/TsDataType.java
  78. 12 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/TsPoint.java
  79. 36 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/TsPointData.java
  80. 23 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/TsPointDataList.java
  81. 17 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/TsQuery.java
  82. 44 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/redis/RedisAutoConfiguration.java
  83. 47 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/redis/RedisConfig.java
  84. 51 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/redis/RedisService.java
  85. 125 0
      realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/redis/RedisServiceImpl.java
  86. 100 0
      realtime/generationregion-service/src/main/resources/application-jn.yml
  87. 5 0
      realtime/generationregion-service/src/main/resources/application.yml
  88. 18 0
      realtime/generationregion-service/src/main/resources/xxl-job-executor.properties
  89. 36 0
      realtime/generationregion-service/src/test/java/com/gyee/regionrealtime/RegionrealtimeTest.java
  90. 4 0
      realtime/meteorologicalcollection/pom.xml
  91. 97 0
      realtime/meteorologicalcollection/src/main/resources/application-jn.yml
  92. 1 1
      realtime/meteorologicalcollection/src/main/resources/application.yml
  93. 1 0
      realtime/pom.xml
  94. 4 0
      web/healthmanagement-web-hb/pom.xml
  95. 11 3
      web/healthmanagement-web-hb/src/main/java/com/gyee/healthmanagement/config/GeneratorCodeConfig.java
  96. 20 0
      web/healthmanagement-web-hb/src/main/java/com/gyee/healthmanagement/controller/auto/WindturbineController.java
  97. 34 0
      web/healthmanagement-web-hb/src/main/java/com/gyee/healthmanagement/init/CacheContext.java
  98. 16 0
      web/healthmanagement-web-hb/src/main/java/com/gyee/healthmanagement/mapper/auto/WindturbineMapper.java
  99. 50 0
      web/healthmanagement-web-hb/src/main/java/com/gyee/healthmanagement/model/auto/Windturbine.java
  100. 0 0
      web/healthmanagement-web-hb/src/main/java/com/gyee/healthmanagement/service/auto/IWindturbineService.java

+ 20 - 0
cache/src/main/java/com/gyee/cache/controller/RegionsController.java

@@ -0,0 +1,20 @@
+package com.gyee.cache.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@RestController
+@RequestMapping("//regions")
+public class RegionsController {
+
+}

+ 14 - 7
cache/src/main/java/com/gyee/cache/init/CacheContext.java

@@ -61,6 +61,10 @@ public class CacheContext implements CommandLineRunner {
     private IEquipmentmodelService equipmentmodelService;
     @Autowired
     private IModelpowerService modelpowerService;
+    @Autowired
+    private IRegionsService regionsService;
+
+
 
 
     public static Map<String, Map<String, Windturbinetestingpointai>> wtpointMap = new HashMap<>();
@@ -327,9 +331,15 @@ public class CacheContext implements CommandLineRunner {
         logger.info("--------------------------redisWP");
         List<Windpowerstation> wpList = windpowerstationService.list();
         List<String> wpids = wpList.stream().map(i -> i.getId()).collect(Collectors.toList());
-        wpids.add("0");
-        wpids.add("-1");
-        wpids.add("-2");
+        List<Regions> regions = regionsService.list();
+        regions.stream().forEach(region -> {
+            wpids.add(region.getId()+"0");
+            wpids.add(region.getId()+"-1");
+            wpids.add(region.getId()+"-2");
+        });
+        wpids.add("QY0");
+        wpids.add("QY-1");
+        wpids.add("QY-2");
         wpids.stream().forEach(i->{
             Map<String, Windpowerstationpointnew> codeaimap = new HashMap<>();
             QueryWrapper<Windpowerstationpointnew> qw = new QueryWrapper<>();
@@ -373,10 +383,7 @@ public class CacheContext implements CommandLineRunner {
             llglMap.put(e.getId(),tempMap);
         });
         redisService.set("ZBZGL",JSONObject.toJSONString(llglMap));
-
-
-
-
+        logger.info("--------------------------redis保证功率结束");
 
     }
 }

+ 16 - 0
cache/src/main/java/com/gyee/cache/mapper/auto/RegionsMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.cache.mapper.auto;
+
+import com.gyee.cache.model.auto.Regions;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+public interface RegionsMapper extends BaseMapper<Regions> {
+
+}

+ 1 - 9
cache/src/main/java/com/gyee/cache/model/auto/Region.java

@@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
-import java.util.Date;
-
 /**
  * <p>
  * 
@@ -24,13 +22,7 @@ public class Region extends Model {
 
     private String name;
 
-    private Date entrydate;
-
-    private Integer safetydayfirst;
-
-    private String pointpre;
-
-    private String companyid;
+    private String code;
 
 
 }

+ 28 - 0
cache/src/main/java/com/gyee/cache/model/auto/Regions.java

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

+ 16 - 0
cache/src/main/java/com/gyee/cache/service/auto/IRegionsService.java

@@ -0,0 +1,16 @@
+package com.gyee.cache.service.auto;
+
+import com.gyee.cache.model.auto.Regions;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+public interface IRegionsService extends IService<Regions> {
+
+}

+ 20 - 0
cache/src/main/java/com/gyee/cache/service/auto/impl/RegionsServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.cache.service.auto.impl;
+
+import com.gyee.cache.model.auto.Regions;
+import com.gyee.cache.mapper.auto.RegionsMapper;
+import com.gyee.cache.service.auto.IRegionsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@Service
+public class RegionsServiceImpl extends ServiceImpl<RegionsMapper, Regions> implements IRegionsService {
+
+}

+ 7 - 1
common/src/main/java/com/gyee/common/contant/Contant.java

@@ -16,6 +16,8 @@ public class Contant {
 
     public static final String benchPoints = "RSDJZSDL,RSSTZSDL,RXNZSDL,RSQXZSDL,RGZZSDL,RSZZSDL,RJXZSDL,RLZZSDL,RQFZSDL,RXDZSDL,RWZZSDL,RTZZSDL";
 
+    public static final String monthbenchPoints = "YSDJZSDL,YSSTZSDL,YXNZSDL,YSQXZSDL,YGZZSDL,YSZZSDL,YJXZSDL,YLZZSDL,YQFZSDL,YXDZSDL,YWZZSDL,YTZZSDL";
+
     public static final String RFDLB = "RFDLB"; //日发电量(升压站)
     public static final String YFDLB = "YFDLB";//月发电量(升压站)
     public static final String NFDLB = "NFDLB";//年发电量(升压站)
@@ -40,6 +42,9 @@ public class Contant {
     public static final String CYDLY="CYDLY";//月场用电量
     public static final String CYDLN="CYDLN";//年场用电量
 
+    public static final String FNLYL = "FNLYL";//风能利用率
+    public static final String AQTS = "AQTS";
+
     public static final String RPJFS = "RPJFS"; //日平均风速
     public static final String YPJFS = "YPJFS"; //月平均风速
     public static final String NPJFS = "NPJFS";  //年平均风速
@@ -53,6 +58,7 @@ public class Contant {
     public static final String AI064 = "AI064"; //风机日发电量
     public static final String AI138 = "AI138"; //风机月发电量
     public static final String AI139 = "AI139"; //风机年发电量
+
     //判断数据中断(风速,功率,绕组温度,电流,电压)
     public static final String INTERRUPTION ="AI022,AI130,AI045,AI089,AI021";
     //判断状态
@@ -225,7 +231,7 @@ public class Contant {
 
     public static final String TPOINT_WP_DJNUM = "DJNUM"; //待机明细
 
-    public static final String TPOINT_WP_MATRIX = "XDTS,YXTS,DJTS,WHTJ,GZTJ,TXZD,SSFS,DWSLNUM,HJSLNUM,FCFGCDQ0001,ZBZGL,ZZSGL,SSZGL,AGC002,AGC001";
+    public static final String TPOINT_WP_MATRIX = "XDTS,YXTS,DJTS,WHTJ,GZTJ,TXZD,SSFS,SLTS,FCFGCDQ0001,ZBZGL,ZZSGL,SSZGL,AGC002,AGC001";
 
 
     public static final String TPOINT_WT_FJZT = "FJZT" ;

+ 1 - 0
histroy/analysis-histroy-hb/src/main/java/com/gyee/analysis/service/analysis/AnalysisNewService.java

@@ -509,6 +509,7 @@ public class AnalysisNewService {
      * @param endDate
      */
     public void saveWindProject(String beginDate, String endDate) throws Exception {
+        //风场,
         Map<String, List<Meterpoint>> wpmeterMap = CacheContext.wpmeterMap;
         Map<String, Meterpoint> meterMap = CacheContext.meterMap;
         List<String> days = getDays(beginDate, endDate);

+ 54 - 0
realtime/generation-service/src/main/java/com/gyee/generation/service/AverageAndGeneratingService.java

@@ -65,6 +65,7 @@ public class AverageAndGeneratingService {
     public  void saveAvespeedAndAvepowerAndScada() throws Exception {
         init();
         List<PointData> resultList = new ArrayList<>();
+        String monthbenchPoints = Contant.monthbenchPoints;
         wpls.stream().forEach(wp->{
             List<Project> projects = wppromap.get(wp.getId());
             Map<String, Windpowerstationpointnew> wppointnewmap = wppointmap.get(wp.getId());
@@ -77,6 +78,7 @@ public class AverageAndGeneratingService {
             Windpowerstationpointnew fdlwppointnew = wppointnewmap.get(Contant.RFDL);
             Windpowerstationpointnew yfdlwppointnew = wppointnewmap.get(Contant.YFDL);
             Windpowerstationpointnew nfdlwppointnew = wppointnewmap.get(Contant.NFDL);
+            Windpowerstationpointnew fnlylwppointnew = wppointnewmap.get(Contant.FNLYL);
             List<PointData> projectavespeedList = new ArrayList<>();
             List<PointData> yprojectavespeedList = new ArrayList<>();
             List<PointData> nprojectavespeedList = new ArrayList<>();
@@ -98,6 +100,7 @@ public class AverageAndGeneratingService {
                 Windpowerstationpointnew fdlprojectpointnew = projectpointnewmap.get(Contant.RFDL);
                 Windpowerstationpointnew yfdlprojectpointnew = projectpointnewmap.get(Contant.YFDL);
                 Windpowerstationpointnew nfdlprojectpointnew = projectpointnewmap.get(Contant.NFDL);
+                Windpowerstationpointnew fnlylprojectpointnew = projectpointnewmap.get(Contant.FNLYL);
                 List<PointData> lineavespeedList = new ArrayList<>();
                 List<PointData> ylineavespeedList = new ArrayList<>();
                 List<PointData> nlineavespeedList = new ArrayList<>();
@@ -119,6 +122,7 @@ public class AverageAndGeneratingService {
                     Windpowerstationpointnew linefdlpointnew = linepointnewmap.get(Contant.RFDL);
                     Windpowerstationpointnew ylinefdlpointnew = linepointnewmap.get(Contant.YFDL);
                     Windpowerstationpointnew nlinefdlpointnew = linepointnewmap.get(Contant.NFDL);
+                    Windpowerstationpointnew linefnlylpointnew = linepointnewmap.get(Contant.FNLYL);
                     List<PointData> wtavespeedList = new ArrayList<>();
                     List<PointData> ywtavespeedList = new ArrayList<>();
                     List<PointData> nwtavespeedList = new ArrayList<>();
@@ -173,6 +177,7 @@ public class AverageAndGeneratingService {
                             rfdlList.add(fdlpointData);
 
                             PointData yfdlpointData = createPointData(fjyfdl, yfdl);
+
                             yfdlList.add(yfdlpointData);
 
                             PointData nfdlpointData = createPointData(fjnfdl, nfdl);
@@ -255,6 +260,23 @@ public class AverageAndGeneratingService {
                     ylinefdlList.add(yfdlpoint);
                     nlinefdlList.add(nfdlpoint);
 
+                    //算风能利用率
+
+                    List<String> pointList = new ArrayList<>();
+                    double ssdl = 0;
+                    Arrays.stream(monthbenchPoints.split(",")).forEach(code->{
+                        pointList.add(linepointnewmap.get(code).getCode());
+                    });
+                    try {
+                        List<PointData> ssdlList = edosUtil.getRealData(pointList);
+                        ssdl = ssdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                    double fnlyl = (ssdl+lineyfdl)!=0?lineyfdl/(ssdl+lineyfdl):0;
+                    PointData fnlylpoint = createWpPointData(linefnlylpointnew, fnlyl);
+                    resultList.add(fnlylpoint);
+
                     OptionalDouble average = wtavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
                     if (average.isPresent()){
                         double linespeed = average.getAsDouble();
@@ -302,6 +324,22 @@ public class AverageAndGeneratingService {
                 resultList.addAll(ylinefdlList);
                 resultList.addAll(nlinefdlList);
 
+                //算风能利用率
+                List<String> pointList = new ArrayList<>();
+                double ssdl = 0;
+                Arrays.stream(monthbenchPoints.split(",")).forEach(code->{
+                    pointList.add(projectpointnewmap.get(code).getCode());
+                });
+                try {
+                    List<PointData> ssdlList = edosUtil.getRealData(pointList);
+                    ssdl = ssdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                double fnlyl = (ssdl+proyfdl)!=0?proyfdl/(ssdl+proyfdl):0;
+                PointData fnlylpoint = createWpPointData(fnlylprojectpointnew, fnlyl);
+                resultList.add(fnlylpoint);
+
                 PointData rfdlpointData = createWpPointData(fdlprojectpointnew, prorfdl);
                 PointData yfdlpointData = createWpPointData(yfdlprojectpointnew, proyfdl);
                 PointData nfdlpointData = createWpPointData(nfdlprojectpointnew, pronfdl);
@@ -346,6 +384,22 @@ public class AverageAndGeneratingService {
             PointData yfdlpointData = createWpPointData(yfdlwppointnew, fcyfdl);
             resultList.add(yfdlpointData);
 
+            //算风能利用率
+            List<String> pointList = new ArrayList<>();
+            double ssdl = 0;
+            Arrays.stream(monthbenchPoints.split(",")).forEach(code->{
+                pointList.add(wppointnewmap.get(code).getCode());
+            });
+            try {
+                List<PointData> ssdlList = edosUtil.getRealData(pointList);
+                ssdl = ssdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            double fnlyl = (ssdl+fcyfdl)!=0?fcyfdl/(ssdl+fcyfdl):0;
+            PointData fnlylpoint = createWpPointData(fnlylwppointnew, fnlyl);
+            resultList.add(fnlylpoint);
+
             double fcnfdl = projectnfdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
             PointData nfdlpointData = createWpPointData(nfdlwppointnew, fcnfdl);
             resultList.add(nfdlpointData);

+ 32 - 10
realtime/generation-service/src/main/java/com/gyee/generation/service/FiveLossesService.java

@@ -649,15 +649,23 @@ public class FiveLossesService {
                     double bzgl = bzglDatasSnap.get(i).getPointValueInDouble();
                     double zsgl = zsglDatasSnap.get(i).getPointValueInDouble();
                     double power = powerDatasSnap.get(i).getPointValueInDouble();
-                    bzss += (bzgl-power);
-                    zsss += (zsgl-power);
+                    double temp = bzgl - power;
+                    if (temp>0){
+                        bzss+=temp;
+                    }
+                    double temp1 = zsgl - power;
+                    if (temp1>0){
+                        zsss+=temp1;
+                    }
+//                    bzss += (bzgl-power<0?0:bzgl-power);
+//                    zsss += (zsgl-power<0?0:zsgl-power);
                 }
             }
         }
 
 
-        bzss = bzss /60;
-        zsss = zsss/60;
+        bzss = bzss /60>=0?bzss/60:0;
+        zsss = zsss/60>=0?zsss/60:0;
         //待有历史改为用自算损失
         PointData wtPointData = createWtPointData(point, zsss);
         resultList.add(wtPointData);
@@ -825,8 +833,16 @@ public class FiveLossesService {
                         double bzgl = bzglDatasSnap.get(i).getPointValueInDouble();
                         double zsgl = zsglDatasSnap.get(i).getPointValueInDouble();
                         double power = powerDatasSnap.get(i).getPointValueInDouble();
-                        bzss += (bzgl-power);
-                        zsss += (zsgl-power);
+                        double temp = bzgl - power;
+                        if (temp>0){
+                            bzss+=temp;
+                        }
+                        double temp1 = zsgl - power;
+                        if (temp1>0){
+                            zsss+=temp1;
+                        }
+//                        bzss += (bzgl-power<0?0:bzgl-power);
+//                        zsss += (zsgl-power<0?0:zsgl-power);
                     }
                 }
             }
@@ -836,14 +852,20 @@ public class FiveLossesService {
                     if (pointDataList.get(j).getPointTime().equals(ztmxDatasSnap.get(i).getPointTime())){
                         double bzgl = bzglDatasSnap.get(i).getPointValueInDouble();
                         double zsgl = zsglDatasSnap.get(i).getPointValueInDouble();
-                        bzss += bzgl;
-                        zsss += zsgl;
+                        if (bzgl>0){
+                            bzss+=bzgl;
+                        }
+                        if (zsgl>0){
+                            zsss+=zsgl;
+                        }
+//                        bzss += bzgl<0?0:bzgl;
+//                        zsss += zsgl<0?0:zsgl;
                     }
                 }
             }
         }
-        bzss = bzss /60;
-        zsss = zsss/60;
+        bzss = bzss /60>=0?bzss/60:0;
+        zsss = zsss/60>=0?zsss/60:0;
         //待有历史改为用自算损失
         PointData wtPointData = createWtPointData(point, zsss);
         resultList.add(wtPointData);

+ 82 - 0
realtime/generation-service/src/main/java/com/gyee/generation/service/SafetyService.java

@@ -0,0 +1,82 @@
+package com.gyee.generation.service;
+
+import com.gyee.common.contant.Contant;
+import com.gyee.common.model.PointData;
+import com.gyee.common.util.DateUtils;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.Line;
+import com.gyee.generation.model.auto.Project;
+import com.gyee.generation.model.auto.Windpowerstation;
+import com.gyee.generation.model.auto.Windpowerstationpointnew;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : SafetyService
+ * @Author : xieshengjie
+ * @Date: 2022/5/30 15:10
+ * @Description : 安全天数
+ */
+@Service
+public class SafetyService {
+    @Resource
+    private IEdosUtil edosUtil;
+
+    private Date currentDate;
+
+    public void safetyReatimel() throws Exception {
+        List<PointData> resultList = new ArrayList<>();
+        List<Windpowerstation> wpls = CacheContext.wpls;
+        Map<String, Map<String, Windpowerstationpointnew>> wppointmap = CacheContext.wppointmap;
+        Map<String, Map<String, Windpowerstationpointnew>> propointmap = CacheContext.propointmap;
+        Map<String, List<Project>> wppromap = CacheContext.wppromap;
+        Map<String, Map<String, Windpowerstationpointnew>> linepointmap = CacheContext.linepointmap;
+        Map<String, List<Line>> prolinemap = CacheContext.prolinemap;
+        wpls.stream().forEach(wp->{
+            Windpowerstationpointnew windpowerstationpointnew = wppointmap.get(wp.getId()).get(Contant.AQTS);
+            double aqts = 0;
+            try {
+                double doublevalue = edosUtil.getRealData(windpowerstationpointnew).getPointValueInDouble();
+                aqts = doublevalue+1;
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            PointData wpPointData = createWpPointData(windpowerstationpointnew, aqts);
+            resultList.add(wpPointData);
+            List<Project> projects = wppromap.get(wp.getId());
+            double finalAqts = aqts;
+            double finalAqts1 = aqts;
+            projects.stream().forEach(project -> {
+                Windpowerstationpointnew windpowerstationpointnew1 = propointmap.get(project.getId()).get(Contant.AQTS);
+                PointData proPointData = createWpPointData(windpowerstationpointnew1, finalAqts);
+                resultList.add(proPointData);
+                List<Line> lineList = prolinemap.get(project.getId());
+                lineList.stream().forEach(line -> {
+                    Windpowerstationpointnew windpowerstationpointnew2 = linepointmap.get(line.getId()).get(Contant.AQTS);
+                    PointData linePointData = createWpPointData(windpowerstationpointnew2, finalAqts1);
+                    resultList.add(linePointData);
+                });
+            });
+
+        });
+        edosUtil.sendMultiPoint(resultList);
+    }
+
+
+    private PointData createWpPointData(Windpowerstationpointnew linepointnew, double linespeed) {
+        currentDate = DateUtils.getSamedayZero();
+        PointData pointData = new PointData();
+        pointData.setEdnaId(linepointnew.getCode());
+        pointData.setPointTime(currentDate.getTime());
+        pointData.setPointName(linepointnew.getName());
+        pointData.setPointValue(String.valueOf(linespeed));
+        pointData.setPointValueInDouble(linespeed);
+        return pointData;
+    }
+}

+ 0 - 69
realtime/generation-service/src/main/java/com/gyee/generation/service/UnderissuanceService.java

@@ -1,69 +0,0 @@
-package com.gyee.generation.service;
-
-import com.gyee.common.contant.Contant;
-import com.gyee.common.util.DateUtils;
-import com.gyee.generation.init.CacheContext;
-import com.gyee.generation.model.auto.Windturbine;
-import com.gyee.generation.model.auto.Windturbinetestingpointnew;
-import com.gyee.generation.util.realtimesource.IEdosUtil;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @ClassName : UnderissuanceService
- * @Author : xieshengjie
- * @Date: 2022/5/7 10:34
- * @Description : 欠发
- */
-@Service
-public class UnderissuanceService {
-    @Resource
-    private IEdosUtil edosUtil;
-    private List<Windturbine> wtls;
-    private Map<String, Map<String, Windturbinetestingpointnew>> wtpAimap;
-    private Date samedayZero;
-    private Date currentDate;
-    private Date tomorrow;
-
-    private void init(){
-        wtls = CacheContext.wtls;
-        wtpAimap = CacheContext.wtpAimap;
-        samedayZero = DateUtils.getSamedayZero();
-        currentDate = DateUtils.getCurrentDate();
-        tomorrow = DateUtils.addDays(samedayZero,1);
-    }
-    /**
-     * 计算风机欠发状态
-     * //                if (zt == GdnxfdTarget.statusMx.待机 || zt == GdnxfdTarget.statusMx.手动停机 || zt == GdnxfdTarget.statusMx.发电降出力 || zt == GdnxfdTarget.statusMx.正常发电
-     * //                        || zt == GdnxfdTarget.statusMx.限电停机 || zt == GdnxfdTarget.statusMx.限电降出力 || zt == GdnxfdTarget.statusMx.环境受累)
-     */
-    public void underissuanceStatus(){
-        init();
-        wtls.stream().forEach(wt->{
-            Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
-            Windturbinetestingpointnew ztmxPoint = windturbinetestingpointnewMap.get(Contant.ZTMX);
-            Windturbinetestingpointnew zsglPoint = windturbinetestingpointnewMap.get(Contant.ZSGL);
-            Windturbinetestingpointnew powerPoint = windturbinetestingpointnewMap.get(Contant.AI130);
-            double ztmxValue = 0.0;
-            double zsglValue = 0.0;
-            double powerValue = 0.0;
-            try {
-                ztmxValue = edosUtil.getSectionData(ztmxPoint,tomorrow.getTime()).getPointValueInDouble();
-                zsglValue = edosUtil.getSectionData(zsglPoint,tomorrow.getTime()).getPointValueInDouble();
-                powerValue = edosUtil.getSectionData(powerPoint,tomorrow.getTime()).getPointValueInDouble();
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            double[] underissuanceArray = {0,1,2,3,4,5,11};
-            if (Arrays.asList(underissuanceArray).contains(ztmxValue)){
-
-            }
-        });
-
-    }
-}

+ 25 - 6
realtime/generation-service/src/main/java/com/gyee/generation/task/SaticScheduleTask.java

@@ -34,6 +34,8 @@ public class SaticScheduleTask {
     private TheorypowerService theorypowerService;
     @Resource
     private FiveLossesService fiveLossesService;
+    @Resource
+    private SafetyService safetyService;
     //3.添加定时任务
     /**
      * 电计量实时计算计算(电量,上网,购网,场用)
@@ -81,6 +83,7 @@ public class SaticScheduleTask {
         String yesterdayStr = DateUtils.getYesterdayStr("yyyy-MM-dd");
         try {
             generationService.saveMeterpointValueRealtime(yesterdayStr,yesterdayStr);
+
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -91,15 +94,16 @@ public class SaticScheduleTask {
     /**
      * 实时状态计算
      * 只执行一次(死循环)
+     * 2s
      */
     @XxlJob("status-realtime")
     public void status() throws Exception {
-        while(true){
+//        while(true){
             XxlJobHelper.log("实时状态调度程序执行开始!........");
             statusService.calculateStatus();
             statusService.calculateStatusNumber();
             XxlJobHelper.log("实时状态调度程序执行完成!........");
-        }
+//        }
 
     }
 
@@ -117,14 +121,15 @@ public class SaticScheduleTask {
     /**
      * 实时风速功率
      * 只执行一次(死循环)
+     * 2s
      */
     @XxlJob("speedAndPower-realtime")
     public void speedAndPower() throws Exception {
-        while (true){
+//        while (true){
             XxlJobHelper.log("实时风速,实时功率调度程序执行开始!........");
             realtimeSpeedPowerService.calculateRealtimeSpeedPower();
             XxlJobHelper.log("实时风速,实时功率调度程序执行完成!........");
-        }
+//        }
     }
 
     /**
@@ -143,21 +148,23 @@ public class SaticScheduleTask {
     /**
      * 计算理论功率,保证功率
      * 死循环
+     * 10min
      * @throws Exception
      */
     @XxlJob("theropower-realtime")
     public void theropower() throws Exception {
-        while (true){
+//        while (true){
             XxlJobHelper.log("理论保证功率调度程序执行开始!........");
             theorypowerService.theropower();
             XxlJobHelper.log("理论保证功率调度程序执行完成!........");
-        }
+//        }
 
     }
 
     /**
      * 计算损失电量
      * 1小时一次(*:20)
+     * 30min
      * @throws Exception
      */
     @XxlJob("losses-realtime")
@@ -167,6 +174,18 @@ public class SaticScheduleTask {
             XxlJobHelper.log("损失电量调度程序执行完成!........");
     }
 
+    /**
+     * 安全天数
+     * 每日0点
+     * @throws Exception
+     */
+    @XxlJob("safe-realtime")
+    public void safety() throws Exception {
+        XxlJobHelper.log("安全天数调度程序执行开始!........");
+        safetyService.safetyReatimel();
+        XxlJobHelper.log("安全天数调度程序执行完成!........");
+    }
+
 
 
 }

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

@@ -1,5 +1,5 @@
 server:
-  port: 7011
+  port: 7012
   servlet:
     context-path: /
 

+ 5 - 1
realtime/generation-service/src/test/java/com/gyee/generation/GenerationTest.java

@@ -44,16 +44,20 @@ public class GenerationTest {
     private RedisService redisService;
     @Resource
     private FiveLossesService fiveLossesService;
+    @Resource
+    private SafetyService safetyService;
     @Test
     public void test1() throws Exception {
 //        averageAndGeneratingService.saveAvespeedAndAvepowerAndScada();
-        statusService.calculateStatusNumber();
+//        statusService.calculateStatusNumber();
 //        realtimeSpeedPowerService.calculateRealtimeSpeedPower();
 //        generationService.saveMeterpointValueRealtime();
 //        theorypowerService.fittingPower();
 //        theorypowerService.theropower();
 //        averageAndGeneratingService.saveAvespeedAndAvepowerAndScada();
 //        fiveLossesService.lossesReal();
+//        safetyService.safetyReatimel();
+        fiveLossesService.lossesReal();
     }
 
 

+ 107 - 0
realtime/generationregion-service/pom.xml

@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>realtime</artifactId>
+        <groupId>com.gyee</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>generationregion-service</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.oracle</groupId>
+            <artifactId>ojdbc6</artifactId>
+            <version>11.2.0.3</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.freemarker</groupId>
+            <artifactId>freemarker</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.17</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.gyee</groupId>
+            <artifactId>common</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+        <!-- ********************** plugin ********************** -->
+        <!-- groovy-all -->
+        <dependency>
+            <groupId>org.codehaus.groovy</groupId>
+            <artifactId>groovy</artifactId>
+        </dependency>
+        <!-- xxl-job-core -->
+        <dependency>
+            <groupId>com.xuxueli</groupId>
+            <artifactId>xxl-job-core</artifactId>
+            <version>2.3.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-all</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 20 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/RegionrealtimeMain.java

@@ -0,0 +1,20 @@
+package com.gyee.regionrealtime;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @ClassName : RegionrealtimeMain
+ * @Author : xieshengjie
+ * @Date: 2022/5/20 15:28
+ * @Description :
+ */
+@SpringBootApplication
+@MapperScan("com.gyee.regionrealtime.mapper")
+public class RegionrealtimeMain {
+
+    public static void main(String[] args) {
+        SpringApplication.run(RegionrealtimeMain.class,args);
+    }
+}

+ 148 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/config/GeneratorCodeConfig.java

@@ -0,0 +1,148 @@
+package com.gyee.regionrealtime.config;
+
+
+import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.generator.AutoGenerator;
+import com.baomidou.mybatisplus.generator.config.*;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
+
+import java.util.Scanner;
+
+/**
+ *@ClassName GeneratorCodeConfig
+ *@Description 自动生成mybatisplus的相关代码
+ *@Author 谢生杰
+ *@Date 2020/9/25 18:26
+ *@Version 1.0
+ **/
+public class GeneratorCodeConfig {
+    public static String scanner(String tip) {
+        Scanner scanner = new Scanner(System.in);
+        StringBuilder help = new StringBuilder();
+        help.append("请输入" + tip + ":");
+        System.out.println(help.toString());
+        if (scanner.hasNext()) {
+            String ipt = scanner.next();
+            if (StringUtils.isNotEmpty(ipt)) {
+                return ipt;
+            }
+        }
+        throw new MybatisPlusException("请输入正确的" + tip + "!");
+    }
+
+    public static void main(String[] args) {
+        // 代码生成器
+        AutoGenerator mpg = new AutoGenerator();
+
+        // 全局配置
+        GlobalConfig gc = new GlobalConfig();
+        String projectPath = System.getProperty("user.dir");
+        gc.setOutputDir(projectPath + "/src/main/java");
+        gc.setAuthor("谢生杰");
+        gc.setOpen(false);
+        //实体属性 Swagger2 注解
+        gc.setSwagger2(false);
+        mpg.setGlobalConfig(gc);
+
+        // 数据源配置
+        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.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.setUsername("gdprod");
+        dsc.setPassword("gd123");
+        dsc.setUrl("jdbc:postgresql://10.81.3.151:5432/wisdom");
+        mpg.setDataSource(dsc);
+
+
+
+        // 包配置
+        PackageConfig pc = new PackageConfig();
+//        pc.setModuleName(scanner("模块名"));
+        pc.setParent("com.gyee.regionrealtime");
+        pc.setEntity("model.auto");
+        pc.setMapper("mapper.auto");
+        pc.setService("service.auto");
+        pc.setServiceImpl("service.auto.impl");
+        mpg.setPackageInfo(pc);
+
+        // 自定义配置
+//        InjectionConfig cfg = new InjectionConfig() {
+//            @Override
+//            public void initMap() {
+//                // to do nothing
+//            }
+//        };
+
+        // 如果模板引擎是 freemarker
+//        String templatePath = "/templates/mapper.xml.ftl";
+        // 如果模板引擎是 velocity
+        // String templatePath = "/templates/mapper.xml.vm";
+
+        // 自定义输出配置
+//        List<FileOutConfig> focList = new ArrayList<>();
+        // 自定义配置会被优先输出
+//        focList.add(new FileOutConfig(templatePath) {
+//            @Override
+//            public String outputFile(TableInfo tableInfo) {
+//                // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
+//                return projectPath + "/src/main/resources/mapper/" + pc.getModuleName()
+//                        + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
+//            }
+//        });
+        /*
+        cfg.setFileCreate(new IFileCreate() {
+            @Override
+            public boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath) {
+                // 判断自定义文件夹是否需要创建
+                checkDir("调用默认方法创建的目录");
+                return false;
+            }
+        });
+        */
+//        cfg.setFileOutConfigList(focList);
+//        mpg.setCfg(cfg);
+
+        // 配置模板
+        TemplateConfig templateConfig = new TemplateConfig();
+
+        // 配置自定义输出模板
+        //指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
+        // templateConfig.setEntity("templates/entity2.java");
+        // templateConfig.setService();
+        // templateConfig.setController();
+
+        templateConfig.setXml(null);
+        mpg.setTemplate(templateConfig);
+
+        // 策略配置
+        StrategyConfig strategy = new StrategyConfig();
+        strategy.setNaming(NamingStrategy.underline_to_camel);
+        strategy.setColumnNaming(NamingStrategy.underline_to_camel);
+        strategy.setSuperEntityClass("com.baomidou.mybatisplus.extension.activerecord.Model");
+        strategy.setEntityLombokModel(true);
+        strategy.setRestControllerStyle(true);
+
+        strategy.setEntityLombokModel(true);
+        // 公共父类
+//        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
+        // 写于父类中的公共字段
+//        strategy.setSuperEntityColumns("id");
+        strategy.setInclude(scanner("表名,多个英文逗号分割").split(","));
+        strategy.setControllerMappingHyphenStyle(true);
+        strategy.setTablePrefix(pc.getModuleName() + "_");
+        mpg.setStrategy(strategy);
+        mpg.setTemplateEngine(new FreemarkerTemplateEngine());
+        mpg.execute();
+    }
+}

+ 68 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/config/XxlJobConfig.java

@@ -0,0 +1,68 @@
+package com.gyee.regionrealtime.config;
+
+
+import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.EnvironmentAware;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+
+/**
+ * xxl-job config
+ *
+ * @author xuxueli 2017-04-28
+ */
+
+
+@Configuration
+@PropertySource("classpath:xxl-job-executor.properties")
+public class XxlJobConfig implements EnvironmentAware {
+    private Environment env;
+
+
+    @Override
+    public void setEnvironment(Environment environment) {
+        this.env=environment;
+    }
+
+    private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
+
+
+
+    @Bean
+    public XxlJobSpringExecutor xxlJobExecutor() {
+    logger.info(">>>>>>>>>>> xxl-job config init.");
+    XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
+    xxlJobSpringExecutor.setAdminAddresses(env.getProperty("xxl.job.admin.addresses"));
+    xxlJobSpringExecutor.setAppname(env.getProperty("xxl.job.executor.appname"));
+    xxlJobSpringExecutor.setAddress(env.getProperty("xxl.job.executor.address"));
+    xxlJobSpringExecutor.setIp(env.getProperty("xxl.job.executor.ip"));
+    xxlJobSpringExecutor.setPort(Integer.parseInt(env.getProperty("xxl.job.executor.port")));
+    xxlJobSpringExecutor.setAccessToken(env.getProperty("xxl.job.accessToken"));
+    xxlJobSpringExecutor.setLogPath(env.getProperty("xxl.job.executor.logpath"));
+    xxlJobSpringExecutor.setLogRetentionDays(Integer.parseInt(env.getProperty("xxl.job.executor.logretentiondays")));
+    return xxlJobSpringExecutor;
+    }
+
+    /**
+    * 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
+    *
+    *      1、引入依赖:
+    *          <dependency>
+    *             <groupId>org.springframework.cloud</groupId>
+    *             <artifactId>spring-cloud-commons</artifactId>
+    *             <version>${version}</version>
+    *         </dependency>
+    *
+    *      2、配置文件,或者容器启动变量
+    *          spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
+    *
+    *      3、获取IP
+    *          String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
+    */
+
+
+}

+ 20 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/controller/RegionController.java

@@ -0,0 +1,20 @@
+package com.gyee.regionrealtime.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@RestController
+@RequestMapping("//region")
+public class RegionController {
+
+}

+ 20 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/controller/RegionsController.java

@@ -0,0 +1,20 @@
+package com.gyee.regionrealtime.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@RestController
+@RequestMapping("//regions")
+public class RegionsController {
+
+}

+ 20 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/controller/WindpowerstationController.java

@@ -0,0 +1,20 @@
+package com.gyee.regionrealtime.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@RestController
+@RequestMapping("//windpowerstation")
+public class WindpowerstationController {
+
+}

+ 20 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/controller/WindpowerstationpointnewController.java

@@ -0,0 +1,20 @@
+package com.gyee.regionrealtime.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@RestController
+@RequestMapping("//windpowerstationpointnew")
+public class WindpowerstationpointnewController {
+
+}

+ 20 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/controller/WindturbinetestingpointnewController.java

@@ -0,0 +1,20 @@
+package com.gyee.regionrealtime.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@RestController
+@RequestMapping("//windturbinetestingpointnew")
+public class WindturbinetestingpointnewController {
+
+}

+ 102 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/init/CacheContext.java

@@ -0,0 +1,102 @@
+package com.gyee.regionrealtime.init;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.gyee.regionrealtime.model.auto.Regions;
+import com.gyee.regionrealtime.model.auto.Windpowerstation;
+import com.gyee.regionrealtime.model.auto.Windpowerstationpointnew;
+import com.gyee.regionrealtime.service.auto.IRegionsService;
+import com.gyee.regionrealtime.service.auto.IWindpowerstationService;
+import com.gyee.regionrealtime.util.redis.RedisService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : CacheContext
+ * @Author : xieshengjie
+ * @Date: 2021/5/18 9:35
+ * @Description : 缓存
+ */
+@Component
+public class CacheContext implements CommandLineRunner {
+    Logger logger = LoggerFactory.getLogger(CacheContext.class);
+    @Resource
+    private IWindpowerstationService windpowerstationService;
+    @Resource
+    private IRegionsService regionsService;
+
+    @Resource
+    private RedisService redisService;
+
+
+
+    public static Map<String,Map<String, Windpowerstationpointnew>> wppointmap =new HashMap<>();
+
+    public static List<Windpowerstation> wpls = new ArrayList<>();
+    public static List<Regions> regions = new ArrayList<>();
+
+    @Override
+    public void run(String... args) throws Exception {
+        logger.info("缓存开始------------------------------------------------------------");
+
+        wpls = windpowerstationService.list();
+
+        regions = regionsService.list();
+
+        regions.stream().forEach(region -> {
+            String region0 = region.getId() + "0";
+            String region1 = region.getId() + "-1";
+            String region2 = region.getId() + "-2";
+
+            String region0String = redisService.get(region0);
+            Map<String, Windpowerstationpointnew> region0Map = JSONObject.parseObject(region0String, new TypeReference<Map<String, Windpowerstationpointnew>>() {
+            });
+            wppointmap.put(region0,region0Map);
+
+            String region1String = redisService.get(region1);
+            Map<String, Windpowerstationpointnew> region1Map = JSONObject.parseObject(region1String, new TypeReference<Map<String, Windpowerstationpointnew>>() {
+            });
+            wppointmap.put(region1,region1Map);
+
+            String region2String = redisService.get(region2);
+            Map<String, Windpowerstationpointnew> region2Map = JSONObject.parseObject(region2String, new TypeReference<Map<String, Windpowerstationpointnew>>() {
+            });
+            wppointmap.put(region2,region2Map);
+
+
+        });
+        String jt0 = redisService.get("QY0");
+        Map<String, Windpowerstationpointnew> jt0Map = JSONObject.parseObject(jt0, new TypeReference<Map<String, Windpowerstationpointnew>>() {
+        });
+        wppointmap.put("QY0",jt0Map);
+
+        String jt1 = redisService.get("QY-1");
+        Map<String, Windpowerstationpointnew> jt1Map = JSONObject.parseObject(jt1, new TypeReference<Map<String, Windpowerstationpointnew>>() {
+        });
+        wppointmap.put("QY-1",jt1Map);
+
+        String jt2 = redisService.get("QY-2");
+        Map<String, Windpowerstationpointnew> jt2Map = JSONObject.parseObject(jt2, new TypeReference<Map<String, Windpowerstationpointnew>>() {
+        });
+        wppointmap.put("QY-2",jt2Map);
+
+        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);
+        });
+
+
+        logger.info("缓存结束------------------------------------------------------------");
+    }
+}

+ 16 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/mapper/auto/RegionMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.regionrealtime.mapper.auto;
+
+import com.gyee.regionrealtime.model.auto.Region;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+public interface RegionMapper extends BaseMapper<Region> {
+
+}

+ 16 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/mapper/auto/RegionsMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.regionrealtime.mapper.auto;
+
+import com.gyee.regionrealtime.model.auto.Regions;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+public interface RegionsMapper extends BaseMapper<Regions> {
+
+}

+ 16 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/mapper/auto/WindpowerstationMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.regionrealtime.mapper.auto;
+
+import com.gyee.regionrealtime.model.auto.Windpowerstation;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+public interface WindpowerstationMapper extends BaseMapper<Windpowerstation> {
+
+}

+ 16 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/mapper/auto/WindpowerstationpointnewMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.regionrealtime.mapper.auto;
+
+import com.gyee.regionrealtime.model.auto.Windpowerstationpointnew;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+public interface WindpowerstationpointnewMapper extends BaseMapper<Windpowerstationpointnew> {
+
+}

+ 16 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/mapper/auto/WindturbinetestingpointnewMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.regionrealtime.mapper.auto;
+
+import com.gyee.regionrealtime.model.auto.Windturbinetestingpointnew;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+public interface WindturbinetestingpointnewMapper extends BaseMapper<Windturbinetestingpointnew> {
+
+}

+ 28 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/model/auto/Region.java

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

+ 28 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/model/auto/Regions.java

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

+ 62 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/model/auto/Windpowerstation.java

@@ -0,0 +1,62 @@
+package com.gyee.regionrealtime.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class Windpowerstation extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String code;
+
+    private String name;
+
+    private String address;
+
+    private String telephone;
+
+    private Double capacity;
+
+    private String capacityunit;
+
+    private Double quantity;
+
+    private String aname;
+
+    private Double longitude;
+
+    private Double latitude;
+
+    private String photo;
+
+    private String companyid;
+
+    private String systemmanufact;
+
+    private String headfarm;
+
+    private String headfarmphone;
+
+    private String model;
+
+    private Double ordernum;
+
+    private Double altitude;
+
+    private Double height;
+
+
+}

+ 56 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/model/auto/Windpowerstationpointnew.java

@@ -0,0 +1,56 @@
+package com.gyee.regionrealtime.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class Windpowerstationpointnew extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String code;
+
+    private String name;
+
+    private String model;
+
+    private String valueunit;
+
+    private String englishname;
+
+    private String typeid;
+
+    private String modelid;
+
+    private Double maxval;
+
+    private Double minval;
+
+    private Double reasonablemaxval;
+
+    private Double reasonableminval;
+
+    private String uniformcode;
+
+    private String shortid;
+
+    private String longid;
+
+    private String windpowerstationid;
+
+    private String realtimeid;
+
+
+}

+ 58 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/model/auto/Windturbinetestingpointnew.java

@@ -0,0 +1,58 @@
+package com.gyee.regionrealtime.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class Windturbinetestingpointnew extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String code;
+
+    private String name;
+
+    private String model;
+
+    private String valueunit;
+
+    private String englishname;
+
+    private String typeid;
+
+    private String modelid;
+
+    private Double maxval;
+
+    private Double minval;
+
+    private Double reasonablemaxval;
+
+    private Double reasonableminval;
+
+    private String windturbineid;
+
+    private String uniformcode;
+
+    private String shortid;
+
+    private String longid;
+
+    private String windpowerstationid;
+
+    private String realtimeid;
+
+
+}

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 2145 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/RegionRealtimeService.java


+ 16 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/IRegionService.java

@@ -0,0 +1,16 @@
+package com.gyee.regionrealtime.service.auto;
+
+import com.gyee.regionrealtime.model.auto.Region;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+public interface IRegionService extends IService<Region> {
+
+}

+ 16 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/IRegionsService.java

@@ -0,0 +1,16 @@
+package com.gyee.regionrealtime.service.auto;
+
+import com.gyee.regionrealtime.model.auto.Regions;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+public interface IRegionsService extends IService<Regions> {
+
+}

+ 16 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/IWindpowerstationService.java

@@ -0,0 +1,16 @@
+package com.gyee.regionrealtime.service.auto;
+
+import com.gyee.regionrealtime.model.auto.Windpowerstation;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+public interface IWindpowerstationService extends IService<Windpowerstation> {
+
+}

+ 16 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/IWindpowerstationpointnewService.java

@@ -0,0 +1,16 @@
+package com.gyee.regionrealtime.service.auto;
+
+import com.gyee.regionrealtime.model.auto.Windpowerstationpointnew;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+public interface IWindpowerstationpointnewService extends IService<Windpowerstationpointnew> {
+
+}

+ 16 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/IWindturbinetestingpointnewService.java

@@ -0,0 +1,16 @@
+package com.gyee.regionrealtime.service.auto;
+
+import com.gyee.regionrealtime.model.auto.Windturbinetestingpointnew;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+public interface IWindturbinetestingpointnewService extends IService<Windturbinetestingpointnew> {
+
+}

+ 20 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/impl/RegionServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.regionrealtime.service.auto.impl;
+
+import com.gyee.regionrealtime.model.auto.Region;
+import com.gyee.regionrealtime.mapper.auto.RegionMapper;
+import com.gyee.regionrealtime.service.auto.IRegionService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@Service
+public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> implements IRegionService {
+
+}

+ 20 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/impl/RegionsServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.regionrealtime.service.auto.impl;
+
+import com.gyee.regionrealtime.model.auto.Regions;
+import com.gyee.regionrealtime.mapper.auto.RegionsMapper;
+import com.gyee.regionrealtime.service.auto.IRegionsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@Service
+public class RegionsServiceImpl extends ServiceImpl<RegionsMapper, Regions> implements IRegionsService {
+
+}

+ 20 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/impl/WindpowerstationServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.regionrealtime.service.auto.impl;
+
+import com.gyee.regionrealtime.model.auto.Windpowerstation;
+import com.gyee.regionrealtime.mapper.auto.WindpowerstationMapper;
+import com.gyee.regionrealtime.service.auto.IWindpowerstationService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@Service
+public class WindpowerstationServiceImpl extends ServiceImpl<WindpowerstationMapper, Windpowerstation> implements IWindpowerstationService {
+
+}

+ 20 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/impl/WindpowerstationpointnewServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.regionrealtime.service.auto.impl;
+
+import com.gyee.regionrealtime.model.auto.Windpowerstationpointnew;
+import com.gyee.regionrealtime.mapper.auto.WindpowerstationpointnewMapper;
+import com.gyee.regionrealtime.service.auto.IWindpowerstationpointnewService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@Service
+public class WindpowerstationpointnewServiceImpl extends ServiceImpl<WindpowerstationpointnewMapper, Windpowerstationpointnew> implements IWindpowerstationpointnewService {
+
+}

+ 20 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/service/auto/impl/WindturbinetestingpointnewServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.regionrealtime.service.auto.impl;
+
+import com.gyee.regionrealtime.model.auto.Windturbinetestingpointnew;
+import com.gyee.regionrealtime.mapper.auto.WindturbinetestingpointnewMapper;
+import com.gyee.regionrealtime.service.auto.IWindturbinetestingpointnewService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-19
+ */
+@Service
+public class WindturbinetestingpointnewServiceImpl extends ServiceImpl<WindturbinetestingpointnewMapper, Windturbinetestingpointnew> implements IWindturbinetestingpointnewService {
+
+}

+ 48 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/task/SaticScheduleTask.java

@@ -0,0 +1,48 @@
+package com.gyee.regionrealtime.task;
+
+
+import com.gyee.regionrealtime.service.RegionRealtimeService;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+/**
+ * @ClassName : SaticScheduleTask
+ * @Description : 调度
+ */
+
+
+@Component
+public class SaticScheduleTask {
+
+    private static Logger logger = LoggerFactory.getLogger(SaticScheduleTask.class);
+    @Resource
+    private RegionRealtimeService regionRealtimeService;
+    //3.添加定时任务
+
+
+    @XxlJob("region-realtime")
+    public void regionRealtime()  {
+        XxlJobHelper.log("区域公司实时调度程序执行开始!........");
+        try {
+            regionRealtimeService.regionRealtime("-1");
+            regionRealtimeService.regionRealtime("-2");
+            regionRealtimeService.regionRealtime("0");
+
+            regionRealtimeService.groupRealtime("-1");
+            regionRealtimeService.groupRealtime("-2");
+            regionRealtimeService.groupRealtime("0");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        XxlJobHelper.log("区域公司实时调度任务处理完成!........");
+    }
+
+
+
+
+}

+ 48 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/ApiGolden.java

@@ -0,0 +1,48 @@
+/** 
+ * Project Name:nxfd2 
+ * File Name:ApiEdos.java 
+ * Package Name:com.gyee.frame.util
+ * Date:2016-7-25下午12:26:14 
+ * Copyright (c) 2016, chenzhou1025@126.com All Rights Reserved. 
+ * 
+ */
+
+package com.gyee.regionrealtime.util.realtimesource;
+
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * ClassName:ApiEdos <br/>
+ * Function: TODO ADD FUNCTION. <br/>
+ * Reason: TODO ADD REASON. <br/>
+ * Date: 2016-7-25 下午12:26:14 <br/>
+ * 
+ * @author 石林
+ * @version
+ * @since JDK 1.6
+ * @see
+ */
+public class ApiGolden {
+
+    private static RestTemplate restTemplate = null;
+
+  
+    private ApiGolden() {
+
+    }
+
+    public static RestTemplate getInstance() {
+    	
+    	
+
+        if (restTemplate == null) {
+        	
+        	restTemplate = new RestTemplate();
+
+        }
+
+        return restTemplate;
+
+    }
+
+}

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1316 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/EdosUtil.java


+ 27 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/GoldenConfig.java

@@ -0,0 +1,27 @@
+package com.gyee.regionrealtime.util.realtimesource;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * 读取项目相关配置
+ * 
+ * @author gyee
+ */
+
+@Configuration
+@ConfigurationProperties(prefix = "golden")
+public class GoldenConfig
+{
+    private static String baseURL;
+
+    public static String getBaseurl() {
+        return baseURL;
+    }
+
+    public  void setBaseurl(String baseURL) {
+        GoldenConfig.baseURL = baseURL;
+    }
+}
+
+

+ 262 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/IEdosUtil.java

@@ -0,0 +1,262 @@
+package com.gyee.regionrealtime.util.realtimesource;
+
+
+import com.gyee.common.model.DNAStatVal;
+import com.gyee.common.model.DNAVal;
+import com.gyee.common.model.PointData;
+import com.gyee.regionrealtime.model.auto.Windpowerstationpointnew;
+import com.gyee.regionrealtime.model.auto.Windturbinetestingpointnew;
+
+import java.util.List;
+import java.util.Map;
+
+
+public interface IEdosUtil {
+
+	/**
+	 * 通过风场测点获得测点实时数据
+	 * @param point 只是用了code字段,作为唯一标识
+	 * @return
+	 * @throws Exception
+	 */
+    public PointData getRealData(Windpowerstationpointnew point) throws Exception;
+
+
+    /**
+     * 通过风场测点获得测点切面数据
+     * @param point 只是用了code字段,作为唯一标识
+     * @param date 时间
+     * @return
+     * @throws Exception
+     */
+    public PointData getSectionData(String point,Long date) throws Exception;
+
+
+    /**
+     * 通过风场测点获得测点切面数据
+     * @param point 只是用了code字段,作为唯一标识
+     * @param date 时间
+     * @return
+     * @throws Exception
+     */
+    public PointData getSectionData(Windpowerstationpointnew point,Long date) throws Exception;
+
+    /**
+     * 通过风机测点获得测点切面数据
+     * @param point 只是用了code字段,作为唯一标识
+     * @param date 时间
+     * @return
+     * @throws Exception
+     */
+    public PointData getSectionData(Windturbinetestingpointnew point, Long date) throws Exception;
+
+    /**
+     * 通过风场测点获得测点历史快照数据
+     * @param point 只是用了code字段,作为唯一标识
+     * @param beginDate 开始时间(秒级)
+     * @param endDate 结束时间(秒级)
+     * @param count  点数
+     * @param pried  时间间隔
+     * @return
+     * @throws Exception
+     */
+    public List<PointData> getHistoryDatasSnap(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception;
+
+    /**
+     * 通过风场测点获得测点历史存储数据,存多少取多少
+     * @param point 只是用了code字段,作为唯一标识
+     * @param beginDate 开始时间(秒级)
+     * @param endDate 结束时间(秒级)
+     * @return
+     * @throws Exception
+     */
+    public List<PointData> getHistoryDatasRaw(Windpowerstationpointnew point, Long beginDate, Long endDate) throws Exception;
+
+    /**
+     * 通过风机测点获得测点实时数据
+     * @param point 只是用了id字段,作为唯一标识
+     * @return
+     * @throws Exception
+     */
+    public PointData getRealData(Windturbinetestingpointnew point) throws Exception;
+
+    /**
+     * 通过风机测点获得历史快照
+     * @param point  只是用了id字段,作为唯一标识
+     * @param  beginDate 开始时间(秒级)
+     * @param endDate 结束时间(秒级)
+     * @param count  点数
+     * @param pried  时间间隔
+     * @return
+     * @throws Exception
+     */
+    public List<PointData> getHistoryDatasSnap(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception;
+
+    /**
+     * 通过风机测点获得测点历史存储数据,存多少取多少
+     * @param point 只是用了id字段,作为唯一标识
+     * @param  beginDate 开始时间(秒级)
+     * @param endDate 结束时间(秒级)
+     * @return
+     * @throws Exception
+     */
+    public List<PointData> getHistoryDatasRaw(Windturbinetestingpointnew point, Long beginDate, Long endDate) throws Exception;
+
+
+    /**
+     * 通过风机测点获得测点实时数据
+     * @param pointid 测点编号
+     * @return
+     * @throws Exception
+     */
+    public PointData getRealData(String pointid) throws Exception;
+
+    /**
+     * 通过全局点名获得测点实时数据 读取多个点
+     * @param pointids 测点的数组
+     * @return 列表集合
+     * @throws Exception
+     */
+    public List<PointData> getRealData(String... pointids) throws Exception;
+    /**
+     * 通过全局点名获得测点实时数据 读取多个点
+     * @param pointids 测点的列表
+     * @return 列表集合
+     * @throws Exception
+     */
+    public List<PointData> getRealData(List<String> pointids) throws Exception;
+    /**
+     * 通过全局点名获得测点实时数据 读取多个点
+     * @param pointids 测点的数组
+     * @return Map集合
+     * @throws Exception
+     */
+    public Map<String,Double> getRealDataMap(String... pointids) throws Exception;
+
+    /**
+     * 通过全局点名获得历史数据快照
+     * @param pointid  全局点名
+     * @param beginDate 开始时间(秒级)
+     * @param endDate 结束时间(秒级)
+     * @param count  点数
+     * @param pried  时间间隔
+     * @return
+     * @throws Exception
+     */
+    public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate, Long count, Long pried) throws Exception;
+
+    /**
+     * 通过风机测点获得测点历史存储数据,存多少取多少
+     * @param pointid 全局点名
+     * @param  beginDate 开始时间(秒级)
+     * @param endDate 结束时间(秒级)
+     * @return
+     * @throws Exception
+     */
+    public List<PointData> getHistoryDatasRaw(String pointid, Long beginDate, Long endDate) throws Exception;
+
+
+    /**
+     * 通过风机测点获得测点指定时间周期的统计数据
+     * @param point 只是用了id字段,作为唯一标识
+     * @param  beginDate 开始时间(秒级)
+     * @param endDate 结束时间(秒级)
+     * @param count  点数
+     * @param pried  时间间隔
+     * @type 0、最大值。1、最小值。、平均值
+     * @return
+     * @throws Exception
+     */
+    public List<PointData> getHistStat(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception;
+
+    /**
+     * 通过风场测点获得测点指定时间周期的统计数据
+     * @param point 只是用了code字段,作为唯一标识
+     * @param  beginDate 开始时间(秒级)
+     * @param endDate 结束时间(秒级)
+     * @param count  点数
+     * @param pried  时间间隔
+     * @type 0、最大值。1、最小值。、平均值
+     * @return
+     * @throws Exception
+     */
+    public List<PointData> getHistStat(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception;
+
+    /**
+     * 通过全局点名获得测点指定时间周期的统计数据
+     * @param pointid 全局点名
+     * @param  beginDate 开始时间(秒级)
+     * @param endDate 结束时间(秒级)
+     * @param count  点数
+     * @param pried  时间间隔
+     * @type 0、最大值。1、最小值。、平均值
+     * @return
+     * @throws Exception
+     */
+    public List<PointData> getHistStat(String pointid, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception;
+
+    /**
+     * 通过全局点名获得测点指定时间周期的统计数据 同时返回max、min、avg数据
+     * @param point 全局点名
+     * @param  beginDate 开始时间(秒级)
+     * @param endDate 结束时间(秒级)
+     * @param pried  时间间隔
+     * @return
+     * @throws Exception
+     */
+    public DNAStatVal[] getHistStat(String point, Long beginDate, Long endDate, Integer pried) throws Exception;
+    /**
+     * 补录单点历史数据
+     * @param point 测点对象
+     * @return
+     * @throws Exception
+     */
+    public void updatePoint(PointData point) throws Exception;
+
+    /**
+     * 批量查询实时数据
+     * @param tagNames 测点字符串数组
+     * @return
+     * @throws Exception
+     */
+
+    public DNAVal[] getRealtimeTagValues(String... tagNames) throws Exception;
+
+    /**
+     * 批量插入历史数据
+     * @param pointls 测点对象集合
+     * @throws Exception
+     */
+    public void updatePoint(List<PointData> pointls) throws Exception;
+
+    /**
+     * 单点写入实时数据
+     * @param point 测点对象
+     * @throws Exception
+     */
+    public void sendSinglePoint(PointData point) throws Exception ;
+    /**
+     * 批量写入实时数据
+     * @param pointls 测点对象列表
+     * @throws Exception
+     */
+    public void sendMultiPoint(List<PointData> pointls) throws Exception ;
+
+    /**
+     * 通过两个字符串数组对象批量写入实时数据
+     * @param realvalue 插入值字符串数组
+     * @param pointls 存储对象数组对象
+     * @throws Exception
+     */
+
+    public void sendMultiPoint(String[] realvalue,DNAVal[] pointls) throws Exception;
+    /**
+     *
+     * @param nameList 测点名称列表集合
+     * @param tTime  时间点(秒级)
+     * @return
+     * @throws Exception
+     */
+    public DNAVal[] getHistMatrix(String[] nameList, int tTime) throws Exception;
+
+}

+ 34 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/StringUtil.java

@@ -0,0 +1,34 @@
+package com.gyee.regionrealtime.util.realtimesource;
+
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * String辅助类
+ * 
+ */
+public class StringUtil extends StringUtils {
+	
+	/**
+	 * 非空判断
+	 * 
+	 * @param obj
+	 * @return
+	 */
+	public static boolean isNotBlank(Object obj) {
+		return !isBlank(obj);
+	}
+
+	/**
+	 * 为空判断
+	 * 
+	 * @param obj
+	 * @return
+	 */
+	public static boolean isBlank(Object obj) {
+		if (obj == null || StringUtils.isBlank(obj.toString())) {
+			return true;
+		}
+		return false;
+	}
+
+}

+ 28 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BaseTsQuery.java

@@ -0,0 +1,28 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+import lombok.Data;
+
+@Data
+public class BaseTsQuery implements TsQuery {
+
+    private final TsPoint tsPoint;
+    private final long startTs;
+    private final long endTs;
+    private final int interval;
+    private final int limit;
+    private final Interpolation interpolation;
+
+    public BaseTsQuery(TsPoint tsPoint, long startTs, long endTs, int interval, int limit, Interpolation interpolation) {
+        this.tsPoint = tsPoint;
+        this.startTs = startTs;
+        this.endTs = endTs;
+        this.interval = interval;
+        this.limit = limit;
+        this.interpolation = interpolation;
+    }
+
+    public BaseTsQuery(TsPoint tsPoint, long startTs, long endTs) {
+        this(tsPoint, startTs, endTs, 1, 1, Interpolation.RAW);
+    }
+
+}

+ 38 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BasicTsData.java

@@ -0,0 +1,38 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+public abstract class BasicTsData implements TsData, Comparable<BasicTsData>{
+
+    private final long ts;
+
+    private final short status;
+
+    public BasicTsData(long ts, short status) {
+        this.ts = ts;
+        this.status = status;
+    }
+
+    public long getTs() {
+        return ts;
+    }
+
+    public short getStatus() {
+        return status;
+    }
+
+    @Override
+    public int compareTo(BasicTsData o) {
+        return Long.compare(ts, o.ts);
+    }
+
+    @Override
+    public String toString() {
+        return "BasicTsData{ts='" + ts +
+                "', status='" + this.getStatus() +
+                "'}";
+    }
+
+}
+

+ 29 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BasicTsPoint.java

@@ -0,0 +1,29 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+public class BasicTsPoint implements TsPoint {
+
+    private final String id;
+
+    private final TsDataType tsDataType;
+
+    public BasicTsPoint(String id,  TsDataType tsDataType) {
+        this.id = id;
+        this.tsDataType = tsDataType;
+    }
+
+    public String getId() { return id; }
+
+    public TsDataType getTsDataType() {return tsDataType; }
+
+    @Override
+    public String toString() {
+        return "BasicTsPoint{id='" + id +
+                "', dataType='" + this.getTsDataType() +
+                "'}";
+    }
+
+}
+

+ 24 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BlobTsData.java

@@ -0,0 +1,24 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+import java.util.Base64;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+public class BlobTsData extends BasicTsData {
+
+    private final byte[] blob;
+
+    public BlobTsData(long ts, short status, byte[] blob) {
+        super(ts, status);
+        this.blob = blob;
+    }
+
+    //public byte[] getBlob() { return  blob ;}
+
+    public String getBlobValue() {
+        return Base64.getEncoder().encodeToString(blob);
+    }
+
+}
+

+ 22 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BlobWriteTsData.java

@@ -0,0 +1,22 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+import lombok.Data;
+
+import java.util.Base64;
+
+/**
+ * @descrition:
+ * @author:Wanghs
+ * @date:2018-05-04
+ */
+@Data
+public class BlobWriteTsData {
+    private String tagName;
+    private long ts;
+    private  byte[]blob;
+
+    public String getValue() {
+        return Base64.getEncoder().encodeToString(blob);
+    }
+
+}

+ 24 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BooleanTsData.java

@@ -0,0 +1,24 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+public class BooleanTsData extends BasicTsData {
+
+    private final boolean actualValue;
+
+    public BooleanTsData(long ts, short status, boolean actualValue) {
+        super(ts, status);
+        this.actualValue = actualValue;
+    }
+
+//    public boolean getActualValue() {
+//        return actualValue;
+//    }
+
+    public String getBooleanValue() {
+        return Boolean.toString(actualValue);
+    }
+
+}
+

+ 19 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/BooleanWriteTsData.java

@@ -0,0 +1,19 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+import lombok.Data;
+
+/**
+ * @descrition:
+ * @author:Wanghs
+ * @date:2018-05-04
+ */
+@Data
+public class BooleanWriteTsData  {
+    private String tagName;
+    private long ts;
+    private boolean actualValue;
+
+    public boolean getValue() {
+        return this.actualValue;
+    }
+}

+ 18 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/Coordinate.java

@@ -0,0 +1,18 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+@Data
+@AllArgsConstructor
+public class Coordinate {
+
+    private double latitude;
+
+    private double longitude;
+
+}
+

+ 26 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/CoordinateTsData.java

@@ -0,0 +1,26 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+public class CoordinateTsData extends BasicTsData {
+
+    private final Coordinate coordinate;
+
+    public CoordinateTsData(long ts, short status, double latitude, double longitude) {
+        super(ts, status);
+        this.coordinate = new Coordinate(latitude, longitude);
+    }
+
+    public CoordinateTsData(long ts, short status, Coordinate coordinate) {
+        super(ts, status);
+        this.coordinate = coordinate;
+    }
+
+    public Coordinate getCoordinateValue() {
+        return coordinate;
+        //return String.format("{\"longitude\":%f,\"latitude\":\"%f\"}", longitude, latitude);
+    }
+
+}
+

+ 21 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/CoordinateWriteTsData.java

@@ -0,0 +1,21 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+import lombok.Data;
+
+/**
+ * @descrition:
+ * @author:Wanghs
+ * @date:2018-05-04
+ */
+@Data
+public class CoordinateWriteTsData  {
+
+    private String tagName;
+    private long ts;
+    private  double latitude;
+    private  double longitude;
+
+    public double getLatitude() { return  latitude ;}
+    public double getLongitude() {return  longitude; }
+
+}

+ 30 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/DoubleStatData.java

@@ -0,0 +1,30 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+public class DoubleStatData {
+
+    private DoubleTsData avg;
+    private DoubleTsData max;
+    private DoubleTsData min;
+
+    public DoubleStatData(DoubleTsData avg, DoubleTsData max, DoubleTsData min) {
+        this.avg = avg;
+        this.max = max;
+        this.min = min;
+    }
+
+    public DoubleTsData getAvg() {
+        return avg;
+    }
+
+    public DoubleTsData getMax() {
+        return max;
+    }
+
+    public DoubleTsData getMin() {
+        return min;
+    }
+}
+

+ 25 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/DoubleTsData.java

@@ -0,0 +1,25 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+public class DoubleTsData extends BasicTsData {
+
+    private final double actualValue;
+
+    public DoubleTsData(long ts, short status, double actualValue) {
+        super(ts, status);
+        this.actualValue = actualValue;
+    }
+
+
+    public double getDoubleValue() {
+        return actualValue;
+    }
+
+//    public String getValue() {
+//        return Double.toString(actualValue);
+//    }
+
+}
+

+ 19 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/DoubleWriteTsData.java

@@ -0,0 +1,19 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+import lombok.Data;
+
+/**
+ * @descrition:
+ * @author:Wanghs
+ * @date:2018-05-04
+ */
+@Data
+public class DoubleWriteTsData  {
+    private String tagName;
+    private long ts;
+    private double actualValue;
+
+    public double getValue() {
+        return this.actualValue;
+    }
+}

+ 38 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/ErrorRequest.java

@@ -0,0 +1,38 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+import com.gyee.common.model.PointData;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @descrition:接口请求失败返回操作类
+ * @author:Wanghs
+ * @date:2018-05-21
+ */
+public class ErrorRequest {
+
+    public static List<PointData> RequestListError(String pointId) {
+        List<PointData> dataList = new ArrayList<>();
+        return dataList;
+    }
+
+    public static List<PointData> RequestListError(String... pointId) {
+        List<PointData> dataList = new ArrayList<>();
+        return dataList;
+    }
+
+    public static PointData RequestError(String pointId) {
+        PointData data = new PointData();
+        data.setPointValueInDouble(0);
+        data.setPointName("0");
+        return data;
+    }
+
+    public static Map<String, Double> RequestMapError() {
+        Map<String, Double> resultMap = new HashMap();
+        return resultMap;
+    }
+}

+ 27 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/GeneralTsData.java

@@ -0,0 +1,27 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Optional;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class GeneralTsData implements TsData {
+
+    private long ts;
+    private short status;
+    private Optional<Double> doubleValue;
+    private Optional<Long> longValue;
+    private Optional<Boolean> booleanValue;
+    private Optional<String> stringValue;
+    private Optional<String> blobValue;
+    private Optional<Coordinate> coordinateValue;
+
+}
+

+ 8 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/Interpolation.java

@@ -0,0 +1,8 @@
+
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+public enum Interpolation {
+    SNAP,   // 历史快照数据
+    INTERPOLATION, //插值
+    RAW    //原始数据
+}

+ 206 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/JsonObjectHelper.java

@@ -0,0 +1,206 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.common.model.DNAStatVal;
+import com.gyee.common.model.DNAVal;
+import com.gyee.common.model.PointData;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+
+/**
+ * @descrition:JSONObject转实体辅助类
+ * @author:Wanghs
+ * @date:2018-05-10
+ */
+public class JsonObjectHelper {
+    public static List<PointData> phrasePointData(JSONArray jsonArray, String tagName) {
+        List<PointData> result = new ArrayList<>();
+
+        for (int i = 0; i < jsonArray.size(); i++) {
+            JSONObject tsData = jsonArray.getJSONObject(i);
+
+            Long ts = tsData.getLong("ts");
+            String pointValue = null;
+            if (tsData.containsKey("doubleValue")) {
+                pointValue = tsData.getString("doubleValue");
+            } else if (tsData.containsKey("booleanValue")) {
+                pointValue = tsData.getString("booleanValue");
+            } else if (tsData.containsKey("longValue")) {
+                pointValue = tsData.getString("longValue");
+            } else if (tsData.containsKey("stringValue")) {
+                pointValue = tsData.getString("stringValue");
+            }
+            PointData pointData = new PointData();
+            pointData.setEdnaId(tagName);
+            pointData.setPointName("1");
+            pointData.setPointTime(ts / 1000);
+            pointData.setPointValue(pointValue);
+            pointData.setPointValueInDouble(Double.parseDouble(pointValue));
+            //System.out.println("key= " + tagName + ", ts = " + ts + ", value = " + pointValue);
+            result.add(pointData);
+        }
+        return result;
+    }
+
+
+    public static List<PointData> phrasePointData(JSONObject jsonObject) {
+        List<PointData> result = new ArrayList<>();
+        Iterator<String> sIterator = jsonObject.keySet().iterator();
+        while (sIterator.hasNext()) {
+            // 获得key
+            String key = sIterator.next();
+            // 根据key获得value, value也可以是JSONObject,JSONArray,使用对应的参数接收即可
+            JSONObject jsonData = jsonObject.getJSONObject(key);
+            Long ts = 0l;
+
+            if (jsonData!=null){
+                ts  = jsonData.getLong("ts");
+                String pointValue = null;
+                if (jsonData.containsKey("doubleValue")) {
+                    pointValue = jsonData.getString("doubleValue");
+                } else if (jsonData.containsKey("booleanValue")) {
+                    pointValue = jsonData.getString("booleanValue");
+                } else if (jsonData.containsKey("longValue")) {
+                    pointValue = jsonData.getString("longValue");
+                } else if (jsonData.containsKey("stringValue")) {
+                    pointValue = jsonData.getString("stringValue");
+                }
+                PointData pointData = new PointData();
+                pointData.setEdnaId(key);
+                pointData.setPointName("1");
+                pointData.setPointValue(pointValue);
+                pointData.setPointTime(ts/1000);
+                if(pointValue.equals("false")  )
+                {
+                    pointData.setPointValueInDouble(0.0);
+                }else  if(pointValue.equals("true") )
+                {
+                    pointData.setPointValueInDouble(1.0);
+                }else
+                {
+                    pointData.setPointValueInDouble(Double.parseDouble(pointValue));
+                }
+
+                //  System.out.println("key= " + key + ", ts = " + ts + ", value = " + pointValue);
+                result.add(pointData);
+            }
+        }
+        return result;
+    }
+    /**
+     * @param arry    DoubleStatData集合
+     * @param tagName 标签点名
+     * @param type    0、最大值。1、最小值。2、平均值
+     */
+    public static List<PointData> GeneralTsDataToPointDataByStat(JSONArray arry, String tagName, int type) {
+        List<PointData> result = new ArrayList<>();
+        for (int i = 0; i < arry.size(); i++) {
+            JSONObject jsonData = arry.getJSONObject(i);
+            PointData data = new PointData();
+            data.setEdnaId(tagName);
+            data.setPointName("1");
+            JSONObject avgData = null;
+            JSONObject maxData = null;
+            JSONObject minData = null;
+            if (jsonData.containsKey("avg")) {
+                avgData = jsonData.getJSONObject("avg");
+            }
+            if (jsonData.containsKey("max")) {
+                maxData = jsonData.getJSONObject("max");
+            }
+            if (jsonData.containsKey("min")) {
+                minData = jsonData.getJSONObject("min");
+            }
+            switch (type) {
+                case 0:
+                    data.setPointValue(String.valueOf(maxData.getString("doubleValue")));
+                    data.setPointValueInDouble(Double.valueOf(maxData.getString("doubleValue")));
+                    data.setPointTime(Long.valueOf(maxData.getString("ts")) / 1000);
+                    break;
+                case 1:
+                    data.setPointValue(String.valueOf(minData.getString("doubleValue")));
+                    data.setPointValueInDouble(Double.valueOf(minData.getString("doubleValue")));
+                    data.setPointTime(Long.valueOf(minData.getString("ts")) / 1000);
+                    break;
+                case 2:
+                    data.setPointValue(String.valueOf(avgData.getString("doubleValue")));
+                    data.setPointValueInDouble(Double.valueOf(avgData.getString("doubleValue")));
+                    data.setPointTime(Long.valueOf(avgData.getString("ts")) / 1000);
+                    break;
+                default:
+                    break;
+            }
+            result.add(data);
+        }
+        return result;
+    }
+
+    public static DNAVal[] phraseDNAVal(JSONObject jsonObject, String[] tagName) {
+        DNAVal[] arr = new DNAVal[jsonObject.size()];
+        List<DNAVal> list = new ArrayList<>();
+        Iterator<String> sIterator = jsonObject.keySet().iterator();
+
+        for (int i = 0; i < tagName.length; i++) {
+            // 获得key
+            String key = tagName[i];
+            // 根据key获得value, value也可以是JSONObject,JSONArray,使用对应的参数接收即可
+            JSONObject jsonData = jsonObject.getJSONObject(key);
+            DNAVal data = new DNAVal();
+            data.Time = Integer.parseInt(String.valueOf(Long.valueOf(jsonData.getString("ts")) / 1000));
+            data.Status = (short) jsonData.getShortValue("status");
+            data.DValue = (Double.valueOf(jsonData.getDoubleValue("doubleValue")));
+            list.add(data);
+        }
+
+        return list.toArray(arr);
+    }
+
+    public static DNAStatVal[] phraseDNAVal(JSONArray jsonArray) {
+
+        DNAStatVal[] arr = new DNAStatVal[jsonArray.size()];
+        List<DNAStatVal> list = new ArrayList<>();
+        for (int i = 0; i < jsonArray.size(); i++) {
+            JSONObject jsonData = jsonArray.getJSONObject(i);
+            JSONObject avgData = null;
+            JSONObject maxData = null;
+            JSONObject minData = null;
+            if (jsonData.containsKey("avg")) {
+                avgData = jsonData.getJSONObject("avg");
+            }
+            if (jsonData.containsKey("max")) {
+                maxData = jsonData.getJSONObject("max");
+            }
+            if (jsonData.containsKey("min")) {
+                minData = jsonData.getJSONObject("min");
+            }
+            DNAStatVal statVal = new DNAStatVal();
+
+            DNAVal avgVal = new DNAVal();
+            DNAVal maxVal = new DNAVal();
+            DNAVal minVal = new DNAVal();
+
+            avgVal.Time = Integer.valueOf(String.valueOf(Long.valueOf(avgData.getString("ts")) / 1000));
+            avgVal.DValue = Double.valueOf(avgData.getString("doubleValue"));
+
+            maxVal.Time =  Integer.valueOf(String.valueOf(Long.valueOf(maxData.getString("ts")) / 1000));
+            maxVal.DValue = Double.valueOf(maxData.getString("doubleValue"));
+
+            minVal.Time =  Integer.valueOf(String.valueOf(Long.valueOf(minData.getString("ts")) / 1000));
+            minVal.DValue = Double.valueOf(minData.getString("doubleValue"));
+
+            statVal.max = maxVal;
+            statVal.min = minVal;
+            statVal.avg = avgVal;
+
+            list.add(statVal);
+        }
+
+        return list.toArray(arr);
+    }
+
+}

+ 24 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/LongTsData.java

@@ -0,0 +1,24 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+public class LongTsData extends BasicTsData {
+
+    private final long actualValue;
+
+    public LongTsData(long ts, short status, long actualValue) {
+        super(ts, status);
+        this.actualValue = actualValue;
+    }
+
+    public long getLongValue() {
+        return actualValue;
+    }
+
+//    public String getValue() {
+//        return Long.toString(actualValue);
+//    }
+
+}
+

+ 20 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/LongWriteTsData.java

@@ -0,0 +1,20 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+import lombok.Data;
+
+/**
+ * @descrition:
+ * @author:Wanghs
+ * @date:2018-05-04
+ */
+@Data
+public class LongWriteTsData  {
+
+    private String tagName;
+    private long ts;
+    private long actualValue;
+
+    public long getValue() {
+        return this.actualValue;
+    }
+}

+ 24 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/StringTsData.java

@@ -0,0 +1,24 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+public class StringTsData extends BasicTsData {
+
+    private final String actualValue;
+
+    public StringTsData(long ts, short status, String actualValue) {
+        super(ts, status);
+        this.actualValue = actualValue;
+    }
+
+//    public String getActualValue() {
+//        return actualValue;
+//    }
+
+    public String getStringValue() {
+        return actualValue;
+    }
+
+}
+

+ 34 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/StringUtil.java

@@ -0,0 +1,34 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * String辅助类
+ * 
+ */
+public class StringUtil extends StringUtils {
+	
+	/**
+	 * 非空判断
+	 * 
+	 * @param obj
+	 * @return
+	 */
+	public static boolean isNotBlank(Object obj) {
+		return !isBlank(obj);
+	}
+
+	/**
+	 * 为空判断
+	 * 
+	 * @param obj
+	 * @return
+	 */
+	public static boolean isBlank(Object obj) {
+		if (obj == null || StringUtils.isBlank(obj.toString())) {
+			return true;
+		}
+		return false;
+	}
+
+}

+ 20 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/StringWriteTsData.java

@@ -0,0 +1,20 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+import lombok.Data;
+
+/**
+ * @descrition:String类型写入实体类
+ * @author:Wanghs
+ * @date:2018-05-04
+ */
+@Data
+public class StringWriteTsData  {
+    private String tagName;
+    private long ts;
+    private String actualValue;
+
+    public String getValue() {
+        return this.actualValue;
+    }
+
+}

+ 15 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/TsData.java

@@ -0,0 +1,15 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+public interface TsData {
+
+    long getTs();
+
+    short getStatus();
+
+    //double getValue();
+
+}
+

+ 15 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/TsDataType.java

@@ -0,0 +1,15 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+public enum TsDataType {
+    LONG,
+    DOUBLE,
+    BOOLEAN,
+    STRING,
+    BLOB,
+    COORDINATE
+
+}
+

+ 12 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/TsPoint.java

@@ -0,0 +1,12 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+public interface TsPoint {
+
+    String getId();
+
+    TsDataType getTsDataType();
+}
+

+ 36 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/TsPointData.java

@@ -0,0 +1,36 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class TsPointData {
+
+    private String tagName;
+    private GeneralTsData tsData;
+
+    public TsDataType findDataType() {
+        if (tsData.getDoubleValue().isPresent())
+            return TsDataType.DOUBLE;
+        else if (tsData.getBooleanValue().isPresent())
+            return TsDataType.BOOLEAN;
+        else if (tsData.getLongValue().isPresent())
+            return TsDataType.LONG;
+        else if (tsData.getStringValue().isPresent())
+            return TsDataType.STRING;
+        else if (tsData.getBlobValue().isPresent())
+            return TsDataType.BLOB;
+        else if (tsData.getCoordinateValue().isPresent())
+            return TsDataType.COORDINATE;
+
+        return TsDataType.DOUBLE;
+    }
+}
+

+ 23 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/TsPointDataList.java

@@ -0,0 +1,23 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class TsPointDataList {
+
+    private String tagName;
+
+    private List<GeneralTsData> tsDataList;
+
+}
+

+ 17 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/realtimesource/timeseries/TsQuery.java

@@ -0,0 +1,17 @@
+package com.gyee.regionrealtime.util.realtimesource.timeseries;
+
+public interface TsQuery {
+
+    TsPoint getTsPoint();
+
+    long getStartTs();
+
+    long getEndTs();
+
+    int getInterval();
+
+    int getLimit();
+
+    Interpolation getInterpolation();
+
+}

+ 44 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/redis/RedisAutoConfiguration.java

@@ -0,0 +1,44 @@
+package com.gyee.regionrealtime.util.redis;
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+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.RedisOperations;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.StringRedisTemplate;
+
+import java.net.UnknownHostException;
+
+@Configuration
+@ConditionalOnClass(RedisOperations.class)
+@EnableConfigurationProperties(RedisProperties.class)
+public class RedisAutoConfiguration {
+
+
+    @Bean
+    @ConditionalOnMissingBean(name = "redisTemplate")
+    public RedisTemplate<Object, Object> redisTemplate(
+            RedisConnectionFactory redisConnectionFactory) throws UnknownHostException {
+        RedisTemplate<Object, Object> template = new RedisTemplate<>();
+        template.setConnectionFactory(redisConnectionFactory);
+        return template;
+
+    }
+
+
+    @Bean
+    @ConditionalOnMissingBean
+    public StringRedisTemplate stringRedisTemplate(
+            RedisConnectionFactory redisConnectionFactory) throws UnknownHostException {
+        StringRedisTemplate template = new StringRedisTemplate();
+        template.setConnectionFactory(redisConnectionFactory);
+        return template;
+
+    }
+
+
+}

+ 47 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/redis/RedisConfig.java

@@ -0,0 +1,47 @@
+package com.gyee.regionrealtime.util.redis;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+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.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+
+/**
+
+/**
+ *@ClassName RedisConfig
+ *@Description TODO
+ *@Author 谢生杰
+ *@Date 2020/9/14 10:42
+ *@Version 1.0
+ **/
+@Configuration
+public class RedisConfig {
+    @Bean
+    @SuppressWarnings("all")
+    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
+        RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
+        template.setConnectionFactory(factory);
+        Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
+        ObjectMapper om = new ObjectMapper();
+        om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+        om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
+        jackson2JsonRedisSerializer.setObjectMapper(om);
+        StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
+        // key采用String的序列化方式
+        template.setKeySerializer(stringRedisSerializer);
+        // hash的key也采用String的序列化方式
+        template.setHashKeySerializer(stringRedisSerializer);
+        // value序列化方式采用jackson
+        template.setValueSerializer(jackson2JsonRedisSerializer);
+        // hash的value序列化方式采用jackson
+        template.setHashValueSerializer(jackson2JsonRedisSerializer);
+        template.afterPropertiesSet();
+        return template;
+    }
+}

+ 51 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/redis/RedisService.java

@@ -0,0 +1,51 @@
+package com.gyee.regionrealtime.util.redis;
+
+public interface RedisService {
+
+    /**
+     * set存数据
+     * @param key
+     * @param value
+     * @return
+     */
+    boolean set(String key, String value);
+
+
+
+    /**
+     * get获取数据
+     * @param key
+     * @return
+     */
+    String get(String key);
+
+//    void getList(String key,int start,int end);
+
+    /**
+     * 设置有效天数
+     * @param key
+     * @param expire
+     * @return
+     */
+    boolean expire(String key, long expire);
+
+    /**
+     * 移除数据
+     * @param key
+     * @return
+     */
+    boolean remove(String key);
+
+
+    /**
+     * 插入对象
+     */
+    void setObject(Object o);
+
+
+    boolean hasKey(String key);
+
+
+    void select(Integer dbIndex);
+
+}

+ 125 - 0
realtime/generationregion-service/src/main/java/com/gyee/regionrealtime/util/redis/RedisServiceImpl.java

@@ -0,0 +1,125 @@
+package com.gyee.regionrealtime.util.redis;
+
+import org.springframework.dao.DataAccessException;
+import org.springframework.data.redis.connection.RedisConnection;
+import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
+import org.springframework.data.redis.core.RedisCallback;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.RedisSerializer;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.lang.reflect.Field;
+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 {
+                RedisSerializer<String> serializer = redisTemplate.getStringSerializer();
+                connection.set(serializer.serialize(key), serializer.serialize(value));
+                return true;
+            }
+        });
+        return result;
+    }
+
+
+    @Override
+    public String get(final String key) {
+        String result = redisTemplate.execute(new RedisCallback<String>() {
+            @Override
+            public String doInRedis(RedisConnection connection) throws DataAccessException {
+                RedisSerializer<String> serializer = redisTemplate.getStringSerializer();
+                byte[] value = connection.get(serializer.serialize(key));
+                return serializer.deserialize(value);
+            }
+        });
+        return result;
+    }
+
+
+
+    @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 {
+                RedisSerializer<String> serializer = redisTemplate.getStringSerializer();
+                connection.del(key.getBytes());
+                return true;
+            }
+        });
+        return result;
+    }
+
+    @Override
+    public boolean hasKey(final String key) {
+        try {
+            return redisTemplate.hasKey(key);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
+
+    @Override
+    public void setObject(Object obj) {
+        Field[] fields = obj.getClass().getDeclaredFields();
+        for(int i = 0 , len = fields.length; i < len; i++) {
+            // 对于每个属性,获取属性名
+            String varName = fields[i].getName();
+            try {
+                // 获取原来的访问控制权限
+                boolean accessFlag = fields[i].isAccessible();
+                // 修改访问控制权限
+                fields[i].setAccessible(true);
+                // 获取在对象f中属性fields[i]对应的对象中的变量
+                Object o;
+                try {
+                    o = fields[i].get(obj);
+                    if (o!=null){
+                        set(varName, String.valueOf(o));
+                    }else {
+                        set(varName,"");
+                    }
+
+                    //System.err.println("传入的对象中包含一个如下的变量:" + varName + " = " + o);
+                } catch (IllegalAccessException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+                // 恢复访问控制权限
+                fields[i].setAccessible(accessFlag);
+            } catch (IllegalArgumentException ex) {
+                ex.printStackTrace();
+            }
+        }
+
+    }
+
+    public void select(Integer dbIndex) {
+        if (dbIndex == null || dbIndex > 15 || dbIndex < 0) {
+            dbIndex = 0;
+        }
+        LettuceConnectionFactory jedisConnectionFactory = (LettuceConnectionFactory) redisTemplate
+                .getConnectionFactory();
+        jedisConnectionFactory.setDatabase(dbIndex);
+        redisTemplate.setConnectionFactory(jedisConnectionFactory);
+        jedisConnectionFactory.afterPropertiesSet();
+//        jedisConnectionFactory.resetConnection();
+
+    }
+}

+ 100 - 0
realtime/generationregion-service/src/main/resources/application-jn.yml

@@ -0,0 +1,100 @@
+server:
+  port: 7013
+  servlet:
+    context-path: /
+
+
+spring:
+  main:
+    allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
+  #redis集群
+  redis:
+    host: 10.81.3.155
+    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
+    jedis:
+      pool:
+        max-active: 8
+        min-idle: 0
+        max-idle: 8
+        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: org.postgresql.Driver
+    url: jdbc:postgresql://10.81.3.151:5432/wisdom
+    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.81.3.152:8011/ts
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 5 - 0
realtime/generationregion-service/src/main/resources/application.yml

@@ -0,0 +1,5 @@
+# 场站,期次,线路电计量信息
+spring:
+  profiles:
+    active: jn
+#    active: dev

+ 18 - 0
realtime/generationregion-service/src/main/resources/xxl-job-executor.properties

@@ -0,0 +1,18 @@
+### 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, access token
+xxl.job.accessToken=
+
+### xxl-job executor appname
+xxl.job.executor.appname=generation-region-job
+### xxl-job executor registry-address: default use address to registry , otherwise use ip:port if address is null
+xxl.job.executor.address=
+### xxl-job executor server-info
+xxl.job.executor.ip=
+xxl.job.executor.port=9102
+### xxl-job executor log-path
+xxl.job.executor.logpath=E:\\jobs\\generation-region-job
+### xxl-job executor log-retention-days
+xxl.job.executor.logretentiondays=30
+

+ 36 - 0
realtime/generationregion-service/src/test/java/com/gyee/regionrealtime/RegionrealtimeTest.java

@@ -0,0 +1,36 @@
+package com.gyee.regionrealtime;
+
+import com.gyee.regionrealtime.service.RegionRealtimeService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+
+/**
+ * @ClassName : RegionrealtimeTest
+ * @Author : xieshengjie
+ * @Date: 2022/5/20 15:24
+ * @Description :
+ */
+@SpringBootTest
+@RunWith(SpringRunner.class)
+@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
+public class RegionrealtimeTest {
+    @Resource
+    private RegionRealtimeService regionRealtimeService;
+    @Test
+    public void test1() throws Exception {
+//        regionRealtimeService.regionRealtime("-1");
+//        regionRealtimeService.regionRealtime("-2");
+//        regionRealtimeService.regionRealtime("0");
+
+
+        regionRealtimeService.groupRealtime("-1");
+        regionRealtimeService.groupRealtime("-2");
+        regionRealtimeService.groupRealtime("0");
+    }
+}

+ 4 - 0
realtime/meteorologicalcollection/pom.xml

@@ -64,6 +64,10 @@
             <version>1.0-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+        </dependency>
 
     </dependencies>
     <build>

+ 97 - 0
realtime/meteorologicalcollection/src/main/resources/application-jn.yml

@@ -0,0 +1,97 @@
+server:
+  port: 7010
+  servlet:
+    context-path: /
+
+
+spring:
+  main:
+    allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
+  #redis集群
+  redis:
+    host: 10.81.3.155
+    port: 6379
+    timeout: 100000
+    #    集群环境打开下面注释,单机不需要打开
+    #    cluster:
+    #      集群信息
+    #      nodes: xxx.xxx.xxx.xxx:xxxx,xxx.xxx.xxx.xxx:xxxx,xxx.xxx.xxx.xxx:xxxx
+    #      #默认值是5 一般当此值设置过大时,容易报:Too many Cluster redirections
+    #      maxRedirects: 3
+    password:
+    application:
+      name: test
+    jedis:
+      pool:
+        max-active: 8
+        min-idle: 0
+        max-idle: 8
+        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: org.postgresql.Driver
+    url: jdbc:postgresql://10.81.3.151:5432/wisdom
+    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
+
+
+meteorological:
+  weatherkey: 3b66d35579770393051599f8d518df4a
+  model: weather,forecast,onecall
+  url: https://api.openweathermap.org/data/2.5/
+
+
+
+
+
+
+
+

+ 1 - 1
realtime/meteorologicalcollection/src/main/resources/application.yml

@@ -1,4 +1,4 @@
 spring:
   profiles:
 #    active: dev
-    active: test
+    active: jn

+ 1 - 0
realtime/pom.xml

@@ -20,6 +20,7 @@
         <module>failurestatistics-server-cph</module>
         <module>datatraining-server-cph</module>
         <module>healthmodel-server-cph</module>
+        <module>generationregion-service</module>
     </modules>
 
 

+ 4 - 0
web/healthmanagement-web-hb/pom.xml

@@ -39,6 +39,10 @@
             <groupId>com.alibaba.cloud</groupId>
             <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 11 - 3
web/healthmanagement-web-hb/src/main/java/com/gyee/healthmanagement/config/GeneratorCodeConfig.java

@@ -55,11 +55,19 @@ public class GeneratorCodeConfig {
 //        dsc.setPassword("root");
 //        mpg.setDataSource(dsc);
 
-        dsc.setDriverName("oracle.jdbc.driver.OracleDriver");
+//        dsc.setDriverName("oracle.jdbc.driver.OracleDriver");
+//        dsc.setUsername("gdprod");
+//        dsc.setPassword("gd123");
+////        dsc.setUrl("jdbc:oracle:thin:@49.4.50.80:1521:gdnxfd");
+//        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:oracle:thin:@49.4.50.80:1521:gdnxfd");
-        dsc.setUrl("jdbc:oracle:thin:@10.83.68.165:1521:gdsj");
+        dsc.setUrl("jdbc:postgresql://10.81.3.151:5432/wisdom");
         mpg.setDataSource(dsc);
 
 //        dsc.setDriverName("com.cloudera.impala.jdbc41.Driver");

+ 20 - 0
web/healthmanagement-web-hb/src/main/java/com/gyee/healthmanagement/controller/auto/WindturbineController.java

@@ -0,0 +1,20 @@
+package com.gyee.healthmanagement.controller.auto;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-24
+ */
+@RestController
+@RequestMapping("//windturbine")
+public class WindturbineController {
+
+}

+ 34 - 0
web/healthmanagement-web-hb/src/main/java/com/gyee/healthmanagement/init/CacheContext.java

@@ -0,0 +1,34 @@
+package com.gyee.healthmanagement.init;
+
+import com.gyee.healthmanagement.model.auto.Windturbine;
+import com.gyee.healthmanagement.service.auto.IWindturbineService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @ClassName : CacheContext
+ * @Author : xieshengjie
+ * @Date: 2022/5/24 11:33
+ * @Description :
+ */
+@Component
+public class CacheContext implements CommandLineRunner {
+
+    Logger logger = LoggerFactory.getLogger(CacheContext.class);
+    @Resource
+    private IWindturbineService windturbineService;
+
+    public static List<Windturbine> wtls = new ArrayList<>();
+
+    @Override
+    public void run(String... args) throws Exception {
+        wtls = windturbineService.list().stream().filter(wt->wt.getWindpowerstationid().endsWith("FDC")).collect(Collectors.toList());
+    }
+}

+ 16 - 0
web/healthmanagement-web-hb/src/main/java/com/gyee/healthmanagement/mapper/auto/WindturbineMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.healthmanagement.mapper.auto;
+
+import com.gyee.healthmanagement.model.auto.Windturbine;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-24
+ */
+public interface WindturbineMapper extends BaseMapper<Windturbine> {
+
+}

+ 50 - 0
web/healthmanagement-web-hb/src/main/java/com/gyee/healthmanagement/model/auto/Windturbine.java

@@ -0,0 +1,50 @@
+package com.gyee.healthmanagement.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-05-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class Windturbine extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String code;
+
+    private String windpowerstationid;
+
+    private Double longitude;
+
+    private Double latitude;
+
+    private String modelid;
+
+    private String status;
+
+    private String projectid;
+
+    private String lineid;
+
+    private Date firstintegratedtime;
+
+    private String photo;
+
+    private String name;
+
+    private String standardid;
+
+
+}

+ 0 - 0
web/healthmanagement-web-hb/src/main/java/com/gyee/healthmanagement/service/auto/IWindturbineService.java


Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott