Browse Source

Merge branch 'master' of http://124.70.43.205:3000/xieshengjie/sis-background

xushili 2 years ago
parent
commit
4463d081c2
100 changed files with 4753 additions and 370 deletions
  1. 5 2
      benchmarking-impala/src/main/java/com/gyee/benchmarkingimpala/service/BenchmarkingService.java
  2. 11 1
      gradeevaluation/src/main/java/com/gyee/gradeevaluation/service/bigscreen/BigScreenService.java
  3. 4 0
      gradeevaluation/src/main/java/com/gyee/gradeevaluation/variable/MainConstant.java
  4. 5 1
      gyee-sample-impala/pom.xml
  5. 3 3
      gyee-sample-impala/src/main/java/com/gyee/impala/common/config/ThreadPoolConfig.java
  6. 1 1
      gyee-sample-impala/src/main/java/com/gyee/impala/common/config/datasource/KuduDataSourceConfig.java
  7. 1 1
      gyee-sample-impala/src/main/java/com/gyee/impala/common/config/datasource/SlaveDataSourceConfig.java
  8. 0 1
      gyee-sample-impala/src/main/java/com/gyee/impala/common/feign/RemoteServiceBuilder.java
  9. 1 1
      gyee-sample-impala/src/main/java/com/gyee/impala/controller/diagnose/HostparamController.java
  10. 1 2
      gyee-sample-impala/src/main/java/com/gyee/impala/schdule/TaskStatistic.java
  11. 2 3
      gyee-sample-impala/src/main/java/com/gyee/impala/schdule/TaskWeather.java
  12. 2 3
      gyee-sample-impala/src/main/java/com/gyee/impala/schdule/TaskWindspeedForecast.java
  13. 1 0
      gyee-sample-impala/src/main/java/com/gyee/impala/service/custom/diagnose/AutoCmdService.java
  14. 35 28
      gyee-sample-impala/src/main/java/com/gyee/impala/service/impl/master/WindspeedforecastshorttermServiceImpl.java
  15. 12 31
      gyee-sample-impala/src/main/resources/application.yaml
  16. 1 1
      pom.xml
  17. 0 26
      power-fetting/src/main/java/com/gyee/power/fetting/BootApplication.java
  18. 0 16
      power-fetting/src/main/java/com/gyee/power/fetting/common/config/GyeeConfig.java
  19. 0 24
      power-fetting/src/main/java/com/gyee/power/fetting/common/feign/IAdapterService.java
  20. 0 152
      power-fetting/src/main/java/com/gyee/power/fetting/common/spring/InitialRunner.java
  21. 45 11
      power-fetting/pom.xml
  22. 11 11
      power-fetting/src/main/java/com/gyee/power/fetting/MapperGenerator.java
  23. 49 0
      power-fitting/src/main/java/com/gyee/power/fitting/PowerBootApplication.java
  24. 9 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/CurveFitting.java
  25. 39 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/DBSCANPointALG.java
  26. 446 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/MpptFittingAlg.java
  27. 180 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PolynomialCurveFitting.java
  28. 443 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerFittingALG.java
  29. 356 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerProcessALG.java
  30. 78 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerTemperatureAlg.java
  31. 22 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/TimeCostCalculator.java
  32. 158 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/alg/WindDirectionALG.java
  33. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/base/ExcludeQueryWrapper.java
  34. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/config/CorsConfig.java
  35. 1 8
      power-fetting/src/main/java/com/gyee/power/fetting/common/config/datasource/DataSourceConfig.java
  36. 73 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/config/GyeeConfig.java
  37. 50 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/config/ThreadPoolConfig.java
  38. 20 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/config/WebSocketConfig.java
  39. 13 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/constants/Constants.java
  40. 3 3
      power-fetting/src/main/java/com/gyee/power/fetting/common/exception/AdviceException.java
  41. 2 2
      power-fetting/src/main/java/com/gyee/power/fetting/common/exception/CustomException.java
  42. 32 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/feign/FeignsBuilder.java
  43. 34 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/feign/IAdapterService.java
  44. 26 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/feign/IDataAdapter.java
  45. 2 2
      power-fetting/src/main/java/com/gyee/power/fetting/common/feign/RemoteServiceBuilder.java
  46. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/result/JsonResult.java
  47. 2 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/result/ResultCode.java
  48. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/spring/ExitDisposable.java
  49. 125 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/spring/InitialRunner.java
  50. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/spring/SpringContextUtil.java
  51. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/Base64Util.java
  52. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/CollectUtil.java
  53. 21 3
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/DateUtil.java
  54. 360 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/util/DateUtils.java
  55. 107 10
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/FileUtil.java
  56. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/JudeSystem.java
  57. 20 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/NumberUtil.java
  58. 62 0
      power-fitting/src/main/java/com/gyee/power/fitting/common/util/PowerFittingUtil.java
  59. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/SnowFlakeUtil.java
  60. 1 1
      power-fetting/src/main/java/com/gyee/power/fetting/common/util/TokenGenerator.java
  61. 48 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/AgcDeviateController.java
  62. 138 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/DataFittingController.java
  63. 83 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/DataPrepareController.java
  64. 106 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/DataProcessController.java
  65. 61 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/DateOptionController.java
  66. 32 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/PowerTemperatureController.java
  67. 65 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/WindDirectionController.java
  68. 23 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/base/CurveFittingController.java
  69. 36 0
      power-fitting/src/main/java/com/gyee/power/fitting/controller/base/WindInfoController.java
  70. 13 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/AgcDeviateMapper.java
  71. 18 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/EquipmentmodelMapper.java
  72. 21 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/ModelpowerMapper.java
  73. 18 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/ModelpowerdetailsMapper.java
  74. 16 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/PhotovoltaiccapacityMapper.java
  75. 18 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/PhotovoltaicivMapper.java
  76. 18 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/PowerfittinganalysisMapper.java
  77. 2 2
      power-fetting/src/main/java/com/gyee/power/fetting/mapper/WindpowerstationMapper.java
  78. 18 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/Windpowerstationtestingpoint2Mapper.java
  79. 2 2
      power-fetting/src/main/java/com/gyee/power/fetting/mapper/WindturbineMapper.java
  80. 18 0
      power-fitting/src/main/java/com/gyee/power/fitting/mapper/Windturbinetestingpointai2Mapper.java
  81. 92 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/AgcDeviateModel.java
  82. 72 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Equipmentmodel.java
  83. 47 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Modelpower.java
  84. 47 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Modelpowerdetails.java
  85. 78 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Photovoltaiccapacity.java
  86. 77 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Photovoltaiciv.java
  87. 86 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Powerfittinganalysis.java
  88. 5 4
      power-fetting/src/main/java/com/gyee/power/fetting/model/Windpowerstation.java
  89. 199 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Windpowerstationtestingpoint2.java
  90. 4 3
      power-fetting/src/main/java/com/gyee/power/fetting/model/Windturbine.java
  91. 86 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/Windturbinetestingpointai2.java
  92. 48 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/agc/AgcDeviateConfig.java
  93. 33 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/agc/AgcDeviateTag.java
  94. 56 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/agc/AiPoints.java
  95. 35 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/agc/PointData.java
  96. 75 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/anno/AnnotationTool.java
  97. 18 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/anno/Desc.java
  98. 22 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/anno/FixedVo.java
  99. 35 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/custom/LineCurveFitting.java
  100. 0 0
      power-fitting/src/main/java/com/gyee/power/fitting/model/custom/Point.java

+ 5 - 2
benchmarking-impala/src/main/java/com/gyee/benchmarkingimpala/service/BenchmarkingService.java

@@ -2506,8 +2506,11 @@ public class BenchmarkingService  {
         qw.ge("recorddate",begin).le("recorddate",end);
         List<Benchmark> tbList = benchmarkService.list(qw);
         if (StringUtils.isNotNull(tbList)  && StringUtils.isNotEmpty(tbList)){
-            tbList.get(0).setForeignkeyid("同比");
-            resultList.add(tbList.get(0));
+            Benchmark benchmark = tbList.get(0);
+            if(benchmark!=null){
+                benchmark.setForeignkeyid("同比");
+                resultList.add(benchmark);
+            }
         }
     }
     public void getJz(String timetype, String foreigntype,List<Benchmark> resultList) throws Exception {

+ 11 - 1
gradeevaluation/src/main/java/com/gyee/gradeevaluation/service/bigscreen/BigScreenService.java

@@ -224,7 +224,12 @@ public class BigScreenService {
         double hzjfdl = ednaApiUtil.getRealData(MainConstant.JSFW_HZJRFDLB).getPointValueInDouble();
         double hzjgl = ednaApiUtil.getRealData(MainConstant.JSFW_HZJSSZGL).getPointValueInDouble();
         double hzjrzqd = ednaApiUtil.getRealData(MainConstant.HZJFS).getPointValueInDouble();
-        double gfrzqd = new BigDecimal(dwkrzqd + plrzqd + xhrzqd + mchrzqd + hzjrzqd) .divide(new BigDecimal(3), 2, RoundingMode.HALF_EVEN).doubleValue();
+
+        double akfdl = ednaApiUtil.getRealData(MainConstant.JSFW_AKRFDLB).getPointValueInDouble();//埃肯发电量
+        double akgl = ednaApiUtil.getRealData(MainConstant.JSFW_AKSSZGL).getPointValueInDouble();//埃肯功率
+        double akrzqd = ednaApiUtil.getRealData(MainConstant.AKFS).getPointValueInDouble();//埃肯光照强度
+
+        double gfrzqd = new BigDecimal(dwkrzqd + plrzqd + xhrzqd + mchrzqd + hzjrzqd+akrzqd) .divide(new BigDecimal(3), 2, RoundingMode.HALF_EVEN).doubleValue();
         map.put("dwkgl",dwkgl);
         map.put("plgl",plgl);
         map.put("xhgl",xhgl-mchgl);
@@ -234,6 +239,11 @@ public class BigScreenService {
         map.put("hzjrzqd",hzjrzqd);
         map.put("gfrzqd",gfrzqd);
 
+        map.put("akfdl",akfdl);
+        map.put("akgl",akgl);
+        map.put("akrzqd",akrzqd);
+
+
         double fwjsl = 93.58;
         double zhjsl = 96.12;
         double xqjsl = 94.67;

+ 4 - 0
gradeevaluation/src/main/java/com/gyee/gradeevaluation/variable/MainConstant.java

@@ -70,6 +70,9 @@ public class MainConstant {
     public static final String JSFW_HZJSSFS = "HZJGDCJSFW.NX_GD_HZJG_XX_XX_XXX_XXX_CI0134"; //海子井日照强度
     public static final String JSFW_HZJSSZGL = "HZJDQ.NX_GD_HZJG_DQ_P1_L1_001_AI0052"; //海子井总功率
 
+    public static final String JSFW_AKRFDLB = "AKGDCJSFW.NX_GD_AKG_XX_XX_XXX_XXX_CI0088"; //埃肯日发电量
+    public static final String JSFW_AKSSZGL = "AKDQ.NX_GD_AKG_DQ_P1_L1_001_AI0139"; //埃肯总功率
+
 
 
     public static final String JSFW_XHRFDLB = "XHGDCJSFW.NX_GD_XHG_XX_XX_XXX_XXX_CI0088"; // 宣和日发电量
@@ -164,6 +167,7 @@ public class MainConstant {
     public static final String XHFS = "XHGGL.NX_GD_XHG_YC_P1_L1_001_QXZ001"; // 宣和日照强度
     public static final String MCHFS = "MCHGGL.NX_GD_MCHG_YC_P1_L1_001_QXZ001"; // 马场湖日照强度
     public static final String HZJFS = "HZJGGL.NX_GD_HZJG_YC_P1_L1_001_QXZ001"; // 海子井日照强度
+    public static final String AKFS = "AKDQ.NX_GD_AKG_DQ_P1_L1_001_AI0157"; // 埃肯日照强度
 
 
 }

+ 5 - 1
gyee-sample-impala/pom.xml

@@ -53,7 +53,11 @@
             <artifactId>spring-boot-configuration-processor</artifactId>
             <optional>true</optional>
         </dependency>
-
+        <dependency>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+            <version>42.4.0</version>
+        </dependency>
         <dependency>
             <groupId>com.alibaba</groupId>
             <artifactId>fastjson</artifactId>

+ 3 - 3
gyee-sample-impala/src/main/java/com/gyee/impala/common/config/ThreadPoolConfig.java

@@ -16,13 +16,13 @@ public class ThreadPoolConfig {
      */
 
     /** 核心线程数(默认线程数) */
-    private static final int corePoolSize = 20;
+    private static final int corePoolSize = 10;
     /** 最大线程数 */
-    private static final int maxPoolSize = 40;
+    private static final int maxPoolSize = 20;
     /** 允许线程空闲时间(单位:默认为秒) */
     private static final int keepAliveTime = 60;
     /** 缓冲队列大小 */
-    private static final int queueCapacity = 200;
+    private static final int queueCapacity = 100;
     /** 允许等待最长时间 */
     private static final int awaitTime = 15;
     /** 线程池名前缀 */

+ 1 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/common/config/datasource/KuduDataSourceConfig.java

@@ -34,7 +34,7 @@ public class KuduDataSourceConfig {
     public void initKuDu(){
         if (kuduClient == null)
             kuduClient = new KuduClient
-                    .KuduClientBuilder(gyeeConfig.getKuduHost() + ":7051")//7051,21050
+                    .KuduClientBuilder(gyeeConfig.getKuduHost() )//7051,21050
                     .defaultOperationTimeoutMs(6000)
                     .build();
     }

+ 1 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/common/config/datasource/SlaveDataSourceConfig.java

@@ -51,7 +51,7 @@ public class SlaveDataSourceConfig {
     @Bean
     public PaginationInterceptor paginationInterceptor() {
         PaginationInterceptor page = new PaginationInterceptor();
-        page.setDbType(DbType.ORACLE);
+        page.setDbType(DbType.POSTGRE_SQL);
         return page;
     }
 }

+ 0 - 1
gyee-sample-impala/src/main/java/com/gyee/impala/common/feign/RemoteServiceBuilder.java

@@ -38,7 +38,6 @@ public class RemoteServiceBuilder {
                 .retryer(new Retryer.Default(10000, 10000, 3))
                 .target(IShardingService.class, config.getAlertUrl());
     }
-
     @Bean
     public IHostService hostparam() {
         return Feign.builder()

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

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

+ 1 - 2
gyee-sample-impala/src/main/java/com/gyee/impala/schdule/TaskStatistic.java

@@ -5,7 +5,6 @@ import com.gyee.impala.model.master.Casefaultalg;
 import com.gyee.impala.service.master.CasefaultalgService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -24,7 +23,7 @@ public class TaskStatistic {
     /**
      * 统计算法准确率
      */
-    @Scheduled(initialDelay = 60 * 1000, fixedRate = 1 * 60 * 60 * 1000)
+    //@Scheduled(initialDelay = 60 * 1000, fixedRate = 1 * 60 * 60 * 1000)
     public void accuracyStatisticTask() {
         if (0 == InitialRunner.historyList.size())
             return;

+ 2 - 3
gyee-sample-impala/src/main/java/com/gyee/impala/schdule/TaskWeather.java

@@ -10,7 +10,6 @@ import com.gyee.impala.model.master.Weatherforecast;
 import com.gyee.impala.service.decision.WfNwpDataService;
 import com.gyee.impala.service.master.WeatherforecastService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -43,7 +42,7 @@ public class TaskWeather {
     }
 
 
-    @Scheduled(cron = "0 0 1 * * ?")
+    //@Scheduled(cron = "0 0 1 * * ?")
     public void weatherForecastTask(){
         MAP_STATION.forEach((k, v) -> {
             Weatherforecast forecast = forecastService.getOneMaxTimeByStation(v);
@@ -67,7 +66,7 @@ public class TaskWeather {
     /**
      * 天气样本库加入实际风速
      */
-    @Scheduled(cron = "0 15 1 * * ?")
+    //@Scheduled(cron = "0 15 1 * * ?")
     public void weatherAddActualspeedTask(){
         QueryWrapper<Weatherforecast> wrapper1 = new QueryWrapper<>();
         wrapper1.between("time",DateUtil.getPreviousDate(26),new Date());

+ 2 - 3
gyee-sample-impala/src/main/java/com/gyee/impala/schdule/TaskWindspeedForecast.java

@@ -11,7 +11,6 @@ import com.gyee.impala.service.master.IWindspeedforecastshorttermService;
 import com.gyee.impala.service.master.IWindspeedforecastspshorttermService;
 import lombok.SneakyThrows;
 import org.apache.kudu.client.KuduException;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -108,7 +107,7 @@ public class TaskWindspeedForecast {
     }
     
     @SneakyThrows
-    @Scheduled(cron = "0 25 2 * * ?")
+    //@Scheduled(cron = "0 25 2 * * ?")
     //短期
     public void shortTerm() {
         Calendar today = Calendar.getInstance();
@@ -344,7 +343,7 @@ public class TaskWindspeedForecast {
     }
 
     @SneakyThrows
-    @Scheduled(cron = "0 45 2 * * ?")
+    //@Scheduled(cron = "0 45 2 * * ?")
     //超短期
     public void specialShortTerm() {
 

+ 1 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/service/custom/diagnose/AutoCmdService.java

@@ -32,6 +32,7 @@ public class AutoCmdService {
         System.out.println(new Date() + "开始执行脚本...");
         Process p;
         String cmdPath = gyeeConfig.getDiagnosePath();
+        if(InitialRunner.historyModelMap.size()<1) return;
         try {
             Diagnosetrainhistory history = InitialRunner.historyModelMap.get(fi.getStationId() + "_" + fi.getModelId()).get(0);
             System.out.println("脚本调用成功: " + history.toString());

+ 35 - 28
gyee-sample-impala/src/main/java/com/gyee/impala/service/impl/master/WindspeedforecastshorttermServiceImpl.java

@@ -26,7 +26,7 @@ import java.util.stream.Collectors;
 
 /**
  * <p>
- *  服务实现类
+ * 服务实现类
  * </p>
  *
  * @author gfhd
@@ -42,6 +42,7 @@ public class WindspeedforecastshorttermServiceImpl extends ServiceImpl<Windspeed
     /**
      * 由于mybatis-plus存储的中文乱码
      * 采用原生写法
+     *
      * @param list
      * @return
      */
@@ -50,13 +51,13 @@ public class WindspeedforecastshorttermServiceImpl extends ServiceImpl<Windspeed
         KuduTable kuduTable = kuduConfig.kuduClient.openTable("impala::gyee_sample_kudu.windspeedforecastshortterm");
         KuduSession kuduSession = kuduConfig.kuduSession();
         int i = 0;
-        for (Windspeedforecastshortterm boj : list){
+        for (Windspeedforecastshortterm boj : list) {
             Insert insert = kuduTable.newInsert();
             // 获取Row对象,设置插入的值
             PartialRow row = insert.getRow();
             row.addObject("id", SnowFlakeUtil.generateIdL());
-            long time = boj.getCalctime().getTime()+28800000;
-            row.addObject("calctime", time*1000);
+            long time = boj.getCalctime().getTime() + 28800000;
+            row.addObject("calctime", time * 1000);
             row.addObject("forecasttype", boj.getForecasttype());
             row.addObject("stationid", boj.getStationid());
             row.addObject("projectid", boj.getProjectid());
@@ -74,7 +75,7 @@ public class WindspeedforecastshorttermServiceImpl extends ServiceImpl<Windspeed
 
             // 先不提交kudu
             kuduSession.apply(insert);
-            i ++;
+            i++;
             if (i % kuduConfig.getCount() == 0)
                 kuduSession.flush(); //批量写入kudu
         }
@@ -94,16 +95,16 @@ public class WindspeedforecastshorttermServiceImpl extends ServiceImpl<Windspeed
 
     @Override
     public JSONObject getContrast(String stationid, Date starttime, Date endtime, int timescale) {
-        Date dateStartQntq = DateUtil.dateTimeAddYear(starttime,-1);
-        Date dateEndQntq = DateUtil.dateTimeAddYear(endtime,-1);
+        Date dateStartQntq = DateUtil.dateTimeAddYear(starttime, -1);
+        Date dateEndQntq = DateUtil.dateTimeAddYear(endtime, -1);
 
         //list1短期 list2超短期 list3去年同期短期 list4去年同期超短期
-        List<Windspeedforecastshortterm> list1 = getShortterm(stationid,starttime,endtime);
-        List<Windspeedforecastspshortterm> list2 = getSpShortterm(stationid,starttime,endtime,timescale);
-        List<Windspeedforecastshortterm> list3 = getShortterm(stationid,dateStartQntq,dateEndQntq);
-        List<Windspeedforecastspshortterm> list4 = getSpShortterm(stationid,dateStartQntq,dateEndQntq,timescale);
+        List<Windspeedforecastshortterm> list1 = getShortterm(stationid, starttime, endtime);
+        List<Windspeedforecastspshortterm> list2 = getSpShortterm(stationid, starttime, endtime, timescale);
+        List<Windspeedforecastshortterm> list3 = getShortterm(stationid, dateStartQntq, dateEndQntq);
+        List<Windspeedforecastspshortterm> list4 = getSpShortterm(stationid, dateStartQntq, dateEndQntq, timescale);
         List<WindspeedforecastContrast> windspeedforecastContrasts = new ArrayList<>();
-        list1.forEach(l->{
+        list1.forEach(l -> {
             WindspeedforecastContrast wsfcc = new WindspeedforecastContrast();
             wsfcc.setCalctime(l.getCalctime());
             wsfcc.setActualpower(l.getActualpower());
@@ -112,25 +113,31 @@ public class WindspeedforecastshorttermServiceImpl extends ServiceImpl<Windspeed
             wsfcc.setForecastwindspeed(l.getForecastwindspeed());
             windspeedforecastContrasts.add(wsfcc);
         });
-        Map<Date, WindspeedforecastContrast> contrastMap = windspeedforecastContrasts.stream().collect(Collectors.toMap(WindspeedforecastContrast::getCalctime, Function.identity(),(key1,key2)->key2));
+        Map<Date, WindspeedforecastContrast> contrastMap = windspeedforecastContrasts.stream().collect(Collectors.toMap(WindspeedforecastContrast::getCalctime, Function.identity(), (key1, key2) -> key2));
 
-        list2.forEach(l-> {
+        list2.forEach(l -> {
             WindspeedforecastContrast wsfcc = contrastMap.get(l.getCalctime());
-            wsfcc.setForecastpowersp(l.getForecastpower());
-            wsfcc.setForecastwindspeedsp(l.getForecastwindspeed());
+            if (wsfcc != null) {
+                wsfcc.setForecastpowersp(l.getForecastpower());
+                wsfcc.setForecastwindspeedsp(l.getForecastwindspeed());
+            }
         });
         //给年份加一年,然后匹配
-        list3.forEach(l-> {
-            WindspeedforecastContrast wsfcc = contrastMap.get(DateUtil.dateTimeAddYear(l.getCalctime(),1));
-            wsfcc.setActualpowertq(l.getActualpower());
-            wsfcc.setForecastpowertq(l.getForecastpower());
-            wsfcc.setActualwindspeedtq(l.getActualwindspeed());
-            wsfcc.setForecastwindspeedtq(l.getForecastwindspeed());
+        list3.forEach(l -> {
+            WindspeedforecastContrast wsfcc = contrastMap.get(DateUtil.dateTimeAddYear(l.getCalctime(), 1));
+            if (wsfcc != null) {
+                wsfcc.setActualpowertq(l.getActualpower());
+                wsfcc.setForecastpowertq(l.getForecastpower());
+                wsfcc.setActualwindspeedtq(l.getActualwindspeed());
+                wsfcc.setForecastwindspeedtq(l.getForecastwindspeed());
+            }
         });
-        list4.forEach(l-> {
-            WindspeedforecastContrast wsfcc = contrastMap.get(DateUtil.dateTimeAddYear(l.getCalctime(),1));
-            wsfcc.setForecastpowersptq(l.getForecastpower());
-            wsfcc.setForecastwindspeedsptq(l.getForecastwindspeed());
+        list4.forEach(l -> {
+            WindspeedforecastContrast wsfcc = contrastMap.get(DateUtil.dateTimeAddYear(l.getCalctime(), 1));
+            if (wsfcc != null) {
+                wsfcc.setForecastpowersptq(l.getForecastpower());
+                wsfcc.setForecastwindspeedsptq(l.getForecastwindspeed());
+            }
         });
 
         //根据时间排序
@@ -145,7 +152,7 @@ public class WindspeedforecastshorttermServiceImpl extends ServiceImpl<Windspeed
     private List<Windspeedforecastshortterm> getShortterm(String stationid, Date dateStart, Date dateEnd) {
         QueryWrapper<Windspeedforecastshortterm> wrapper = new QueryWrapper<>();
         wrapper.eq("stationid", stationid)
-                .eq("algorithmmodel","风电_极限学习机_功率_中国大陆")
+                .eq("algorithmmodel", "风电_极限学习机_功率_中国大陆")
                 .between("calctime", dateStart, dateEnd).orderByDesc("calctime");
         return baseMapper.selectList(wrapper);
     }
@@ -153,7 +160,7 @@ public class WindspeedforecastshorttermServiceImpl extends ServiceImpl<Windspeed
     /**
      * 超短期功率
      */
-    private List<Windspeedforecastspshortterm> getSpShortterm(String stationid, Date dateStart, Date dateEnd,int timescale) {
+    private List<Windspeedforecastspshortterm> getSpShortterm(String stationid, Date dateStart, Date dateEnd, int timescale) {
         QueryWrapper<Windspeedforecastspshortterm> wrapper = new QueryWrapper<>();
         wrapper.eq("stationid", stationid)
                 .between("calctime", dateStart, dateEnd)

+ 12 - 31
gyee-sample-impala/src/main/resources/application.yaml

@@ -1,17 +1,15 @@
 gyee:
   # golden实时适配器的url
-  golden-url: http://10.155.32.4:8011
+  golden-url: http://18.6.30.63:8011
   # 报警url
-  alert-url: http://192.168.1.14:8075
-  #alert-url: http://localhost:8075
-  host-url: http://10.155.32.14:8520
+  alert-url: http://18.6.30.53:8075
   # 样本数据统计开始时间
   init-time: 2022-01-01 00:00:00
   # 故障样本数据导入模板路径
   template-path-window: D://java//kudu//template/
   template-path-linux: /home/gyee/fault_digonsis/services/template/
   # kudu的host
-  kudu-host: 192.168.1.60
+  kudu-host: 18.6.30.73:21050
   # 故障诊断脚本路径
   diagnose-path-window: D://test//
   diagnose-path-linux: /home/gyee/fault_digonsis/scripts/
@@ -20,6 +18,7 @@ gyee:
   diagnose-file-linux: /home/gyee/fault_digonsis/data/
   # 报警规则是否加密
   rule-encryption: false
+  host-url: http://18.6.30.66:8520
 
 server:
   port: 9002
@@ -45,25 +44,13 @@ spring:
       #kudu数据库
       master:
         driver-class-name: com.cloudera.impala.jdbc41.Driver
-        jdbc-url: jdbc:impala://192.168.1.62:21050/gyee_sample_kudu
-      #三区oracle数据库
+        jdbc-url: jdbc:impala://18.6.30.71:21050/gyee_sample_kudu
+      #一区postgresql数据库
       slave:
-        jdbc-url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
-        username: nxfdprod
+        jdbc-url: jdbc:postgresql://18.6.30.71:5432/wisdom_cs
+        username: postgres
         password: gdnxfd123
-        driver-class-name: oracle.jdbc.OracleDriver
-      #网源oracle数据库 -- 数据采集
-      decision:
-        jdbc-url: jdbc:oracle:thin:@10.155.32.7:1521:ORCL
-        username: gyee
-        password: FRWIND
-        driver-class-name: oracle.jdbc.OracleDriver
-      #国电oracle数据库 -- oa
-      gdoa:
-        jdbc-url: jdbc:oracle:thin:@192.168.1.10:1521:ORCL
-        username: mis
-        password: GDnxXNY_2020#!
-        driver-class-name: oracle.jdbc.OracleDriver
+        driver-class-name: org.postgresql.Driver
       # 初始化大小,最小,最大
       initial-size: 1
       min-idle: 1
@@ -85,13 +72,13 @@ spring:
 ####################三区大数据服务器 SFTP  hive 配置####################
 hiveconfig:
   protocols: sftp
-  host: 192.168.1.60
+  host: 18.6.30.70
   port: 22
   username: root
   password: Admin@2019
   path: /home/gyee/kudu/dataprocess/
   driver: org.apache.hive.jdbc.HiveDriver
-  url: jdbc:hive2://192.168.1.60:10000/default
+  url: jdbc:hive2://18.6.30.70:10000/default
 ####################三区大数据服务器 SFTP EXEC 配置####################
 
 
@@ -99,7 +86,6 @@ hiveconfig:
 mybatis-plus:
   configuration:
     map-underscore-to-camel-case: true # 数据库下划线自动转驼峰标示关闭
-    # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 ####################Mybatis Plus配置####################
 
 
@@ -110,9 +96,4 @@ logging:
     root: info
     com.example: debug
   file:
-    path: ./logs
-
-
-## 故障诊断部署  运行  source activate tensorflow-gpu   ##
-## java -jar -Xms512m -Xmx1024m -XX:PermSize=256M -XX:MaxPerSize=512M  /home/gyee/fault_digonsis/services/diagnose-kudu/gyee-sample-impala-0.0.1-SNAPSHOT.jar ##
-
+    path: ./logs

+ 1 - 1
pom.xml

@@ -23,7 +23,7 @@
         <module>benchmarking-impala</module>
         <module>consumer</module>
         <module>gyee-sample-impala</module>
-        <module>power-fetting</module>
+        <module>power-fitting</module>
     </modules>
 
 

+ 0 - 26
power-fetting/src/main/java/com/gyee/power/fetting/BootApplication.java

@@ -1,26 +0,0 @@
-package com.gyee.power.fetting;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.cache.annotation.EnableCaching;
-import org.springframework.scheduling.annotation.EnableAsync;
-import org.springframework.scheduling.annotation.EnableScheduling;
-
-
-/**
- * 使用exclude = {DataSourceAutoConfiguration.class}
- * 禁用springboot默认加载的application.properties单数据源配置
- * 关闭springBoot关于mybatisPlus的一些自动注入
- */
-@EnableAsync
-@EnableCaching
-@EnableScheduling
-@SpringBootApplication
-public class BootApplication {
-
-    public static void main(String[] args) {
-        SpringApplication.run(BootApplication.class, args);
-    }
-
-}

+ 0 - 16
power-fetting/src/main/java/com/gyee/power/fetting/common/config/GyeeConfig.java

@@ -1,16 +0,0 @@
-package com.gyee.power.fetting.common.config;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-@Data
-@Component
-@ConfigurationProperties(prefix = "gyee")
-public class GyeeConfig {
-
-    /**数据适配器网址 **/
-    private String adapterUrl;
-
-
-}

+ 0 - 24
power-fetting/src/main/java/com/gyee/power/fetting/common/feign/IAdapterService.java

@@ -1,24 +0,0 @@
-package com.gyee.power.fetting.common.feign;
-
-import com.alibaba.fastjson.JSONObject;
-import com.gyee.power.fetting.model.custom.TsDoubleData;
-import feign.Headers;
-import feign.Param;
-import feign.RequestLine;
-
-import java.util.List;
-
-
-public interface IAdapterService {
-
-
-    @Headers({"Content-Type: application/json", "Accept: application/json"})
-    @RequestLine("GET /ts/latest?keys={points}")
-    JSONObject getLatest(@Param(value = "points") String points);
-
-
-    @Headers({"Content-Type: application/json", "Accept: application/json"})
-    @RequestLine("GET /ts/history/snap?tagName={tagName}&startTs={startTs}&endTs={endTs}&interval={interval}")
-    List<TsDoubleData> getHistorySnapAI(@Param(value = "tagName") String tagName, @Param(value = "startTs") long startTs,
-                                        @Param(value = "endTs") long endTs, @Param(value = "interval") Integer interval);
-}

+ 0 - 152
power-fetting/src/main/java/com/gyee/power/fetting/common/spring/InitialRunner.java

@@ -1,152 +0,0 @@
-package com.gyee.power.fetting.common.spring;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.CommandLineRunner;
-import org.springframework.core.annotation.Order;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * 服务启动前执行,进行全局变量初始化
- */
-@Component
-@Order(2)
-public class InitialRunner implements CommandLineRunner {
-
-//    @Resource
-//    private WindturbineService windturbineService;
-//    @Resource
-//    private WindpowerstationService windpowerstationService;
-//    @Autowired
-//    private KnowcategoryService faulttypeService;
-//    @Autowired
-//    private EquipmentmodelService modelService;
-//    @Autowired
-//    private DiagnosepointService diagnosepointService;
-//    @Autowired
-//    private DiagnosetrainhistoryService diagnosetrainhistoryService;
-//
-//    /**场站所有信息**/
-//    public static List<Windpowerstation> wpList = new ArrayList<>();
-//    /**场站的风机**/
-//    public static Map<String, List<Windturbine>> wpMap = new HashMap<>();
-//    /** <MHS_FDC, 麻黄山风电场> **/
-//    public static Map<String, String> stationMap = new HashMap<>();
-//    /** <麻黄山风电场, MHS_FDC> **/
-//    public static Map<String, String> stationenMap = new HashMap<>();
-//    /**所有的风机**/
-//    public static List<Windturbine> wtList = new ArrayList<>();
-//    /** <NG01_01, Windturbine> **/
-//    public static Map<String, Windturbine> wtMap = new HashMap<>();
-//    /**功率曲线预处理数据表格数据 key:time+wtId  value:当前风机的总条数 **/
-//    public static Map<String, Integer> scatterMap = new HashMap<>();
-//    /***故障  <FDJ,发电机故障>  类型*/
-//    public static Map<String, String> faultTypeMap = new HashMap<>();
-//    public static List<Knowcategory> faultTypeList = new ArrayList<>();
-//    /***scada预警  <FDJ,发电机>  类型*/
-//    public static Map<String, String> scadaWarnMap = new HashMap<>();
-//    public static List<Knowcategory> scadaWarnList = new ArrayList<>();
-//    /***自定义预警  <FDJ,发电机>  类型*/
-//    public static Map<String, String> customWarnMap = new HashMap<>();
-//    public static List<Knowcategory> customWarnList = new ArrayList<>();
-//    /** 设备型号配置 <UP82, Equipmentmodel> **/
-//    public static Map<String, Equipmentmodel> modelMap = new HashMap<>();
-//    /** 故障诊断 训练需要的测点 <NSS_FDC, UP82, Diagnosepoint></> **/
-//    public static Map<String, Map<String, List<Diagnosepoint>>> mapPoint = new HashMap<>();
-//
-//    /*** 故障训练历史模型 */
-//    public static Map<String, List<Diagnosetrainhistory>> historyModelMap = new HashMap<>();
-//    public static List<Diagnosetrainhistory> historyList = new ArrayList<>();
-
-
-
-    @Override
-    public void run(String... args){
-        System.out.println(">>>>>>>>>>>>>>>服务启动,正在缓存数据<<<<<<<<<<<<<<");
-
-//        cacheStation();
-//        cacheKnowCategory();
-//        cacheEquipmentModel();
-//        cacheDiagnosePoint();
-//        cacheHistory();
-
-        System.out.println(">>>>>>>>>>>>>>>数据缓存完成<<<<<<<<<<<<<<");
-    }
-
-    /**
-     * 缓存场站数据
-     * 数据新增或删除后需要更新,故每次清空
-     */
-//    public void cacheStation(){
-//        wpList.clear();
-//        wtList.clear();
-//        stationMap.clear();
-//        stationenMap.clear();
-//        wpMap.clear();
-//        wtMap.clear();
-//
-//        List<Windpowerstation> stations = windpowerstationService.getAll();
-//        wpList = stations;
-//        stations.stream().forEach(obj -> {
-//            List<Windturbine> wts = windturbineService.getWindTurbineId(obj.getId());
-//            stationMap.put(obj.getId(), obj.getName());
-//            stationenMap.put(obj.getName(), obj.getId());
-//            wpMap.put(obj.getId(), wts);
-//            wtList.addAll(wts);
-//            wts.stream().forEach(o -> wtMap.put(o.getId(), o));
-//        });
-//    }
-//
-//    /**
-//     * 缓存故障知识数据
-//     */
-//    public void cacheKnowCategory() {
-//        faultTypeList.clear();
-//        scadaWarnList.clear();
-//        customWarnList.clear();
-//        faultTypeMap.clear();
-//        scadaWarnMap.clear();
-//        customWarnMap.clear();
-//
-//        List<Knowcategory> faultType = faulttypeService.getAll();
-//        faultType.stream().forEach(obj -> {
-//            if (obj.getCategory().equals("GZ")) {
-//                faultTypeList.add(obj);
-//                faultTypeMap.put(obj.getCode().toUpperCase(), obj.getName());
-//            }
-//            else if (obj.getCategory().equals("SCADABJ")) {
-//                scadaWarnList.add(obj);
-//                scadaWarnMap.put(obj.getCode().toUpperCase(), obj.getName());
-//            }
-//            else if (obj.getCategory().equals("CUSTOMBJ")) {
-//                customWarnList.add(obj);
-//                customWarnMap.put(obj.getCode().toUpperCase(), obj.getName());
-//            }
-//        });
-//    }
-//
-//    public void cacheEquipmentModel() {
-//        modelMap.clear();
-//        List<Equipmentmodel> models = modelService.getAll();
-//        models.stream().forEach(obj -> modelMap.put(obj.getId(), obj));
-//    }
-//
-//    public void cacheDiagnosePoint(){
-//        mapPoint.clear();
-//        List<Diagnosepoint> points = diagnosepointService.getDiagnosepointList();
-//        mapPoint = points.stream().collect(Collectors.groupingBy(Diagnosepoint::getStationen, Collectors.groupingBy(Diagnosepoint::getModel)));
-//    }
-//
-//    public void cacheHistory(){
-//        historyModelMap.clear();
-//        historyList.clear();
-//        historyList = diagnosetrainhistoryService.getListAll();
-//        historyModelMap = historyList.stream().filter(h -> h.isEnable()).collect(Collectors.groupingBy(Diagnosetrainhistory::getModel));
-//    }
-}

+ 45 - 11
power-fetting/pom.xml

@@ -9,7 +9,7 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
-    <artifactId>power-fetting</artifactId>
+    <artifactId>power-fitting</artifactId>
 
     <properties>
         <maven.compiler.source>8</maven.compiler.source>
@@ -19,26 +19,54 @@
     <dependencies>
         <dependency>
             <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
+            <artifactId>spring-boot-starter-websocket</artifactId>
         </dependency>
 
-        <!-- 模板引擎 -->
         <dependency>
-            <groupId>org.apache.velocity</groupId>
-            <artifactId>velocity-engine-core</artifactId>
-            <version>2.0</version>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.2.11</version>
         </dependency>
 
         <dependency>
             <groupId>com.alibaba</groupId>
-            <artifactId>druid-spring-boot-starter</artifactId>
-            <version>1.2.11</version>
+            <artifactId>easyexcel</artifactId>
+            <version>3.1.1</version>
         </dependency>
 
+        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+            <version>2.7.4</version>
+        </dependency>
+
+
+        <!--        <dependency>-->
+<!--            <groupId>com.oracle</groupId>-->
+<!--            <artifactId>ojdbc6</artifactId>-->
+<!--            <version>11.2.0.3</version>-->
+<!--        </dependency>-->
+
+        <!--oracle驱动-->
+        <!-- https://mvnrepository.com/artifact/com.oracle.database.jdbc/ojdbc8 -->
         <dependency>
-            <groupId>com.oracle</groupId>
-            <artifactId>ojdbc6</artifactId>
-            <version>11.2.0.3</version>
+            <groupId>com.oracle.database.jdbc</groupId>
+            <artifactId>ojdbc8</artifactId>
+            <version>19.7.0.0</version>
+        </dependency>
+
+        <!-- oracle字符集  https://mvnrepository.com/artifact/cn.easyproject/orai18n -->
+        <dependency>
+            <groupId>cn.easyproject</groupId>
+            <artifactId>orai18n</artifactId>
+            <version>12.1.0.2.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.xerial</groupId>
+            <artifactId>sqlite-jdbc</artifactId>
+            <version>3.36.0.3</version>
         </dependency>
 
         <!--mybatis依赖-->
@@ -65,6 +93,12 @@
             <optional>true</optional>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-math3</artifactId>
+            <version>3.6.1</version>
+        </dependency>
+
 
         <!--http请求-->
         <dependency>

+ 11 - 11
power-fetting/src/main/java/com/gyee/power/fetting/MapperGenerator.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting;
+package com.gyee.power.fitting;
 
 import com.baomidou.mybatisplus.annotation.DbType;
 import com.baomidou.mybatisplus.generator.AutoGenerator;
@@ -23,30 +23,30 @@ public class MapperGenerator {
     private static String canonicalPath = "";
 
     //基本包名
-    private static String basePackage = "com.gyee.impala";
+    private static String basePackage = "com.gyee.power.fetting";
     //作者
     private static String authorName = "chenmh";
     //要生成的表名
-    private static String[] tables = {"",};
+    private static String[] tables = {"WINDPOWERSTATION"};
     //table前缀
     private static String prefix = "";
 
     //数据库类型
-    private static DbType dbType = DbType.ORACLE;
+    private static DbType dbType = DbType.SQLITE;
     //数据库配置四要素
 //    private static String driverName = "com.mysql.cj.jdbc.Driver";
 //    private static String url = "jdbc:mysql://localhost:3306/gyee_sample_kudu?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=UTC";
 //    private static String username = "root";
 //    private static String password = "";
 
-    private static String driverName = "oracle.jdbc.driver.OracleDriver";
-//    private static String url = "jdbc:oracle:thin:@192.168.1.10:1521:ORCL";
-//    private static String username = "mis";
-//    private static String password = "GDnxXNY_2020#!";
+    private static String driverName = "org.sqlite.JDBC";
+    private static String url = "jdbc:sqlite::resource:DataMiningTools.db";
+    private static String username = null;
+    private static String password = null;
 
-    private static String url = "jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd";
-    private static String username = "nxfdprod";
-    private static String password = "gdnxfd123";
+//    private static String url = "jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd";
+//    private static String username = "nxfdprod";
+//    private static String password = "gdnxfd123";
 
 
     public static void main(String[] args) {

+ 49 - 0
power-fitting/src/main/java/com/gyee/power/fitting/PowerBootApplication.java

@@ -0,0 +1,49 @@
+package com.gyee.power.fitting;
+
+import com.gyee.power.fitting.common.config.GyeeConfig;
+import com.gyee.power.fitting.common.spring.SpringContextUtil;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+import java.io.File;
+
+
+/**
+ * 使用exclude = {DataSourceAutoConfiguration.class}
+ * 禁用springboot默认加载的application.properties单数据源配置
+ * 关闭springBoot关于mybatisPlus的一些自动注入
+ */
+@EnableAsync
+@EnableCaching
+@EnableScheduling
+@SpringBootApplication
+@MapperScan("com.gyee.power.fitting.mapper")
+public class PowerBootApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(PowerBootApplication.class, args);
+
+        createFile();
+    }
+
+    private static void createFile(){
+        GyeeConfig bean = SpringContextUtil.getBean(GyeeConfig.class);
+        File f1 = new File(bean.getFilePathPrepare());
+        File f2 = new File(bean.getFilePathProcess());
+        File f3 = new File(bean.getFilePathFitting());
+        File f4 = new File(bean.getFilePathDownload());
+        if (!f1.exists())
+            f1.mkdirs();
+        if (!f2.exists())
+            f2.mkdirs();
+        if (!f3.exists())
+            f3.mkdirs();
+        if (!f4.exists())
+            f4.mkdirs();
+    }
+
+}

+ 9 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/CurveFitting.java

@@ -0,0 +1,9 @@
+package com.gyee.power.fitting.common.alg;
+
+import java.util.List;
+
+public interface CurveFitting {
+    Object run(List<Object> params);
+    List<Object> getParams(); 
+    void printResult(Object result,double accuracy);
+}

+ 39 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/DBSCANPointALG.java

@@ -0,0 +1,39 @@
+package com.gyee.power.fitting.common.alg;
+
+import com.gyee.power.fitting.model.custom.PowerPointData;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 散点聚合
+ */
+public class DBSCANPointALG {
+
+    /**
+     * 功率曲线拟合 散点聚合
+     * @param points  散点list
+     * @param param   聚合参数  10
+     * @return
+     */
+    public static  Map<String, List<PowerPointData>> dbscan(List<PowerPointData> points, double param){
+        Map<String, List<PowerPointData>> map = new HashMap<>();
+
+        for (PowerPointData item : points){
+            double x = item.getSpeed() * param;
+            double y = item.getPower() / param;
+
+            String key = Math.round(x) +  String.valueOf(Math.round(y));
+
+            if (!map.containsKey(key)){
+                map.put(key, new ArrayList<>());
+            }
+            map.get(key).add(item);
+        }
+
+        return map;
+    }
+
+}

+ 446 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/MpptFittingAlg.java

@@ -0,0 +1,446 @@
+package com.gyee.power.fitting.common.alg;
+
+import java.util.List;
+
+import com.gyee.power.fitting.model.custom.PointVo;
+
+import java.util.ArrayList;
+
+import org.apache.commons.math3.fitting.PolynomialCurveFitter;
+import org.apache.commons.math3.fitting.WeightedObservedPoints;
+
+
+/**
+ * I-V曲线拟合算法
+ * 最小二乘法
+ */
+public class MpptFittingAlg {
+
+
+    public static List<PointVo> BuildLine_IV_LSC(double[] arrX, double[] arrY, int length, int dimension, double scale){
+
+        List<PointVo> points = new ArrayList<>();
+
+        if(arrX.length != arrY.length || arrX.length < 3){
+            return points;
+        }
+
+        double minValue = arrY[arrY.length - 1];
+        double maxValue = arrY[0];
+
+        double min = 0;
+        double max = 0;
+
+        double[] coefficient = MultiLine(arrX, arrY, length, dimension);
+
+        for (double i = arrX[arrX.length - 1]; i > arrX[0]; i -= scale) {
+            PointVo point = new PointVo();
+            point.setX(i);
+
+            for (int j = 0; j < coefficient.length; j++) {
+                if (j == 0) {
+                    point.setY(coefficient[j] * Math.pow(point.getX(), j));
+                } else {
+                    double temp = coefficient[j] *Math.pow(point.getX(), j);
+                    point.setY(point.getY() + temp);
+                }
+            }
+
+            if (point.getY() < minValue) {
+                point.setY(minValue);
+
+
+            }
+            if (point.getY() > maxValue) {
+                point.setY(maxValue);
+
+            }
+
+            if (point.getY() < min) {
+                min = point.getY();
+            }
+            if (point.getY() > max) {
+                max = point.getY();
+            }
+
+            points.add(point);
+        }
+        Builder(points, min, max);
+        System.out.print("X轴数据\n");
+        int len = points.size();
+        double[] aX = new double[len];
+        for (int i = len-1; i >0; i --){
+            aX[i] = points.get(i).getX();
+            System.out.print(aX[i]+",");
+            System.out.print("\n");
+        }
+        System.out.print("\n");
+        System.out.print("Y轴数据\n");
+
+        double[] aY = new double[len];
+        for(int i = len-1;i >0; i--){
+            aY[i] = points.get(i).getY();
+            System.out.print(aY[i]+",");
+            System.out.print("\n");
+        }
+
+        return points;
+    }
+    /**
+     * P-V曲线拟合算法
+     * 最小二乘法
+     */
+    public static List<PointVo> BuildLine_PV_LSC(double[] arrX, double[] arrY, int length, int dimension, double scale){
+
+        List<PointVo> points = new ArrayList<>();
+
+        if(arrX.length != arrY.length || arrX.length < 3){
+            return points;
+        }
+
+        double minValue = arrY[0];
+        double maxValue = 0;
+        for(int i = 0 ;i < arrY.length; i++){
+            double val = arrY[i];
+            if(val > maxValue){
+                maxValue = val;
+            }
+        }
+
+        double min = 0;
+        double max = 0;
+
+        double[] coefficient = MultiLine(arrX, arrY, length, dimension);
+
+        for (double i = arrX[arrX.length - 1]; i > arrX[0]; i -= scale) {
+            PointVo point = new PointVo();
+            point.setX(i);
+
+            for (int j = 0; j < coefficient.length; j++) {
+                if (j == 0) {
+                    point.setY(coefficient[j] * Math.pow(point.getX(), j));
+                } else {
+                    double temp = coefficient[j] *Math.pow(point.getX(), j);
+                    point.setY(point.getY() + temp);
+                }
+            }
+
+            if (point.getY() < minValue) {
+                point.setY(minValue);
+
+
+            }
+            if (point.getY() > maxValue) {
+                point.setY(maxValue);
+
+            }
+
+            if (point.getY() < min) {
+                min = point.getY();
+            }
+            if (point.getY() > max) {
+                max = point.getY();
+            }
+
+            points.add(point);
+        }
+        Builder(points, min, max);
+        System.out.print("X轴数据\n");
+        int len = points.size();
+        double[] aX = new double[len];
+        for (int i = len-1; i >0; i --){
+            aX[i] = points.get(i).getX();
+            System.out.print(aX[i]+",");
+            System.out.print("\n");
+        }
+        System.out.print("\n");
+        System.out.print("Y轴数据\n");
+
+        double[] aY = new double[len];
+        for (int i = len-1;i >0; i--){
+            aY[i] = points.get(i).getY();
+            System.out.print(aY[i]+",");
+            System.out.print("\n");
+        }
+
+        return points;
+    }
+
+    private static void Builder(List<PointVo> points, double min, double max) {
+        boolean b = false;
+        for (int i = 0; i < points.size(); i++) {
+            if (b) {
+                points.get(i).setY(max);
+            } else {
+                if (max == points.get(i).getY()) {
+                    b = true;
+                }
+            }
+
+        }
+        for (int i = points.size() - 1; i > -1; i--) {
+            if (!b) {
+                points.get(i).setY(min);
+            } else {
+                if (min == points.get(i).getY()) {
+                    b = false;
+                }
+            }
+        }
+    }
+
+    private static double[] MultiLine(double[] arrX, double[] arrY, int length,int dimension)
+    {
+        int n = dimension + 1;                  //dimension次方程需要求 dimension+1个 系数
+        double[][] Guass = new double[n][n + 1];      //高斯矩阵 例如:y=a0+a1*x+a2*x*x
+        for (int i = 0; i < n; i++) {
+            int j;
+            for (j = 0; j < n; j++) {
+                Guass[i][j] = SumArr(arrX, j + i, length);
+            }
+            Guass[i][j] = SumArr(arrX, i, arrY, 1, length);
+        }
+        return ComputGauss(Guass, n);
+    }
+
+    private static double SumArr(double[] arr, int n, int length) //求数组的元素的n次方的和
+    {
+        double s = 0;
+        for (int i = 0; i < length; i++) {
+            if (arr[i] != 0 || n != 0)
+                s = s + Math.pow(arr[i], n);
+            else
+                s = s + 1;
+        }
+        return s;
+    }
+
+    private static double SumArr(double[] arr1, int n1, double[] arr2, int n2, int length) {
+        double s = 0;
+        for (int i = 0; i < length; i++) {
+            if ((arr1[i] != 0 || n1 != 0) && (arr2[i] != 0 || n2 != 0))
+                s = s + Math.pow(arr1[i], n1) * Math.pow(arr2[i], n2);
+            else
+                s = s + 1;
+        }
+        return s;
+
+    }
+
+    private static double[] ComputGauss(double[][] Guass, int n) {
+        int i, j;
+        int k, m;
+        double temp;
+        double max;
+        double s;
+        double[] x = new double[n];
+        for (i = 0; i < n; i++) x[i] = 0.0;//初始化
+
+        for (j = 0; j < n; j++) {
+            max = 0;
+            k = j;
+            for (i = j; i < n; i++) {
+                if (Math.abs(Guass[i][j]) > max) {
+                    max = Guass[i][j];
+                    k = i;
+                }
+            }
+
+
+            if (k != j) {
+                for (m = j; m < n + 1; m++) {
+                    temp = Guass[j][m];
+                    Guass[j][m] = Guass[k][m];
+                    Guass[k][m] = temp;
+                }
+            }
+            if (0 == max) {
+                // "此线性方程为奇异线性方程"
+                return x;
+            }
+
+            for (i = j + 1; i < n; i++) {
+                s = Guass[i][j];
+                for (m = j; m < n + 1; m++) {
+                    Guass[i][m] = Guass[i][m] - Guass[j][m] * s / (Guass[j][j]);
+                }
+            }
+
+        }//结束for (j=0;j<n;j++)
+
+        for (i = n - 1; i >= 0; i--) {
+            s = 0;
+            for (j = i + 1; j < n; j++) {
+                s = s + Guass[i][j] * x[j];
+            }
+            x[i] = (Guass[i][n] - s) / Guass[i][i];
+        }
+        return x;
+    }//返回值是函数的系数
+
+
+
+    /**
+     * P-V曲线拟合算法
+     * 多项式曲线拟合
+     * @param arrX --功率(P)值
+     * @param arrY  --电流(I)值
+     * @param order 进行拟合的阶数
+     */
+
+    public static List<PointVo> BuildLine_PV_Poly(double[] arrX, double[] arrY, int order) {
+
+        double[] aX = new double[10];
+
+        double maxValue = 0;
+        for(int i = 0 ;i < arrX.length; i++){
+            double val = arrX[i];
+            if(val > maxValue){
+                maxValue = val;
+            }
+        }
+        double scale = 0.1;
+        int ylen = (int)(maxValue/scale);
+
+        double[] aY = new double[ylen];
+        for(int i = 0; i< arrX.length; i++){
+            aX[i] = arrX[i];
+        }
+        PointVo point = new PointVo();
+        List<PointVo> points = new ArrayList<>();
+
+        // N阶多项式会有N+1个系数,其中之一为常数项
+        double[] factor = new double[order + 1];
+        for(int index = 0; index < factor.length; index++) {
+            factor[index] = index + 1;
+        }
+        for(int index = 0; index < arrY.length; index++) {
+            arrX[index] = index * 0.00001;
+            arrY[index] = calcPoly(arrX[index], factor); // y = sum(x[n) * fact[n])
+
+        }
+
+        //调用将arrX和arrY序列中的数据逐个添加到观察点序列对象中
+        WeightedObservedPoints point1 = new WeightedObservedPoints();
+        for(int index = 0; index < arrX.length; index++) {
+            point1.add(arrX[index], arrY[index]);
+        }
+       // 创建PolynomialCurveFitter对象,需指定拟合多项式的阶数
+        PolynomialCurveFitter fitter = PolynomialCurveFitter.create(order);
+
+        List<Object> params = new ArrayList<Object>();
+        params.add(point1);
+       // 调用PolynomialCurveFitter的fit方法进行多项式曲线拟合
+        WeightedObservedPoints point2 = (WeightedObservedPoints)params.get(0);
+     //   拟合结果通过一个double数组返回,按元素顺序依次是常数项、一次项、二次项、……。
+        double[] result = fitter.fit(point2.toList());//例如 3,4,2,6 y=3*x^3+4*x^2+2*x+6
+
+       // String y = printPoly(result);
+        int k = result.length - 1;
+        System.out.print("X轴数据\n");
+        for(int i = 0;i < aX.length; i++){
+            System.out.print(aX[i]+",");
+            System.out.print("\n");
+        }
+        System.out.print("Y轴数据\n");
+
+        int q = 0;
+
+        for (double i = aX[aX.length - 1]; i > aX[0]; i -= scale) {
+
+            for (int j = 0; j < result.length; j++) {
+                if (j == 0) {
+                    aY[q] = result[k];
+                } else {
+                    aY[q] += Math.pow(arrX[q], j) * result[k - j];
+                }
+            }
+            System.out.print(aY[q]+",");
+            System.out.print("\n");
+            q++;
+        }
+        return points;
+    }
+
+    /**
+     * P-V曲线拟合算法
+     * 多项式曲线拟合
+     *
+     * @param arrX --电压(V)值
+     * @param arrY  --电流(I)值
+     * @param order 进行拟合的阶数
+     */
+
+    public static List<PointVo> BuildLine_IV_Poly(double[] arrX, double[] arrY, int order) {
+
+        PointVo point = new PointVo();
+        List<PointVo> points = new ArrayList<>();
+
+        // N阶多项式会有N+1个系数,其中之一为常数项
+        double[] factor = new double[order + 1];
+        for(int index = 0; index < factor.length; index++)
+        {
+            factor[index] = index + 1;
+        }
+        for(int index = 0; index < arrY.length; index++)
+        {
+            arrX[index] = index * 0.00001;
+            arrY[index] = calcPoly(arrX[index], factor); // y = sum(x[n) * fact[n])
+        }
+        //调用将arrX和arrY序列中的数据逐个添加到观察点序列对象中
+        WeightedObservedPoints point1 = new WeightedObservedPoints();
+        for(int index = 0; index < arrX.length; index++)
+        {
+            point1.add(arrX[index], arrY[index]);
+        }
+        // 创建PolynomialCurveFitter对象,需指定拟合多项式的阶数
+        PolynomialCurveFitter fitter = PolynomialCurveFitter.create(order);
+
+        List<Object> params = new ArrayList<Object>();
+        params.add(point1);
+        // 调用PolynomialCurveFitter的fit方法进行多项式曲线拟合
+        WeightedObservedPoints point2 = (WeightedObservedPoints)params.get(0);
+        //   拟合结果通过一个double数组返回,按元素顺序依次是常数项、一次项、二次项、……。
+        double[] result = fitter.fit(point2.toList());//例如 3,4,2,6 y=3*x^3+4*x^2+2*x+6
+
+        int k = result.length - 1;
+        for (int i = 0 ; i <= arrX[arrX.length - 1]; i++) {
+            for (int j = 0; j < result.length; j++) {
+                if (j == 0) {
+                    arrY[i] = result[k];
+                    break;
+                }
+                arrY[i] += Math.pow(arrX[i], j) * result[k - j];
+            }
+            point.setX(arrX[i]);
+            point.setX(arrY[i]);
+            points.add(point);
+        }
+
+        return points;
+    }
+
+    public static double calcPoly(double x, double[] factor)
+    {
+        double y = 0;
+        for(int deg = 0; deg < factor.length; deg++)
+        {
+            y += Math.pow(x, deg) * factor[deg];
+        }
+        return y;
+    }
+    public static String printPoly(double[] result) {
+
+        String polynomialString = "";
+        for (int i = 0; i < result.length; i++) {
+            if (i == 0) {
+                polynomialString += result[i];
+                break;
+            }
+            polynomialString += result[i] + "x^" + i + " ";
+        }
+        return polynomialString;
+    }
+}
+
+

+ 180 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PolynomialCurveFitting.java

@@ -0,0 +1,180 @@
+package com.gyee.power.fitting.common.alg;
+
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.gyee.power.fitting.model.custom.TsDoubleData;
+import org.apache.commons.math3.fitting.PolynomialCurveFitter;
+import org.apache.commons.math3.fitting.WeightedObservedPoint;
+import org.apache.commons.math3.fitting.WeightedObservedPoints;
+
+import java.util.*;
+
+public class PolynomialCurveFitting implements CurveFitting {
+
+    private WeightedObservedPoints points = null;
+    private final int degree = 1; // 阶数
+
+    private double[] inputDataX = null;
+    private double[] inputDataY = null;
+
+    public void CalcCurveFitting() {
+        inputDataX = new double[17];
+        inputDataY = new double[17];
+        importdata_1("data1", inputDataX);
+        importdata_1("data2", inputDataY);
+        System.out.print("本算例用于计算多项式曲线拟合。已加载计算数据(" + inputDataX.length + "点, " + degree + "阶)... ...");
+        /*double[] factor = new double[degree + 1];
+        // N阶多项式会有N+1个系数,其中之一为常数项
+        for (int index = 0; index < factor.length; index++) {
+            factor[index] = index + 1;
+        }
+        for (int index = 0; index < inputDataY.length; index++) {
+            inputDataX[index] = index * 0.1;
+            inputDataY[index] = calcPoly(inputDataX[index], factor); // y = sum(x[n) * fact[n])
+            // System.out.print(inputDataY[index] + ", ");
+        }*/
+        points = new WeightedObservedPoints();
+        for (int index = 0; index < inputDataX.length; index++) {
+            points.add(inputDataX[index], inputDataY[index]);
+        }
+        System.out.println("初始化完成");
+    }
+
+    @Override
+    public Object run(List<Object> params) {
+        PolynomialCurveFitter fitter = PolynomialCurveFitter.create(degree);
+        WeightedObservedPoints points = (WeightedObservedPoints) params.get(0);
+        double[] result = fitter.fit(points.toList());
+        return result;
+    }
+
+    public double[] run(WeightedObservedPoints params) {
+        PolynomialCurveFitter fitter = PolynomialCurveFitter.create(degree);
+        double[] result = fitter.fit(params.toList());
+        return result;
+    }
+
+    @Override
+    public List<Object> getParams() {
+        CalcCurveFitting();
+        List<Object> params = new ArrayList<Object>();
+        params.add(points);
+        return params;
+    }
+
+    @Override
+    //例如 3,4,2,6 y=3*x^3+4*x^2+2*x+6
+    public void printResult(Object r,double accuracy) {
+        double[] result = (double[]) r;
+
+        List<Double> dataX = new ArrayList<>();
+        List<Double> dataY = new ArrayList<>();
+
+        for (double index = inputDataX[0]; index < inputDataX[inputDataX.length-1]; index+=accuracy) {
+            //int i = 0;
+            dataX.add(index);
+            dataY.add(calcPoly(index, result));
+            //i++;
+        }
+        System.out.print("\n\n\nX轴数据\n\n");
+        for (Double x : dataX) {
+            System.out.println(x+",");
+        }
+        System.out.print("\n\n\nY轴数据\n\n");
+        for (Double y : dataY) {
+            System.out.println(y+",");
+        }
+    }
+    public void printResultAll(List<TsDoubleData> x, double[] result,double accuracy) {
+
+        List<Double> dataX = new ArrayList<>();
+        List<Double> dataY = new ArrayList<>();
+
+        for (double index = x.get(0).getDoubleValue(); index < x.get(x.size()-1).getDoubleValue(); index+=accuracy) {
+            //int i = 0;
+            dataX.add(index);
+            dataY.add(calcPoly(index, result));
+            //i++;
+        }
+        System.out.print("\n\n\nX轴数据\n\n");
+        for (Double d : dataX) {
+            System.out.print(d+",");
+        }
+        System.out.print("\n\n\nY轴数据\n\n");
+        for (Double y : dataY) {
+            System.out.print(y+",");
+        }
+        System.out.println();
+    }
+
+    public String printResultY(List<TsDoubleData> x, double[] result) {
+        System.out.print("\n\n\nY轴数据\n\n");
+        String ss = "";
+        for (TsDoubleData v : x) {
+            double y = calcPoly(v.getDoubleValue(),result);
+            String s = y + ",";
+            ss += s;
+        }
+        return ss;
+    }
+
+    private double calcPoly(double x, double[] factor) {
+        double y = 0;
+        for (int deg = 0; deg < factor.length; deg++) {
+            y += Math.pow(x, deg) * factor[deg];
+        }
+        return y;
+    }
+
+    public double calcLow(Map<Double, Double> points, double[] factor) {
+        double sum = 0;
+        for (Map.Entry<Double, Double> dde : points.entrySet()) {
+            sum += dde.getValue() - calcPoly(dde.getKey(), factor);
+        }
+        return sum/points.size();
+    }
+
+    /**
+     * 从execl中导入数据
+     */
+    public static void importdata_1(String sheet, final double[] data)
+    {
+        int i=0;
+        List<Map<Integer,String>> list = new LinkedList<>(); //初始化列表
+
+        EasyExcel.read("D:/光伏经济运行/WTest0.xlsx") //文件路径
+                .sheet(sheet) //表单名
+                .registerReadListener(new AnalysisEventListener<Map<Integer,String>>() { //监听器,以行的形式读取Excel
+
+                    //一行一行读取Excel,在这里处理读取到的数据
+                    @Override
+                    public void invoke(Map<Integer, String> integerStringMap, AnalysisContext analysisContext) {
+                        // TODO Auto-generated method stub
+                        list.add(integerStringMap); //将读取到的每一行为一组存入列表中
+                    }
+
+                    //数据读取完毕后运行下面
+                    @Override
+                    public void doAfterAllAnalysed(AnalysisContext context) {
+                        System.out.println("数据读取完毕");
+                    }
+                }).headRowNumber(1).doRead(); //headRowNumber(num)为指定前num行为表头,从num+1开始读,默认为1
+
+        //遍历列表存储数据
+        for (Map<Integer, String> integerStringMap : list)
+        {
+            Set<Integer> keySet =integerStringMap.keySet();
+            Iterator<Integer> iterator = keySet.iterator();
+            while (iterator.hasNext())
+            {
+                Integer key = iterator.next();
+                Double val = Double.valueOf(integerStringMap.get(key));
+                System.out.print(val+",");
+                data[i++] = val;
+            }
+        }
+        System.out.println();
+        System.out.println(i+"条数据已导入");
+    }
+}

+ 443 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerFittingALG.java

@@ -0,0 +1,443 @@
+package com.gyee.power.fitting.common.alg;
+
+import com.gyee.power.fitting.model.custom.LineCurveFitting;
+import com.gyee.power.fitting.model.custom.Point;
+import com.gyee.power.fitting.model.custom.PointVo;
+import com.gyee.power.fitting.model.custom.PowerPointData;
+
+import java.text.DecimalFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 功率曲线拟合算法
+ * 最小二乘法
+ */
+public class PowerFittingALG {
+
+    /**
+     * 功率曲线拟合
+     *
+     * @param arrX        风速数组
+     * @param arrY        功率数据
+     * @param length      点个数
+     * @param dimension   维度
+     * @param scale       精度  0.1  0.01
+     * @return
+     */
+    public static List<Point> buildLine(double[] arrX, double[] arrY, int length, int dimension, double scale) {
+
+        List<Point> points = new ArrayList<>();
+
+        if (arrX.length != arrY.length || arrX.length < 3) {
+            return points;
+        }
+
+        double minValue = arrY[0];
+        double maxValue = arrY[arrY.length - 1];
+
+        double min = 0;
+        double max = 0;
+
+        double[] coefficient = MultiLine(arrX, arrY, length, dimension);
+
+        for (double i = arrX[0]; i <= arrX[arrX.length - 1]; i += scale) {
+            Point point = new Point();
+            point.setX(i);
+
+
+            for (int j = 0; j < coefficient.length; j++) {
+                if (j == 0) {
+                    point.setY(coefficient[j] * Math.pow(point.getX(), j));
+                } else {
+                    double temp = coefficient[j] * Math.pow(point.getX(), j);
+                    point.setY(point.getY() + temp);
+                }
+
+            }
+            if (point.getY() < minValue) {
+                point.setY(minValue);
+
+            }
+            if (point.getY() > maxValue) {
+                point.setY(maxValue);
+            }
+
+            if (point.getY() < min) {
+                min = point.getY();
+            }
+            if (point.getY() > max) {
+                max = point.getY();
+            }
+
+            points.add(point);
+        }
+        Builder(points, min, max);
+        return points;
+    }
+
+    private static void Builder(List<Point> points, double min, double max) {
+        boolean b = false;
+        for (int i = 0; i < points.size(); i++) {
+            if (b) {
+                points.get(i).setY(max);
+            } else {
+                if (max == points.get(i).getY()) {
+                    b = true;
+                }
+            }
+
+        }
+
+        for (int i = points.size() - 1; i > -1; i--) {
+            if (!b) {
+                points.get(i).setY(min);
+            } else {
+                if (min == points.get(i).getY()) {
+                    b = false;
+                }
+            }
+
+        }
+    }
+
+
+    ///<summary>
+    ///用最小二乘法拟合二元多次曲线
+    ///</summary>
+    ///<param name="arrX">已知点的x坐标集合</param>
+    ///<param name="arrY">已知点的y坐标集合</param>
+    ///<param name="length">已知点的个数</param>
+    ///<param name="dimension">方程的最高次数</param>
+    //二元多次线性方程拟合曲线
+    private static double[] MultiLine(double[] arrX, double[] arrY, int length, int dimension) {
+        int n = dimension + 1;                  //dimension次方程需要求 dimension+1个 系数
+        double[][] Guass = new double[n][n + 1];      //高斯矩阵 例如:y=a0+a1*x+a2*x*x
+        for (int i = 0; i < n; i++) {
+            int j;
+            for (j = 0; j < n; j++) {
+                Guass[i][j] = SumArr(arrX, j + i, length);
+            }
+            Guass[i][j] = SumArr(arrX, i, arrY, 1, length);
+        }
+        return ComputGauss(Guass, n);
+    }
+
+    //求数组的元素的n次方的和
+    private static double SumArr(double[] arr, int n, int length) {
+        double s = 0;
+        for (int i = 0; i < length; i++) {
+            if (arr[i] != 0 || n != 0)
+                s = s + Math.pow(arr[i], n);
+            else
+                s = s + 1;
+        }
+        return s;
+    }
+
+    private static double SumArr(double[] arr1, int n1, double[] arr2, int n2, int length) {
+        double s = 0;
+        for (int i = 0; i < length; i++) {
+            if ((arr1[i] != 0 || n1 != 0) && (arr2[i] != 0 || n2 != 0))
+                s = s + Math.pow(arr1[i], n1) * Math.pow(arr2[i], n2);
+            else
+                s = s + 1;
+        }
+        return s;
+
+    }
+
+    private static double[] ComputGauss(double[][] Guass, int n) {
+        int i, j;
+        int k, m;
+        double temp;
+        double max;
+        double s;
+        double[] x = new double[n];
+        for (i = 0; i < n; i++) x[i] = 0.0;//初始化
+
+        for (j = 0; j < n; j++) {
+            max = 0;
+            k = j;
+            for (i = j; i < n; i++) {
+                if (Math.abs(Guass[i][j]) > max) {
+                    max = Guass[i][j];
+                    k = i;
+                }
+            }
+
+
+            if (k != j) {
+                for (m = j; m < n + 1; m++) {
+                    temp = Guass[j][m];
+                    Guass[j][m] = Guass[k][m];
+                    Guass[k][m] = temp;
+                }
+            }
+            if (0 == max) {
+                // "此线性方程为奇异线性方程" 
+                return x;
+            }
+
+            for (i = j + 1; i < n; i++) {
+                s = Guass[i][j];
+                for (m = j; m < n + 1; m++) {
+                    Guass[i][m] = Guass[i][m] - Guass[j][m] * s / (Guass[j][j]);
+                }
+            }
+
+        }//结束for (j=0;j<n;j++)
+
+        for (i = n - 1; i >= 0; i--) {
+            s = 0;
+            for (j = i + 1; j < n; j++) {
+                s = s + Guass[i][j] * x[j];
+            }
+            x[i] = (Guass[i][n] - s) / Guass[i][i];
+        }
+        return x;
+    }//返回值是函数的系数
+
+
+    /**
+     * 推力系数 CP 值
+     * @param sweptarea  扫风面积
+     * @param line
+     * @return
+     */
+    public static LineCurveFitting buildCp(Double sweptarea, LineCurveFitting line){
+        List<Point> cpValue = new ArrayList<>();
+
+        double kqmd = 1.225; //空气密度
+        double max = 0;
+        double cpAvg = 0;
+        double sum1 = 0;
+
+        for (int i = 0; i < line.getYLines().size(); i++)
+        {
+            Point point = line.getYLines().get(i);
+            double speed = point.getX();
+            double power = point.getY();
+            double k = 0.5 * kqmd * Math.pow(speed, 3) * sweptarea;
+            double result = 0;
+            if (k != 0)
+                result = power / k * 1000;
+            //s5.Points.AddXY(speed, result);
+            Point cppoint = new Point();
+            cppoint.setX(speed);
+            cppoint.setY(result);
+            cpValue.add(cppoint);
+
+            if (max < result)
+            {
+                max = result;
+            }
+
+            if (result > 0 && speed >= 3 && speed <= 25)
+            {
+                cpAvg += result;
+                sum1++;
+
+            }
+
+        }
+        if(sum1>0)
+            cpAvg /= sum1;
+
+        line.setCpValue(cpValue);
+        line.setCpAvg(cpAvg);
+
+        return line;
+    }
+
+
+    /**
+     * 静风频率计算
+     * @param list  风速数组
+     * @param speed 切入风速
+     * @return
+     */
+    public static double frequency(List<Double> list, double speed){
+        DecimalFormat df = new DecimalFormat("0.00");
+        int count = 0;
+        for (Double fs : list){
+            if (fs < speed)
+                count ++;
+        }
+        return list.size() > 0 ? Double.valueOf(df.format(((double)count / list.size() * 100 ))) : 0.0;
+    }
+
+
+    /**
+     * 曲线偏差率
+     * @param points1 风速功率数组
+     * @param points2
+     * @param maxp
+     * @return
+     */
+    public static double curveDeviationRatio(List<Point> points1, List<Point> points2, double maxp) {
+        double result = -0;
+        double pc = 0;
+        if (points1 != null && points1.size() > 0 && points2 != null && points2.size() > 0)
+        {
+            double count = 0;
+            double sum = 0;
+            for (Point point : points1){
+                Optional<Point> p = points2.stream().filter(it -> it.getX() == point.getX()).findFirst();
+                if (p.isPresent()){
+                    sum += Math.pow(point.getY() - p.get().getY(), 2);
+                    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;
+        }
+        return result;
+    }
+
+    /**
+     * 曲线偏差率  正负偏差
+     * @param points1 风速功率数组
+     * @param points2 风速功率数组(保证功率)
+     * @param maxp  区间内的最大保证功率
+     * @param mins 最小风速
+     * @param maxs 最大风速
+     * @return
+     */
+    public static double curveDeviationRatio2(List<Point> points1, List<Point> points2, double maxp, double mins, double maxs) {
+        double result = -0;
+        double pc = 0;
+        if (points1 != null && points1.size() > 0 && points2 != null && points2.size() > 0)
+        {
+            double count = 0;
+            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();
+                }
+            }
+            sum = Math.sqrt(sum);
+            count = Math.sqrt(count);
+            maxp = maxp * count;
+            if (maxp != 0)
+                result = sum / maxp * 100;
+            if (pc < 0)
+                result = 0 - result;
+        }
+        return result;
+    }
+
+
+    /**
+     * 对风偏差散点过滤  统计-50 到 50的
+     *
+     * @param list
+     *
+     *
+     * @return
+     */
+    public static List<Point> windDeviationScatter(List<PowerPointData> list){
+        //正负偏差 [-50,-49,....,0,1,2,.....50]
+        List<Point> ls = new ArrayList<>();
+        LinkedHashSet<Double> keys = new LinkedHashSet<>();  //散点太多去重
+        //次数统计
+        for (int i = 0; i < list.size(); i++){
+            PowerPointData item = list.get(i);
+            int ele = (int)Math.round((item.getFx() + Math.abs(item.getDfwc())));
+            int index = ele - 180;
+            if (index >= -50 && index <= 50) {
+                double key = Math.abs(index) + item.getSpeed();
+                if (!keys.contains(key))
+                    ls.add(new Point(index, item.getSpeed()));
+                keys.add(key);
+            }
+        }
+
+        return ls;
+    }
+
+
+    /**
+     * 静态偏航对风分析
+     * 对风偏差散点过滤  统计-15 到 15的  正负偏差 [-15,-14,....,0,1,2,.....15]
+     * 数据为二维数组 内层数组为3项. 第一项表示Y轴索引(风速),  第二项代表X轴的索引(正负偏差) 第三项代表value值.
+     * @param points
+     * @return
+     */
+    public static List<Object> windDeviationPoint(List<PowerPointData> points){
+        List<PowerPointData> list = new ArrayList<>();
+        List<Object> result = new ArrayList<>();
+        Map<Integer, double[]> map = new LinkedHashMap<>();
+
+        //过滤对风偏差
+        for (int i = 0; i < points.size(); i++){
+            PowerPointData item = points.get(i);
+            if (item.getSpeed() < 4.5 || item.getSpeed() >= 10.5 && item.getMxzt() != 2)
+                continue;
+
+            list.add(item);
+            Integer speed = Math.toIntExact(Math.round(item.getSpeed()));
+            if (!map.containsKey(speed))
+                map.put(speed, new double[2]);  //[0]最小值 [1]最大值
+
+            double[] value = map.get(speed);
+            double power = item.getPower() < 0 ? 0 : item.getPower();
+            value[0] = power < value[0] ? power : value[0]; //最小值
+            value[1] = power > value[1] ? power : value[1]; //最大值
+        }
+
+        DecimalFormat sf = new DecimalFormat("0.00");
+        for (int i = 0; i < list.size(); i++){
+            PowerPointData item = list.get(i);
+            Integer speed = Math.toIntExact(Math.round(item.getSpeed()));
+            int ele = (int) (Math.abs(item.getFx()) + Math.abs(item.getAngle()));
+            int index = ele - 180;
+            if (index >= -30 && index <= 30 && item.getPower() > 0) {
+                double[] value = map.get(speed);
+                double v = (item.getPower() - value[0]) / (value[1] - value[0]);
+                double s[] = {speed, index, Double.valueOf(sf.format(v)).doubleValue()};
+                result.add(s);
+            }
+        }
+
+        return result;
+    }
+
+
+    /**
+     * 对风偏差频次统计  统计-50 到 50
+     * @param list
+     * @return
+     */
+    public static int[] windDeviationRatio(List<PowerPointData> list){
+        int[] pc = new int[101];  //正负偏差 [-50,-49,....,0,1,2,.....50]
+        //次数统计
+        for (int i = 0; i < list.size(); i++){
+            PowerPointData item = list.get(i);
+            int ele = (int) (Math.abs(item.getFx()) + Math.abs(item.getDfwc()));
+            int index = ele - 180;
+            if (index >= -50 && index <= 50)
+                pc[50-(index > 0 ? -index : Math.abs(index))]++;
+        }
+
+        return pc;
+    }
+
+
+    public static void main(String[] args){
+        double s =  4.53;
+        Integer speed = Math.toIntExact(Math.round(s));
+        System.out.println(speed);
+    }
+
+}
+

+ 356 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerProcessALG.java

@@ -0,0 +1,356 @@
+package com.gyee.power.fitting.common.alg;
+
+import com.gyee.power.fitting.common.util.DateUtil;
+import com.gyee.power.fitting.model.custom.PowerPointData;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 数据预处理算法
+ */
+public class PowerProcessALG {
+
+
+    /**
+     * 数据预处理
+     *
+     * @param list   预处理的数据
+     * @param map    风速对应的保证功率
+     * @param maxs   最大风速
+     * @param mins   最小风速
+     * @param maxp   最大功率
+     * @param minp   最小功率
+     * @param isfbw  是否并网
+     * @param isfhl  是否合理值
+     * @param isbw   并网后10分钟
+     * @param istj   停机前10分钟
+     * @param isglpc 功率曲线偏差
+     * @param isqfh  是否欠符合
+     * @param qfhdj  欠符合等级
+     * @return
+     */
+    public static List<PowerPointData> dataProcess(List<PowerPointData> list, Map<Double, Double> map,
+                                                   Double maxs, Double mins, Double maxp, Double minp, Boolean isfbw,
+                                                   Boolean isfhl, Boolean isbw, Boolean istj, Boolean isglpc, Boolean isqfh, Integer qfhdj){
+        String timeBW = DateUtil.format(new Date(0), DateUtil.DATE_TIME_PATTERN);
+        List<PowerPointData> tempei = new ArrayList<>();
+        List<PowerPointData> tempqf = new ArrayList<>();
+
+        //TODO 数据过滤  // 0正常,1过滤掉
+        for (PowerPointData item : list) {
+            int filter = 0;
+            int fjstatus = 0;
+            if (timeBW == DateUtil.format(new Date(0), DateUtil.DATE_TIME_PATTERN)){
+                timeBW = item.getTime();
+            }
+            // 过滤非并网值  风机状态不等于2
+            if (filter == 0 && isfbw && item.getMxzt() != 2) {
+                filter = 1;
+                fjstatus = 1;
+                timeBW = item.getTime();
+            } else {
+                filter = 0;
+                fjstatus = 0;
+            }
+            // 按给定风速功率过滤
+            if (item.getSpeed() < mins || item.getSpeed() > maxs || item.getPower() < minp || item.getPower() > maxp) {
+                filter = 1;
+            }
+            // 过滤非合理值 并网状态下功率小于等于0
+            if (filter == 0 && isfhl && item.getPower() <= 0) {
+                filter = 1;
+            }
+            // 过滤非合理值 并网状态下功率小于等于0
+            if (filter == 0 && isfhl && item.getSpeed() < 3 && item.getPower() != 0) {
+                filter = 1;
+            }
+            // 过滤并网后十分钟
+            if (filter == 0 && isbw) {
+                if (DateUtil.getTimeDiff(item.getTime(), timeBW) <= 10)
+                    filter = 1;
+            }
+            // 过滤停机前十分钟
+            if (istj) {
+                if (fjstatus == 0) {
+                    if (tempei.size() > 0) {
+                        if (DateUtil.getTimeDiff(tempei.get(0).getTime(), timeBW) >= 10) {
+                            tempei.remove(0);
+                        }
+                    }
+                    tempei.add(item);
+                } else {
+                    for (PowerPointData temp : tempei) {
+                        temp.setFilter(1);
+                    }
+                    tempei.clear();
+                }
+            }
+            //欠发
+            if (filter == 0 && item.getSpeed() >= 6 && item.getSpeed() < 12.5 && isqfh && qfhdj < item.getQfzt()) {
+                filter = 1;
+                for (PowerPointData temp : tempqf) {
+                    temp.setFilter(1);
+                }
+            } else if (filter == 0 && item.getSpeed() >= 12.5 && isqfh && qfhdj < 1) {
+                filter = 1;
+                for (PowerPointData temp : tempqf) {
+                    temp.setFilter(1);
+                }
+            }
+            if (tempqf.size() > 0) {
+                if (DateUtil.getTimeDiff(tempqf.get(0).getTime(), item.getTime()) >= 5) {
+                    tempqf.remove(0);
+                }
+            }
+            tempqf.add(0, item);
+            item.setFilter(filter);
+
+            //功率曲线偏差
+            if (isglpc) {
+                if (map.containsKey(item.getSpeed())) {
+                    double power = map.get(item.getSpeed());  //不同风速对应的保证功率
+                    double maxPower = map.get(24.0);     //最大保证功率
+                    double k = item.getPower() / power;  //保证功率/实际功率   k:偏差百分比
+                    if (item.getPower() > 0) {
+                        if (k < 0.95 && maxPower <= power) {
+                            item.setFilter(1);
+                        }
+                        if (k < 0.9 && maxPower > power) {
+                            item.setFilter(1);
+                        }
+                        if (k < 0.85 && item.getSpeed() < 6 && item.getSpeed() > 4) {
+                            item.setFilter(1);
+                        }
+
+                        if (k < 0.9 && item.getSpeed() <= 4 && item.getSpeed() > 3.5) {
+                            item.setFilter(1);
+                        }
+                        if (k < 0.85 && item.getSpeed() <= 3.5 && item.getSpeed() > 3) {
+                            item.setFilter(1);
+                        }
+                        if (k < 0.4 && item.getSpeed() <= 3 && item.getSpeed() > 0) {
+                            item.setFilter(1);
+                        }
+                    }
+                }
+            }
+        }
+
+        return list;
+    }
+
+
+    /**
+     * 按照给定风俗功率过滤
+     * @param list
+     * @param maxs  最大风速
+     * @param mins  最小风速
+     * @param maxp  最大功率
+     * @param minp  最小风速
+     * @return
+     */
+    public static List<PowerPointData> dataProcessPS(List<PowerPointData> list, Double maxs, Double mins, Double maxp, Double minp){
+        //TODO 数据过滤  // 0正常,1过滤掉
+        for (PowerPointData item : list) {
+            int filter = 0;
+            // 按给定风速功率过滤
+            if (item.getSpeed() < mins || item.getSpeed() > maxs || item.getPower() < minp || item.getPower() > maxp) {
+                filter = 1;
+            }
+
+            item.setFilter(filter);
+        }
+
+        return list;
+    }
+
+    /**
+     * 过滤非并网值
+     * @param list
+     * @return
+     */
+    public static List<PowerPointData> dataProcessFBW(List<PowerPointData> list){
+        //TODO 数据过滤  // 0正常,1过滤掉
+        for (PowerPointData item : list) {
+            int filter = 0;
+            // 过滤非并网值  风机状态不等于2
+            if (filter == 0 && item.getMxzt() != 2)
+                filter = 1;
+
+            item.setFilter(filter);
+        }
+
+        return list;
+    }
+
+
+    /**
+     * 过滤非合理值
+     * @param list
+     * @return
+     */
+    public static List<PowerPointData> dataProcessFHLZ(List<PowerPointData> list){
+        //TODO 数据过滤  // 0正常,1过滤掉
+        for (PowerPointData item : list) {
+            int filter = 0;
+            // 过滤非合理值 并网状态下功率小于等于0
+            if (filter == 0 && item.getMxzt() != 2 && item.getPower() <= 0) {
+                filter = 1;
+            }
+
+            item.setFilter(filter);
+        }
+
+        return list;
+    }
+
+    /**
+     * 过滤并网后几分钟内数据
+     * @param list
+     * @param minute  分钟
+     * @return
+     */
+    public static List<PowerPointData> dataProcessBWH(List<PowerPointData> list, int minute){
+        String timeBW = DateUtil.format(new Date(0), DateUtil.DATE_TIME_PATTERN);
+        //TODO 数据过滤  // 0正常,1过滤掉
+        for (PowerPointData item : list) {
+            int filter = 0;
+            if (timeBW == DateUtil.format(new Date(0), DateUtil.DATE_TIME_PATTERN)){
+                timeBW = item.getTime();
+            }
+            // 过滤并网后十分钟
+            if (filter == 0 && DateUtil.getTimeDiff(item.getTime(), timeBW) <= minute){
+                filter = 1;
+            }
+
+            item.setFilter(filter);
+        }
+
+        return list;
+    }
+
+
+    /**
+     * 过滤停机前几分钟内数据
+     * @param list
+     * @param minute  分钟
+     * @return
+     */
+    public static List<PowerPointData> dataProcessTJQ(List<PowerPointData> list, int minute){
+        String timeBW = DateUtil.format(new Date(0), DateUtil.DATE_TIME_PATTERN);
+        List<PowerPointData> tempei = new ArrayList<>();
+
+        //TODO 数据过滤  // 0正常,1过滤掉
+        for (PowerPointData item : list) {
+            int filter = 0;
+            int fjstatus = 0;
+            if (timeBW == DateUtil.format(new Date(0), DateUtil.DATE_TIME_PATTERN)){
+                timeBW = item.getTime();
+            }
+            if (filter == 0 && item.getMxzt() != 2) {
+                filter = 1;
+                fjstatus = 1;
+                timeBW = item.getTime();
+            } else {
+                filter = 0;
+                fjstatus = 0;
+            }
+            // 过滤停机前十分钟
+            if (fjstatus == 0) {
+                if (tempei.size() > 0) {
+                    if (DateUtil.getTimeDiff(tempei.get(0).getTime(), timeBW) >= minute) {
+                        tempei.remove(0);
+                    }
+                }
+                tempei.add(item);
+            } else {
+                for (PowerPointData temp : tempei) {
+                    temp.setFilter(1);
+                }
+                tempei.clear();
+            }
+
+            item.setFilter(filter);
+        }
+
+        return list;
+    }
+
+    /**
+     * 曲线偏差率过滤
+     * @param list
+     * @param map  风速对应的保证功率
+     * @return
+     */
+    public static List<PowerPointData> dataProcessQXPC(List<PowerPointData> list, Map<Double, Double> map){
+        //TODO 数据过滤  // 0正常,1过滤掉
+        for (PowerPointData item : list) {
+            if (map.containsKey(item.getSpeed())) {
+                double power = map.get(item.getSpeed());  //不同风速对应的保证功率
+                double maxPower = map.get(24.0);     //最大保证功率
+                double k = item.getPower() / power;  //保证功率/实际功率   k:偏差百分比
+                if (item.getPower() > 0) {
+                    if (k < 0.95 && maxPower <= power) {
+                        item.setFilter(1);
+                    }
+                    if (k < 0.9 && maxPower > power) {
+                        item.setFilter(1);
+                    }
+                    if (k < 0.85 && item.getSpeed() < 6 && item.getSpeed() > 4) {
+                        item.setFilter(1);
+                    }
+
+                    if (k < 0.9 && item.getSpeed() <= 4 && item.getSpeed() > 3.5) {
+                        item.setFilter(1);
+                    }
+                    if (k < 0.85 && item.getSpeed() <= 3.5 && item.getSpeed() > 3) {
+                        item.setFilter(1);
+                    }
+                    if (k < 0.4 && item.getSpeed() <= 3 && item.getSpeed() > 0) {
+                        item.setFilter(1);
+                    }
+                }
+            }
+        }
+
+        return list;
+    }
+
+    /**
+     * 根据欠发过滤
+     * @param list
+     * @param qfhdj 签发等级
+     * @return
+     */
+    public static List<PowerPointData> dataProcessQF(List<PowerPointData> list, int qfhdj){
+        List<PowerPointData> tempqf = new ArrayList<>();
+        //TODO 数据过滤  // 0正常,1过滤掉
+        for (PowerPointData item : list) {
+            int filter = 0;
+            //欠发
+            if (filter == 0 && item.getSpeed() >= 6 && item.getSpeed() < 12.5 && qfhdj < item.getQfzt()) {
+                filter = 1;
+                for (PowerPointData temp : tempqf) {
+                    temp.setFilter(1);
+                }
+            } else if (filter == 0 && item.getSpeed() >= 12.5 && qfhdj < 1) {
+                filter = 1;
+                for (PowerPointData temp : tempqf) {
+                    temp.setFilter(1);
+                }
+            }
+            if (tempqf.size() > 0) {
+                if (DateUtil.getTimeDiff(tempqf.get(0).getTime(), item.getTime()) >= 5) {
+                    tempqf.remove(0);
+                }
+            }
+            tempqf.add(0, item);
+            item.setFilter(filter);
+        }
+
+        return list;
+    }
+}

+ 78 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/PowerTemperatureAlg.java

@@ -0,0 +1,78 @@
+package com.gyee.power.fitting.common.alg;
+
+
+import com.gyee.power.fitting.model.custom.PowerPointData;
+
+import java.util.*;
+
+/**
+ * 温度功率算法
+ */
+public class PowerTemperatureAlg {
+
+
+    /**
+     * 风速大于12m时的平均额定功率与额定功率的差值
+     * @param points  测点数据
+     * @param power   该型号风机的额定功率
+     * @param minT    最小温度
+     * @param maxT    最大温度
+     * 统计跨度温度内是否欠满发   实发总功率/次数 - 理论功率
+     */
+    public static Map<String, Integer> temperatureRatedPower(List<PowerPointData> points, double power, double minT, double maxT){
+        Map<Integer, int[]> map = new TreeMap<>(); //[0]计数  [1]功率求和
+        int mint = (int) minT;
+        int maxt = (int) maxT;
+        int split = 5;  //温度间隔步调5°
+
+        points.stream().filter(f -> !(f.getSpeed() < 12.0 || f.getSpeed() > 25.0 || f.getMxzt() != 2))
+                .sorted(Comparator.comparing(PowerPointData::getHjwd)).forEach(item -> {
+            int T = (int) item.getHjwd();
+            if (!map.containsKey(T)) {
+                map.put(T, new int[2]);
+            }
+            int[] value = map.get(T);
+            value[0]++;
+            value[1] += item.getPower();
+        });
+
+        Map<String, Integer> result = new LinkedHashMap<>();
+        for (int i = mint; i <= maxt; i+=split){
+            int count = 0;
+            double totalPower = 0;
+            for (int j = 0; j < split; j++){
+                if (!map.containsKey(i + j))
+                    continue;
+                count += map.get(i + j)[0];
+                totalPower += map.get(i + j)[1];
+            }
+            result.put("(" + i + "," + (i + split) + "]", (int)(totalPower/count - power));
+        }
+
+        return result;
+    }
+
+
+    /**
+     * 额定功率vs.温度分析
+     * @param points  测点
+     * @return  风速大于12m/s满发状态时的
+     */
+    public static List<int[]> temperatureRatedPower(List<PowerPointData> points){
+        List<int[]> list = new ArrayList<>();
+        points.stream().filter(f -> f.getSpeed() >= 12.0 && f.getSpeed() <= 25.0 && f.getMxzt() == 2)
+                .sorted(Comparator.comparing(PowerPointData::getHjwd)).forEach(item -> {
+                    int t = (int) item.getHjwd();
+                    int v = (int) item.getPower();
+                    int[] temp = new int[]{t, v};
+                    list.add(temp);
+                });
+        return list;
+    }
+
+
+    public static void main(String[] args){
+        for (int i = -4; i <= 28; i+=5)
+            System.out.println(i);
+    }
+}

+ 22 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/TimeCostCalculator.java

@@ -0,0 +1,22 @@
+package com.gyee.power.fitting.common.alg;
+
+import java.util.List;
+
+public class TimeCostCalculator {
+    /**
+     * 计算指定对象的运行时间开销。
+     * @param testCase 指定被测对象。
+     * @return 返回sub.run的时间开销,单位为s。
+     */
+    public double calcTimeCost(CurveFitting testCase) {
+        List<Object> params = testCase.getParams();
+        long startTime = System.nanoTime();
+        //拟合结果通过一个double数组返回,按元素顺序依次是常数项、一次项、二次项、……。
+        Object result = testCase.run(params);
+        long stopTime = System.nanoTime();
+        testCase.printResult(result,0.5);
+        //System.out.println("start: " + startTime + " / stop: " + stopTime);
+        double timeCost = (stopTime - startTime) * 1.0e-9;
+        return timeCost;
+    }
+}

+ 158 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/alg/WindDirectionALG.java

@@ -0,0 +1,158 @@
+package com.gyee.power.fitting.common.alg;
+
+
+import com.gyee.power.fitting.model.custom.PowerPointData;
+
+import java.util.*;
+
+
+/**
+ * 风向玫瑰图
+ * 风向频次玫瑰图
+ */
+public class WindDirectionALG {
+
+    /**
+     * 风速风向玫瑰图
+     * 风速:[0,2.5) [2.5,5) [5,7.5) [7.5,10) [10,12.5) [12.5,15) [15,17.5) [17.5,20) [20,22.5) [22.5,25) [25,inf)  11
+     * @param list
+     */
+    public static Object fxRoses(List<PowerPointData> list){
+        int[][] count = new int[11][16];
+
+        list.stream().forEach(item -> {
+            int fx = windFXAngle(item.getFx());
+            int speed = windSpeed(item.getSpeed());
+            if (speed < 11 && fx < 16)
+                count[speed][fx] = 1;
+        });
+
+        return count;
+    }
+
+
+    /**
+     * 风向频次玫瑰图
+     * 风速:[0,2.5) [2.5,5) [5,7.5) [7.5,10) [10,12.5) [12.5,15) [15,17.5) [17.5,20) [20,22.5) [22.5,25) [25,inf)  11
+     * @param list
+     */
+    public static int[][] fxCountRoses(List<PowerPointData> list){
+        int[][] count = new int[11][16];
+        list.stream().sorted(Comparator.comparing(PowerPointData::getSpeed)).forEach(item -> {
+            int fx = windFXAngle(item.getFx());
+            int speed = windSpeed(item.getSpeed());
+            if (speed < 11 && fx < 16)
+                count[speed][fx] ++;
+        });
+
+        return count;
+    }
+
+
+    /**
+     * 风向频次雷达图
+     * @param list
+     * @return
+     */
+    public static int[] fxRadarRoses(List<PowerPointData> list){
+        int[] count = new int[16];
+        list.stream().sorted(Comparator.comparing(PowerPointData::getSpeed)).forEach(item -> {
+            int df = windDFAngle(item.getDfwc());
+            if (count[df] < 1000) {
+                count[df]++;
+            }
+        });
+
+        return count;
+    }
+
+
+    /**
+     * 风向划分
+     * 0:0-22.5
+     * 1:22.5-45
+     * 2:90-135
+     * .。。。。。。
+     * @param fx
+     * @return params: 0,1,2。。。。。15
+     */
+    private static int windFXAngle(double fx){
+        int split = 16;  //风向分为16个角度
+        double angle = (double)360 / split;
+        int index = (int) (fx / angle);
+        return index;
+    }
+
+    /**
+     * 对风角度计算
+     * 0:0-22.5
+     * 1:22.5-45
+     * 2:90-135
+     * .。。。。。。
+     * @param
+     * @return
+     */
+    private static int windDFAngle(double angle){
+        int split = 16;  //风向分为8个角度
+        double interval = (double)360 / split;
+        angle = angle > 360 ? 720 - 360 : angle;
+        int index = (int) (Math.abs(angle) / interval);
+        return index;
+    }
+
+    /**
+     * 风速区域划分
+     * @param speed
+     * @return
+     */
+    private static int windSpeed(double speed){
+        if (speed < 2.5)
+            return 0;
+        else if (speed < 5)
+            return 1;
+        else if (speed < 7.5)
+            return 2;
+        else if (speed < 10)
+            return 3;
+        else if (speed < 12.5)
+            return 4;
+        else if (speed < 15)
+            return 5;
+        else if (speed < 17.5)
+            return 6;
+        else if (speed < 20)
+            return 7;
+        else if (speed < 22.5)
+            return 8;
+        else if (speed < 25)
+            return 9;
+        else
+            return 10;
+    }
+
+
+    /**
+     * 数据聚合  间隔10
+     * @param list
+     * @return
+     */
+    private static Object arrayDistinct(List<List<Double>> list){
+        for (List<Double> item : list){
+            List<Double> lt = new ArrayList<>();
+            LinkedHashSet<Integer> ls = new LinkedHashSet<>();
+            item.forEach(ele -> {
+                if (ele == null)
+                    return;
+                int v = (int) (ele / 10);
+                if (!ls.contains(v))
+                    lt.add(ele);
+
+                ls.add(v);
+            });
+            item.clear();
+            item.addAll(lt);
+        }
+
+        return list;
+    }
+}

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/base/ExcludeQueryWrapper.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.base;
+package com.gyee.power.fitting.common.base;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/config/CorsConfig.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.config;
+package com.gyee.power.fitting.common.config;
 
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.servlet.config.annotation.CorsRegistry;

+ 1 - 8
power-fetting/src/main/java/com/gyee/power/fetting/common/config/datasource/DataSourceConfig.java

@@ -1,16 +1,9 @@
-package com.gyee.power.fetting.common.config.datasource;
+package com.gyee.power.fitting.common.config;
 
 import com.alibaba.druid.pool.DruidDataSource;
-import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
-import org.apache.ibatis.session.SqlSessionFactory;
-import org.mybatis.spring.SqlSessionTemplate;
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.jdbc.DataSourceBuilder;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
 
 import javax.sql.DataSource;
 

+ 73 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/config/GyeeConfig.java

@@ -0,0 +1,73 @@
+package com.gyee.power.fitting.common.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.system.ApplicationHome;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "gyee")
+public class GyeeConfig {
+
+    public File jarF = null;
+    {
+        ApplicationHome h = new ApplicationHome(getClass());
+        jarF = h.getSource();
+    }
+
+    /** 数据适配器网址 **/
+    private String adapterUrl;
+    /** 数据准备保存路径(原始数据) **/
+    private String filePathPrepare;
+    /** 数据处理保存路径(处理后的数据) **/
+    private String filePathProcess;
+    /** 数据拟合保存路径(拟合后的数据) **/
+    private String filePathFitting;
+    /** 数据压缩下载 **/
+    private String filePathDownload;
+    /** 功率曲线拟合测点 **/
+    private String points;
+    /** 适配器读取数据等间隔时间 **/
+    private Integer interval;
+
+    public List<String> getPoints() {
+        return Arrays.asList(this.points.split(","));
+    }
+
+    public String getFilePathPrepare() {
+        return jarF.getParentFile().getAbsolutePath() + "\\" + filePathPrepare;
+    }
+
+    public void setFilePathPrepare(String filePathPrepare) {
+        this.filePathPrepare = filePathPrepare;
+    }
+
+    public String getFilePathProcess() {
+        return jarF.getParentFile().getAbsolutePath() + "\\" + filePathProcess;
+    }
+
+    public void setFilePathProcess(String filePathProcess) {
+        this.filePathProcess = filePathProcess;
+    }
+
+    public String getFilePathFitting() {
+        return jarF.getParentFile().getAbsolutePath() + "\\" + filePathFitting;
+    }
+
+    public void setFilePathFitting(String filePathFitting) {
+        this.filePathFitting = filePathFitting;
+    }
+
+    public String getFilePathDownload() {
+        return jarF.getParentFile().getAbsolutePath() + "\\" + filePathDownload;
+    }
+
+    public void setFilePathDownload(String filePathDownload) {
+        this.filePathDownload = filePathDownload;
+    }
+}

+ 50 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/config/ThreadPoolConfig.java

@@ -0,0 +1,50 @@
+package com.gyee.power.fitting.common.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+
+@Configuration
+public class ThreadPoolConfig {
+    /**
+     *   默认情况下,在创建了线程池后,线程池中的线程数为0,当有任务来之后,就会创建一个线程去执行任务,
+     *	当线程池中的线程数目达到corePoolSize后,就会把到达的任务放到缓存队列当中;
+     *  当队列满了,就继续创建线程,当线程数量大于等于maxPoolSize后,开始使用拒绝策略拒绝
+     */
+
+    /** 核心线程数(默认线程数) */
+    private static final int corePoolSize = 10;
+    /** 最大线程数 */
+    private static final int maxPoolSize = 20;
+    /** 允许线程空闲时间(单位:默认为秒) */
+    private static final int keepAliveTime = 60;
+    /** 缓冲队列大小 */
+    private static final int queueCapacity = 100;
+    /** 允许等待最长时间 */
+    private static final int awaitTime = 15;
+    /** 线程池名前缀 */
+    private static final String threadNamePrefix = "GYEE-Thread-";
+
+
+    @Bean
+    public ThreadPoolTaskExecutor taskExecutor(){
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setCorePoolSize(corePoolSize);
+        executor.setMaxPoolSize(maxPoolSize);
+        executor.setQueueCapacity(queueCapacity);
+        executor.setKeepAliveSeconds(keepAliveTime);
+        executor.setThreadNamePrefix(threadNamePrefix);
+        executor.setAwaitTerminationSeconds(awaitTime);
+
+        // 线程池对拒绝任务的处理策略
+        // CallerRunsPolicy:由调用线程(提交任务的线程)处理该任务
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+        // 初始化
+        executor.initialize();
+        return executor;
+    }
+
+}

+ 20 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/config/WebSocketConfig.java

@@ -0,0 +1,20 @@
+package com.gyee.power.fitting.common.config;
+
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.socket.server.standard.ServerEndpointExporter;
+
+/**
+ * 开启 WebSocket 支持
+ **/
+@Configuration
+public class WebSocketConfig {
+
+    @Bean
+    public ServerEndpointExporter serverEndpointExporter() {
+        System.out.println("开启websocket支持。。。。。");
+        return new ServerEndpointExporter();
+    }
+
+}

+ 13 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/constants/Constants.java

@@ -0,0 +1,13 @@
+package com.gyee.power.fitting.common.constants;
+
+public class Constants {
+
+    // 数据准备  标记
+    public static final String DATA_PREPARE = "prepare";
+
+    // 数据处理完  标记
+    public static final String DATA_PROCESS = "process";
+
+    // 数据处理完  标记
+    public static final String DATA_FITTING = "fitting";
+}

+ 3 - 3
power-fetting/src/main/java/com/gyee/power/fetting/common/exception/AdviceException.java

@@ -1,8 +1,8 @@
-package com.gyee.power.fetting.common.exception;
+package com.gyee.power.fitting.common.exception;
 
 import com.alibaba.fastjson.JSONObject;
-import com.gyee.power.fetting.common.result.JsonResult;
-import com.gyee.power.fetting.common.result.ResultCode;
+import com.gyee.power.fitting.common.result.JsonResult;
+import com.gyee.power.fitting.common.result.ResultCode;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.RestControllerAdvice;

+ 2 - 2
power-fetting/src/main/java/com/gyee/power/fetting/common/exception/CustomException.java

@@ -1,6 +1,6 @@
-package com.gyee.power.fetting.common.exception;
+package com.gyee.power.fitting.common.exception;
 
-import com.gyee.power.fetting.common.result.ResultCode;
+import com.gyee.power.fitting.common.result.ResultCode;
 import lombok.Data;
 
 @Data

+ 32 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/feign/FeignsBuilder.java

@@ -0,0 +1,32 @@
+package com.gyee.power.fitting.common.feign;
+
+import feign.Feign;
+import feign.Request;
+import feign.Retryer;
+import feign.jackson.JacksonDecoder;
+import feign.jackson.JacksonEncoder;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @author xysn
+ */
+@Configuration
+public class FeignsBuilder {
+    /**
+     * 数据适配器url
+     */
+    @Value("${gyee.adapter-url:http://192.168.101.8:8011}")
+    private String adapterUrl;
+
+    @Bean
+    public IDataAdapter dataAdapter() {
+        return Feign.builder()
+                .encoder(new JacksonEncoder())
+                .decoder(new JacksonDecoder())
+                .options(new Request.Options(1000, 100000))
+                .retryer(new Retryer.Default(5000, 5000, 3))
+                .target(IDataAdapter.class, adapterUrl);
+    }
+}

+ 34 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/feign/IAdapterService.java

@@ -0,0 +1,34 @@
+package com.gyee.power.fitting.common.feign;
+
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.power.fitting.model.custom.TsDoubleData;
+import feign.Headers;
+import feign.Param;
+import feign.RequestLine;
+import org.springframework.web.bind.annotation.GetMapping;
+
+import java.util.List;
+
+
+public interface IAdapterService {
+
+
+    @Headers({"Content-Type: application/json", "Accept: application/json"})
+    @RequestLine("GET /ts/latest?keys={points}")
+    JSONObject getLatest(@Param(value = "points") String points);
+
+    @Headers({"Content-Type: application/json", "Accept: application/json"})
+    @RequestLine("GET /ts/history/snap?tagName={tagName}&startTs={startTs}&endTs={endTs}&interval={interval}")
+    List<TsDoubleData> getHistorySnap(@Param(value = "tagName") String tagName, @Param(value = "startTs") long startTs,
+                                        @Param(value = "endTs") long endTs, @Param(value = "interval") Integer interval);
+    
+    @Headers({"Content-Type: application/json", "Accept: application/json"})
+    @RequestLine("GET /ts/history/snap?tagName={tagName}&startTs={startTs}&endTs={endTs}&interval={interval}")
+    List<TsDoubleData> getValuesByKey(@Param(value = "tagName") String tagName, @Param(value = "startTs") long startTs,
+                                   @Param(value = "endTs") long endTs, @Param(value = "interval") int interval);
+    
+    @Headers({"Content-Type: application/json", "Accept: application/json"})
+    @RequestLine("GET /ts/history/raw?tagName={tagName}&startTs={startTs}&endTs={endTs}")
+    List<TsDoubleData> getRawValuesByKey(@Param(value = "tagName") String tagName, @Param(value = "startTs") long startTs,
+                                      @Param(value = "endTs") long endTs);
+}

+ 26 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/feign/IDataAdapter.java

@@ -0,0 +1,26 @@
+package com.gyee.power.fitting.common.feign;
+
+import com.gyee.power.fitting.model.agc.PointData;
+import feign.Param;
+import feign.RequestLine;
+
+import java.util.List;
+
+/**
+ * DataAdapter数据请求
+ */
+public interface IDataAdapter {
+    /**
+     * 获取等间隔历史数据
+     *
+     * @param tagName  测点名称
+     * @param startTs  开始时间
+     * @param endTs    结束时间
+     * @param interval 数据间隔
+     * @return 历史数据
+     */
+    @RequestLine("GET /ts/history/snap?tagName={tagName}&startTs={startTs}&endTs={endTs}&interval={interval}")
+    List<PointData> getSnapValuesByKey(@Param(value = "tagName") String tagName, @Param(value = "startTs") long startTs,
+                                       @Param(value = "endTs") long endTs, @Param(value = "interval") int interval);
+}
+

+ 2 - 2
power-fetting/src/main/java/com/gyee/power/fetting/common/feign/RemoteServiceBuilder.java

@@ -1,6 +1,6 @@
-package com.gyee.power.fetting.common.feign;
+package com.gyee.power.fitting.common.feign;
 
-import com.gyee.power.fetting.common.config.GyeeConfig;
+import com.gyee.power.fitting.common.config.GyeeConfig;
 import feign.Feign;
 import feign.Request;
 import feign.Retryer;

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/result/JsonResult.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.result;
+package com.gyee.power.fitting.common.result;
 
 import com.alibaba.fastjson.JSONObject;
 import lombok.Data;

+ 2 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/result/ResultCode.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.result;
+package com.gyee.power.fitting.common.result;
 
 /*
  * #1001~1999 区间表示参数错误
@@ -9,6 +9,7 @@ package com.gyee.power.fetting.common.result;
 public enum ResultCode {
     /* 成功 */
     SUCCESS(200, "成功"),
+    SUCCESS_DATA_PREPARE(200, "数据已提交,稍后查看"),
 
     /* 默认失败 */
     ERROR(4000, "失败"),

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/spring/ExitDisposable.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.spring;
+package com.gyee.power.fitting.common.spring;
 
 import org.springframework.beans.factory.DisposableBean;
 import org.springframework.boot.ExitCodeGenerator;

+ 125 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/spring/InitialRunner.java

@@ -0,0 +1,125 @@
+package com.gyee.power.fitting.common.spring;
+
+import com.gyee.power.fitting.common.config.GyeeConfig;
+import com.gyee.power.fitting.model.*;
+import com.gyee.power.fitting.service.*;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 服务启动前执行,进行全局变量初始化
+ */
+@Slf4j
+@Component
+@Order(1)
+public class InitialRunner implements CommandLineRunner {
+
+    @Autowired
+    GyeeConfig config;
+    @Resource
+    private WindturbineService windturbineService;
+    @Resource
+    private WindpowerstationService windpowerstationService;
+    @Resource
+    private Windturbinetestingpointai2Service pointService;
+    @Resource
+    private EquipmentmodelService equipmentmodelService;
+    @Resource
+    private ModelpowerService modelpowerService;
+    @Resource
+    private ModelpowerdetailsService modelpowerdetailsService;
+
+
+    /**场站所有信息**/
+    public static List<Windpowerstation> wpList = new ArrayList<>();
+    /** <MHS_FDC, 麻黄山风电场> **/
+    public static Map<String, String> stationMap = new HashMap<>();
+
+    /**所有的风机**/
+    public static List<Windturbine> wtList = new ArrayList<>();
+    /** key:wtId NG01_01 **/
+    public static Map<String, Windturbine> wtMap = new HashMap<>();
+    /**场站的风机**/
+    public static Map<String, List<Windturbine>> wpMap = new HashMap<>();
+
+    public static Map<String, List<Windturbinetestingpointai2>> pointMap = new HashMap<>();
+
+    /**所有设备型号**/
+    public static List<Equipmentmodel> equipmentList = new ArrayList<>();
+    public static Map<String, Equipmentmodel> equipmentMap = new HashMap<>();
+
+    /**功率曲线拟合的风速功率点**/
+    /** key: model  UP82 **/
+    public static Map<String, List<Modelpower>> modelPowerMap = new HashMap<>();
+    /** key: model  UP82 **/
+    public static Map<String, List<Modelpowerdetails>> modelPowerDetailMap = new HashMap<>();
+
+
+    @Override
+    public void run(String... args){
+        System.out.println(">>>>>>>>>>>>>>>服务启动,正在缓存数据<<<<<<<<<<<<<<");
+
+        cacheStation();
+        cachePoints();
+        cacheEquipment();
+        cacheModelPower();
+
+        System.out.println(">>>>>>>>>>>>>>>数据缓存完成<<<<<<<<<<<<<<");
+    }
+
+    /**
+     * 缓存场站、风机数据
+     * 数据新增或删除后需要更新,故每次清空
+     */
+    public void cacheStation(){
+        List<Windpowerstation> stations = windpowerstationService.selectList();
+        wpList = stations.stream().filter(f -> f.getId().contains("FDC")).collect(Collectors.toList());
+        wpList.stream().forEach(obj -> {
+            List<Windturbine> wts = windturbineService.selectList(obj.getId());
+            stationMap.put(obj.getId(), obj.getName());
+            wpMap.put(obj.getId(), wts);
+            wtList.addAll(wts);
+
+            wts.stream().forEach(u -> wtMap.put(u.getId(), u));
+        });
+    }
+
+    /**
+     * 缓存测点数据
+     */
+    private void cachePoints() {
+        List<Windturbinetestingpointai2> list = new ArrayList<>();
+        wpList.stream().forEach(d -> list.addAll(pointService.selectList(d.getId(), config.getPoints())));
+        pointMap.putAll(list.stream().collect(Collectors.groupingBy(u -> u.getWindturbineid())));
+        System.out.println("cachePoints: " + pointMap.size());
+        if (pointMap.size() == 0)
+            log.error("cachePoints", "测点数据缓存失败");
+    }
+
+    /**
+     * 缓存设备型号
+     */
+    private void cacheEquipment() {
+        equipmentList.addAll(equipmentmodelService.selectList());
+        for (Equipmentmodel eq : equipmentList)
+            equipmentMap.put(eq.getId(), eq);
+    }
+
+    private void cacheModelPower() {
+        List<Modelpower> lsMP = modelpowerService.selectList();
+        List<Modelpowerdetails> lsMPD = modelpowerdetailsService.selectList();
+        modelPowerMap.putAll(lsMP.stream().collect(Collectors.groupingBy(u -> u.getModelid())));
+        modelPowerDetailMap.putAll(lsMPD.stream().collect(Collectors.groupingBy(u -> u.getModelid())));
+    }
+
+}

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/spring/SpringContextUtil.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.spring;
+package com.gyee.power.fitting.common.spring;
 
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.DisposableBean;

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/util/Base64Util.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 import java.io.UnsupportedEncodingException;
 import java.util.Base64;

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/util/CollectUtil.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;

+ 21 - 3
power-fetting/src/main/java/com/gyee/power/fetting/common/util/DateUtil.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.time.DateFormatUtils;
@@ -152,6 +152,8 @@ public class DateUtil extends DateUtils {
 
     public static String YYYY_MM = "yyyy-MM";
 
+    public static String YYYY_MM_DD_CHN = "yyyy年MM月dd日";
+
     public static String YYYY_MM_DD = "yyyy-MM-dd";
 
     public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
@@ -181,7 +183,7 @@ public class DateUtil extends DateUtils {
         return dateTimeNow(YYYY_MM_DD);
     }
 
-    public static final String getTime() {
+    public static final String getTimeDiff() {
         return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
     }
 
@@ -488,9 +490,25 @@ public class DateUtil extends DateUtils {
         return utcSDF;
     }
 
+    // 获取两个时间相差分钟数
+    public static int getTimeDiff(String oldTime, String newTime) {
+        int diff = 0;
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        long NTime = 0;
+        long OTime = 0;
+        try {
+            NTime = df.parse(newTime).getTime();
+            //从对象中拿到时间
+            OTime = df.parse(oldTime).getTime();
+            diff = (int) (Math.abs((NTime-OTime))/1000/60);
+        } catch (ParseException e) {
+        }
+
+        return diff;
+    }
+
 
     public static void main(String[] args) {
-        System.out.println(getCurrentDate());
         System.out.println(getPreviousDate(3 * 360 * 24));
         System.out.println(covertDateTimestamp("2021-12-30 00:00:00"));
     }

+ 360 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/util/DateUtils.java

@@ -0,0 +1,360 @@
+package com.gyee.power.fitting.common.util;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * 日期操作工具类
+ */
+public class DateUtils {
+
+    private static final SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd");
+    private static final SimpleDateFormat sdfl = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+    /**
+     * 日期转换-  String -> Date
+     *
+     * @param dateString 字符串时间
+     * @return Date类型信息
+     * @throws Exception 抛出异常
+     */
+    public static Date string2DateS(String dateString) throws Exception {
+        if (dateString == null) {
+            return null;
+        }
+        return sdfs.parse(dateString);
+    }
+
+    /**
+     * 日期转换-  String -> Date
+     *
+     * @param dateString 字符串时间
+     * @return Date类型信息
+     * @throws Exception 抛出异常
+     */
+    public static Date string2DateL(String dateString) throws Exception {
+        if (dateString == null) {
+            return null;
+        }
+        return sdfl.parse(dateString);
+    }
+
+    /**
+     * 日期转换-  String -> Date
+     *
+     * @param dateString 字符串时间
+     * @param pattern    格式模板
+     * @return Date类型信息
+     * @throws Exception 抛出异常
+     */
+    public static Date string2Date(String dateString, String pattern) throws Exception {
+        if (dateString == null) {
+            return null;
+        }
+        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+        Date date = sdf.parse(dateString);
+        return date;
+    }
+
+    /**
+     * 日期转换 Date -> String
+     *
+     * @param date Date类型信息
+     * @return 字符串时间
+     * @throws Exception 抛出异常
+     */
+    public static String date2StringS(Date date) throws Exception {
+        if (date == null) {
+            return null;
+        }
+        return sdfs.format(date);
+    }
+
+    /**
+     * 日期转换 Date -> String
+     *
+     * @param date Date类型信息
+     * @return 字符串时间
+     * @throws Exception 抛出异常
+     */
+    public static String date2StringL(Date date) throws Exception {
+        if (date == null) {
+            return null;
+        }
+        return sdfl.format(date);
+    }
+
+    /**
+     * 日期转换 Date -> String
+     *
+     * @param date    Date类型信息
+     * @param pattern 格式模板
+     * @return 字符串时间
+     * @throws Exception 抛出异常
+     */
+    public static String date2String(Date date, String pattern) throws Exception {
+        if (date == null) {
+            return null;
+        }
+        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+        String strDate = sdf.format(date);
+        return strDate;
+    }
+
+    /**
+     * 获取当前时间的0点
+     */
+    public static Calendar getZero(Calendar c){
+        Calendar time = (Calendar) c.clone();
+        time.set(Calendar.HOUR_OF_DAY, 0);
+        time.set(Calendar.MINUTE, 0);
+        time.set(Calendar.SECOND, 0);
+        time.set(Calendar.MILLISECOND, 0);
+        return time;
+    }
+    /**
+     * 获取当前时间的最晚点
+     */
+    public static Calendar getNight(Calendar c){
+        Calendar time = getZero(c);
+        time.add(Calendar.DATE, 1);
+        time.add(Calendar.MILLISECOND,-1);
+        return time;
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+    /**
+     * 获取当前日期的本周一是几号
+     *
+     * @return 本周一的日期
+     */
+    public static Date getThisWeekMonday() {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(new Date());
+        // 获得当前日期是一个星期的第几天
+        int dayWeek = cal.get(Calendar.DAY_OF_WEEK);
+        if (1 == dayWeek) {
+            cal.add(Calendar.DAY_OF_MONTH, -1);
+        }
+        // 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一
+        cal.setFirstDayOfWeek(Calendar.MONDAY);
+        // 获得当前日期是一个星期的第几天
+        int day = cal.get(Calendar.DAY_OF_WEEK);
+        // 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值
+        cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - day);
+        return cal.getTime();
+    }
+
+    /**
+     * 获取当前日期周的最后一天
+     *
+     * @return 当前日期周的最后一天
+     */
+    public static Date getSundayOfThisWeek() {
+        Calendar c = Calendar.getInstance();
+        int dayOfWeek = c.get(Calendar.DAY_OF_WEEK) - 1;
+        if (dayOfWeek == 0) {
+            dayOfWeek = 7;
+        }
+        c.add(Calendar.DATE, -dayOfWeek + 7);
+        return c.getTime();
+    }
+
+    /**
+     * 根据日期区间获取月份列表
+     *
+     * @param minDate 开始时间
+     * @param maxDate 结束时间
+     * @return 月份列表
+     * @throws Exception
+     */
+    public static List<String> getMonthBetween(String minDate, String maxDate, String format) throws Exception {
+        ArrayList<String> result = new ArrayList<>();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
+
+        Calendar min = Calendar.getInstance();
+        Calendar max = Calendar.getInstance();
+
+        min.setTime(sdf.parse(minDate));
+        min.set(min.get(Calendar.YEAR), min.get(Calendar.MONTH), 1);
+
+        max.setTime(sdf.parse(maxDate));
+        max.set(max.get(Calendar.YEAR), max.get(Calendar.MONTH), 2);
+        SimpleDateFormat sdf2 = new SimpleDateFormat(format);
+
+        Calendar curr = min;
+        while (curr.before(max)) {
+            result.add(sdf2.format(curr.getTime()));
+            curr.add(Calendar.MONTH, 1);
+        }
+
+        return result;
+    }
+
+    /**
+     * 根据日期获取年度中的周索引
+     *
+     * @param date 日期
+     * @return 周索引
+     * @throws Exception
+     */
+    public static Integer getWeekOfYear(String date) throws Exception {
+        Date useDate = string2DateS(date);
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(useDate);
+        return cal.get(Calendar.WEEK_OF_YEAR);
+    }
+
+    /**
+     * 根据年份获取年中周列表
+     *
+     * @param year 年分
+     * @return 周列表
+     * @throws Exception
+     */
+    public static Map<Integer, String> getWeeksOfYear(String year) throws Exception {
+        Date useDate = string2Date(year, "yyyy");
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(useDate);
+        //获取年中周数量
+        int weeksCount = cal.getWeeksInWeekYear();
+        Map<Integer, String> mapWeeks = new HashMap<>(55);
+        for (int i = 0; i < weeksCount; i++) {
+            cal.get(Calendar.DAY_OF_YEAR);
+            mapWeeks.put(i + 1, date2StringS(getFirstDayOfWeek(cal.get(Calendar.YEAR), i)));
+        }
+        return mapWeeks;
+    }
+
+    /**
+     * 获取某年的第几周的开始日期
+     *
+     * @param year 年分
+     * @param week 周索引
+     * @return 开始日期
+     * @throws Exception
+     */
+    public static Date getFirstDayOfWeek(int year, int week) throws Exception {
+        Calendar c = new GregorianCalendar();
+        c.set(Calendar.YEAR, year);
+        c.set(Calendar.MONTH, Calendar.JANUARY);
+        c.set(Calendar.DATE, 1);
+
+        Calendar cal = (GregorianCalendar) c.clone();
+        cal.add(Calendar.DATE, week * 7);
+
+        return getFirstDayOfWeek(cal.getTime());
+    }
+
+    /**
+     * 获取某年的第几周的结束日期
+     *
+     * @param year 年份
+     * @param week 周索引
+     * @return 结束日期
+     * @throws Exception
+     */
+    public static Date getLastDayOfWeek(int year, int week) throws Exception {
+        Calendar c = new GregorianCalendar();
+        c.set(Calendar.YEAR, year);
+        c.set(Calendar.MONTH, Calendar.JANUARY);
+        c.set(Calendar.DATE, 1);
+
+        Calendar cal = (GregorianCalendar) c.clone();
+        cal.add(Calendar.DATE, week * 7);
+
+        return getLastDayOfWeek(cal.getTime());
+    }
+
+    /**
+     * 获取当前时间所在周的开始日期
+     *
+     * @param date 当前时间
+     * @return 开始时间
+     */
+    public static Date getFirstDayOfWeek(Date date) {
+        Calendar c = new GregorianCalendar();
+        c.setFirstDayOfWeek(Calendar.SUNDAY);
+        c.setTime(date);
+        c.set(Calendar.DAY_OF_WEEK, c.getFirstDayOfWeek());
+        return c.getTime();
+    }
+
+    /**
+     * 获取当前时间所在周的结束日期
+     *
+     * @param date 当前时间
+     * @return 结束日期
+     */
+    public static Date getLastDayOfWeek(Date date) {
+        Calendar c = new GregorianCalendar();
+        c.setFirstDayOfWeek(Calendar.SUNDAY);
+        c.setTime(date);
+        c.set(Calendar.DAY_OF_WEEK, c.getFirstDayOfWeek() + 6);
+        return c.getTime();
+    }
+    //获得上周一的日期
+    public static Date geLastWeekMonday(Date date) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(getThisWeekMonday(date));
+        cal.add(Calendar.DATE, -7);
+        return cal.getTime();
+    }
+
+    //获得本周一的日期
+    public static Date getThisWeekMonday(Date date) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        // 获得当前日期是一个星期的第几天
+        int dayWeek = cal.get(Calendar.DAY_OF_WEEK);
+        if (1 == dayWeek) {
+            cal.add(Calendar.DAY_OF_MONTH, -1);
+        }
+        // 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一
+        cal.setFirstDayOfWeek(Calendar.MONDAY);
+        // 获得当前日期是一个星期的第几天
+        int day = cal.get(Calendar.DAY_OF_WEEK);
+        // 根据日历的规则,给当前日期减去星期几与一个星期第一天的差值
+        cal.add(Calendar.DATE, cal.getFirstDayOfWeek() - day);
+        return cal.getTime();
+    }
+
+    //获得下周一的日期
+    public static Date getNextWeekMonday(Date date) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(getThisWeekMonday(date));
+        cal.add(Calendar.DATE, 7);
+        return cal.getTime();
+    }
+
+    //获得今天日期
+    public static Date getToday(){
+        return new Date();
+    }
+
+    //获得本月一日的日期
+    public static Date getFirstDay4ThisMonth(){
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.DAY_OF_MONTH,1);
+        return calendar.getTime();
+    }
+
+    public static void main(String[] args) {
+        try {
+            System.out.println("本周一" + date2StringS(getThisWeekMonday()));
+            System.out.println("本月一日" + date2StringS(getFirstDay4ThisMonth()));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 107 - 10
power-fetting/src/main/java/com/gyee/power/fetting/common/util/FileUtil.java

@@ -1,13 +1,15 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
-import com.gyee.power.fetting.common.exception.CustomException;
-import com.gyee.power.fetting.common.result.ResultCode;
 import lombok.extern.slf4j.Slf4j;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
 
 @Slf4j
 public class FileUtil {
@@ -18,7 +20,7 @@ public class FileUtil {
      * @param fileName
      * @param content
      */
-    public static void writeFile(String fileName, String content) {
+    public static boolean writeFile(String fileName, String content) {
         BufferedWriter bw = null;
 
         try {
@@ -29,15 +31,16 @@ public class FileUtil {
             bw = new BufferedWriter(new FileWriter(file, true));
 
             String[] list = content.split("\n");
-            for(int i = 0; i < list.length; i++){
+            for (int i = 0; i < list.length; i++) {
                 bw.write(list[i]);
                 bw.write("\n");
-                if (i % 500 == 0)
+                if (i % 1000 == 0)
                     bw.flush();
             }
             bw.flush();
         } catch (Exception e) {
-            log.error(e.getMessage());
+            log.error("writePowerData", e);
+            return false;
         } finally {
             try {
                 bw.close();
@@ -45,6 +48,8 @@ public class FileUtil {
                 e.printStackTrace();
             }
         }
+
+        return true;
     }
 
     /**
@@ -97,6 +102,45 @@ public class FileUtil {
 
     }
 
+    /**
+     * 读取文件
+     *
+     * @param fileName
+     * @param isAll    是否读取全部数据
+     * @return
+     */
+    public static List<String> readFile(String fileName, boolean isAll) {
+        List<String> list = new ArrayList<>();
+
+        File file = new File(fileName);
+        BufferedReader reader = null;
+        try {
+            reader = new BufferedReader(new FileReader(file));
+            String content = null;
+            int line = 0;
+            // 一次读入一行,直到读入null为文件结束
+            while ((content = reader.readLine()) != null) {
+                // 显示行号
+                list.add(content);
+                line++;
+                if (!isAll && line == 300)
+                    break;
+            }
+            reader.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (IOException e1) {
+                }
+            }
+        }
+
+        return list;
+    }
+
 
     /**
      * 加载文件
@@ -128,10 +172,8 @@ public class FileUtil {
                 os.write(buffer, 0, i);
                 i = bis.read(buffer);
             }
-        } catch (FileNotFoundException e) {
-            throw new CustomException(ResultCode.ERROR_FILE_NO);
         } catch (Exception e) {
-            throw new CustomException(ResultCode.ERROR);
+            log.error("FileUtil--download", e);
         } finally {
             if (bis != null) {
                 try {
@@ -149,4 +191,59 @@ public class FileUtil {
             }
         }
     }
+
+
+    /**
+     * @describe 压缩多个文件
+     * @author zfc
+     */
+    public static String zipFiles(List<File> srcFiles, File zipFile) {
+        // 判断压缩后的文件存在不,不存在则创建
+        if (!zipFile.exists()) {
+            try {
+                zipFile.createNewFile();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        // 创建 FileOutputStream 对象
+        FileOutputStream fileOutputStream = null;
+        // 创建 ZipOutputStream
+        ZipOutputStream zipOutputStream = null;
+        // 创建 FileInputStream 对象
+        FileInputStream fileInputStream = null;
+
+        try {
+            // 实例化 FileOutputStream 对象
+            fileOutputStream = new FileOutputStream(zipFile);
+            // 实例化 ZipOutputStream 对象
+            zipOutputStream = new ZipOutputStream(fileOutputStream);
+            // 创建 ZipEntry 对象
+            ZipEntry zipEntry = null;
+            // 遍历源文件数组
+            for (int i = 0; i < srcFiles.size(); i++) {
+                // 将源文件数组中的当前文件读入 FileInputStream 流中
+                fileInputStream = new FileInputStream(srcFiles.get(i));
+                // 实例化 ZipEntry 对象,源文件数组中的当前文件
+                zipEntry = new ZipEntry(srcFiles.get(i).getName());
+                zipOutputStream.putNextEntry(zipEntry);
+                // 该变量记录每次真正读的字节个数
+                int len;
+                // 定义每次读取的字节数组
+                byte[] buffer = new byte[1024];
+                while ((len = fileInputStream.read(buffer)) > 0) {
+                    zipOutputStream.write(buffer, 0, len);
+                }
+            }
+            zipOutputStream.closeEntry();
+            zipOutputStream.close();
+            fileInputStream.close();
+            fileOutputStream.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        return zipFile.getAbsolutePath();
+    }
+
 }

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/util/JudeSystem.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 
 /**

+ 20 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/util/NumberUtil.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 
 import java.math.BigDecimal;
@@ -87,4 +87,23 @@ public class NumberUtil {
         return sb.toString();
     }
 
+    public static String toNum(int num){
+        String interval = "";
+        switch(num){
+            case 1:
+                interval = "一秒";
+                break;
+            case 60:
+                interval = "一分钟";
+                break;
+            case 600:
+                interval = "十分钟";
+                break;
+            default:
+                interval = "一分钟";
+        }
+
+        return interval;
+    }
+
 }

+ 62 - 0
power-fitting/src/main/java/com/gyee/power/fitting/common/util/PowerFittingUtil.java

@@ -0,0 +1,62 @@
+package com.gyee.power.fitting.common.util;
+
+import com.gyee.power.fitting.common.constants.Constants;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+public class PowerFittingUtil {
+
+    /**
+     * 功率曲线拟合数据  tree
+     * @return
+     */
+    public static List<Object> powerDataTree(List<Powerfittinganalysis> list, String type){
+        /**多层分组**/
+        Map<String, Map<String, Map<String, List<Powerfittinganalysis>>>> map = list.stream().
+                collect(Collectors.groupingBy(Powerfittinganalysis::getInterval, TreeMap::new,
+                        Collectors.groupingBy(Powerfittinganalysis::getTime,
+                                Collectors.groupingBy(Powerfittinganalysis::getStationcn))));
+
+        List<Object> result = new ArrayList<>();
+        map.forEach((k, v) -> {
+            List<Object> l1 = new ArrayList<>();
+            Map<String, Object> map1 = new TreeMap<>();
+
+            map.get(k).forEach((k1, v1) -> {
+                List<Object> l2 = new ArrayList<>();
+                Map<String, Object> map2 = new HashMap<>();
+                map.get(k).get(k1).forEach((k2, v2) -> {
+                    Map<String, Object> map3 = new HashMap<>();
+                    map3.put("id", SnowFlakeUtil.generateId());
+                    map3.put("label", k2);
+                    map3.put("children", v2.stream().sorted(Comparator.comparing(Powerfittinganalysis::getWindturbine)));
+                    l2.add(map3);
+                });
+
+                map2.put("id", SnowFlakeUtil.generateId());
+                map2.put("label", k1);
+                map2.put("children", l2);
+                l1.add(map2);
+            });
+
+            map1.put("id", SnowFlakeUtil.generateId());
+            map1.put("label", k);
+            map1.put("children", l1);
+            result.add(map1);
+        });
+
+        Map<String, Object> mp = new HashMap<>();
+        mp.put("id", SnowFlakeUtil.generateId());
+        mp.put("label", type.equals(Constants.DATA_PREPARE) ? "数据准备" :
+                type.equals(Constants.DATA_PROCESS) ? "数据预处理" : type.equals(Constants.DATA_FITTING) ? "功率曲线拟合" : "数据");
+        mp.put("children", result);
+
+        List<Object> ls = new ArrayList<>();
+        ls.add(mp);
+
+        return ls;
+    }
+
+}

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/util/SnowFlakeUtil.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 
 /**

+ 1 - 1
power-fetting/src/main/java/com/gyee/power/fetting/common/util/TokenGenerator.java

@@ -1,4 +1,4 @@
-package com.gyee.power.fetting.common.util;
+package com.gyee.power.fitting.common.util;
 
 import java.security.MessageDigest;
 import java.util.UUID;

+ 48 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/AgcDeviateController.java

@@ -0,0 +1,48 @@
+package com.gyee.power.fitting.controller.analyse;
+
+import com.gyee.power.fitting.model.agc.AgcDeviateTag;
+import com.gyee.power.fitting.service.custom.curve.AgcDeviateService;
+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.List;
+
+/**
+ * 获取各个场站AGC偏差分析数据
+ */
+@RestController
+@RequestMapping("/agc")
+public class AgcDeviateController {
+    @Resource
+    private AgcDeviateService agcDeviateService;
+
+    /**
+     * 获取偏差信息
+     *
+     * @param startTs  开始时间
+     * @param endTs    结束时间
+     * @param id       场站id
+     * @param interval 时间间隔
+     * @return
+     */
+    @GetMapping("/deviate")
+    public List<AgcDeviateTag> getData(@RequestParam(value = "startTs") long startTs,
+                                       @RequestParam(value = "endTs") long endTs,
+                                       @RequestParam(value = "id") String id,
+                                       @RequestParam(value = "interval", defaultValue = "60", required = false) int interval) {
+        return agcDeviateService.getAgcDeviateTags(id, startTs, endTs, interval);
+    }
+
+    /**
+     * 获取配置
+     *
+     * @return
+     */
+    @GetMapping("/config")
+    public Object getAgcConifg() {
+        return agcDeviateService.getConfig();
+    }
+}

+ 138 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/DataFittingController.java

@@ -0,0 +1,138 @@
+package com.gyee.power.fitting.controller.analyse;
+
+
+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.Powerfittinganalysis;
+import com.gyee.power.fitting.model.custom.PowerPointData;
+import com.gyee.power.fitting.service.custom.curve.DataFittingService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 功率曲线拟合
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/power/fitting")
+public class DataFittingController {
+
+    @Autowired
+    private DataFittingService fittingService;
+
+
+    /**
+     * 数据拟合
+     * @param ids    数据预处理id
+     * @param maxs
+     * @param mins
+     * @param maxp
+     * @param minp
+     * @param dimension 多项式
+     * @param mode  拟合方式  0:单台拟合  1:合并拟合  2:同名拟合
+     * @return
+     */
+    @GetMapping("/data")
+    public JSONObject dataFitting(@RequestParam(value = "ids",  required = false) String ids,
+                                  @RequestParam(value = "maxs",  required = false) Double maxs,
+                                  @RequestParam(value = "mins",  required = false) Double mins,
+                                  @RequestParam(value = "maxp",  required = false) Double maxp,
+                                  @RequestParam(value = "minp",  required = false) Double minp,
+                                  @RequestParam(value = "dimension",  required = false) Integer dimension,
+                                  @RequestParam(value = "mode",  required = false) Integer mode){
+        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);
+    }
+
+
+    /** 文件 tree
+     * @return
+     */
+    @GetMapping("tree")
+    public JSONObject dataFIttingTree(){
+        List<Object> result = fittingService.dataFittingTree();
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+
+    /**
+     * file 文件数据展示
+     * @param id
+     * @return
+     */
+    @GetMapping("show")
+    public JSONObject dataFittingShow(String id){
+        Map<String, Object> result = fittingService.dataFittingShow(id);
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+
+    /**
+     * 读取曲线,散点等数据
+     * @param id  拟合好的数据ID
+     * @return
+     */
+    @GetMapping("curve")
+    public JSONObject dataFittingCurve(String id){
+        Map<String, Object> result = fittingService.dataFittingCurve(id);
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+
+    /**
+     * 通过key获取原始数据
+     * 对应前端的圈选功能
+     * @param yk  有用点的key
+     * @param wk  无用点的key
+     * @return
+     */
+    @GetMapping("filter")
+    public JSONObject dataFittingFilter(String yk, String wk){
+        List<PowerPointData> list = fittingService.dataOrigin(yk, wk);
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+
+
+    /**
+     * 计算曲线偏差率
+     * @param id 曲线拟合的id
+     * @return
+     */
+//    @GetMapping("curve/ratio")
+//    public JSONObject dataCurveRatio(String id){
+//        Map<String, Double> map = fittingService.dataCurveRatio(id);
+//        return JsonResult.successData(ResultCode.SUCCESS, map);
+//    }
+
+
+    /**
+     * 获取多风机的拟合曲线功率
+     * @param ids  拟合好的数据ID
+     * @return
+     */
+    @GetMapping("line")
+    public JSONObject dataFittingLine(String ids){
+        Object o = fittingService.dataFittingLine(ids);
+        return JsonResult.successData(ResultCode.SUCCESS, o);
+    }
+
+    /**
+     * 获取多风机的运行时间 统计并网时间  3-5m   5-10m   10-12m   12-25m
+     * @param ids  拟合好的数据ID
+     * @return
+     */
+    @GetMapping("time")
+    public JSONObject dataFittingYXTime(String ids){
+        Object o = fittingService.dataFittingTime(ids);
+        return JsonResult.successData(ResultCode.SUCCESS, o);
+    }
+}

+ 83 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/DataPrepareController.java

@@ -0,0 +1,83 @@
+package com.gyee.power.fitting.controller.analyse;
+
+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.FileUtil;
+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 javax.servlet.http.HttpServletResponse;
+import java.util.*;
+
+
+/**
+ * 功率曲线拟合  数据准备
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/power/prepare")
+public class DataPrepareController {
+
+    @Autowired
+    private DataPrepareService prepareService;
+    @Autowired
+    private PowerfittinganalysisService powerService;
+
+
+    /**
+     * 数据准备  golden-file
+     * @param station
+     * @param wtIds
+     * @param st
+     * @param et
+     * @param interval
+     * @return
+     */
+    @GetMapping("data")
+    public JSONObject dataPrepare(String station, String wtIds, Long st,
+                                  Long et, Integer interval){
+        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);
+    }
+
+    /** 文件 tree
+     * @return
+     */
+    @GetMapping("tree")
+    public JSONObject dataPrepareTree(){
+        List<Object> result = prepareService.dataPrepareTree();
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+
+    /**
+     * file 文件数据展示前500行
+     * @param id
+     * @return
+     */
+    @GetMapping("show")
+    public JSONObject dataPrepareShow(String id){
+        Map<String, Object> result = prepareService.dataPrepareShow(id);
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+
+    /**
+     * file 下载
+     * @return
+     */
+    @GetMapping("download")
+    public void dataPrepareDownload(HttpServletResponse response, @RequestParam(value = "id", required = false) String id){
+        Powerfittinganalysis obj = powerService.selectItemById(id);
+        FileUtil.download(obj.getPath(), response);
+    }
+}

+ 106 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/DataProcessController.java

@@ -0,0 +1,106 @@
+package com.gyee.power.fitting.controller.analyse;
+
+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.FileUtil;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
+import com.gyee.power.fitting.service.custom.curve.DataProcessService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 功率曲线拟合  数据预处理
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/power/process")
+public class DataProcessController {
+
+    @Autowired
+    private PowerfittinganalysisService powerService;
+    @Autowired
+    private DataProcessService processService;
+
+
+    /**
+     * 数据预处理
+     * @param ids       预处理数据的ID  自定义
+     * @param maxs     最大风速
+     * @param mins     最小风速
+     * @param maxp     最大功率
+     * @param minp     最小功率
+     * @param isfbw    非并网
+     * @param isfhl    非合理值
+     * @param isbw     并网后10分钟
+     * @param istj     停机前10分钟
+     * @param isglpc   功率曲线偏差
+     * @param isqfh    是否欠符合
+     * @param qfhdj    欠符合等级
+     * @return
+     */
+    @GetMapping("data")
+    public JSONObject dataProcess(@RequestParam(value = "ids",  required = false) String ids,
+                                  @RequestParam(value = "maxs",  required = false) Double maxs,
+                                  @RequestParam(value = "mins",  required = false) Double mins,
+                                  @RequestParam(value = "maxp",  required = false) Double maxp,
+                                  @RequestParam(value = "minp",  required = false) Double minp,
+                                  @RequestParam(value = "isfbw",  required = false) Boolean isfbw,
+                                  @RequestParam(value = "isfhl",  required = false) Boolean isfhl,
+                                  @RequestParam(value = "isbw",  required = false) Boolean isbw,
+                                  @RequestParam(value = "istj",  required = false) Boolean istj,
+                                  @RequestParam(value = "isglpc",  required = false) Boolean isglpc,
+                                  @RequestParam(value = "isqfh",  required = false) Boolean isqfh,
+                                  @RequestParam(value = "qfhdj",  required = false) Integer qfhdj){
+
+        isfbw = isfbw == null ? false : isfbw;
+        isfhl = isfhl == null ? false : isfhl;
+        isbw = isbw == null ? false : isbw;
+        istj = istj == null ? false : istj;
+        isglpc = isglpc == null ? false : isglpc;
+        isqfh = isqfh == null ? false : isqfh;
+
+        String[] id = ids.split(",");
+        processService.dataProcess(Arrays.asList(id), maxs, mins, maxp, minp, isfbw, isfhl, isbw, istj, isglpc, isqfh, qfhdj);
+
+        return JsonResult.error(ResultCode.SUCCESS);
+    }
+
+    /** 文件 tree
+     * @return
+     */
+    @GetMapping("tree")
+    public JSONObject dataProcessTree(){
+        List<Object> result = processService.dataProcessTree();
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+
+    /**
+     * file 文件数据展示前500行
+     * @param id
+     * @return
+     */
+    @GetMapping("show")
+    public JSONObject dataProcessShow(String id){
+        Map<String, Object> result = processService.dataProcessShow(id);
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+    /**
+     * file 下载
+     * @return
+     */
+    @GetMapping("download")
+    public void dataProcessDownload(HttpServletResponse response, @RequestParam(value = "id", required = false) String id){
+        Powerfittinganalysis obj = powerService.selectItemById(id);
+        FileUtil.download(obj.getPath(), response);
+    }
+
+}

+ 61 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/DateOptionController.java

@@ -0,0 +1,61 @@
+package com.gyee.power.fitting.controller.analyse;
+
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.power.fitting.common.config.GyeeConfig;
+import com.gyee.power.fitting.common.result.JsonResult;
+import com.gyee.power.fitting.common.result.ResultCode;
+import com.gyee.power.fitting.common.util.FileUtil;
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 数据删除、下载...
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/data/option")
+public class DateOptionController {
+
+    @Autowired
+    private GyeeConfig gyeeConfig;
+    @Autowired
+    private PowerfittinganalysisService powerfittinganalysisService;
+
+
+    /** 删除
+     * @return
+     */
+    @GetMapping("delete")
+    public JSONObject dataDelete(String ids){
+        powerfittinganalysisService.deleteList(ids);
+        return JsonResult.success(ResultCode.SUCCESS);
+    }
+
+
+    /**
+     * 文件压缩下载
+     * @return
+     */
+    @GetMapping("download")
+    public void dataProcessDownload(HttpServletResponse response, @RequestParam(value = "ids", required = false) String ids){
+        if (ids.isEmpty())
+            return;
+
+        List<Powerfittinganalysis> objs = powerfittinganalysisService.selectListByIds(ids);
+        List<String> list = objs.stream().map(p -> p.getPath()).collect(Collectors.toList());
+        List<File> files = list.stream().map(File::new).collect(Collectors.toList());
+
+        File zipFile = new File(gyeeConfig.getFilePathDownload()  + "\\" + objs.get(0).getStation() + "_" + System.currentTimeMillis() + ".zip");
+        // 调用压缩方法
+        String ps = FileUtil.zipFiles(files, zipFile);
+        FileUtil.download(ps, response);
+    }
+
+}

+ 32 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/PowerTemperatureController.java

@@ -0,0 +1,32 @@
+package com.gyee.power.fitting.controller.analyse;
+
+
+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 org.springframework.web.bind.annotation.*;
+
+/**
+ * 功率温度分析
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/temperature")
+public class PowerTemperatureController {
+
+    @Autowired
+    private PowerTemperatureService powerTemperatureService;
+
+    /***
+     * 与温度有关的稳定功率
+     * @param ids  预处理数据的id
+     * @return
+     */
+    @GetMapping("rated/power")
+    public JSONObject ratedPower(String ids){
+        Object o = powerTemperatureService.ratedPower(ids);
+        return JsonResult.successData(ResultCode.SUCCESS, o);
+    }
+}

+ 65 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/WindDirectionController.java

@@ -0,0 +1,65 @@
+package com.gyee.power.fitting.controller.analyse;
+
+
+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.socket.RatioService;
+import com.gyee.power.fitting.service.custom.windresource.WindDirectionService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * 风向玫瑰图
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/wind")
+public class WindDirectionController {
+
+    @Autowired
+    private RatioService ratioService;
+
+    @Autowired
+    private WindDirectionService windDirectionService;
+
+    /***
+     * 风向玫瑰图
+     * @param ids  预处理数据的id
+     * @param mode 统计方式   0:单台统计   1:合并统计
+     * @return
+     */
+    @GetMapping("roses")
+    public JSONObject fsRoses(String ids, @RequestParam(value = "mode",  required = false) Integer mode){
+        mode = mode == null ? 0 : mode;
+        Object o = windDirectionService.fxRoses(ids, mode);
+        return JsonResult.successData(ResultCode.SUCCESS, o);
+    }
+
+    /***
+     * 风向频次玫瑰图
+     * @param ids  预处理数据的id
+     * @param mode 统计方式   0:单台统计   1:合并统计
+     * @return
+     */
+    @GetMapping("roses/count")
+    public JSONObject fxRoses(String ids, @RequestParam(value = "mode",  required = false) Integer mode){
+        mode = mode == null ? 0 : mode;
+        Object o = windDirectionService.fxCountRoses(ids, mode);
+        return JsonResult.successData(ResultCode.SUCCESS, o);
+    }
+
+    /**
+     * 对风偏差分析
+     * @param ids  预处理数据 ids
+     * @param mode 拟合方式  0:单台统计   1:合并统计
+     * @return
+     */
+    @GetMapping("deviation/ratio")
+    public JSONObject fsDeviationRatio(String ids, @RequestParam(value = "mode",  required = false) Integer mode){
+        mode = mode == null ? 0 : mode;
+        Object o = ratioService.windDeviationRatio(ids, mode);
+        return JsonResult.successData(ResultCode.SUCCESS, o);
+    }
+}

+ 23 - 0
power-fitting/src/main/java/com/gyee/power/fitting/controller/base/CurveFittingController.java

@@ -0,0 +1,23 @@
+package com.gyee.power.fitting.controller.base;
+
+import com.gyee.power.fitting.common.feign.IAdapterService;
+import com.gyee.power.fitting.service.Windturbinetestingpointai2Service;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+@RestController("curvefitting")
+public class CurveFittingController {
+    @Resource
+    private Windturbinetestingpointai2Service windturbinetestingpointai2Service;
+    @Resource
+    private IAdapterService iAdapterService;
+
+    @GetMapping("/")
+    private void get(@RequestParam("wtid") String wtid){
+        wtid = "HZJ01_01";
+        windturbinetestingpointai2Service.getZlTag(wtid);
+    }
+}

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

@@ -0,0 +1,36 @@
+package com.gyee.power.fitting.controller.base;
+
+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.model.Windpowerstation;
+import com.gyee.power.fitting.model.Windturbine;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 场站风机等基础数据
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/base")
+public class WindInfoController {
+
+    @GetMapping("station")
+    public JSONObject getStation(){
+        List<Windpowerstation> list = InitialRunner.wpList;
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+
+    @GetMapping("windturbine")
+    public JSONObject getWindTurbine(String stationId){
+        List<Windturbine> list = InitialRunner.wpMap.get(stationId);
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+}

+ 13 - 0
power-fitting/src/main/java/com/gyee/power/fitting/mapper/AgcDeviateMapper.java

@@ -0,0 +1,13 @@
+package com.gyee.power.fitting.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.power.fitting.model.Equipmentmodel;
+import com.gyee.power.fitting.model.AgcDeviateModel;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+
+@Mapper
+public interface AgcDeviateMapper extends BaseMapper<AgcDeviateModel> {
+}

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

@@ -0,0 +1,18 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.Equipmentmodel;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Mapper
+public interface EquipmentmodelMapper extends BaseMapper<Equipmentmodel> {
+
+}

+ 21 - 0
power-fitting/src/main/java/com/gyee/power/fitting/mapper/ModelpowerMapper.java

@@ -0,0 +1,21 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.Modelpower;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Mapper
+public interface ModelpowerMapper extends BaseMapper<Modelpower> {
+
+    List<Modelpower> selectList();
+}

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

@@ -0,0 +1,18 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.Modelpowerdetails;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Mapper
+public interface ModelpowerdetailsMapper extends BaseMapper<Modelpowerdetails> {
+
+}

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

@@ -0,0 +1,16 @@
+package com.gyee.power.fitting.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.power.fitting.model.Photovoltaiccapacity;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2022-12-13
+ */
+public interface PhotovoltaiccapacityMapper extends BaseMapper<Photovoltaiccapacity> {
+
+}

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

@@ -0,0 +1,18 @@
+package com.gyee.power.fitting.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.power.fitting.model.Photovoltaiciv;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2022-12-13
+ */
+@Mapper
+public interface PhotovoltaicivMapper extends BaseMapper<Photovoltaiciv> {
+
+}

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

@@ -0,0 +1,18 @@
+package com.gyee.power.fitting.mapper;
+
+import com.gyee.power.fitting.model.Powerfittinganalysis;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-03
+ */
+@Mapper
+public interface PowerfittinganalysisMapper extends BaseMapper<Powerfittinganalysis> {
+
+}

+ 2 - 2
power-fetting/src/main/java/com/gyee/power/fetting/mapper/WindpowerstationMapper.java

@@ -1,8 +1,8 @@
-package com.gyee.power.fetting.mapper;
+package com.gyee.power.fitting.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.gyee.power.fetting.model.Windpowerstation;
+import com.gyee.power.fitting.model.Windpowerstation;
 import org.apache.ibatis.annotations.Mapper;
 
 /**

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

@@ -0,0 +1,18 @@
+package com.gyee.power.fitting.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.power.fitting.model.Windpowerstationtestingpoint2;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2022-12-13
+ */
+@Mapper
+public interface Windpowerstationtestingpoint2Mapper extends BaseMapper<Windpowerstationtestingpoint2> {
+
+}

+ 2 - 2
power-fetting/src/main/java/com/gyee/power/fetting/mapper/WindturbineMapper.java

@@ -1,8 +1,8 @@
-package com.gyee.power.fetting.mapper;
+package com.gyee.power.fitting.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.gyee.power.fetting.model.Windturbine;
+import com.gyee.power.fitting.model.Windturbine;
 import org.apache.ibatis.annotations.Mapper;
 
 /**

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

@@ -0,0 +1,18 @@
+package com.gyee.power.fitting.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.power.fitting.model.Windturbinetestingpointai2;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-01
+ */
+@Mapper
+public interface Windturbinetestingpointai2Mapper extends BaseMapper<Windturbinetestingpointai2> {
+
+}

+ 92 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/AgcDeviateModel.java

@@ -0,0 +1,92 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+
+@TableName("controlsettings")
+public class AgcDeviateModel extends Model<AgcDeviateModel> {
+    /**
+     * 唯一ID
+     */
+    @Id
+    @Column(name = "ID")
+    private String id;
+    /**
+     * key
+     */
+    @Column(name = "KEY")
+    private String key;
+    /**
+     * 时间戳
+     */
+    @Column(name = "TIMESTAMP")
+    private Long timestamp;
+    /**
+     * 说明,描述
+     */
+    @Column(name = "DESCRIPTION")
+    private String description;
+    /**
+     * 值
+     */
+    @Column(name = "VALUE")
+    private String value;
+
+    /**
+     * 是否是备份
+     */
+    @Column(name = "BACKUP")
+    private boolean backup;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public Long getTimestamp() {
+        return timestamp;
+    }
+
+    public void setTimestamp(Long timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public boolean getBackup() {
+        return backup;
+    }
+
+    public void setBackup(boolean backup) {
+        this.backup = backup;
+    }
+
+}

+ 72 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Equipmentmodel.java

@@ -0,0 +1,72 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("EQUIPMENTMODEL")
+public class Equipmentmodel extends Model<Equipmentmodel> {
+
+    private static final long serialVersionUID=1L;
+
+      @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("DESCRIPTION")
+    private String description;
+
+    @TableField("POWERPRODUCTION")
+    private String powerproduction;
+
+    @TableField("CUTINWINDSPEED")
+    private String cutinwindspeed;
+
+    @TableField("RATEDWINDSPEED")
+    private String ratedwindspeed;
+
+    @TableField("CUTOUTWINDSPEED")
+    private String cutoutwindspeed;
+
+    @TableField("WINDTURBINEMANUFACTURERID")
+    private String windturbinemanufacturerid;
+
+    @TableField("PHOTO")
+    private String photo;
+
+    @TableField("UNIT")
+    private String unit;
+
+    //扫风面积
+    @TableField("SWEPTAREA")
+    private Double sweptarea;
+
+    @TableField("EQUIPMENTCATEGORY")
+    private String equipmentcategory;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 47 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Modelpower.java

@@ -0,0 +1,47 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("MODELPOWER")
+public class Modelpower extends Model<Modelpower> {
+
+    private static final long serialVersionUID=1L;
+
+      @TableId("ID")
+    private String id;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("SPEED")
+    private String speed;
+
+    @TableField("THEORYPOWER")
+    private String theorypower;
+
+    @TableField("ENSUREPOWER")
+    private String ensurepower;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 47 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Modelpowerdetails.java

@@ -0,0 +1,47 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-08
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("MODELPOWERDETAILS")
+public class Modelpowerdetails extends Model<Modelpowerdetails> {
+
+    private static final long serialVersionUID=1L;
+
+      @TableId("ID")
+    private String id;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("SPEED")
+    private Double speed;
+
+    @TableField("THEORYPOWER")
+    private Double theorypower;
+
+    @TableField("ENSUREPOWER")
+    private Double ensurepower;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 78 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Photovoltaiccapacity.java

@@ -0,0 +1,78 @@
+package com.gyee.power.fitting.model;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author gfhd
+ * @since 2022-12-13
+ */
+public class Photovoltaiccapacity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private Short branchesnum;
+
+    private Integer platesnum;
+
+    private BigDecimal ratedcapacity;
+
+    private String stationid;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Short getBranchesnum() {
+        return branchesnum;
+    }
+
+    public void setBranchesnum(Short branchesnum) {
+        this.branchesnum = branchesnum;
+    }
+
+    public Integer getPlatesnum() {
+        return platesnum;
+    }
+
+    public void setPlatesnum(Integer platesnum) {
+        this.platesnum = platesnum;
+    }
+
+    public BigDecimal getRatedcapacity() {
+        return ratedcapacity;
+    }
+
+    public void setRatedcapacity(BigDecimal ratedcapacity) {
+        this.ratedcapacity = ratedcapacity;
+    }
+
+    public String getStationid() {
+        return stationid;
+    }
+
+    public void setStationid(String stationid) {
+        this.stationid = stationid;
+    }
+
+    @Override
+    public String toString() {
+        return "Photovoltaiccapacity{" +
+            "id = " + id +
+            ", branchesnum = " + branchesnum +
+            ", platesnum = " + platesnum +
+            ", ratedcapacity = " + ratedcapacity +
+            ", stationid = " + stationid +
+        "}";
+    }
+}

+ 77 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Photovoltaiciv.java

@@ -0,0 +1,77 @@
+package com.gyee.power.fitting.model;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author gfhd
+ * @since 2022-12-13
+ */
+public class Photovoltaiciv implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String windturbineid;
+
+    private Short branchnum;
+
+    private String electric;
+
+    private String description;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getWindturbineid() {
+        return windturbineid;
+    }
+
+    public void setWindturbineid(String windturbineid) {
+        this.windturbineid = windturbineid;
+    }
+
+    public Short getBranchnum() {
+        return branchnum;
+    }
+
+    public void setBranchnum(Short branchnum) {
+        this.branchnum = branchnum;
+    }
+
+    public String getElectric() {
+        return electric;
+    }
+
+    public void setElectric(String electric) {
+        this.electric = electric;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public String toString() {
+        return "Photovoltaiciv{" +
+            "id = " + id +
+            ", windturbineid = " + windturbineid +
+            ", branchnum = " + branchnum +
+            ", electric = " + electric +
+            ", description = " + description +
+        "}";
+    }
+}

+ 86 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Powerfittinganalysis.java

@@ -0,0 +1,86 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("POWERFITTINGANALYSIS")
+public class Powerfittinganalysis extends Model<Powerfittinganalysis> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableField("ID")
+    private String id;
+
+    @TableField("STATION")
+    private String station;
+
+    @TableField("STATIONCN")
+    private String stationcn;
+
+    @TableField("WINDTURBINE")
+    private String windturbine;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("INTERVAL")
+    private String interval;
+
+    @TableField("TIME")
+    private String time;
+
+    @TableField("PATH")
+    private String path;
+
+    @TableField("TYPE")
+    private String type;
+
+    @TableField("PROCESSID")
+    private String processid;
+
+    @TableField("CPAVG")
+    private Double cpavg;
+
+    @TableField("SPEEDAVG")
+    private Double speedavg;
+
+    @TableField("FREQUENCY")
+    private Double frequency;
+
+    @TableField("PCRATIO")
+    private Double pcratio;
+
+    @TableField("PC5RATIO")
+    private Double pc5ratio;
+
+    @TableField("PC10RATIO")
+    private Double pc10ratio;
+
+    @TableField("PC12RATIO")
+    private Double pc12ratio;
+
+    @TableField("PC25RATIO")
+    private Double pc25ratio;
+
+
+
+    @Override
+    protected Serializable pkVal() {
+        return null;
+    }
+
+}

+ 5 - 4
power-fetting/src/main/java/com/gyee/power/fetting/model/Windpowerstation.java

@@ -1,11 +1,12 @@
-package com.gyee.power.fetting.model;
+package com.gyee.power.fitting.model;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.time.LocalDate;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+import java.util.Date;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -84,8 +85,8 @@ public class Windpowerstation extends Model<Windpowerstation> {
     @TableField("HEIGHT")
     private String height;
 
-    @TableField("AQTS")
-    private LocalDate aqts;
+//    @TableField("AQTS")
+//    private Date aqts;
 
 
     @Override

+ 199 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Windpowerstationtestingpoint2.java

@@ -0,0 +1,199 @@
+package com.gyee.power.fitting.model;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author gfhd
+ * @since 2022-12-13
+ */
+public class Windpowerstationtestingpoint2 implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String code;
+
+    private String name;
+
+    private String model;
+
+    private String valueunit;
+
+    private String englishname;
+
+    private String typeid;
+
+    private String modelid;
+
+    private BigDecimal maxval;
+
+    private BigDecimal minval;
+
+    private BigDecimal reasonablemaxval;
+
+    private BigDecimal reasonableminval;
+
+    private String uniformcode;
+
+    private String shortid;
+
+    private String longid;
+
+    private String windpowerstationid;
+
+    private String realtimeid;
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getModel() {
+        return model;
+    }
+
+    public void setModel(String model) {
+        this.model = model;
+    }
+
+    public String getValueunit() {
+        return valueunit;
+    }
+
+    public void setValueunit(String valueunit) {
+        this.valueunit = valueunit;
+    }
+
+    public String getEnglishname() {
+        return englishname;
+    }
+
+    public void setEnglishname(String englishname) {
+        this.englishname = englishname;
+    }
+
+    public String getTypeid() {
+        return typeid;
+    }
+
+    public void setTypeid(String typeid) {
+        this.typeid = typeid;
+    }
+
+    public String getModelid() {
+        return modelid;
+    }
+
+    public void setModelid(String modelid) {
+        this.modelid = modelid;
+    }
+
+    public BigDecimal getMaxval() {
+        return maxval;
+    }
+
+    public void setMaxval(BigDecimal maxval) {
+        this.maxval = maxval;
+    }
+
+    public BigDecimal getMinval() {
+        return minval;
+    }
+
+    public void setMinval(BigDecimal minval) {
+        this.minval = minval;
+    }
+
+    public BigDecimal getReasonablemaxval() {
+        return reasonablemaxval;
+    }
+
+    public void setReasonablemaxval(BigDecimal reasonablemaxval) {
+        this.reasonablemaxval = reasonablemaxval;
+    }
+
+    public BigDecimal getReasonableminval() {
+        return reasonableminval;
+    }
+
+    public void setReasonableminval(BigDecimal reasonableminval) {
+        this.reasonableminval = reasonableminval;
+    }
+
+    public String getUniformcode() {
+        return uniformcode;
+    }
+
+    public void setUniformcode(String uniformcode) {
+        this.uniformcode = uniformcode;
+    }
+
+    public String getShortid() {
+        return shortid;
+    }
+
+    public void setShortid(String shortid) {
+        this.shortid = shortid;
+    }
+
+    public String getLongid() {
+        return longid;
+    }
+
+    public void setLongid(String longid) {
+        this.longid = longid;
+    }
+
+    public String getWindpowerstationid() {
+        return windpowerstationid;
+    }
+
+    public void setWindpowerstationid(String windpowerstationid) {
+        this.windpowerstationid = windpowerstationid;
+    }
+
+    public String getRealtimeid() {
+        return realtimeid;
+    }
+
+    public void setRealtimeid(String realtimeid) {
+        this.realtimeid = realtimeid;
+    }
+
+    @Override
+    public String toString() {
+        return "Windpowerstationtestingpoint2{" +
+            "code = " + code +
+            ", name = " + name +
+            ", model = " + model +
+            ", valueunit = " + valueunit +
+            ", englishname = " + englishname +
+            ", typeid = " + typeid +
+            ", modelid = " + modelid +
+            ", maxval = " + maxval +
+            ", minval = " + minval +
+            ", reasonablemaxval = " + reasonablemaxval +
+            ", reasonableminval = " + reasonableminval +
+            ", uniformcode = " + uniformcode +
+            ", shortid = " + shortid +
+            ", longid = " + longid +
+            ", windpowerstationid = " + windpowerstationid +
+            ", realtimeid = " + realtimeid +
+        "}";
+    }
+}

+ 4 - 3
power-fetting/src/main/java/com/gyee/power/fetting/model/Windturbine.java

@@ -1,11 +1,12 @@
-package com.gyee.power.fetting.model;
+package com.gyee.power.fitting.model;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.time.LocalDate;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+import java.util.Date;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -52,7 +53,7 @@ public class Windturbine extends Model<Windturbine> {
     private String lineid;
 
     @TableField("FIRSTINTEGRATEDTIME")
-    private LocalDate firstintegratedtime;
+    private String firstintegratedtime;
 
     @TableField("PHOTO")
     private String photo;

+ 86 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/Windturbinetestingpointai2.java

@@ -0,0 +1,86 @@
+package com.gyee.power.fitting.model;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author chenmh
+ * @since 2022-11-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("WINDTURBINETESTINGPOINTAI2")
+public class Windturbinetestingpointai2 extends Model<Windturbinetestingpointai2> {
+
+    private static final long serialVersionUID=1L;
+
+      @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("MODEL")
+    private String model;
+
+    @TableField("VALUEUNIT")
+    private String valueunit;
+
+    @TableField("ENGLISHNAME")
+    private String englishname;
+
+    @TableField("TYPEID")
+    private String typeid;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("MAXVAL")
+    private String maxval;
+
+    @TableField("MINVAL")
+    private String minval;
+
+    @TableField("REASONABLEMAXVAL")
+    private String reasonablemaxval;
+
+    @TableField("REASONABLEMINVAL")
+    private String reasonableminval;
+
+    @TableField("WINDTURBINEID")
+    private String windturbineid;
+
+    @TableField("UNIFORMCODE")
+    private String uniformcode;
+
+    @TableField("SHORTID")
+    private String shortid;
+
+    @TableField("LONGID")
+    private String longid;
+
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    @TableField("REALTIMEID")
+    private String realtimeid;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 48 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/agc/AgcDeviateConfig.java

@@ -0,0 +1,48 @@
+package com.gyee.power.fitting.model.agc;
+
+public class AgcDeviateConfig {
+
+    private String id;
+    /**
+     * 装机容量
+     */
+    private float installedCapacity;
+    /**
+     * 场站名称
+     */
+    private String title;
+
+    private AiPoints[] aiPoints;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public float getInstalledCapacity() {
+        return installedCapacity;
+    }
+
+    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;
+    }
+
+    public void setAiPoints(AiPoints[] aiPoints) {
+        this.aiPoints = aiPoints;
+    }
+}

+ 33 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/agc/AgcDeviateTag.java

@@ -0,0 +1,33 @@
+package com.gyee.power.fitting.model.agc;
+
+import java.util.List;
+
+/**
+ * agc曲线偏差数据
+ */
+public class AgcDeviateTag {
+    /**
+     * 数据点名称
+     */
+    private String name;
+    /**
+     * 数据值列表
+     */
+    private List<PointData> values;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public List<PointData> getValues() {
+        return values;
+    }
+
+    public void setValues(List<PointData> values) {
+        this.values = values;
+    }
+}

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

@@ -0,0 +1,56 @@
+package com.gyee.power.fitting.model.agc;
+
+/**
+ * 从数据库的value里面取到需要的值
+ */
+public class AiPoints {
+
+    private String name;
+    /**
+     * 标签点
+     */
+    private String tag;
+    /**
+     * 倍率
+     */
+    private float multiplier;
+    /**
+     * 单位
+     */
+    private String unit;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        if (name == null) {
+            return;
+        }
+        this.name = name.replaceAll(":","");
+    }
+
+    public String getTag() {
+        return tag;
+    }
+
+    public void setTag(String tag) {
+        this.tag = tag;
+    }
+
+    public float getMultiplier() {
+        return multiplier;
+    }
+
+    public void setMultiplier(float multiplier) {
+        this.multiplier = multiplier;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+}

+ 35 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/agc/PointData.java

@@ -0,0 +1,35 @@
+package com.gyee.power.fitting.model.agc;
+
+/**
+ * 测点数据
+ */
+public class PointData {
+    /**
+     * 时间戳
+     */
+    private long ts;
+    /**
+     * 数据
+     */
+    private double doubleValue;
+
+    public long getTs() {
+        return ts;
+    }
+
+    public void setTs(long ts) {
+        this.ts = ts;
+    }
+
+    public double getValue() {
+        return doubleValue;
+    }
+
+    public double getDoubleValue() {
+        return doubleValue;
+    }
+
+    public void setDoubleValue(double doubleValue) {
+        this.doubleValue = doubleValue;
+    }
+}

+ 75 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/anno/AnnotationTool.java

@@ -0,0 +1,75 @@
+package com.gyee.power.fitting.model.anno;
+
+import java.lang.reflect.Field;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * 注解工具类,提供解析注解的方法
+ */
+public class AnnotationTool {
+
+    /**
+     * 获取打了Desc注解的字典属性列表
+     * @return 字典属性列表
+     */
+    public static <T> List<FixedVo> getFixedVoList(Class<T> c) {
+        if (c == null) {
+            return Collections.emptyList();
+        }
+        try {
+            T cls = c.newInstance();
+            Field[] fields = c.getDeclaredFields();
+            List<FixedVo> fixedVoList = new LinkedList<>();
+            for (Field field : fields) {
+                //使私有对象可以访问
+                field.setAccessible(true);
+                Desc desc = field.getAnnotation(Desc.class);
+                if (desc != null) {
+                    FixedVo vo = new FixedVo();
+                    vo.setKey(String.valueOf(field.get(cls)));
+                    vo.setName(field.getName());
+                    vo.setValue(desc.value());
+                    vo.setRemark(desc.remark());
+                    fixedVoList.add(vo);
+                }
+            }
+            return fixedVoList;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Collections.emptyList();
+    }
+
+    /**
+     * 通过反射获取值
+     * @param object
+     * @return
+     */
+    public static List<FixedVo> getValueList(Object object) {
+        if (object == null) {
+            return Collections.emptyList();
+        }
+        try {
+            Field[] fields = object.getClass().getDeclaredFields();
+            List<FixedVo> fixedVoList = new LinkedList<>();
+            for (Field field : fields) {
+                //使私有对象可以访问
+                field.setAccessible(true);
+                Desc desc = field.getAnnotation(Desc.class);
+                if (desc != null) {
+                    FixedVo vo = new FixedVo();
+                    Object o = field.get(object);
+                    vo.setKey(String.valueOf(o));
+                    vo.setRemark(desc.remark());
+                    fixedVoList.add(vo);
+                }
+            }
+            return fixedVoList;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return Collections.emptyList();
+    }
+}

+ 18 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/anno/Desc.java

@@ -0,0 +1,18 @@
+package com.gyee.power.fitting.model.anno;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * 配置通过注解
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Desc {
+
+    String value ();
+    String remark () default "";
+}

+ 22 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/anno/FixedVo.java

@@ -0,0 +1,22 @@
+package com.gyee.power.fitting.model.anno;
+
+import lombok.Data;
+
+/**
+ * 与注解属性对应的类 @Desc
+ */
+@Data
+public class FixedVo {
+
+    public String key;
+    public String name;
+    public String value;
+    public String remark;
+
+
+    @Override
+    public String toString() {
+        return "FixedVo [key=" + key + ", name=" + name +", value=" + value + ", remark="
+                + remark + "]";
+    }
+}

+ 35 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/custom/LineCurveFitting.java

@@ -0,0 +1,35 @@
+package com.gyee.power.fitting.model.custom;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class LineCurveFitting {
+
+    public String name;
+    public List<Point> lines;
+    public List<Point> YLines;
+
+    public List<Point> point;
+    public List<Point> YPoint;
+
+    /// <summary>
+    /// 推力系数
+    /// </summary>
+    public List<Point> CpValue;
+    /// <summary>
+    /// 推力系数平均值
+    /// </summary>
+    public double CpAvg;
+    /// <summary>
+    /// 平均风速
+    /// </summary>
+    public double speed;
+
+    /// <summary>
+    /// 静风频率
+    /// </summary>
+    public double frequency;
+
+}

+ 0 - 0
power-fitting/src/main/java/com/gyee/power/fitting/model/custom/Point.java


Some files were not shown because too many files changed in this diff