Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

全业务考评 1 rok temu
rodzic
commit
9b34cc108c
100 zmienionych plików z 3688 dodań i 518 usunięć
  1. 30 29
      benchmarking-impala/src/main/java/com/gyee/benchmarkingimpala/controller/BenchmarkingController.java
  2. 9 8
      benchmarking-impala/src/main/java/com/gyee/benchmarkingimpala/service/BenchmarkingService.java
  3. 2 2
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/HostparamController.java
  4. 95 0
      hostparam/pom.xml
  5. 13 0
      hostparam/src/main/java/com/gyee/host/HostparamApplication.java
  6. 115 0
      hostparam/src/main/java/com/gyee/host/comm/AjaxResult.java
  7. 44 0
      hostparam/src/main/java/com/gyee/host/controller/HostparamController.java
  8. 19 0
      hostparam/src/main/java/com/gyee/host/mode/CpuInfo.java
  9. 18 0
      hostparam/src/main/java/com/gyee/host/mode/DiskInfo.java
  10. 13 0
      hostparam/src/main/java/com/gyee/host/mode/GpuInfo.java
  11. 21 0
      hostparam/src/main/java/com/gyee/host/mode/Memory.java
  12. 215 0
      hostparam/src/main/java/com/gyee/host/service/HostparamService.java
  13. 42 0
      hostparam/src/main/java/com/gyee/host/service/ShellService.java
  14. 7 0
      hostparam/src/main/resources/application.yml
  15. 1 0
      pom.xml
  16. 41 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/controller/newfj/ProBasicEquipmentController.java
  17. 21 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/controller/newfj/ProBasicEquipmentPointController.java
  18. 21 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/controller/newfj/ProBasicPowerstationController.java
  19. 25 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/controller/newfj/ProBasicPowerstationPointController.java
  20. 21 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/controller/newfj/ProEconEquipmentmodelController.java
  21. 16 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/mapper/ProBasicEquipmentMapper.java
  22. 16 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/mapper/ProBasicEquipmentPointMapper.java
  23. 16 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/mapper/ProBasicPowerstationMapper.java
  24. 20 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/mapper/ProBasicPowerstationPointMapper.java
  25. 16 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/mapper/ProEconEquipmentmodelMapper.java
  26. 152 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/model/ProBasicEquipment.java
  27. 145 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/model/ProBasicEquipmentPoint.java
  28. 276 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/model/ProBasicPowerstation.java
  29. 139 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/model/ProBasicPowerstationPoint.java
  30. 120 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/model/ProEconEquipmentmodel.java
  31. 16 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/service/ProBasicEquipmentPointService.java
  32. 20 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/service/ProBasicEquipmentService.java
  33. 20 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/service/ProBasicPowerstationPointService.java
  34. 16 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/service/ProBasicPowerstationService.java
  35. 16 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/service/ProEconEquipmentmodelService.java
  36. 20 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/service/impl/ProBasicEquipmentPointServiceImpl.java
  37. 30 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/service/impl/ProBasicEquipmentServiceImpl.java
  38. 24 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/service/impl/ProBasicPowerstationPointServiceImpl.java
  39. 20 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/service/impl/ProBasicPowerstationServiceImpl.java
  40. 20 0
      power-fitting-JN/src/main/java/com.gyee.power.fitting/service/impl/ProEconEquipmentmodelServiceImpl.java
  41. 3 3
      power-fitting-JN/src/main/resources/application.yaml
  42. 40 0
      power-fitting-JN/src/main/resources/mapper/ProBasicEquipmentMapper.xml
  43. 37 0
      power-fitting-JN/src/main/resources/mapper/ProBasicEquipmentPointMapper.xml
  44. 66 0
      power-fitting-JN/src/main/resources/mapper/ProBasicPowerstationMapper.xml
  45. 35 0
      power-fitting-JN/src/main/resources/mapper/ProBasicPowerstationPointMapper.xml
  46. 32 0
      power-fitting-JN/src/main/resources/mapper/ProEconEquipmentmodelMapper.xml
  47. 20 0
      power-fitting/pom.xml
  48. 1 1
      power-fitting/src/main/java/com/gyee/power/fitting/MapperGenerator.java
  49. 2 1
      power-fitting/src/main/java/com/gyee/power/fitting/PowerBootApplication.java
  50. 15 9
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerFittingALG.java
  51. 33 6
      power-fitting/src/main/java/com/gyee/power/fitting/common/config/GyeeConfig.java
  52. 17 5
      power-fitting/src/main/java/com/gyee/power/fitting/common/constants/Constants.java
  53. 2 2
      power-fitting/src/main/java/com/gyee/power/fitting/common/result/JsonResult.java
  54. 3 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/result/ResultCode.java
  55. 31 9
      power-fitting/src/main/java/com/gyee/power/fitting/common/spring/InitialRunner.java
  56. 11 9
      power-fitting/src/main/java/com/gyee/power/fitting/common/util/DateUtil.java
  57. 46 12
      power-fitting/src/main/java/com/gyee/power/fitting/common/util/FileUtil.java
  58. 2 1
      power-fitting/src/main/java/com/gyee/power/fitting/common/util/NumberUtil.java
  59. 30 16
      power-fitting/src/main/java/com/gyee/power/fitting/common/util/PowerFittingUtil.java
  60. 64 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/agc/PowerPredictionController.java
  61. 4 4
      power-fitting/src/main/java/com/gyee/power/fitting/controller/base/WindInfoController.java
  62. 7 4
      power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/BladeController.java
  63. 2 1
      power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/DataFittingController.java
  64. 53 3
      power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/DataPrepareController.java
  65. 1 1
      power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/DataProcessController.java
  66. 12 4
      power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/DateOptionController.java
  67. 5 4
      power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/FiveLossInfoController.java
  68. 3 4
      power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/PowerTemperatureController.java
  69. 1 1
      power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/RatedPowerController.java
  70. 129 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/ReportController.java
  71. 2 3
      power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/WindDirectionController.java
  72. 18 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/PoweranalysisreportMapper.java
  73. 80 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Poweranalysisreport.java
  74. 19 2
      power-fitting/src/main/java/com/gyee/power/fitting/model/Powerfittinganalysis.java
  75. 3 1
      power-fitting/src/main/java/com/gyee/power/fitting/model/Powerwindinfo.java
  76. 2 2
      power-fitting/src/main/java/com/gyee/power/fitting/model/Windpowerstation.java
  77. 6 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Windturbine.java
  78. 5 31
      power-fitting/src/main/java/com/gyee/power/fitting/model/agc/AgcDeviateConfig.java
  79. 10 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/agc/AiPoints.java
  80. 9 9
      power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PhotovoltaicInfo.java
  81. 5 1
      power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PowerPointData.java
  82. 146 0
      power-fitting/src/main/java/com/gyee/power/fitting/schedule/DataCacheOptionTask.java
  83. 0 60
      power-fitting/src/main/java/com/gyee/power/fitting/schedule/DeviateAnalysisTask.java
  84. 3 5
      power-fitting/src/main/java/com/gyee/power/fitting/schedule/FiveLossScheduleTask.java
  85. 38 0
      power-fitting/src/main/java/com/gyee/power/fitting/schedule/ReportScheduleTask.java
  86. 28 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/PoweranalysisreportService.java
  87. 8 13
      power-fitting/src/main/java/com/gyee/power/fitting/service/PowerfittinganalysisService.java
  88. 5 4
      power-fitting/src/main/java/com/gyee/power/fitting/service/PowerwindinfoService.java
  89. 86 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/BladeService.java
  90. 93 86
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/fiveloss/FiveLossService.java
  91. 17 13
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/temperature/PowerTemperatureService.java
  92. 18 8
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/ratedpower/RatedPowerService.java
  93. 357 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/ReportService.java
  94. 1 1
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/socket/WebSocketServer.java
  95. 19 21
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/agc/AgcDeviateService.java
  96. 59 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/agc/PowerPredictionService.java
  97. 0 76
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/blade/BladeService.java
  98. 30 29
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataFittingService.java
  99. 23 14
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataPrepareService.java
  100. 0 0
      power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataProcessService.java

+ 30 - 29
benchmarking-impala/src/main/java/com/gyee/benchmarkingimpala/controller/BenchmarkingController.java

@@ -5,15 +5,16 @@ import com.gyee.benchmarkingimpala.common.StringUtils;
 import com.gyee.benchmarkingimpala.config.R;
 import com.gyee.benchmarkingimpala.init.CacheContext;
 import com.gyee.benchmarkingimpala.model.auto.*;
-import com.gyee.benchmarkingimpala.model.vo.*;
+import com.gyee.benchmarkingimpala.model.vo.FjjxbVo;
+import com.gyee.benchmarkingimpala.model.vo.FjjxbmxVo;
+import com.gyee.benchmarkingimpala.model.vo.Operation;
+import com.gyee.benchmarkingimpala.model.vo.WxsslVo;
 import com.gyee.benchmarkingimpala.service.BenchmarkingService;
 import com.gyee.benchmarkingimpala.util.RandomUtil;
 import com.gyee.benchmarkingimpala.util.SortUtils;
-import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.text.ParseException;
 import java.util.List;
 import java.util.Map;
 
@@ -533,42 +534,42 @@ public class BenchmarkingController {
                     i.setComprehensiverate(1.62);
                 }else if(i.getForeignkeyid().equals("QS_FDC")){
                     i.setComprehensiverate(1.37);
-                }else if(i.getForeignkeyid().equals("SBQ_FDC")){
+                } else if (i.getForeignkeyid().equals("SBQ_FDC")) {
                     i.setComprehensiverate(0.68);
-                }else if(i.getForeignkeyid().equals("XS_FDC")){
+                } else if (i.getForeignkeyid().equals("XS_FDC")) {
                     i.setComprehensiverate(1.82);
                 }
-                i.setResettimelyrate(RandomUtil.getRandomForDoubleBounded(91,99));
-                i.setStatetransitionrate(RandomUtil.getRandomForDoubleBounded(91,99));
-                i.setEliminationrate(RandomUtil.getRandomForDoubleBounded(91,99));
+                i.setResettimelyrate(RandomUtil.getRandomForDoubleBounded(91, 99));
+                i.setStatetransitionrate(RandomUtil.getRandomForDoubleBounded(91, 99));
+                i.setEliminationrate(RandomUtil.getRandomForDoubleBounded(91, 99));
+            });
+        }
+        if (timetype.equals("日")) {
+            resultList.stream().forEach(i -> {
+                if (i.getForeignkeyid().equals("MHS_FDC")) {
+                    i.setComprehensiverate(1.06);
+                } else if (i.getForeignkeyid().equals("NSS_FDC")) {
+                    i.setComprehensiverate(0.62);
+                } else if (i.getForeignkeyid().equals("QS_FDC")) {
+                    i.setComprehensiverate(2.37);
+                } else if (i.getForeignkeyid().equals("SBQ_FDC")) {
+                    i.setComprehensiverate(1.68);
+                } else if (i.getForeignkeyid().equals("XS_FDC")) {
+                    i.setComprehensiverate(1.82);
+                }
+                i.setResettimelyrate(RandomUtil.getRandomForDoubleBounded(91, 99));
+                i.setStatetransitionrate(RandomUtil.getRandomForDoubleBounded(91, 99));
+                i.setEliminationrate(RandomUtil.getRandomForDoubleBounded(91, 99));
             });
-            if (timetype.equals("年")){
-                resultList.stream().forEach(i->{
-                    if (i.getForeignkeyid().equals("MHS_FDC")){
-                        i.setComprehensiverate(1.06);
-                    }else if(i.getForeignkeyid().equals("NSS_FDC")){
-                        i.setComprehensiverate(0.62);
-                    }else if(i.getForeignkeyid().equals("QS_FDC")){
-                        i.setComprehensiverate(2.37);
-                    }else if(i.getForeignkeyid().equals("SBQ_FDC")){
-                        i.setComprehensiverate(1.68);
-                    }else if(i.getForeignkeyid().equals("XS_FDC")){
-                        i.setComprehensiverate(1.82);
-                    }
-                    i.setResettimelyrate(RandomUtil.getRandomForDoubleBounded(91,99));
-                    i.setStatetransitionrate(RandomUtil.getRandomForDoubleBounded(91,99));
-                    i.setEliminationrate(RandomUtil.getRandomForDoubleBounded(91,99));
-                });
-            }
         }
         Map<String, Windpowerstation> wpmap = CacheContext.wpmap;
