Pārlūkot izejas kodu

计算服务修改

xieshengjie 3 gadi atpakaļ
vecāks
revīzija
e7ec8cd14c
71 mainītis faili ar 2315 papildinājumiem un 131 dzēšanām
  1. 9 11
      cache/src/main/java/com/gyee/cache/config/GeneratorCodeConfig.java
  2. 20 0
      cache/src/main/java/com/gyee/cache/controller/CompanyController.java
  3. 20 0
      cache/src/main/java/com/gyee/cache/controller/EquipmentmodelController.java
  4. 20 0
      cache/src/main/java/com/gyee/cache/controller/ModelpowerController.java
  5. 20 0
      cache/src/main/java/com/gyee/cache/controller/RegionController.java
  6. 20 0
      cache/src/main/java/com/gyee/cache/controller/WindturbineaiController.java
  7. 20 0
      cache/src/main/java/com/gyee/cache/controller/WindturbinediController.java
  8. 61 0
      cache/src/main/java/com/gyee/cache/controller/configure/CompanyConfigureController.java
  9. 62 0
      cache/src/main/java/com/gyee/cache/controller/configure/LineConfigureController.java
  10. 62 0
      cache/src/main/java/com/gyee/cache/controller/configure/ProjectConfigureController.java
  11. 62 0
      cache/src/main/java/com/gyee/cache/controller/configure/RegionConfigureController.java
  12. 61 0
      cache/src/main/java/com/gyee/cache/controller/configure/WindpowerstationConfigureController.java
  13. 61 0
      cache/src/main/java/com/gyee/cache/controller/configure/WindturbineConfigureController.java
  14. 85 0
      cache/src/main/java/com/gyee/cache/controller/configure/WindturbinetestingpointConfigureController.java
  15. 29 40
      cache/src/main/java/com/gyee/cache/init/CacheContext.java
  16. 16 0
      cache/src/main/java/com/gyee/cache/mapper/auto/CompanyMapper.java
  17. 16 0
      cache/src/main/java/com/gyee/cache/mapper/auto/EquipmentmodelMapper.java
  18. 16 0
      cache/src/main/java/com/gyee/cache/mapper/auto/ModelpowerMapper.java
  19. 16 0
      cache/src/main/java/com/gyee/cache/mapper/auto/RegionMapper.java
  20. 16 0
      cache/src/main/java/com/gyee/cache/mapper/auto/WindturbineaiMapper.java
  21. 16 0
      cache/src/main/java/com/gyee/cache/mapper/auto/WindturbinediMapper.java
  22. 34 0
      cache/src/main/java/com/gyee/cache/model/auto/Company.java
  23. 48 0
      cache/src/main/java/com/gyee/cache/model/auto/Equipmentmodel.java
  24. 32 0
      cache/src/main/java/com/gyee/cache/model/auto/Modelpower.java
  25. 36 0
      cache/src/main/java/com/gyee/cache/model/auto/Region.java
  26. 34 0
      cache/src/main/java/com/gyee/cache/model/auto/Windturbineai.java
  27. 34 0
      cache/src/main/java/com/gyee/cache/model/auto/Windturbinedi.java
  28. 16 0
      cache/src/main/java/com/gyee/cache/service/auto/ICompanyService.java
  29. 16 0
      cache/src/main/java/com/gyee/cache/service/auto/IEquipmentmodelService.java
  30. 16 0
      cache/src/main/java/com/gyee/cache/service/auto/IModelpowerService.java
  31. 16 0
      cache/src/main/java/com/gyee/cache/service/auto/IRegionService.java
  32. 16 0
      cache/src/main/java/com/gyee/cache/service/auto/IWindturbineaiService.java
  33. 16 0
      cache/src/main/java/com/gyee/cache/service/auto/IWindturbinediService.java
  34. 20 0
      cache/src/main/java/com/gyee/cache/service/auto/impl/CompanyServiceImpl.java
  35. 20 0
      cache/src/main/java/com/gyee/cache/service/auto/impl/EquipmentmodelServiceImpl.java
  36. 20 0
      cache/src/main/java/com/gyee/cache/service/auto/impl/ModelpowerServiceImpl.java
  37. 20 0
      cache/src/main/java/com/gyee/cache/service/auto/impl/RegionServiceImpl.java
  38. 20 0
      cache/src/main/java/com/gyee/cache/service/auto/impl/WindturbineaiServiceImpl.java
  39. 20 0
      cache/src/main/java/com/gyee/cache/service/auto/impl/WindturbinediServiceImpl.java
  40. 43 0
      cache/src/main/java/com/gyee/cache/service/configure/CompanyConfigureSerivice.java
  41. 44 0
      cache/src/main/java/com/gyee/cache/service/configure/LineConfigureSerivice.java
  42. 44 0
      cache/src/main/java/com/gyee/cache/service/configure/ProjectConfigureSerivice.java
  43. 46 0
      cache/src/main/java/com/gyee/cache/service/configure/RegionConfigureSerivice.java
  44. 44 0
      cache/src/main/java/com/gyee/cache/service/configure/WindpowerstationConfigureSerivice.java
  45. 43 0
      cache/src/main/java/com/gyee/cache/service/configure/WindturbineConfigureSerivice.java
  46. 134 0
      cache/src/main/java/com/gyee/cache/service/configure/WindturbinetestingpointConfigureService.java
  47. 2 3
      cache/src/main/resources/application-jn.yml
  48. 1 1
      cache/src/main/resources/application.yml
  49. 33 0
      cache/src/test/java/com/gyee/cache/CacheTest.java
  50. 13 3
      common/src/main/java/com/gyee/common/contant/Contant.java
  51. 4 3
      histroy/benchmarking-histroy-new/src/main/java/com/gyee/benchmarkinghistroy/model/auto/Windpowerspecificinfoday.java
  52. 5 0
      histroy/benchmarking-histroy-new/src/main/java/com/gyee/benchmarkinghistroy/service/specific/SpecificService.java
  53. 3 3
      histroy/benchmarking-histroy-new/src/main/resources/application-jn.yml
  54. 2 2
      histroy/benchmarking-histroy-new/src/main/resources/application.yml
  55. 3 2
      histroy/benchmarking-histroy-new/src/test/java/com/gyee/benchmarkinghistroy/BenchmarkingHistroyMainNewTest.java
  56. 7 3
      realtime/generation-service/src/main/java/com/gyee/generation/config/GeneratorCodeConfig.java
  57. 20 0
      realtime/generation-service/src/main/java/com/gyee/generation/controller/WindturbinepowerController.java
  58. 19 2
      realtime/generation-service/src/main/java/com/gyee/generation/init/CacheContext.java
  59. 16 0
      realtime/generation-service/src/main/java/com/gyee/generation/mapper/auto/WindturbinepowerMapper.java
  60. 34 0
      realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Windturbinepower.java
  61. 35 22
      realtime/generation-service/src/main/java/com/gyee/generation/service/AverageAndGeneratingService.java
  62. 151 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/RealtimeSpeedPowerService.java
  63. 227 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/TheorypowerService.java
  64. 16 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/auto/IWindturbinepowerService.java
  65. 20 0
      realtime/generation-service/src/main/java/com/gyee/generation/service/auto/impl/WindturbinepowerServiceImpl.java
  66. 59 2
      realtime/generation-service/src/main/java/com/gyee/generation/task/SaticScheduleTask.java
  67. 7 1
      realtime/generation-service/src/main/resources/application-jn.yml
  68. 41 5
      realtime/generation-service/src/test/java/com/gyee/generation/GenerationTest.java
  69. 54 24
      web/benchmarking-web-hb/src/main/java/com/gyee/benchmarkingweb/service/benching/BenchmarkingService.java
  70. 1 2
      web/benchmarking-web-hb/src/main/resources/application-jn.yml
  71. 2 2
      web/benchmarking-web-hb/src/main/resources/application.yml

+ 9 - 11
cache/src/main/java/com/gyee/cache/config/GeneratorCodeConfig.java

@@ -49,19 +49,17 @@ public class GeneratorCodeConfig {
 
         // 数据源配置
         DataSourceConfig dsc = new DataSourceConfig();
-        dsc.setUrl("jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true");
-        dsc.setDriverName("com.mysql.jdbc.Driver");
-        dsc.setUsername("root");
-        dsc.setPassword("root");
-        mpg.setDataSource(dsc);
-//        dsc.setDriverName("oracle.jdbc.driver.OracleDriver");
-//        dsc.setUsername("gdprod");
-//        dsc.setPassword("gd123");
-//        dsc.setUrl("jdbc:oracle:thin:@10.83.68.165:1521:gdsj");
-//
+//        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("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();

+ 20 - 0
cache/src/main/java/com/gyee/cache/controller/CompanyController.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-04-21
+ */
+@RestController
+@RequestMapping("//company")
+public class CompanyController {
+
+}

+ 20 - 0
cache/src/main/java/com/gyee/cache/controller/EquipmentmodelController.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-04-26
+ */
+@RestController
+@RequestMapping("//equipmentmodel")
+public class EquipmentmodelController {
+
+}

+ 20 - 0
cache/src/main/java/com/gyee/cache/controller/ModelpowerController.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-04-25
+ */
+@RestController
+@RequestMapping("//modelpower")
+public class ModelpowerController {
+
+}

+ 20 - 0
cache/src/main/java/com/gyee/cache/controller/RegionController.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-04-21
+ */
+@RestController
+@RequestMapping("//region")
+public class RegionController {
+
+}

+ 20 - 0
cache/src/main/java/com/gyee/cache/controller/WindturbineaiController.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-04-22
+ */
+@RestController
+@RequestMapping("//windturbineai")
+public class WindturbineaiController {
+
+}

+ 20 - 0
cache/src/main/java/com/gyee/cache/controller/WindturbinediController.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-04-22
+ */
+@RestController
+@RequestMapping("//windturbinedi")
+public class WindturbinediController {
+
+}

+ 61 - 0
cache/src/main/java/com/gyee/cache/controller/configure/CompanyConfigureController.java

@@ -0,0 +1,61 @@
+package com.gyee.cache.controller.configure;
+
+import com.gyee.cache.model.auto.Company;
+import com.gyee.cache.service.configure.CompanyConfigureSerivice;
+import com.gyee.common.config.R;
+import com.gyee.common.model.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @ClassName : CompanyConfigureController
+ * @Author : xieshengjie
+ * @Date: 2022/4/21 14:40
+ * @Description : 公司配置controller
+ */
+@RestController
+@RequestMapping("//companyConfigure")
+public class CompanyConfigureController {
+    @Resource
+    private CompanyConfigureSerivice companyConfigureSerivice;
+
+    @GetMapping("/list")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R list(@RequestParam(value = "id",required = true)String id,
+                  @RequestParam(value = "name",required = true)String name){
+        List<Company> resultList = companyConfigureSerivice.companyList(id,name);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.ok((long) resultList.size()).data(resultList);
+        }else{
+            return R.error().message("访问失败");
+        }
+    }
+
+    @PostMapping("/saveSingle")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R saveSingle(@RequestBody Company company){
+        Boolean aBoolean = companyConfigureSerivice.saveSingle(company);
+        if (aBoolean) {
+            return R.ok().data("保存成功");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+
+    @PostMapping("/saveBatch")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R saveBatch(@RequestBody List<Company> companies){
+        Boolean aBoolean = companyConfigureSerivice.saveBatch(companies);
+        if (aBoolean) {
+            return R.ok().data("保存成功");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+
+}

+ 62 - 0
cache/src/main/java/com/gyee/cache/controller/configure/LineConfigureController.java

@@ -0,0 +1,62 @@
+package com.gyee.cache.controller.configure;
+
+import com.gyee.cache.model.auto.Line;
+import com.gyee.cache.service.configure.LineConfigureSerivice;
+import com.gyee.common.config.R;
+import com.gyee.common.model.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @ClassName : LineConfigureController
+ * @Author : xieshengjie
+ * @Date: 2022/4/21 15:44
+ * @Description : 线路配置controller
+ */
+@RestController
+@RequestMapping("//lineConfigure")
+public class LineConfigureController {
+
+    @Resource
+    private LineConfigureSerivice lineConfigureSerivice;
+
+    @GetMapping("/list")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R list(@RequestParam(value = "id",required = true)String id,
+                  @RequestParam(value = "name",required = true)String name){
+        List<Line> resultList = lineConfigureSerivice.lineList(id,name);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.ok((long) resultList.size()).data(resultList);
+        }else{
+            return R.error().message("访问失败");
+        }
+    }
+
+
+    @PostMapping("/saveSingle")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R saveSingle(@RequestBody Line line){
+        Boolean aBoolean = lineConfigureSerivice.saveSingle(line);
+        if (aBoolean) {
+            return R.ok().data("保存成功");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+
+    @PostMapping("/saveBatch")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R saveBatch(@RequestBody List<Line> lines){
+        Boolean aBoolean = lineConfigureSerivice.saveBatch(lines);
+        if (aBoolean) {
+            return R.ok().data("保存成功");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+}

+ 62 - 0
cache/src/main/java/com/gyee/cache/controller/configure/ProjectConfigureController.java

@@ -0,0 +1,62 @@
+package com.gyee.cache.controller.configure;
+
+import com.gyee.cache.model.auto.Project;
+import com.gyee.cache.service.configure.ProjectConfigureSerivice;
+import com.gyee.common.config.R;
+import com.gyee.common.model.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @ClassName : ProjectConfigureController
+ * @Author : xieshengjie
+ * @Date: 2022/4/21 15:44
+ * @Description : 工程配置controller
+ */
+@RestController
+@RequestMapping("//projectConfigure")
+public class ProjectConfigureController {
+
+    @Resource
+    private ProjectConfigureSerivice projectConfigureSerivice;
+
+    @GetMapping("/list")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R list(@RequestParam(value = "id",required = true)String id,
+                  @RequestParam(value = "name",required = true)String name){
+        List<Project> resultList = projectConfigureSerivice.projectList(id,name);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.ok((long) resultList.size()).data(resultList);
+        }else{
+            return R.error().message("访问失败");
+        }
+    }
+
+
+    @PostMapping("/saveSingle")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R saveSingle(@RequestBody Project project){
+        Boolean aBoolean = projectConfigureSerivice.saveSingle(project);
+        if (aBoolean) {
+            return R.ok().data("保存成功");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+
+    @PostMapping("/saveBatch")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R saveBatch(@RequestBody List<Project> projects){
+        Boolean aBoolean = projectConfigureSerivice.saveBatch(projects);
+        if (aBoolean) {
+            return R.ok().data("保存成功");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+}

+ 62 - 0
cache/src/main/java/com/gyee/cache/controller/configure/RegionConfigureController.java

@@ -0,0 +1,62 @@
+package com.gyee.cache.controller.configure;
+
+import com.gyee.cache.model.auto.Region;
+import com.gyee.cache.service.configure.RegionConfigureSerivice;
+import com.gyee.common.config.R;
+import com.gyee.common.model.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @ClassName : RegionConfigureController
+ * @Author : xieshengjie
+ * @Date: 2022/4/21 14:40
+ * @Description : 区域配置controller
+ */
+@RestController
+@RequestMapping("//regionConfigure")
+public class RegionConfigureController {
+    @Resource
+    private RegionConfigureSerivice regionConfigureSerivice;
+
+    @GetMapping("/list")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R list(@RequestParam(value = "id",required = true)String id,
+                  @RequestParam(value = "name",required = true)String name,
+                  @RequestParam(value = "companyid",required = true)String companyid){
+        List<Region> resultList = regionConfigureSerivice.regionList(id,name,companyid);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.ok((long) resultList.size()).data(resultList);
+        }else{
+            return R.error().message("访问失败");
+        }
+    }
+
+    @PostMapping("/saveSingle")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R saveSingle(@RequestBody Region region){
+        Boolean aBoolean = regionConfigureSerivice.saveSingle(region);
+        if (aBoolean) {
+            return R.ok().data("保存成功");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+
+    @PostMapping("/saveBatch")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R saveBatch(@RequestBody List<Region> regions){
+        Boolean aBoolean = regionConfigureSerivice.saveBatch(regions);
+        if (aBoolean) {
+            return R.ok().data("保存成功");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+
+}

+ 61 - 0
cache/src/main/java/com/gyee/cache/controller/configure/WindpowerstationConfigureController.java

@@ -0,0 +1,61 @@
+package com.gyee.cache.controller.configure;
+
+import com.gyee.cache.model.auto.Windpowerstation;
+import com.gyee.cache.service.configure.WindpowerstationConfigureSerivice;
+import com.gyee.common.config.R;
+import com.gyee.common.model.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @ClassName : WindpowerstationConfigureController
+ * @Author : xieshengjie
+ * @Date: 2022/4/21 15:15
+ * @Description : 场站配置controller
+ */
+@RestController
+@RequestMapping("//windpowerstationConfigure")
+public class WindpowerstationConfigureController {
+    @Resource
+    private WindpowerstationConfigureSerivice windpowerstationConfigureSerivice;
+
+    @GetMapping("/list")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R list(@RequestParam(value = "id",required = true)String id,
+                  @RequestParam(value = "name",required = true)String name){
+        List<Windpowerstation> resultList = windpowerstationConfigureSerivice.windpowerstationList(id,name);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.ok((long) resultList.size()).data(resultList);
+        }else{
+            return R.error().message("访问失败");
+        }
+    }
+
+
+    @PostMapping("/saveSingle")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R saveSingle(@RequestBody Windpowerstation windpowerstation){
+        Boolean aBoolean = windpowerstationConfigureSerivice.saveSingle(windpowerstation);
+        if (aBoolean) {
+            return R.ok().data("保存成功");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+
+    @PostMapping("/saveBatch")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R saveBatch(@RequestBody List<Windpowerstation> windpowerstations){
+        Boolean aBoolean = windpowerstationConfigureSerivice.saveBatch(windpowerstations);
+        if (aBoolean) {
+            return R.ok().data("保存成功");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+}

+ 61 - 0
cache/src/main/java/com/gyee/cache/controller/configure/WindturbineConfigureController.java

@@ -0,0 +1,61 @@
+package com.gyee.cache.controller.configure;
+
+import com.gyee.cache.model.auto.Windturbine;
+import com.gyee.cache.service.configure.WindturbineConfigureSerivice;
+import com.gyee.common.config.R;
+import com.gyee.common.model.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @ClassName : CompanyConfigureController
+ * @Author : xieshengjie
+ * @Date: 2022/4/21 14:40
+ * @Description : 风机配置controller
+ */
+@RestController
+@RequestMapping("//windturbineConfigure")
+public class WindturbineConfigureController {
+    @Resource
+    private WindturbineConfigureSerivice windturbineConfigureSerivice;
+
+    @GetMapping("/list")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R list(@RequestParam(value = "id",required = true)String id,
+                  @RequestParam(value = "name",required = true)String name){
+        List<Windturbine> resultList = windturbineConfigureSerivice.windturbineList(id,name);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.ok((long) resultList.size()).data(resultList);
+        }else{
+            return R.error().message("访问失败");
+        }
+    }
+
+    @PostMapping("/saveSingle")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R saveSingle(@RequestBody Windturbine windturbine){
+        Boolean aBoolean = windturbineConfigureSerivice.saveSingle(windturbine);
+        if (aBoolean) {
+            return R.ok().data("保存成功");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+
+    @PostMapping("/saveBatch")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R saveBatch(@RequestBody List<Windturbine> windturbines){
+        Boolean aBoolean = windturbineConfigureSerivice.saveBatch(windturbines);
+        if (aBoolean) {
+            return R.ok().data("保存成功");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+
+}

+ 85 - 0
cache/src/main/java/com/gyee/cache/controller/configure/WindturbinetestingpointConfigureController.java

@@ -0,0 +1,85 @@
+package com.gyee.cache.controller.configure;
+
+import com.gyee.cache.model.auto.Windturbinetestingpointnew;
+import com.gyee.cache.service.configure.WindturbinetestingpointConfigureService;
+import com.gyee.common.config.R;
+import com.gyee.common.model.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @ClassName : WindturbinetestingpointConfigureController
+ * @Author : xieshengjie
+ * @Date: 2022/4/25 9:54
+ * @Description :
+ */
+@RestController
+@RequestMapping("//WindturbinetestingpointConfigure")
+public class WindturbinetestingpointConfigureController {
+    @Resource
+    private WindturbinetestingpointConfigureService windturbinetestingpointConfigureService;
+
+    @PostMapping("/init")
+    @ResponseBody
+    public R init(){
+        boolean b = windturbinetestingpointConfigureService.initWindturbinetestingpoints();
+        if (b) {
+            return R.ok().data("初始化成功!");
+        }else{
+            return R.error().message("访问失败");
+        }
+
+    }
+
+    @GetMapping("/list")
+    @ResponseBody
+    public R list(@RequestParam(value = "name",required = true)String name,
+                  @RequestParam(value = "code",required = true)String code,
+                  @RequestParam(value = "wpid",required = true)String wpid,
+                  @RequestParam(value = "wtid",required = true)String wtid,
+                    @RequestParam(value = "pageNum",required = true) String pageNum,
+                  @RequestParam(value = "pageSize",required = true) String pageSize){
+       List<Windturbinetestingpointnew> resultList  = windturbinetestingpointConfigureService.list(name,code,wpid,wtid,pageNum,pageSize);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.ok((long) resultList.size()).data(resultList);
+        }else{
+            return R.error().message("访问失败");
+        }
+
+    }
+    @PostMapping("/save")
+    @ResponseBody
+    public R save(@RequestBody Windturbinetestingpointnew windturbinetestingpointnew){
+        boolean b = windturbinetestingpointConfigureService.saveOrUpdate(windturbinetestingpointnew);
+        if (b) {
+            return R.ok().data("保存成功!");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+
+    @PostMapping("/saveBatch")
+    @ResponseBody
+    public R saveBatch(@RequestBody List<Windturbinetestingpointnew> windturbinetestingpointnews){
+        boolean b = windturbinetestingpointConfigureService.saveOrUpdateBatch(windturbinetestingpointnews);
+        if (b) {
+            return R.ok().data("保存成功!");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+
+    @DeleteMapping("/delete")
+    @ResponseBody
+    public R delete(@RequestBody Windturbinetestingpointnew windturbinetestingpointnew){
+        boolean b = windturbinetestingpointConfigureService.delete(windturbinetestingpointnew);
+        if (b) {
+            return R.ok().data("保存成功!");
+        }else{
+            return R.error().message("保存失败");
+        }
+    }
+
+}

+ 29 - 40
cache/src/main/java/com/gyee/cache/init/CacheContext.java

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.cache.model.auto.*;
 import com.gyee.cache.service.RedisService;
 import com.gyee.cache.service.auto.*;
+import com.gyee.common.model.algorithm.PointVo;
+import com.gyee.common.util.algorithm.LineBuild;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -55,6 +57,10 @@ public class CacheContext implements CommandLineRunner {
     private IWindturbinetestingpointdisService windturbinetestingpointdisService;
     @Autowired
     private IWindturbinestatusdiService windturbinestatusdiService;
+    @Autowired
+    private IEquipmentmodelService equipmentmodelService;
+    @Autowired
+    private IModelpowerService modelpowerService;
 
 
     public static Map<String, Map<String, Windturbinetestingpointai>> wtpointMap = new HashMap<>();
@@ -192,7 +198,7 @@ public class CacheContext implements CommandLineRunner {
         //缓存设备点
         redisService.remove("PRODUCT-WT");
         if (!redisService.hasKey("PRODUCT-WT")){
-            Map<String,Map<String,Windturbinetestingpointnew>> wtaimap = new HashMap<>();
+            Map<String,Map<String, Windturbinetestingpointnew>> wtaimap = new HashMap<>();
             List<Windturbine> windturbineList = windturbineService.list();
             windturbineList.stream().forEach(i->{
                 Map<String,Windturbinetestingpointnew> codeaimap = new HashMap<>();
@@ -336,29 +342,6 @@ public class CacheContext implements CommandLineRunner {
             redisService.set(i,s);
         });
 
-//        logger.info("--------------------------redis五种状态");
-//        Map<String,Map<String,List<Windturbinetestingpointdis>>> wzztMap = new HashMap<>();
-//        List<Windturbinetestingpointdis> windturbinetestingpointdis = windturbinetestingpointdisService.list();
-//        windturbinetestingpointdis.stream().forEach(w->{
-//            if (wzztMap.containsKey(w.getWindturbineid())){
-//                Map<String, List<Windturbinetestingpointdis>> stringListMap = wzztMap.get(w.getWindturbineid());
-//                if (stringListMap.containsKey(w.getUniformcode())){
-//                    stringListMap.get(w.getUniformcode()).add(w);
-//                }else {
-//                    List<Windturbinetestingpointdis> wdisList = new ArrayList<>();
-//                    wdisList.add(w);
-//                    stringListMap.put(w.getUniformcode(),wdisList);
-//                }
-//            }else {
-//                Map<String,List<Windturbinetestingpointdis>> map = new HashMap<>();
-//                List<Windturbinetestingpointdis> wdisList = new ArrayList<>();
-//                wdisList.add(w);
-//                map.put(w.getUniformcode(),wdisList);
-//                wzztMap.put(w.getWindturbineid(),map);
-//            }
-//        });
-//        redisService.set("WZZT",JSONObject.toJSONString(wzztMap));
-
         logger.info("--------------------------redis十三种状态");
         Map<String,List<Windturbinestatusdi>> sszztMap = new HashMap<>();
         List<Windturbinestatusdi> windturbinestatusdis = windturbinestatusdiService.list();
@@ -370,24 +353,30 @@ public class CacheContext implements CommandLineRunner {
                 wdisList.add(w);
                 sszztMap.put(w.getWindturbineid(),wdisList);
             }
-//            if (sszztMap.containsKey(w.getWindturbineid())){
-//                Map<String, List<Windturbinestatusdi>> stringListMap = sszztMap.get(w.getWindturbineid());
-//                if (stringListMap.containsKey(w.getUniformcode())){
-//                    stringListMap.get(w.getUniformcode()).add(w);
-//                }else {
-//                    List<Windturbinestatusdi> wdisList = new ArrayList<>();
-//                    wdisList.add(w);
-//                    stringListMap.put(w.getUniformcode(),wdisList);
-//                }
-//            }else {
-//                Map<String,List<Windturbinestatusdi>> map = new HashMap<>();
-//                List<Windturbinestatusdi> wdisList = new ArrayList<>();
-//                wdisList.add(w);
-//                map.put(w.getUniformcode(),wdisList);
-//                sszztMap.put(w.getWindturbineid(),map);
-//            }
         });
         redisService.set("SSZZT",JSONObject.toJSONString(sszztMap));
 
+
+        logger.info("--------------------------redis保证功率");
+        List<Modelpower> modelpowers = modelpowerService.list();
+        List<Equipmentmodel> equipmentmodels = equipmentmodelService.list();
+        Map<String,Map<Double,Double>> llglMap = new HashMap<>();
+        equipmentmodels.stream().forEach(e->{
+            List<Modelpower> modelpowerList = modelpowers.stream().filter(m -> m.getModelid().equals(e.getId())).collect(Collectors.toList());
+            double[] speeds = modelpowerList.stream().map(s -> s.getSpeed()).mapToDouble(Double::doubleValue).toArray();
+            double[] powers = modelpowerList.stream().map(s -> s.getEnsurepower()).mapToDouble(Double::doubleValue).toArray();
+            List<PointVo> pointVoList = LineBuild.buildLine(speeds, powers, speeds.length, 20, 0.01);
+            Map<Double,Double> tempMap = new HashMap<>();
+            pointVoList.stream().forEach(pointVo -> {
+                tempMap.put(pointVo.getX(),pointVo.getY());
+            });
+            llglMap.put(e.getId(),tempMap);
+        });
+        redisService.set("ZBZGL",JSONObject.toJSONString(llglMap));
+
+
+
+
+
     }
 }

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

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

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

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

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

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

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

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

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

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

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

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

+ 34 - 0
cache/src/main/java/com/gyee/cache/model/auto/Company.java

@@ -0,0 +1,34 @@
+package com.gyee.cache.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-04-21
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class Company extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String name;
+
+    private Date entrydate;
+
+    private Integer safetydayfirst;
+
+    private String pointpre;
+
+
+}

+ 48 - 0
cache/src/main/java/com/gyee/cache/model/auto/Equipmentmodel.java

@@ -0,0 +1,48 @@
+package com.gyee.cache.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-04-26
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class Equipmentmodel extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String code;
+
+    private String name;
+
+    private String description;
+
+    private Double powerproduction;
+
+    private Double cutinwindspeed;
+
+    private Double ratedwindspeed;
+
+    private String cutoutwindspeed;
+
+    private String windturbinemanufacturerid;
+
+    private String photo;
+
+    private String unit;
+
+    private Double sweptarea;
+
+    private Double equipmentcategory;
+
+
+}

+ 32 - 0
cache/src/main/java/com/gyee/cache/model/auto/Modelpower.java

@@ -0,0 +1,32 @@
+package com.gyee.cache.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-04-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class Modelpower extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String modelid;
+
+    private double speed;
+
+    private double theorypower;
+
+    private double ensurepower;
+
+
+}

+ 36 - 0
cache/src/main/java/com/gyee/cache/model/auto/Region.java

@@ -0,0 +1,36 @@
+package com.gyee.cache.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-04-21
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class Region extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String name;
+
+    private Date entrydate;
+
+    private Integer safetydayfirst;
+
+    private String pointpre;
+
+    private String companyid;
+
+
+}

+ 34 - 0
cache/src/main/java/com/gyee/cache/model/auto/Windturbineai.java

@@ -0,0 +1,34 @@
+package com.gyee.cache.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-04-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class Windturbineai extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String code;
+
+    private String name;
+
+    private String uniformcode;
+
+    @TableField("ORDERNUM")
+    private String ordernum;
+
+
+}

+ 34 - 0
cache/src/main/java/com/gyee/cache/model/auto/Windturbinedi.java

@@ -0,0 +1,34 @@
+package com.gyee.cache.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-04-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class Windturbinedi extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String code;
+
+    private String name;
+
+    private String uniformcode;
+
+    @TableField("ORDERNUM")
+    private String ordernum;
+
+
+}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 43 - 0
cache/src/main/java/com/gyee/cache/service/configure/CompanyConfigureSerivice.java

@@ -0,0 +1,43 @@
+package com.gyee.cache.service.configure;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.cache.model.auto.Company;
+import com.gyee.cache.service.auto.ICompanyService;
+import com.gyee.common.model.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @ClassName : CompanyConfigureSerivice
+ * @Author : xieshengjie
+ * @Date: 2022/4/21 14:11
+ * @Description : 公司配置
+ */
+@Service
+public class CompanyConfigureSerivice {
+    @Resource
+    private ICompanyService companyService;
+
+    public List<Company> companyList(String id,String name){
+        QueryWrapper<Company> qw = new QueryWrapper<>();
+        if (StringUtils.isNotEmpty(id)){
+            qw.like("id",id);
+        }
+        if (StringUtils.isNotEmpty(name)){
+            qw.like("name",name);
+        }
+        List<Company> companies = companyService.list(qw);
+        return companies;
+    }
+
+    public Boolean saveSingle(Company company){
+        return companyService.saveOrUpdate(company);
+    }
+
+    public Boolean saveBatch(List<Company> companies){
+        return companyService.saveOrUpdateBatch(companies);
+    }
+
+}

+ 44 - 0
cache/src/main/java/com/gyee/cache/service/configure/LineConfigureSerivice.java

@@ -0,0 +1,44 @@
+package com.gyee.cache.service.configure;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.cache.model.auto.Line;
+import com.gyee.cache.service.auto.ILineService;
+import com.gyee.common.model.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @ClassName : RegionConfigureSerivice
+ * @Author : xieshengjie
+ * @Date: 2022/4/21 14:11
+ * @Description : 公司配置
+ */
+@Service
+public class LineConfigureSerivice {
+    @Resource
+    private ILineService lineService;
+
+    public List<Line> lineList(String id, String name){
+        QueryWrapper<Line> qw = new QueryWrapper<>();
+        if (StringUtils.isNotEmpty(id)){
+            qw.like("id",id);
+        }
+        if (StringUtils.isNotEmpty(name)){
+            qw.like("name",name);
+        }
+        List<Line> lineList = lineService.list(qw);
+        return lineList;
+    }
+
+    public Boolean saveSingle(Line line){
+        return lineService.saveOrUpdate(line);
+    }
+
+    public Boolean saveBatch(List<Line> lines){
+        return lineService.saveOrUpdateBatch(lines);
+    }
+
+
+}

+ 44 - 0
cache/src/main/java/com/gyee/cache/service/configure/ProjectConfigureSerivice.java

@@ -0,0 +1,44 @@
+package com.gyee.cache.service.configure;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.cache.model.auto.Project;
+import com.gyee.cache.service.auto.IProjectService;
+import com.gyee.common.model.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @ClassName : RegionConfigureSerivice
+ * @Author : xieshengjie
+ * @Date: 2022/4/21 14:11
+ * @Description : 公司配置
+ */
+@Service
+public class ProjectConfigureSerivice {
+    @Resource
+    private IProjectService projectService;
+
+    public List<Project> projectList(String id, String name){
+        QueryWrapper<Project> qw = new QueryWrapper<>();
+        if (StringUtils.isNotEmpty(id)){
+            qw.like("id",id);
+        }
+        if (StringUtils.isNotEmpty(name)){
+            qw.like("name",name);
+        }
+        List<Project> projectList = projectService.list(qw);
+        return projectList;
+    }
+
+    public Boolean saveSingle(Project project){
+        return projectService.saveOrUpdate(project);
+    }
+
+    public Boolean saveBatch(List<Project> projects){
+        return projectService.saveOrUpdateBatch(projects);
+    }
+
+
+}

+ 46 - 0
cache/src/main/java/com/gyee/cache/service/configure/RegionConfigureSerivice.java

@@ -0,0 +1,46 @@
+package com.gyee.cache.service.configure;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.cache.model.auto.Region;
+import com.gyee.cache.service.auto.IRegionService;
+import com.gyee.common.model.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @ClassName : RegionConfigureSerivice
+ * @Author : xieshengjie
+ * @Date: 2022/4/21 14:11
+ * @Description : 公司配置
+ */
+@Service
+public class RegionConfigureSerivice {
+    @Resource
+    private IRegionService regionService;
+
+    public List<Region> regionList(String id, String name,String companyid){
+        QueryWrapper<Region> qw = new QueryWrapper<>();
+        if (StringUtils.isNotEmpty(id)){
+            qw.like("id",id);
+        }
+        if (StringUtils.isNotEmpty(name)){
+            qw.like("name",name);
+        }
+        if (StringUtils.isNotEmpty(companyid)){
+            qw.like("companyid",companyid);
+        }
+        List<Region> regions = regionService.list(qw);
+        return regions;
+    }
+
+    public Boolean saveSingle(Region region){
+        return regionService.saveOrUpdate(region);
+    }
+
+    public Boolean saveBatch(List<Region> regions){
+        return regionService.saveOrUpdateBatch(regions);
+    }
+
+}

+ 44 - 0
cache/src/main/java/com/gyee/cache/service/configure/WindpowerstationConfigureSerivice.java

@@ -0,0 +1,44 @@
+package com.gyee.cache.service.configure;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.cache.model.auto.Windpowerstation;
+import com.gyee.cache.service.auto.IWindpowerstationService;
+import com.gyee.common.model.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @ClassName : RegionConfigureSerivice
+ * @Author : xieshengjie
+ * @Date: 2022/4/21 14:11
+ * @Description : 公司配置
+ */
+@Service
+public class WindpowerstationConfigureSerivice {
+    @Resource
+    private IWindpowerstationService windpowerstationService;
+
+    public List<Windpowerstation> windpowerstationList(String id, String name){
+        QueryWrapper<Windpowerstation> qw = new QueryWrapper<>();
+        if (StringUtils.isNotEmpty(id)){
+            qw.like("id",id);
+        }
+        if (StringUtils.isNotEmpty(name)){
+            qw.like("name",name);
+        }
+        List<Windpowerstation> windpowerstations = windpowerstationService.list(qw);
+        return windpowerstations;
+    }
+
+    public Boolean saveSingle(Windpowerstation windpowerstation){
+        return windpowerstationService.saveOrUpdate(windpowerstation);
+    }
+
+    public Boolean saveBatch(List<Windpowerstation> windpowerstations){
+        return windpowerstationService.saveOrUpdateBatch(windpowerstations);
+    }
+
+
+}

+ 43 - 0
cache/src/main/java/com/gyee/cache/service/configure/WindturbineConfigureSerivice.java

@@ -0,0 +1,43 @@
+package com.gyee.cache.service.configure;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.cache.model.auto.Windturbine;
+import com.gyee.cache.service.auto.IWindturbineService;
+import com.gyee.common.model.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @ClassName : CompanyConfigureSerivice
+ * @Author : xieshengjie
+ * @Date: 2022/4/21 14:11
+ * @Description : 公司配置
+ */
+@Service
+public class WindturbineConfigureSerivice {
+    @Resource
+    private IWindturbineService windturbineService;
+
+    public List<Windturbine> windturbineList(String id, String name){
+        QueryWrapper<Windturbine> qw = new QueryWrapper<>();
+        if (StringUtils.isNotEmpty(id)){
+            qw.like("id",id);
+        }
+        if (StringUtils.isNotEmpty(name)){
+            qw.like("name",name);
+        }
+        List<Windturbine> windturbines = windturbineService.list(qw);
+        return windturbines;
+    }
+
+    public Boolean saveSingle(Windturbine windturbine){
+        return windturbineService.saveOrUpdate(windturbine);
+    }
+
+    public Boolean saveBatch(List<Windturbine> windturbines){
+        return windturbineService.saveOrUpdateBatch(windturbines);
+    }
+
+}

+ 134 - 0
cache/src/main/java/com/gyee/cache/service/configure/WindturbinetestingpointConfigureService.java

@@ -0,0 +1,134 @@
+package com.gyee.cache.service.configure;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.cache.model.auto.*;
+import com.gyee.cache.service.auto.*;
+import com.gyee.common.model.StringUtils;
+import com.gyee.common.util.CommonUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName : WindturbinetestingpointConfigureService
+ * @Author : xieshengjie
+ * @Date: 2022/4/22 12:11
+ * @Description :
+ */
+@Service
+public class WindturbinetestingpointConfigureService {
+    @Resource
+    private IWindturbinetestingpointnewService windturbinetestingpointnewService;
+    @Resource
+    private IWindturbineService windturbineService;
+    @Resource
+    private IWindturbinediService windturbinediService;
+    @Resource
+    private IWindturbineaiService windturbineaiService;
+    @Resource
+    private IWtretimepointService wtretimepointService;
+
+
+    /**
+     * 初始化风机点表
+     */
+    public boolean initWindturbinetestingpoints(){
+        List<Windturbinetestingpointnew> resultList = new ArrayList<>();
+        List<Windturbine> wtls = windturbineService.list();
+        List<Windturbinedi> windturbinedis = windturbinediService.list();
+        List<Windturbineai> windturbineais = windturbineaiService.list();
+        List<Wtretimepoint> wtretimepoints = wtretimepointService.list();
+        wtls.stream().forEach(wt->{
+            windturbinedis.stream().forEach(di->{
+                Windturbinetestingpointnew windturbinetestingpointnew = new Windturbinetestingpointnew();
+                windturbinetestingpointnew.setId(CommonUtils.getUUID());
+                windturbinetestingpointnew.setCode("INITIAL");
+                windturbinetestingpointnew.setName(wt.getCode()+di.getName());
+                windturbinetestingpointnew.setModel(wt.getModelid());
+                windturbinetestingpointnew.setModelid(wt.getModelid());
+                windturbinetestingpointnew.setWindturbineid(wt.getId());
+                windturbinetestingpointnew.setUniformcode(di.getUniformcode());
+                windturbinetestingpointnew.setWindpowerstationid(wt.getWindpowerstationid());
+                String realtimeid = "SXJN."+wt.getWindpowerstationid().split("_")[0]+"FJ";
+                windturbinetestingpointnew.setRealtimeid(realtimeid);
+                resultList.add(windturbinetestingpointnew);
+            });
+            windturbineais.stream().forEach(ai->{
+                Windturbinetestingpointnew windturbinetestingpointnew = new Windturbinetestingpointnew();
+                windturbinetestingpointnew.setId(CommonUtils.getUUID());
+                windturbinetestingpointnew.setCode("INITIAL");
+                windturbinetestingpointnew.setName(wt.getCode()+ai.getName());
+                windturbinetestingpointnew.setModel(wt.getModelid());
+                windturbinetestingpointnew.setModelid(wt.getModelid());
+                windturbinetestingpointnew.setWindturbineid(wt.getId());
+                windturbinetestingpointnew.setUniformcode(ai.getUniformcode());
+                windturbinetestingpointnew.setWindpowerstationid(wt.getWindpowerstationid());
+                String realtimeid = "SXJN."+wt.getWindpowerstationid().split("_")[0]+"FJ";
+                windturbinetestingpointnew.setRealtimeid(realtimeid);
+                resultList.add(windturbinetestingpointnew);
+            });
+            wtretimepoints.stream().forEach(u->{
+                Windturbinetestingpointnew windturbinetestingpointnew = new Windturbinetestingpointnew();
+                String uuid = CommonUtils.getUUID();
+                windturbinetestingpointnew.setId(uuid);
+                //GJY01_GC
+//                GJYFJJSFW.SX_JN_GJYF_JS_P1_L1_007_CI0249
+                String[] pros = wt.getProjectid().split("_");
+                int pro = Integer.parseInt(pros[0].substring(pros[0].length() - 2));
+                String[] lines = wt.getLineid().split("_");
+                int line = Integer.parseInt(lines[0].substring(lines[0].length() - 2));
+                String[] fjs = wt.getId().split("_");
+                String code = wt.getWindpowerstationid().split("_")[0]+"FJJSFW.SX_JN_"+wt.getWindpowerstationid().split("_")[0]+"F_JS_P"+pro+"_L"+line+"_"+fjs[1]+"_"+u.getCode()+u.getId();
+                windturbinetestingpointnew.setCode(code);
+                windturbinetestingpointnew.setName(wt.getCode()+u.getName());
+                windturbinetestingpointnew.setModel(wt.getModelid());
+                windturbinetestingpointnew.setModelid(wt.getModelid());
+                windturbinetestingpointnew.setWindturbineid(wt.getId());
+                windturbinetestingpointnew.setUniformcode(u.getUniformcode());
+                windturbinetestingpointnew.setWindpowerstationid(wt.getWindpowerstationid());
+                windturbinetestingpointnew.setRealtimeid("SXJN.JSFW"+wt.getWindpowerstationid().split("_")[0]+"FJ");
+                resultList.add(windturbinetestingpointnew);
+            });
+        });
+        boolean b = windturbinetestingpointnewService.saveOrUpdateBatch(resultList);
+        return b;
+    }
+
+
+    public boolean saveOrUpdate(Windturbinetestingpointnew windturbinetestingpointnew) {
+        return windturbinetestingpointnewService.saveOrUpdate(windturbinetestingpointnew);
+    }
+
+    public boolean delete(Windturbinetestingpointnew windturbinetestingpointnew) {
+        QueryWrapper<Windturbinetestingpointnew> qw = new QueryWrapper<>();
+        qw.eq("id",windturbinetestingpointnew.getId());
+        return windturbinetestingpointnewService.remove(qw);
+    }
+
+    public List<Windturbinetestingpointnew> list(String name, String code,String wpid, String wtid,String pageNum, String pageSize) {
+        QueryWrapper<Windturbinetestingpointnew> qw = new QueryWrapper<>();
+        if (StringUtils.isNotEmpty(name)){
+            qw.like("name",name);
+        }
+        if (StringUtils.isNotEmpty(code)){
+            qw.like("code",code);
+        }
+        if (StringUtils.isNotEmpty(wpid)){
+            qw.like("windpowerstationid",wpid);
+        }
+        if (StringUtils.isNotEmpty(wtid)){
+            qw.like("windturbineid",wtid);
+        }
+        Page<Windturbinetestingpointnew> page = new Page<>(Integer.parseInt(pageNum),Integer.parseInt(pageSize));
+        Page<Windturbinetestingpointnew> p3DeviceFaultPage = windturbinetestingpointnewService.getBaseMapper().selectPage(page, qw);
+        List<Windturbinetestingpointnew> list = p3DeviceFaultPage.getRecords();
+        return list;
+    }
+
+    public boolean saveOrUpdateBatch(List<Windturbinetestingpointnew> windturbinetestingpointnews) {
+        return windturbinetestingpointnewService.saveOrUpdateBatch(windturbinetestingpointnews);
+    }
+}

+ 2 - 3
cache/src/main/resources/application-jn.yml

@@ -83,7 +83,6 @@ logging:
     root: info
     com.example: debug
 
-
-golden:
-  baseURL: http://10.155.32.4:8011/ts
+db:
+  ur: http://10.81.3.150:8081/ts
 

+ 1 - 1
cache/src/main/resources/application.yml

@@ -1,4 +1,4 @@
 spring:
   profiles:
-    active: one
+    active: jn
 #    active: hb

+ 33 - 0
cache/src/test/java/com/gyee/cache/CacheTest.java

@@ -2,7 +2,10 @@ package com.gyee.cache;
 
 import com.gyee.cache.model.auto.*;
 import com.gyee.cache.service.auto.*;
+import com.gyee.cache.service.configure.WindturbinetestingpointConfigureService;
+import com.gyee.common.model.algorithm.PointVo;
 import com.gyee.common.util.CommonUtils;
+import com.gyee.common.util.algorithm.LineBuild;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -12,6 +15,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 import javax.annotation.Resource;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @ClassName : CacheTest
@@ -23,6 +27,7 @@ import java.util.List;
 @RunWith(SpringRunner.class)
 @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
 public class CacheTest {
+
     @Resource
     private IWindpowerstationpointnewService windpowerstationpointnewService;
     @Resource
@@ -37,6 +42,10 @@ public class CacheTest {
     private ILineService lineService;
     @Resource
     private IProjectService projectService;
+    @Resource
+    private WindturbinetestingpointConfigureService windturbinetestingpointConfigureService;
+    @Resource
+    private IModelpowerService modelpowerService;
     @Test
     public void test1(){
         List<Windturbine> wtls = windturbineService.list();
@@ -112,4 +121,28 @@ public class CacheTest {
             windpowerstationpointnewService.save(windpowerstationpointnew);
         });
     }
+    @Test
+    public void test3(){
+        windturbinetestingpointConfigureService.initWindturbinetestingpoints();
+    }
+
+    /**
+     * 生成modelpowerrd
+     */
+    @Test
+    public void test4(){
+        List<Modelpower> modelpowers = modelpowerService.list();
+        List<Modelpower> collect = modelpowers.stream().filter(i -> i.getModelid().equals("TZ2000/116-85")).collect(Collectors.toList());
+        double[] speeds = collect.stream().map(i -> i.getSpeed()).mapToDouble(Double::doubleValue).toArray();
+        double[] powers = collect.stream().map(i -> i.getEnsurepower()).mapToDouble(Double::doubleValue).toArray();
+        List<PointVo> pointVoList = LineBuild.buildLine(speeds, powers, speeds.length, 20, 0.01);
+
+    }
+
+
+    @Test
+    public void test5(){
+
+
+    }
 }

+ 13 - 3
common/src/main/java/com/gyee/common/contant/Contant.java

@@ -46,12 +46,15 @@ public class Contant {
     public static final String RPJGL = "RPJGL"; //日平均功率
     public static final String YPJGL = "YPJGL"; //月平均功率
     public static final String NPJGL = "NPJGL"; //年平均功率
-//    public static final String SSFS = "SSFS"; //实时风速
+    public static final String SSFS = "SSFS"; //实时风速
+    public static final String SSZGL = "SSZGL"; //实时功率
     public static final String AI022 = "AI022"; //风机实时风速
     public static final String AI130 = "AI130"; //风机实时功率
-    public static final String AI064 = "AI064"; //风机发电量
+    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,AI058,AI061";
+    public static final String INTERRUPTION ="AI022,AI130,AI045,AI089,AI021";
     //判断状态
     public static final String MX000 = "MX000"; //待机
     public static final String MX002 = "MX002";//运行
@@ -89,6 +92,13 @@ public class Contant {
     public static final String XDTS = "XDTS";  //限电台数
     public static final String YXTS = "YXTS";  //运行台数
 
+    public static final String ZSGL = "ZSGL";//风机自算功率
+    public static final String ZZSGL = "ZZSGL";//场站自算功率
+    public static final String BZGL = "BZGL";//风机保证功率
+    public static final String ZBZGL = "ZBZGL";//场站保证功率
+
+
+
 
 
 

+ 4 - 3
histroy/benchmarking-histroy-new/src/main/java/com/gyee/benchmarkinghistroy/model/auto/Windpowerspecificinfoday.java

@@ -1,5 +1,6 @@
 package com.gyee.benchmarkinghistroy.model.auto;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -23,9 +24,9 @@ import java.util.Date;
 public class Windpowerspecificinfoday extends Model {
 
     private static final long serialVersionUID = 1L;
-
-    @TableId("ID")
-    private Long id;
+    //解决pg数据库插入报错,别的地方是long类型
+    @TableId(value = "ID",type = IdType.INPUT)
+    private String id;
 
     @TableField("WINDPOWERSTATIONID")
     private String windpowerstationid;

+ 5 - 0
histroy/benchmarking-histroy-new/src/main/java/com/gyee/benchmarkinghistroy/service/specific/SpecificService.java

@@ -7,6 +7,7 @@ import com.gyee.benchmarkinghistroy.model.auto.*;
 import com.gyee.benchmarkinghistroy.service.auto.*;
 import com.gyee.common.model.StringUtils;
 import com.gyee.common.util.BigDecimalUtils;
+import com.gyee.common.util.CommonUtils;
 import com.gyee.common.util.DateUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -225,6 +226,8 @@ public class SpecificService {
                 zsxqcs += sxqcs;
                 windpowerspecificinfoday.setYear(year);
                 windpowerspecificinfoday.setMonth(month);
+                //将id改成uuid,解决pg数据库插入错误
+                windpowerspecificinfoday.setId(CommonUtils.getUUID());
                 windpowerspecificinfodayService.save(windpowerspecificinfoday);
 
             }
@@ -259,6 +262,8 @@ public class SpecificService {
             capacityData.setRightcount(zsxqcs);
             capacityData.setYear(year);
             capacityData.setMonth(month);
+            //将id改成uuid,解决pg数据库插入错误
+            capacityData.setId(CommonUtils.getUUID());
             windpowerspecificinfodayService.save(capacityData);
             log.info("结束执行"+day+"的专题分析数据写入");
         }

+ 3 - 3
histroy/benchmarking-histroy-new/src/main/resources/application-jn.yml

@@ -11,7 +11,7 @@ spring:
   redis:
     host: 10.81.3.155
     port: 6379
-    timeout: 100000
+    timeout: 10000000
     #    集群环境打开下面注释,单机不需要打开
     #    cluster:
     #      集群信息
@@ -27,7 +27,7 @@ spring:
         min-idle: 0
         max-idle: 8
         max-wait: -1
-    database: 19
+    database: 0
   autoconfigure:
     exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
   datasource:
@@ -84,5 +84,5 @@ logging:
 
 
 golden:
-  baseURL: http://10.81.3.155:8011/ts
+  baseURL: http://10.81.3.152:8011/ts
 

+ 2 - 2
histroy/benchmarking-histroy-new/src/main/resources/application.yml

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

+ 3 - 2
histroy/benchmarking-histroy-new/src/test/java/com/gyee/benchmarkinghistroy/BenchmarkingHistroyMainNewTest.java

@@ -40,12 +40,13 @@ public  class BenchmarkingHistroyMainNewTest {
 
     @Test
     public void test1() throws Exception {
-        String date = "2022-03-10";
-        benchmarkingHistroyService.saveEquipmentdayinfo(date,date);
+        String date = "2022-04-23";
+//        benchmarkingHistroyService.saveEquipmentdayinfo(date,date);
 //        benchmarkingHistroyService.saveEquipmentdaydetailed(date,date);
 //        benchmarkingHistroyService.saveOperationrecord(date,date);
 //        benchmarkingHistroyService.saveBeanchmarkList(date,date);
 //        benchmarkingHistroyService.saveBenchmark(date,date);
+        specificService.saveWindpowerspecificinfoday(date,date);
     }
 
     @Test

+ 7 - 3
realtime/generation-service/src/main/java/com/gyee/generation/config/GeneratorCodeConfig.java

@@ -53,11 +53,15 @@ public class GeneratorCodeConfig {
         dsc.setUsername("root");
         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:@10.83.68.165:1521:gdsj");
+
+        dsc.setDriverName("org.postgresql.Driver");
         dsc.setUsername("gdprod");
         dsc.setPassword("gd123");
-        dsc.setUrl("jdbc:oracle:thin:@10.83.68.165:1521:gdsj");
-
+        dsc.setUrl("jdbc:postgresql://10.81.3.151:5432/wisdom");
         mpg.setDataSource(dsc);
 
 

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

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

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

@@ -42,6 +42,8 @@ public class CacheContext implements CommandLineRunner {
     @Resource
     private IWindturbinestatusdiService windturbinestatusdiService;
     @Resource
+    private IWindturbinepowerService windturbinepowerService;
+    @Resource
     private RedisService redisService;
     @Value("${runWindpowerstation}")
     private String runWindpowerstation;
@@ -60,7 +62,9 @@ public class CacheContext implements CommandLineRunner {
     public static Map<String,Map<String, Windpowerstationpointnew>> wppointmap =new HashMap<>();
     public static Map<String,Project> proMap = new HashMap<>();
     public static Map<String,List<Windturbinestatusdi>> statusMap = new HashMap<>();
+    public static Map<String,Map<Double,Double>> zbzglMap = new HashMap<>();
     public static Map<String,Equipmentmodel> modelMap = new HashMap<>();
+    public static Map<String,Map<Double,Double>> zzsglMap = new HashMap<>();
     @Override
     public void run(String... args) throws Exception {
         logger.info("缓存开始------------------------------------------------------------");
@@ -126,8 +130,6 @@ public class CacheContext implements CommandLineRunner {
             wppointmap.put(wp.getId(),stringMapMap);
         });
 
-
-
         String sszzt = redisService.get("SSZZT");
          statusMap = JSONObject.parseObject(sszzt, new TypeReference<Map<String,List<Windturbinestatusdi>>>() {
         });
@@ -137,6 +139,21 @@ public class CacheContext implements CommandLineRunner {
             modelMap.put(e.getId(),e);
         });
 
+        String zbzgl = redisService.get("ZBZGL");
+        zbzglMap = JSONObject.parseObject(zbzgl, new TypeReference<Map<String,Map<Double,Double>>>() {
+        });
+
+        List<Windturbinepower> windturbinepowerList = windturbinepowerService.list().stream().filter(windturbinepower -> runWindpowerstation.contains(windturbinepower.getWindpowerstationid())).collect(Collectors.toList());
+        windturbinepowerList.stream().forEach(w -> {
+            if (zzsglMap.containsKey(w.getWindturbineid())){
+                zzsglMap.get(w.getWindturbineid()).put(w.getSpeed(),w.getTheorypower());
+            }else {
+                Map<Double,Double> tempMap = new HashMap<>();
+                tempMap.put(w.getSpeed(),w.getTheorypower());
+                zzsglMap.put(w.getWindturbineid(),tempMap);
+            }
+
+        });
 
 //        String wpString = redisService.get("PRODUCT-WP");
 //        wppointmap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Map<String, Windpowerstationpointnew>>>() {

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

@@ -0,0 +1,16 @@
+package com.gyee.generation.mapper.auto;
+
+import com.gyee.generation.model.auto.Windturbinepower;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-04-26
+ */
+public interface WindturbinepowerMapper extends BaseMapper<Windturbinepower> {
+
+}

+ 34 - 0
realtime/generation-service/src/main/java/com/gyee/generation/model/auto/Windturbinepower.java

@@ -0,0 +1,34 @@
+package com.gyee.generation.model.auto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-04-26
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class Windturbinepower extends Model {
+
+    private static final long serialVersionUID = 1L;
+    @TableId(value = "ID",type = IdType.INPUT)
+    private String id;
+
+    private String windturbineid;
+
+    private String windpowerstationid;
+
+    private Double speed;
+
+    private Double theorypower;
+
+
+}

+ 35 - 22
realtime/generation-service/src/main/java/com/gyee/generation/service/AverageAndGeneratingService.java

@@ -6,6 +6,7 @@ import com.gyee.common.model.PointData;
 import com.gyee.common.util.DateUtils;
 import com.gyee.generation.init.CacheContext;
 import com.gyee.generation.model.auto.*;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -15,7 +16,7 @@ import java.util.*;
  * @ClassName : AverageAndGeneratingService
  * @Author : xieshengjie
  * @Date: 2022/3/22 10:42
- * @Description :
+ * @Description : 平均风速,平均功率,SCADA发电量
  */
 @Service
 public class AverageAndGeneratingService {
@@ -35,6 +36,8 @@ public class AverageAndGeneratingService {
     private Map<String, Map<String, Windturbinetestingpointnew>> wtpAimap;
     @Resource
     private IEdosUtil edosUtil;
+    @Value("${typeOfElectric.direct}")
+    private String direct;
 
 
     private void init(){
@@ -138,30 +141,40 @@ public class AverageAndGeneratingService {
                         Windturbinetestingpointnew fjfdl = windturbinetestingpointnewMap.get(Contant.RFDL);
                         Windturbinetestingpointnew fjyfdl = windturbinetestingpointnewMap.get(Contant.YFDL);
                         Windturbinetestingpointnew fjnfdl = windturbinetestingpointnewMap.get(Contant.NFDL);
+                        Windturbinetestingpointnew ai138 = windturbinetestingpointnewMap.get(Contant.AI138);
+                        Windturbinetestingpointnew ai139 = windturbinetestingpointnewMap.get(Contant.AI139);
                         try {
                             //算发电量
-                            Double currentValue = 0.0;
-                            Double samedayValue = 0.0;
-                            Double monthFirstValue = 0.0;
-                            Double yearFirstValue = 0.0;
-                            PointData realData = edosUtil.getRealData(ai064);
-                            currentValue = realData.getPointValueInDouble();
-                            Optional<PointData> samedayfirst = edosUtil.getHistoryDatasSnap(ai064, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, 0l).stream().findFirst();
-                            if (samedayfirst.isPresent()){
-                                samedayValue = samedayfirst.get().getPointValueInDouble();
+                            Double rfdl = 0.0;
+                            Double yfdl = 0.0;
+                            Double nfdl = 0.0;
+                            if (direct.contains(wt.getProjectid())){
+                                rfdl = edosUtil.getRealData(ai064).getPointValueInDouble();
+                                yfdl = edosUtil.getRealData(ai138).getPointValueInDouble();
+                                nfdl = edosUtil.getRealData(ai139).getPointValueInDouble();
+                            }else{
+                                Double currentValue = 0.0;
+                                Double samedayValue = 0.0;
+                                Double monthFirstValue = 0.0;
+                                Double yearFirstValue = 0.0;
+                                PointData realData = edosUtil.getRealData(ai064);
+                                currentValue = realData.getPointValueInDouble();
+                                Optional<PointData> samedayfirst = edosUtil.getHistoryDatasSnap(ai064, samedayZero.getTime() / 1000, samedayZero.getTime() / 1000, 1l, 0l).stream().findFirst();
+                                if (samedayfirst.isPresent()){
+                                    samedayValue = samedayfirst.get().getPointValueInDouble();
+                                }
+                                Optional<PointData> monthfirst = edosUtil.getHistoryDatasSnap(ai064, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, 0l).stream().findFirst();
+                                if (monthfirst.isPresent()){
+                                    monthFirstValue = monthfirst.get().getPointValueInDouble();
+                                }
+                                Optional<PointData> yearfirst = edosUtil.getHistoryDatasSnap(ai064, yearFirstZero.getTime() / 1000, yearFirstZero.getTime() / 1000, 1l, 0l).stream().findFirst();
+                                if (yearfirst.isPresent()){
+                                    yearFirstValue = yearfirst.get().getPointValueInDouble();
+                                }
+                                rfdl = currentValue - samedayValue;
+                                yfdl = currentValue - monthFirstValue;
+                                nfdl = currentValue - yearFirstValue;
                             }
-                            Optional<PointData> monthfirst = edosUtil.getHistoryDatasSnap(ai064, monthFirstZero.getTime() / 1000, monthFirstZero.getTime() / 1000, 1l, 0l).stream().findFirst();
-                            if (monthfirst.isPresent()){
-                                monthFirstValue = monthfirst.get().getPointValueInDouble();
-                            }
-                            Optional<PointData> yearfirst = edosUtil.getHistoryDatasSnap(ai064, yearFirstZero.getTime() / 1000, yearFirstZero.getTime() / 1000, 1l, 0l).stream().findFirst();
-                            if (yearfirst.isPresent()){
-                                yearFirstValue = yearfirst.get().getPointValueInDouble();
-                            }
-                            Double rfdl = currentValue - samedayValue;
-                            Double yfdl = currentValue - monthFirstValue;
-                            Double nfdl = currentValue - yearFirstValue;
-
                             PointData fdlpointData = createPointData(fjfdl, rfdl);
                             rfdlList.add(fdlpointData);
 

+ 151 - 0
realtime/generation-service/src/main/java/com/gyee/generation/service/RealtimeSpeedPowerService.java

@@ -0,0 +1,151 @@
+package com.gyee.generation.service;
+
+import com.gyee.benchmarkinghistroy.util.realtimesource.IEdosUtil;
+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.*;
+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;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * @ClassName : RealtimeSpeedPowerService
+ * @Author : xieshengjie
+ * @Date: 2022/4/24 8:49
+ * @Description : 场站实时风速,实时功率
+ */
+@Service
+public class RealtimeSpeedPowerService {
+    @Resource
+    private IEdosUtil edosUtil;
+    private List<Windpowerstation> wpls;
+    private Map<String, List<Project>> wppromap;
+    private Map<String, List<Line>> prolinemap;
+    private Map<String, List<Windturbine>> linewtmap;
+    private Date currentDate;
+    private Map<String, Map<String, Windpowerstationpointnew>> wppointmap;
+    private Map<String, Map<String, Windpowerstationpointnew>> linepointmap;
+    private Map<String, Map<String, Windpowerstationpointnew>> propointmap;
+    private Map<String, Map<String, Windturbinetestingpointnew>> wtpAimap;
+
+    private void init(){
+        wpls = CacheContext.wpls;
+        wppromap = CacheContext.wppromap;
+        prolinemap = CacheContext.prolinemap;
+        linewtmap = CacheContext.linewtmap;
+        wppointmap = CacheContext.wppointmap;
+        linepointmap = CacheContext.linepointmap;
+        propointmap = CacheContext.propointmap;
+        wtpAimap = CacheContext.wtpAimap;
+        currentDate = DateUtils.getCurrentDate();
+    }
+
+    /**
+     * 计算场站实时风速功率
+     */
+    public void calculateRealtimeSpeedPower() throws Exception {
+        init();
+        List<PointData> resultList = new ArrayList<>();
+
+        wpls.stream().forEach(wp->{
+            AtomicReference<Double> wpSpeed = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpPower = new AtomicReference<>(0.0);
+            Map<String, Windpowerstationpointnew> wppointnewMap = wppointmap.get(wp.getId());
+            Windpowerstationpointnew wpspeedpointnew = wppointnewMap.get(Contant.SSFS);
+            Windpowerstationpointnew wppowerpointnew = wppointnewMap.get(Contant.SSZGL);
+            AtomicReference<Double> wpcount = new AtomicReference<>(0.0);
+            wppromap.get(wp.getId()).stream().forEach(project -> {
+                AtomicReference<Double> projectSpeed = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectPower = new AtomicReference<>(0.0);
+                Map<String, Windpowerstationpointnew> propointnewMap = propointmap.get(project.getId());
+                Windpowerstationpointnew prospeedpointnew = propointnewMap.get(Contant.SSFS);
+                Windpowerstationpointnew propowerpointnew = propointnewMap.get(Contant.SSZGL);
+                AtomicReference<Double> procount = new AtomicReference<>(0.0);
+                prolinemap.get(project.getId()).stream().forEach(line->{
+                    AtomicReference<Double> lineSpeed = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linePower = new AtomicReference<>(0.0);
+                    Map<String, Windpowerstationpointnew> linepointnewMap = linepointmap.get(line.getId());
+                    Windpowerstationpointnew linespeedpointnew = linepointnewMap.get(Contant.SSFS);
+                    Windpowerstationpointnew linepowerpointnew = linepointnewMap.get(Contant.SSZGL);
+                    AtomicReference<Double> count = new AtomicReference<>(0.0);
+                    linewtmap.get(line.getId()).stream().forEach(wt->{
+                        Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
+                        Windturbinetestingpointnew speedpoint = windturbinetestingpointnewMap.get(Contant.AI022);
+                        Windturbinetestingpointnew powerpoint = windturbinetestingpointnewMap.get(Contant.AI130);
+                        Windturbinetestingpointnew ztpoint = windturbinetestingpointnewMap.get(Contant.ZTMX);
+                        Boolean isOffline = false;
+                        try {
+                            Double ztvalue  = edosUtil.getRealData(ztpoint).getPointValueInDouble();
+                            if (ztvalue == 12.0){
+                                isOffline = true;
+                            }
+                            if (! isOffline){
+                                count.getAndSet(count.get() + 1);
+                                procount.getAndSet(procount.get() + 1);
+                                wpcount.getAndSet(wpcount.get() + 1);
+                                Double wtspeed = 0.0;
+                                Double wtpower = 0.0;
+                                try {
+                                    wtspeed = edosUtil.getRealData(speedpoint).getPointValueInDouble();
+                                    Double finalWtspeed = wtspeed;
+                                    lineSpeed.updateAndGet(v -> new Double((double) (v + finalWtspeed)));
+                                    projectSpeed.updateAndGet(v -> new Double((double) (v + finalWtspeed)));
+                                    wpSpeed.updateAndGet(v -> new Double((double) (v + finalWtspeed)));
+
+                                    wtpower = edosUtil.getRealData(powerpoint).getPointValueInDouble();
+                                    Double finalWtpower = wtpower;
+                                    linePower.updateAndGet(v -> new Double((double) (v + finalWtpower)));
+                                    projectPower.updateAndGet(v -> new Double((double) (v + finalWtpower)));
+                                    wpPower.updateAndGet(v -> new Double((double) (v + finalWtpower)));
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+
+                    });
+                    Double linespeedvalue = count.get()!=0 ? lineSpeed.get()/count.get() : 0.0;
+                    PointData linespeedPointData = createWpPointData(linespeedpointnew, linespeedvalue);
+                    PointData linepowerPointData = createWpPointData(linepowerpointnew, linePower.get());
+                    resultList.add(linespeedPointData);
+                    resultList.add(linepowerPointData);
+                });
+
+                Double projectspeedvalue = procount.get()!=0 ? projectSpeed.get()/procount.get() : 0.0;
+                PointData projectspeedPointData = createWpPointData(prospeedpointnew, projectspeedvalue);
+                PointData projectpowerPointData = createWpPointData(propowerpointnew, projectPower.get());
+                resultList.add(projectspeedPointData);
+                resultList.add(projectpowerPointData);
+            });
+
+            Double wpspeedvalue = wpcount.get()!=0 ? wpSpeed.get()/wpcount.get() : 0.0;
+            PointData wpspeedPointData = createWpPointData(wpspeedpointnew, wpspeedvalue);
+            PointData wppowerPointData = createWpPointData(wppowerpointnew, wpPower.get());
+            resultList.add(wpspeedPointData);
+            resultList.add(wppowerPointData);
+
+        });
+        edosUtil.sendMultiPoint(resultList);
+
+
+    }
+
+    private PointData createWpPointData(Windpowerstationpointnew linepointnew, double linespeed) {
+        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;
+    }
+}

+ 227 - 0
realtime/generation-service/src/main/java/com/gyee/generation/service/TheorypowerService.java

@@ -0,0 +1,227 @@
+package com.gyee.generation.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.benchmarkinghistroy.util.realtimesource.IEdosUtil;
+import com.gyee.common.contant.Contant;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.algorithm.PointVo;
+import com.gyee.common.util.CommonUtils;
+import com.gyee.common.util.DateUtils;
+import com.gyee.common.util.DoubleUtils;
+import com.gyee.common.util.algorithm.LineBuild;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.*;
+import com.gyee.generation.service.auto.IWindturbinepowerService;
+import com.gyee.generation.util.redis.RedisService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+
+/**
+ * @ClassName : TheorypowerService
+ * @Author : xieshengjie
+ * @Date: 2022/4/26 10:37
+ * @Description : 理论功率,保证功率
+ */
+@Service
+public class TheorypowerService {
+    @Resource
+    private IEdosUtil edosUtil;
+    @Resource
+    private RedisService redisService;
+    @Resource
+    private IWindturbinepowerService windturbinepowerService;
+    private List<Windpowerstation> wpls;
+    private Map<String, List<Project>> wppromap;
+    private Map<String, List<Line>> prolinemap;
+    private Map<String, List<Windturbine>> linewtmap;
+    private Date currentDate;
+    private Map<String, Map<String, Windpowerstationpointnew>> wppointmap;
+    private Map<String, Map<String, Windpowerstationpointnew>> linepointmap;
+    private Map<String, Map<String, Windpowerstationpointnew>> propointmap;
+    private Map<String, Map<String, Windturbinetestingpointnew>> wtpAimap;
+
+    private void init(){
+        wpls = CacheContext.wpls;
+        wppromap = CacheContext.wppromap;
+        prolinemap = CacheContext.prolinemap;
+        linewtmap = CacheContext.linewtmap;
+        wppointmap = CacheContext.wppointmap;
+        linepointmap = CacheContext.linepointmap;
+        propointmap = CacheContext.propointmap;
+        wtpAimap = CacheContext.wtpAimap;
+        currentDate = DateUtils.getCurrentDate();
+    }
+
+    /**
+     * 理论功率,保证功率
+     */
+    public void theropower() throws Exception {
+        init();
+        Map<String, Map<Double, Double>> zbzglMap = CacheContext.zbzglMap;
+        Map<String, Map<Double, Double>> zzsglMap = CacheContext.zzsglMap;
+        List<PointData> resultList = new ArrayList<>();
+        wpls.stream().forEach(wp->{
+            Map<String, Windpowerstationpointnew> wppointnewMap = wppointmap.get(wp.getId());
+            Windpowerstationpointnew wpbzglpoint = wppointnewMap.get(Contant.ZBZGL);
+            Windpowerstationpointnew wpzsglpoint = wppointnewMap.get(Contant.ZZSGL);
+            AtomicReference<Double> wpbzgl = new AtomicReference<>(0.0);
+            AtomicReference<Double> wpzsgl = new AtomicReference<>(0.0);
+            wppromap.get(wp.getId()).stream().forEach(project -> {
+                Map<String, Windpowerstationpointnew> projectpointnewMap = propointmap.get(project.getId());
+                Windpowerstationpointnew projectbzglpoint = projectpointnewMap.get(Contant.ZBZGL);
+                Windpowerstationpointnew projectzsglpoint = projectpointnewMap.get(Contant.ZZSGL);
+                AtomicReference<Double> projectbzgl = new AtomicReference<>(0.0);
+                AtomicReference<Double> projectzsgl = new AtomicReference<>(0.0);
+                prolinemap.get(project.getId()).stream().forEach(line -> {
+                    AtomicReference<Double> linebzgl = new AtomicReference<>(0.0);
+                    AtomicReference<Double> linezsgl = new AtomicReference<>(0.0);
+                    Map<String, Windpowerstationpointnew> linepointnewMap = linepointmap.get(line.getId());
+                    Windpowerstationpointnew linebzglpoint = linepointnewMap.get(Contant.ZBZGL);
+                    Windpowerstationpointnew linezsglpoint = linepointnewMap.get(Contant.ZZSGL);
+                    linewtmap.get(line.getId()).stream().forEach(wt->{
+//                        Map<Double, Double> zsglMap = zzsglMap.get(wt.getId());
+                        redisService.select(1);
+                        String s = redisService.get(wt.getId());
+                        Map<Double, Double> zsglMap = JSONObject.parseObject(s, new TypeReference<Map<Double, Double>>() {
+                        });
+                        Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
+                        Windturbinetestingpointnew speedPointnew = windturbinetestingpointnewMap.get(Contant.AI022);
+                        Windturbinetestingpointnew wtzsgl = windturbinetestingpointnewMap.get(Contant.ZSGL);
+                        Windturbinetestingpointnew wtbzgl = windturbinetestingpointnewMap.get(Contant.BZGL);
+                        Double zzsgl = 0.0;
+                        Double zbzgl = 0.0;
+                        try {
+                            Double wtspeed = DoubleUtils.keepPrecision(edosUtil.getRealData(speedPointnew).getPointValueInDouble(),2);
+                            if (zbzglMap.containsKey(wt.getModelid())){
+                                Map<Double, Double> doubleDoubleMap = zbzglMap.get(wt.getModelid());
+                                if(doubleDoubleMap.containsKey(wtspeed)){
+                                    zbzgl = doubleDoubleMap.get(wtspeed);
+                                }
+                            }
+                            if (zsglMap.containsKey(wtspeed)){
+                                zzsgl = zsglMap.get(wtspeed);
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                        Double finalZbzgl = zbzgl;
+                        linebzgl.updateAndGet(v -> v + finalZbzgl);
+                        Double finalZzsgl = zzsgl;
+                        linezsgl.updateAndGet(v -> v + finalZzsgl);
+                        PointData wtbzglpoint = createPointData(wtbzgl, zbzgl);
+                        resultList.add(wtbzglpoint);
+                        PointData wtzsglpoint = createPointData(wtzsgl, zzsgl);
+                        resultList.add(wtzsglpoint);
+                    });
+                    PointData linebzglpointdata = createWpPointData(linebzglpoint, linebzgl.get());
+                    resultList.add(linebzglpointdata);
+                    PointData linezsglpointdata = createWpPointData(linezsglpoint, linezsgl.get());
+                    resultList.add(linezsglpointdata);
+                    Double finallineZbzgl = linebzgl.get();
+                    projectbzgl.updateAndGet(v -> v + finallineZbzgl);
+                    Double finallineZzsgl = linezsgl.get();
+                    projectzsgl.updateAndGet(v -> v + finallineZzsgl);
+                });
+                PointData projectbzglpointdata = createWpPointData(projectbzglpoint, projectbzgl.get());
+                resultList.add(projectbzglpointdata);
+                PointData projectzsglpointdata = createWpPointData(projectzsglpoint, projectzsgl.get());
+                resultList.add(projectzsglpointdata);
+                Double finalprojectZbzgl = projectbzgl.get();
+               wpbzgl.updateAndGet(v -> v + finalprojectZbzgl);
+                Double finalprojectZzsgl = projectzsgl.get();
+                wpzsgl.updateAndGet(v -> v + finalprojectZzsgl);
+            });
+            PointData wpbzglpointdata = createWpPointData(wpbzglpoint, wpbzgl.get());
+            resultList.add(wpbzglpointdata);
+            PointData wpzsglpointdata = createWpPointData(wpzsglpoint, wpzsgl.get());
+            resultList.add(wpzsglpointdata);
+        });
+        edosUtil.sendMultiPoint(resultList);
+    }
+
+
+    /**
+     * 拟合功率曲线,存储到redis
+     */
+    public void fittingPower(){
+        init();
+        List<Windturbinepower> resultList = new ArrayList<>();
+        List<Windturbine> wtls = CacheContext.wtls;
+        Date date = new Date();
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.MONTH, -1);
+        Date begin = cal.getTime();
+
+        wtls.stream().forEach(wt->{
+            QueryWrapper<Windturbinepower> deleteqw = new QueryWrapper<>();
+            deleteqw.eq("windturbineid",wt.getId());
+            windturbinepowerService.remove(deleteqw);
+
+            Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
+            Windturbinetestingpointnew speedPoint = windturbinetestingpointnewMap.get(Contant.AI022);
+            Windturbinetestingpointnew powerPoint = windturbinetestingpointnewMap.get(Contant.AI130);
+            List<PointVo> pointVoList = new ArrayList<>();
+            try {
+                List<PointData> speedpoints =  edosUtil.getHistoryDatasSnap(speedPoint, begin.getTime()/1000 , date.getTime()/1000 , null, 3600l);
+                List<PointData> powerpoints = edosUtil.getHistoryDatasSnap(powerPoint, begin.getTime()/1000 , date.getTime()/1000 , null, 3600l);
+                Collections.sort(speedpoints, Comparator.comparing(PointData::getPointValueInDouble));
+                Collections.sort(powerpoints, Comparator.comparing(PointData::getPointValueInDouble));
+                double[] speeds = speedpoints.stream().map(i -> i.getPointValueInDouble()).mapToDouble(Double::doubleValue).toArray();
+                double[] powers = powerpoints.stream().map(i -> i.getPointValueInDouble()).mapToDouble(Double::doubleValue).toArray();
+                pointVoList = LineBuild.buildLine(speeds, powers, speeds.length, 20, 0.01);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            pointVoList.stream().forEach(pointVo -> {
+                Windturbinepower windturbinepower = new Windturbinepower();
+                windturbinepower.setId(CommonUtils.getUUID());
+                windturbinepower.setWindturbineid(wt.getId());
+                windturbinepower.setWindpowerstationid(wt.getWindpowerstationid());
+                windturbinepower.setSpeed(pointVo.getX());
+                windturbinepower.setTheorypower(pointVo.getY());
+                resultList.add(windturbinepower);
+            });
+        });
+        windturbinepowerService.saveBatch(resultList);
+        wtls.stream().forEach(wt->{
+            List<Windturbinepower> windturbinepowers = resultList.stream().filter(p -> p.getWindturbineid().equals(wt.getId())).collect(Collectors.toList());
+            Map<Double,Double> doubleMap = new HashMap<>();
+            windturbinepowers.stream().forEach(w->{
+                doubleMap.put(w.getSpeed(),w.getTheorypower());
+            });
+            redisService.select(1);
+            redisService.set(wt.getId(), JSONObject.toJSONString(doubleMap));
+        });
+
+    }
+
+
+
+
+    private PointData createPointData(Windturbinetestingpointnew fjfdl, Double rfdl) {
+        PointData pointData = new PointData();
+        pointData.setEdnaId(fjfdl.getCode());
+        pointData.setPointName(fjfdl.getName());
+        pointData.setPointTime(currentDate.getTime());
+        pointData.setPointValueInDouble(rfdl);
+        pointData.setPointValue(String.valueOf(rfdl));
+        return pointData;
+    }
+
+    private PointData createWpPointData(Windpowerstationpointnew linepointnew, double linespeed) {
+        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;
+    }
+}

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

@@ -0,0 +1,16 @@
+package com.gyee.generation.service.auto;
+
+import com.gyee.generation.model.auto.Windturbinepower;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-04-26
+ */
+public interface IWindturbinepowerService extends IService<Windturbinepower> {
+
+}

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

@@ -0,0 +1,20 @@
+package com.gyee.generation.service.auto.impl;
+
+import com.gyee.generation.model.auto.Windturbinepower;
+import com.gyee.generation.mapper.auto.WindturbinepowerMapper;
+import com.gyee.generation.service.auto.IWindturbinepowerService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-04-26
+ */
+@Service
+public class WindturbinepowerServiceImpl extends ServiceImpl<WindturbinepowerMapper, Windturbinepower> implements IWindturbinepowerService {
+
+}

+ 59 - 2
realtime/generation-service/src/main/java/com/gyee/generation/task/SaticScheduleTask.java

@@ -2,8 +2,7 @@ package com.gyee.generation.task;
 
 
 import com.gyee.common.util.DateUtils;
-import com.gyee.generation.service.GenerationService;
-import com.gyee.generation.service.StatusService;
+import com.gyee.generation.service.*;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.slf4j.Logger;
@@ -27,6 +26,12 @@ public class SaticScheduleTask {
     private GenerationService generationService;
     @Resource
     private StatusService statusService;
+    @Resource
+    private AverageAndGeneratingService averageAndGeneratingService;
+    @Resource
+    private RealtimeSpeedPowerService realtimeSpeedPowerService;
+    @Resource
+    private TheorypowerService theorypowerService;
     //3.添加定时任务
     /**
      * 电计量实时计算计算(电量,上网,购网,场用)
@@ -100,6 +105,58 @@ public class SaticScheduleTask {
 
     }
 
+    /**
+     * 平均风速,平均功率,scada发电量计算
+     * 每10分钟一次
+     */
+    @XxlJob("averageandGenerating-realtime")
+    public void averageandGenerating() throws Exception {
+            XxlJobHelper.log("平均风速,功率,scada发电量调度程序执行开始!........");
+            averageAndGeneratingService.saveAvespeedAndAvepowerAndScada();
+            XxlJobHelper.log("平均风速,功率,scada发电量调度程序执行完成!........");
+    }
+
+    /**
+     * 实时风速功率
+     * 只执行一次(死循环)
+     */
+    @XxlJob("speedAndPower-realtime")
+    public void speedAndPower() throws Exception {
+        while (true){
+            XxlJobHelper.log("实时风速,实时功率调度程序执行开始!........");
+            realtimeSpeedPowerService.calculateRealtimeSpeedPower();
+            XxlJobHelper.log("实时风速,实时功率调度程序执行完成!........");
+        }
+    }
+
+    /**
+     * 拟合功率曲线,存储到数据库中
+     * 一个月执行一次
+     * @throws Exception
+     */
+    @XxlJob("fittingpower-realtime")
+    public void fittingpower() throws Exception {
+        XxlJobHelper.log("拟合功率曲线调度程序执行开始!........");
+        theorypowerService.fittingPower();
+        XxlJobHelper.log("拟合功率曲线调度程序执行完成!........");
+    }
+
+
+    /**
+     * 计算理论功率,保证功率
+     * 死循环
+     * @throws Exception
+     */
+    @XxlJob("theropower-realtime")
+    public void theropower() throws Exception {
+        while (true){
+            XxlJobHelper.log("理论保证功率调度程序执行开始!........");
+            theorypowerService.theropower();
+            XxlJobHelper.log("理论保证功率调度程序执行完成!........");
+        }
+
+    }
+
 
 
 }

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

@@ -92,12 +92,18 @@ clauStatus:
   di: GJY02_GC
 
 #判断数据终端
-second: 90
+second: 300
 #判断降出力
 AI134: 17.4    #叶轮转速给定
 AI178: 17.4    #转矩给定
 #AI443:容量
 
+#计算电量直接取,如果不是1就是相减算
+typeOfElectric:
+  #直接取
+  direct: GJY02_GC
+
+
 
 
 

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

@@ -1,17 +1,21 @@
 package com.gyee.generation;
 
-import com.gyee.generation.service.AverageAndGeneratingService;
-import com.gyee.generation.service.GenerationService;
-import com.gyee.generation.service.StatusService;
+import com.gyee.common.model.PointData;
+import com.gyee.common.model.algorithm.PointVo;
+import com.gyee.common.util.algorithm.LineBuild;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.Windturbinetestingpointnew;
+import com.gyee.generation.service.*;
+import com.gyee.generation.util.realtimesource.EdosUtil;
 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;
+import java.util.*;
 
 /**
  * @ClassName : GenerationTest
@@ -29,10 +33,42 @@ public class GenerationTest {
     private StatusService statusService;
     @Resource
     private AverageAndGeneratingService averageAndGeneratingService;
+    @Resource
+    private RealtimeSpeedPowerService realtimeSpeedPowerService;
+    @Resource
+    private TheorypowerService theorypowerService;
+    @Resource
+    private EdosUtil edosUtil;
     @Test
     public void test1() throws Exception {
 //        generationService.saveMeterpointValue("2022-03-25","2022-03-25");
 //        averageAndGeneratingService.saveAvespeedAndAvepowerAndScada();
-        statusService.calculateStatus();
+//        statusService.calculateStatus();
+//        realtimeSpeedPowerService.calculateRealtimeSpeedPower();
+
+//        theorypowerService.fittingPower();
+        theorypowerService.theropower();
+    }
+
+
+    @Test
+    public void test2() throws Exception {
+        Windturbinetestingpointnew windturbinetestingpointnew = CacheContext.wtpAimap.get("GJY01_027").get("AI022");
+        Windturbinetestingpointnew windturbinetestingpointnew1 = CacheContext.wtpAimap.get("GJY01_027").get("AI130");
+        Date date = new Date();
+
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.MONTH, -1);
+        Date begin = cal.getTime();
+
+        List<PointData> speedpoints = edosUtil.getHistoryDatasSnap(windturbinetestingpointnew, begin.getTime()/1000 , date.getTime()/1000 , null, 3600l);
+        List<PointData> powerpoints = edosUtil.getHistoryDatasSnap(windturbinetestingpointnew1, begin.getTime()/1000 , date.getTime()/1000 , null, 3600l);
+        Collections.sort(speedpoints, Comparator.comparing(PointData::getPointValueInDouble));
+        Collections.sort(powerpoints, Comparator.comparing(PointData::getPointValueInDouble));
+        double[] speeds = speedpoints.stream().map(i -> i.getPointValueInDouble()).mapToDouble(Double::doubleValue).toArray();
+        double[] powers = powerpoints.stream().map(i -> i.getPointValueInDouble()).mapToDouble(Double::doubleValue).toArray();
+
+        List<PointVo> pointVoList = LineBuild.buildLine(speeds, powers, speeds.length, 20, 0.01);
     }
 }

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 54 - 24
web/benchmarking-web-hb/src/main/java/com/gyee/benchmarkingweb/service/benching/BenchmarkingService.java


+ 1 - 2
web/benchmarking-web-hb/src/main/resources/application-jn.yml

@@ -21,7 +21,6 @@ spring:
   #redis集群
   redis:
     host: 10.81.3.155
-#    host: 192.168.2.202
     port: 6379
     timeout: 100000
     #    集群环境打开下面注释,单机不需要打开
@@ -39,7 +38,7 @@ spring:
         min-idle: 0
         max-idle: 8
         max-wait: -1
-    database: 19
+    database: 0
   autoconfigure:
     exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
   datasource:

+ 2 - 2
web/benchmarking-web-hb/src/main/resources/application.yml

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