-        resultList.stream().forEach(i->{
+        resultList.stream().forEach(i -> {
             i.setOrderno(wpmap.get(i.getForeignkeyid()).getOrdernum());
         });
-        SortUtils.sort(resultList,"orderno",SortUtils.ASC);
+        SortUtils.sort(resultList, "orderno", SortUtils.ASC);
         if (StringUtils.isNotNull(resultList)) {
             return R.ok(resultList.size()).data(resultList);
-        }else{
+        } else {
             return R.error().message("访问失败");
         }
     }

+ 9 - 8
benchmarking-impala/src/main/java/com/gyee/benchmarkingimpala/service/BenchmarkingService.java

@@ -414,8 +414,8 @@ public class BenchmarkingService  {
         }
         sb.append("sum(genecapacity) genecapacity,sum(therogenecapacity) therogenecapacity,avg(speed) speed,sum(daynhwhssdl) daynhwhssdl,sum(daynhgzssdl) daynhgzssdl,sum(daynhxdssdl) daynhxdssdl,sum(daynhqfdl) daynhqfdl,sum(daynhcfdl) daynhcfdl");
         qw.select(String.valueOf(sb));
-        qw.ge("recorddate",DateUtils.parseDate(beginDate)).le("recorddate",DateUtils.parseDate(endDate));
-
+        qw.ge("recorddate", DateUtils.parseDate(beginDate)).le("recorddate", DateUtils.parseDate(endDate));
+        qw.gt("genecapacity", 0); //由于有的风机发电量采集不到为0,导致理论电量过高,过滤发电量为0的数据
         if (StringUtils.isNotEmpty(wpids)){
             List<String> wpList = Arrays.asList(wpids.split(","));
             qw.in("windpowerstationid",wpList);
@@ -548,7 +548,8 @@ public class BenchmarkingService  {
 
         sb.append("sum(genecapacity) genecapacity,sum(therogenecapacity) therogenecapacity,avg(speed) speed,sum(daynhwhssdl1) daynhwhssdl1,sum(daynhwhssdl2) daynhwhssdl2,sum(daynhgzssdl1) daynhgzssdl1,sum(daynhgzssdl2) daynhgzssdl2,sum(daynhxdssdl1) daynhxdssdl1,sum(daynhxdssdl2) daynhxdssdl2,sum(daynhqfdl1) daynhqfdl1,sum(daynhqfdl2) daynhqfdl2,sum(daynhqfdl3) daynhqfdl3,sum(daynhqfdl4) daynhqfdl4,sum(daynhcfdl1) daynhcfdl1,sum(daynhcfdl2) daynhcfdl2 ");
         qw.select(String.valueOf(sb));
-        qw.ge("recorddate",DateUtils.parseDate(beginDate)).le("recorddate",DateUtils.parseDate(endDate));
+        qw.ge("recorddate", DateUtils.parseDate(beginDate)).le("recorddate", DateUtils.parseDate(endDate));
+        qw.gt("genecapacity", 0); //由于有的风机发电量采集不到为0,导致理论电量过高,过滤发电量为0的数据
 
         if (StringUtils.isNotEmpty(wpids)){
             List<String> wpList = Arrays.asList(wpids.split(","));
@@ -2341,11 +2342,11 @@ public class BenchmarkingService  {
                 "sum(daynhxdssdl) daynhxdssdl," +
                 "sum(daynhqfdl) daynhqfdl," +
                 "sum(daynhcfdl) daynhcfdl, " +
-                "nvl(sum(actualpower),0)/nvl(sum(theoreticalpower),1)*100 windenergy, " +
-                "nvl(sum(daynhxdssdl),0)/nvl(sum(theoreticalpower),1)*100 powerlossrate, " +
-                "nvl(sum(daynhqfdl),0)/nvl(sum(theoreticalpower),1)*100 performancelossrate, " +
-                "nvl(sum(daynhgzssdl),0)/nvl(sum(theoreticalpower),1)*100 failurelossrate, " +
-                "nvl(sum(daynhwhssdl),0)/nvl(sum(theoreticalpower),1)*100 mainlossrate," +
+                "nvl(sum(actualpower),0)/decode(sum(theoreticalpower),0,100,null,100,sum(theoreticalpower))*100 windenergy, " +
+                "nvl(sum(daynhxdssdl),0)/decode(sum(theoreticalpower),0,100,null,100,sum(theoreticalpower))*100 powerlossrate, " +
+                "nvl(sum(daynhqfdl),0)/decode(sum(theoreticalpower),0,100,null,100,sum(theoreticalpower))*100 performancelossrate, " +
+                "nvl(sum(daynhgzssdl),0)/decode(sum(theoreticalpower),0,100,null,100,sum(theoreticalpower))*100 failurelossrate, " +
+                "nvl(sum(daynhwhssdl),0)/decode(sum(theoreticalpower),0,100,null,100,sum(theoreticalpower))*100 mainlossrate," +
                 "avg(comprehensiverate) comprehensiverate,sum(actualpower)/avg(capacity) utilizationhours," +
                 "avg(windpoweraccuracy) windpoweraccuracy," +
                 "avg(agccurvefollowing) agccurvefollowing," +

+ 2 - 2
gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/HostparamController.java

@@ -21,8 +21,8 @@ public class HostparamController {
      */
     @GetMapping("/{host}/{port}")
     public JSONObject getHostParam(@PathVariable String  host,@PathVariable int port) {
-        JSONObject  json = hostparamService.exec(host,port);
-        return new JSONObject();
+        JSONObject json = hostparamService.exec(host,port);
+        return json;
     }
 
 }

+ 95 - 0
hostparam/pom.xml

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>sis-background</artifactId>
+        <groupId>com.gyee</groupId>
+        <version>0.0.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>hostparam</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna -->
+        <dependency>
+            <groupId>net.java.dev.jna</groupId>
+            <artifactId>jna</artifactId>
+            <version>5.11.0</version>
+        </dependency>
+
+        <!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna-platform -->
+        <dependency>
+            <groupId>net.java.dev.jna</groupId>
+            <artifactId>jna-platform</artifactId>
+            <version>5.11.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>net.java.dev.jna</groupId>
+            <artifactId>jna</artifactId>
+            <version>5.11.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.17</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.8.0.M4</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.votoanthuan</groupId>
+            <artifactId>sigar</artifactId>
+            <version>1.6.4</version>
+        </dependency>
+
+        <!-- https://mvnrepository.com/artifact/com.github.oshi/oshi-core -->
+        <dependency>
+            <groupId>com.github.oshi</groupId>
+            <artifactId>oshi-core</artifactId>
+            <version>6.1.6</version>
+        </dependency>
+    </dependencies>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <includeSystemScope>true</includeSystemScope>
+                    <excludes>
+                        <exclude>
+                            <groupId>org.projectlombok</groupId>
+                            <artifactId>lombok</artifactId>
+                        </exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 13 - 0
hostparam/src/main/java/com/gyee/host/HostparamApplication.java

@@ -0,0 +1,13 @@
+package com.gyee.host;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class HostparamApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(HostparamApplication.class, args);
+    }
+
+}

+ 115 - 0
hostparam/src/main/java/com/gyee/host/comm/AjaxResult.java

@@ -0,0 +1,115 @@
+package com.gyee.host.comm;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import java.util.HashMap;
+
+/**
+* @ClassName: AjaxResult
+* @Description: TODO(ajax操作消息提醒)
+* @author gyee
+* @date 2018年8月18日
+*
+ */
+public class AjaxResult extends HashMap<String, Object>
+{
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 初始化一个新创建的 Message 对象
+     */
+
+    public AjaxResult()
+    {
+    }
+
+    /**
+     * 返回错误消息
+     *
+     * @return 错误消息
+     */
+    public static AjaxResult error()
+    {
+        return error(1, "操作失败");
+    }
+
+    /**
+     * 返回错误消息
+     *
+     * @param msg 内容
+     * @return 错误消息
+     */
+    public static AjaxResult error(String msg)
+    {
+        return error(500, msg);
+    }
+
+    /**
+     * 返回错误消息
+     *
+     * @param code 错误码
+     * @param msg 内容
+     * @return 错误消息
+     */
+    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
+    public static AjaxResult error(int code, String msg)
+    {
+        AjaxResult json = new AjaxResult();
+        json.put("code", code);
+        json.put("msg", msg);
+        return json;
+    }
+
+    /**
+     * 返回成功消息
+     *
+     * @param msg 内容
+     * @return 成功消息
+     */
+    public static AjaxResult success(String msg)
+    {
+        AjaxResult json = new AjaxResult();
+        json.put("msg", msg);
+        json.put("code", 200);
+        return json;
+    }
+
+    /**
+     * 返回成功消息
+     *
+     * @return 成功消息
+     */
+    public static AjaxResult success()
+    {
+        return AjaxResult.success("操作成功");
+    }
+
+
+    public static AjaxResult successData(Object value){
+        AjaxResult json = new AjaxResult();
+        json.put("code", 200);
+        json.put("data", value);
+        return json;
+    }
+
+    public static AjaxResult successData(int code, Object value){
+        AjaxResult json = new AjaxResult();
+        json.put("code", code);
+        json.put("data", value);
+        return json;
+    }
+
+
+    /**
+     * 返回成功消息
+     *
+     * @param key 键值
+     * @param value 内容
+     * @return 成功消息
+     */
+    @Override
+    public AjaxResult put(String key, Object value)
+    {
+        super.put(key, value);
+        return this;
+    }
+}

+ 44 - 0
hostparam/src/main/java/com/gyee/host/controller/HostparamController.java

@@ -0,0 +1,44 @@
+package com.gyee.host.controller;
+
+import com.gyee.host.comm.AjaxResult;
+import com.gyee.host.mode.GpuInfo;
+import com.gyee.host.service.HostparamService;
+import com.gyee.host.service.ShellService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/hostparam")
+public class HostparamController {
+
+    @Autowired
+    private HostparamService hostparamService;
+
+    @Autowired
+    private ShellService shellService;
+
+    @GetMapping(value = "getparam")
+    public AjaxResult getParam() throws Exception{
+        Map map = hostparamService.getHostParam();
+        List<GpuInfo> gpuInfoList = hostparamService.getGpuInfos();
+        map.put("gpu",gpuInfoList);
+
+        return AjaxResult.successData(map);
+    }
+
+
+    @GetMapping(value = "gpu")
+    public AjaxResult getGPU() throws IOException {
+        List<GpuInfo> gpuInfoList = hostparamService.getGpuInfos();
+        return AjaxResult.successData(gpuInfoList);
+    }
+}
+
+
+

+ 19 - 0
hostparam/src/main/java/com/gyee/host/mode/CpuInfo.java

@@ -0,0 +1,19 @@
+package com.gyee.host.mode;
+
+import lombok.Data;
+
+@Data
+public class CpuInfo {
+
+    //cpu名称
+    private String cpuName;
+
+    //cpu数量
+    private  int  cpuNum;
+
+    //cpu核心数量
+    private  int cpuCoreNum;
+
+    //cpu线程数
+    private  int cpuhreads;
+}

+ 18 - 0
hostparam/src/main/java/com/gyee/host/mode/DiskInfo.java

@@ -0,0 +1,18 @@
+package com.gyee.host.mode;
+
+import lombok.Data;
+
+@Data
+public class DiskInfo {
+
+
+    private String diskId;
+    //磁盘名称
+    private String diskName;
+
+    //型号
+    private String diskMode;
+
+    //大小
+    private String diskSize;
+}

+ 13 - 0
hostparam/src/main/java/com/gyee/host/mode/GpuInfo.java

@@ -0,0 +1,13 @@
+package com.gyee.host.mode;
+
+import lombok.Data;
+
+@Data
+public class GpuInfo {
+    //("GPU编号")
+    private Integer number;
+
+    //("显卡名称")
+    private String name;
+
+}

+ 21 - 0
hostparam/src/main/java/com/gyee/host/mode/Memory.java

@@ -0,0 +1,21 @@
+package com.gyee.host.mode;
+
+
+import lombok.Data;
+
+@Data
+public class Memory {
+
+
+    //("总内存")
+    private String totalMemory;
+
+    //("使用内存")
+    //private String usedMemory;
+
+    //("可用内存")
+    private String useableMemory;
+
+    //("使用率")
+    //private Double usageRate;
+}

+ 215 - 0
hostparam/src/main/java/com/gyee/host/service/HostparamService.java

@@ -0,0 +1,215 @@
+package com.gyee.host.service;
+
+import cn.hutool.core.lang.Console;
+import cn.hutool.system.OsInfo;
+import cn.hutool.system.SystemUtil;
+import com.gyee.host.mode.CpuInfo;
+import com.gyee.host.mode.DiskInfo;
+import com.gyee.host.mode.GpuInfo;
+import com.gyee.host.mode.Memory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import oshi.SystemInfo;
+import oshi.hardware.*;
+import oshi.software.os.OperatingSystem;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
+@Service
+public class HostparamService {
+
+    private static final Logger logger = LoggerFactory.getLogger(HostparamService.class);
+
+
+    @Autowired
+    private ShellService shellService;
+
+    public Map getHostParam(){
+//        Console.log("======= 操作系统信息 ======");
+        OsInfo osInfo = SystemUtil.getOsInfo();
+        Console.log("操作系统:{}", osInfo.getName());
+        Console.log("系统版本:{}", osInfo.getVersion());
+//        Console.log("系统架构:{}", osInfo.getArch());
+//        Console.log("JVM总内存:{}", format(SystemUtil.getTotalMemory()));
+//        Console.log("JVM剩余内存:{}", format(SystemUtil.getFreeMemory()));
+
+
+        Map map =new HashMap();
+        SystemInfo systemInfo = new SystemInfo();
+        HardwareAbstractionLayer hardware = systemInfo.getHardware();
+        OperatingSystem operatingSystem = systemInfo.getOperatingSystem();
+
+        Console.log("======= CPU信息 ======");
+        CentralProcessor cpu = hardware.getProcessor();
+        CentralProcessor.ProcessorIdentifier cpuInfo = cpu.getProcessorIdentifier();
+        CpuInfo info = new CpuInfo();
+//        Console.log("cpu数量:{}", cpu.getPhysicalPackageCount());
+        info.setCpuNum(cpu.getPhysicalPackageCount());
+//        Console.log("cpu核心数:{}", cpu.getPhysicalProcessorCount());
+        info.setCpuCoreNum(cpu.getPhysicalProcessorCount());
+//        Console.log("cpu线程数:{}", cpu.getLogicalProcessorCount());
+        info.setCpuhreads(cpu.getLogicalProcessorCount());
+//        Console.log("cpuID:{}", cpuInfo.getProcessorID());
+//        Console.log("cpu名称:{}", cpuInfo.getName());
+        info.setCpuName(cpuInfo.getName());
+//        Console.log("cpu标识:{}", cpuInfo.getIdentifier());
+        map.put("cpu",info);
+
+//        Console.log("======= 主板信息 ======");
+//        ComputerSystem computer = hardware.getComputerSystem();
+//        Console.log("主板型号:{}", computer.getModel());
+//        Console.log("主板序列号:{}", computer.getSerialNumber());
+
+        Console.log("======= 内存信息 ======");
+        Memory m = new Memory();
+        GlobalMemory memory = hardware.getMemory();
+//        Console.log("内存大小:{}", format(memory.getTotal()));
+//        Console.log("可用内存:{}", format(memory.getAvailable()));
+        m.setTotalMemory(format(memory.getTotal()));
+        m.setUseableMemory(format(memory.getAvailable()));
+        map.put("memory",m);
+        Console.log("==========");
+        List<PhysicalMemory> memoryList = memory.getPhysicalMemory();
+//        memoryList.forEach((item) -> {
+//            Console.log("内存型号:{}", item.getManufacturer());
+//            Console.log("内存规格:{}", item.getMemoryType());
+//            Console.log("内存主频:{}", format(item.getClockSpeed()));
+//            Console.log("内存大小:{}", format(item.getCapacity()));
+//            Console.log("==========");
+//        });
+
+        Console.log("======= 物理磁盘信息 ======");
+        List<HWDiskStore> diskList = hardware.getDiskStores();
+
+        List<DiskInfo> diskInfos = new ArrayList<>();
+        diskList.forEach((disk) -> {
+            DiskInfo diskInfo = new DiskInfo();
+//            Console.log("名称:{}", disk.getName());
+            diskInfo.setDiskName(disk.getName());
+//            Console.log("型号:{}", disk.getModel());
+            diskInfo.setDiskMode(disk.getModel());
+//            Console.log("序号:{}", disk.getSerial());
+            diskInfo.setDiskId(disk.getSerial());
+//            Console.log("大小:{}", format(disk.getSize()));
+            diskInfo.setDiskSize(format(disk.getSize()));
+//            Console.log("==========");
+            diskInfos.add(diskInfo);
+        });
+
+        map.put("disk",diskInfos);
+
+//        Console.log("======= 逻辑磁盘信息 ======");
+//        FileSystem fileSystem = operatingSystem.getFileSystem();
+//        List<OSFileStore> fileList = fileSystem.getFileStores(true);
+//        fileList.forEach((file) -> {
+//            Console.log("名称:{}", file.getName());
+//            Console.log("UUID:{}", file.getUUID());
+//            Console.log("盘符:{}", file.getMount());
+//            Console.log("文件类型:{}", file.getType());
+//            Console.log("总大小:{}", format(file.getTotalSpace()));
+//            Console.log("剩余大小:{}", format(file.getUsableSpace()));
+//            Console.log("==========");
+//        });
+        return  map;
+    }
+
+
+    private static String format(long size) {
+        if (size < 1024) {
+            return size + "B";
+        } else {
+            size = size / 1024;
+        }
+        if (size < 1024) {
+            return size + "KB";
+        } else {
+            size = size / 1024;
+        }
+        if (size < 1024) {
+            size = size * 100;
+            return size / 100 + "." + size % 100 + "MB";
+        } else {
+            size = size * 100 / 1024;
+            return size / 100 + "." + size % 100 + "GB";
+        }
+    }
+
+
+
+    public List<GpuInfo> getGpuInfos() throws IOException {
+        String gpus = null;
+
+        gpus = shellService.getGPU();
+        //命令行调用后获取的信息
+        /*String gpus = "Mon Jun  1 10:47:16 2020       \n" +
+                "+-----------------------------------------------------------------------------+\n" +
+                "| NVIDIA-SMI 418.87.01    Driver Version: 418.87.01    CUDA Version: 10.1     |\n" +
+                "|-------------------------------+----------------------+----------------------+\n" +
+                "| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |\n" +
+                "| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |\n" +
+                "|===============================+======================+======================|\n" +
+                "|   0  TITAN V             Off  | 00000000:2D:00.0  On |                  N/A |\n" +
+                "| 29%   43C    P8    27W / 250W |   1123MiB / 12035MiB |      0%      Default |\n" +
+                "+-------------------------------+----------------------+----------------------+\n" +
+                "|   1  GeForce RTX 208...  Off  | 00000000:99:00.0 Off |                  N/A |\n" +
+                "|  0%   29C    P8    20W / 260W |     11MiB / 10989MiB |      0%      Default |\n" +
+                "+-------------------------------+----------------------+----------------------+\n" +
+                "                                                                               \n" +
+                "+-----------------------------------------------------------------------------+\n" +
+                "| Processes:                                                       GPU Memory |\n" +
+                "|  GPU       PID   Type   Process name                             Usage      |\n" +
+                "|=============================================================================|\n" +
+                "|    0     16841      C   inference_worker                            1077MiB |\n" +
+                "|    0     19996      G   /usr/lib/xorg/Xorg                            33MiB |\n" +
+                "+-----------------------------------------------------------------------------+\n";*/
+        //System.out.println("命令行获取的结果: " + gpus);
+        //分割废物信息
+        String[] split = gpus.split("\\|===============================\\+======================\\+======================\\|");
+        String[] gpusInfo = split[1].split("                                                                               ");
+        // 分割多个gpu
+        String[] gpuInfo = gpusInfo[0].split("\\+-------------------------------\\+----------------------\\+----------------------\\+");
+        //System.out.println("000000000000000000000000000000000");
+        List<GpuInfo> gpuInfoList = new ArrayList<>();
+        for (int i = 0; i < gpuInfo.length - 1; i++) {
+            GpuInfo gpuInfo1 = new GpuInfo();
+            String[] nameAndInfo = gpuInfo[i].split("\n");
+            //只要第二块的数据
+            /*0
+             *TITAN
+             *V
+             *Off
+             * */
+            String[] split1 = nameAndInfo[1].split("\\|")[1] // 0  TITAN V             Off
+                    .split("\\s+");//去空格
+
+            gpuInfo1.setNumber(Integer.parseInt(split1[1]));
+            StringBuffer name = new StringBuffer();
+            for (int j = 0; j < split1.length - 1; j++) {
+                if (j > 1 && j != split1.length) {
+                    name.append(split1[j] + " ");
+                }
+            }
+            gpuInfo1.setName(name.toString());
+
+            String[] info = nameAndInfo[2].split("\\|")[2].split("\\s+");
+            /* System.out.println("biubiu~~~biubiu~~~biubiu~~~biubiu~~~biubiu~~~biubiu~~~biubiu~~~biubiu~~~biubiu~~~biubiu~~~");*/
+//            gpuInfo1.setUsedMemory(info[1]);
+//            gpuInfo1.setTotalMemory(info[3]);
+//            int useable = Integer.parseInt(gpuInfo1.getTotalMemory().split("MiB")[0]) - Integer.parseInt(gpuInfo1.getUsedMemory().split("MiB")[0]);
+//            gpuInfo1.setUseableMemory(useable + "MiB");
+//            Double usageRate = Integer.parseInt(gpuInfo1.getUsedMemory().split("MiB")[0]) * 100.00 / Integer.parseInt(gpuInfo1.getTotalMemory().split("MiB")[0]);
+//            gpuInfo1.setUsageRate(usageRate);
+            gpuInfoList.add(gpuInfo1);
+
+        }
+        return gpuInfoList;
+    }
+
+}

+ 42 - 0
hostparam/src/main/java/com/gyee/host/service/ShellService.java

@@ -0,0 +1,42 @@
+package com.gyee.host.service;
+
+import com.sun.jna.Platform;
+import org.springframework.stereotype.Service;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+
+@Service
+public class ShellService {
+
+    private static HashMap<String, Process> processHashMap = new HashMap<>();
+
+    public String getGPU() throws IOException {
+        Process process = null;
+        try {
+            if (Platform.isWindows()) {
+                process = Runtime.getRuntime().exec("nvidia-smi.exe");
+            } else if (Platform.isLinux()) {
+                String[] shell = {"/bin/bash", "-c", "nvidia-smi"};
+                process = Runtime.getRuntime().exec(shell);
+            }
+
+            process.getOutputStream().close();
+        } catch (IOException e) {
+            e.printStackTrace();
+          return null;
+        }
+
+        BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+
+        StringBuffer stringBuffer = new StringBuffer();
+        String line = "";
+        while (null != (line = reader.readLine())) {
+            stringBuffer.append(line + "\n");
+        }
+
+        return stringBuffer.toString();
+    }
+}

+ 7 - 0
hostparam/src/main/resources/application.yml

@@ -0,0 +1,7 @@
+server:
+  port: 85200
+  servlet:
+   encoding:
+    charset: UTF-8
+    enabled: true
+    force: true

+ 1 - 0
pom.xml

@@ -25,6 +25,7 @@
         <module>gyee-sample-impala</module>
         <module>power-fitting</module>
         <module>power-fitting-JN</module>
+        <module>hostparam</module>
     </modules>
 
 

+ 41 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/controller/newfj/ProBasicEquipmentController.java

@@ -0,0 +1,41 @@
+package com.gyee.power.fitting.controller.newfj;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.power.fitting.common.result.JsonResult;
+import com.gyee.power.fitting.common.result.ResultCode;
+import com.gyee.power.fitting.model.ProBasicEquipment;
+import com.gyee.power.fitting.service.ProBasicEquipmentService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 风机&光伏 前端控制器
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@RestController
+@RequestMapping("/proBasicEquipment")
+public class ProBasicEquipmentController {
+
+
+    @Autowired
+    private ProBasicEquipmentService proBasicEquipmentService;
+
+    @GetMapping("data")
+    public JSONObject getlist(@RequestParam(value = "ids",  required = false) String ids){
+        List<ProBasicEquipment> list = proBasicEquipmentService.getlist();
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+
+}
+

+ 21 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/controller/newfj/ProBasicEquipmentPointController.java

@@ -0,0 +1,21 @@
+package com.gyee.power.fitting.controller.newfj;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 设备测点 前端控制器
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@RestController
+@RequestMapping("/proBasicEquipmentPoint")
+public class ProBasicEquipmentPointController {
+
+}
+

+ 21 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/controller/newfj/ProBasicPowerstationController.java

@@ -0,0 +1,21 @@
+package com.gyee.power.fitting.controller.newfj;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@RestController
+@RequestMapping("/proBasicPowerstation")
+public class ProBasicPowerstationController {
+
+}
+

+ 25 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/controller/newfj/ProBasicPowerstationPointController.java

@@ -0,0 +1,25 @@
+package com.gyee.power.fitting.controller.newfj;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 场站测点,期次测点,线路测点,三级公司测点,区域测点
+
+
+
++方阵测点 前端控制器
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@RestController
+@RequestMapping("/proBasicPowerstationPoint")
+public class ProBasicPowerstationPointController {
+
+}
+

+ 21 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/controller/newfj/ProEconEquipmentmodelController.java

@@ -0,0 +1,21 @@
+package com.gyee.power.fitting.controller.newfj;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@RestController
+@RequestMapping("/proEconEquipmentmodel")
+public class ProEconEquipmentmodelController {
+
+}
+

+ 16 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/mapper/ProBasicEquipmentMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.ProBasicEquipment;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 风机&光伏 Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+public interface ProBasicEquipmentMapper extends BaseMapper<ProBasicEquipment> {
+
+}

+ 16 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/mapper/ProBasicEquipmentPointMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.ProBasicEquipmentPoint;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 设备测点 Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+public interface ProBasicEquipmentPointMapper extends BaseMapper<ProBasicEquipmentPoint> {
+
+}

+ 16 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/mapper/ProBasicPowerstationMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.ProBasicPowerstation;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+public interface ProBasicPowerstationMapper extends BaseMapper<ProBasicPowerstation> {
+
+}

+ 20 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/mapper/ProBasicPowerstationPointMapper.java

@@ -0,0 +1,20 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.ProBasicPowerstationPoint;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 场站测点,期次测点,线路测点,三级公司测点,区域测点
+
+
+
++方阵测点 Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+public interface ProBasicPowerstationPointMapper extends BaseMapper<ProBasicPowerstationPoint> {
+
+}

+ 16 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/mapper/ProEconEquipmentmodelMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.ProEconEquipmentmodel;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+public interface ProEconEquipmentmodelMapper extends BaseMapper<ProEconEquipmentmodel> {
+
+}

+ 152 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/model/ProBasicEquipment.java

@@ -0,0 +1,152 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.time.LocalDate;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 风机&光伏
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("pro_basic_equipment")
+public class ProBasicEquipment extends Model<ProBasicEquipment> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 编码
+     */
+    private String nemCode;
+
+    /**
+     * 场站编号(冗余)
+     */
+    private String windpowerstationId;
+
+    /**
+     * 地球经度
+     */
+    private String longitude;
+
+    /**
+     * 地球纬度
+     */
+    private String latitude;
+
+    /**
+     * 型号编号
+     */
+    private String modelId;
+
+    /**
+     * 状态
+     */
+    private String status;
+
+    /**
+     * 工程编号(冗余)
+     */
+    private String projectId;
+
+    /**
+     * 线路编号
+     */
+    private String lineId;
+
+    /**
+     * 首次并网时间
+     */
+    private LocalDate firstIntegratedTime;
+
+    /**
+     * 图片
+     */
+    private String photo;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 别名
+     */
+    private String aname;
+
+    /**
+     * 是否是标杆设备
+     */
+    private Integer isStandard;
+
+    /**
+     * 区域编号
+     */
+    private String regionId;
+
+    /**
+     * 公司编号
+     */
+    private String companyId;
+
+    /**
+     * 是否可用
+     */
+    private Integer isable;
+
+    /**
+     * 1:陆地;2:海上;3:集中;4:组串
+     */
+    private Integer equipmentCategory;
+
+    private String parentId;
+
+    private String squareId;
+
+    /**
+     * 备用1
+     */
+    private String spare1;
+
+    /**
+     * 备用2
+     */
+    private String spare2;
+
+    /**
+     * 备用3
+     */
+    private String spare3;
+
+    /**
+     * 备用4
+     */
+    private String spare4;
+
+    /**
+     * 排序
+     */
+    private Integer orderNum;
+
+    private String substationId;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 145 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/model/ProBasicEquipmentPoint.java

@@ -0,0 +1,145 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 设备测点
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("pro_basic_equipment_point")
+public class ProBasicEquipmentPoint extends Model<ProBasicEquipmentPoint> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 编码
+     */
+    private String nemCode;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 实时库名称
+     */
+    private String aname;
+
+    /**
+     * 型号
+     */
+    private String model;
+
+    /**
+     * 单位
+     */
+    private String valueUnit;
+
+    /**
+     * 英文名称
+     */
+    private String englishName;
+
+    /**
+     * 类型编号
+     */
+    private String typeId;
+
+    /**
+     * 所属型号
+     */
+    private String modelId;
+
+    /**
+     * 最大值
+     */
+    private String maxval;
+
+    /**
+     * 最小值
+     */
+    private String minval;
+
+    /**
+     * 合理最大值
+     */
+    private String reasonableMaxval;
+
+    /**
+     * 合理最小值
+     */
+    private String reasonableMinval;
+
+    /**
+     * 风机编号
+     */
+    private String windturbineId;
+
+    /**
+     * 统一编码
+     */
+    private String uniformCode;
+
+    /**
+     * 短ID
+     */
+    private String shortId;
+
+    /**
+     * 长ID
+     */
+    private String longId;
+
+    /**
+     * 场站编号
+     */
+    private String windpowerstationId;
+
+    /**
+     * 实时配置编号
+     */
+    private String realtimeId;
+
+    /**
+     * 部件编号
+     */
+    private String logicalUnitId;
+
+    /**
+     * 集团测点编号
+     */
+    private String groupPointId;
+
+    /**
+     * 具体名称
+     */
+    private String specificName;
+
+    /**
+     * 系数
+     */
+    private String coefficient;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 276 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/model/ProBasicPowerstation.java

@@ -0,0 +1,276 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("pro_basic_powerstation")
+public class ProBasicPowerstation extends Model<ProBasicPowerstation> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 编码
+     */
+    private String nemCode;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 地址
+     */
+    private String address;
+
+    /**
+     * 电话
+     */
+    private String telephone;
+
+    /**
+     * 风电装机容量
+     */
+    private String windCapacity;
+
+    /**
+     * 风电容量单位
+     */
+    private String windCapacityUnit;
+
+    /**
+     * 风电装机数量海上
+     */
+    private Integer windQuantityHs;
+
+    /**
+     * 风电装机数量陆地
+     */
+    private Integer windQuantityLd;
+
+    /**
+     * 光伏装机容量
+     */
+    private String capacity;
+
+    /**
+     * 光伏容量单位
+     */
+    private String capacityUnit;
+
+    /**
+     * 光伏装机数量集中
+     */
+    private Integer quantityJz;
+
+    /**
+     * 光伏装机数量组串
+     */
+    private Integer quantityZc;
+
+    /**
+     * 接入风电装机容量
+     */
+    private String jrwindCapacity;
+
+    /**
+     * 接入风电容量单位
+     */
+    private String jrwindCapacityUnit;
+
+    /**
+     * 接入风电装机数量海上
+     */
+    private Integer jrwindQuantityHs;
+
+    /**
+     * 接入风电装机数量陆地
+     */
+    private Integer jrwindQuantityLd;
+
+    /**
+     * 接入光伏装机容量
+     */
+    private String jrCapacity;
+
+    /**
+     * 接入光伏容量单位
+     */
+    private String jrCapacityUnit;
+
+    /**
+     * 接入光伏装机数量集中
+     */
+    private Integer jrquantityJz;
+
+    /**
+     * 接入光伏装机数量组串
+     */
+    private Integer jrquantityZc;
+
+    /**
+     * 别名
+     */
+    private String aname;
+
+    /**
+     * 地球经度
+     */
+    private String longitude;
+
+    /**
+     * 地球纬度
+     */
+    private String latitude;
+
+    /**
+     * 图片
+     */
+    private String photo;
+
+    /**
+     * 系统厂家
+     */
+    private String systemManufact;
+
+    /**
+     * 场长
+     */
+    private String headfarm;
+
+    /**
+     * 场长电话
+     */
+    private String headfarmPhone;
+
+    /**
+     * 机型
+     */
+    private String model;
+
+    /**
+     * 顺序
+     */
+    private Integer orderNum;
+
+    /**
+     * 海拔高度
+     */
+    private String height;
+
+    /**
+     * 场站类型(-1为风电)(-2为光伏)
+     */
+    private String windType;
+
+    /**
+     * 公司编号
+     */
+    private String companyId;
+
+    /**
+     * 区域编号
+     */
+    private String regionId;
+
+    /**
+     * 集团编号
+     */
+    private String groupId;
+
+    /**
+     * 是否可用(0是待建)(1是投产)(0是不参与计算)(1是参与计算)
+     */
+    private Integer isAble;
+
+    /**
+     * 备用1
+     */
+    private String spare1;
+
+    /**
+     * 备用2
+     */
+    private String spare2;
+
+    /**
+     * 备用3
+     */
+    private String spare3;
+
+    /**
+     * 备用4
+     */
+    private String spare4;
+
+    /**
+     * 核准容量
+     */
+    private String appCapacity;
+
+    /**
+     * 在建容量
+     */
+    private String conCapacity;
+
+    /**
+     * 并网容量
+     */
+    private String gridCapacity;
+
+    private String hoiCapacity;
+
+    /**
+     * 首批并网时间
+     */
+    private LocalDateTime firstGridTime;
+
+    /**
+     * 整场投运时间
+     */
+    private LocalDateTime wholeGridTime;
+
+    /**
+     * 测风塔数量
+     */
+    private Integer anemoNumber;
+
+    /**
+     * 升压站数量
+     */
+    private Integer stationNumber;
+
+    private Integer xPoint;
+
+    private Integer yPoint;
+
+    private Integer xEmPoint;
+
+    private Integer yEmPoint;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 139 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/model/ProBasicPowerstationPoint.java

@@ -0,0 +1,139 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 场站测点,期次测点,线路测点,三级公司测点,区域测点
+
+
+
++方阵测点
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("pro_basic_powerstation_point")
+public class ProBasicPowerstationPoint extends Model<ProBasicPowerstationPoint> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 编码
+     */
+    private String nemCode;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 实时库名称
+     */
+    private String aname;
+
+    /**
+     * 型号
+     */
+    private String model;
+
+    /**
+     * 单位
+     */
+    private String valueUnit;
+
+    /**
+     * 英文名称
+     */
+    private String englishName;
+
+    /**
+     * 类型编号
+     */
+    private String typeId;
+
+    /**
+     * 所属型号
+     */
+    private String modelId;
+
+    /**
+     * 最大值
+     */
+    private String maxval;
+
+    /**
+     * 最小值
+     */
+    private String minval;
+
+    /**
+     * 合理最大值
+     */
+    private String reasonableMaxval;
+
+    /**
+     * 合理最小值
+     */
+    private String reasonableMinval;
+
+    /**
+     * 统一编码
+     */
+    private String uniformCode;
+
+    /**
+     * 短ID
+     */
+    private String shortId;
+
+    /**
+     * 长ID
+     */
+    private String longId;
+
+    /**
+     * 场站编号
+     */
+    private String windpowerstationId;
+
+    /**
+     * 实时配置编号
+     */
+    private String realtimeId;
+
+    /**
+     * 集团测点编号
+     */
+    private String groupPointId;
+
+    /**
+     * 具体名称
+     */
+    private String specificName;
+
+    /**
+     * 系数
+     */
+    private String coefficient;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 120 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/model/ProEconEquipmentmodel.java

@@ -0,0 +1,120 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("pro_econ_equipmentmodel")
+public class ProEconEquipmentmodel extends Model<ProEconEquipmentmodel> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 编码
+     */
+    private String nemCode;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 别名
+     */
+    private String aname;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+    /**
+     * 容量
+     */
+    private String powerProduction;
+
+    /**
+     * 厂商编号
+     */
+    private String windturbineManufacturerId;
+
+    /**
+     * 图片
+     */
+    private String photo;
+
+    /**
+     * 传输总发电量单位
+     */
+    private String unit;
+
+    /**
+     * 切入风速
+     */
+    private String cutinwindSpeed;
+
+    /**
+     * 额定风速
+     */
+    private String ratedwindSpeed;
+
+    /**
+     * 切出风速
+     */
+    private String cutoutwindSpeed;
+
+    /**
+     * 叶片切入面积
+     */
+    private String sweptArea;
+
+    /**
+     * 设备类别
+     */
+    private String equipmentCategory;
+
+    /**
+     * 备用1
+     */
+    private String spare1;
+
+    /**
+     * 备用1
+     */
+    private String spare2;
+
+    /**
+     * 备用3
+     */
+    private String spare3;
+
+    /**
+     * 备用4
+     */
+    private String spare4;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 16 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/ProBasicEquipmentPointService.java

@@ -0,0 +1,16 @@
+package com.gyee.power.fitting.service;
+
+import com.gyee.power.fitting.model.ProBasicEquipmentPoint;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 设备测点 服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+public interface ProBasicEquipmentPointService extends IService<ProBasicEquipmentPoint> {
+
+}

+ 20 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/ProBasicEquipmentService.java

@@ -0,0 +1,20 @@
+package com.gyee.power.fitting.service;
+
+import com.gyee.power.fitting.model.ProBasicEquipment;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 风机&光伏 服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+public interface ProBasicEquipmentService extends IService<ProBasicEquipment> {
+
+
+    List<ProBasicEquipment> getlist();
+}

+ 20 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/ProBasicPowerstationPointService.java

@@ -0,0 +1,20 @@
+package com.gyee.power.fitting.service;
+
+import com.gyee.power.fitting.model.ProBasicPowerstationPoint;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 场站测点,期次测点,线路测点,三级公司测点,区域测点
+
+
+
++方阵测点 服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+public interface ProBasicPowerstationPointService extends IService<ProBasicPowerstationPoint> {
+
+}

+ 16 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/ProBasicPowerstationService.java

@@ -0,0 +1,16 @@
+package com.gyee.power.fitting.service;
+
+import com.gyee.power.fitting.model.ProBasicPowerstation;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+public interface ProBasicPowerstationService extends IService<ProBasicPowerstation> {
+
+}

+ 16 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/ProEconEquipmentmodelService.java

@@ -0,0 +1,16 @@
+package com.gyee.power.fitting.service;
+
+import com.gyee.power.fitting.model.ProEconEquipmentmodel;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+public interface ProEconEquipmentmodelService extends IService<ProEconEquipmentmodel> {
+
+}

+ 20 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/impl/ProBasicEquipmentPointServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.power.fitting.service.impl;
+
+import com.gyee.power.fitting.model.ProBasicEquipmentPoint;
+import com.gyee.power.fitting.mapper.ProBasicEquipmentPointMapper;
+import com.gyee.power.fitting.service.ProBasicEquipmentPointService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 设备测点 服务实现类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@Service
+public class ProBasicEquipmentPointServiceImpl extends ServiceImpl<ProBasicEquipmentPointMapper, ProBasicEquipmentPoint> implements ProBasicEquipmentPointService {
+
+}

+ 30 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/impl/ProBasicEquipmentServiceImpl.java

@@ -0,0 +1,30 @@
+package com.gyee.power.fitting.service.impl;
+
+import com.gyee.power.fitting.common.base.ExcludeQueryWrapper;
+import com.gyee.power.fitting.model.ProBasicEquipment;
+import com.gyee.power.fitting.mapper.ProBasicEquipmentMapper;
+import com.gyee.power.fitting.service.ProBasicEquipmentService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 风机&光伏 服务实现类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@Service
+public class ProBasicEquipmentServiceImpl extends ServiceImpl<ProBasicEquipmentMapper, ProBasicEquipment> implements ProBasicEquipmentService {
+
+    @Override
+    public List<ProBasicEquipment> getlist() {
+        ExcludeQueryWrapper wrapper = new ExcludeQueryWrapper();
+        wrapper.eq("windpowerstation_id", "SXJ_KGDL_HSM_FDC_STA");
+        List<ProBasicEquipment> list = baseMapper.selectList(wrapper);
+        return list;
+    }
+}

+ 24 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/impl/ProBasicPowerstationPointServiceImpl.java

@@ -0,0 +1,24 @@
+package com.gyee.power.fitting.service.impl;
+
+import com.gyee.power.fitting.model.ProBasicPowerstationPoint;
+import com.gyee.power.fitting.mapper.ProBasicPowerstationPointMapper;
+import com.gyee.power.fitting.service.ProBasicPowerstationPointService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 场站测点,期次测点,线路测点,三级公司测点,区域测点
+
+
+
++方阵测点 服务实现类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@Service
+public class ProBasicPowerstationPointServiceImpl extends ServiceImpl<ProBasicPowerstationPointMapper, ProBasicPowerstationPoint> implements ProBasicPowerstationPointService {
+
+}

+ 20 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/impl/ProBasicPowerstationServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.power.fitting.service.impl;
+
+import com.gyee.power.fitting.model.ProBasicPowerstation;
+import com.gyee.power.fitting.mapper.ProBasicPowerstationMapper;
+import com.gyee.power.fitting.service.ProBasicPowerstationService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@Service
+public class ProBasicPowerstationServiceImpl extends ServiceImpl<ProBasicPowerstationMapper, ProBasicPowerstation> implements ProBasicPowerstationService {
+
+}

+ 20 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/impl/ProEconEquipmentmodelServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.power.fitting.service.impl;
+
+import com.gyee.power.fitting.model.ProEconEquipmentmodel;
+import com.gyee.power.fitting.mapper.ProEconEquipmentmodelMapper;
+import com.gyee.power.fitting.service.ProEconEquipmentmodelService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-09-22
+ */
+@Service
+public class ProEconEquipmentmodelServiceImpl extends ServiceImpl<ProEconEquipmentmodelMapper, ProEconEquipmentmodel> implements ProEconEquipmentmodelService {
+
+}

+ 3 - 3
power-fitting-JN/src/main/resources/application.yaml

@@ -1,6 +1,6 @@
 gyee:
   # 实时适配器的url
-  adapter-url: http://10.155.32.4:8011
+  adapter-url: http://10.81.3.152:8098
   # 数据准备保存路径(原始数据)
   file-path-prepare: data/prepare/
   # 数据处理保存路径(处理后的数据)
@@ -38,8 +38,8 @@ spring:
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
     # 宁夏三区oracle
-    url: jdbc:postgresql://10.81.3.151:5432/wisdom
-    username: gdprod
+    url: jdbc:postgresql://10.81.3.151:5432/IMS_NEM_JN
+    username: postgres
     password: gd123
     driver-class-name: org.postgresql.Driver
 

+ 40 - 0
power-fitting-JN/src/main/resources/mapper/ProBasicEquipmentMapper.xml

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.power.fitting.mapper.ProBasicEquipmentMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gyee.power.fitting.model.ProBasicEquipment">
+        <id column="id" property="id" />
+        <result column="nem_code" property="nemCode" />
+        <result column="windpowerstation_id" property="windpowerstationId" />
+        <result column="longitude" property="longitude" />
+        <result column="latitude" property="latitude" />
+        <result column="model_id" property="modelId" />
+        <result column="status" property="status" />
+        <result column="project_id" property="projectId" />
+        <result column="line_id" property="lineId" />
+        <result column="first_integrated_time" property="firstIntegratedTime" />
+        <result column="photo" property="photo" />
+        <result column="name" property="name" />
+        <result column="aname" property="aname" />
+        <result column="is_standard" property="isStandard" />
+        <result column="region_id" property="regionId" />
+        <result column="company_id" property="companyId" />
+        <result column="isable" property="isable" />
+        <result column="equipment_category" property="equipmentCategory" />
+        <result column="parent_id" property="parentId" />
+        <result column="square_id" property="squareId" />
+        <result column="spare1" property="spare1" />
+        <result column="spare2" property="spare2" />
+        <result column="spare3" property="spare3" />
+        <result column="spare4" property="spare4" />
+        <result column="order_num" property="orderNum" />
+        <result column="substation_id" property="substationId" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, nem_code, windpowerstation_id, longitude, latitude, model_id, status, project_id, line_id, first_integrated_time, photo, name, aname, is_standard, region_id, company_id, isable, equipment_category, parent_id, square_id, spare1, spare2, spare3, spare4, order_num, substation_id
+    </sql>
+
+</mapper>

+ 37 - 0
power-fitting-JN/src/main/resources/mapper/ProBasicEquipmentPointMapper.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.power.fitting.mapper.ProBasicEquipmentPointMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gyee.power.fitting.model.ProBasicEquipmentPoint">
+        <id column="id" property="id" />
+        <result column="nem_code" property="nemCode" />
+        <result column="name" property="name" />
+        <result column="aname" property="aname" />
+        <result column="model" property="model" />
+        <result column="value_unit" property="valueUnit" />
+        <result column="english_name" property="englishName" />
+        <result column="type_id" property="typeId" />
+        <result column="model_id" property="modelId" />
+        <result column="maxval" property="maxval" />
+        <result column="minval" property="minval" />
+        <result column="reasonable_maxval" property="reasonableMaxval" />
+        <result column="reasonable_minval" property="reasonableMinval" />
+        <result column="windturbine_id" property="windturbineId" />
+        <result column="uniform_code" property="uniformCode" />
+        <result column="short_id" property="shortId" />
+        <result column="long_id" property="longId" />
+        <result column="windpowerstation_id" property="windpowerstationId" />
+        <result column="realtime_id" property="realtimeId" />
+        <result column="logical_unit_id" property="logicalUnitId" />
+        <result column="group_point_id" property="groupPointId" />
+        <result column="specific_name" property="specificName" />
+        <result column="coefficient" property="coefficient" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, nem_code, name, aname, model, value_unit, english_name, type_id, model_id, maxval, minval, reasonable_maxval, reasonable_minval, windturbine_id, uniform_code, short_id, long_id, windpowerstation_id, realtime_id, logical_unit_id, group_point_id, specific_name, coefficient
+    </sql>
+
+</mapper>

Plik diff jest za duży
+ 66 - 0
power-fitting-JN/src/main/resources/mapper/ProBasicPowerstationMapper.xml


+ 35 - 0
power-fitting-JN/src/main/resources/mapper/ProBasicPowerstationPointMapper.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.power.fitting.mapper.ProBasicPowerstationPointMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gyee.power.fitting.model.ProBasicPowerstationPoint">
+        <id column="id" property="id" />
+        <result column="nem_code" property="nemCode" />
+        <result column="name" property="name" />
+        <result column="aname" property="aname" />
+        <result column="model" property="model" />
+        <result column="value_unit" property="valueUnit" />
+        <result column="english_name" property="englishName" />
+        <result column="type_id" property="typeId" />
+        <result column="model_id" property="modelId" />
+        <result column="maxval" property="maxval" />
+        <result column="minval" property="minval" />
+        <result column="reasonable_maxval" property="reasonableMaxval" />
+        <result column="reasonable_minval" property="reasonableMinval" />
+        <result column="uniform_code" property="uniformCode" />
+        <result column="short_id" property="shortId" />
+        <result column="long_id" property="longId" />
+        <result column="windpowerstation_id" property="windpowerstationId" />
+        <result column="realtime_id" property="realtimeId" />
+        <result column="group_point_id" property="groupPointId" />
+        <result column="specific_name" property="specificName" />
+        <result column="coefficient" property="coefficient" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, nem_code, name, aname, model, value_unit, english_name, type_id, model_id, maxval, minval, reasonable_maxval, reasonable_minval, uniform_code, short_id, long_id, windpowerstation_id, realtime_id, group_point_id, specific_name, coefficient
+    </sql>
+
+</mapper>

+ 32 - 0
power-fitting-JN/src/main/resources/mapper/ProEconEquipmentmodelMapper.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.power.fitting.mapper.ProEconEquipmentmodelMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gyee.power.fitting.model.ProEconEquipmentmodel">
+        <id column="id" property="id" />
+        <result column="nem_code" property="nemCode" />
+        <result column="name" property="name" />
+        <result column="aname" property="aname" />
+        <result column="description" property="description" />
+        <result column="power_production" property="powerProduction" />
+        <result column="windturbine_manufacturer_id" property="windturbineManufacturerId" />
+        <result column="photo" property="photo" />
+        <result column="unit" property="unit" />
+        <result column="cutinwind_speed" property="cutinwindSpeed" />
+        <result column="ratedwind_speed" property="ratedwindSpeed" />
+        <result column="cutoutwind_speed" property="cutoutwindSpeed" />
+        <result column="swept_area" property="sweptArea" />
+        <result column="equipment_category" property="equipmentCategory" />
+        <result column="spare1" property="spare1" />
+        <result column="spare2" property="spare2" />
+        <result column="spare3" property="spare3" />
+        <result column="spare4" property="spare4" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, nem_code, name, aname, description, power_production, windturbine_manufacturer_id, photo, unit, cutinwind_speed, ratedwind_speed, cutoutwind_speed, swept_area, equipment_category, spare1, spare2, spare3, spare4
+    </sql>
+
+</mapper>

+ 20 - 0
power-fitting/pom.xml

@@ -124,6 +124,26 @@
             <artifactId>commons-lang3</artifactId>
         </dependency>
 
+        <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
+        <dependency>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+            <version>42.4.1</version>
+        </dependency>
+
+        <!--解析excel-  xls-->
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>3.17</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>3.17</version>
+        </dependency>
+
+
     </dependencies>
 
     <build>

+ 1 - 1
power-fitting/src/main/java/com/gyee/power/fitting/MapperGenerator.java

@@ -27,7 +27,7 @@ public class MapperGenerator {
     //作者
     private static String authorName = "chenmh";
     //要生成的表名
-    private static String[] tables = {"POWERWINDINFO"};
+    private static String[] tables = {"POWERANALYSISREPORT"};
     //table前缀
     private static String prefix = "";
 

+ 2 - 1
power-fitting/src/main/java/com/gyee/power/fitting/PowerBootApplication.java

@@ -38,8 +38,9 @@ public class PowerBootApplication {
         String[] fileName = {bean.getFilePathPrepare(), bean.getFilePathProcess(), bean.getFilePathFitting(), bean.getFilePathDownload()};
         for (String path : fileName){
             File file = new File(path);
-            if (!file.exists())
+            if (!file.exists()) {
                 file.mkdirs();
+            }
         }
     }
 

+ 15 - 9
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerFittingALG.java

@@ -306,19 +306,25 @@ public class PowerFittingALG {
             double sum = 0;
             for (Point point : points1){
                 Optional<Point> p = points2.stream().filter(it -> it.getX() == point.getX()).findFirst();
+//                if (p.isPresent() && p.get().getX() >= mins && p.get().getX() < maxs){
+//                    sum += Math.pow(point.getY() - p.get().getY(), 2);
+//                    count ++;
+//                    pc += point.getY() - p.get().getY();
+//                }
                 if (p.isPresent() && p.get().getX() >= mins && p.get().getX() < maxs){
-                    sum += Math.pow(point.getY() - p.get().getY(), 2);
+                    sum += (point.getY() - p.get().getY());
                     count ++;
-                    pc += point.getY() - p.get().getY();
                 }
             }
-            sum = Math.sqrt(sum);
-            count = Math.sqrt(count);
-            maxp = maxp * count;
-            if (maxp != 0)
-                result = sum / maxp * 100;
-            if (pc < 0)
-                result = 0 - result;
+//            sum = Math.sqrt(sum);
+//            count = Math.sqrt(count);
+//            maxp = maxp * count;
+//            if (maxp != 0)
+//                result = sum / maxp * 100;
+//            if (pc < 0)
+//                result = 0 - result;
+            BigDecimal bg = new BigDecimal((sum / (count * 10)));
+            result = bg.setScale(4, BigDecimal.ROUND_FLOOR).doubleValue();
         }
         return result;
     }

+ 33 - 6
power-fitting/src/main/java/com/gyee/power/fitting/common/config/GyeeConfig.java

@@ -39,16 +39,32 @@ public class GyeeConfig {
     private String filePathProcess;
     /** 数据拟合保存路径(拟合后的数据) **/
     private String filePathFitting;
-    /** 数据压缩下载 **/
+    /** 配置文件路径 **/
+    private String filePathPower;
+    /**
+     * 数据压缩下载
+     **/
     private String filePathDownload;
-    /** 功率曲线拟合测点 **/
+    /**
+     * 功率曲线拟合测点
+     **/
     private String points;
-    /** 适配器读取数据等间隔时间 **/
+    /**
+     * 适配器读取数据等间隔时间
+     **/
     private Integer interval;
-    /** 数据是否离线执行 **/
+    /**
+     * 数据是否离线执行
+     **/
     private boolean offLine;
-    /** 是否实时计算 **/
+    /**
+     * 是否实时计算
+     **/
     private boolean realTimeCal;
+    /**
+     * 光伏数据准备路径
+     */
+    private String gfDataPath;
 
     public List<String> getPoints() {
         return getUniformCodes();
@@ -86,12 +102,23 @@ public class GyeeConfig {
         this.filePathDownload = filePathDownload;
     }
 
+    public String getFilePathPower() {
+        return jarF.getParentFile().getAbsolutePath() + File.separator + filePathPower;
+    }
+
+    public void setFilePathPower(String filePathPower) {
+        this.filePathPower = filePathPower;
+    }
 
-    private List<String> getUniformCodes(){
+    private List<String> getUniformCodes() {
         List<FixedVo> fxList = annotationTool.getFixedVoList(PowerPointData.class);
         List<String> codes = fxList.stream().filter(f -> !StringUtils.isEmpty(f.getUniformCode()))
                 .map(d -> d.getUniformCode()).collect(Collectors.toList());
 
         return codes;
     }
+
+    public String getGfDataPath() {
+        return getFilePathPrepare()+"gf"+File.separator;
+    }
 }

+ 17 - 5
power-fitting/src/main/java/com/gyee/power/fitting/common/constants/Constants.java

@@ -6,24 +6,36 @@ public class Constants {
 
     // 数据准备  标记
     public static final String DATA_PREPARE = "prepare";
-
     // 数据处理完  标记
     public static final String DATA_PROCESS = "process";
-
     // 数据处理完  标记
     public static final String DATA_FITTING = "fitting";
 
+
+
+    // 曲线偏差率
+    public static final String MODULE_CURVE = "curve";
+    // 静态偏航对风
+    public static final String MODULE_STATIC_WIND = "staticwind";
+    // 容量系数
+    public static final String MODULE_MLXS = "mrlxs";
+    // 桨距角
+    public static final String MODULE_BLADE = "blade";
+    // 停机时长
+    public static final String MODULE_STOP_TIME = "stoptime";
+    // 损失电量
+    public static final String MODULE_LOSS_DL = "lossdl";
+
+
+
     //功率
     public static final String CODE_POINT_POWER = "AI130";
-
     //风速
     public static final String CODE_POINT_SPEED = "AI022";
-
     //明细状态
     // 0-待机  1-手动停机  2-正常发电  3-缺陷降出力  4-限电降出力  5-限电停机  6-故障停机
     // 7-场内受累停机  8-检修停机  9-场内受累检修  10-电网受累  11-环境受累  12-风机离线
     public static final String CODE_POINT_MXZT = "ZTMX";
-
     //电量
     public static final String CODE_POINT_RFDL = "RFDL";
 }

+ 2 - 2
power-fitting/src/main/java/com/gyee/power/fitting/common/result/JsonResult.java

@@ -16,8 +16,8 @@ public class JsonResult extends HashMap<String, Object> implements Serializable
 
     public static JSONObject error(){
         JSONObject json = new JSONObject();
-        json.put("code", ResultCode.SUCCESS.getCode());
-        json.put("msg", ResultCode.SUCCESS.getMessage());
+        json.put("code", ResultCode.ERROR.getCode());
+        json.put("msg", ResultCode.ERROR.getMessage());
         return json;
     }
 

+ 3 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/result/ResultCode.java

@@ -23,6 +23,7 @@ public enum ResultCode {
     ERROR_SQL(4008, "sql语法不正确"),
     ERROR_MODEL(4009, "自算功率数据为空"),
     ERROR_MODEL_TYPE(4010, "风机机型不一致,请重新选择"),
+    ERROR_POINT(4011, "风机测点数据异常"),
 
 
     /* 参数错误:1000~1999 */
@@ -32,6 +33,8 @@ public enum ResultCode {
     PARAM_NOT_COMPLETE(1004, "参数缺失"),
     ERROR_DATA_DIR(1005, "目录创建失败"),
     ERROR_DATA_FILE(1006, "文件上传失败"),
+    ERROR_FILE_BLANK(1007, "文件不能为空"),
+
 
     /* 用户错误 */
     USER_NOT_LOGIN(2001, "用户未登录"),

+ 31 - 9
power-fitting/src/main/java/com/gyee/power/fitting/common/spring/InitialRunner.java

@@ -1,13 +1,16 @@
 package com.gyee.power.fitting.common.spring;
 
+import com.alibaba.fastjson.JSON;
 import com.gyee.power.fitting.common.config.GyeeConfig;
+import com.gyee.power.fitting.common.util.FileUtil;
 import com.gyee.power.fitting.model.*;
+import com.gyee.power.fitting.model.agc.AgcDeviateConfig;
 import com.gyee.power.fitting.service.*;
+import com.gyee.power.fitting.service.impl.IvPvCurveFittingService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.core.annotation.Order;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -27,7 +30,7 @@ import java.util.stream.Collectors;
 public class InitialRunner implements CommandLineRunner {
 
     @Resource
-    GyeeConfig config;
+    private GyeeConfig config;
     @Resource
     private WindturbineService windturbineService;
     @Resource
@@ -44,6 +47,8 @@ public class InitialRunner implements CommandLineRunner {
     private LineService lineService;
     @Resource
     private PowermodelService powermodelService;
+    @Resource
+    private IvPvCurveFittingService ipcfService;
 
 
     /**
@@ -115,6 +120,7 @@ public class InitialRunner implements CommandLineRunner {
     public static Map<String, List<Modelpowerdetails>> modelPowerDetailMap = new HashMap<>();
     /** key: NG01_01, speed, power**/
     public static Map<String, Map<Double, Double>> zsllglMap = new HashMap<>();
+    public static Map<String, AgcDeviateConfig> powerPreMap = new HashMap<>();
 
     @Override
     public void run(String... args) {
@@ -126,6 +132,7 @@ public class InitialRunner implements CommandLineRunner {
         cacheProject();
         cacheLine();
         cachePhotovoltaicInfo();
+        cacheFGL();
 
         // 耗时缓存
         new Thread(() -> {
@@ -137,11 +144,11 @@ public class InitialRunner implements CommandLineRunner {
     }
 
     private void cachePhotovoltaicInfo() {
-        List<Windpowerstationtestingpoint2> zfsPoints = windpowerstationtestingpoint2Service.getPoints("GDC", "SSFS");
-        List<Windpowerstationtestingpoint2> zjwdPoints = windpowerstationtestingpoint2Service.getPoints("GDC", "FCCFTWD");
+        List<Windpowerstationtestingpoint2> zfsPoints = windpowerstationtestingpoint2Service.getPoints("GDC", ipcfService.getUniforcodes().get("光照强度"));
+        List<Windpowerstationtestingpoint2> zjwdPoints = windpowerstationtestingpoint2Service.getPoints("GDC", ipcfService.getUniforcodes().get("组件温度"));
         zfsMap = zfsPoints.stream().collect(Collectors.toMap(Windpowerstationtestingpoint2::getWindpowerstationid, Function.identity()));
         zjwdMap = zjwdPoints.stream().collect(Collectors.toMap(Windpowerstationtestingpoint2::getWindpowerstationid, Function.identity()));
-        List<Windturbinetestingpointai2> zglPoints = pointService.getPoints("GDC", null, "AI130");
+        List<Windturbinetestingpointai2> zglPoints = pointService.getPoints("GDC", null, ipcfService.getUniforcodes().get("功率"));
         zglMap = zglPoints.stream().collect(Collectors.groupingBy(Windturbinetestingpointai2::getWindpowerstationid));
     }
 
@@ -180,8 +187,9 @@ public class InitialRunner implements CommandLineRunner {
         wpList.stream().forEach(d -> list.addAll(pointService.selectList(d.getId(), config.getPoints())));
         pointMap.putAll(list.stream().collect(Collectors.groupingBy(u -> u.getWindturbineid())));
         log.info("cachePoints: " + pointMap.size());
-        if (pointMap.size() == 0)
+        if (pointMap.size() == 0) {
             log.error("cachePoints", "测点数据缓存失败");
+        }
     }
 
     /**
@@ -189,8 +197,9 @@ public class InitialRunner implements CommandLineRunner {
      */
     private void cacheEquipment() {
         equipmentList.addAll(equipmentmodelService.selectList());
-        for (Equipmentmodel eq : equipmentList)
+        for (Equipmentmodel eq : equipmentList) {
             equipmentMap.put(eq.getId(), eq);
+        }
         log.info("设备型号数据缓存完成");
     }
 
@@ -223,12 +232,25 @@ public class InitialRunner implements CommandLineRunner {
         }else{
             List<Powermodel> list = powermodelService.selectByWtId(wtId);
             Map<Double, Double> collect = list.stream().collect(Collectors.toMap(Powermodel::getSpeed, Powermodel::getPower));
-            if (zsllglMap.containsKey(wtId))
+            if (zsllglMap.containsKey(wtId)) {
                 zsllglMap.replace(wtId, collect);
-            else
+            } else {
                 zsllglMap.put(wtId, collect);
+            }
         }
         log.info("自算功率数据缓存完成");
     }
 
+    /**
+     * 功率预测相关测点
+     */
+    private void cacheFGL(){
+        String str = FileUtil.getStringFromFile(config.getFilePathPower() + "fgl_info.json");
+        AgcDeviateConfig[] object = JSON.parseObject(str, AgcDeviateConfig[].class);
+        for (AgcDeviateConfig conf : object){
+            powerPreMap.put(conf.getId(), conf);
+        }
+        log.info("自功率预测相关测点数据缓存完成");
+    }
+
 }

+ 11 - 9
power-fitting/src/main/java/com/gyee/power/fitting/common/util/DateUtil.java

@@ -16,6 +16,16 @@ import java.util.TimeZone;
 public class DateUtil extends DateUtils {
 
     /**
+     * 时间格式(yyyy-MM-dd)
+     */
+    public final static String DATE_PATTERN = "yyyy-MM-dd";
+    public final static String DATE_SECOND_PATTERN = "yyyy-MM-dd HH:mm";
+    /**
+     * 时间格式(yyyy-MM-dd HH:mm:ss)
+     */
+    public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
+
+    /**
      * 获取当前时间
      *
      * @return
@@ -85,14 +95,6 @@ public class DateUtil extends DateUtils {
         return stamp;
     }
 
-    /**
-     * 时间格式(yyyy-MM-dd)
-     */
-    public final static String DATE_PATTERN = "yyyy-MM-dd";
-    /**
-     * 时间格式(yyyy-MM-dd HH:mm:ss)
-     */
-    public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
 
     public static String format(Date date) {
         return format(date, DATE_PATTERN);
@@ -220,7 +222,7 @@ public class DateUtil extends DateUtils {
     public static final Date dateZeroFormat(Date date){
         Calendar cal = Calendar.getInstance();
         cal.setTime(date);
-        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH),
+        cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), 1,
                 0, 0, 0);
         Date time = cal.getTime();
         return time;

+ 46 - 12
power-fitting/src/main/java/com/gyee/power/fitting/common/util/FileUtil.java

@@ -44,7 +44,7 @@ public class FileUtil {
             }
             bw.flush();
         } catch (Exception e) {
-            log.error("writePowerData", e);
+            log.error("FileUtil-----writePowerData", e);
             return false;
         } finally {
             try {
@@ -202,17 +202,17 @@ public class FileUtil {
      */
     public static String zipFiles(List<File> srcFiles, File zipFile) {
         // 判断压缩后的文件存在不,不存在则创建
-        if (!zipFile.exists()) {
-            try {
-                String fileName = zipFile.getAbsolutePath();
-                //fileName = fileName.substring(0, fileName.lastIndexOf("\\"));
-                File file1 = new File(fileName);
-                file1.mkdirs();
-                zipFile.createNewFile();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
+//        if (!zipFile.exists()) {
+//            try {
+//                String fileName = zipFile.getAbsolutePath();
+//                //fileName = fileName.substring(0, fileName.lastIndexOf("\\"));
+//                File file1 = new File(fileName);
+//                file1.mkdirs();
+//                zipFile.createNewFile();
+//            } catch (IOException e) {
+//                e.printStackTrace();
+//            }
+//        }
         // 创建 FileOutputStream 对象
         FileOutputStream fileOutputStream = null;
         // 创建 ZipOutputStream
@@ -253,4 +253,38 @@ public class FileUtil {
         return zipFile.getAbsolutePath();
     }
 
+
+    /**
+     * 从文件中获取字符串
+     *
+     * @param path 路径
+     * @return 字符串
+     */
+    public static String getStringFromFile(String path) {
+        BufferedReader bufferedReader = null;
+        File file = new File(path);
+        if (!file.exists()) {
+            return "";
+        }
+        try {
+            bufferedReader = new BufferedReader(new FileReader(file));
+            StringBuilder sb = new StringBuilder();
+            String s = null;
+            while ((s = bufferedReader.readLine()) != null) {
+                sb.append(s);
+            }
+            return sb.toString();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                assert bufferedReader != null;
+                bufferedReader.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return "";
+    }
+
 }

+ 2 - 1
power-fitting/src/main/java/com/gyee/power/fitting/common/util/NumberUtil.java

@@ -1,6 +1,7 @@
 package com.gyee.power.fitting.common.util;
 
 
+import java.io.File;
 import java.math.BigDecimal;
 
 /**
@@ -65,7 +66,7 @@ public class NumberUtil {
         StringBuffer sb = new StringBuffer();
         //将小数点后面的零给去除
         String numStr = bigDecimalNum.abs().stripTrailingZeros().toPlainString();
-        String[] split = numStr.split("\\.");
+        String[] split = numStr.split(File.separator);
         String integerStr = int2chineseNum(Integer.parseInt(split[0]));
         sb.append(integerStr);
         //如果传入的数有小数,则进行切割,将整数与小数部分分离

+ 30 - 16
power-fitting/src/main/java/com/gyee/power/fitting/common/util/PowerFittingUtil.java

@@ -13,42 +13,57 @@ public class PowerFittingUtil {
      * @return
      */
     public static List<Object> powerDataTree(List<Powerfittinganalysis> list, String type){
+        // 前端默认展开一组数据的id
+        int index1 = 100;
+        int index2 = 10000;
+        int index3 = 100000;
         /**多层分组**/
         Map<String, Map<String, Map<String, List<Powerfittinganalysis>>>> map = list.stream().
-                collect(Collectors.groupingBy(Powerfittinganalysis::getInterval, TreeMap::new,
+                collect(Collectors.groupingBy(Powerfittinganalysis::getInterval,
                         Collectors.groupingBy(Powerfittinganalysis::getTime,
-                                Collectors.groupingBy(Powerfittinganalysis::getStationcn, TreeMap::new, Collectors.toList()))));
+                        Collectors.groupingBy(Powerfittinganalysis::getStationcn, Collectors.toList()))));
         //map.values().stream().sorted(Comparator.comparing(s -> s.get)).collect(Collectors.toList());
-        List<Object> result = new ArrayList<>();
-        map.forEach((k, v) -> {
-            List<Object> l1 = new ArrayList<>();
-            Map<String, Object> map1 = new TreeMap<>();
+        List<Map<String, Object>> result = new ArrayList<>();
+        for (Map.Entry<String, Map<String, Map<String, List<Powerfittinganalysis>>>> entry : map.entrySet()) {
+            String k = entry.getKey();
+            List<Map<String, Object>> l1 = new ArrayList<>();
+            Map<String, Object> map1 = new HashMap<>();
 
-            map.get(k).forEach((k1, v1) -> {
+            for (Map.Entry<String, Map<String, List<Powerfittinganalysis>>> e : map.get(k).entrySet()) {
+                String k1 = e.getKey();
                 List<Object> l2 = new ArrayList<>();
                 Map<String, Object> map2 = new HashMap<>();
-                map.get(k).get(k1).forEach((k2, v2) -> {
+                for (Map.Entry<String, List<Powerfittinganalysis>> mapEntry : map.get(k).get(k1).entrySet()) {
+                    String k2 = mapEntry.getKey();
+                    List<Powerfittinganalysis> v2 = mapEntry.getValue();
                     Map<String, Object> map3 = new HashMap<>();
-                    map3.put("id", SnowFlakeUtil.generateId());
+                    map3.put("id", index3);
                     map3.put("label", k2);
                     map3.put("children", v2.stream().sorted(Comparator.comparing(Powerfittinganalysis::getWindturbine)));
                     l2.add(map3);
-                });
+                    index3 += 1;
+                }
 
-                map2.put("id", SnowFlakeUtil.generateId());
+                map2.put("id", index2);
                 map2.put("label", k1);
                 map2.put("children", l2);
                 l1.add(map2);
-            });
+                index2 += 1;
+            }
 
-            map1.put("id", SnowFlakeUtil.generateId());
+            l1.sort((o1, o2) -> o2.get("label").toString().compareTo(o1.get("label").toString()));
+
+            map1.put("id", index1);
             map1.put("label", k);
             map1.put("children", l1);
             result.add(map1);
-        });
+            index1 += 1;
+        }
+
+        result.sort((o1, o2) -> o2.get("label").toString().compareTo(o1.get("label").toString()));
 
         Map<String, Object> mp = new HashMap<>();
-        mp.put("id", SnowFlakeUtil.generateId());
+        mp.put("id", 1);
         mp.put("label", type.equals(Constants.DATA_PREPARE) ? "数据准备" :
                 type.equals(Constants.DATA_PROCESS) ? "数据预处理" : type.equals(Constants.DATA_FITTING) ? "功率曲线拟合" : "数据");
         mp.put("children", result);
@@ -58,5 +73,4 @@ public class PowerFittingUtil {
 
         return ls;
     }
-
 }

+ 64 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/agc/PowerPredictionController.java

@@ -0,0 +1,64 @@
+package com.gyee.power.fitting.controller.agc;
+
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.power.fitting.common.result.JsonResult;
+import com.gyee.power.fitting.common.result.ResultCode;
+import com.gyee.power.fitting.common.spring.InitialRunner;
+import com.gyee.power.fitting.common.util.DateUtil;
+import com.gyee.power.fitting.service.custom.agc.PowerPredictionService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author gyee
+ * 功率预测接口
+ */
+@RestController
+@RequestMapping("/power/prediction")
+public class PowerPredictionController {
+
+    @Resource
+    private PowerPredictionService predictionService;
+
+    /**
+     * 查询调度名称
+     * @returnv
+     */
+    @GetMapping("config")
+    public JSONObject getConfig(){
+        List<Object> list = new ArrayList<>();
+        InitialRunner.powerPreMap.forEach((k, v) -> {
+            Map<String, String> map = new HashMap<>();
+            map.put("id", k);
+            map.put("name", v.getTitle());
+            list.add(map);
+        });
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+
+
+    /**
+     * 查询功率预测数据及实际功率
+     * @param id   调度id,场站
+     * @param st
+     * @param et
+     * @param interval  功率预测数据默认15分钟一条数据  900s
+     * @return
+     */
+    @GetMapping("data")
+    public JSONObject getPredictionData(String id, String st, String et,
+                                             @RequestParam(value = "interval", defaultValue = "900", required = false) int interval){
+        long startTime = DateUtil.parseStrtoDate(st, DateUtil.DATE_PATTERN).getTime();
+        long endTime = DateUtil.addDays(DateUtil.parseStrtoDate(et, DateUtil.DATE_PATTERN), 1).getTime();
+        Map<String, Object> map = predictionService.getPredictionData(id, startTime, endTime, interval);
+        return JsonResult.successData(ResultCode.SUCCESS, map);
+    }
+}

+ 4 - 4
power-fitting/src/main/java/com/gyee/power/fitting/controller/base/WindInfoController.java

@@ -12,9 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -97,12 +95,14 @@ public class WindInfoController {
     @GetMapping("location")
     public JSONObject dataLocation(String ids){
         List<Windturbine> result = new ArrayList<>();
-        List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
+        List<Powerfittinganalysis> list = powerService.listByIds(Arrays.asList(ids.split(",")));
         for (Powerfittinganalysis obj : list){
             String[] pids = obj.getProcessid().split(",");
             for (String id : pids){
                 Powerfittinganalysis item = powerService.getById(id);
                 Windturbine wt = InitialRunner.wtMap.get(item.getWindturbine());
+                wt.setProcessId(id);
+                wt.setFittingId(obj.getId());
                 result.add(wt);
             }
         }

+ 7 - 4
power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/BladeController.java

@@ -3,7 +3,7 @@ package com.gyee.power.fitting.controller.fj;
 import com.alibaba.fastjson.JSONObject;
 import com.gyee.power.fitting.common.result.JsonResult;
 import com.gyee.power.fitting.common.result.ResultCode;
-import com.gyee.power.fitting.service.custom.blade.BladeService;
+import com.gyee.power.fitting.service.custom.BladeService;
 import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -11,6 +11,9 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 
+/**
+ * 桨叶分析
+ */
 @RestController
 @CrossOrigin
 @RequestMapping("/blade")
@@ -21,12 +24,12 @@ public class BladeController {
 
     /**
      * 叶片角度
-     * @param ids
-     * @return
+     * @param ids   数据预处理
+     * @returnv
      */
     @GetMapping("angle")
     public JSONObject bladeAngle(String ids){
-        Object o = bladeService.bladeData(ids);
+        Object o = bladeService.bladeAngle(ids);
         return JsonResult.successData(ResultCode.SUCCESS, o);
     }
 }

+ 2 - 1
power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/DataFittingController.java

@@ -46,8 +46,9 @@ public class DataFittingController {
                                   @RequestParam(value = "minp",  required = false) Double minp,
                                   @RequestParam(value = "dimension",  required = false) Integer dimension,
                                   @RequestParam(value = "mode",  required = false) Integer mode){
-        if (ids.isEmpty())
+        if (ids.isEmpty()) {
             return JsonResult.error(ResultCode.PARAM_IS_BLANK);
+        }
 
         Powerfittinganalysis obj = fittingService.dataFitting(ids, maxs, mins, maxp, minp, dimension, mode);
         return JsonResult.successData(ResultCode.SUCCESS, obj);

+ 53 - 3
power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/DataPrepareController.java

@@ -1,17 +1,26 @@
 package com.gyee.power.fitting.controller.fj;
 
 import com.alibaba.fastjson.JSONObject;
+import com.gyee.power.fitting.common.config.GyeeConfig;
+import com.gyee.power.fitting.common.constants.Constants;
 import com.gyee.power.fitting.common.result.JsonResult;
 import com.gyee.power.fitting.common.result.ResultCode;
+import com.gyee.power.fitting.common.spring.InitialRunner;
+import com.gyee.power.fitting.common.util.DateUtil;
 import com.gyee.power.fitting.common.util.FileUtil;
+import com.gyee.power.fitting.common.util.NumberUtil;
 import com.gyee.power.fitting.model.Powerfittinganalysis;
 import com.gyee.power.fitting.service.PowerfittinganalysisService;
 import com.gyee.power.fitting.service.custom.curve.DataPrepareService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
 import java.util.*;
 
 
@@ -24,6 +33,8 @@ import java.util.*;
 public class DataPrepareController {
 
     @Resource
+    private GyeeConfig config;
+    @Resource
     private DataPrepareService prepareService;
     @Resource
     private PowerfittinganalysisService powerService;
@@ -41,13 +52,14 @@ public class DataPrepareController {
     @GetMapping("data")
     public JSONObject dataPrepare(String station, String wtIds, Long st,
                                   Long et, Integer interval){
-        if (station.isEmpty() || wtIds.isEmpty())
+        if (station.isEmpty() || wtIds.isEmpty()) {
             return JsonResult.error(ResultCode.PARAM_NOT_COMPLETE);
+        }
 
         String[] points = wtIds.split(",");
         prepareService.dataPrepare(station, Arrays.asList(points), st, et, interval);
 
-        return JsonResult.error(ResultCode.SUCCESS_DATA_PREPARE);
+        return JsonResult.success(ResultCode.SUCCESS_DATA_PREPARE);
     }
 
     /** 文件 tree
@@ -78,7 +90,45 @@ public class DataPrepareController {
      */
     @GetMapping("download")
     public void dataPrepareDownload(HttpServletResponse response, @RequestParam(value = "id", required = false) String id){
-        Powerfittinganalysis obj = powerService.selectItemById(id);
+        Powerfittinganalysis obj = powerService.getById(id);
         FileUtil.download(obj.getPath(), response);
     }
+
+    /**
+     * 文件导入
+     */
+    @PostMapping("upload")
+    public JSONObject dataImport(@RequestParam("file") MultipartFile[] files, HttpServletRequest request,
+                                 String station, int interval, long st, long et){
+        if (Objects.isNull(files) || files.length < 1){
+            return JsonResult.error(ResultCode.ERROR_FILE_BLANK);
+        }
+
+        List<Powerfittinganalysis> list = new ArrayList<>();
+        for (MultipartFile file : files){
+            String[] name = file.getOriginalFilename().split("_");
+            String fileName = config.getFilePathPrepare() + name[0] + "_" + name[1] + "_" + name[2] + "_" + System.currentTimeMillis() / 1000 + ".csv";
+            Powerfittinganalysis obj = new Powerfittinganalysis();
+            obj.setStation(name[0] + "_" + name[1]);
+            obj.setStationcn(station);
+            obj.setWindturbine(name[2]);
+            obj.setCode(name[2]);
+            obj.setTime(DateUtil.format(st, DateUtil.YYYY_MM_DD_CHN) + "-" + DateUtil.format(et, DateUtil.YYYY_MM_DD_CHN));
+            obj.setInterval(NumberUtil.toNum(interval));
+            obj.setPath(fileName);
+            obj.setType(Constants.DATA_PREPARE);
+            obj.setInterp(interval);
+            obj.setCreatetime(DateUtil.parseStrtoDate(DateUtil.format(st, DateUtil.DATE_TIME_PATTERN), DateUtil.DATE_TIME_PATTERN));
+            list.add(obj);
+            try {
+                File dest = new File(fileName);
+                file.transferTo(dest);
+            } catch (IOException e) {
+                e.printStackTrace();
+                return JsonResult.error(ResultCode.ERROR_DATA_TYPE);
+            }
+        }
+        powerService.saveBatch(list);
+        return  JsonResult.success(ResultCode.SUCCESS);
+    }
 }

+ 1 - 1
power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/DataProcessController.java

@@ -100,7 +100,7 @@ public class DataProcessController {
      */
     @GetMapping("download")
     public void dataProcessDownload(HttpServletResponse response, @RequestParam(value = "id", required = false) String id){
-        Powerfittinganalysis obj = powerService.selectItemById(id);
+        Powerfittinganalysis obj = powerService.getById(id);
         FileUtil.download(obj.getPath(), response);
     }
 

+ 12 - 4
power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/DateOptionController.java

@@ -1,6 +1,7 @@
 package com.gyee.power.fitting.controller.fj;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.gyee.power.fitting.common.config.GyeeConfig;
 import com.gyee.power.fitting.common.result.JsonResult;
 import com.gyee.power.fitting.common.result.ResultCode;
@@ -12,6 +13,8 @@ import org.springframework.web.bind.annotation.*;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -33,8 +36,12 @@ public class DateOptionController {
      * @return
      */
     @GetMapping("delete")
-    public JSONObject dataDelete(String ids){
-        powerfittinganalysisService.deleteList(ids);
+    public JSONObject dataDelete(String ids, String type){
+        if (StringUtils.isBlank(type)) {
+            JsonResult.error();
+        }
+
+        powerfittinganalysisService.deleteList(ids, type);
         return JsonResult.success(ResultCode.SUCCESS);
     }
 
@@ -45,10 +52,11 @@ public class DateOptionController {
      */
     @GetMapping("download")
     public void dataProcessDownload(HttpServletResponse response, @RequestParam(value = "ids", required = false) String ids){
-        if (ids.isEmpty())
+        if (ids.isEmpty()) {
             return;
+        }
 
-        List<Powerfittinganalysis> objs = powerfittinganalysisService.selectListByIds(ids);
+        List<Powerfittinganalysis> objs = powerfittinganalysisService.listByIds(Arrays.asList(ids.split(",")));
         List<String> list = objs.stream().map(p -> p.getPath()).collect(Collectors.toList());
         List<File> files = list.stream().map(File::new).collect(Collectors.toList());
 

+ 5 - 4
power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/FiveLossInfoController.java

@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.gyee.power.fitting.common.result.JsonResult;
 import com.gyee.power.fitting.common.result.ResultCode;
 import com.gyee.power.fitting.common.util.DateUtil;
-import com.gyee.power.fitting.service.custom.fiveloss.FiveLossService;
+import com.gyee.power.fitting.service.custom.FiveLossService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -28,8 +28,9 @@ public class FiveLossInfoController {
     @GetMapping("five/loss/cal")
     public JSONObject fiveLossCal(String ids){
         Map<String, Object> map = fiveLossService.fiveLossCalByZSGL(ids);
-        if (map.size() > 0)
+        if (map.size() > 0) {
             return JsonResult.successData(ResultCode.SUCCESS, map);
+        }
 
         return JsonResult.error(ResultCode.ERROR_MODEL);
     }
@@ -58,12 +59,12 @@ public class FiveLossInfoController {
 
 
     /**
-     * 五损数据计算
+     * 五损数据计算  弃用
      * @return
      */
     @GetMapping("cal")
     public JSONObject fiveCal(){
-        fiveLossService.fiveLossCal();
+//        fiveLossService.fiveLossCal();
         return JsonResult.success(ResultCode.SUCCESS);
     }
 }

+ 3 - 4
power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/PowerTemperatureController.java

@@ -4,8 +4,7 @@ package com.gyee.power.fitting.controller.fj;
 import com.alibaba.fastjson.JSONObject;
 import com.gyee.power.fitting.common.result.JsonResult;
 import com.gyee.power.fitting.common.result.ResultCode;
-import com.gyee.power.fitting.service.custom.temperature.PowerTemperatureService;
-import org.springframework.beans.factory.annotation.Autowired;
+import com.gyee.power.fitting.service.custom.PowerTemperatureService;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -24,7 +23,7 @@ public class PowerTemperatureController {
 
     /***
      * 与温度有关的额定功率
-     * @param ids  预处理数据的id
+     * @param ids  拟合数据的id
      * @return
      */
     @GetMapping("rated/power")
@@ -36,7 +35,7 @@ public class PowerTemperatureController {
 
     /***
      * 温度曲线分析
-     * @param id  预处理数据的id
+     * @param id  拟合数据的id
      * @return
      */
     @GetMapping("curve/analysis")

+ 1 - 1
power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/RatedPowerController.java

@@ -3,7 +3,7 @@ package com.gyee.power.fitting.controller.fj;
 import com.alibaba.fastjson.JSONObject;
 import com.gyee.power.fitting.common.result.JsonResult;
 import com.gyee.power.fitting.common.result.ResultCode;
-import com.gyee.power.fitting.service.custom.ratedpower.RatedPowerService;
+import com.gyee.power.fitting.service.custom.RatedPowerService;
 import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;

+ 129 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/ReportController.java

@@ -0,0 +1,129 @@
+package com.gyee.power.fitting.controller.fj;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.power.fitting.common.result.JsonResult;
+import com.gyee.power.fitting.common.result.ResultCode;
+import com.gyee.power.fitting.common.spring.InitialRunner;
+import com.gyee.power.fitting.common.util.DateUtil;
+import com.gyee.power.fitting.model.Poweranalysisreport;
+import com.gyee.power.fitting.model.Windpowerstation;
+import com.gyee.power.fitting.service.PoweranalysisreportService;
+import com.gyee.power.fitting.service.custom.ReportService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 数据分析报告...
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/report")
+public class ReportController {
+
+    @Autowired
+    private ReportService report;
+    @Autowired
+    private PoweranalysisreportService reportService;
+
+
+    /** 分析报告
+     * @return
+     */
+    @GetMapping("list")
+    public JSONObject reportList(String station,
+                             @RequestParam(value = "st", required = false) String st,
+                             @RequestParam(value = "et", required = false) String et){
+        station = InitialRunner.stationMap.get(station);
+        List<Poweranalysisreport> list = reportService.getList(station, st, et);
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+
+
+    /** 分析报告
+     * @return
+     */
+    @GetMapping("info")
+    public JSONObject reportInfo(String station, String date) {
+        Map<String, Object> map = new HashMap<>();
+        Optional<Windpowerstation> optional = InitialRunner.wpList.stream().filter(f -> f.getName().equals(station)).findFirst();
+        List<Poweranalysisreport> info = reportService.getInfo(station, date);
+        Map<String, List<Poweranalysisreport>> collect = info.stream()
+                .collect(Collectors.groupingBy(Poweranalysisreport::getModule, Collectors.toList()));
+        List<String> wtIds = Arrays.asList(info.stream().map(Poweranalysisreport::getWindturbine).collect(Collectors.joining(",")).split(","));
+        HashMap<String, Integer> mp = new HashMap<>();
+        for (int i=0;i<wtIds.size();i++) {
+            //判断是否为空,如果为空,则表示该内容首次出现,则次数为1
+            if(mp.get(wtIds.get(i))==null){
+                mp.put(wtIds.get(i),1);
+            }else{
+                mp.put(wtIds.get(i), Integer.parseInt(mp.get(wtIds.get(i)).toString())+1);
+            }
+        }
+
+        int count = 0;
+        String wt = "";
+        for (Map.Entry<String, Integer> entry : mp.entrySet()) {
+            if (entry.getValue() > count){
+                count = entry.getValue();
+                wt = entry.getKey();
+            }
+        }
+
+        Date date1 = DateUtil.parseStrtoDate(date, DateUtil.YYYY_MM);
+        Date date2 = DateUtil.addMonths(date1, 1);
+        map.put("station", optional.isPresent() ? optional.get() : null);
+        map.put("info", collect);
+        map.put("time", DateUtil.format(date1, "yyyy.MM.dd") + "—" + DateUtil.format(date2, "yyyy.MM.dd"));
+        map.put("wtcount", info.size());
+        map.put("hjwtid", wt);
+        map.put("hjcount", count);
+        return JsonResult.successData(ResultCode.SUCCESS, map);
+    }
+
+
+    @GetMapping("analysis")
+    public String report(String date) {
+//        Date month = DateUtil.addMonths(new Date(), -1);
+//        //上月1号0点值
+//        Date st = DateUtil.dateZeroFormat(month);
+//        //当月1号0点值
+//        Date et = DateUtil.dateZeroFormat(new Date());
+
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(DateUtil.parseStrtoDate(date, DateUtil.DATE_PATTERN));
+        Date st = DateUtil.dateZeroFormat(cal.getTime());
+        Date month = DateUtil.addMonths(cal.getTime(), 1);
+        Date et = DateUtil.dateZeroFormat(month);
+
+        report.calCurve(st, et);
+        report.calJTPCDF(st, et);
+        report.calMRLXS(st, et);
+        report.calBlade(st, et);
+        report.calStopTime(st, et);
+
+        return "success";
+    }
+
+    public static void main(String[] args){
+        String date = "2023-03-01 00:00:00";
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(DateUtil.parseStrtoDate(date, DateUtil.DATE_PATTERN));
+        Date st = DateUtil.dateZeroFormat(cal.getTime());
+        Date month = DateUtil.addMonths(cal.getTime(), 1);
+        Date et = DateUtil.dateZeroFormat(month);
+
+        //        Date month = DateUtil.addMonths(new Date(), -1);
+//        //上月1号0点值
+//        Date st = DateUtil.dateZeroFormat(month);
+//        //当月1号0点值
+//        Date et = DateUtil.dateZeroFormat(new Date());
+
+        System.out.println(DateUtil.format(st, DateUtil.DATE_PATTERN));
+        System.out.println(DateUtil.format(et, DateUtil.DATE_PATTERN));
+    }
+}

+ 2 - 3
power-fitting/src/main/java/com/gyee/power/fitting/controller/fj/WindDirectionController.java

@@ -6,7 +6,6 @@ import com.gyee.power.fitting.common.result.ResultCode;
 import com.gyee.power.fitting.service.custom.windresource.AvgSpeedInfoService;
 import com.gyee.power.fitting.service.custom.windresource.RatioService;
 import com.gyee.power.fitting.service.custom.windresource.WindDirectionService;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -27,7 +26,7 @@ public class WindDirectionController {
     private WindDirectionService windDirectionService;
 
     /***
-     * 风速风向玫瑰图
+     * 风速风向玫瑰图、静态偏航对风、雷达图
      * @param ids  预处理数据的id
      * @param mode 统计方式   0:单台统计   1:合并统计
      * @return
@@ -72,7 +71,7 @@ public class WindDirectionController {
      */
     @GetMapping("avg/speed")
     public JSONObject avgSpeedInfo(String ids){
-        Object o = avgSpeedInfoService.avgSpeedInfo(ids);
+        Object o = avgSpeedInfoService.getSpeedInfo(ids);
         return JsonResult.successData(ResultCode.SUCCESS, o);
     }
 }

+ 18 - 0
power-fitting/src/main/java/com/gyee/power/fitting/mapper/PoweranalysisreportMapper.java

@@ -0,0 +1,18 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.Poweranalysisreport;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-06-08
+ */
+public interface PoweranalysisreportMapper extends BaseMapper<Poweranalysisreport> {
+
+}

+ 80 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Poweranalysisreport.java

@@ -0,0 +1,80 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-06-08
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("POWERANALYSISREPORT")
+public class Poweranalysisreport extends Model<Poweranalysisreport> {
+
+    private static final long serialVersionUID=1L;
+
+    /**
+     * 主键
+     */
+    @TableId(value = "ID", type = IdType.ASSIGN_ID)
+    private String id;
+
+    /**
+     * 场站
+     */
+    @TableField("STATION")
+    private String station;
+
+    /**
+     * 报告生成日期
+     */
+    @TableField("TIME")
+    private String time;
+
+    /**
+     * 模块(曲线偏差率、静态偏航对风、停机时长......)
+     */
+    @TableField("MODULE")
+    private String module;
+
+    /**
+     * 风机数量
+     */
+    @TableField("WTIDCOUNT")
+    private Integer wtidcount;
+
+    /**
+     * 风机编号
+     */
+    @TableField("WINDTURBINE")
+    private String windturbine;
+
+    /**
+     * 模块对应的分区
+     */
+    @TableField("SECTION")
+    private String section;
+
+    @TableField("REMARK")
+    private String remark;
+
+    @Override
+    protected Serializable pkVal() {
+        return null;
+    }
+
+}

+ 19 - 2
power-fitting/src/main/java/com/gyee/power/fitting/model/Powerfittinganalysis.java

@@ -1,9 +1,13 @@
 package com.gyee.power.fitting.model;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+import java.util.Date;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -18,11 +22,11 @@ import lombok.EqualsAndHashCode;
 @Data
 @EqualsAndHashCode(callSuper = false)
 @TableName("POWERFITTINGANALYSIS")
-public class Powerfittinganalysis extends Model<Powerfittinganalysis> {
+public class Powerfittinganalysis extends Model<Powerfittinganalysis> implements Cloneable {
 
     private static final long serialVersionUID=1L;
 
-    @TableField("ID")
+    @TableId(value = "ID", type = IdType.ASSIGN_ID)
     private String id;
 
     @TableField("STATION")
@@ -81,6 +85,9 @@ public class Powerfittinganalysis extends Model<Powerfittinganalysis> {
 
     @TableField("ISCAL")
     private Integer iscal = 0;  //0-没有计算  1-已计算
+
+    @TableField("CREATETIME")
+    private Date createtime;  //文件创建日期
 //
 //    @TableField("ISPROCESS")
 //    private Integer isprocess = 0;  //0-没有计算  1-已计算
@@ -90,4 +97,14 @@ public class Powerfittinganalysis extends Model<Powerfittinganalysis> {
         return null;
     }
 
+    @Override
+    public Powerfittinganalysis clone() {
+        Powerfittinganalysis p = null;
+        try {
+            p = (Powerfittinganalysis) super.clone();
+        } catch (CloneNotSupportedException e) {
+            e.printStackTrace();
+        }
+        return p;
+    }
 }

+ 3 - 1
power-fitting/src/main/java/com/gyee/power/fitting/model/Powerwindinfo.java

@@ -1,6 +1,8 @@
 package com.gyee.power.fitting.model;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import lombok.Data;
@@ -24,7 +26,7 @@ public class Powerwindinfo extends Model<Powerwindinfo> {
 
     private static final long serialVersionUID=1L;
 
-    @TableField("ID")
+    @TableId(value = "ID", type = IdType.ASSIGN_ID)
     private String id;
 
     @TableField("STATION")

+ 2 - 2
power-fitting/src/main/java/com/gyee/power/fitting/model/Windpowerstation.java

@@ -53,10 +53,10 @@ public class Windpowerstation extends Model<Windpowerstation> {
     private String aname;
 
     @TableField("LONGITUDE")
-    private String longitude;
+    private Double longitude;
 
     @TableField("LATITUDE")
-    private String latitude;
+    private Double latitude;
 
     @TableField("PHOTO")
     private String photo;

+ 6 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Windturbine.java

@@ -64,6 +64,12 @@ public class Windturbine extends Model<Windturbine> {
     @TableField("STANDARDID")
     private String standardid;
 
+    @TableField(exist = false)
+    private String prepareId;
+    @TableField(exist = false)
+    private String processId;
+    @TableField(exist = false)
+    private String fittingId;
 
     @Override
     protected Serializable pkVal() {

+ 5 - 31
power-fitting/src/main/java/com/gyee/power/fitting/model/agc/AgcDeviateConfig.java

@@ -1,5 +1,8 @@
 package com.gyee.power.fitting.model.agc;
 
+import lombok.Data;
+
+@Data
 public class AgcDeviateConfig {
 
     private String id;
@@ -12,37 +15,8 @@ public class AgcDeviateConfig {
      */
     private String title;
 
-    private AiPoints[] aiPoints;
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public float getInstalledCapacity() {
-        return installedCapacity;
-    }
+    private AiPoints power;
 
-    public void setInstalledCapacity(float installedCapacity) {
-        this.installedCapacity = installedCapacity;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public AiPoints[] getAiPoints() {
-        return aiPoints;
-    }
+    private AiPoints[] aiPoints;
 
-    public void setAiPoints(AiPoints[] aiPoints) {
-        this.aiPoints = aiPoints;
-    }
 }

+ 10 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/agc/AiPoints.java

@@ -19,6 +19,8 @@ public class AiPoints {
      */
     private String unit;
 
+    private int type;
+
     public String getName() {
         return name;
     }
@@ -53,4 +55,12 @@ public class AiPoints {
     public void setUnit(String unit) {
         this.unit = unit;
     }
+
+    public int getType() {
+        return type;
+    }
+
+    public void setType(int type) {
+        this.type = type;
+    }
 }

+ 9 - 9
power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PhotovoltaicInfo.java

@@ -15,10 +15,10 @@ public class PhotovoltaicInfo {
     private long time;//时间
     @Desc(des = "时间")
     private String datetime;
-    @Desc(des = "组件温度")
+    @Desc(des = "组件温度", uniformCode = "${uniformcode.gfzjwd:FCCFTWD}")
     @JsonProperty("T")
     private double T;
-    @Desc(des = "光照强度")
+    @Desc(des = "光照强度", uniformCode = "${uniformcode.gfgzqd:SSFS}")
     @JsonProperty("S")
     private double S;
 
@@ -30,26 +30,26 @@ public class PhotovoltaicInfo {
     private double V;
     @JsonProperty("P")
     private double P;
-    @Desc(des = "功率")
+    @Desc(des = "功率", uniformCode = "${uniformcode.power:AI130}")
     private double actualP;
     private double ideaP;
 
-    @Desc(des = "A相电流")
+    @Desc(des = "A相电流", uniformCode = "${uniformcode.gfadl:AIG060}")
     @JsonProperty("aI")
     private double aI;
-    @Desc(des = "A相电压")
+    @Desc(des = "A相电压", uniformCode = "${uniformcode.gfady:AIG061}")
     @JsonProperty("aV")
     private double aV;
-    @Desc(des = "B相电流")
+    @Desc(des = "B相电流", uniformCode = "${uniformcode.gfbdl:AIG062}")
     @JsonProperty("bI")
     private double bI;
-    @Desc(des = "B相电压")
+    @Desc(des = "B相电压", uniformCode = "${uniformcode.gfbdy:AIG061A}")
     @JsonProperty("bV")
     private double bV;
-    @Desc(des = "C相电流")
+    @Desc(des = "C相电流", uniformCode = "${uniformcode.gfcdl:AIG064}")
     @JsonProperty("cI")
     private double cI;
-    @Desc(des = "C相电压")
+    @Desc(des = "C相电压", uniformCode = "${uniformcode.gfcdy:AIG065}")
     @JsonProperty("cV")
     private double cV;
 

+ 5 - 1
power-fitting/src/main/java/com/gyee/power/fitting/model/custom/PowerPointData.java

@@ -2,6 +2,7 @@ package com.gyee.power.fitting.model.custom;
 
 import com.gyee.power.fitting.model.anno.Desc;
 import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
 
 import java.text.DecimalFormat;
 
@@ -9,6 +10,7 @@ import java.text.DecimalFormat;
  * 数据准备的测点
  * remark  0:表示该字段不在前端显示  1:表示该字段在前端显示
  */
+@Slf4j
 @Data
 public class PowerPointData {
 
@@ -33,7 +35,9 @@ public class PowerPointData {
             this.yp3 = Double.valueOf(df.format(Double.valueOf(str[13])));
             if (isFilter)
                 this.filter = Integer.valueOf(str[str.length - 1]);
-        }catch (Exception e){}
+        }catch (Exception e){
+            log.error(e.getMessage());
+        }
     }
 
     //时间

+ 146 - 0
power-fitting/src/main/java/com/gyee/power/fitting/schedule/DataCacheOptionTask.java

@@ -0,0 +1,146 @@
+package com.gyee.power.fitting.schedule;
+
+import com.gyee.power.fitting.common.constants.Constants;
+import com.gyee.power.fitting.common.spring.InitialRunner;
+import com.gyee.power.fitting.common.util.DateUtil;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.gyee.power.fitting.model.Windturbine;
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
+import com.gyee.power.fitting.service.custom.curve.DataFittingService;
+import com.gyee.power.fitting.service.custom.curve.DataPrepareService;
+import com.gyee.power.fitting.service.custom.curve.DataProcessService;
+import com.gyee.power.fitting.service.custom.FiveLossService;
+import com.gyee.power.fitting.service.custom.windresource.AvgSpeedInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Component
+public class DataCacheOptionTask {
+
+    @Resource
+    private DataPrepareService prepareService;
+    @Resource
+    private DataProcessService processService;
+    @Resource
+    private DataFittingService fittingService;
+    @Resource
+    private PowerfittinganalysisService powerService;
+    @Autowired
+    private FiveLossService fiveLossService;
+    @Autowired
+    private AvgSpeedInfoService speedInfoService;
+
+
+    /**
+     * 元数据缓存
+     * 每月1号凌晨1点执行
+     */
+    @Scheduled(cron = "0 0 1 1 * ?")
+    public void dataPrepare(){
+        Date month = DateUtil.addMonths(new Date(), -1);
+        //上月1号0点值
+        Date st = DateUtil.dateZeroFormat(month);
+        //当月1号0点值
+        Date et = DateUtil.dateZeroFormat(new Date());
+        Map<String, List<Windturbine>> wpMap = InitialRunner.wpMap;
+        wpMap.forEach((k, v) -> {
+            List<String> wtIds = v.stream().map(m -> m.getId()).collect(Collectors.toList());
+            prepareService.dataPrepare(k, wtIds, st.getTime(), et.getTime(), 10 * 60);
+        });
+    }
+
+
+    /**
+     * 根据缓存的元数据文件进行数据预处理
+     * 每月1号22点执行
+     */
+    @Scheduled(cron = "0 0 22 1 * ?")
+//    @Scheduled(cron="0/40 * * * * ?")
+    public void dataProcess(){
+        Date month = DateUtil.addMonths(new Date(), -1);
+        //上月1号0点值
+        Date st = DateUtil.dateZeroFormat(month);
+        //当月1号0点值
+        Date et = DateUtil.dateZeroFormat(new Date());
+        List<Powerfittinganalysis> list = powerService.selectByTime(Constants.DATA_PREPARE, st, et);
+        List<String> ids = list.stream().map(m -> m.getId()).collect(Collectors.toList());
+        processService.dataProcess(ids, 25.0, 0.0, 2500.0, 0.0, true, true, true, true, true, true, 3);
+    }
+
+
+    /**
+     * 根据缓存的文件进行数据拟合
+     * 每月1号23点执行
+     */
+    @Scheduled(cron = "0 0 23 1 * ?")
+//    @Scheduled(cron="0/55 * * * * ?")
+    public void dataFitting(){
+        Date month = DateUtil.addMonths(new Date(), -1);
+        //上月1号0点值
+        Date st = DateUtil.dateZeroFormat(month);
+        //当月1号0点值
+        Date et = DateUtil.dateZeroFormat(new Date());
+        List<Powerfittinganalysis> list = powerService.selectByTime(Constants.DATA_PROCESS, st, et);
+        String ids = list.stream().map(Powerfittinganalysis::getId).collect(Collectors.joining(","));
+        fittingService.dataFitting(ids, 25.0, 0.0, 2500.0, 0.0, 10, 0);
+    }
+
+
+
+    /**
+     * 根据缓存的文件计算毛容量系数
+     * 每月2号1点执行
+     */
+    @Scheduled(cron = "0 0 1 2 * ?")
+    public void taskMRLXS(){
+        Date month = DateUtil.addMonths(new Date(), -1);
+        //上月1号0点值
+        Date st = DateUtil.dateZeroFormat(month);
+        //当月1号0点值
+        Date et = DateUtil.dateZeroFormat(new Date());
+        List<Powerfittinganalysis> list = powerService.selectByTime(Constants.DATA_PROCESS, st, et);
+        String ids = list.stream().map(Powerfittinganalysis::getId).collect(Collectors.joining(","));
+        speedInfoService.calSpeedInfo(ids);
+    }
+
+
+
+    /**
+     * 五损数据离线计算,使用已经缓存的文件
+     * 每月2号3点执行
+     */
+    @Scheduled(cron = "0 0 3 2 * ?")
+    public void fiveLossCal(){
+        Date month = DateUtil.addMonths(new Date(), -1);
+        //上月1号0点值
+        Date st = DateUtil.dateZeroFormat(month);
+        //当月1号0点值
+        Date et = DateUtil.dateZeroFormat(new Date());
+        List<Powerfittinganalysis> list = powerService.selectByTime(Constants.DATA_PREPARE, st, et);
+        if (list == null || list.size() == 0) {
+            return;
+        }
+
+        String ids = list.stream().map(Powerfittinganalysis::getId).collect(Collectors.joining(","));
+        fiveLossService.fiveLossCalByZSGL(ids);
+    }
+
+
+    public static void main(String[] args){
+        Date month = DateUtil.addMonths(new Date(), -1);
+        //上月1号0点值
+        Date st = DateUtil.dateZeroFormat(month);
+        //当月1号0点值
+        Date et = DateUtil.dateZeroFormat(new Date());
+        System.out.println(DateUtil.format(st, DateUtil.DATE_TIME_PATTERN));
+        System.out.println(DateUtil.format(et, DateUtil.DATE_TIME_PATTERN));
+    }
+}
+

+ 0 - 60
power-fitting/src/main/java/com/gyee/power/fitting/schedule/DeviateAnalysisTask.java

@@ -1,60 +0,0 @@
-package com.gyee.power.fitting.schedule;
-
-import com.gyee.power.fitting.common.constants.Constants;
-import com.gyee.power.fitting.common.spring.InitialRunner;
-import com.gyee.power.fitting.common.util.DateUtil;
-import com.gyee.power.fitting.model.Powerfittinganalysis;
-import com.gyee.power.fitting.model.Windturbine;
-import com.gyee.power.fitting.service.PowerfittinganalysisService;
-import com.gyee.power.fitting.service.custom.curve.DataPrepareService;
-import com.gyee.power.fitting.service.custom.curve.DataProcessService;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-@Component
-public class DeviateAnalysisTask {
-
-    @Resource
-    private DataPrepareService prepareService;
-    @Resource
-    private DataProcessService processService;
-    @Resource
-    private PowerfittinganalysisService powerService;
-
-
-    /**
-     * 元数据缓存
-     */
-    @Scheduled(cron = "0 0 1 1 * ?")  //每月1号凌晨1点执行
-    public void dataPrepare(){
-        Date month = DateUtil.addMonths(new Date(), -1);
-        Date st = DateUtil.dateZeroFormat(month);  //上月1号0点值
-        Date et = DateUtil.dateZeroFormat(new Date());  //当月1号0点值
-        Map<String, List<Windturbine>> wpMap = InitialRunner.wpMap;
-        wpMap.forEach((k, v) -> {
-            List<String> wtIds = v.stream().map(m -> m.getId()).collect(Collectors.toList());
-            prepareService.dataPrepare(k, wtIds, st.getTime(), et.getTime(), 10 * 60);
-        });
-    }
-
-
-    /**
-     * 根据缓存的文件进行数据预处理
-     */
-    @Scheduled(cron = "0 0 22 1 * ?")  //每月1号22点执行
-    public void dataProcess(){
-        List<Powerfittinganalysis> list = powerService.selectListByIsCal(Constants.DATA_PROCESS, 0);
-        if (list == null || list.size() == 0)
-            return;
-
-        List<String> ids = list.stream().map(m -> m.getId()).collect(Collectors.toList());
-        processService.dataProcess(ids, 25.0, 0.0, 2500.0, 0.0, true, true, true, true, true, true, 3);
-    }
-
-}

+ 3 - 5
power-fitting/src/main/java/com/gyee/power/fitting/schedule/FiveLossScheduleTask.java

@@ -3,7 +3,7 @@ package com.gyee.power.fitting.schedule;
 
 import com.gyee.power.fitting.common.config.GyeeConfig;
 import com.gyee.power.fitting.common.util.DateUtil;
-import com.gyee.power.fitting.service.custom.fiveloss.FiveLossService;
+import com.gyee.power.fitting.service.custom.FiveLossService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -21,14 +21,12 @@ public class FiveLossScheduleTask {
     /**
      * 五损数据离线计算,使用已经缓存的文件
      */
-    @Scheduled(cron = "0 0 23 1 * ?")  //每月1号23点执行
+    @Scheduled(cron = "0 0 3 2 * ?")  //每月2号3点执行
     public void fiveLossCal(){
         fiveLossService.fiveLossCal();
     }
 
-    /**
-     * 每月2号凌晨三点执行
-     */
+
     @Scheduled(cron = "0 0 3 * * ?")  //每天凌晨三点执行
     public void fiveLossLineCal(){
         // 是否实时计算五损数据

+ 38 - 0
power-fitting/src/main/java/com/gyee/power/fitting/schedule/ReportScheduleTask.java

@@ -0,0 +1,38 @@
+package com.gyee.power.fitting.schedule;
+
+
+import com.gyee.power.fitting.common.util.DateUtil;
+import com.gyee.power.fitting.service.PoweranalysisreportService;
+import com.gyee.power.fitting.service.custom.ReportService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+@Component
+public class ReportScheduleTask {
+
+    @Autowired
+    private ReportService reportService;
+
+
+    /**
+     * 数据报告分析
+     * 每月2号凌晨2点执行
+     */
+    @Scheduled(cron = "0 0 2 2 * ?")
+    public void dataPrepare(){
+        Date month = DateUtil.addMonths(new Date(), -1);
+        //上月1号0点值
+        Date st = DateUtil.dateZeroFormat(month);
+        //当月1号0点值
+        Date et = DateUtil.dateZeroFormat(new Date());
+
+        reportService.calCurve(st, et);
+        reportService.calJTPCDF(st, et);
+        reportService.calMRLXS(st, et);
+        reportService.calBlade(st, et);
+        reportService.calStopTime(st, et);
+    }
+}

+ 28 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/PoweranalysisreportService.java

@@ -0,0 +1,28 @@
+package com.gyee.power.fitting.service;
+
+import com.gyee.power.fitting.model.Poweranalysisreport;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author chenmh
+ * @since 2023-06-08
+ */
+public interface PoweranalysisreportService extends IService<Poweranalysisreport> {
+
+
+    List<Poweranalysisreport> getList(String station, String st, String et);
+
+
+    List<Poweranalysisreport> getInfo(String station, String date);
+
+
+    void saveBatch(List<Poweranalysisreport> list, String module);
+
+}

+ 8 - 13
power-fitting/src/main/java/com/gyee/power/fitting/service/PowerfittinganalysisService.java

@@ -3,6 +3,7 @@ package com.gyee.power.fitting.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.gyee.power.fitting.model.Powerfittinganalysis;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -15,9 +16,6 @@ import java.util.List;
  */
 public interface PowerfittinganalysisService extends IService<Powerfittinganalysis> {
 
-
-    Powerfittinganalysis selectItemById(String id);
-
     /**
      * 根据类型查询
      * @param type   prepare
@@ -25,18 +23,15 @@ public interface PowerfittinganalysisService extends IService<Powerfittinganalys
      */
     List<Powerfittinganalysis> selectList(String type);
 
-    void insertItem(Powerfittinganalysis obj);
 
-    List<Powerfittinganalysis> selectListByIds(String ids);
+    List<Powerfittinganalysis> selectListById(String ids);
 
-    void deleteList(String ids);
 
-    /**
-     * 查询准备的数据
-     * @param type  Constants.DATA_PREPARE  Constants.DATA_PROCESS
-     * @param isCal
-     * @return
-     */
-    List<Powerfittinganalysis> selectListByIsCal(String type, int isCal);
+    void deleteList(String ids, String type);
+
+
+    void insertItem(Powerfittinganalysis obj);
+
 
+    List<Powerfittinganalysis> selectByTime(String type, Date st, Date et);
 }

+ 5 - 4
power-fitting/src/main/java/com/gyee/power/fitting/service/PowerwindinfoService.java

@@ -19,14 +19,15 @@ public interface PowerwindinfoService extends IService<Powerwindinfo> {
 
     /**
      * 通过风机ID和日期查询
-     * @param wtIds
-     * @param dates
+     * @param wtId
+     * @param date
      * @return
      */
-    List<Powerwindinfo> selectListByWtIdAndTime(String wtId, List<String> dates);
+    List<Powerwindinfo> selectByWtIdAndTime(String wtId, String date);
 
 
-    void insertBatch(List<Powerwindinfo> list);
+    List<Powerwindinfo> selectByTime(String st, String et);
+
 
     void deleteBatch(String wtId, List<String> dates);
 }

+ 86 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/BladeService.java

@@ -0,0 +1,86 @@
+package com.gyee.power.fitting.service.custom;
+
+import com.gyee.power.fitting.common.util.DateUtil;
+import com.gyee.power.fitting.common.util.FileUtil;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.gyee.power.fitting.model.custom.PowerPointData;
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
+import lombok.val;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+
+@Service
+public class BladeService {
+
+
+    @Resource
+    private PowerfittinganalysisService powerService;
+
+
+    /**
+     * 3个叶片的角度
+     * 并网状态下开桨是否趋近于0度,停机状态下收桨是否趋近于90度
+     * @param ids
+     * @return
+     */
+    public Object bladeAngle(String ids){
+        TreeMap<String, Object> map = new TreeMap<>();
+        List<Powerfittinganalysis> list = powerService.listByIds(Arrays.asList(ids.split(",")));
+        if (list.size() == 0) {
+            return map;
+        }
+
+        Powerfittinganalysis obj = list.get(0);
+        List<Map<String, Object>> pbw = new ArrayList<>();
+        List<Map<String, Object>> ptj = new ArrayList<>();
+        List<PowerPointData> ls = csvParse(obj);
+        for (PowerPointData item : ls){
+            double v = (item.getYp1() + item.getYp2() + item.getYp3()) / 3;
+            double avg = new BigDecimal(v).setScale(2, RoundingMode.CEILING).doubleValue();
+            if (item.getFilter() == 0){
+                //风机正常并网且风速在5-12m
+                if (item.getMxzt() == 2 && item.getSpeed() >= 5 && item.getSpeed() <= 12 && avg < 20){
+                    Map<String, Object> mbw = new HashMap<>();
+                    mbw.put("time", item.getTime());
+                    mbw.put("value", avg);
+                    pbw.add(mbw);
+                }
+            }
+            //风机在不发电情况下
+            if (item.getFilter() == 2 && avg > 70){
+                Map<String, Object> mtj = new HashMap<>();
+                mtj.put("time", item.getTime());
+                mtj.put("value", new BigDecimal(90 - avg).setScale(2, RoundingMode.CEILING).doubleValue());
+                ptj.add(mtj);
+            }
+        }
+        map.put("bw", pbw);
+        map.put("tj", ptj);
+        map.put("wtId", obj.getWindturbine());
+
+        return map;
+    }
+
+
+    /**
+     * csv 文件解析成对象
+     * @param obj
+     * @return
+     */
+    private List<PowerPointData> csvParse(Powerfittinganalysis obj){
+        List<PowerPointData> list = new ArrayList<>();
+        val content = FileUtil.readFile(obj.getPath(), true);
+        for (int i = 1; i < content.size(); i++) {
+            String[] split = content.get(i).split(",");
+            PowerPointData data = new PowerPointData(split, true);
+            list.add(data);
+        }
+
+        return list;
+    }
+
+}

+ 93 - 86
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/fiveloss/FiveLossService.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fitting.service.custom.fiveloss;
+package com.gyee.power.fitting.service.custom;
 
 import com.alibaba.fastjson.JSONObject;
 import com.gyee.power.fitting.common.constants.Constants;
@@ -122,7 +122,7 @@ public class FiveLossService {
         Map<String, Windturbine> wtmap = InitialRunner.wtMap;
         Map<String, Map<Double, Double>> zsglmap = InitialRunner.zsllglMap;
 
-        List<Powerfittinganalysis> analyses = analysisService.selectListByIsCal(Constants.DATA_PREPARE, 0);
+        List<Powerfittinganalysis> analyses = analysisService.selectList(Constants.DATA_PREPARE);
         if (analyses.size() == 0){
             log.info("======风机榜效帮计算结束,Powerfittinganalysis数据为空.............");
             return;
@@ -241,6 +241,97 @@ public class FiveLossService {
 
 
     /**
+     * 使用文件,通过自算功率计算五损数据
+     * @param ids  准备的数据ID
+     */
+    /** 根据已缓存的文件计算损失电量
+     * 明细状态
+     * 0-待机  1-手动停机  2-正常发电  3-缺陷降出力  4-限电降出力  5-限电停机  6-故障停机
+     * 7-场内受累停机  8-检修停机  9-场内受累检修  10-电网受累  11-环境受累  12-风机离线
+     */
+    public Map<String, Object> fiveLossCalByZSGL(String ids) {
+        log.info("======损失电量计算开始.............");
+        Map<String, Object> promise = new HashMap<>();
+        List<FjjxbVo> result = new ArrayList<>();
+        Map<String, Map<Double, Double>> zsglmap = InitialRunner.zsllglMap;
+
+        List<Powerfittinganalysis> analyses = analysisService.listByIds(Arrays.asList(ids.split(",")));
+        if (analyses.size() == 0){
+            log.info("======风机榜效帮计算结束,数据为空.............");
+            throw new CustomException(ResultCode.ERROR);
+        }
+
+        for (Powerfittinganalysis p : analyses) {
+            List<String> content = FileUtil.readFile(p.getPath(), true);
+            if (content.size() == 0 || zsglmap.size() == 0 || zsglmap.get(p.getWindturbine()) == null){
+                log.info(p.getWindturbine() + "文件内容或当前风机的自算功率为空.............");
+                continue;
+            }
+            log.info("======损失电量计算:" + p.getWindturbine());
+            double llfdl = 0.0; //理论发电量
+            double rfdl = 0.0; //日发电量
+            double jhjxssdl = 0.0;//计划检修损失电量
+            double fjhjxssdl =0.0;//非计划检修电量
+            double xdssdl = 0.0;//限电损失电量
+            double slssdl = 0.0;//受累损失电量
+            double xnssdl = 0.0;//性能损失电量
+            double speed = 0.0;//风速
+            content.remove(0); //去掉标题栏
+            int count = 86400 / p.getInterp(); //一天86400s  一天的条数
+            List<List<String>> coll = CollectUtil.groupListByQty(content, count);
+            for (List<String> ls : coll) {
+                List<PowerPointData> pdl = ls.stream().map(mp -> new PowerPointData(mp.split(","), false)).collect(Collectors.toList());
+                double lldl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), -1); //理论发电量
+                double dj = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 0); //待机
+                double sdtj = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 1); //手动停机
+                double zcfd = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 2); //正常发电
+                double xdss = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 5);  //限电损失电量
+                double qxjcl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 3); //缺陷降出力损失电量
+                double xdjcl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 4); //限电降出力损失电量
+                double cnsltj = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 7); //场内受累停机损失电量
+                double cnsljx = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 9); //场内受累检修损失电量
+                double dwsl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 10); //电网受累损失电量
+                double hjsl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 11); //环境受累损失电量
+                double gzss = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 6); //故障损失电量
+                double tjjx = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 8); //停机检修
+
+                llfdl += lldl;
+                jhjxssdl += (tjjx + cnsljx);
+                fjhjxssdl += (gzss + cnsltj);
+                xdssdl += (xdjcl + xdss);
+                slssdl += (dwsl + hjsl);
+                xnssdl += (dj + sdtj + zcfd + qxjcl);
+                rfdl += pdl.get(pdl.size() - 1).getDl();
+                speed += pdl.stream().mapToDouble(PowerPointData::getSpeed).sum();
+            }
+            FjjxbVo vo = new FjjxbVo();
+            vo.setId(p.getWindturbine());
+            vo.setName(p.getWindturbine());
+            vo.setLlfdl(new BigDecimal(llfdl).setScale(2, RoundingMode.FLOOR).doubleValue());
+            vo.setSjfdl(new BigDecimal(rfdl).setScale(2, RoundingMode.FLOOR).doubleValue());
+            vo.setJhjx(new BigDecimal(jhjxssdl).setScale(2, RoundingMode.FLOOR).doubleValue());
+            vo.setFjhjx(new BigDecimal(fjhjxssdl).setScale(2, RoundingMode.FLOOR).doubleValue());
+            vo.setXd(new BigDecimal(xdssdl).setScale(2, RoundingMode.FLOOR).doubleValue());
+            vo.setXn(new BigDecimal(xnssdl).setScale(2, RoundingMode.FLOOR).doubleValue());
+            vo.setSl(new BigDecimal(slssdl).setScale(2, RoundingMode.FLOOR).doubleValue());
+            vo.setSpeed(new BigDecimal(speed/content.size()).setScale(2, RoundingMode.FLOOR).doubleValue());
+            vo.setFnlly(llfdl > 0 ? new BigDecimal(rfdl / llfdl).setScale(2, RoundingMode.FLOOR).doubleValue() : 0);
+            result.add(vo);
+        }
+        log.info("======风机榜效帮计算结束.............");
+        result.stream().sorted(Comparator.comparing(FjjxbVo::getId));
+        /** 添加标题 **/
+        List<FixedVo> fxList = annotationTool.getFixedVoList(FjjxbVo.class);
+        List<TableTitle> lt = fxList.stream().map(d -> new TableTitle(d.getName(), d.getDes())).collect(Collectors.toList());
+        promise.put("title", lt);
+        promise.put("data", result);
+
+        return promise;
+    }
+
+
+
+    /**
      * 通过线上实时计算五损数据
      * @param st   开始时间
      * @param et   结束时间
@@ -350,88 +441,4 @@ public class FiveLossService {
         return ssdl > 0 ? ssdl : 0;
     }
 
-    /**
-     * 使用文件,通过自诉案功率计算五损数据
-     * @param ids  准备的数据ID
-     */
-    public Map<String, Object> fiveLossCalByZSGL(String ids) {
-        log.info("======损失电量计算开始.............");
-        Map<String, Object> promise = new HashMap<>();
-        List<FjjxbVo> result = new ArrayList<>();
-        Map<String, Map<Double, Double>> zsglmap = InitialRunner.zsllglMap;
-
-        List<Powerfittinganalysis> analyses = analysisService.selectListByIds(ids);
-        if (analyses.size() == 0){
-            log.info("======风机榜效帮计算结束,数据为空.............");
-            throw new CustomException(ResultCode.ERROR);
-        }
-
-        for (Powerfittinganalysis p : analyses) {
-            List<String> content = FileUtil.readFile(p.getPath(), true);
-            if (content.size() == 0 || zsglmap.size() == 0 || zsglmap.get(p.getWindturbine()) == null){
-                log.info(p.getWindturbine() + "文件内容或当前风机的自算功率为空.............");
-                continue;
-            }
-            log.info("======损失电量计算:" + p.getWindturbine());
-            double llfdl = 0.0; //理论发电量
-            double rfdl = 0.0; //日发电量
-            double jhjxssdl = 0.0;//计划检修损失电量
-            double fjhjxssdl =0.0;//非计划检修电量
-            double xdssdl = 0.0;//限电损失电量
-            double slssdl = 0.0;//受累损失电量
-            double xnssdl = 0.0;//性能损失电量
-            double speed = 0.0;//风速
-            content.remove(0); //去掉标题栏
-            int count = 86400 / p.getInterp(); //一天86400s  一天的条数
-            List<List<String>> coll = CollectUtil.groupListByQty(content, count);
-            for (List<String> ls : coll) {
-                List<PowerPointData> pdl = ls.stream().map(mp -> new PowerPointData(mp.split(","), false)).collect(Collectors.toList());
-                double lldl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), -1); //理论发电量
-                double dj = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 0); //待机
-                double sdtj = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 1); //手动停机
-                double zcfd = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 2); //正常发电
-                double xdss = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 5);  //限电损失电量
-                double qxjcl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 3); //缺陷降出力损失电量
-                double xdjcl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 4); //限电降出力损失电量
-                double cnsltj = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 7); //场内受累停机损失电量
-                double cnsljx = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 9); //场内受累检修损失电量
-                double dwsl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 10); //电网受累损失电量
-                double hjsl = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 11); //环境受累损失电量
-                double gzss = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 6); //故障损失电量
-                double tjjx = generalLoss(pdl, zsglmap.get(p.getWindturbine()), p.getInterp(), 8); //停机检修
-
-                llfdl += lldl;
-                jhjxssdl += (tjjx + cnsljx);
-                fjhjxssdl += (gzss + cnsltj);
-                xdssdl += (xdjcl + xdss);
-                slssdl += (dwsl + hjsl);
-                xnssdl += (dj + sdtj + zcfd + qxjcl);
-                rfdl += pdl.get(pdl.size() - 1).getDl();
-                speed += pdl.stream().mapToDouble(PowerPointData::getSpeed).sum();
-            }
-            FjjxbVo vo = new FjjxbVo();
-            vo.setId(p.getWindturbine());
-            vo.setName(p.getWindturbine());
-            vo.setLlfdl(new BigDecimal(llfdl).setScale(2, RoundingMode.FLOOR).doubleValue());
-            vo.setSjfdl(new BigDecimal(rfdl).setScale(2, RoundingMode.FLOOR).doubleValue());
-            vo.setJhjx(new BigDecimal(jhjxssdl).setScale(2, RoundingMode.FLOOR).doubleValue());
-            vo.setFjhjx(new BigDecimal(fjhjxssdl).setScale(2, RoundingMode.FLOOR).doubleValue());
-            vo.setXd(new BigDecimal(xdssdl).setScale(2, RoundingMode.FLOOR).doubleValue());
-            vo.setXn(new BigDecimal(xnssdl).setScale(2, RoundingMode.FLOOR).doubleValue());
-            vo.setSl(new BigDecimal(slssdl).setScale(2, RoundingMode.FLOOR).doubleValue());
-            vo.setSpeed(new BigDecimal(speed/content.size()).setScale(2, RoundingMode.FLOOR).doubleValue());
-            vo.setFnlly(llfdl > 0 ? new BigDecimal(rfdl / llfdl).setScale(2, RoundingMode.FLOOR).doubleValue() : 0);
-            result.add(vo);
-        }
-        log.info("======风机榜效帮计算结束.............");
-        result.stream().sorted(Comparator.comparing(FjjxbVo::getId));
-        /** 添加标题 **/
-        List<FixedVo> fxList = annotationTool.getFixedVoList(FjjxbVo.class);
-        List<TableTitle> lt = fxList.stream().map(d -> new TableTitle(d.getName(), d.getDes())).collect(Collectors.toList());
-        promise.put("title", lt);
-        promise.put("data", result);
-
-        return promise;
-    }
-    
 }

+ 17 - 13
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/temperature/PowerTemperatureService.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fitting.service.custom.temperature;
+package com.gyee.power.fitting.service.custom;
 
 import com.gyee.power.fitting.common.alg.PowerTemperatureAlg;
 import com.gyee.power.fitting.common.spring.InitialRunner;
@@ -30,14 +30,15 @@ public class PowerTemperatureService {
      */
     public Object ratedPower(String ids) {
         List<Object> result = new ArrayList<>();
-        List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
-        if (list == null || list.size() == 0)
+        List<Powerfittinganalysis> list = powerService.listByIds(Arrays.asList(ids.split(",")));
+        if (list == null || list.size() == 0) {
             return result;
+        }
 
         for (Powerfittinganalysis obj : list){
-            String[] pids = obj.getProcessid().split(",");
-            for (String id : pids){
-                Powerfittinganalysis pf = powerService.selectItemById(id);
+            String[] split = obj.getProcessid().split(",");
+            for (String id : split){
+                Powerfittinganalysis pf = powerService.getById(id);
                 List<Modelpowerdetails> ls = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid());
                 Double theoryPower = ls.get(ls.size() - 1).getTheorypower(); //理论功率
                 Map<String, Object> map = csvParse(pf);//数据解析
@@ -60,9 +61,10 @@ public class PowerTemperatureService {
 
     public Object curveAnalysis(String id) {
         Map<String, Object> map = new HashMap<>();
-        Powerfittinganalysis obj = powerService.selectItemById(id);
-        if (obj == null)
+        Powerfittinganalysis obj = powerService.getById(id);
+        if (obj == null) {
             return map;
+        }
 
         //实际功率
         List<Object> sjglList = new ArrayList<>();
@@ -81,13 +83,15 @@ public class PowerTemperatureService {
         //散点ID
         String[] ids = obj.getProcessid().split(",");
         for (String pid : ids) {
-            Powerfittinganalysis pf = powerService.selectItemById(pid);
-            List<String> lp = FileUtil.readFile(pf.getPath(), true);   //数据解析
+            Powerfittinganalysis pf = powerService.getById(pid);
+            //数据解析
+            List<String> lp = FileUtil.readFile(pf.getPath(), true);
             for (int i = 1; i < lp.size(); i++){
                 String[] split = lp.get(i).split(",");
                 PowerPointData pd = new PowerPointData(split, true);
-                if (pd.getSpeed() < 0 || pd.getPower() < 0)
+                if (pd.getSpeed() < 0 || pd.getPower() < 0) {
                     continue;
+                }
 
                 Object[] temp = new Object[3];
                 temp[0] = pd.getSpeed();
@@ -150,11 +154,11 @@ public class PowerTemperatureService {
 
         /** 添加内容 **/
         List<PowerPointData> list = new ArrayList<>();
-        Powerfittinganalysis obj = powerService.selectItemById(id);
+        Powerfittinganalysis obj = powerService.getById(id);
         if (obj == null)
             return map;
         String[] ids = obj.getProcessid().split(",");
-        Powerfittinganalysis item = powerService.selectItemById(ids[0]);
+        Powerfittinganalysis item = powerService.getById(ids[0]);
         List<String> ls = FileUtil.readFile(item.getPath(), false);
         for (int i = 1; i < ls.size(); i++){
             PowerPointData data = new PowerPointData(ls.get(i).split(","), false);

+ 18 - 8
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/ratedpower/RatedPowerService.java

@@ -1,6 +1,7 @@
-package com.gyee.power.fitting.service.custom.ratedpower;
+package com.gyee.power.fitting.service.custom;
 
 import com.gyee.power.fitting.common.spring.InitialRunner;
+import com.gyee.power.fitting.common.util.DateUtil;
 import com.gyee.power.fitting.common.util.FileUtil;
 import com.gyee.power.fitting.model.Equipmentmodel;
 import com.gyee.power.fitting.model.Powerfittinganalysis;
@@ -8,12 +9,14 @@ import com.gyee.power.fitting.model.Windturbine;
 import com.gyee.power.fitting.model.custom.PowerPointData;
 import com.gyee.power.fitting.service.PowerfittinganalysisService;
 import lombok.val;
+import org.apache.commons.collections4.list.TreeList;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 额定功率分析
@@ -29,27 +32,32 @@ public class RatedPowerService {
         Map<String, Object> result = new HashMap<>();
         Map<String, Equipmentmodel> eqMap = InitialRunner.equipmentMap;
         Map<String, Windturbine> wtMap = InitialRunner.wtMap;
-        List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
-        if (list.size() == 0)
+        List<Powerfittinganalysis> list = powerService.listByIds(Arrays.asList(ids.split(",")));
+        if (list.size() == 0) {
             return result;
+        }
 
         List<PowerPointData> all = new ArrayList<>();
-        TreeMap<String, Double> map = new TreeMap<>();
+        TreeList<Object> lst = new TreeList<>();
         for (Powerfittinganalysis obj : list){
             String[] spid = obj.getProcessid().split(",");
             for (String id : spid){
-                Powerfittinganalysis item = powerService.selectItemById(id);
+                TreeMap<String, Object> mp = new TreeMap<>();
+                Powerfittinganalysis item = powerService.getById(id);
                 List<PowerPointData> ls = csvParse(item);
                 all.addAll(ls);
                 double avg = ls.size() > 0 ? ls.stream().mapToDouble(PowerPointData::getPower).average().getAsDouble() : 0;
-                map.put(item.getWindturbine(), new BigDecimal(avg).setScale(0, RoundingMode.CEILING).doubleValue());
+                mp.put("wt", item.getWindturbine());
+                mp.put("avg", new BigDecimal(avg).setScale(0, RoundingMode.CEILING).doubleValue());
+                mp.put("count", ls.size());
+                lst.add(mp);
             }
         }
         double avg = all.size() > 0 ? all.stream().mapToDouble(PowerPointData::getPower).average().getAsDouble() : 0;
         double avgData = new BigDecimal(avg).setScale(0, RoundingMode.CEILING).doubleValue();
 
         result.put("avg", avgData);
-        result.put("data", map);
+        result.put("data", lst);
         result.put("power", eqMap.get(wtMap.get(list.get(0).getWindturbine()).getModelid()).getPowerproduction());
 
         return result;
@@ -66,8 +74,10 @@ public class RatedPowerService {
         for (int i = 1; i < content.size(); i++){
             String[] split = content.get(i).split(",");
             PowerPointData data = new PowerPointData(split, false);
-            if (data.getSpeed() >= 12.0)
+            if (data.getSpeed() >= 12.0){
+                data.setTime(DateUtil.format(data.getTime(), DateUtil.DATE_PATTERN));
                 list.add(data);
+            }
         }
 
         return list;

+ 357 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/ReportService.java

@@ -0,0 +1,357 @@
+package com.gyee.power.fitting.service.custom;
+
+import com.gyee.power.fitting.common.alg.WindDirectionALG;
+import com.gyee.power.fitting.common.constants.Constants;
+import com.gyee.power.fitting.common.spring.InitialRunner;
+import com.gyee.power.fitting.common.util.DateUtil;
+import com.gyee.power.fitting.common.util.FileUtil;
+import com.gyee.power.fitting.model.Poweranalysisreport;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.gyee.power.fitting.model.Powerwindinfo;
+import com.gyee.power.fitting.model.custom.PowerFittingData;
+import com.gyee.power.fitting.model.custom.PowerPointData;
+import com.gyee.power.fitting.service.PoweranalysisreportService;
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
+import com.gyee.power.fitting.service.PowerwindinfoService;
+import lombok.extern.slf4j.Slf4j;
+import lombok.val;
+import lombok.var;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Component
+public class ReportService {
+
+    @Autowired
+    private PowerfittinganalysisService powerService;
+    @Autowired
+    private PowerwindinfoService windinfoService;
+    @Autowired
+    private PoweranalysisreportService reportService;
+
+
+    /**
+     * 曲线偏差率分析
+     */
+    public void calCurve(Date st, Date et){
+        log.info("=====曲线偏差率分析");
+        List<Poweranalysisreport> result = new ArrayList<>();
+        var list = powerService.selectByTime(Constants.DATA_FITTING, st, et);
+        val collect = list.stream().collect(Collectors.groupingBy(Powerfittinganalysis::getStationcn, Collectors.toList()));
+        collect.forEach((k, v) -> {
+            String date = null;
+            List<String> pcl_all = new ArrayList<>();
+            List<String> pcl_5 = new ArrayList<>();
+            List<String> pcl_10 = new ArrayList<>();
+            List<String> pcl_12 = new ArrayList<>();
+            List<String> pcl_25 = new ArrayList<>();
+            try {
+                for (Powerfittinganalysis obj : v) {
+                    if (date == null) {
+                        date = DateUtil.format(obj.getCreatetime(), DateUtil.YYYY_MM);
+                    }
+                    //3-25m风速区间曲线偏差率小于0
+                    if (obj.getPcratio() < 0) {
+                        pcl_all.add(obj.getWindturbine());
+                    }
+                    //3-5m风速区间曲线偏差率小于0
+                    if (obj.getPc5ratio() < 0) {
+                        pcl_5.add(obj.getWindturbine());
+                    }
+                    //5-10m风速区间曲线偏差率小于0
+                    if (obj.getPc10ratio() < 0) {
+                        pcl_10.add(obj.getWindturbine());
+                    }
+                    //10-12m风速区间曲线偏差率小于0
+                    if (obj.getPc12ratio() < 0) {
+                        pcl_12.add(obj.getWindturbine());
+                    }
+                    //12-25m风速区间曲线偏差率小于0
+                    if (obj.getPc25ratio() < 0) {
+                        pcl_25.add(obj.getWindturbine());
+                    }
+                }
+                if (pcl_all.size() > 0){
+                    buildObj(result, k, date, Constants.MODULE_CURVE, "3-25m", pcl_all, null);
+                }
+                if (pcl_5.size() > 0){
+                    buildObj(result, k, date, Constants.MODULE_CURVE, "3-5m", pcl_5, null);
+                }
+                if (pcl_10.size() > 0){
+                    buildObj(result, k, date, Constants.MODULE_CURVE, "5-10m", pcl_10, null);
+                }
+                if (pcl_12.size() > 0){
+                    buildObj(result, k, date, Constants.MODULE_CURVE, "10-12m", pcl_12, null);
+                }
+                if (pcl_25.size() > 0){
+                    buildObj(result, k, date, Constants.MODULE_CURVE, "12-25m", pcl_12, null);
+                }
+            }catch (Exception e){
+                log.error("ReportService--calCurve" + e.getMessage());
+            }
+        });
+        reportService.saveBatch(result, Constants.MODULE_CURVE);
+    }
+
+
+    /**
+     * 静态偏航对风分析
+     */
+    public void calJTPCDF(Date st,  Date et){
+        log.info("=====静态偏航对风分析");
+        List<Poweranalysisreport> result = new ArrayList<>();
+        var list = powerService.selectByTime(Constants.DATA_PROCESS, st, et);
+        val collect = list.stream().collect(Collectors.groupingBy(Powerfittinganalysis::getStationcn, Collectors.toList()));
+        collect.forEach((k, v) -> {
+            String date = null;
+            // 负值偏大、中度负值、中度正值、正值偏大
+            List<String> lsL2 = new ArrayList<>();
+            List<String> lsL1 = new ArrayList<>();
+            List<String> lsR1 = new ArrayList<>();
+            List<String> lsR2 = new ArrayList<>();
+           try {
+               for (Powerfittinganalysis obj : v){
+                   List<PowerPointData> data = fileParse(obj, false);
+                   //静态偏航数据
+                   Map<String, Object> mp = WindDirectionALG.windDeviationPoint(data);
+                   int avg = (int) mp.get("avg");
+                   List<Object> ls = (List<Object>) mp.get("data");
+                   //点太少不做计算
+                   if (ls.size() < 50){
+                       continue;
+                   }
+                   if (date == null){
+                       date = DateUtil.format(obj.getCreatetime(), DateUtil.YYYY_MM);
+                   }
+                   if (avg <= -15){
+                       lsL2.add(obj.getWindturbine());
+                   }
+//                if (avg > -15 && avg <= -10){
+//                    lsL1.add(obj.getWindturbine());
+//                }
+//                if (avg >= 10 && avg < 15){
+//                    lsR1.add(obj.getWindturbine());
+//                }
+                   if (avg >= 15){
+                       lsR2.add(obj.getWindturbine());
+                   }
+               }
+               if (lsL2.size() > 0){
+                   buildObj(result, k, date, Constants.MODULE_STATIC_WIND, "负值偏大(15+deg)", lsL2, null);
+               }
+//            if (lsL1.size() > 0){
+//                buildObj(result, k, date, Constants.MODULE_STATIC_WIND, "中度负值(10-15deg)", lsL1);
+//            }
+//            if (lsR1.size() > 0){
+//                buildObj(result, k, date, Constants.MODULE_STATIC_WIND, "中度正值(10-15deg)", lsR1);
+//            }
+               if (lsR2.size() > 0){
+                   buildObj(result, k, date, Constants.MODULE_STATIC_WIND, "正值偏大(15+deg)", lsR2, null);
+               }
+           } catch (Exception e){
+               log.error("ReportService--calJTPCDF" + e.getMessage());
+           }
+        });
+        reportService.saveBatch(result, Constants.MODULE_STATIC_WIND);
+    }
+
+
+    /**
+     * 容量系数分析
+     */
+    public void calMRLXS(Date st,  Date et){
+        log.info("=====容量系数分析");
+        List<Poweranalysisreport> result = new ArrayList<>();
+        var list = windinfoService.selectByTime(DateUtil.format(st, DateUtil.YYYY_MM), DateUtil.format(et, DateUtil.YYYY_MM));
+        val collect = list.stream().collect(Collectors.groupingBy(Powerwindinfo::getStation, Collectors.toList()));
+        collect.forEach((k, v) -> {
+            String date = null;
+            // 毛容量系数 0-0.15   0.15-0.2
+            List<String> ls1 = new ArrayList<>();
+            List<String> ls2 = new ArrayList<>();
+            try {
+                for (Powerwindinfo obj : v){
+                    if (date == null){
+                        date = obj.getTime();
+                    }
+                    if (obj.getAvgspeed() < 5 && obj.getMrxs() <= 0.15){
+                        ls1.add(obj.getWindturbine());
+                    }
+                    if (obj.getAvgspeed() >= 5 && obj.getMrxs() > 0.15 && obj.getMrxs() <= 0.2){
+                        ls2.add(obj.getWindturbine());
+                    }
+
+                }
+                if (ls1.size() > 0){
+                    buildObj(result, InitialRunner.stationMap.get(k), date, Constants.MODULE_MLXS, "0-15%", ls1, null);
+                }
+                if (ls2.size() > 0){
+                    buildObj(result, InitialRunner.stationMap.get(k), date, Constants.MODULE_MLXS, "15-20%", ls2, null);
+                }
+            } catch (Exception e){
+                log.info("ReportService--calMRLXS" + e.getMessage());
+            }
+        });
+        reportService.saveBatch(result, Constants.MODULE_MLXS);
+    }
+
+
+    /**
+     * 桨距角分析
+     */
+    public void calBlade(Date st,  Date et){
+        log.info("=====桨距角分析");
+        List<Poweranalysisreport> result = new ArrayList<>();
+        var list = powerService.selectByTime(Constants.DATA_PROCESS, st, et);
+        val collect = list.stream().collect(Collectors.groupingBy(Powerfittinganalysis::getStationcn, Collectors.toList()));
+        collect.forEach((k, v) -> {
+            String date = null;
+            // 并网分析、停机分析
+            List<String> lsbw = new ArrayList<>();
+            List<String> lstj = new ArrayList<>();
+            try {
+                for (Powerfittinganalysis obj : v){
+                    List<PowerPointData> ls = fileParse(obj, true);
+                    int countBW = 0;
+                    int countTJ = 0;
+                    for (PowerPointData item : ls){
+                        if (date == null){
+                            date = DateUtil.format(obj.getCreatetime(), DateUtil.YYYY_MM);
+                        }
+                        double angle = (item.getYp1() + item.getYp2() + item.getYp3()) / 3;
+                        double avg = new BigDecimal(angle).setScale(2, RoundingMode.CEILING).doubleValue();
+                        if (item.getFilter() == 0 && avg < 20){
+                            //风机正常并网且风速在5-12m
+                            if (item.getMxzt() == 2 && item.getSpeed() >= 5 && item.getSpeed() <= 12 && avg > 6){
+                                countBW += 1;
+                            }
+                        }
+                        //风机在不发电情况下
+                        if (item.getFilter() == 2 && avg > 70){
+                            if ((90 - avg) > 6){
+                                countTJ += 1;
+                            }
+                        }
+                    }
+                    if (countBW >= 50){
+                        lsbw.add(obj.getWindturbine());
+                    }
+                    if (countTJ >= 50){
+                        lstj.add(obj.getWindturbine());
+                    }
+                }
+                if (lsbw.size() > 0){
+                    buildObj(result, k, date, Constants.MODULE_BLADE, "并网桨距角偏大", lsbw, null);
+                }
+                if (lstj.size() > 0){
+                    buildObj(result, k, date, Constants.MODULE_BLADE, "停机桨距角偏大", lstj, null);
+                }
+            } catch (Exception e){
+                log.error("ReportService--calBLADE" + e.getMessage());
+            }
+        });
+        reportService.saveBatch(result, Constants.MODULE_BLADE);
+    }
+
+
+
+    /**
+     * 停机时间
+     */
+    public void calStopTime(Date st,  Date et){
+        log.info("=====停机时间");
+        List<Poweranalysisreport> result = new ArrayList<>();
+        var list = powerService.selectByTime(Constants.DATA_PREPARE, st, et);
+        val collect = list.stream().collect(Collectors.groupingBy(Powerfittinganalysis::getStationcn, Collectors.toList()));
+        collect.forEach((k, v) -> {
+            String date = null;
+            double time1 = 0.0,  time2 = 0.0;
+            List<String> ls1 = new ArrayList<>();
+            List<String> ls2 = new ArrayList<>();
+            try {
+                for (Powerfittinganalysis obj : v) {
+                    if (date == null){
+                        date = DateUtil.format(obj.getCreatetime(), DateUtil.YYYY_MM);
+                    }
+                    List<PowerPointData> datas = fileParse(obj, false);
+                    if (datas == null || datas.size() == 0) {
+                        continue;
+                    }
+                    //3-5m的停机时间、大于25m的停机时间
+                    double times1 = 0.0,  times2 = 0.0;
+                    double interval = DateUtil.getTimeDiff(datas.get(1).getTime(), datas.get(2).getTime()); //两条数据的间隔时间
+                    for (PowerPointData item : datas){
+                        if (item.getMxzt() != 2 && item.getSpeed() > 3.0 && item.getSpeed() < 5.0){
+                            times1 += interval;
+                        }
+                        if (item.getSpeed() >= 25 && item.getMxzt() == 2){
+                            times2 += interval;
+                        }
+                    }
+                    // 3-5m风速停机时长超过5000分钟
+                    if (times1 > 5000) {
+                        time1 += times1;
+                        ls1.add(obj.getWindturbine());
+                    }
+                    // 暴风天气未停机
+                    if (times2 >  10) {
+                        time2 += times2;
+                        ls2.add(obj.getWindturbine());
+                    }
+                }
+                if (ls1.size() > 0) {
+                    buildObj(result, k, date, Constants.MODULE_STOP_TIME, "3-5m", ls1, String.valueOf(time1));
+                }
+                if (ls2.size() > 0) {
+                    buildObj(result, k, date, Constants.MODULE_STOP_TIME, "大于25m", ls2, String.valueOf(time2));
+                }
+            } catch (Exception e){
+                log.error("ReportService--calStopTime" + e.getMessage());
+            }
+        });
+        reportService.saveBatch(result, Constants.MODULE_STOP_TIME);
+    }
+
+
+    private void buildObj(List<Poweranalysisreport> list, String station, String date, String module, String section, List<String> wtIds, String remark){
+        Poweranalysisreport report = new Poweranalysisreport();
+        report.setStation(station);
+        report.setModule(module);
+        report.setSection(section);
+        report.setTime(date);
+        report.setWtidcount(wtIds.size());
+        report.setWindturbine(StringUtils.join(wtIds, ","));
+        report.setRemark(remark);
+        list.add(report);
+    }
+
+
+    private List<PowerFittingData> csvParse(Powerfittinganalysis obj){
+        var list = new ArrayList<PowerFittingData>();
+        val content = FileUtil.readFile(obj.getPath(), true);
+        for (int i = 1; i < content.size(); i++){
+            PowerFittingData data = new PowerFittingData(content.get(i).split(","));
+            list.add(data);
+        }
+        return list;
+    }
+
+
+    private List<PowerPointData> fileParse(Powerfittinganalysis obj, boolean isFilter){
+        val list = new ArrayList<PowerPointData>();
+        val content = FileUtil.readFile(obj.getPath(), true);
+        for (int i = 1; i < content.size(); i++){
+            String[] split = content.get(i).split(",");
+            PowerPointData data = new PowerPointData(split, isFilter);
+            list.add(data);
+        }
+        return list;
+    }
+}

+ 1 - 1
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/socket/WebSocketServer.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fitting.service.custom.socket;
+package com.gyee.power.fitting.service.custom;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;

+ 19 - 21
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/agc/AgcDeviateService.java

@@ -44,7 +44,7 @@ public class AgcDeviateService {
 
 
 
-    private final AgcDeviateMapper agcDeviateMapper;
+    private final AgcDeviateMapper agcDeviateMapper = null;
     /**
      * AGC信息缓存
      */
@@ -52,29 +52,27 @@ public class AgcDeviateService {
 
     @Resource
     private IDataAdapter iDataAdapter;
-    @Resource
-    private GyeeConfig gyeeConfig;
 
 
     public AgcDeviateService(AgcDeviateMapper agcDeviateMapper, FileService fs, Environment env) {
-        this.agcDeviateMapper = agcDeviateMapper;
-        fileService = fs;
-        agcDeviateConfigMap = new HashMap<>();
-
-        isOffline = Boolean.TRUE.equals(env.getProperty("gyee.offline", boolean.class));
-        filePathPower = env.getProperty("gyee.file-path-power");
-
-        AgcDeviateConfig[] adcs = null;
-        if (isOffline) {
-            adcs = fileService.getFromFile(filePathPower + "agc_info_net.json", AgcDeviateConfig[].class);
-            initFiles();
-        } else {
-            AgcDeviateModel adm = agcDeviateMapper.selectById("agc_info_net");
-            adcs = JSON.parseObject(adm.getValue(), AgcDeviateConfig[].class);
-        }
-        for (AgcDeviateConfig adc : adcs) {
-            agcDeviateConfigMap.put(adc.getId(), adc);
-        }
+//        this.agcDeviateMapper = agcDeviateMapper;
+//        fileService = fs;
+//        agcDeviateConfigMap = new HashMap<>();
+//
+//        isOffline = Boolean.TRUE.equals(env.getProperty("gyee.offline", boolean.class));
+//        filePathPower = env.getProperty("gyee.file-path-power");
+//
+//        AgcDeviateConfig[] adcs = null;
+//        if (isOffline) {
+//            adcs = fileService.getFromFile(filePathPower + "agc_info_net.json", AgcDeviateConfig[].class);
+//            initFiles();
+//        } else {
+//            AgcDeviateModel adm = agcDeviateMapper.selectById("agc_info_net");
+//            adcs = JSON.parseObject(adm.getValue(), AgcDeviateConfig[].class);
+//        }
+//        for (AgcDeviateConfig adc : adcs) {
+//            agcDeviateConfigMap.put(adc.getId(), adc);
+//        }
     }
 
     private void initFiles() {

+ 59 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/agc/PowerPredictionService.java

@@ -0,0 +1,59 @@
+package com.gyee.power.fitting.service.custom.agc;
+
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.power.fitting.common.feign.RemoteServiceBuilder;
+import com.gyee.power.fitting.common.spring.InitialRunner;
+import com.gyee.power.fitting.common.util.DateUtil;
+import com.gyee.power.fitting.model.agc.AiPoints;
+import com.gyee.power.fitting.model.custom.TsDoubleData;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @author gyee
+ */
+@Service
+public class PowerPredictionService {
+
+    @Resource
+    private RemoteServiceBuilder remoteService;
+
+
+    public Map<String, Object> getPredictionData(String id, long st, long et, int interval) {
+        Map<String, Object> result = new HashMap<>();
+
+        //时间
+        List<String> time = new ArrayList<>();
+        //实际功率,等间隔
+        List<Double> sjgl = new ArrayList<>();
+        String sjglPoint = InitialRunner.powerPreMap.get(id).getPower().getTag();
+        List<TsDoubleData> data = remoteService.adapter().getHistorySnap(sjglPoint, st, et, interval);
+        for (TsDoubleData ts : data){
+            time.add(DateUtil.format(ts.getTs(), DateUtil.DATE_TIME_PATTERN));
+            sjgl.add(new BigDecimal(ts.getDoubleValue()).setScale(2, BigDecimal.ROUND_FLOOR).doubleValue());
+        }
+
+        //短期功率
+//        List<Double> dqgl = new ArrayList<>();
+//        AiPoints[] aiPoints = InitialRunner.powerPreMap.get(id).getAiPoints();
+//        List<String> fglPoint = Arrays.stream(aiPoints).filter(f -> f.getType() == 1).map(m -> m.getTag()).collect(Collectors.toList());
+//        for (long s = st; s <= et; s += (interval * 1000)){
+//            JSONObject json = remoteService.adapter().getHistorySection(tagNames, s);
+//            for (String point : fglPoint){
+//                double value = json.getJSONObject(point).getDoubleValue("doubleValue");
+//                dqgl.add(new BigDecimal(value).setScale(2, BigDecimal.ROUND_FLOOR).doubleValue());
+//            }
+//        }
+//
+//        result.put("time", time);
+//        result.put("sjgl", sjgl);
+//        result.put("dqyugl", dqgl);
+
+        return result;
+    }
+}

+ 0 - 76
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/blade/BladeService.java

@@ -1,76 +0,0 @@
-package com.gyee.power.fitting.service.custom.blade;
-
-import com.gyee.power.fitting.common.util.FileUtil;
-import com.gyee.power.fitting.model.Powerfittinganalysis;
-import com.gyee.power.fitting.model.custom.PowerPointData;
-import com.gyee.power.fitting.service.PowerfittinganalysisService;
-import lombok.val;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.*;
-import java.util.stream.Collectors;
-
-@Service
-public class BladeService {
-
-    @Resource
-    private PowerfittinganalysisService powerService;
-
-    /**
-     * 3个叶片的角度
-     * @param ids
-     * @return
-     */
-    public Object bladeData(String ids){
-        Map<String, Object> result = new HashMap<>();
-        List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
-        if (list.size() == 0)
-            return result;
-
-        List<String> time = new ArrayList<>();
-        List<Object> temp = new ArrayList<>();
-        for (int i = 0; i < list.size(); i++){
-            Powerfittinganalysis obj = list.get(i);
-            TreeMap<String, Object> mp = new TreeMap<>();
-            List<Double> p1 = new ArrayList<>();
-            List<Double> p2 = new ArrayList<>();
-            List<Double> p3 = new ArrayList<>();
-            List<PowerPointData> ls = csvParse(obj);
-            for (PowerPointData item : ls){
-                p1.add(item.getYp1());
-                p2.add(item.getYp2());
-                p3.add(item.getYp3());
-            }
-            mp.put("yp1", p1);
-            mp.put("yp2", p2);
-            mp.put("yp3", p3);
-            mp.put("wt", obj.getWindturbine());
-            if (time.size() == 0)
-                time.addAll(ls.stream().map(m -> m.getTime()).collect(Collectors.toList()));
-            temp.add(mp);
-        }
-        result.put("time", time);
-        result.put("angle", temp);
-
-        return result;
-    }
-
-    /**
-     * csv 文件解析成对象
-     * @param obj
-     * @return
-     */
-    private List<PowerPointData> csvParse(Powerfittinganalysis obj){
-        List<PowerPointData> list = new ArrayList<>();
-        val content = FileUtil.readFile(obj.getPath(), true);
-        for (int i = 1; i < content.size(); i++){
-            String[] split = content.get(i).split(",");
-            PowerPointData data = new PowerPointData(split, false);
-            list.add(data);
-        }
-
-        return list;
-    }
-
-}

+ 30 - 29
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataFittingService.java

@@ -11,10 +11,7 @@ import com.gyee.power.fitting.common.util.DateUtil;
 import com.gyee.power.fitting.common.util.FileUtil;
 import com.gyee.power.fitting.common.util.PowerFittingUtil;
 import com.gyee.power.fitting.common.util.SnowFlakeUtil;
-import com.gyee.power.fitting.model.Modelpowerdetails;
-import com.gyee.power.fitting.model.Powerfittinganalysis;
-import com.gyee.power.fitting.model.Powermodel;
-import com.gyee.power.fitting.model.Windturbine;
+import com.gyee.power.fitting.model.*;
 import com.gyee.power.fitting.model.anno.AnnotationTool;
 import com.gyee.power.fitting.model.anno.FixedVo;
 import com.gyee.power.fitting.model.custom.*;
@@ -55,7 +52,7 @@ public class DataFittingService {
 
     /**
      * 曲线拟合
-     * @param ids
+     * @param ids  预处理数据的id
      * @param maxs
      * @param mins
      * @param maxp
@@ -69,7 +66,7 @@ public class DataFittingService {
         if (mode == 0){  //单台拟合
             String[] splitId = ids.split(",");
             for (String id : splitId) {
-                List<Powerfittinganalysis> list = powerService.selectListByIds(id);
+                List<Powerfittinganalysis> list = powerService.selectListById(id);
                 List<Double> arraySpeed = new ArrayList<>();
                 List<Double> arrayPower = new ArrayList<>();
                 List<String> line = FileUtil.readFile(list.get(0).getPath(), true);
@@ -80,7 +77,7 @@ public class DataFittingService {
             }
         }
         if (mode == 1){  //合并拟合
-            List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
+            List<Powerfittinganalysis> list = powerService.selectListById(ids);
             AtomicReference<Double> maxP = new AtomicReference<>(0.0);
             List<Double> arraySpeed = new ArrayList<>();
             List<Double> arrayPower = new ArrayList<>();
@@ -94,7 +91,7 @@ public class DataFittingService {
             object.set(fittingMode(list, maxP.get(), arraySpeed, arrayPower, dimension, mode));
         }
         if (mode == 2){  //同名拟合
-            List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
+            List<Powerfittinganalysis> list = powerService.selectListById(ids);
             Map<String, List<Powerfittinganalysis>> map = list.stream().collect(Collectors.groupingBy(d -> d.getWindturbine()));
             map.forEach((k, ls) -> {
                 if (ls.size() > 1){
@@ -134,7 +131,7 @@ public class DataFittingService {
      * @return
      */
     public List<Object> dataFittingTree(){
-        List<Powerfittinganalysis> list = powerService.selectList(Constants.DATA_FITTING);
+        List<Powerfittinganalysis> list = powerService.selectList( Constants.DATA_FITTING);
         List<Object> ls = PowerFittingUtil.powerDataTree(list, Constants.DATA_FITTING);
         return ls;
     }
@@ -154,7 +151,7 @@ public class DataFittingService {
 
         /** 添加内容 **/
         List<PowerFittingData> list = new ArrayList<>();
-        Powerfittinganalysis obj = powerService.selectItemById(id);
+        Powerfittinganalysis obj = powerService.getById(id);
         List<String> ls = FileUtil.readFile(obj.getPath(), false);
         for (int i = 1; i < ls.size(); i++){
             PowerFittingData data = new PowerFittingData(ls.get(i).split(","));
@@ -178,7 +175,7 @@ public class DataFittingService {
      */
     public Map<String, Object> dataFittingCurve(String id){
         Map<String, Object> map = new HashMap<>();
-        Powerfittinganalysis obj = powerService.selectItemById(id);
+        Powerfittinganalysis obj = powerService.getById(id);
 
         //实际功率、风速、Cp值
         List<Object> sjglList = new ArrayList<>();
@@ -199,7 +196,7 @@ public class DataFittingService {
         List<PowerPointData> yyd = new ArrayList<>(); //有用点
         List<PowerPointData> wyd = new ArrayList<>(); //无用点
         for (String pid : ids){
-            Powerfittinganalysis pf = powerService.selectItemById(pid);
+            Powerfittinganalysis pf = powerService.getById(pid);
             List<String> lp = FileUtil.readFile(pf.getPath(), true);
             for (int i = 1; i < lp.size(); i++){
                 String[] split = lp.get(i).split(",");
@@ -270,9 +267,10 @@ public class DataFittingService {
     private void csvParse(List<String> line, List<Double> arrayS, List<Double> arrayP, double mins, double maxs, double minp, double maxp){
         for (int i = 1; i < line.size(); i++) {
             String[] split = line.get(i).split(",");
-            PowerPointData data = new PowerPointData(split, true);//是否过滤 0:没过滤 1:过滤
-            double x = data.getSpeed();    //风速
-            double y = data.getPower();    //功率
+            //是否过滤 0:没过滤 1:过滤
+            PowerPointData data = new PowerPointData(split, true);
+            double x = data.getSpeed();
+            double y = data.getPower();
             int filter = data.getFilter();
             if (filter == 0 && (x >= mins && x <= maxs && y >= minp && y <= maxp)) {
                 arrayS.add(x);
@@ -408,10 +406,10 @@ public class DataFittingService {
                     points.add(new Point(power.getSpeed(), power.getEnsurepower()));
             }
 
-            double maxp5 = list.stream().filter(f -> 5.0 == f.getSpeed()).collect(Collectors.toList()).get(0).getEnsurepower();
-            double maxp10 = list.stream().filter(f -> 10.0 == f.getSpeed()).collect(Collectors.toList()).get(0).getEnsurepower();
-            double maxp12 = list.stream().filter(f -> 12.0 == f.getSpeed()).collect(Collectors.toList()).get(0).getEnsurepower();
-            double maxp25 = list.stream().filter(f -> 25.0 == f.getSpeed()).collect(Collectors.toList()).get(0).getEnsurepower();
+            double maxp5 = list.stream().filter(f -> 5.0 == f.getSpeed()).findFirst().get().getEnsurepower();
+            double maxp10 = list.stream().filter(f -> 10.0 == f.getSpeed()).findFirst().get().getEnsurepower();
+            double maxp12 = list.stream().filter(f -> 12.0 == f.getSpeed()).findFirst().get().getEnsurepower();
+            double maxp25 = list.stream().filter(f -> 25.0 == f.getSpeed()).findFirst().get().getEnsurepower();
 
             //曲线偏差率
             double pcl = PowerFittingALG.curveDeviationRatio2(point, points, maxp25, 3, 25);
@@ -440,15 +438,18 @@ public class DataFittingService {
     public Object dataFittingLine(String ids) {
         List<Object> result = new ArrayList<>();
         Map<String, Windturbine> wtMap = InitialRunner.wtMap;
-        List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
-        if (list.size() == 0)
+        Map<String, Equipmentmodel> eqMap = InitialRunner.equipmentMap;
+        List<Powerfittinganalysis> list = powerService.listByIds(Arrays.asList(ids.split(",")));
+        if (list.size() == 0) {
             return result;
+        }
 
-        String model = wtMap.get(list.get(0).getWindturbine()).getModelid();
+        double power = eqMap.get(wtMap.get(list.get(0).getWindturbine()).getModelid()).getPowerproduction();
         list.forEach(item -> {
             //机型不一致,额定功率计算不准确
-            if (!model.equals(wtMap.get(item.getWindturbine()).getModelid()))
-                throw new CustomException(4010, item.getWindturbine() + "机型不一致,请重新选择");
+            if (power != eqMap.get(wtMap.get(item.getWindturbine()).getModelid()).getPowerproduction()) {
+                throw new CustomException(4010, item.getWindturbine() + "机型额定功率不一致,请重新选择");
+            }
 
             //实际功率、风速
             Map<String, Object> map = new HashMap<>();
@@ -482,14 +483,14 @@ public class DataFittingService {
      */
     public Object dataFittingTime(String ids) {
         List<Object> result = new ArrayList<>();
-        List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
+        List<Powerfittinganalysis> list = powerService.listByIds(Arrays.asList(ids.split(",")));
         if (list.size() == 0)
             return result;
 
         list.forEach(item -> {
             Map<String, Object> map = new HashMap<>();
-            int[] time1 = new int[5];  //0:运行 1:3-5m   2:5-10m   3:10-12m  4:12-25m(全功率)
-            int[] time2 = new int[4];  //0:3-5m   1:5-10m   2:10-12m  3:12-25m(全功率)
+            int[] time1 = new int[5];  //0:运行时间: 0:全部  1:3-5m   2:5-10m   3:10-12m  4:12-25m(全功率)
+            int[] time2 = new int[4];  //0:不运行时间: 3-5m   1:5-10m   2:10-12m  3:12-25m(全功率)
             String[] split = item.getProcessid().split(",");//数据准备ID,获取文件
             for (String id : split){
                 List<String> line = FileUtil.readFile(powerService.getById(id).getPath(), true);
@@ -504,7 +505,7 @@ public class DataFittingService {
         return result;
     }
 
-    private void timeTotal(int[] time1, int[] time2, List<String> line){
+    public void timeTotal(int[] time1, int[] time2, List<String> line){
         List<PowerPointData> list = new ArrayList<>();
         double interval = DateUtil.getTimeDiff(line.get(1).split(",")[0], line.get(2).split(",")[0]); //两条数据的间隔时间
         for (int i = 1; i < line.size(); i++){
@@ -539,7 +540,7 @@ public class DataFittingService {
      */
     @Async
     public void curveSave(String ids) {
-        List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
+        List<Powerfittinganalysis> list = powerService.listByIds(Arrays.asList(ids.split(",")));
         if (list.size() == 0)
             return;
 

+ 23 - 14
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataPrepareService.java

@@ -18,7 +18,7 @@ import com.gyee.power.fitting.model.custom.PowerPointData;
 import com.gyee.power.fitting.model.custom.TableTitle;
 import com.gyee.power.fitting.model.custom.TsDoubleData;
 import com.gyee.power.fitting.service.PowerfittinganalysisService;
-import com.gyee.power.fitting.service.custom.socket.WebSocketServer;
+import com.gyee.power.fitting.service.custom.WebSocketServer;
 import lombok.extern.slf4j.Slf4j;
 import lombok.val;
 import org.springframework.scheduling.annotation.Async;
@@ -27,10 +27,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.io.File;
 import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
@@ -64,27 +61,36 @@ public class DataPrepareService {
             try{
                 List<String> points = config.getPoints();
                 Map<String, List<Windturbinetestingpointai2>> collect = InitialRunner.pointMap.get(wt).stream().collect(Collectors.groupingBy(w -> w.getUniformcode()));
-                if (collect.size() < 8)
+                if (points.size() != collect.size()) {
+                    log.error("测点数据不足,points: " + points);
+                    collect.forEach((key, value) -> {
+                        log.error("测点数据异常: point:" + key);
+                        log.error("测点数据异常: point:" + value);
+                    });
+                    socketServer.sendInfo(JsonResult.seccess(4000, wt + "风机测点异常,数据准备失败"), null);
                     continue;
+                }
 
                 for (int i = 0; i < points.size(); i++){
                     Windturbinetestingpointai2 point = collect.get(points.get(i)).get(0);
                     log.info("测点:" + point.getId() + "----" + point.getName());
                     List<TsDoubleData> data = remoteService.adapter().getHistorySnap(point.getId(), st, et, interval);
-                    if (data == null || data.size() < 0)
+                    if (data == null || data.size() < 0) {
                         break;
+                    }
                     result.add(data);
                     TimeUnit.MILLISECONDS.sleep(200);
                 }
-                if (result.size() != points.size())
+                if (result.size() != points.size()) {
                     continue;
+                }
 
                 String content = assemble(result);
                 // 处理的数据保存在本地
                 String wtCode = InitialRunner.wtMap.get(wt).getCode();
                 String fileName = config.getFilePathPrepare() + station + "_" + wtCode + "_" + System.currentTimeMillis() +File.separator+ 1000 + ".csv";
                 boolean flag = FileUtil.writeFile(fileName, content);
-                if (flag){  // TODO  保存数据库
+                if (flag){
                     Powerfittinganalysis obj = new Powerfittinganalysis();
                     obj.setStation(station);
                     obj.setStationcn(InitialRunner.stationMap.get(station));
@@ -95,12 +101,14 @@ public class DataPrepareService {
                     obj.setPath(fileName);
                     obj.setType(Constants.DATA_PREPARE);
                     obj.setInterp(interval);
-                    powerService.insertItem(obj);
+                    obj.setCreatetime(DateUtil.parseStrtoDate(DateUtil.format(st, DateUtil.DATE_TIME_PATTERN), DateUtil.DATE_TIME_PATTERN));
+                    powerService.save(obj);
                 }
                 socketServer.sendInfo(JsonResult.successData(ResultCode.SUCCESS, new DecimalFormat("0.00").format((double)(k + 1)/wtId.size())), null);
-                System.out.println("数据准备完成:" + wt);
+                log.info("数据准备完成:" + wt);
             } catch (Exception e) {
-                socketServer.sendInfo(JsonResult.error(), null);
+                socketServer.sendInfo(JsonResult.error(ResultCode.ERROR_POINT), null);
+                log.error("时序数据读取异常:", e.getMessage());
             } finally {}
         }
     }
@@ -132,7 +140,7 @@ public class DataPrepareService {
 
         /** 添加内容  读取前500行 **/
         List<PowerPointData> list = new ArrayList<>();
-        Powerfittinganalysis obj = powerService.selectItemById(id);
+        Powerfittinganalysis obj = powerService.getById(id);
         List<String> ls = FileUtil.readFile(obj.getPath(), false);
         for (int i = 1; i < ls.size(); i++){
             PowerPointData data = new PowerPointData(ls.get(i).split(","), false);
@@ -146,8 +154,9 @@ public class DataPrepareService {
     }
 
     private String assemble(List<List<TsDoubleData>> list){
-        if (list.size() == 0)
+        if (list.size() == 0) {
             return null;
+        }
 
         StringBuilder sb = setTitle();
         List<TsDoubleData> data = list.get(0);

+ 0 - 0
power-fitting/src/main/java/com/gyee/power/fitting/service/custom/curve/DataProcessService.java


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików