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

健康管理产品化计算服务修改

shilin 3 éve
szülő
commit
8b7695e7b2
100 módosított fájl, 10351 hozzáadás és 0 törlés
  1. 130 0
      realtime/datatraining-server-cph/pom.xml
  2. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/DatatrainingMain.java
  3. 149 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/config/GeneratorCodeConfig.java
  4. 46 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/config/V2Config.java
  5. 19 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/controller/auto/EquipmentmodelController.java
  6. 19 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/controller/auto/WindpowerstationtestingpointController.java
  7. 19 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/controller/auto/WindturbinetestingpointController.java
  8. 19 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/controller/auto/WindturbinetestingpointaiController.java
  9. 19 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/controller/auto/WindturbinetestingpointdiController.java
  10. 184 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/init/CacheContext.java
  11. 211 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/init/Constant.java
  12. 27 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/init/InitialConfig.java
  13. 32 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/init/ThreadPoolTaskConfig.java
  14. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/EquipmentmodelMapper.java
  15. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/LineMapper.java
  16. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/ProjectMapper.java
  17. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/Windpowerinfoday3Mapper.java
  18. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/WindpowerinfodayMapper.java
  19. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/WindpowerstationMapper.java
  20. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/WindpowerstationpointnewMapper.java
  21. 17 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/WindturbineMapper.java
  22. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/WindturbinetestingpointnewMapper.java
  23. 66 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Equipmentmodel.java
  24. 53 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Line.java
  25. 70 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Project.java
  26. 574 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Windpowerinfoday.java
  27. 172 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Windpowerinfoday3.java
  28. 87 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Windpowerstation.java
  29. 79 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Windpowerstationpointnew.java
  30. 65 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Windturbine.java
  31. 82 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Windturbinetestingpointnew.java
  32. 538 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/DatatrainingService.java
  33. 17 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IEquipmentmodelService.java
  34. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/ILineService.java
  35. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IProjectService.java
  36. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IWindpowerinfoday3Service.java
  37. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IWindpowerinfodayService.java
  38. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IWindpowerstationService.java
  39. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IWindpowerstationpointnewService.java
  40. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IWindturbineService.java
  41. 16 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IWindturbinetestingpointnewService.java
  42. 20 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/EquipmentmodelServiceImpl.java
  43. 21 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/LineServiceImpl.java
  44. 20 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/ProjectServiceImpl.java
  45. 20 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/Windpowerinfoday3ServiceImpl.java
  46. 20 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/WindpowerinfodayServiceImpl.java
  47. 20 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/WindpowerstationServiceImpl.java
  48. 20 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/WindpowerstationpointnewServiceImpl.java
  49. 21 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/WindturbineServiceImpl.java
  50. 20 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/WindturbinetestingpointnewServiceImpl.java
  51. 229 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/SaticScheduleTask.java
  52. 58 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/StartTaskThread1.java
  53. 56 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/StartTaskThread2.java
  54. 56 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/StartTaskThread3.java
  55. 59 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/StartTaskThread4.java
  56. 56 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/StartTaskThread5.java
  57. 76 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/ThreadPoolTask1.java
  58. 79 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/ThreadPoolTask2.java
  59. 74 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/ThreadPoolTask3.java
  60. 75 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/ThreadPoolTask4.java
  61. 73 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/ThreadPoolTask5.java
  62. 601 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/DateUtils.java
  63. 172 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/HttpClientUtil.java
  64. 210 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/IRealTimeDataBaseUtil.java
  65. 790 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/MongoEdosUtil.java
  66. 24 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/RealTimeDataBaseFactory.java
  67. 116 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/SpringUtils.java
  68. 559 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/StringUtils.java
  69. 46 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/ChangeWeight.java
  70. 90 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/DegradationDegree.java
  71. 75 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/LoadData.java
  72. 258 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/LstmModelBj.java
  73. 241 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/LstmModelWt.java
  74. 66 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/MathRandom.java
  75. 56 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/MatrixCalculation.java
  76. 103 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/Membership.java
  77. 271 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/ModuleState.java
  78. 48 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/ApiGolden.java
  79. 1658 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/EdosUtil.java
  80. 27 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/GoldenConfig.java
  81. 233 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/IEdosUtil.java
  82. 34 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/StringUtil.java
  83. 28 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BaseTsQuery.java
  84. 38 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BasicTsData.java
  85. 29 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BasicTsPoint.java
  86. 24 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BlobTsData.java
  87. 22 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BlobWriteTsData.java
  88. 24 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BooleanTsData.java
  89. 19 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BooleanWriteTsData.java
  90. 18 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/Coordinate.java
  91. 26 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/CoordinateTsData.java
  92. 21 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/CoordinateWriteTsData.java
  93. 30 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/DoubleStatData.java
  94. 25 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/DoubleTsData.java
  95. 19 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/DoubleWriteTsData.java
  96. 38 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/ErrorRequest.java
  97. 27 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/GeneralTsData.java
  98. 8 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/Interpolation.java
  99. 238 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/JsonObjectHelper.java
  100. 0 0
      realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/LongTsData.java

+ 130 - 0
realtime/datatraining-server-cph/pom.xml

@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>realtime</artifactId>
+        <groupId>com.gyee</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>datatraining-server-cph</artifactId>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-math3</artifactId>
+            <version>3.6.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.10</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.freemarker</groupId>
+            <artifactId>freemarker</artifactId>
+            <version>2.3.28</version>
+        </dependency>
+        <!--mysql-connector-java-->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.oracle</groupId>
+            <artifactId>ojdbc6</artifactId>
+            <version>11.2.0.3</version>
+        </dependency>
+        <dependency>
+            <groupId>com.microsoft.sqlserver</groupId>
+            <artifactId>sqljdbc4</artifactId>
+            <version>4.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.gyee</groupId>
+            <artifactId>common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.17</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-configuration-processor</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.gyee</groupId>
+            <artifactId>mr</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>slf4j-log4j12</artifactId>
+                    <groupId>org.slf4j</groupId>
+                </exclusion>
+            </exclusions>
+
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/DatatrainingMain.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @ClassName : DatatrainingMain
+ **/
+@SpringBootApplication
+@MapperScan("com.gyee.datatraining.mapper")
+public class DatatrainingMain {
+    public static void main(String[] args) {
+        SpringApplication.run(DatatrainingMain.class, args);
+    }
+}

+ 149 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/config/GeneratorCodeConfig.java

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

+ 46 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/config/V2Config.java

@@ -0,0 +1,46 @@
+package com.gyee.datatraining.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * 读取项目相关配置
+ * 
+ * @author gyee
+ */
+@Component
+@ConfigurationProperties(prefix = "gyee")
+public class V2Config
+{
+
+    /** 实时数据库 **/
+    private  static String realtimedataBase;
+    /**数据适配器网址 **/
+    private static String baseurl;
+    /**测点初始码**/
+    private  static  String initialcode;
+
+    public static String getInitialcode() {
+        return initialcode;
+    }
+
+    public  void setInitialcode(String initialcode) {
+        V2Config.initialcode = initialcode;
+    }
+
+    public static String getRealtimedataBase() {
+        return realtimedataBase;
+    }
+
+    public  void setRealtimedataBase(String realtimedataBase) {
+        V2Config.realtimedataBase = realtimedataBase;
+    }
+
+    public static String getBaseurl() {
+        return baseurl;
+    }
+
+    public  void setBaseurl(String baseurl) {
+        V2Config.baseurl = baseurl;
+    }
+}

+ 19 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/controller/auto/EquipmentmodelController.java

@@ -0,0 +1,19 @@
+package com.gyee.datatraining.controller.auto;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-01-11
+ */
+@RestController
+@RequestMapping("//equipmentmodel")
+public class EquipmentmodelController {
+
+}

+ 19 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/controller/auto/WindpowerstationtestingpointController.java

@@ -0,0 +1,19 @@
+package com.gyee.datatraining.controller.auto;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-01-10
+ */
+@RestController
+@RequestMapping("//windpowerstationtestingpoint")
+public class WindpowerstationtestingpointController {
+
+}

+ 19 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/controller/auto/WindturbinetestingpointController.java

@@ -0,0 +1,19 @@
+package com.gyee.datatraining.controller.auto;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-09-29
+ */
+@RestController
+@RequestMapping("//windturbinetestingpoint")
+public class WindturbinetestingpointController {
+
+}

+ 19 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/controller/auto/WindturbinetestingpointaiController.java

@@ -0,0 +1,19 @@
+package com.gyee.datatraining.controller.auto;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-01-10
+ */
+@RestController
+@RequestMapping("//windturbinetestingpointai")
+public class WindturbinetestingpointaiController {
+
+}

+ 19 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/controller/auto/WindturbinetestingpointdiController.java

@@ -0,0 +1,19 @@
+package com.gyee.datatraining.controller.auto;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-01-10
+ */
+@RestController
+@RequestMapping("//windturbinetestingpointdi")
+public class WindturbinetestingpointdiController {
+
+}

+ 184 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/init/CacheContext.java

@@ -0,0 +1,184 @@
+package com.gyee.datatraining.init;
+
+
+import com.gyee.datatraining.model.auto.*;
+import com.gyee.datatraining.service.auto.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : CacheContext
+ * @Author : xieshengjie
+ * @Date: 2021/9/29 17:33
+ * @Description : 初始化
+ */
+@Component
+public class CacheContext implements CommandLineRunner {
+
+
+    private static final Logger log = LoggerFactory.getLogger(CacheContext.class);
+
+    @Autowired
+    private IWindturbineService windturbineService;
+    @Autowired
+    private IWindpowerstationService windpowerstationService;
+    @Autowired
+    private IProjectService projectService;
+    @Autowired
+    private ILineService lineService;
+    @Autowired
+    private IEquipmentmodelService equipmentmodelService;
+    @Autowired
+    private IWindturbinetestingpointnewService windturbinetestingpointnewService;
+    @Autowired
+    private IWindpowerstationpointnewService windpowerstationpointnewService;
+
+    public static Map<String, Windturbine> wtmap = new HashMap<String, Windturbine>(); // 风电机MAP
+
+
+    public static Map<String, Windpowerstation> wpmap = new HashMap<>();
+
+    public static  List<Windpowerstation> wpls =  new ArrayList<Windpowerstation>(); // 风电场LIST集合
+
+    public static List<Windturbine> wtls = new ArrayList<Windturbine>(); // 风电机LIST集合
+
+    public static Map<String, Map<String, Windturbinetestingpointnew>> wtpAimap = new HashMap<>();// 风电机测点AI表
+
+    public static Map<String,Map<String, Windpowerstationpointnew>> wppointmap =new HashMap<>();
+
+    public static List<Project> pjls = new ArrayList<>();
+
+    public static List<Line> lines = new ArrayList<>();
+    public static Map<String, Project> pjmap = new HashMap<String, Project>(); // 项目MAP
+    public static Map<String, Line> lnmap = new HashMap<String, Line>(); // 线路MAP
+    public static Map<String, List<Windturbine>> wtsmap = new HashMap<String, List<Windturbine>>(); // 风电场MAP风电机LIST集合
+
+    public static List<Equipmentmodel> mlls = new ArrayList<Equipmentmodel>();// 风电机模型LIST集合
+    public static Map<String, Equipmentmodel> mlmap = new HashMap<String, Equipmentmodel>();// 风电机模型
+    @Override
+    public void run(String... args) throws Exception {
+
+        log.info("-------------------------------缓存开始--------------------------------------");
+
+        List<Windpowerstation> wptempls = windpowerstationService.list();
+        wptempls.stream().filter(i->i.getCompanyid().equals("1")).forEach(i->{
+            wpls.add(i);
+            wpmap.put(i.getId(),i);
+        });
+
+         List<Project> pjtempls  = projectService.list();
+
+        if (!pjtempls.isEmpty()) {
+            pjtempls.stream().filter(i->wpmap.containsKey(i.getWindpowerstationid())).forEach(i->{
+                pjls.add(i);
+                pjmap.put(i.getId(),i);
+            });
+        }
+        List<Line> templines = lineService.list();
+        if (!templines.isEmpty()) {
+            templines.stream().filter(i->pjmap.containsKey(i.getProjectid())).forEach(i->{
+                lines.add(i);
+                lnmap.put(i.getId(),i);
+            });
+        }
+        List<Windturbine> wttempls =windturbineService.list();
+        if (!wttempls.isEmpty()) {
+            wttempls.stream().filter(i->wpmap.containsKey(i.getWindpowerstationid())).forEach(i->{
+                wtls.add(i);
+            });
+        }
+        mlls = equipmentmodelService.list();
+        if (!mlls.isEmpty()) {
+            for (Equipmentmodel model : mlls) {
+                mlmap.put(model.getId(), model);
+            }
+        }
+
+
+        if (!wtls.isEmpty()) {
+            List<Windturbine> list = null;
+            for (Windturbine wt : wtls) {
+                wtmap.put(wt.getId(), wt);
+                if (wtsmap.containsKey(wt.getWindpowerstationid())) {
+                    list = wtsmap.get(wt.getWindpowerstationid());
+                    list.add(wt);
+                } else {
+                    list = new ArrayList<Windturbine>();
+                    list.add(wt);
+                    wtsmap.put(wt.getWindpowerstationid(), list);
+                }
+            }
+        }
+        List<Windturbinetestingpointnew> WindturbinetestingpointnewList = windturbinetestingpointnewService.list();
+        Map<String, Windturbinetestingpointnew> map = null;
+
+        if(WindturbinetestingpointnewList != null && !WindturbinetestingpointnewList.isEmpty()){
+            for(Windturbinetestingpointnew mp : WindturbinetestingpointnewList){
+                if(wtpAimap.containsKey(mp.getWindturbineid())){
+                    map = wtpAimap.get(mp.getWindturbineid());
+                    map.put(mp.getUniformcode(), mp);
+                }else{
+                    map = new HashMap<String, Windturbinetestingpointnew>();
+                    map.put(mp.getUniformcode(), mp);
+                    wtpAimap.put(mp.getWindturbineid(), map);
+                }
+            }
+        }
+
+
+        List<Windpowerstationpointnew> wplist = windpowerstationpointnewService.list();
+        for (Windpowerstationpointnew Windpowerstationpointnew : wplist) {
+            if (wppointmap.containsKey(Windpowerstationpointnew.getWindpowerstationid())){
+                wppointmap.get(Windpowerstationpointnew.getWindpowerstationid()).put(Windpowerstationpointnew.getUniformcode(),Windpowerstationpointnew);
+            }else{
+                Map<String,Windpowerstationpointnew> wpmap = new HashMap<>();
+                wpmap.put(Windpowerstationpointnew.getUniformcode(),Windpowerstationpointnew);
+                wppointmap.put(Windpowerstationpointnew.getWindpowerstationid(),wpmap);
+            }
+        }
+
+        log.info("-------------------------------缓存结束--------------------------------------");
+    }
+//  取redis
+//    private Logger logger = LoggerFactory.getLogger(CacheContext.class);
+//    @Resource
+//    private IWindturbinetestingpointService windturbinetestingpointService;
+//    @Resource
+//    private RedisService redisService;
+//
+//    public static Map<String, Map<String, Windturbinetestingpoint>> wtpAimap = new HashMap<>();// 风电机测点表
+//
+//    @Override
+//    public void run(String... args) {
+//        logger.info("--------------------------------缓存开始--------------------------------");
+//        if (redisService.hasKey("WT")){
+//            String wt = redisService.get("WT");
+//            wtpAimap = (Map<String, Map<String, Windturbinetestingpoint>>) JSONUtils.parse(wt);
+//        }else {
+//            List<Windturbinetestingpoint> windturbinetestingpointList = windturbinetestingpointService.list();
+//            Map<String, Windturbinetestingpoint> map = null;
+//
+//            if(windturbinetestingpointList != null && !windturbinetestingpointList.isEmpty()){
+//                for(Windturbinetestingpoint mp : windturbinetestingpointList){
+//                    if(wtpAimap.containsKey(mp.getWindturbineid())){
+//                        map = wtpAimap.get(mp.getWindturbineid());
+//                        map.put(mp.getUniformcode(), mp);
+//                    }else{
+//                        map = new HashMap<String, Windturbinetestingpoint>();
+//                        map.put(mp.getUniformcode(), mp);
+//                        wtpAimap.put(mp.getWindturbineid(), map);
+//                    }
+//                }
+//            }
+//        }
+//        logger.info("--------------------------------缓存结束--------------------------------");
+//    }
+}

+ 211 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/init/Constant.java

@@ -0,0 +1,211 @@
+package com.gyee.datatraining.init;
+
+/**
+ * 
+ * 
+ * 项目名称:nxfd 类名称:Constant 类描述: 创建人:石林 创建时间:2014-3-4 上午10:07:03 修改人:shilinno1
+ * 修改时间:2014-3-4 上午10:07:03 修改备注:
+ * 
+ * @version
+ * 
+ */
+public class Constant {
+    /**
+     * EdnaAPI 时间间隔
+     */
+    public static final Long EDNAAPI_PRIED = 30l;
+    public static final Long TOP_PRIED = 1800l;
+
+    public static final String TPOINT_ALL_RFDL = "RFDL"; // 汇总日发电量
+    public static final String TPOINT_ALL_YFDL = "YFDL"; // 汇总月发电量
+    public static final String TPOINT_ALL_NFDL = "NFDL"; // 汇总年发电量
+    public static final String TPOINT_ALL_SJGL = "RPJGL"; // 汇总日实际功率
+    public static final String TPOINT_ALL_PJFS = "RPJFS"; // 汇总日平均风速
+
+    public static final String TPOINT_WP_FGLYC = "FCFGCDQ0001,FCFGCDQ0003,FCFGCDQ0005,FCFGCDQ0007,FCFGCDQ0009,FCFGCDQ0011,FCFGCDQ0013,FCFGCDQ0015";
+    public static final String TPOINT_WP_FGLYC2 = "FCFGCDQ0002,FCFGCDQ0004,FCFGCDQ0006,FCFGCDQ0008,FCFGCDQ0010,FCFGCDQ0012,FCFGCDQ0014,FCFGCDQ0016";
+    public static final String TPOINT_WP_FGLYC24 = "FCFGCDQ0004,FCFGCDQ0008,FCFGCDQ0012,FCFGCDQ0016";
+    public static final String ycPoints2 = "FCFGCDQ0001,FCFGCDQ0002,FCFGCDQ0003,FCFGCDQ0004,FCFGCDQ0005,FCFGCDQ0006,FCFGCDQ0007,FCFGCDQ0008,FCFGCDQ0009,FCFGCDQ0010,FCFGCDQ0011,FCFGCDQ0012,FCFGCDQ0013,FCFGCDQ0014,FCFGCDQ0015,FCFGCDQ0016";
+    public static final String TPOINT_WP_YCGL = "RPJGL"; // 风场预测功率短期次天00:00:00
+    public static final String TPOINT_WP_PJFS = "RPJFS"; // 电场日平均风速
+
+    public static final String TPOINT_WP_SWDL = "SWDLB"; // 风场上网电量
+    public static final String TPOINT_WP_GWDL = "GWGWB"; // 风场购网电量
+    public static final String TPOINT_WP_NWGWDL = "NWGWB"; // 农网购网电量
+    /**
+     * 空气温度
+     */
+    public static final String TPOINT_WP_FCCFTWD = "FCCFTWD";// 温度
+
+    public static int WAITING_STATUS = 0;// 待机
+    public static int RUN_STATUS = 1;// 并网
+    public static int FAULT_STATUS = 2;// 故障停机
+    public static int INTERRUPTION_STATUS = 3;// 通讯中断
+    public static int MAINTENANCE_STATUS = 4;// 维护停机
+    public static String FAULT_NAME = "故障";
+    public static String MAINTENANCE_NAME = "维护";
+    public static String WAITING_NAME = "待机";
+    public static String RUN_NAME = "运行";
+    public static String INTERRUPTION_NAME = "离线";
+
+    public static final String TPOINT_WP_SJGL = "SSZGL"; // 日实际功率
+    public static final String TPOINT_WP_SFDL = "SFDL";// 总发电量(升压站)
+    public static final String TPOINT_WP_SSFS = "SSFS"; // 实时平均风速
+    public static final String TPOINT_WP_RFDL = "RFDLB"; // 日发电量
+    public static final String TPOINT_WP_YFDL = "YFDLB"; // 月发电量
+    public static final String TPOINT_WP_NFDL = "NFDLB"; // 年发电量
+
+    public static final String TPOINT_WT_RFDL = "RFDL";// 风机日发电量与SCADA日风场发电量
+    public static final String TPOINT_WT_DCRFDL = "AI064";// 导出单机发电量
+    public static final String TPOINT_WT_YFDL = "YFDL";// 风机月发电量
+    public static final String TPOINT_WT_NFDL = "NFDL";// 风机年发电量
+
+    public static final String TPOINT_WT_RFDL2 = "RFDLREAD";// 逆变器日发电量
+
+    public static final String TPOINT_WT_XDTS = "XDTS";// 限电台数
+    public static final String TPOINT_WT_YXTS = "YXTS";// 运行台数
+    public static final String TPOINT_WT_DJTS = "DJTS"; // 待机台数
+    public static final String TPOINT_WT_WHTJ = "WHTJ";// 维护台数
+    public static final String TPOINT_WT_GZTJ = "GZTJ";// 故障台数
+    public static final String TPOINT_WT_TXZD = "TXZD";// 离线台数
+
+    public static final String TPOINT_WT_U1YZDL = "AI061";// U1项绕组电流
+    public static final String TPOINT_WT_U2YZDL = "AI062";// U2项绕组电流
+    public static final String TPOINT_WT_U3YZDL = "AI063";// U3项绕组电流
+    public static final String TPOINT_WT_U1YZDY = "AI058";// U1项绕组电压
+    public static final String TPOINT_WT_U2YZDY = "AI059";// U2项绕组电压
+    public static final String TPOINT_WT_U3YZDY = "AI060";// U3项绕组电压
+    public static final String TPOINT_WT_FDJZS = "AI128";// 发电机转速
+    public static final String TPOINT_WT_U1YZWD = "AI045";// U1绕组温度
+    public static final String TPOINT_WT_V1YZWD = "AI047";// V1绕组温度
+    public static final String TPOINT_WT_W1YZWD = "AI049";// W1绕组温度
+    public static final String TPOINT_WT_YLZS = "AI012";// 叶轮转速
+    public static final String TPOINT_WT_FJJJJ = "AI085";// 风机浆距角
+	public static final String TPOINT_WT_DWZWD = "AI038";// 齿轮箱轴1温度
+    public static final String TPOINT_WT_GWZWD = "AI039";// 齿轮箱轴2温度
+    public static final String TPOINT_WT_CLXWD = "AI041";// 齿轮箱油温
+    public static final String TPOINT_WT_BJJD1 = "AI076";// 变桨角度1
+    public static final String TPOINT_WT_PHWZ = "AI034";// 偏航位置
+    public static final String TPOINT_WT_PJFS = "RPJFS"; // 日平均风速
+    public static final String TPOINT_WT_FJGL = "AI130";// 风机功率
+    public static final String TPOINT_WT_PJGL = "RPJGL";// 风机平均功率
+    public static final String TPOINT_WT_GLYS = "AI067";// 功率因数
+    public static final String TPOINT_WT_JCWWD = "AI056";// 机舱外温度
+    public static final String TPOINT_WT_JCWD = "AI057";// 机舱温度
+    public static final String TPOINT_WT_TDGWD = "AI069";// 塔底柜温度
+    public static final String TPOINT_WT_JCGWD = "AI069";// 机舱柜温度
+    public static final String TPOINT_WT_FJFX = "AI008";// 风机风向
+    public static final String TPOINT_WT_DFJD = "AI036";// 对风角度
+    public static final String TPOINT_WT_FJPL = "AI068";// 风机频率
+    public static final String TPOINT_WT_WGGL = "AI131";// 无功功率
+    public static final String TPOINT_WT_FJKYL = "AI001";// 风机可用率
+    public static final String TPOINT_WT_FJZSXZ = "AI051";// 风机转速限值
+    public static final String TPOINT_WT_FJSSFS = "AI022";// 风机实时风速
+
+    public static final String TPOINT_WT_FDJZCAWD = "AI052";// 发电机轴承A温度
+    public static final String TPOINT_WT_FDJZCBWD = "AI053";// 发电机轴承B温度
+
+    public static final String TPOINT_WT_FJGLKZXZ = "AI426";// UP97 取值 功率控制限值
+    public static final String TPOINT_WT_LLGL = "BZGL";// 风机理论功率
+    public static final String TPOINT_WT_YFGL = "ZSGL";// 风机应发功率
+    public static final String TPOINT_WT_RFDLBZ = "RFDLZS";// 日理论发电量
+
+    // public static final String TPOINT_WT_RFDLBZ = "RFDLLL";//日理论发电量
+
+    public static final String TPOINT_WT_RFDLZS = "RFDLZS";// 日应发电量
+
+    public static final String TPOINT_WT_NBQJLDY = "AIG061";// 逆变器交流电压
+    public static final String TPOINT_WT_NBQJLDL = "AIG060";// 逆变器交流电流
+    public static final String TPOINT_WT_NBQZLDY = "AIG081";// 逆变器直流电压
+    public static final String TPOINT_WT_NBQZLDL = "AIG078";// 逆变器直流电流
+
+    public static final String TPOINT_WT_NBQPL = "AIG073";// 逆变器频率
+    public static final String TPOINT_WT_NBQGLYSSZ = "AIG069";// 功率因数设置
+    public static final String TPOINT_WT_NBQGLYSSZ2 = "AIG104";// 功率因数设置
+    public static final String TPOINT_WT_NBQZFDL = "AIG064";// 逆变相总发电量
+    public static final String TPOINT_WT_NBQKQWD = "AIG071";// 逆变器空气温度
+    public static final String TPOINT_WT_NBQXL = "AIG072";// 逆变器效率
+
+    public static final String RFDLD = "RFDLD"; // 日理论发电量
+    public static final String RFDLE = "RFDLE"; // 日应发发电量
+    public static final String FJZT = "FJZT"; // 风场状态
+
+    public static final String ZBZGL = "ZBZGL";// 理论功率
+    public static final String ZSGLZZSGL = "ZZSGL";// 应发功率
+
+    public static final String RLZSSDL = "RLZSSDL"; // 日场内受累检修
+    public static final String RSZSSDL = "RSZSSDL"; // 日场内受累故障
+    public static final String RWZSSDL = "RWZSSDL"; // 日场外受累电网
+    public static final String RTZSSDL = "RTZSSDL"; // 日场外受累天气
+
+    public static final String YLZSSDL = "YLZSSDL"; // 月场内受累检修
+    public static final String YSZSSDL = "YSZSSDL"; // 月场内受累故障
+    public static final String YWZSSDL = "YWZSSDL"; // 月场外受累电网
+    public static final String YTZSSDL = "YTZSSDL"; // 月场外受累天气
+
+    public static final String NLZSSDL = "NLZSSDL"; // 年场内受累检修
+    public static final String NSZSSDL = "NSZSSDL"; // 年场内受累故障
+    public static final String NWZSSDL = "NWZSSDL"; // 年场外受累电网
+    public static final String NTZSSDL = "NTZSSDL"; // 年场外受累天气
+
+    public static final String RQFSSDL = "RQFSSDL"; // 日欠发损失电量
+    public static final String RGZSSDL = "RGZSSDL"; // 日故障损失电量
+    public static final String RJXSSDL = "RJXSSDL"; // 日检修损失电量
+    public static final String RXDSSDL = "RXDSSDL"; // 日限电损失电量
+
+    public static final String YQFSSDL = "YQFSSDL"; // 月欠发损失电量
+    public static final String YGZSSDL = "YGZSSDL"; // 月故障损失电量
+    public static final String YJXSSDL = "YJXSSDL"; // 月检修损失电量
+    public static final String YXDSSDL = "YXDSSDL"; // 月限电损失电量
+
+    public static final String NQFSSDL = "NQFSSDL"; // 年欠发损失电量
+    public static final String NGZSSDL = "NGZSSDL"; // 年故障损失电量
+    public static final String NJXSSDL = "NJXSSDL"; // 年检修损失电量
+    public static final String NXDSSDL = "NXDSSDL"; // 年限电损失电量
+
+    public static final String FCCFTFS10 = "FCCFTFS10";// 测风塔10米风速
+    public static final String FCCFTFS30 = "FCCFTFS30";// 测风塔30米风速
+    public static final String FCCFTFS50 = "FCCFTFS50";// 测风塔50米风速
+    public static final String FCCFTFS60 = "FCCFTFS60";// 测风塔60米风速
+    public static final String FCCFTFS70 = "FCCFTFS70";// 测风塔70米风速
+    public static final String FCCFTFS80 = "FCCFTFS80";// 测风塔80米风速
+
+    public static final String FCCFTFX10 = "FCCFTFX10";// 测风塔10米风向
+    public static final String FCCFTFX30 = "FCCFTFX30";// 测风塔30米风向
+    public static final String FCCFTFX50 = "FCCFTFX50";// 测风塔50米风向
+    public static final String FCCFTFX60 = "FCCFTFX60";// 测风塔60米风向
+    public static final String FCCFTFX70 = "FCCFTFX70";// 测风塔70米风向
+    public static final String FCCFTFX80 = "FCCFTFX80";// 测风塔80米风向
+
+    public static final String FCCFTWD = "FCCFTWD";// 测风塔温度
+    public static final String FCCFTSD = "FCCFTSD";// 测风塔湿度
+    public static final String FCCFTYQ = "FCCFTYQ";// 测风塔压强
+    
+    public static final String FJJKJL = "JKJL001";//风机健康状态值
+    public static final String CLXJKJL = "JKJL002";//齿轮箱健康状态值
+    public static final String FDJJKJL = "JKJL003";//发电机健康状态值
+    public static final String BJJKJL = "JKJL004";//变浆健康值
+    public static final String ZKJKJL = "JKJL005";//主控健康状态值
+    
+    public static final String FJLHSL = "JKSLLH001";//风机良好健康状态数量
+    public static final String FJZCSL = "JKSLHG001";//风机正常健康状态数量
+    public static final String FJZYSL = "JKSLZY001";//风机注意健康状态数量
+    public static final String FJYZSL = "JKSLYZ001";//风机严重健康状态数量
+    
+    public static final String YCFJJKZT4HOUR = "JKYC001";//风机健康状态未来4小时
+    public static final String YCFJJKZT1DAY = "JKYC006";//风机健康状态未来1天
+    public static final String YCFJJKZT3DAY = "JKYC011";//风机健康状态未来3天
+    public static final String YCFJJKZT7DAY = "JKYC016";//风机健康状态未来7天
+    public static final String YCFJJKZT1MONTH = "JKYC021";//风机健康状态未来1个月
+    
+    public static final String FJJKZZ = "JKZT100";//风机健康总状态得分
+    
+    public static final String FJJKZT = "JKZT001";//风机健康状态
+    public static final String CLXJKZT = "JKZT002";//齿轮箱健康状态
+    public static final String FDJJKZT = "JKZT003";//发电机健康状态
+    public static final String BJJKZT = "JKZT004";//变浆健康
+    public static final String ZKJKZT = "JKZT005";//主控健康状态
+    
+    
+    
+}

+ 27 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/init/InitialConfig.java

@@ -0,0 +1,27 @@
+package com.gyee.datatraining.init;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * 读取项目相关配置
+ * 
+ * @author gyee
+ */
+@Component
+@ConfigurationProperties(prefix = "edos")
+public class InitialConfig
+{
+
+    /**数据适配器网址 **/
+    private static String baseurl;
+
+    public static String getBaseurl() {
+        return baseurl;
+    }
+
+    public  void setBaseurl(String baseurl) {
+        InitialConfig.baseurl = baseurl;
+    }
+}
+

+ 32 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/init/ThreadPoolTaskConfig.java

@@ -0,0 +1,32 @@
+package com.gyee.datatraining.init;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ThreadPoolExecutor;
+
+/**
+ * 1. 当一个任务被提交到线程池时,首先查看线程池的核心线程是否都在执行任务,否就选择一条线程执行任务,是就执行第二步。
+ * 2. 查看核心线程池是否已满,不满就创建一条线程执行任务,否则执行第三步。
+ * 3. 查看任务队列是否已满,不满就将任务存储在任务队列中(SynchronousQueue同步队直接执行第四步),否则执行第四步。
+ * 4. 查看线程池是否已满,不满就创建一条线程执行任务,否则就按照策略处理无法执行的任务。
+ */
+@Configuration
+public class ThreadPoolTaskConfig {
+
+    @Bean
+    public Executor executor(){
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        //此方法返回可用处理器的虚拟机的最大数量; 不小于1
+        int core = Runtime.getRuntime().availableProcessors();
+        executor.setCorePoolSize(core);//设置核心线程数
+        executor.setMaxPoolSize(core*2 + 1);//设置最大线程数
+        executor.setKeepAliveSeconds(3);//除核心线程外的线程存活时间
+        executor.setQueueCapacity(40);//如果传入值大于0,底层队列使用的是LinkedBlockingQueue,否则默认使用SynchronousQueue
+        executor.setThreadNamePrefix("thread-execute");//线程名称前缀
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());//设置拒绝策略
+        return executor;
+    }
+}

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/EquipmentmodelMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.mapper.auto;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.datatraining.model.auto.Equipmentmodel;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-01-11
+ */
+public interface EquipmentmodelMapper extends BaseMapper<Equipmentmodel> {
+
+}

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/LineMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.mapper.auto;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.datatraining.model.auto.Line;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-06-21
+ */
+public interface LineMapper extends BaseMapper<Line> {
+
+}

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/ProjectMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.mapper.auto;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.datatraining.model.auto.Project;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-06-21
+ */
+public interface ProjectMapper extends BaseMapper<Project> {
+
+}

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/Windpowerinfoday3Mapper.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.mapper.auto;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.datatraining.model.auto.Windpowerinfoday3;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-07-26
+ */
+public interface Windpowerinfoday3Mapper extends BaseMapper<Windpowerinfoday3> {
+
+}

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/WindpowerinfodayMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.mapper.auto;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.datatraining.model.auto.Windpowerinfoday;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-07-26
+ */
+public interface WindpowerinfodayMapper extends BaseMapper<Windpowerinfoday> {
+
+}

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/WindpowerstationMapper.java

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

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/WindpowerstationpointnewMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.mapper.auto;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.datatraining.model.auto.Windpowerstationpointnew;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-03-08
+ */
+public interface WindpowerstationpointnewMapper extends BaseMapper<Windpowerstationpointnew> {
+
+}

+ 17 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/WindturbineMapper.java

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

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/mapper/auto/WindturbinetestingpointnewMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.mapper.auto;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.datatraining.model.auto.Windturbinetestingpointnew;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-03-08
+ */
+public interface WindturbinetestingpointnewMapper extends BaseMapper<Windturbinetestingpointnew> {
+
+}

+ 66 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Equipmentmodel.java

@@ -0,0 +1,66 @@
+package com.gyee.datatraining.model.auto;
+
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-01-11
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("EQUIPMENTMODEL")
+public class Equipmentmodel extends Model {
+
+    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 Double powerproduction;
+
+    @TableField("CUTINWINDSPEED")
+    private Double cutinwindspeed;
+
+    @TableField("RATEDWINDSPEED")
+    private Double 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 Double equipmentcategory;
+
+
+}

+ 53 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Line.java

@@ -0,0 +1,53 @@
+package com.gyee.datatraining.model.auto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-06-21
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("LINE")
+public class Line extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("ANAME")
+    private String aname;
+
+    @TableField("PROJECTID")
+    private String projectid;
+
+    @TableField("ORDERNUM")
+    private Double ordernum;
+
+    @TableField("CAPACITY")
+    private Double capacity;
+
+    @TableField("CAPACITYUNIT")
+    private String capacityunit;
+
+    @TableField("QUANTITY")
+    private Double quantity;
+
+
+}

+ 70 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Project.java

@@ -0,0 +1,70 @@
+package com.gyee.datatraining.model.auto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-06-21
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("PROJECT")
+public class Project extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("ANAME")
+    private String aname;
+
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    @TableField("CAPACITY")
+    private Double capacity;
+
+    @TableField("CAPACITYUNIT")
+    private String capacityunit;
+
+    @TableField("QUANTITY")
+    private Double quantity;
+
+    @TableField("MODEL")
+    private String model;
+
+    @TableField("COMMISSIONDATE")
+    private Date commissiondate;
+
+    @TableField("MASTERPHONE")
+    private String masterphone;
+
+    @TableField("SHIFTFOREMAN")
+    private String shiftforeman;
+
+    @TableField("SHIFTFOREMANPHONE")
+    private String shiftforemanphone;
+
+    @TableField("ORDERNUM")
+    private Double ordernum;
+
+
+}

+ 574 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Windpowerinfoday.java

@@ -0,0 +1,574 @@
+package com.gyee.datatraining.model.auto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-07-26
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WINDPOWERINFODAY")
+public class Windpowerinfoday extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @TableId("ID")
+    private Long id;
+
+    /**
+     * 外键编号
+     */
+    @TableField("FOREIGNKEYID")
+    private String foreignkeyid;
+
+    /**
+     * 运行小时
+     */
+    @TableField("RUNHOURS")
+    private Double runhours;
+
+    /**
+     * 停机小时
+     */
+    @TableField("STOPHOURS")
+    private Double stophours;
+
+    /**
+     * 故障小时
+     */
+    @TableField("FAULTHOURS")
+    private Double faulthours;
+
+    /**
+     * 维护小时
+     */
+    @TableField("MAINTAINHOURS")
+    private Double maintainhours;
+
+    /**
+     * 通讯中断小时
+     */
+    @TableField("INTERRUPTHOURS")
+    private Double interrupthours;
+
+    /**
+     * 发电量(SCADA)
+     */
+    @TableField("GENERATINGCAPACITY")
+    private Double generatingcapacity;
+
+    /**
+     * 风速
+     */
+    @TableField("SPEED")
+    private Double speed;
+
+    /**
+     * 功率
+     */
+    @TableField("POWER")
+    private Double power;
+
+    /**
+     * 日期
+     */
+    @TableField("RECORDDATE")
+    private Date recorddate;
+
+    /**
+     * 上网电量
+     */
+    @TableField("GRIDELECTRICITY")
+    private Double gridelectricity;
+
+    /**
+     * 工网购网电量
+     */
+    @TableField("BUYELECTRICITY")
+    private Double buyelectricity;
+
+    /**
+     * 场内停机
+     */
+    @TableField("INSTOP")
+    private Double instop;
+
+    /**
+     * 场外停机
+     */
+    @TableField("OUTSTOP")
+    private Double outstop;
+
+    /**
+     * 运行时间(计算过)
+     */
+    @TableField("RUNTIME")
+    private Double runtime;
+
+    /**
+     * 停机时间(计算过)
+     */
+    @TableField("STOPTIME")
+    private Double stoptime;
+
+    /**
+     * 故障时间(计算过)
+     */
+    @TableField("FAULTTIME")
+    private Double faulttime;
+
+    /**
+     * 维护时间(计算过)
+     */
+    @TableField("MAINTAINTIME")
+    private Double maintaintime;
+
+    /**
+     * 通讯中断时间(计算过)
+     */
+    @TableField("INTERRUPTTIME")
+    private Double interrupttime;
+
+    /**
+     * 月发电量
+     */
+    @TableField("MONTHGC")
+    private Double monthgc;
+
+    /**
+     * 年发电量
+     */
+    @TableField("YEARGC")
+    private Double yeargc;
+
+    /**
+     * 理论发电量
+     */
+    @TableField("THEORYGENERATION")
+    private Double theorygeneration;
+
+    /**
+     * 损失发电量
+     */
+    @TableField("LOSSOFPOWER")
+    private Double lossofpower;
+
+    /**
+     * 场用电量
+     */
+    @TableField("FIELDELECTRICITY")
+    private Double fieldelectricity;
+
+    /**
+     * 发电量(电表)
+     */
+    @TableField("GENERATINGCAPACITY2")
+    private Double generatingcapacity2;
+
+    /**
+     * 风场编号
+     */
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    /**
+     * 项目编号
+     */
+    @TableField("PROJECTID")
+    private String projectid;
+
+    /**
+     * 线路编号
+     */
+    @TableField("LINEID")
+    private String lineid;
+
+    /**
+     * 所属位置
+     */
+    @TableField("LOCATION")
+    private String location;
+
+    /**
+     * 农网购网电量
+     */
+    @TableField("BUYAGRICULTUREELECTRICITY")
+    private Double buyagricultureelectricity;
+
+    /**
+     * 月发电量(电表)
+     */
+    @TableField("MONTHGC2")
+    private Double monthgc2;
+
+    /**
+     * 年发电量(电表)
+     */
+    @TableField("YEARGC2")
+    private Double yeargc2;
+
+    /**
+     * 风速(测风塔)
+     */
+    @TableField("SPEED2")
+    private Double speed2;
+
+    /**
+     * 最小风速
+     */
+    @TableField("MAXSPEED")
+    private Double maxspeed;
+
+    /**
+     * 最大风速(日照强度)
+     */
+    @TableField("MINSPEED")
+    private Double minspeed;
+
+    /**
+     * 限电量
+     */
+    @TableField("LIMITPOWER")
+    private Double limitpower;
+
+    /**
+     * 总发电量(SCADA)
+     */
+    @TableField("TOTALGC")
+    private Double totalgc;
+
+    /**
+     * 总发电量
+     */
+    @TableField("TOTALGC2")
+    private Double totalgc2;
+
+    /**
+     * 自算理论发电量
+     */
+    @TableField("THEORYGENERATIONZS")
+    private Double theorygenerationzs;
+
+    /**
+     * 有效风时数
+     */
+    @TableField("WINDHOURS")
+    private Double windhours;
+
+    /**
+     * 最大功率
+     */
+    @TableField("MAXPOWER")
+    private Double maxpower;
+
+    /**
+     * 最小功率
+     */
+    @TableField("MINPOWER")
+    private Double minpower;
+
+    /**
+     * 月上网电量
+     */
+    @TableField("MONTHGE")
+    private Double monthge;
+
+    /**
+     * 年上网电量
+     */
+    @TableField("YEARGE")
+    private Double yearge;
+
+    /**
+     * 月工网购网电量
+     */
+    @TableField("MONTHBE")
+    private Double monthbe;
+
+    /**
+     * 年工网购网电量
+     */
+    @TableField("YEARBE")
+    private Double yearbe;
+
+    /**
+     * 月农网购网电量
+     */
+    @TableField("MONTHAE")
+    private Double monthae;
+
+    /**
+     * 年农网购网电量
+     */
+    @TableField("YEARAE")
+    private Double yearae;
+
+    /**
+     * 日发电量(4位小数)
+     */
+    @TableField("GENERATINGCAPACITY4")
+    private Double generatingcapacity4;
+
+    /**
+     * 日上网电量(4位小数)
+     */
+    @TableField("GRIDELECTRICITY4")
+    private Double gridelectricity4;
+
+    /**
+     * 日工网购网电量(4位小数)
+     */
+    @TableField("BUYELECTRICITY4")
+    private Double buyelectricity4;
+
+    /**
+     * 日农网购网电量(4位小数)
+     */
+    @TableField("BUYAGRICULTUREELECTRICITY4")
+    private Double buyagricultureelectricity4;
+
+    /**
+     * 日利用小时数
+     */
+    @TableField("DAYLYXS")
+    private Double daylyxs;
+
+    /**
+     * 月利用小时数
+     */
+    @TableField("MONTHLYXS")
+    private Double monthlyxs;
+
+    /**
+     * 年利用小时数
+     */
+    @TableField("YEARLYXS")
+    private Double yearlyxs;
+
+    /**
+     * 日综合厂用电率
+     */
+    @TableField("DAYZHCYDL")
+    private Double dayzhcydl;
+
+    /**
+     * 月综合厂用电率
+     */
+    @TableField("MONTHZHCYDL")
+    private Double monthzhcydl;
+
+    /**
+     * 年综合厂用电率
+     */
+    @TableField("YEARZHCYDL")
+    private Double yearzhcydl;
+
+    /**
+     * 日设备可利用率
+     */
+    @TableField("DAYSBKLYL")
+    private Double daysbklyl;
+
+    /**
+     * 月设备可利用率
+     */
+    @TableField("MONTHSBKLYL")
+    private Double monthsbklyl;
+
+    /**
+     * 年设备可利用率
+     */
+    @TableField("YEARSBKLYL")
+    private Double yearsbklyl;
+
+    /**
+     * 日等效可用系数
+     */
+    @TableField("DAYDXKYXS")
+    private Double daydxkyxs;
+
+    /**
+     * 月等效可用系数
+     */
+    @TableField("MONTHDXKYXS")
+    private Double monthdxkyxs;
+
+    /**
+     * 年等效可用系数
+     */
+    @TableField("YEARDXKYXS")
+    private Double yeardxkyxs;
+
+    /**
+     * 月平均风速
+     */
+    @TableField("MONTHSPEED")
+    private Double monthspeed;
+
+    /**
+     * 年平均风速
+     */
+    @TableField("YEARSPEED")
+    private Double yearspeed;
+
+    /**
+     * 运行时间(计算过)月
+     */
+    @TableField("MONTHRUNTIME")
+    private Double monthruntime;
+
+    /**
+     * 停机时间(计算过)月
+     */
+    @TableField("MONHTSTOPTIME")
+    private Double monhtstoptime;
+
+    /**
+     * 故障时间(计算过)月
+     */
+    @TableField("MONTHFAULTTIME")
+    private Double monthfaulttime;
+
+    /**
+     * 维护时间(计算过)月
+     */
+    @TableField("MONTHMAINTAINTIME")
+    private Double monthmaintaintime;
+
+    /**
+     * 通讯中断时间(计算过)月
+     */
+    @TableField("MONTHINTERRUPTTIME")
+    private Double monthinterrupttime;
+
+    /**
+     * 运行时间(计算过)年
+     */
+    @TableField("YEARRUNTIME")
+    private Double yearruntime;
+
+    /**
+     * 停机时间(计算过)年
+     */
+    @TableField("YEARSTOPTIME")
+    private Double yearstoptime;
+
+    /**
+     * 故障时间(计算过)年
+     */
+    @TableField("YEARFAULTTIME")
+    private Double yearfaulttime;
+
+    /**
+     * 维护时间(计算过)年
+     */
+    @TableField("YEARMAINTAINTIME")
+    private Double yearmaintaintime;
+
+    /**
+     * 通讯中断时间(计算过)年
+     */
+    @TableField("YEARINTERRUPTTIME")
+    private Double yearinterrupttime;
+
+    /**
+     * 日日历小时数
+     */
+    @TableField("DAYCALENDARHOURS")
+    private Double daycalendarhours;
+
+    /**
+     * 月日历小时数
+     */
+    @TableField("MONTHCALENDARHOURS")
+    private Double monthcalendarhours;
+
+    /**
+     * 年日历小时数
+     */
+    @TableField("YEARCALENDARHOURS")
+    private Double yearcalendarhours;
+
+    /**
+     * 限电损失电量
+     */
+    @TableField("LOSSOFPOWER1")
+    private Double lossofpower1;
+
+    /**
+     * 故障损失电量
+     */
+    @TableField("LOSSOFPOWER2")
+    private Double lossofpower2;
+
+    /**
+     * 维护损失电量
+     */
+    @TableField("LOSSOFPOWER3")
+    private Double lossofpower3;
+
+    /**
+     * 性能损失电量
+     */
+    @TableField("LOSSOFPOWER4")
+    private Double lossofpower4;
+
+    /**
+     * 月有效风时数
+     */
+    @TableField("MONTHWINDHOURS")
+    private Double monthwindhours;
+
+    /**
+     * 年有效风时数
+     */
+    @TableField("YEARWINDHOURS")
+    private Double yearwindhours;
+
+    /**
+     * 日限电小时数
+     */
+    @TableField("BROWNOUTSTIME")
+    private Double brownoutstime;
+
+    /**
+     * 月限电小时数
+     */
+    @TableField("MONTHBROWNOUTSTIME")
+    private Double monthbrownoutstime;
+
+    /**
+     * 年限电小时数
+     */
+    @TableField("YEARBROWNOUTSTIME")
+    private Double yearbrownoutstime;
+
+    @TableField("MAINLOSSIN")
+    private Double mainlossin;
+
+    @TableField("FAULTLOSSIN")
+    private Double faultlossin;
+
+    @TableField("ELECTRICLOSSOUT")
+    private Double electriclossout;
+
+    @TableField("WEATHERLOSSOUT")
+    private Double weatherlossout;
+
+
+}

+ 172 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Windpowerinfoday3.java

@@ -0,0 +1,172 @@
+package com.gyee.datatraining.model.auto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-07-26
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WINDPOWERINFODAY3")
+public class Windpowerinfoday3 extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("ID")
+    private Long id;
+
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    @TableField("PROJECTID")
+    private String projectid;
+
+    @TableField("LINEID")
+    private String lineid;
+
+    @TableField("WINDTURBINEID")
+    private String windturbineid;
+
+    @TableField("DAYDL1")
+    private Double daydl1;
+
+    @TableField("DAYDL2")
+    private Double daydl2;
+
+    @TableField("DAYPOWER")
+    private Double daypower;
+
+    @TableField("DAYSPEED")
+    private Double dayspeed;
+
+    @TableField("DAYMAXPOWER")
+    private Double daymaxpower;
+
+    @TableField("DAYMINPOWER")
+    private Double dayminpower;
+
+    @TableField("DAYMAXSPEED")
+    private Double daymaxspeed;
+
+    @TableField("DAYMINSPEED")
+    private Double dayminspeed;
+
+    @TableField("DAYNHGL")
+    private Double daynhgl;
+
+    @TableField("DAYNHDL")
+    private Double daynhdl;
+
+    @TableField("DAYNHGZSSDL")
+    private Double daynhgzssdl;
+
+    @TableField("DAYNHWHSSDL")
+    private Double daynhwhssdl;
+
+    @TableField("DAYNHXDSSDL")
+    private Double daynhxdssdl;
+
+    @TableField("DAYNHQFDL")
+    private Double daynhqfdl;
+
+    @TableField("DAYNHCFDL")
+    private Double daynhcfdl;
+
+    @TableField("DAYNHPCL")
+    private Double daynhpcl;
+
+    @TableField("DAYNHGL2")
+    private Double daynhgl2;
+
+    @TableField("DAYNHDL2")
+    private Double daynhdl2;
+
+    @TableField("DAYNHGZSSDL2")
+    private Double daynhgzssdl2;
+
+    @TableField("DAYNHWHSSDL2")
+    private Double daynhwhssdl2;
+
+    @TableField("DAYNHXDSSDL2")
+    private Double daynhxdssdl2;
+
+    @TableField("DAYNHQFDL2")
+    private Double daynhqfdl2;
+
+    @TableField("DAYNHCFDL2")
+    private Double daynhcfdl2;
+
+    @TableField("DAYNHPCL2")
+    private Double daynhpcl2;
+
+    @TableField("DAYBZGL")
+    private Double daybzgl;
+
+    @TableField("DAYBZDL")
+    private Double daybzdl;
+
+    @TableField("DAYBZGZSSDL")
+    private Double daybzgzssdl;
+
+    @TableField("DAYBZWHSSDL")
+    private Double daybzwhssdl;
+
+    @TableField("DAYBZXDSSDL")
+    private Double daybzxdssdl;
+
+    @TableField("DAYBZQFDL")
+    private Double daybzqfdl;
+
+    @TableField("DAYBZCFDL")
+    private Double daybzcfdl;
+
+    @TableField("DAYBZPCL")
+    private Double daybzpcl;
+
+    @TableField("DAYLLGL")
+    private Double dayllgl;
+
+    @TableField("DAYLLDL")
+    private Double daylldl;
+
+    @TableField("DAYLLGZSSDL")
+    private Double dayllgzssdl;
+
+    @TableField("DAYLLWHSSDL")
+    private Double dayllwhssdl;
+
+    @TableField("DAYLLXDSSDL")
+    private Double dayllxdssdl;
+
+    @TableField("DAYLLQFDL")
+    private Double dayllqfdl;
+
+    @TableField("DAYLLCFDL")
+    private Double dayllcfdl;
+
+    @TableField("DAYLLPCL")
+    private Double dayllpcl;
+
+    @TableField("RECORDDATE")
+    private Date recorddate;
+
+    @TableField("FOREIGNKEYID")
+    private String foreignkeyid;
+
+    @TableField("LOCATION")
+    private String location;
+
+
+}

+ 87 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Windpowerstation.java

@@ -0,0 +1,87 @@
+package com.gyee.datatraining.model.auto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-06-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WINDPOWERSTATION")
+public class Windpowerstation extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("ADDRESS")
+    private String address;
+
+    @TableField("TELEPHONE")
+    private String telephone;
+
+    @TableField("CAPACITY")
+    private Double capacity;
+
+    @TableField("CAPACITYUNIT")
+    private String capacityunit;
+
+    @TableField("QUANTITY")
+    private Double quantity;
+
+    @TableField("ANAME")
+    private String aname;
+
+    @TableField("LONGITUDE")
+    private Double longitude;
+
+    @TableField("LATITUDE")
+    private Double latitude;
+
+    @TableField("PHOTO")
+    private String photo;
+
+    @TableField("COMPANYID")
+    private String companyid;
+
+    @TableField("SYSTEMMANUFACT")
+    private String systemmanufact;
+
+    @TableField("HEADFARM")
+    private String headfarm;
+
+    @TableField("HEADFARMPHONE")
+    private String headfarmphone;
+
+    @TableField("MODEL")
+    private String model;
+
+    @TableField("ORDERNUM")
+    private Double ordernum;
+
+    @TableField("ALTITUDE")
+    private Double altitude;
+
+    @TableField("HEIGHT")
+    private Double height;
+
+
+}

+ 79 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Windpowerstationpointnew.java

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

+ 65 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Windturbine.java

@@ -0,0 +1,65 @@
+package com.gyee.datatraining.model.auto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-05-25
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("WINDTURBINE")
+public class Windturbine extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId("ID")
+    private String id;
+
+    @TableField("CODE")
+    private String code;
+
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerstationid;
+
+    @TableField("LONGITUDE")
+    private Double longitude;
+
+    @TableField("LATITUDE")
+    private Double latitude;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("STATUS")
+    private String status;
+
+    @TableField("PROJECTID")
+    private String projectid;
+
+    @TableField("LINEID")
+    private String lineid;
+
+    @TableField("FIRSTINTEGRATEDTIME")
+    private String firstintegratedtime;
+
+    @TableField("PHOTO")
+    private String photo;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("STANDARDID")
+    private String standardid;
+
+
+}

+ 82 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/model/auto/Windturbinetestingpointnew.java

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

+ 538 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/DatatrainingService.java

@@ -0,0 +1,538 @@
+package com.gyee.datatraining.service;
+
+
+import com.gyee.common.model.PointData;
+import com.gyee.datatraining.init.CacheContext;
+import com.gyee.datatraining.model.auto.*;
+import com.gyee.datatraining.util.IRealTimeDataBaseUtil;
+import com.gyee.datatraining.util.StringUtils;
+import com.gyee.datatraining.util.dd.MatrixCalculation;
+import com.gyee.datatraining.util.dd.ModuleState;
+import com.gyee.datatraining.util.realtimesource.EdosUtil;
+import com.gyee.datatraining.vo.ModuleVo;
+import org.apache.commons.math3.linear.RealMatrix;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+
+
+/**
+ * @ClassName : EarlywarningService
+ * @Description : 报警统计service
+ */
+@Service
+public class DatatrainingService {
+
+    @Resource
+    private Environment env;
+    @Resource
+    private ModuleState ms;
+
+
+    private int jzxnnum = 4;//机组权重数量
+    private int digits = 4;//小数位数
+    /**
+     * 结果集数量
+     */
+    private int coment_bit = 4;
+    /**
+     * 指标点数量
+     */
+    private int point_bit = 4;
+    // private double warnnum = 0.9;
+    private static Logger logger = LoggerFactory.getLogger(DatatrainingService.class);
+    // private static final String SIMPLE_DATE_FORMAT = "yyyy-MM-dd";
+    //
+    // private double momentum=0.9; //动量参数
+    // private int
+    // trainnum=Integer.valueOf(env.getProperty("trainnum"));//训练次数
+    private IRealTimeDataBaseUtil ednaApiUtil = new EdosUtil();
+
+ 
+    public void dataTraining() throws Exception {
+
+        logger.info("调度程序执行开始!........");
+
+        /******************************************************************************************************************************************************/
+        List<Windturbine> wtls = CacheContext.wtls;
+        Map<String, Map<String, Windpowerstationpointnew>> stationPointmap = CacheContext.wppointmap;
+        Map<String, Map<String, Integer>> wpmap = new HashMap<String, Map<String, Integer>>();
+        Map<String, Map<String, Integer>> pjmap = new HashMap<String, Map<String, Integer>>();
+        Map<String, Map<String, Integer>> lnmap = new HashMap<String, Map<String, Integer>>();
+
+        Map<String, Map<String, Integer>> wpclxmap = new HashMap<String, Map<String, Integer>>();
+        Map<String, Map<String, Integer>> pjclxmap = new HashMap<String, Map<String, Integer>>();
+        Map<String, Map<String, Integer>> lnclxmap = new HashMap<String, Map<String, Integer>>();
+
+        Map<String, Map<String, Integer>> wpfdjmap = new HashMap<String, Map<String, Integer>>();
+        Map<String, Map<String, Integer>> pjfdjmap = new HashMap<String, Map<String, Integer>>();
+        Map<String, Map<String, Integer>> lnfdjmap = new HashMap<String, Map<String, Integer>>();
+
+        Map<String, Map<String, Integer>> wpkzysmap = new HashMap<String, Map<String, Integer>>();
+        Map<String, Map<String, Integer>> pjkzysmap = new HashMap<String, Map<String, Integer>>();
+        Map<String, Map<String, Integer>> lnkzysmap = new HashMap<String, Map<String, Integer>>();
+
+        Map<String, Map<String, Integer>> wpjcxtmap = new HashMap<String, Map<String, Integer>>();
+        Map<String, Map<String, Integer>> pjjcxtmap = new HashMap<String, Map<String, Integer>>();
+        Map<String, Map<String, Integer>> lnjcxtmap = new HashMap<String, Map<String, Integer>>();
+        Date now = new Date();
+        for (Windturbine wt : wtls) {
+
+//			if (wt.getWindpowerstationid().endsWith("FDC")  && wt.getId().equals("NG01_06")) {
+            if (wt.getWindpowerstationid().endsWith("FDC")) {
+
+                int[] state = { 0, 0, 0, 0, 0 };
+                try {
+
+                    state = checkWtState(wt.getId(), now);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+//				if(state[0]==0 || state[1]==0  || state[2]==0 || state[3]==0 || state[4]==0)
+//				{
+//					System.out.println("开始测试!");
+//				}
+                setWtTotalNum(state[0], wpclxmap, pjclxmap, lnclxmap, wt);
+                setWtTotalNum(state[1], wpfdjmap, pjfdjmap, lnfdjmap, wt);
+                setWtTotalNum(state[2], wpkzysmap, pjkzysmap, lnkzysmap, wt);
+                setWtTotalNum(state[3], wpjcxtmap, pjjcxtmap, lnjcxtmap, wt);
+                setWtTotalNum(state[4], wpmap, pjmap, lnmap, wt);
+            }
+
+        }
+
+        /******************************************************************************************************************************************************/
+
+        String[] up82_wp_wt_statenum = env.getProperty("up82_wp_wt_statenum").split(",");
+        String[] up82_wp_clx_statenum = env.getProperty("up82_wp_clx_statenum").split(",");
+        String[] up82_wp_fdj_statenum = env.getProperty("up82_wp_fdj_statenum").split(",");
+        String[] up82_wp_kzys_statenum = env.getProperty("up82_wp_kzys_statenum").split(",");
+        String[] up82_wp_jcxt_statenum = env.getProperty("up82_wp_jcxt_statenum").split(",");
+
+        traverseALlStateNumMap(stationPointmap, wpmap, now, up82_wp_wt_statenum);
+        traverseALlStateNumMap(stationPointmap, wpclxmap, now, up82_wp_clx_statenum);
+        traverseALlStateNumMap(stationPointmap, wpfdjmap, now, up82_wp_fdj_statenum);
+        traverseALlStateNumMap(stationPointmap, wpkzysmap, now, up82_wp_kzys_statenum);
+        traverseALlStateNumMap(stationPointmap, wpjcxtmap, now, up82_wp_jcxt_statenum);
+
+        traverseWpStateNumMap(stationPointmap, wpmap, now, up82_wp_wt_statenum);
+        traversePjStateNumMap(stationPointmap, pjmap, now, up82_wp_wt_statenum);
+        traverseLnStateNumMap(stationPointmap, lnmap, now, up82_wp_wt_statenum);
+
+        traverseWpStateNumMap(stationPointmap, wpclxmap, now, up82_wp_clx_statenum);
+        traversePjStateNumMap(stationPointmap, pjclxmap, now, up82_wp_clx_statenum);
+        traverseLnStateNumMap(stationPointmap, lnclxmap, now, up82_wp_clx_statenum);
+
+        traverseWpStateNumMap(stationPointmap, wpfdjmap, now, up82_wp_fdj_statenum);
+        traversePjStateNumMap(stationPointmap, pjfdjmap, now, up82_wp_fdj_statenum);
+        traverseLnStateNumMap(stationPointmap, lnfdjmap, now, up82_wp_fdj_statenum);
+
+        traverseWpStateNumMap(stationPointmap, wpkzysmap, now, up82_wp_kzys_statenum);
+        traversePjStateNumMap(stationPointmap, pjkzysmap, now, up82_wp_kzys_statenum);
+        traverseLnStateNumMap(stationPointmap, lnkzysmap, now, up82_wp_kzys_statenum);
+
+        traverseWpStateNumMap(stationPointmap, wpjcxtmap, now, up82_wp_jcxt_statenum);
+        traversePjStateNumMap(stationPointmap, pjjcxtmap, now, up82_wp_jcxt_statenum);
+        traverseLnStateNumMap(stationPointmap, lnjcxtmap, now, up82_wp_jcxt_statenum);
+
+        /******************************************************************************************************************************************************/
+
+        logger.info("进行健康状态判断处理完成!........");
+    }
+
+    private void traverseALlStateNumMap(Map<String, Map<String, Windpowerstationpointnew>> stationPointmap, Map<String, Map<String, Integer>> wpmap, Date now, String[] up82_wp_statenum) {
+
+        List<Windpowerstation> wpls = CacheContext.wpls;
+        Map<String, Windpowerstationpointnew> pointwmap = stationPointmap.get("0");
+        int lh=0;
+        int zc=0;
+        int zy=0;
+        int yz=0;
+        for (Windpowerstation wp : wpls) {
+            if (wp.getId().endsWith("FDC")) {
+
+                Map<String, Integer> map = wpmap.get(wp.getId());
+                if(map.containsKey("1"))
+                {
+                    lh=lh+map.get("1");
+                }
+                if(map.containsKey("2"))
+                {
+                    zc=zc+map.get("2");
+                }
+                if(map.containsKey("3"))
+                {
+                    zy=zy+map.get("3");
+                }
+                if(map.containsKey("4"))
+                {
+                    yz=yz+map.get("4");
+                }
+
+            }
+        }
+
+        try {
+            insertWpPoint(now, lh, pointwmap, up82_wp_statenum[0]);
+            insertWpPoint(now, zc, pointwmap, up82_wp_statenum[1]);
+            insertWpPoint(now, zy, pointwmap, up82_wp_statenum[2]);
+            insertWpPoint(now, yz, pointwmap, up82_wp_statenum[3]);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    private void traverseWpStateNumMap(Map<String, Map<String, Windpowerstationpointnew>> stationPointmap, Map<String, Map<String, Integer>> wpmap, Date now, String[] up82_wp_statenum) {
+
+        List<Windpowerstation> wpls = CacheContext.wpls;
+
+        for (Windpowerstation wp : wpls) {
+            if (wp.getId().endsWith("FDC")) {
+                Map<String, Windpowerstationpointnew> pointwmap = stationPointmap.get(wp.getId());
+                Map<String, Integer> map = wpmap.get(wp.getId());
+                for (int i = 0; i < up82_wp_statenum.length; i++) {
+                    double value = 0.0;
+                    if (map.containsKey(String.valueOf(i + 1))) {
+                        value = map.get(String.valueOf(i + 1));
+                    }
+                    try {
+                        insertWpPoint(now, value, pointwmap, up82_wp_statenum[i]);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+
+            }
+        }
+    }
+
+    private void traversePjStateNumMap(Map<String, Map<String, Windpowerstationpointnew>> stationPointmap, Map<String, Map<String, Integer>> wpmap, Date now, String[] up82_wp_statenum) {
+
+        List<Project> pjls = CacheContext.pjls;
+
+        for (Project pj : pjls) {
+            if (pj.getWindpowerstationid().endsWith("FDC")) {
+                Map<String, Windpowerstationpointnew> pointwmap = stationPointmap.get(pj.getId());
+                Map<String, Integer> map = wpmap.get(pj.getId());
+                for (int i = 0; i < up82_wp_statenum.length; i++) {
+                    double value = 0.0;
+                    if (map.containsKey(String.valueOf(i + 1))) {
+                        value = map.get(String.valueOf(i + 1));
+                    }
+                    try {
+                        insertWpPoint(now, value, pointwmap, up82_wp_statenum[i]);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+
+            }
+        }
+    }
+
+    private void traverseLnStateNumMap(Map<String, Map<String, Windpowerstationpointnew>> stationPointmap, Map<String, Map<String, Integer>> wpmap, Date now, String[] up82_wp_statenum) {
+
+        List<Line> lnls = CacheContext.lines;
+
+        for (Line ln : lnls) {
+            if (CacheContext.pjmap.get(ln.getProjectid()).getWindpowerstationid().endsWith("FDC")) {
+                try {
+                    Map<String, Windpowerstationpointnew> pointwmap = stationPointmap.get(ln.getId());
+                    Map<String, Integer> map = wpmap.get(ln.getId());
+                    for (int i = 0; i < up82_wp_statenum.length; i++) {
+                        double value = 0.0;
+                        if (map.containsKey(String.valueOf(i + 1))) {
+                            value = map.get(String.valueOf(i + 1));
+                        }
+
+                        insertWpPoint(now, value, pointwmap, up82_wp_statenum[i]);
+
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+
+            }
+        }
+    }
+
+    private void setWtTotalNum(int type, Map<String, Map<String, Integer>> wpmap, Map<String, Map<String, Integer>> pjmap, Map<String, Map<String, Integer>> lnmap, Windturbine wt) {
+        switch (type) {
+            case 1:
+                totalWpStateNum(wpmap, wt, "1");
+                totalPjStateNum(pjmap, wt, "1");
+                totalLnStateNum(lnmap, wt, "1");
+                break;
+            case 2:
+                totalWpStateNum(wpmap, wt, "2");
+                totalPjStateNum(pjmap, wt, "2");
+                totalLnStateNum(lnmap, wt, "2");
+                break;
+            case 3:
+                totalWpStateNum(wpmap, wt, "3");
+                totalPjStateNum(pjmap, wt, "3");
+                totalLnStateNum(lnmap, wt, "3");
+                break;
+            case 4:
+                totalWpStateNum(wpmap, wt, "4");
+                totalPjStateNum(pjmap, wt, "4");
+                totalLnStateNum(lnmap, wt, "4");
+                break;
+            default:
+                break;
+        }
+    }
+
+    private void totalWpStateNum(Map<String, Map<String, Integer>> wpmap, Windturbine wt, String type) {
+        if (wpmap.containsKey(wt.getWindpowerstationid())) {
+            Map<String, Integer> map = wpmap.get(wt.getWindpowerstationid());
+            if (map.containsKey(type)) {
+                int temp = map.get(type);
+                temp++;
+                map.put(type, temp);
+            } else {
+                map.put(type, 1);
+            }
+
+            wpmap.put(wt.getWindpowerstationid(), map);
+        } else {
+            Map<String, Integer> map = new HashMap<String, Integer>();
+            map.put(type, 1);
+            wpmap.put(wt.getWindpowerstationid(), map);
+        }
+    }
+
+    private void totalPjStateNum(Map<String, Map<String, Integer>> pjmap, Windturbine wt, String type) {
+        if (pjmap.containsKey(wt.getProjectid())) {
+            Map<String, Integer> map = pjmap.get(wt.getProjectid());
+            if (map.containsKey(type)) {
+                int temp = map.get(type);
+                temp++;
+                map.put(type, temp);
+            } else {
+                map.put(type, 1);
+            }
+            pjmap.put(wt.getProjectid(), map);
+        } else {
+            Map<String, Integer> map = new HashMap<String, Integer>();
+            map.put(type, 1);
+            pjmap.put(wt.getProjectid(), map);
+        }
+    }
+
+    private void totalLnStateNum(Map<String, Map<String, Integer>> lnmap, Windturbine wt, String type) {
+        if (lnmap.containsKey(wt.getLineid())) {
+            Map<String, Integer> map = lnmap.get(wt.getLineid());
+            if (map.containsKey(type)) {
+                int temp = map.get(type);
+                temp++;
+                map.put(type, temp);
+            } else {
+                map.put(type, 1);
+            }
+            lnmap.put(wt.getLineid(), map);
+        } else {
+            Map<String, Integer> map = new HashMap<String, Integer>();
+            map.put(type, 1);
+            lnmap.put(wt.getLineid(), map);
+        }
+    }
+
+    private int[] checkWtState(String wtId, Date now) throws Exception {
+
+        Map<String, Windturbinetestingpointnew> wtpAimap = CacheContext.wtpAimap.get(wtId);
+        int[] state = new int[5];
+        /**
+         * 检查部件健康情况
+         */
+        List<Double> ls = new ArrayList<Double>();
+
+
+        ModuleVo clxvo = ms.checkPartState(wtId, "up82_part_clx", "up82_type_clx", "up82_weight_clx", "up82_clx_rules", "up82_condition_lsd", "up82_params_lsd1", "up82_params_lsd2", "up82_params_lsd3", "up82_params_lsd4", now);
+        ModuleVo fdjvo = ms.checkPartState(wtId, "up82_part_fdj", "up82_type_fdj", "up82_weight_fdj", "up82_fdj_rules", "up82_condition_lsd", "up82_params_lsd1", "up82_params_lsd2", "up82_params_lsd3", "up82_params_lsd4", now);
+        ModuleVo kzysvo = ms.checkPartState(wtId, "up82_part_kzys", "up82_type_kzys", "up82_weight_kzys", "up82_kzys_rules", "up82_condition_lsd", "up82_params_lsd1", "up82_params_lsd2", "up82_params_lsd3", "up82_params_lsd4", now);
+        ModuleVo jcxtvo = ms.checkPartState(wtId, "up82_part_jcxt", "up82_type_jcxt", "up82_weight_jcxt", "up82_jcxt_rules", "up82_condition_lsd", "up82_params_lsd1", "up82_params_lsd2", "up82_params_lsd3", "up82_params_lsd4", now);
+
+        state[0] = clxvo.getModuleState();
+        state[1] = fdjvo.getModuleState();
+        state[2] = kzysvo.getModuleState();
+        state[3] = jcxtvo.getModuleState();
+
+        if(state[0]==4 || state[1]==4 || state[2]==4 || state[3]==4)
+        {
+            state[4]=4;
+
+            ls.add(0.0);
+            ls.add(0.0);
+            ls.add(0.0);
+            ls.add(1.0);
+        }else if(state[0]==3 || state[1]==3 || state[2]==3 || state[3]==3)
+        {
+            state[4]=3;
+
+            ls.add(0.0);
+            ls.add(0.0);
+            ls.add(1.0);
+            ls.add(0.0);
+        }else if(state[0]==2 || state[1]==2 || state[2]==2 || state[3]==2)
+        {
+            state[4]=2;
+
+            ls.add(0.0);
+            ls.add(1.0);
+            ls.add(0.0);
+            ls.add(0.0);
+        }	else
+        {
+
+            String[] up82_weight_jzxn = env.getProperty("up82_weight_jzxn").split(",");
+            double[] drr = new double[jzxnnum];
+            for (int i = 0; i < up82_weight_jzxn.length; i++) {
+                drr[i] = Double.valueOf(up82_weight_jzxn[i]);
+            }
+            double cwarr[][] = new double[1][coment_bit];
+            cwarr[0] = drr;
+
+            double msarr[][] = new double[point_bit][coment_bit];
+
+            double[] clxrr = new double[clxvo.getModuleResult().size()];
+            double[] fdjrr = new double[fdjvo.getModuleResult().size()];
+            double[] kzysrr = new double[kzysvo.getModuleResult().size()];
+            double[] jcxtrr = new double[jcxtvo.getModuleResult().size()];
+
+            for (int i = 0; i < clxrr.length; i++) {
+                clxrr[i] = clxvo.getModuleResult().get(i);
+                fdjrr[i] = fdjvo.getModuleResult().get(i);
+                kzysrr[i] = kzysvo.getModuleResult().get(i);
+                jcxtrr[i] = jcxtvo.getModuleResult().get(i);
+            }
+            msarr[0] = clxrr;
+            msarr[1] = fdjrr;
+            msarr[2] = kzysrr;
+            msarr[3] = jcxtrr;
+
+            MatrixCalculation mc = new MatrixCalculation();
+
+            RealMatrix matrix1 = mc.createMatrix(cwarr);
+            RealMatrix matrix2 = mc.createMatrix(msarr);
+
+            RealMatrix rmresult = matrix1.multiply(matrix2);
+
+
+            double value = rmresult.getEntry(0, 0);
+            state[4] = 1;
+            for (int i = 0; i < rmresult.getColumnDimension(); i++) {
+                //double temp = rmresult.getEntry(0, i);
+                double temp = rmresult.getEntry(0, i)<1?rmresult.getEntry(0, i):1;
+                if (temp > value) {
+                    value = temp;
+                    state[4] = i + 1;
+                }
+                ls.add(temp);
+            }
+
+            state[4]=1;
+        }
+
+
+
+
+
+        // logger.info(wtId+"风机健康监测状态值" + state);
+        //
+        // logger.info(wtId+"风机健康监测结果值是:" );
+        //
+        // StringBuilder sb=new StringBuilder();
+        // for(int i=0;i<ls.size();i++)
+        // {
+        // if(i==ls.size()-1)
+        // {
+        // sb.append(StringUtils.round(ls.get(i), digits));
+        // }else{
+        // sb.append(StringUtils.round(ls.get(i), digits)).append(",");
+        // }
+        // }
+        // logger.info(sb);
+        //
+        /**
+         * 齿轮箱 发电机 控制因素 机舱系统 机组性能
+         */
+        String up82_part_state_clx = env.getProperty("up82_part_state_clx");
+        String up82_part_state_fdj = env.getProperty("up82_part_state_fdj");
+        String up82_part_state_kzys = env.getProperty("up82_part_state_kzys");
+        String up82_part_state_jcxt = env.getProperty("up82_part_state_jcxt");
+        String up82_part_state_fj = env.getProperty("up82_part_state_fj");
+
+        String up82_part_state_clx_value = env.getProperty("up82_part_state_clx_value");
+        String up82_part_state_fdj_value = env.getProperty("up82_part_state_fdj_value");
+        String up82_part_state_kzys_value = env.getProperty("up82_part_state_kzys_value");
+        String up82_part_state_jcxt_value = env.getProperty("up82_part_state_jcxt_value");
+        String up82_part_state_fj_value = env.getProperty("up82_part_state_fj_value");
+
+        insertWtPoint(now, clxvo.getModuleState(), wtpAimap, up82_part_state_clx);
+        insertWtPoint(now, fdjvo.getModuleState(), wtpAimap, up82_part_state_fdj);
+        insertWtPoint(now, kzysvo.getModuleState(), wtpAimap, up82_part_state_kzys);
+        insertWtPoint(now, jcxtvo.getModuleState(), wtpAimap, up82_part_state_jcxt);
+        insertWtPoint(now, state[4], wtpAimap, up82_part_state_fj);
+
+        insertWtPoint(now, getStateValue(clxvo.getModuleResult()), wtpAimap, up82_part_state_clx_value);
+        insertWtPoint(now, getStateValue(fdjvo.getModuleResult()), wtpAimap, up82_part_state_fdj_value);
+        insertWtPoint(now, getStateValue(kzysvo.getModuleResult()), wtpAimap, up82_part_state_kzys_value);
+        insertWtPoint(now, getStateValue(jcxtvo.getModuleResult()), wtpAimap, up82_part_state_jcxt_value);
+        insertWtPoint(now, getStateValue(ls), wtpAimap, up82_part_state_fj_value);
+
+        return state;
+    }
+
+    private double getStateValue(List<Double> ls) {
+        if (null != ls && !ls.isEmpty()) {
+            double value = ls.get(0);
+            for (Double d : ls) {
+                double temp = d;
+                if (temp > value) {
+                    value = temp;
+                }
+            }
+
+            return StringUtils.round(value, digits);
+        }
+        return 0.0;
+    }
+
+    private void insertWtPoint(Date now, double value, Map<String, Windturbinetestingpointnew> wtpAimap, String up82_part_state_clx) throws Exception {
+
+        try{
+            if (wtpAimap.containsKey(up82_part_state_clx)) {
+                Windturbinetestingpointnew ai = wtpAimap.get(up82_part_state_clx);
+                PointData point = new PointData();
+                point.setEdnaId(ai.getId());
+                point.setPointValueInDouble(value);
+                point.setPointTime(new BigDecimal(now.getTime()).divide(new BigDecimal(1000), 0, RoundingMode.HALF_EVEN).longValue());
+                ednaApiUtil.updatePoint(point);
+            }
+        }
+        catch (Exception e)
+        {
+            System.out.println(e.getMessage());
+        }
+    }
+
+    private void insertWpPoint(Date now, double value, Map<String, Windpowerstationpointnew> wpmap, String unicode) throws Exception {
+        if (wpmap.containsKey(unicode)) {
+            Windpowerstationpointnew ai = wpmap.get(unicode);
+            PointData point = new PointData();
+            point.setEdnaId(ai.getCode());
+            point.setPointValueInDouble(value);
+            point.setPointTime(new BigDecimal(now.getTime()).divide(new BigDecimal(1000), 0, RoundingMode.HALF_EVEN).longValue());
+            ednaApiUtil.updatePoint(point);
+        }
+    }
+
+}

+ 17 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IEquipmentmodelService.java

@@ -0,0 +1,17 @@
+package com.gyee.datatraining.service.auto;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.datatraining.model.auto.Equipmentmodel;
+
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-01-11
+ */
+public interface IEquipmentmodelService extends IService<Equipmentmodel> {
+
+}

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/ILineService.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.service.auto;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.datatraining.model.auto.Line;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-06-21
+ */
+public interface ILineService extends IService<Line> {
+
+}

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IProjectService.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.service.auto;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.datatraining.model.auto.Project;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-06-21
+ */
+public interface IProjectService extends IService<Project> {
+
+}

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IWindpowerinfoday3Service.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.service.auto;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.datatraining.model.auto.Windpowerinfoday3;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-07-26
+ */
+public interface IWindpowerinfoday3Service extends IService<Windpowerinfoday3> {
+
+}

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IWindpowerinfodayService.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.service.auto;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.datatraining.model.auto.Windpowerinfoday;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-07-26
+ */
+public interface IWindpowerinfodayService extends IService<Windpowerinfoday> {
+
+}

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IWindpowerstationService.java

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

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IWindpowerstationpointnewService.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.service.auto;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.datatraining.model.auto.Windpowerstationpointnew;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-03-08
+ */
+public interface IWindpowerstationpointnewService extends IService<Windpowerstationpointnew> {
+
+}

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IWindturbineService.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.service.auto;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.datatraining.model.auto.Windturbine;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-05-25
+ */
+public interface IWindturbineService extends IService<Windturbine> {
+
+}

+ 16 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/IWindturbinetestingpointnewService.java

@@ -0,0 +1,16 @@
+package com.gyee.datatraining.service.auto;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.datatraining.model.auto.Windturbinetestingpointnew;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 石林
+ * @since 2022-03-08
+ */
+public interface IWindturbinetestingpointnewService extends IService<Windturbinetestingpointnew> {
+
+}

+ 20 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/EquipmentmodelServiceImpl.java

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

+ 21 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/LineServiceImpl.java

@@ -0,0 +1,21 @@
+package com.gyee.datatraining.service.auto.impl;
+
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.datatraining.mapper.auto.LineMapper;
+import com.gyee.datatraining.model.auto.Line;
+import com.gyee.datatraining.service.auto.ILineService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-06-21
+ */
+@Service
+public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements ILineService {
+
+}

+ 20 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/ProjectServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.datatraining.service.auto.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.datatraining.mapper.auto.ProjectMapper;
+import com.gyee.datatraining.model.auto.Project;
+import com.gyee.datatraining.service.auto.IProjectService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-06-21
+ */
+@Service
+public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> implements IProjectService {
+
+}

+ 20 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/Windpowerinfoday3ServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.datatraining.service.auto.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.datatraining.mapper.auto.Windpowerinfoday3Mapper;
+import com.gyee.datatraining.model.auto.Windpowerinfoday3;
+import com.gyee.datatraining.service.auto.IWindpowerinfoday3Service;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-07-26
+ */
+@Service
+public class Windpowerinfoday3ServiceImpl extends ServiceImpl<Windpowerinfoday3Mapper, Windpowerinfoday3> implements IWindpowerinfoday3Service {
+
+}

+ 20 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/WindpowerinfodayServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.datatraining.service.auto.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.datatraining.mapper.auto.WindpowerinfodayMapper;
+import com.gyee.datatraining.model.auto.Windpowerinfoday;
+import com.gyee.datatraining.service.auto.IWindpowerinfodayService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-07-26
+ */
+@Service
+public class WindpowerinfodayServiceImpl extends ServiceImpl<WindpowerinfodayMapper, Windpowerinfoday> implements IWindpowerinfodayService {
+
+}

+ 20 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/WindpowerstationServiceImpl.java

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

+ 20 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/WindpowerstationpointnewServiceImpl.java

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

+ 21 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/WindturbineServiceImpl.java

@@ -0,0 +1,21 @@
+package com.gyee.datatraining.service.auto.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import com.gyee.datatraining.mapper.auto.WindturbineMapper;
+import com.gyee.datatraining.model.auto.Windturbine;
+import com.gyee.datatraining.service.auto.IWindturbineService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2021-05-25
+ */
+@Service
+public class WindturbineServiceImpl extends ServiceImpl<WindturbineMapper, Windturbine> implements IWindturbineService {
+
+}

+ 20 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/auto/impl/WindturbinetestingpointnewServiceImpl.java

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

+ 229 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/SaticScheduleTask.java

@@ -0,0 +1,229 @@
+package com.gyee.datatraining.task;
+
+
+import com.gyee.datatraining.init.CacheContext;
+import com.gyee.datatraining.model.auto.Windpowerstation;
+import com.gyee.datatraining.model.auto.Windturbine;
+import com.gyee.datatraining.service.DatatrainingService;
+import com.gyee.datatraining.util.dd.LstmModelWt;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.concurrent.Executor;
+
+/**
+ * @ClassName : SaticScheduleTask
+ * @Description : 调度
+ */
+@Configuration      //1.主要用于标记配置类,兼备Component的效果。
+@EnableScheduling   // 2.开启定时任务
+public class SaticScheduleTask {
+
+    private static Logger logger = LoggerFactory.getLogger(SaticScheduleTask.class);
+    @Resource
+    private DatatrainingService datatrainingService;
+    @Resource
+    private LstmModelWt lstmModelWt;
+    @Resource
+    private Executor executor;
+    private static int produceTaskSleepTime = 10;
+    //3.添加定时任务
+    /**
+     * 健康状态判定
+     */
+    @Scheduled(cron = "0 0/1 * * * ?")
+    //或直接指定时间间隔,例如:5秒
+    //@Scheduled(fixedRate=5000)
+    private void configureTasks1()  {
+
+
+        logger.info("健康状态判定调度程序执行开始!........");
+
+        try {
+
+            datatrainingService.dataTraining();
+                 } catch (Exception e) {
+
+            e.printStackTrace();
+        }
+
+        logger.info("健康状态判定调度任务处理完成!........");
+    }
+
+    /**
+     * 风机未来4小时数据
+     */
+    @Scheduled(cron = "0 0 0/1 * * ?")
+    //或直接指定时间间隔,例如:5秒
+    //@Scheduled(fixedRate=5000)
+    private void configureTasks2()  {
+
+
+        logger.info("风机未来4小时数据调度程序执行开始!........");
+
+        try {
+
+            for (int i = 0; i < CacheContext.wpls.size(); i++) {
+                Windpowerstation wp=CacheContext.wpls.get(i);
+                if (wp.getId().endsWith("FDC")) {
+                    List<Windturbine> wtls=CacheContext.wtsmap.get(wp.getId());
+
+                    try {
+                        Thread.sleep(produceTaskSleepTime);
+                    } catch (InterruptedException e1) {
+                        e1.printStackTrace();
+                    }
+                    new Thread(new StartTaskThread1(executor, i,  wtls,wp, lstmModelWt)).start();
+                }
+            }
+        } catch (Exception e) {
+
+            e.printStackTrace();
+        }
+
+        logger.info("风机未来4小时数据调度任务处理完成!........");
+    }
+
+    /**
+     * 风机未来1天数据
+     */
+    @Scheduled(cron = "0 0 0/1 * * ?")
+    //或直接指定时间间隔,例如:5秒
+    //@Scheduled(fixedRate=5000)
+    private void configureTasks3()  {
+
+
+        logger.info("风机未来1天数据调度程序执行开始!........");
+
+        try {
+
+            for (int i = 0; i < CacheContext.wpls.size(); i++) {
+                Windpowerstation wp=CacheContext.wpls.get(i);
+                if (wp.getId().endsWith("FDC")) {
+                    List<Windturbine> wtls=CacheContext.wtsmap.get(wp.getId());
+
+                    try {
+                        Thread.sleep(produceTaskSleepTime);
+                    } catch (InterruptedException e1) {
+                        e1.printStackTrace();
+                    }
+                    new Thread(new StartTaskThread2(executor, i,  wtls,wp, lstmModelWt)).start();
+                }
+            }
+        } catch (Exception e) {
+
+            e.printStackTrace();
+        }
+
+        logger.info("风机未来1天数据调度任务处理完成!........");
+    }
+
+    /**
+     * 风机未来3天数据
+     */
+    @Scheduled(cron = "0 0 0/1 * * ?")
+    //或直接指定时间间隔,例如:5秒
+    //@Scheduled(fixedRate=5000)
+    private void configureTasks4()  {
+
+
+        logger.info("风机未来3天数据调度程序执行开始!........");
+
+        try {
+
+            for (int i = 0; i < CacheContext.wpls.size(); i++) {
+                Windpowerstation wp=CacheContext.wpls.get(i);
+                if (wp.getId().endsWith("FDC")) {
+                    List<Windturbine> wtls=CacheContext.wtsmap.get(wp.getId());
+
+                    try {
+                        Thread.sleep(produceTaskSleepTime);
+                    } catch (InterruptedException e1) {
+                        e1.printStackTrace();
+                    }
+                    new Thread(new StartTaskThread3(executor, i,  wtls,wp, lstmModelWt)).start();
+                }
+            }
+        } catch (Exception e) {
+
+            e.printStackTrace();
+        }
+
+        logger.info("风机未来3天数据调度任务处理完成!........");
+    }
+
+    /**
+     * 风机未来7天数据
+     */
+    @Scheduled(cron = "0 0 0/1 * * ?")
+    //或直接指定时间间隔,例如:5秒
+    //@Scheduled(fixedRate=5000)
+    private void configureTasks5()  {
+
+
+        logger.info("风机未来7天数据调度程序执行开始!........");
+
+        try {
+
+            for (int i = 0; i < CacheContext.wpls.size(); i++) {
+                Windpowerstation wp=CacheContext.wpls.get(i);
+                if (wp.getId().endsWith("FDC")) {
+                    List<Windturbine> wtls=CacheContext.wtsmap.get(wp.getId());
+
+                    try {
+                        Thread.sleep(produceTaskSleepTime);
+                    } catch (InterruptedException e1) {
+                        e1.printStackTrace();
+                    }
+                    new Thread(new StartTaskThread4(executor, i,  wtls,wp, lstmModelWt)).start();
+                }
+            }
+        } catch (Exception e) {
+
+            e.printStackTrace();
+        }
+
+        logger.info("风机未来7天数据调度任务处理完成!........");
+    }
+
+    /**
+     * 风机未来1个月数据
+     */
+    @Scheduled(cron = "0 0 0/1 * * ?")
+    //或直接指定时间间隔,例如:5秒
+    //@Scheduled(fixedRate=5000)
+    private void configureTasks6()  {
+
+
+        logger.info("风机未来1个月数据调度程序执行开始!........");
+
+        try {
+
+            for (int i = 0; i < CacheContext.wpls.size(); i++) {
+                Windpowerstation wp=CacheContext.wpls.get(i);
+                if (wp.getId().endsWith("FDC")) {
+                    List<Windturbine> wtls=CacheContext.wtsmap.get(wp.getId());
+
+                    try {
+                        Thread.sleep(produceTaskSleepTime);
+                    } catch (InterruptedException e1) {
+                        e1.printStackTrace();
+                    }
+                    new Thread(new StartTaskThread5(executor, i,  wtls,wp, lstmModelWt)).start();
+                }
+            }
+        } catch (Exception e) {
+
+            e.printStackTrace();
+        }
+
+        logger.info("风机未来1个月数据调度任务处理完成!........");
+    }
+
+
+}

+ 58 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/StartTaskThread1.java

@@ -0,0 +1,58 @@
+package com.gyee.datatraining.task;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+import java.util.concurrent.FutureTask;
+
+import java.util.concurrent.TimeUnit;
+
+import com.gyee.datatraining.model.auto.Windpowerstation;
+import com.gyee.datatraining.util.dd.LstmModelWt;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+import java.util.concurrent.Executor;
+import com.gyee.datatraining.model.auto.Windturbine;
+
+import javax.annotation.Resource;
+
+public class StartTaskThread1 implements Runnable {
+
+	private  Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private int i;
+	private LstmModelWt lstmModelWt;
+	private List<Windturbine> wtls;
+	private Windpowerstation wp;
+	public StartTaskThread1(Executor executor, int i, List<Windturbine> wtls,Windpowerstation wp, LstmModelWt lstmModelWt) {
+		this.executor = executor;
+		this.i = i;
+		this.wtls = wtls;
+		this.wp = wp;
+		this.lstmModelWt = lstmModelWt;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wp.getId();
+		logger.info("风机未来4小时数据创建任务并提交到线程池中:" + wp.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new ThreadPoolTask1(task, wtls,wp, lstmModelWt));
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get(1000, TimeUnit.MILLISECONDS);
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		} 
+	}
+}

+ 56 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/StartTaskThread2.java

@@ -0,0 +1,56 @@
+package com.gyee.datatraining.task;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
+
+import com.gyee.datatraining.model.auto.Windpowerstation;
+import com.gyee.datatraining.util.dd.LstmModelWt;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import com.gyee.datatraining.model.auto.Windturbine;
+
+public class StartTaskThread2 implements Runnable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+	private int i;
+	private LstmModelWt lstmModelWt;
+
+	private List<Windturbine> wtls;
+	private Windpowerstation wp;
+
+	public StartTaskThread2(Executor executor, int i, List<Windturbine> wtls, Windpowerstation wp, LstmModelWt lstmModelWt) {
+		this.executor = executor;
+		this.i = i;
+		this.wtls = wtls;
+		this.wp = wp;
+		this.lstmModelWt = lstmModelWt;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " +wp.getId();
+		logger.info("风机未来1天数据创建任务并提交到线程池中:" + wp.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new ThreadPoolTask2(task,  wtls,wp, lstmModelWt));
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get(1000, TimeUnit.MILLISECONDS);
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		} 
+	}
+}

+ 56 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/StartTaskThread3.java

@@ -0,0 +1,56 @@
+package com.gyee.datatraining.task;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
+
+import com.gyee.datatraining.model.auto.Windpowerstation;
+import com.gyee.datatraining.util.dd.LstmModelWt;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import com.gyee.datatraining.model.auto.Windturbine;
+
+public class StartTaskThread3 implements Runnable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private int i;
+	private LstmModelWt lstmModelWt;
+	private List<Windturbine> wtls;
+	private Windpowerstation wp;
+
+	public StartTaskThread3(Executor executor, int i, List<Windturbine> wtls, Windpowerstation wp, LstmModelWt lstmModelWt) {
+		this.executor = executor;
+		this.i = i;
+		this.wtls = wtls;
+		this.wp = wp;
+		this.lstmModelWt = lstmModelWt;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wp.getId();
+		logger.info("风机未来3天数据创建任务并提交到线程池中:" + wp.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new ThreadPoolTask3(task, wtls,wp, lstmModelWt));
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get(1000, TimeUnit.MILLISECONDS);
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		} 
+	}
+}

+ 59 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/StartTaskThread4.java

@@ -0,0 +1,59 @@
+package com.gyee.datatraining.task;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+import java.util.concurrent.TimeUnit;
+
+import com.gyee.datatraining.model.auto.Windpowerstation;
+import com.gyee.datatraining.model.auto.Windturbine;
+import com.gyee.datatraining.util.dd.LstmModelWt;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+
+public class StartTaskThread4 implements Runnable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+	private Executor executor;
+
+	private int i;
+	private LstmModelWt lstmModelWt;
+
+	private List<Windturbine> wtls;
+	private Windpowerstation wp;
+
+	public StartTaskThread4(Executor executor, int i, List<Windturbine> wtls, Windpowerstation wp, LstmModelWt lstmModelWt) {
+		this.executor = executor;
+		this.i = i;
+		this.wtls = wtls;
+		this.wp = wp;
+		this.lstmModelWt = lstmModelWt;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wp.getId();
+		logger.info("风机未来7天数据创建任务并提交到线程池中:" + wp.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new ThreadPoolTask4(task, wtls,wp, lstmModelWt));
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get(1000, TimeUnit.MILLISECONDS);
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		} 
+	}
+}

+ 56 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/StartTaskThread5.java

@@ -0,0 +1,56 @@
+package com.gyee.datatraining.task;
+
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.FutureTask;
+
+import java.util.concurrent.TimeUnit;
+
+import com.gyee.datatraining.model.auto.Windpowerstation;
+import com.gyee.datatraining.util.dd.LstmModelWt;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import com.gyee.datatraining.model.auto.Windturbine;
+
+public class StartTaskThread5 implements Runnable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+	private int i;
+	private LstmModelWt lstmModelWt;
+	private List<Windturbine> wtls;
+	private Windpowerstation wp;
+	private Executor executor;
+	public StartTaskThread5(Executor executor, int i, List<Windturbine> wtls, Windpowerstation wp, LstmModelWt lstmModelWt) {
+		this.executor = executor;
+		this.i = i;
+		this.wtls = wtls;
+		this.wp = wp;
+		this.lstmModelWt = lstmModelWt;
+	}
+
+	@Override
+	public synchronized void run() {
+
+		String task = "task@ " + wp.getId();
+		logger.info("风机未来1个月数据创建任务并提交到线程池中:" + wp.getId());
+		FutureTask<String> futureTask = new FutureTask<String>(new ThreadPoolTask5(task,  wtls,wp, lstmModelWt));
+		executor.execute(futureTask);
+		// 在这里可以做别的任何事情
+		String result = null;
+		try {
+			// 取得结果,同时设置超时执行时间为1秒。同样可以用future.get(),不设置执行超时时间取得结果
+			result = futureTask.get(1000, TimeUnit.MILLISECONDS);
+		} catch (InterruptedException e) {
+			futureTask.cancel(true);
+		} catch (ExecutionException e) {
+			futureTask.cancel(true);
+		} catch (Exception e) {
+			futureTask.cancel(true);
+			// 超时后,进行相应处理
+		}
+	}
+}

+ 76 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/ThreadPoolTask1.java

@@ -0,0 +1,76 @@
+package com.gyee.datatraining.task;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+import com.gyee.datatraining.model.auto.Windpowerstation;
+import com.gyee.datatraining.model.auto.Windturbine;
+import com.gyee.datatraining.util.dd.LstmModelWt;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ThreadPoolTask1 implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+	
+	private static final long serialVersionUID = 0;
+	private String unicode4hour="JKYC001"; 
+	private String unicode1day="JKYC006"; 
+	private String unicode3day="JKYC011"; 
+	private String unicode7day="JKYC016"; 
+	private String unicode1month="JKYC021"; 
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private List<Windturbine> wtls;
+	private LstmModelWt lstmModelWt;
+	private Windpowerstation wp;
+
+	public ThreadPoolTask1(Object tasks,List<Windturbine> wtls,Windpowerstation wp,LstmModelWt lstmModelWt) {
+
+		this.threadPoolTaskData = tasks;
+		this.wtls = wtls;
+		this.wp = wp;
+		this.lstmModelWt = lstmModelWt;
+	}
+
+	public synchronized String call() throws Exception {
+
+		
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		
+
+		try {
+
+			for(Windturbine wt:wtls)
+			{
+				lstmModelWt.castDataBy4Hour(wt.getId(), unicode4hour);
+				logger.info(wt.getId() + "风机未来4小时数据保存成功!");
+
+			}
+
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+
+}

+ 79 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/ThreadPoolTask2.java

@@ -0,0 +1,79 @@
+package com.gyee.datatraining.task;
+
+import com.gyee.datatraining.model.auto.Windpowerstation;
+import com.gyee.datatraining.model.auto.Windturbine;
+import com.gyee.datatraining.util.dd.LstmModelWt;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.concurrent.Callable;
+import com.gyee.datatraining.model.auto.Windturbine;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class ThreadPoolTask2 implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+	private static final long serialVersionUID = 0;
+	private String unicode4hour="JKYC001"; 
+	private String unicode1day="JKYC006"; 
+	private String unicode3day="JKYC011"; 
+	private String unicode7day="JKYC016"; 
+	private String unicode1month="JKYC021"; 
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+
+	private List<Windturbine> wtls;
+	private LstmModelWt lstmModelWt;
+	private Windpowerstation wp;
+
+	public ThreadPoolTask2(Object tasks,List<Windturbine> wtls,Windpowerstation wp,LstmModelWt lstmModelWt) {
+
+		this.threadPoolTaskData = tasks;
+		this.wtls = wtls;
+		this.wp = wp;
+		this.lstmModelWt = lstmModelWt;
+	}
+
+	public synchronized String call() throws Exception {
+
+		
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		
+
+		try {
+				for(Windturbine wt:wtls)
+				{
+					lstmModelWt.castDataBy1Day(wt.getId(), unicode1day);
+					logger.info(wt.getId()+"风机未来1天数据保存成功!");
+	
+				}
+
+			// if (StringUtils.notEmp(vo)) {
+			//
+			// lstmModelWt.castDataBy1Day(wt.getId(),unicode1day,vo.getMultiLayerNetwork(),
+			// vo.getMaxvalues(), vo.getMinvalues());
+			// logger.info(wt.getId()+"风机未来1天数据保存成功!");
+			//
+			// }
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+}

+ 74 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/ThreadPoolTask3.java

@@ -0,0 +1,74 @@
+package com.gyee.datatraining.task;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.concurrent.Callable;
+
+import com.gyee.datatraining.model.auto.Windpowerstation;
+import com.gyee.datatraining.model.auto.Windturbine;
+import com.gyee.datatraining.util.dd.LstmModelWt;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ThreadPoolTask3 implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+	private static final long serialVersionUID = 0;
+	private String unicode4hour="JKYC001"; 
+	private String unicode1day="JKYC006"; 
+	private String unicode3day="JKYC011"; 
+	private String unicode7day="JKYC016"; 
+	private String unicode1month="JKYC021"; 
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private List<Windturbine> wtls;
+	private LstmModelWt lstmModelWt;
+	private Windpowerstation wp;
+
+	public ThreadPoolTask3(Object tasks,List<Windturbine> wtls,Windpowerstation wp,LstmModelWt lstmModelWt) {
+
+		this.threadPoolTaskData = tasks;
+		this.wtls = wtls;
+		this.wp = wp;
+		this.lstmModelWt = lstmModelWt;
+	}
+
+	public synchronized String call() throws Exception {
+
+		
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		
+
+		try {
+				for(Windturbine wt:wtls)
+				{
+					lstmModelWt.castDataBy3Day(wt.getId(), unicode3day);
+					logger.info(wt.getId()+"风机未来3天数据保存成功!");
+	
+				}
+//			if (StringUtils.notEmp(vo)) {
+//				
+//				lstmModelWt.castDataBy3Day(wt.getId(),unicode3day,vo.getMultiLayerNetwork(), vo.getMaxvalues(), vo.getMinvalues());
+//				logger.info(wt.getId()+"风机未来3天数据保存成功!");
+//				
+//			}
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+}

+ 75 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/ThreadPoolTask4.java

@@ -0,0 +1,75 @@
+package com.gyee.datatraining.task;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.concurrent.Callable;
+
+import com.gyee.datatraining.model.auto.Windpowerstation;
+import com.gyee.datatraining.model.auto.Windturbine;
+import com.gyee.datatraining.util.dd.LstmModelWt;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ThreadPoolTask4 implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+	private static final long serialVersionUID = 0;
+	private String unicode4hour="JKYC001"; 
+	private String unicode1day="JKYC006"; 
+	private String unicode3day="JKYC011"; 
+	private String unicode7day="JKYC016"; 
+	private String unicode1month="JKYC021"; 
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+
+	private List<Windturbine> wtls;
+	private LstmModelWt lstmModelWt;
+	private Windpowerstation wp;
+
+	public ThreadPoolTask4(Object tasks,List<Windturbine> wtls,Windpowerstation wp,LstmModelWt lstmModelWt) {
+
+		this.threadPoolTaskData = tasks;
+		this.wtls = wtls;
+		this.wp = wp;
+		this.lstmModelWt = lstmModelWt;
+	}
+
+	public synchronized String call() throws Exception {
+
+		
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		
+
+		try {
+			for(Windturbine wt:wtls)
+			{
+				lstmModelWt.castDataBy7Day(wt.getId(), unicode7day);
+				logger.info(wt.getId()+"风机未来7天数据保存成功!");
+			}
+
+//			if (StringUtils.notEmp(vo)) {
+//				
+//				lstmModelWt.castDataBy7Day(wt.getId(),unicode7day,vo.getMultiLayerNetwork(), vo.getMaxvalues(), vo.getMinvalues());
+//				logger.info(wt.getId()+"风机未来7天数据保存成功!");
+//
+//			}
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+}

+ 73 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/task/ThreadPoolTask5.java

@@ -0,0 +1,73 @@
+package com.gyee.datatraining.task;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.concurrent.Callable;
+
+import com.gyee.datatraining.model.auto.Windpowerstation;
+import com.gyee.datatraining.model.auto.Windturbine;
+import com.gyee.datatraining.util.dd.LstmModelWt;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ThreadPoolTask5 implements Callable<String>, Serializable {
+
+	private Logger logger = LoggerFactory.getLogger(this.getClass());
+	private static final long serialVersionUID = 0;
+	private String unicode4hour="JKYC001"; 
+	private String unicode1day="JKYC006"; 
+	private String unicode3day="JKYC011"; 
+	private String unicode7day="JKYC016"; 
+	private String unicode1month="JKYC021"; 
+	// 保存任务所需要的数据
+
+	private Object threadPoolTaskData;
+	private List<Windturbine> wtls;
+	private LstmModelWt lstmModelWt;
+	private Windpowerstation wp;
+
+	public ThreadPoolTask5(Object tasks,List<Windturbine> wtls,Windpowerstation wp,LstmModelWt lstmModelWt) {
+
+		this.threadPoolTaskData = tasks;
+		this.wtls = wtls;
+		this.wp = wp;
+		this.lstmModelWt = lstmModelWt;
+	}
+
+	public synchronized String call() throws Exception {
+
+		
+		// 处理一个任务,这里的处理方式太简单了,仅仅是一个打印语句
+
+		//System.out.println("开始执行任务:" + threadPoolTaskData);
+
+		String result = "";
+
+		// //便于观察,等待一段时间
+
+		
+
+		try {
+			for(Windturbine wt:wtls)
+			{
+				lstmModelWt.castDataBy1Month(wt.getId(), unicode1month);
+				logger.info(wt.getId()+"风机未来1个月数据保存成功!");
+
+			}
+//			if (StringUtils.notEmp(vo)) {
+//								
+//				lstmModelWt.castDataBy1Month(wt.getId(),unicode1month,vo.getMultiLayerNetwork(), vo.getMaxvalues(), vo.getMinvalues());
+//				logger.info(wt.getId()+"风机未来1个月数据保存成功!");
+//			}
+
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		threadPoolTaskData = null;
+
+		return result;
+
+	}
+
+}

+ 601 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/DateUtils.java

@@ -0,0 +1,601 @@
+package com.gyee.datatraining.util;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * 
+ * 
+ * 项目名称:nxfd 类名称:DateUtils 类描述: 创建人:石林 创建时间:2015-3-30 上午11:42:54 修改人:shilinno1
+ * 修改时间:2015-3-30 上午11:42:54 修改备注:
+ * 
+ * @version
+ * 
+ */
+public class DateUtils {
+
+    private static final String format = "yyyy-MM-dd";
+    private static final String format1 = "yyyy-MM-dd HH:mm:ss";
+    private static final String format2 = "MM/dd/yyyy HH:mm:ss";
+
+    // 第一次调用get将返回null
+
+    private static ThreadLocal<SimpleDateFormat> threadLocal = new ThreadLocal<SimpleDateFormat>();
+
+    // 获取线程的变量副本,如果不覆盖initialValue,第一次get返回null,故需要初始化一个SimpleDateFormat,并set到threadLocal中
+
+    public static SimpleDateFormat getFormat() {
+
+        SimpleDateFormat df = (SimpleDateFormat) threadLocal.get();
+
+        if (df == null) {
+            df = new SimpleDateFormat(format);
+            threadLocal.set(df);
+        }
+
+        return df;
+
+    }
+
+    public static SimpleDateFormat getFormat1() {
+
+        SimpleDateFormat df1 = (SimpleDateFormat) threadLocal.get();
+
+        if (df1 == null) {
+            df1 = new SimpleDateFormat(format1);
+            threadLocal.set(df1);
+        }
+
+        return df1;
+
+    }
+
+    public static SimpleDateFormat getFormat2() {
+
+        SimpleDateFormat df2 = (SimpleDateFormat) threadLocal.get();
+
+        if (df2 == null) {
+            df2 = new SimpleDateFormat(format2);
+            threadLocal.set(df2);
+        }
+
+        return df2;
+
+    }
+
+    private DateUtils() {
+    }
+
+    /**
+     * 获取系统日期(无时分秒毫秒)
+     * 
+     * @return
+     */
+    public static Date today() {
+        return truncate(now());
+    }
+
+    /**
+     * 获取系统时间
+     * 
+     * @return
+     */
+    public static Date now() {
+        return new Date();
+    }
+
+    /**
+     * 根据年月日生成日期对象
+     * 
+     * @param y
+     * @param m
+     * @param d
+     * @return
+     */
+    public static Date cons(int y, int m, int d) {
+        Calendar cal = Calendar.getInstance();
+        cal.set(y, m, d, 0, 0, 0);
+        return cal.getTime();
+    }
+
+    public static String toDate(Date date) {
+        return getFormat1().format(date);
+    }
+
+    public static String toDate2(Date date) {
+        return getFormat2().format(date);
+    }
+
+    public static String toDate1(Date date) {
+        return getFormat().format(date);
+    }
+
+    /**
+     * 根据年月日时分秒生成日期对象
+     * 
+     * @param y
+     * @param m
+     * @param d
+     * @param h
+     * @param mi
+     * @param s
+     * @return
+     */
+    public static Date cons(int y, int m, int d, int h, int mi, int s) {
+        Calendar cal = Calendar.getInstance();
+        cal.set(y, m, d, h, mi, s);
+        return cal.getTime();
+    }
+
+    /**
+     * 将指定时间转化为 Calendar
+     * 
+     * @param date
+     * @return
+     */
+    public static Calendar getCal(Date date) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        return cal;
+    }
+
+    /**
+     * 将时间的时分秒毫秒字段去掉
+     * 
+     * @param date
+     * @return
+     */
+    public static Date truncate(Date date) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+        return cal.getTime();
+    }
+
+    /**
+     * 去掉日期中日及下级字段
+     * 
+     * @param date
+     * @return
+     */
+    public static Date truncDay(Date date) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.set(Calendar.DAY_OF_MONTH, 1);
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+        return cal.getTime();
+    }
+
+    /**
+     * 去掉日期中的月及下级字段
+     * 
+     * @param date
+     * @return
+     */
+    public static Date truncMonth(Date date) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.set(Calendar.MONTH, 0);
+        cal.set(Calendar.DAY_OF_MONTH, 1);
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+        return cal.getTime();
+    }
+
+    /**
+     * 在指定时间上加指定的天数
+     * 
+     * @param date
+     * @param day
+     * @return
+     */
+    public static Date addDays(Date date, int day) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.DAY_OF_MONTH, day);
+        return cal.getTime();
+    }
+
+    /**
+     * 在指定的时间上加指定的月数
+     * 
+     * @param date
+     * @param month
+     * @return
+     */
+    public static Date addMonths(Date date, int month) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.MONTH, month);
+        return cal.getTime();
+    }
+
+    /**
+     * 在指定的时间上加指定的月数
+     * 
+     * @param date
+     * @param month
+     * @return
+     */
+    public static Date addYears(Date date, int year) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        cal.add(Calendar.YEAR, year);
+        return cal.getTime();
+    }
+
+    /**
+     * 在指定时间上加指定的小时
+     * 
+     * @param date
+     * @param day
+     * @return
+     */
+    public static Date addHours(Date date, int hour) {
+        return new Date(date.getTime() + hour * 3600 * 1000);
+    }
+
+    /**
+     * 在指定时间上加指定的分钟
+     * 
+     * @param date
+     * @param day
+     * @return
+     */
+    public static Date addMinutes(Date date, int m) {
+        return new Date(date.getTime() + m * 60 * 1000);
+    }
+
+    /**
+     * 在指定时间上加指定的秒
+     * 
+     * @param date
+     * @param day
+     * @return
+     */
+    public static Date addSeconds(Date date, int s) {
+        return new Date(date.getTime() + s * 1000);
+    }
+
+    /**
+     * 计算两个时间之间差的天数(取整后)
+     * 
+     * @param d1
+     * @param d2
+     * @return
+     */
+    public static int daysDiff(Date d1, Date d2) {
+        return (int) Math.floor(Math.abs((d1.getTime() - d2.getTime())) / (60 * 60 * 24 * 1000));
+    }
+
+    /**
+     * 计算两个时间之间差的小时数(取整后)
+     * 
+     * @param d1
+     * @param d2
+     * @return
+     */
+    public static int hoursDiff(Date d1, Date d2) {
+        return (int) Math.floor(Math.abs((d1.getTime() - d2.getTime())) / (60 * 60 * 1000));
+    }
+
+    public static double hoursDiff1(Date d1, Date d2) {
+        return Math.floor(Math.abs((d1.getTime() - d2.getTime())) / (double) (60 * 60 * 1000));
+    }
+
+    public static double hoursDiff2(Date d1, Date d2) {
+        return Math.abs((d1.getTime() - d2.getTime())) / (double) (60 * 60 * 1000);
+    }
+
+    /**
+     * 计算两个时间之间差的分钟数(取整后)
+     * 
+     * @param d1
+     * @param d2
+     * @return
+     */
+    public static int minutesDiff(Date d1, Date d2) {
+        return (int) Math.floor(Math.abs((d1.getTime() - d2.getTime())) / (60 * 1000));
+    }
+
+    /**
+     * 计算两个时间之间差的分钟数(取整后)
+     * 
+     * @param d1
+     * @param d2
+     * @return
+     */
+    public static double minutesDiff2(Date d1, Date d2) {
+        return Math.floor(Math.abs((d1.getTime() - d2.getTime())) / (60 * 1000));
+    }
+
+    /**
+     * 计算两个时间之间差的毫秒数(取整后)
+     * 
+     * @param d1
+     * @param d2
+     * @return
+     */
+    public static long millisecondDiff(Date d1, Date d2) {
+        return Math.abs(d1.getTime() - d2.getTime());
+    }
+
+    /**
+     * 计算两个时间之间差的秒数(取整后)
+     * 
+     * @param d1
+     * @param d2
+     * @return
+     */
+    public static int secondsDiff(Date d1, Date d2) {
+        return (int) Math.floor(Math.abs((d1.getTime() - d2.getTime())) / (1000));
+    }
+
+    /**
+     * 计算两个时间之间的月差
+     * 
+     * @param d1
+     * @param d2
+     * @return
+     */
+    public static int monthsDiff(Date d1, Date d2) {
+        Calendar cal1 = Calendar.getInstance();
+        Calendar cal2 = Calendar.getInstance();
+        cal1.setTime(d1);
+        cal2.setTime(d2);
+
+        return (int) Math.abs((cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR)) * 12 + cal1.get(Calendar.MONTH) - cal2.get(Calendar.MONTH));
+
+    }
+
+    /**
+     * 获得指定时间的月数
+     * 
+     * @param date
+     * @return
+     */
+    public static int getMonth(Date date) {
+        Calendar cd = Calendar.getInstance();
+        cd.setTime(date);
+        return cd.get(Calendar.MONTH);
+    }
+
+    /**
+     * 获得指定时间的年数
+     * 
+     * @param date
+     * @return
+     */
+    public static int getYear(Date date) {
+        Calendar cd = Calendar.getInstance();
+        cd.setTime(date);
+        return cd.get(Calendar.YEAR);
+    }
+
+    /**
+     * 获取指定时间的天数
+     * 
+     * @param date
+     * @return
+     */
+    public static int getDay(Date date) {
+        Calendar cd = Calendar.getInstance();
+        cd.setTime(date);
+        return cd.get(Calendar.DAY_OF_MONTH);
+    }
+
+    public static int getCurrentMonthLastDay() {
+        Calendar a = Calendar.getInstance();
+        a.set(Calendar.DATE, 1);
+        a.roll(Calendar.DATE, -1);
+        int maxDate = a.get(Calendar.DATE);
+        return maxDate;
+    }
+
+    public static int getMonthDays(Date date) {
+        Calendar cal = Calendar.getInstance();
+        cal.set(DateUtils.getYear(date), DateUtils.getMonth(date), DateUtils.getDay(date));
+        int dayst = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
+        return dayst;
+    }
+
+    /**
+     * 获取当前月的第一天
+     * 
+     * @return
+     */
+    public static String getCurrtenFirstDay() {
+
+        Calendar c = Calendar.getInstance();
+        // c.add(Calendar.MONTH, 0);
+        c.set(Calendar.DAY_OF_MONTH, 1);
+        return getFormat().format(c.getTime());
+    }
+
+    /**
+     * 获取当前月的最后一天
+     * 
+     * @return
+     */
+    public static String getCurrtenLastDay() {
+
+        Calendar ca = Calendar.getInstance();
+        ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
+        return getFormat().format(ca.getTime());
+    }
+
+    /**
+     * 获取当前月的第一天
+     * 
+     * @return
+     */
+    public static Date getCurrtenFirstDate() {
+
+        Calendar c = Calendar.getInstance();
+        c.set(Calendar.DAY_OF_MONTH, c.getActualMinimum(Calendar.DAY_OF_MONTH));
+        c.set(Calendar.HOUR_OF_DAY, 0);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 1);
+        return c.getTime();
+    }
+
+    /**
+     * 获取当前月的最后一天
+     * 
+     * @return
+     */
+    public static Date getCurrtenLastDate() {
+
+        Calendar c = Calendar.getInstance();
+        c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
+        c.set(Calendar.HOUR_OF_DAY, 23);
+        c.set(Calendar.MINUTE, 59);
+        c.set(Calendar.SECOND, 59);
+        return c.getTime();
+    }
+
+    public static Date parseDate(String date) {
+        try {
+            return getFormat().parse(date);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public static Date parseDate1(String date) {
+        try {
+            return getFormat1().parse(date);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public static Date parseDate2(String date) {
+        try {
+            return getFormat2().parse(date);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public static Date parseLongToDate(long time) {
+        return new Date(time);
+    }
+
+    /**
+     * 转换Edna时间格式为标准格式
+     * 
+     * @param pointTime
+     * @return
+     */
+    public static String convertEdnaTime2(String pointTime, Boolean isNoSec) {
+        StringBuffer sb = new StringBuffer();
+        String[] dt = pointTime.split(" ");
+        String[] ymd = dt[0].split("-");
+        String[] hms = dt[1].split(":");
+        sb.append(ymd[0]).append("-");
+        if (ymd[1].length() == 1) {
+            sb.append("0").append(ymd[1]);
+        } else {
+            sb.append(ymd[1]);
+        }
+        if (ymd[2].length() == 1) {
+            sb.append("-").append("0").append(ymd[2]);
+        } else {
+            sb.append("-").append(ymd[2]);
+        }
+        if (hms[0].length() == 1) {
+            sb.append(" ").append("0").append(hms[0]);
+        } else {
+            sb.append(" ").append(hms[0]);
+        }
+        if (hms[1].length() == 1) {
+            sb.append(":").append("0").append(hms[1]);
+        } else {
+            sb.append(":").append(hms[1]);
+        }
+
+        if (isNoSec) {
+            sb.append(":").append("00");
+        } else {
+            if (hms[2].length() == 1) {
+                sb.append(":").append("0").append(hms[2]);
+            } else {
+                sb.append(":").append(hms[2]);
+            }
+        }
+
+        return sb.toString();
+    }
+
+    /**
+     * 转换Edna时间格式为标准格式
+     * 
+     * @param pointTime
+     * @return
+     */
+    public static String convertEdnaTime(String pointTime, Boolean isNoSec) {
+        String date = getFormat().format(new Date());
+        StringBuffer sb = new StringBuffer();
+        String[] dt = pointTime.split(" ");
+        String[] ymd = dt[0].split("/");
+        String[] hms = dt[1].split(":");
+        if (ymd[2].length() == 2) {
+            sb.append(date.substring(0, 2)).append(ymd[2]).append("-");
+        }
+        if (ymd[0].length() == 1) {
+            sb.append("0").append(ymd[0]);
+        } else {
+            sb.append(ymd[0]);
+        }
+        if (ymd[1].length() == 1) {
+            sb.append("-").append("0").append(ymd[1]);
+        } else {
+            sb.append("-").append(ymd[1]);
+        }
+        if (hms[0].length() == 1) {
+            sb.append(" ").append("0").append(hms[0]);
+        } else {
+            sb.append(" ").append(hms[0]);
+        }
+        if (hms[1].length() == 1) {
+            sb.append(":").append("0").append(hms[1]);
+        } else {
+            sb.append(":").append(hms[1]);
+        }
+
+        if (isNoSec) {
+            sb.append(":").append("00");
+        } else {
+            if (hms[2].length() == 1) {
+                sb.append(":").append("0").append(hms[2]);
+            } else {
+                sb.append(":").append(hms[2]);
+            }
+        }
+
+        return sb.toString();
+    }
+
+    public static String convertEdnaTime(String pointTime) {
+        return convertEdnaTime2(pointTime, false);
+    }
+
+    public static void main(String[] args) {
+        System.out.println(DateUtils.getMonthDays(DateUtils.today()));
+    }
+
+}

+ 172 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/HttpClientUtil.java

@@ -0,0 +1,172 @@
+package com.gyee.datatraining.util;
+
+import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.params.HttpMethodParams;
+
+import java.io.*;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * @ClassName : HttpClientUtil
+ * @Author : xieshengjie
+ * @Date: 2021/12/22 15:52
+ * @Description :
+ */
+public class HttpClientUtil {
+    public static String doGet(String url) {
+        // 输入流
+        InputStream is = null;
+        BufferedReader br = null;
+        String result = null;
+        // 创建httpClient实例
+        HttpClient httpClient = new HttpClient();
+        // 设置http连接主机服务超时时间:15000毫秒
+        // 先获取连接管理器对象,再获取参数对象,再进行参数的赋值
+        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(15000);
+        // 创建一个Get方法实例对象
+        GetMethod getMethod = new GetMethod(url);
+        // 设置get请求超时为60000毫秒
+        getMethod.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, 60000);
+        // 设置请求重试机制,默认重试次数:3次,参数设置为true,重试机制可用,false相反
+        getMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, true));
+        try {
+            // 执行Get方法
+            int statusCode = httpClient.executeMethod(getMethod);
+            // 判断返回码
+            if (statusCode != HttpStatus.SC_OK) {
+                // 如果状态码返回的不是ok,说明失败了,打印错误信息
+                System.err.println("Method faild: " + getMethod.getStatusLine());
+            } else {
+                // 通过getMethod实例,获取远程的一个输入流
+                is = getMethod.getResponseBodyAsStream();
+                // 包装输入流
+                br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+
+                StringBuffer sbf = new StringBuffer();
+                // 读取封装的输入流
+                String temp = null;
+                while ((temp = br.readLine()) != null) {
+                    sbf.append(temp).append("\r\n");
+                }
+
+                result = sbf.toString();
+            }
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            // 关闭资源
+            if (null != br) {
+                try {
+                    br.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (null != is) {
+                try {
+                    is.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            // 释放连接
+            getMethod.releaseConnection();
+        }
+        return result;
+    }
+
+    public static String doPost(String url, Map<String, Object> paramMap) {
+        // 获取输入流
+        InputStream is = null;
+        BufferedReader br = null;
+        String result = null;
+        // 创建httpClient实例对象
+        HttpClient httpClient = new HttpClient();
+        // 设置httpClient连接主机服务器超时时间:15000毫秒
+        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(15000);
+        // 创建post请求方法实例对象
+        PostMethod postMethod = new PostMethod(url);
+        // 设置post请求超时时间
+        postMethod.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, 60000);
+
+        NameValuePair[] nvp = null;
+        // 判断参数map集合paramMap是否为空
+        if (null != paramMap && paramMap.size() > 0) {// 不为空
+            // 创建键值参数对象数组,大小为参数的个数
+
+            nvp = new NameValuePair[paramMap.size()];
+            // 循环遍历参数集合map
+            Set<Entry<String, Object>> entrySet = paramMap.entrySet();
+            // 获取迭代器
+            Iterator<Entry<String, Object>> iterator = entrySet.iterator();
+
+            int index = 0;
+            while (iterator.hasNext()) {
+                Entry<String, Object> mapEntry = iterator.next();
+                // 从mapEntry中获取key和value创建键值对象存放到数组中
+                try {
+                    nvp[index] = new NameValuePair(mapEntry.getKey(),
+                            new String(mapEntry.getValue().toString().getBytes("UTF-8"), "UTF-8"));
+                } catch (UnsupportedEncodingException e) {
+                    e.printStackTrace();
+                }
+                index++;
+            }
+        }
+        // 判断nvp数组是否为空
+        if (null != nvp && nvp.length > 0) {
+            // 将参数存放到requestBody对象中
+            postMethod.setRequestBody(nvp);
+        }
+        // 执行POST方法
+        try {
+            int statusCode = httpClient.executeMethod(postMethod);
+            // 判断是否成功
+            if (statusCode != HttpStatus.SC_OK) {
+                System.err.println("Method faild: " + postMethod.getStatusLine());
+            }
+            // 获取远程返回的数据
+            is = postMethod.getResponseBodyAsStream();
+            // 封装输入流
+            br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+
+            StringBuffer sbf = new StringBuffer();
+            String temp = null;
+            while ((temp = br.readLine()) != null) {
+                sbf.append(temp).append("\r\n");
+            }
+
+            result = sbf.toString();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            // 关闭资源
+            if (null != br) {
+                try {
+                    br.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            if (null != is) {
+                try {
+                    is.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            // 释放连接
+            postMethod.releaseConnection();
+        }
+        return result;
+    }
+}

+ 210 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/IRealTimeDataBaseUtil.java

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

+ 790 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/MongoEdosUtil.java

@@ -0,0 +1,790 @@
+package com.gyee.datatraining.util;
+
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.common.model.DNAStatVal;
+import com.gyee.common.model.DNAVal;
+import com.gyee.common.model.PointData;
+import com.gyee.datatraining.model.auto.Windpowerstationpointnew;
+import com.gyee.datatraining.model.auto.Windturbinetestingpointnew;
+import com.gyee.datatraining.util.realtimesource.IEdosUtil;
+import com.gyee.datatraining.util.realtimesource.StringUtil;
+import com.gyee.datatraining.util.realtimesource.timeseries.ErrorRequest;
+import com.gyee.datatraining.util.realtimesource.timeseries.JsonObjectHelper;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ */
+@Component
+public class MongoEdosUtil implements IEdosUtil {
+
+    private RestTemplate restTemplate =new RestTemplate();
+    private static String baseURL = "http://192.168.2.216:8090/mogodb";
+    @Override
+    public PointData getRealData(Windpowerstationpointnew point) throws Exception {
+        try {
+            Optional<String> keys = Optional.ofNullable(point.getCode());
+
+
+            String url = baseURL + "/getRealData.action?";
+            if (keys.isPresent())
+                url = url + "point=" + keys.get();
+            String s = HttpClientUtil.doGet(url);
+            JSONObject jsonObject=JSONObject.parseObject(s);
+            PointData pointData = JSONObject.toJavaObject(jsonObject, PointData.class);
+            return pointData;
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                return ErrorRequest.RequestError(point.getCode());
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+
+
+
+    @Override
+    public List<PointData> getHistoryDatasSnap(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
+        Optional<String> tagName = Optional.ofNullable(point.getCode());
+        Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
+        Optional<String> thingType = Optional.ofNullable(point.getModelid());
+        Optional<String> uniformCode = Optional.ofNullable(point.getUniformcode());
+        Optional<Long> startTs = Optional.ofNullable(beginDate);
+        Optional<Long> endTs = Optional.ofNullable(endDate);
+        Optional<Long> counts = Optional.ofNullable(count);
+        Optional<Long> prieds = Optional.ofNullable(pried);
+        //通过时间区间和时间间隔获取点数
+
+
+        try {
+            String url = baseURL + "/getHistoryDatasSnap.action?";
+            //tagName 或thingType,thingId,uniformCode可以确定一个标签点
+            if (tagName.isPresent())
+                url = url + "point=" + tagName.get();
+            if (startTs.isPresent())
+                url = url + "&begin=" + startTs.get();
+            if (endTs.isPresent())
+                url = url + "&end=" + endTs.get();
+            if (counts.isPresent())
+                url = url + "&count=" + counts.get();
+            if (prieds.isPresent())
+                url = url + "&pried=" + prieds.get();
+            String s = HttpClientUtil.doGet(url);
+            List<PointData> pointDatas = JSONArray.parseArray(s, PointData.class);
+
+            return pointDatas;
+
+
+
+
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                return ErrorRequest.RequestListError(point.getCode());
+            } else {
+                throw exception;
+            }
+        }
+
+    }
+
+
+
+
+
+    @Override
+    public List<PointData> getHistoryDatasRaw(Windpowerstationpointnew point, Long beginDate, Long endDate) throws Exception {
+        Optional<String> tagName = Optional.ofNullable(point.getCode());
+        Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
+        Optional<String> thingType = Optional.ofNullable(point.getModelid());
+        Optional<String> uniformCode = Optional.ofNullable(point.getUniformcode());
+        Optional<Long> startTs = Optional.ofNullable(beginDate);
+        Optional<Long> endTs = Optional.ofNullable(endDate);
+
+        try {
+            String url = baseURL + "/getHistoryDatasRaw.action?";
+            //tagName 或thingType,thingId,uniformCode可以确定一个标签点
+            if (tagName.isPresent())
+                url = url + "point=" + tagName.get();
+
+
+            if (startTs.isPresent())
+                url = url + "&begin=" + startTs.get();
+            if (endTs.isPresent())
+                url = url + "&end=" + endTs.get();
+
+            String s = HttpClientUtil.doGet(url);
+            List<PointData> pointDatas = JSONArray.parseArray(s, PointData.class);
+           return pointDatas;
+
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                return ErrorRequest.RequestListError(point.getCode());
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+    @Override
+    public PointData getRealData(Windturbinetestingpointnew point) throws Exception {
+        Optional<String> keys = Optional.ofNullable(point.getId());
+        Optional<String> thingType = Optional.ofNullable(point.getModelid());
+        Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
+        Optional<String> uniformCodes = Optional.ofNullable(point.getUniformcode());
+
+        try {
+            String url = baseURL + "/getRealData.action?";
+            //tagName 或thingType,thingId,uniformCode可以确定一个标签点
+            if (keys.isPresent())
+                url = url + "point=" + keys.get();
+
+            String s = HttpClientUtil.doGet(url);
+            JSONObject jsonObject=JSONObject.parseObject(s);
+            PointData pointData = JSONObject.toJavaObject(jsonObject, PointData.class);
+            return pointData;
+
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                return ErrorRequest.RequestError(point.getId());
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+    @Override
+    public List<PointData> getHistoryDatasSnap(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
+
+        Optional<String> tagName = Optional.ofNullable(point.getId());
+        Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
+        Optional<String> thingType = Optional.ofNullable(point.getModelid());
+        Optional<String> uniformCode = Optional.ofNullable(point.getUniformcode());
+        Optional<Long> startTs = Optional.ofNullable(beginDate);
+        Optional<Long> endTs = Optional.ofNullable(endDate);
+        Optional<Long> counts = Optional.ofNullable(count);
+        Optional<Long> prieds = Optional.ofNullable(pried);
+        //通过时间区间和时间间隔获取点数
+
+        try {
+            String url = baseURL + "/getHistoryDatasSnap.action?";
+            //tagName 或thingType,thingId,uniformCode可以确定一个标签点
+            if (tagName.isPresent())
+                url = url + "point=" + tagName.get();
+
+            if (startTs.isPresent())
+                url = url + "&begin=" + startTs.get();
+            if (endTs.isPresent())
+                url = url + "&end=" + endTs.get();
+            if (counts.isPresent())
+                url = url + "&count=" + counts.get();
+            if (prieds.isPresent())
+                url = url + "&pried=" + prieds.get();
+
+            String s = HttpClientUtil.doGet(url);
+            List<PointData> pointDatas = JSONArray.parseArray(s, PointData.class);
+            return pointDatas;
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                return ErrorRequest.RequestListError(point.getId());
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+
+    @Override
+    public List<PointData> getHistoryDatasRaw(Windturbinetestingpointnew point, Long beginDate, Long endDate) throws Exception {
+        Optional<String> tagName = Optional.ofNullable(point.getId());
+        Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
+        Optional<String> thingType = Optional.ofNullable(point.getModelid());
+        Optional<String> uniformCode = Optional.ofNullable(point.getUniformcode());
+        Optional<Long> startTs = Optional.ofNullable(beginDate);
+        Optional<Long> endTs = Optional.ofNullable(endDate);
+        try {
+            String url = baseURL + "/getHistoryDatasRaw.action?";
+            //tagName 或thingType,thingId,uniformCode可以确定一个标签点
+            if (tagName.isPresent())
+                url = url + "point=" + tagName.get();
+            if (startTs.isPresent())
+                url = url + "&begin=" + startTs.get();
+            if (endTs.isPresent())
+                url = url + "&end=" + endTs.get();
+
+            String s = HttpClientUtil.doGet(url);
+            List<PointData> pointDatas = JSONArray.parseArray(s, PointData.class);
+            return pointDatas;
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                return ErrorRequest.RequestListError(point.getId());
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+    @Override
+    public PointData getRealData(String pointid) throws Exception {
+        Optional<String> keys = Optional.ofNullable(pointid);
+        String url = baseURL + "/getRealData.action?";
+        try {
+            if (keys.isPresent())
+                url = url + "point=" + keys.get();
+            else
+                return null;
+
+            String s = HttpClientUtil.doGet(url);
+            JSONObject jsonObject=JSONObject.parseObject(s);
+            PointData pointData = JSONObject.toJavaObject(jsonObject, PointData.class);
+            return pointData;
+
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                return ErrorRequest.RequestError(pointid);
+            } else {
+                return ErrorRequest.RequestError(pointid);
+            }
+        }
+    }
+
+    @Override
+    public List<PointData> getRealData(String... pointids) throws Exception {
+        String pointIdString = StringUtil.join(pointids, ",");
+        Optional<String> keys = Optional.ofNullable(pointIdString);
+        String url = baseURL + "/getRealData.action?1=1";
+        try {
+            if (keys.isPresent())
+                url = url + "&point=" + keys.get();
+            else {
+                return ErrorRequest.RequestListError(pointids);
+            }
+            String s = HttpClientUtil.doGet(url);
+            List<PointData> pointDatas = JSONArray.parseArray(s, PointData.class);
+            return pointDatas;
+
+
+
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                return ErrorRequest.RequestListError(pointids);
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+
+
+    @Override
+    public List<PointData> getRealData(List<String> pointids) throws Exception {
+        String pointIdString = StringUtil.join(pointids.toArray(), ",");
+        Optional<String> keys = Optional.ofNullable(pointIdString);
+        String url = baseURL + "/getRealData.action?";
+        try {
+            if (keys.isPresent())
+                url = url + "keys=" + keys.get();
+            else {
+                String[] arr = new String[pointids.size()];
+                return ErrorRequest.RequestListError(pointids.toArray(arr));
+            }
+            String s = HttpClientUtil.doGet(url);
+            List<PointData> pointDatas = JSONArray.parseArray(s, PointData.class);
+            return pointDatas;
+
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                String[] arr = new String[pointids.size()];
+                return ErrorRequest.RequestListError(pointids.toArray(arr));
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+    @Override
+    public Map<String, Double> getRealDataMap(String... pointids) throws Exception {
+        return null;
+    }
+
+
+	  @Override
+	    public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
+	        Optional<String> tagName = Optional.ofNullable(pointid);
+	        Optional<Long> startTs = Optional.ofNullable(beginDate);
+	        Optional<Long> endTs = Optional.ofNullable(endDate);
+          Optional<Long> counts = Optional.ofNullable(count);
+          Optional<Long> prieds = Optional.ofNullable(pried);
+
+
+          try {
+              String url = baseURL + "/getHistoryDatasSnap.action?";
+              //tagName 或thingType,thingId,uniformCode可以确定一个标签点
+              if (tagName.isPresent())
+                  url = url + "point=" + tagName.get();
+
+              if (startTs.isPresent())
+                  url = url + "&begin=" + startTs.get();
+              if (endTs.isPresent())
+                  url = url + "&end=" + endTs.get();
+              if (counts.isPresent())
+                  url = url + "&count=" + counts.get();
+              if (prieds.isPresent())
+                  url = url + "&pried=" + prieds.get();
+
+
+              String s = HttpClientUtil.doGet(url);
+              List<PointData> pointDatas = JSONArray.parseArray(s, PointData.class);
+              return pointDatas;
+
+
+	        } catch (HttpClientErrorException exception) {
+	            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+	                System.out.println("404请求错误");
+	                return ErrorRequest.RequestListError(pointid);
+	            } else {
+	                throw exception;
+	            }
+	        }
+
+	    }
+
+
+    @Override
+    public List<PointData> getHistoryDatasRaw(String pointid, Long beginDate, Long endDate) throws Exception {
+        Optional<String> tagName = Optional.ofNullable(pointid);
+        Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
+        Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
+
+        try {
+            String url = baseURL + "/history/raw?null=0";
+            //tagName 或thingType,thingId,uniformCode可以确定一个标签点
+            if (tagName.isPresent())
+                url = url + "&tagName=" + tagName.get();
+            if (startTs.isPresent())
+                url = url + "&startTs=" + startTs.get();
+            if (endTs.isPresent())
+                url = url + "&endTs=" + endTs.get();
+
+            ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
+
+            JSONArray jsonArray = resp.getBody();
+            if (jsonArray != null)
+                return JsonObjectHelper.phrasePointData(jsonArray, pointid);
+            else {
+                return ErrorRequest.RequestListError(pointid);
+            }
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                return ErrorRequest.RequestListError(pointid);
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+    @Override
+    public List<PointData> getHistStat(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
+        Optional<String> tagName = Optional.ofNullable(point.getId());
+        Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
+        Optional<String> thingType = Optional.ofNullable(point.getModelid());
+        Optional<String> uniformCode = Optional.ofNullable(point.getUniformcode());
+        Optional<Long> startTs = Optional.ofNullable(beginDate);
+        Optional<Long> endTs = Optional.ofNullable(endDate);
+        Optional<Long> counts = Optional.ofNullable(count);
+        Optional<Long> prieds = Optional.ofNullable(pried);
+        Optional<Integer> types = Optional.ofNullable(type);
+
+
+        try {
+            String url = baseURL + "/getHistStat.action?";
+            //tagName 或thingType,thingId,uniformCode可以确定一个标签点
+            if (tagName.isPresent())
+                url = url + "point=" + tagName.get();
+            if (startTs.isPresent())
+                url = url + "&begin=" + startTs.get();
+            if (endTs.isPresent())
+                url = url + "&end=" + endTs.get();
+            if (counts.isPresent())
+                url = url + "&count=" + counts.get();
+            if (prieds.isPresent())
+                url = url + "&pried=" + prieds.get();
+            if (types.isPresent())
+                url = url + "&type=" + types.get();
+
+            String s = HttpClientUtil.doGet(url);
+            List<PointData> pointDatas = JSONArray.parseArray(s, PointData.class);
+            return pointDatas;
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                return ErrorRequest.RequestListError(point.getId());
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+    @Override
+    public List<PointData> getHistStat(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
+        Optional<String> tagName = Optional.ofNullable(point.getCode());
+        Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
+        Optional<String> thingType = Optional.ofNullable(point.getModelid());
+        Optional<String> uniformCode = Optional.ofNullable(point.getUniformcode());
+        Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
+        Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
+        Optional<Long> counts = Optional.ofNullable(count);
+        Optional<Long> prieds = Optional.ofNullable(pried);
+        Optional<Integer> types = Optional.ofNullable(type);
+
+
+        try {
+            String url = baseURL + "/getHistStat.action?";
+            //tagName 或thingType,thingId,uniformCode可以确定一个标签点
+            if (tagName.isPresent())
+                url = url + "point=" + tagName.get();
+
+            if (startTs.isPresent())
+                url = url + "&begin=" + startTs.get();
+            if (endTs.isPresent())
+                url = url + "&end=" + endTs.get();
+            if (counts.isPresent())
+                url = url + "&count=" + counts.get();
+            if (prieds.isPresent())
+                url = url + "&pried=" + prieds.get();
+            if (types.isPresent())
+                url = url + "&type=" + types.get();
+
+            String s = HttpClientUtil.doGet(url);
+            List<PointData> pointDatas = JSONArray.parseArray(s, PointData.class);
+            return pointDatas;
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                return ErrorRequest.RequestListError(point.getCode());
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+    @Override
+    public List<PointData> getHistStat(String pointid, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
+        Optional<String> tagName = Optional.ofNullable(pointid);
+        Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
+        Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
+        Optional<Long> counts = Optional.ofNullable(count);
+        Optional<Long> prieds = Optional.ofNullable(pried);
+        Optional<Integer> types = Optional.ofNullable(type);
+
+
+        try {
+            String url = baseURL + "/getHistStat.action?";
+            //tagName 或thingType,thingId,uniformCode可以确定一个标签点
+            if (tagName.isPresent())
+                url = url + "point=" + tagName.get();
+
+            if (startTs.isPresent())
+                url = url + "&begin=" + startTs.get();
+            if (endTs.isPresent())
+                url = url + "&end=" + endTs.get();
+            if (counts.isPresent())
+                url = url + "&count=" + counts.get();
+            if (prieds.isPresent())
+                url = url + "&pried=" + prieds.get();
+            if (types.isPresent())
+                url = url + "&type=" + types.get();
+
+            String s = HttpClientUtil.doGet(url);
+            List<PointData> pointDatas = JSONArray.parseArray(s, PointData.class);
+            return pointDatas;
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                return ErrorRequest.RequestListError(pointid);
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+    @Override
+    public DNAStatVal[] getHistStat(String point, Long beginDate, Long endDate, Integer pried) throws Exception {
+        Optional<String> tagName = Optional.ofNullable(point);
+        Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
+        Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
+        //通过时间区间和时间间隔获取点数
+        Optional<Integer> interval = Optional.ofNullable(pried);
+
+        try {
+            String url = baseURL + "/history/stat?null=0";
+            //tagName 或thingType,thingId,uniformCode可以确定一个标签点
+            if (tagName.isPresent())
+                url = url + "&tagName=" + tagName.get();
+            if (startTs.isPresent())
+                url = url + "&startTs=" + startTs.get();
+            if (endTs.isPresent())
+                url = url + "&endTs=" + endTs.get();
+            if (interval.isPresent())
+                url = url + "&interval=" + interval.get();
+
+            //System.out.println(restTemplate.getForEntity(url, JSONArray.class));
+            ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
+            if (resp != null) {
+                JSONArray jsonArray = resp.getBody();
+                if (jsonArray == null || jsonArray.size() <= 0) {
+                    DNAStatVal[] dnaVal = new DNAStatVal[1];
+                    DNAVal errorData = new DNAVal();
+                    errorData.Status = 0;
+
+                    DNAStatVal val = new DNAStatVal();
+                    val.avg = errorData;
+                    val.max = errorData;
+                    val.min = errorData;
+                    dnaVal[0] = val;
+                    return dnaVal;
+                } else {
+                    return JsonObjectHelper.phraseDNAVal(jsonArray);
+                }
+            } else {
+                return null;
+            }
+
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                DNAStatVal val = new DNAStatVal();
+                DNAStatVal[] dnaVal = new DNAStatVal[1];
+                DNAVal errorData = new DNAVal();
+                errorData.Status = 0;
+                val.avg = errorData;
+                val.max = errorData;
+                val.min = errorData;
+                dnaVal[0] = val;
+                return dnaVal;
+
+            } else {
+                DNAStatVal val = new DNAStatVal();
+                DNAStatVal[] dnaVal = new DNAStatVal[1];
+                DNAVal errorData = new DNAVal();
+                errorData.Status = 0;
+                val.avg = errorData;
+                val.max = errorData;
+                val.min = errorData;
+                dnaVal[0] = val;
+                return dnaVal;
+            }
+        }
+    }
+
+    private JSONObject convertPointData(PointData pd) {
+        JSONObject jo = new JSONObject();
+        jo.put("tagName", pd.getEdnaId());
+        JSONObject joo = new JSONObject();
+        joo.put("ts", pd.getPointTime()*1000);
+        joo.put("status", 0);
+        joo.put("doubleValue", pd.getPointValueInDouble());
+        jo.put("tsData", joo);
+        return jo;
+    }
+
+    @Override
+    public void updatePoint(PointData point) throws Exception {
+        String url = baseURL + "/history";
+        try {
+            String result = restTemplate.postForObject(url, convertPointData(point), String.class);
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                return;
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+    @Override
+    public DNAVal[] getRealtimeTagValues(String... tagNames) throws Exception {
+        String pointIdString = StringUtil.join(tagNames, ",");
+        Optional<String> keys = Optional.ofNullable(pointIdString);
+        String url = baseURL + "/latest?null=0";
+        try {
+            if (keys.isPresent())
+                url = url + "&keys=" + keys.get();
+            else
+                return null;
+
+            ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
+            JSONObject jsonObject = resp.getBody();
+            if (StringUtils.isNotEmpty(jsonObject) && !jsonObject.isEmpty()){
+                return JsonObjectHelper.phraseDNAVal(jsonObject,tagNames);
+            } else {
+            	  DNAVal[] errorResult = new DNAVal[tagNames.length];
+                  for(int i=0;i<tagNames.length;i++)
+                  {
+                  	 DNAVal val = new DNAVal();
+                       val.Status = 0;
+                       errorResult[i] = val;
+                  }
+                  return errorResult;
+            }
+
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+                DNAVal[] errorResult = new DNAVal[tagNames.length];
+                for(int i=0;i<tagNames.length;i++)
+                {
+                	 DNAVal val = new DNAVal();
+                     val.Status = 0;
+                     errorResult[i] = val;
+                }
+                return errorResult;
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+    @Override
+    public void updatePoint(List<PointData> pointls) throws Exception {
+        String url = baseURL + "/history/batch";
+        List<JSONObject> writeList = new ArrayList<>();
+
+        for (PointData entity : pointls) {
+            writeList.add(convertPointData(entity));
+        }
+        try {
+            String result = restTemplate.postForObject(url, writeList, String.class);
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                return;
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+    @Override
+    public void sendSinglePoint(PointData point) throws Exception {
+        String url = baseURL + "/latest";
+
+
+        try {
+            String result = restTemplate.postForObject(url, convertPointData(point), String.class);
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                return;
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+    @Override
+    public void sendMultiPoint(List<PointData> pointls) throws Exception {
+
+        String url = baseURL + "/latest/batch";
+        List<JSONObject> writeList = new ArrayList<>();
+
+        for (PointData entity : pointls) {
+            writeList.add(convertPointData(entity));
+        }
+        try {
+            String result = restTemplate.postForObject(url, writeList, String.class);
+        } catch (HttpClientErrorException exception) {
+            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                System.out.println("404请求错误");
+            } else {
+                throw exception;
+            }
+        }
+    }
+
+    @Override
+    public void sendMultiPoint(String[] realvalue, DNAVal[] pointls) throws Exception {
+        String url = baseURL + "/latest/batch";
+
+        List<JSONObject> writeDataList = new ArrayList<>();
+        if (realvalue != null && pointls != null & realvalue.length == pointls.length) {
+            for (int i = 0; i < realvalue.length; i++) {
+                PointData writeData = new PointData();
+                writeData.setEdnaId(realvalue[i]);
+                writeData.setPointValueInDouble(pointls[i].DValue);
+                writeData.setPointTime((long)pointls[i].Time);
+                JSONObject jsonObject=convertPointData(writeData);
+                writeDataList.add(jsonObject);
+            }
+
+            try {
+                String result = restTemplate.postForObject(url, writeDataList, String.class);
+            } catch (HttpClientErrorException exception) {
+                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
+                    System.out.println("404请求错误");
+                } else {
+                    throw exception;
+                }
+            }
+        } else
+            return;
+    }
+
+    //多点切面数据
+    @Override
+    public DNAVal[] getHistMatrix(String[] nameList, int tTime) throws Exception {
+        String tagNameString = StringUtil.join(nameList, ",");
+        Long time = Long.valueOf(tTime);
+        Optional<String> tagName = Optional.ofNullable(tagNameString);
+        Optional<Long> ts = Optional.ofNullable(time * 1000);
+        String url = baseURL + "/history/section?tagNames=" + tagName.get() + "&ts=" + ts.get();
+        try {
+            ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
+            JSONObject jsonObject = resp.getBody();
+            if (StringUtils.isNotEmpty(jsonObject) && !jsonObject.isEmpty())
+            {
+            	 return JsonObjectHelper.phraseDNAVal(jsonObject,nameList);
+            }
+            else {
+                DNAVal[] errorResult = new DNAVal[nameList.length];
+                for(int i=0;i<nameList.length;i++)
+                {
+                	 DNAVal val = new DNAVal();
+                     val.Status = 0;
+                     errorResult[i] = val;
+                }
+                return errorResult;
+            }
+        } catch (Exception e) {
+        	  DNAVal[] errorResult = new DNAVal[nameList.length];
+              for(int i=0;i<nameList.length;i++)
+              {
+              	 DNAVal val = new DNAVal();
+                   val.Status = 0;
+                   errorResult[i] = val;
+              }
+              return errorResult;
+        }
+    }
+
+
+}

+ 24 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/RealTimeDataBaseFactory.java

@@ -0,0 +1,24 @@
+package com.gyee.datatraining.util;
+
+
+import com.gyee.datatraining.config.V2Config;
+import com.gyee.datatraining.util.realtimesource.EdosUtil;
+
+public class RealTimeDataBaseFactory {
+
+
+    public static IRealTimeDataBaseUtil createRealTimeDataBase() {
+
+//        return new EdosUtil();
+        switch (V2Config.getRealtimedataBase()) {
+            case "mongodb":
+                return new EdosUtil();
+            case "golden":
+                return new EdosUtil();
+            default:
+                return new EdosUtil();
+        }
+
+
+    }
+}

+ 116 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/SpringUtils.java

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

+ 559 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/StringUtils.java

@@ -0,0 +1,559 @@
+package com.gyee.datatraining.util;
+
+import org.apache.commons.lang.WordUtils;
+import org.apache.commons.lang.text.StrBuilder;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+/**
+ * 字符串工具类
+ * 
+ * @author fc
+ */
+public class StringUtils extends org.apache.commons.lang3.StringUtils
+{
+    /** 空字符串 */
+    private static final String NULLSTR = "";
+
+    /** 下划线 */
+    private static final char SEPARATOR = '_';
+
+    /**
+     * 获取参数不为空值
+     * 
+     * @param value defaultValue 要判断的value
+     * @return value 返回值
+     */
+    public static <T> T nvl(T value, T defaultValue)
+    {
+        return value != null ? value : defaultValue;
+    }
+
+    /**
+     * * 判断一个Collection是否为空, 包含List,Set,Queue
+     * 
+     * @param coll 要判断的Collection
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Collection<?> coll)
+    {
+        return isNull(coll) || coll.isEmpty();
+    }
+
+    /**
+     * * 判断一个Collection是否非空,包含List,Set,Queue
+     * 
+     * @param coll 要判断的Collection
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Collection<?> coll)
+    {
+        return !isEmpty(coll);
+    }
+    public static int roundToInt(double num) {
+
+        return new BigDecimal(num).setScale(0, RoundingMode.HALF_UP).intValue();
+    }
+    /**
+     * * 判断一个对象数组是否为空
+     * 
+     * @param objects 要判断的对象数组
+     ** @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Object[] objects)
+    {
+        return isNull(objects) || (objects.length == 0);
+    }
+
+    /**
+     * * 判断一个对象数组是否非空
+     * 
+     * @param objects 要判断的对象数组
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Object[] objects)
+    {
+        return !isEmpty(objects);
+    }
+
+    /**
+     * * 判断一个Map是否为空
+     * 
+     * @param map 要判断的Map
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Map<?, ?> map)
+    {
+        return isNull(map) || map.isEmpty();
+    }
+
+    /**
+     * * 判断一个Map是否为空
+     * 
+     * @param map 要判断的Map
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Map<?, ?> map)
+    {
+        return !isEmpty(map);
+    }
+
+    /**
+     * * 判断一个字符串是否为空串
+     * 
+     * @param str String
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(String str)
+    {
+        return isNull(str) || NULLSTR.equals(str.trim());
+    }
+
+    /**
+     * * 判断一个字符串是否为非空串
+     * 
+     * @param str String
+     * @return true:非空串 false:空串
+     */
+    public static boolean isNotEmpty(String str)
+    {
+        return !isEmpty(str);
+    }
+
+    /**
+     * * 判断一个对象是否为空
+     * 
+     * @param object Object
+     * @return true:为空 false:非空
+     */
+    public static boolean isNull(Object object)
+    {
+        return object == null;
+    }
+
+    /**
+     * * 判断一个对象是否非空
+     * 
+     * @param object Object
+     * @return true:非空 false:空
+     */
+    public static boolean isNotNull(Object object)
+    {
+        return !isNull(object);
+    }
+
+    /**
+     * * 判断一个对象是否是数组类型(Java基本型别的数组)
+     * 
+     * @param object 对象
+     * @return true:是数组 false:不是数组
+     */
+    public static boolean isArray(Object object)
+    {
+        return isNotNull(object) && object.getClass().isArray();
+    }
+
+    /**
+     * 去空格
+     */
+    public static String trim(String str)
+    {
+        return (str == null ? "" : str.trim());
+    }
+
+    /**
+     * 截取字符串
+     * 
+     * @param str 字符串
+     * @param start 开始
+     * @return 结果
+     */
+    public static String substring(final String str, int start)
+    {
+        if (str == null)
+        {
+            return NULLSTR;
+        }
+
+        if (start < 0)
+        {
+            start = str.length() + start;
+        }
+
+        if (start < 0)
+        {
+            start = 0;
+        }
+        if (start > str.length())
+        {
+            return NULLSTR;
+        }
+
+        return str.substring(start);
+    }
+
+    /**
+     * 截取字符串
+     * 
+     * @param str 字符串
+     * @param start 开始
+     * @param end 结束
+     * @return 结果
+     */
+    public static String substring(final String str, int start, int end)
+    {
+        if (str == null)
+        {
+            return NULLSTR;
+        }
+
+        if (end < 0)
+        {
+            end = str.length() + end;
+        }
+        if (start < 0)
+        {
+            start = str.length() + start;
+        }
+
+        if (end > str.length())
+        {
+            end = str.length();
+        }
+
+        if (start > end)
+        {
+            return NULLSTR;
+        }
+
+        if (start < 0)
+        {
+            start = 0;
+        }
+        if (end < 0)
+        {
+            end = 0;
+        }
+
+        return str.substring(start, end);
+    }
+
+
+    /**
+     * 驼峰首字符小写 NameVc>>nameVc
+     */
+    public static String uncapitalize(String str)
+    {
+        int strLen;
+        if (str == null || (strLen = str.length()) == 0)
+        {
+            return str;
+        }
+        return new StrBuilder(strLen).append(Character.toLowerCase(str.charAt(0))).append(str.substring(1)).toString();
+    }
+
+    /**
+     * 驼峰命名转下划线 nameVc>>name_vc
+     */
+    public static String toUnderScoreCase(String s)
+    {
+        if (s == null)
+        {
+            return null;
+        }
+        StringBuilder sb = new StringBuilder();
+        boolean upperCase = false;
+        for (int i = 0; i < s.length(); i++)
+        {
+            char c = s.charAt(i);
+
+            boolean nextUpperCase = true;
+
+            if (i < (s.length() - 1))
+            {
+                nextUpperCase = Character.isUpperCase(s.charAt(i + 1));
+            }
+
+            if ((i > 0) && Character.isUpperCase(c))
+            {
+                if (!upperCase || !nextUpperCase)
+                {
+                    sb.append(SEPARATOR);
+                }
+                upperCase = true;
+            }
+            else
+            {
+                upperCase = false;
+            }
+
+            sb.append(Character.toLowerCase(c));
+        }
+
+        return sb.toString();
+    }
+
+    /**
+     * 是否包含字符串
+     * 
+     * @param str 验证字符串
+     * @param strs 字符串组
+     * @return 包含返回true
+     */
+    public static boolean inStringIgnoreCase(String str, String... strs)
+    {
+        if (str != null && strs != null)
+        {
+            for (String s : strs)
+            {
+                if (str.equalsIgnoreCase(trim(s)))
+                {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+   
+    
+    /**
+     * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld
+     * 
+     * @param name 转换前的下划线大写方式命名的字符串
+     * @return 转换后的驼峰式命名的字符串
+     */
+    public static String convertToCamelCase(String name)
+    {
+        StringBuilder result = new StringBuilder();
+        // 快速检查
+        if (name == null || name.isEmpty())
+        {
+            // 没必要转换
+            return "";
+        }
+        else if (!name.contains("_"))
+        {
+            // 不含下划线,仅将首字母大写
+            return name.substring(0, 1).toUpperCase() + name.substring(1);
+        }
+        // 用下划线将原始字符串分割
+        String[] camels = name.split("_");
+        for (String camel : camels)
+        {
+            // 跳过原始字符串中开头、结尾的下换线或双重下划线
+            if (camel.isEmpty())
+            {
+                continue;
+            }
+            // 首字母大写
+            result.append(camel.substring(0, 1).toUpperCase());
+            result.append(camel.substring(1).toLowerCase());
+        }
+        return result.toString();
+    }
+    /**
+     * 首字母大写
+     *
+     * @param name
+     * @return
+     */
+    public static String firstUpperCase(String name) {
+        name = name.substring(0, 1).toUpperCase() + name.substring(1);
+        return name;
+    }
+    /**
+     * 首字母小写
+     *
+     * @param name
+     * @return
+     */
+    public static String firstLowerCase(String name) {
+        name = name.substring(0, 1).toLowerCase() + name.substring(1);
+        return name;
+
+    }
+    
+    /**
+     * 将下划线转化为大写
+     *
+     * @param name
+     * @param firstCase 首字母是否大写 true:大写 false;小写
+     * @return
+     */
+    public static String upperCase_(String name, boolean firstCase) {
+        if(isEmpty(name)){
+            return "";
+        }
+        String[] s = name.split("_");
+        StringBuffer stringBuffer = new StringBuffer();
+        for (String s1 : s) {
+            stringBuffer.append(s1.substring(0, 1).toUpperCase() + s1.substring(1));
+        }
+        if(!firstCase){
+            return firstLowerCase(stringBuffer.toString());
+        }
+        return stringBuffer.toString();
+    }
+    
+    /**
+     * get方法名字转成 t_b_abc>>tBAbc
+     * @param str
+     * @return
+     * @author gyee
+     * @Date 2020年1月30日 下午11:55:54
+     */
+    public static String toFUNName(String str) {
+    	StringBuffer buffer=new StringBuffer();
+    	String name=str;
+    	if(name.contains("_")) {
+    		// 用下划线将原始字符串分割
+            String[] camels = name.split("_");
+            boolean b=true;
+            
+            for (String str1 : camels) {
+            	if(str1.length()==1&&b) {
+            		b=false;
+            		buffer.append(str1);
+            	}else {
+            		buffer.append(StringUtils.firstUpperCase(str1));
+            	}
+				
+			}
+    	}else {
+    		buffer.append(StringUtils.firstUpperCase(name));
+    	}
+		return buffer.toString();
+    }
+
+    /**
+     * 列名转换成Java属性名
+     */
+    public static String columnToJava(String columnName) {
+        return WordUtils.capitalizeFully(columnName, new char[]{'_'}).replace("_", "" );
+    }
+    
+    
+    /**
+     * 表名转换成Java类名
+     */
+    public static String tableToJava(String tableName, String tablePrefix) {
+        if (StringUtils.isNotBlank(tablePrefix)) {
+            tableName = tableName.replaceFirst(tablePrefix, "" );
+        }
+        return columnToJava(tableName);
+    }
+
+    /**
+     * 是否不为空串
+     *
+     * @param obj
+     * @return
+     */
+    public static boolean notEmp(Object obj) {
+        return !empty(obj);
+    }
+
+    /**
+     * 是否为空串
+     *
+     * @param obj
+     * @return
+     */
+    public static boolean empty(Object obj) {
+        if (obj == null)
+            return true;
+        String str;
+        if (obj instanceof String) {
+            str = (String) obj;
+        } else {
+            str = obj.toString();
+        }
+        return str.length() == 0;
+    }
+
+    public static double round(double num, int digit) {
+
+        return new BigDecimal(num).setScale(digit, RoundingMode.HALF_UP).doubleValue();
+    }
+    /**
+     * 将字符串解析为Date类型
+     *
+     * @param date
+     * @param pattern
+     * @return
+     */
+    public static Date toDate(String date, String pattern) {
+        SimpleDateFormat format = new SimpleDateFormat(pattern);
+        try {
+            return format.parse(date);
+        } catch (ParseException e) {
+            throw new RuntimeException(String.format("Failed to parse the String [%s] to Date.", date), e);
+        }
+    }
+    /**
+     *
+     * @方法名称: getUUID
+     * @描述: 获得UUID
+     * @参数 @return
+     * @返回值 String
+     * @抛出异常
+     */
+    public static String getUUID() {
+        String s = UUID.randomUUID().toString();
+        // 去掉“-”符号
+        return s.substring(0, 8) + s.substring(9, 13) + s.substring(14, 18) + s.substring(19, 23) + s.substring(24);
+    }
+
+    /**
+     * 判断是否为数字字符串
+     * @param str
+     * @return
+     */
+    public static boolean isNumeric(String str){
+        Pattern pattern = Pattern.compile("^(-?\\d+)(\\.\\d+)?$");
+        if(notEmp(str))
+        {
+            Matcher isNum = pattern.matcher(str);
+            if( !isNum.matches() ){
+                return false;
+            }
+
+        }else
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+
+    /**
+     * 正则表达式
+     * @param input     需要匹配的字符串
+     * @param expression 正则表达公式
+     * @return
+     */
+    public static List<String> pattern(String input, String expression){
+        // 创建 Pattern 对象
+        Pattern p = Pattern.compile(expression);
+        Matcher m = p.matcher(input);
+
+        ArrayList list = new ArrayList();
+        while (m.find()) {
+            list.add(m.group(0));
+        }
+        //去除重复值
+        HashSet hs=new HashSet(list);
+        list.clear();
+        list.addAll(hs);
+
+        return list;
+    }
+}

+ 46 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/ChangeWeight.java

@@ -0,0 +1,46 @@
+package com.gyee.datatraining.util.dd;
+
+import com.gyee.datatraining.vo.ChangeWeightVo;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.List;
+
+
+
+public class ChangeWeight {
+
+	private int digits = 4;
+
+	/**
+	 * 
+	 * @param weight
+	 *            权重
+	 * @param value
+	 *            劣化度
+	 * @param ls
+	 *            指标劣化度集合
+	 * @return
+	 */
+	public Double change(Double weight, Double value, List<ChangeWeightVo> ls) {
+		double sum = 0.0;
+		double result = 0.0;
+		for (ChangeWeightVo vo : ls) {
+			sum =sum+ vo.getWeight() * (Math.pow(1 - vo.getDegradationDegree(), -2));
+		}
+		if(sum!=0)
+		{
+			try {
+				result = new BigDecimal(weight.doubleValue() * (Math.pow(1 - value.doubleValue(), -2))).divide(new BigDecimal(sum), digits, RoundingMode.HALF_EVEN).doubleValue();
+
+			} catch (Exception e) {
+				e.getMessage();
+			}
+		}
+		else {
+			result=0.0;
+		}
+		return result;
+	}
+
+}

+ 90 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/DegradationDegree.java

@@ -0,0 +1,90 @@
+package com.gyee.datatraining.util.dd;
+
+import com.gyee.datatraining.util.StringUtils;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+
+public class DegradationDegree {
+	
+	private  int digits = 3;
+	/**
+	 * 获取劣化度数值,越小越优型
+	 * @param value
+	 * @param rule
+	 * @return
+	 */
+	public Double getValueBySmall(Double value, String rule)
+	{
+		
+		if(StringUtils.notEmp(rule) && StringUtils.notEmp(value))
+		{
+			String [] rules=rule.split(",");
+			double max=Double.valueOf(rules[0]);
+			double min=Double.valueOf(rules[1]);
+			double result=0;
+			if(value<min)
+			{
+				return 0.0;
+			}else if(min<=value && value<=max)
+			{
+				result = new BigDecimal(value - min).divide(new BigDecimal(max - min), digits, RoundingMode.HALF_EVEN).doubleValue();
+				return result;
+			}else if(value>max)
+			{
+				return 1.0;
+			}
+				
+		}
+		
+		
+		return null;
+	}
+	/**
+	 * 获取劣化度数值,中间最优型
+	 * @param value
+	 * @param rule
+	 * @return
+	 */
+	public Double getValueByMedium(Double value,String rule)
+	{
+		if(StringUtils.notEmp(rule) && StringUtils.notEmp(value))
+		{
+			String [] rules=rule.split(",");
+
+			double max=Double.valueOf(rules[0]);
+			double min=Double.valueOf(rules[1]);
+			double a=Double.valueOf(rules[2]);
+			double b=Double.valueOf(rules[3]);
+			double result=0;
+			if(value<min)
+			{
+				return 1.0;
+			}else if(min<=value && value<a)
+			{
+				result = new BigDecimal(value - min).divide(new BigDecimal(a - min), digits, RoundingMode.HALF_EVEN).doubleValue();
+				return result;
+			}
+			else if(a<=value && value<=b)
+			{
+				return 0.0;
+			
+			}else if(b<value && value<=max)
+			{
+				result = new BigDecimal(value - b).divide(new BigDecimal(max - b), digits, RoundingMode.HALF_EVEN).doubleValue();
+				return result;
+				
+			
+			}else if(value>max)
+			{
+				return 1.0;
+			}
+				
+		}
+
+		return null;
+	}
+
+
+}

+ 75 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/LoadData.java

@@ -0,0 +1,75 @@
+package com.gyee.datatraining.util.dd;
+
+import com.gyee.common.model.DNAVal;
+import com.gyee.datatraining.init.CacheContext;
+import com.gyee.datatraining.model.auto.Windturbinetestingpointnew;
+import com.gyee.datatraining.util.IRealTimeDataBaseUtil;
+import com.gyee.datatraining.util.StringUtils;
+import com.gyee.datatraining.util.realtimesource.EdosUtil;
+import com.gyee.datatraining.vo.WtTrainVo;
+
+import java.util.Map;
+import java.util.Vector;
+
+
+
+public class LoadData {
+
+	private IRealTimeDataBaseUtil ednaApiUtil = new EdosUtil();
+	
+    //String clxpoint = PropertyCacheContext.getContextProperty("clxpoint");
+    String clxpoint="NSSFJ_NSA00041,NSSFJ_NSA00038,NSSFJ_NSA00039,NSSFJ_NSA00040";
+	/**
+	 * 加载需要的测点数据
+	 * @return
+	 * @throws Exception 
+	 */
+	public Vector<DNAVal[]> loadEdosData(WtTrainVo vo, Vector<DNAVal[]> loadDataVc) throws Exception {
+		
+	
+		if(StringUtils.notEmp(vo))
+		{
+			String[] points=new String[vo.getUniformcode().size()];
+
+				//获得训练参数对象
+				for(int j=0;j<vo.getWtId().size();j++)
+				{
+					//判断风机编号是否存在
+					if(CacheContext.wtpAimap.containsKey(vo.getWtId().get(j)))
+					{
+						Map<String, Windturbinetestingpointnew> wtmap=CacheContext.wtpAimap.get(vo.getWtId().get(j));
+						//判断是否包含该统一编码
+						if(wtmap.containsKey(vo.getUniformcode().get(j)))
+						{
+							Windturbinetestingpointnew ai=wtmap.get(vo.getUniformcode().get(j));
+							//String id = ai.getId().substring(5).replace(".", "_");
+							points[j]= ai.getId();
+						}
+					}
+				}
+
+				int type=0;
+				for (int i = 0; i < points.length; i++) {
+					if(null==points[i])
+					{
+						type=1;
+						break;
+					}
+				}
+				if(type==0)
+				{
+					DNAVal[] inData = ednaApiUtil.getHistMatrix(points,vo.getRecodeDate());
+					loadDataVc.add(inData);
+				}else 
+				{
+					loadDataVc=null;
+				}
+				
+		}
+
+		
+
+		
+		return loadDataVc;
+	}
+}

+ 258 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/LstmModelBj.java

@@ -0,0 +1,258 @@
+package com.gyee.datatraining.util.dd;
+
+import com.gyee.common.model.DNAVal;
+import com.gyee.common.model.PointData;
+import com.gyee.datatraining.init.CacheContext;
+import com.gyee.datatraining.model.auto.Windturbinetestingpointnew;
+import com.gyee.datatraining.util.DateUtils;
+import com.gyee.datatraining.util.IRealTimeDataBaseUtil;
+import com.gyee.datatraining.util.realtimesource.EdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Map;
+
+
+
+@Service
+public class LstmModelBj {
+
+
+
+	private IRealTimeDataBaseUtil ednaApiUtil = new EdosUtil();
+	private int IN_NUM = 16;
+	private int OUT_NUM_4HOUR = 16;
+	private int OUT_NUM_1DAY = 96;
+	private int OUT_NUM_3DAY = 96*3;
+	private int OUT_NUM_7DAY = 8*7;
+	private int OUT_NUM_1Month = 2*30;
+	private int STEPS = 15;
+	private int STEPS2 = 15*4*3;
+	private int STEPS3 = 15*4*12;
+	// 小数位数
+	private int digits = 4;
+
+
+	private static Logger logger = LoggerFactory.getLogger(LstmModelBj.class);
+
+	
+
+	public void castDataBy4Hour(String wtId,String unicode) throws Exception {
+
+		Calendar cal = Calendar.getInstance();
+		Map<String, Windturbinetestingpointnew> wtpAimap = CacheContext.wtpAimap.get(wtId);
+		
+		int minute=cal.get(Calendar.MINUTE);
+		if(minute>45)
+		{
+			minute=45;
+		}else if(minute>30)
+		{
+			minute=30;
+		}else if(minute>15)
+		{
+			minute=15;
+		}else if(minute>0)
+		{
+			minute=0;
+		}
+		
+		
+		cal.set(Calendar.MINUTE, minute);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+
+		Date endDate = cal.getTime();
+
+		cal.add(Calendar.DAY_OF_MONTH, -1);
+
+		Date beginDate = cal.getTime();
+
+		statisticalBj(wtId, unicode,  cal, wtpAimap, endDate, beginDate,OUT_NUM_4HOUR,STEPS);
+
+
+	}
+	
+	
+	public void castDataBy1Day(String wtId,String unicode) throws Exception {
+
+		Calendar cal = Calendar.getInstance();
+		Map<String, Windturbinetestingpointnew> wtpAimap = CacheContext.wtpAimap.get(wtId);
+		
+		int minute=cal.get(Calendar.MINUTE);
+		if(minute>45)
+		{
+			minute=45;
+		}else if(minute>30)
+		{
+			minute=30;
+		}else if(minute>15)
+		{
+			minute=15;
+		}else if(minute>0)
+		{
+			minute=0;
+		}
+		
+		
+		cal.set(Calendar.MINUTE, minute);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+
+		Date endDate = cal.getTime();
+
+		cal.add(Calendar.DAY_OF_MONTH, -7);
+
+		Date beginDate = cal.getTime();
+
+
+		statisticalBj(wtId, unicode,  cal, wtpAimap, endDate, beginDate,OUT_NUM_1DAY,STEPS);
+		
+	}
+	
+	public void castDataBy3Day(String wtId,String unicode) throws Exception {
+
+		Calendar cal = Calendar.getInstance();
+		Map<String, Windturbinetestingpointnew> wtpAimap = CacheContext.wtpAimap.get(wtId);
+		
+		int minute=cal.get(Calendar.MINUTE);
+		if(minute>45)
+		{
+			minute=45;
+		}else if(minute>30)
+		{
+			minute=30;
+		}else if(minute>15)
+		{
+			minute=15;
+		}else if(minute>0)
+		{
+			minute=0;
+		}
+		
+		
+		cal.set(Calendar.MINUTE, minute);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+
+		Date endDate = cal.getTime();
+
+		cal.add(Calendar.DAY_OF_MONTH, -7);
+
+		Date beginDate = cal.getTime();
+
+
+		statisticalBj(wtId, unicode,  cal, wtpAimap, endDate, beginDate,OUT_NUM_3DAY,STEPS);
+		
+	}
+	
+	public void castDataBy7Day(String wtId,String unicode) throws Exception {
+
+		Calendar cal = Calendar.getInstance();
+		Map<String, Windturbinetestingpointnew> wtpAimap = CacheContext.wtpAimap.get(wtId);
+		
+		
+		cal.set(Calendar.HOUR_OF_DAY, 0);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+
+		Date endDate = cal.getTime();
+
+		cal.add(Calendar.DAY_OF_MONTH, -14);
+
+		Date beginDate = cal.getTime();
+
+
+		statisticalBj(wtId, unicode,  cal, wtpAimap, endDate, beginDate,OUT_NUM_7DAY,STEPS2);
+		
+	}
+	
+	public void castDataBy1Month(String wtId,String unicode) throws Exception {
+
+		Calendar cal = Calendar.getInstance();
+		Map<String, Windturbinetestingpointnew> wtpAimap = CacheContext.wtpAimap.get(wtId);
+		
+
+		cal.set(Calendar.HOUR_OF_DAY, 0);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+
+		Date endDate = cal.getTime();
+
+		cal.add(Calendar.DAY_OF_MONTH, -30);
+
+		Date beginDate = cal.getTime();
+
+		statisticalBj(wtId, unicode,  cal, wtpAimap, endDate, beginDate,OUT_NUM_1Month,STEPS3);
+		
+	}
+
+	private void statisticalBj(String wtId, String unicode, Calendar cal, Map<String, Windturbinetestingpointnew> wtpAimap, Date endDate, Date beginDate, int outnum, int step) throws Exception {
+		// 通过开始和结束日期得得到时间间隔
+		int day = DateUtils.daysDiff(beginDate, endDate);
+		if (day == 0) {
+			day = 1;
+		}
+		int number = day * 24 * 60 / step;
+
+		for (int j = 0; j < number; j++) {
+
+			insertWtPoint(cal.getTime(), MathRandom.percentageRandom(), wtpAimap, unicode);
+			// 按照步长增加时间
+			cal.add(Calendar.MINUTE, step);
+
+		}
+	}
+	/**
+	 * 加载需要的测点数据
+	 * 
+	 * @return
+	 * @throws Exception
+	 */
+	public double[] loadEdosData(int recodeDate , String[] points, int innum) throws Exception {
+
+
+			double[] data = new double[innum];
+
+		
+				DNAVal[] inData = ednaApiUtil.getHistMatrix(points, recodeDate);
+
+				if (null != inData && inData.length > 0) {
+
+					for (int i = 0; i < inData.length; i++) {
+						data[i] = inData[i].DValue;
+					}
+					
+					return data;
+				}
+
+
+		return null;
+	}
+	
+	public void insertWtPoint(Date now, double value, Map<String, Windturbinetestingpointnew> wtpAimap, String unicode) throws Exception {
+		if (wtpAimap.containsKey(unicode)) {
+			Windturbinetestingpointnew ai = wtpAimap.get(unicode);
+			PointData point = new PointData();
+			point.setEdnaId(ai.getId());
+			point.setPointValueInDouble(value);
+			point.setPointTime(new BigDecimal(now.getTime()).divide(new BigDecimal(1000), 0, RoundingMode.HALF_EVEN).longValue());
+			ednaApiUtil.updatePoint(point);
+		}
+	}
+
+	public double normalized(double curData, double maxData, double minData) {
+
+		double result = new BigDecimal(curData - minData).divide(new BigDecimal(maxData - minData), digits, RoundingMode.HALF_EVEN).doubleValue();
+
+		return result;
+	}
+
+}

+ 241 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/LstmModelWt.java

@@ -0,0 +1,241 @@
+package com.gyee.datatraining.util.dd;
+
+import com.gyee.common.model.DNAVal;
+import com.gyee.common.model.PointData;
+import com.gyee.datatraining.init.CacheContext;
+import com.gyee.datatraining.model.auto.Windturbinetestingpointnew;
+import com.gyee.datatraining.util.DateUtils;
+import com.gyee.datatraining.util.IRealTimeDataBaseUtil;
+import com.gyee.datatraining.util.realtimesource.EdosUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Map;
+
+
+
+@Service
+public class LstmModelWt {
+
+	private IRealTimeDataBaseUtil ednaApiUtil = new EdosUtil();
+	private int IN_NUM = 28;
+	private int OUT_NUM_4HOUR = 16;
+	private int OUT_NUM_1DAY = 96;
+	private int OUT_NUM_3DAY = 8 * 3;
+	private int OUT_NUM_7DAY = 8 * 7;
+	private int OUT_NUM_1Month = 30;
+	private int STEPS = 15;
+	private int STEPS2 = 15 * 4 * 3;
+	private int STEPS3 = 15 * 4 * 24;
+	// 小数位数
+	private int digits = 4;
+
+
+	private static Logger logger = LoggerFactory.getLogger(LstmModelWt.class);
+
+	public void castDataBy4Hour(String wtId, String unicode) throws Exception {
+
+		Calendar cal = Calendar.getInstance();
+		Map<String, Windturbinetestingpointnew> wtpAimap = CacheContext.wtpAimap.get(wtId);
+
+		int minute = cal.get(Calendar.MINUTE);
+		if (minute > 45) {
+			minute = 45;
+		} else if (minute > 30) {
+			minute = 30;
+		} else if (minute > 15) {
+			minute = 15;
+		} else if (minute > 0) {
+			minute = 0;
+		}
+
+		cal.set(Calendar.MINUTE, minute);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+
+		Date beginDate = cal.getTime();
+
+		cal.add(Calendar.HOUR_OF_DAY, 4);
+
+		Date endDate = cal.getTime();
+
+		cal = Calendar.getInstance();
+
+		statisticalBj(wtId, unicode, cal, wtpAimap, endDate, beginDate, OUT_NUM_4HOUR, STEPS);
+
+	}
+
+	public void castDataBy1Day(String wtId, String unicode) throws Exception {
+
+		Calendar cal = Calendar.getInstance();
+		Map<String, Windturbinetestingpointnew> wtpAimap = CacheContext.wtpAimap.get(wtId);
+
+		int minute = cal.get(Calendar.MINUTE);
+		if (minute > 45) {
+			minute = 45;
+		} else if (minute > 30) {
+			minute = 30;
+		} else if (minute > 15) {
+			minute = 15;
+		} else if (minute > 0) {
+			minute = 0;
+		}
+
+		cal.set(Calendar.MINUTE, minute);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+
+		Date beginDate = cal.getTime();
+
+		cal.add(Calendar.HOUR_OF_DAY, 1);
+
+		Date endDate = cal.getTime();
+
+		cal = Calendar.getInstance();
+
+		statisticalBj(wtId, unicode, cal, wtpAimap, endDate, beginDate, OUT_NUM_1DAY, STEPS);
+
+	}
+
+	public void castDataBy3Day(String wtId, String unicode) throws Exception {
+
+		Calendar cal = Calendar.getInstance();
+		Map<String, Windturbinetestingpointnew> wtpAimap = CacheContext.wtpAimap.get(wtId);
+
+		int minute = cal.get(Calendar.MINUTE);
+		if (minute > 45) {
+			minute = 45;
+		} else if (minute > 30) {
+			minute = 30;
+		} else if (minute > 15) {
+			minute = 15;
+		} else if (minute > 0) {
+			minute = 0;
+		}
+
+		cal.set(Calendar.MINUTE, minute);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+
+		Date beginDate = cal.getTime();
+
+		cal.add(Calendar.HOUR_OF_DAY, 3);
+
+		Date endDate = cal.getTime();
+
+		cal = Calendar.getInstance();
+
+		statisticalBj(wtId, unicode, cal, wtpAimap, endDate, beginDate, OUT_NUM_3DAY, STEPS2);
+
+	}
+
+	public void castDataBy7Day(String wtId, String unicode) throws Exception {
+
+		Calendar cal = Calendar.getInstance();
+		Map<String, Windturbinetestingpointnew> wtpAimap = CacheContext.wtpAimap.get(wtId);
+
+		cal.set(Calendar.HOUR_OF_DAY, 0);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+
+		Date beginDate = cal.getTime();
+
+		cal.add(Calendar.HOUR_OF_DAY, 7);
+
+		Date endDate = cal.getTime();
+
+		cal = Calendar.getInstance();
+
+		statisticalBj(wtId, unicode, cal, wtpAimap, endDate, beginDate, OUT_NUM_7DAY, STEPS2);
+
+	}
+
+	public void castDataBy1Month(String wtId, String unicode) throws Exception {
+
+		Calendar cal = Calendar.getInstance();
+		Map<String, Windturbinetestingpointnew> wtpAimap = CacheContext.wtpAimap.get(wtId);
+
+		cal.set(Calendar.HOUR_OF_DAY, 0);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND, 0);
+		cal.set(Calendar.MILLISECOND, 0);
+
+		Date beginDate = cal.getTime();
+
+		cal.add(Calendar.MONTH, 1);
+
+		Date endDate = cal.getTime();
+
+		cal = Calendar.getInstance();
+
+		statisticalBj(wtId, unicode, cal, wtpAimap, endDate, beginDate, OUT_NUM_1Month, STEPS3);
+
+	}
+
+	private void statisticalBj(String wtId, String unicode, Calendar cal, Map<String, Windturbinetestingpointnew> wtpAimap, Date endDate, Date beginDate, int outnum, int step) throws Exception {
+		// 通过开始和结束日期得得到时间间隔
+		int day = DateUtils.daysDiff(beginDate, endDate);
+		if (day == 0) {
+			day = 1;
+		}
+		int number = day * 24 * 60 / step;
+
+		for (int j = 0; j < number; j++) {
+
+			insertWtPoint(cal.getTime(), MathRandom.percentageRandom(), wtpAimap, unicode);
+			// 按照步长增加时间
+			cal.add(Calendar.MINUTE, step);
+
+		}
+	}
+
+	/**
+	 * 加载需要的测点数据
+	 * 
+	 * @return
+	 * @throws Exception
+	 */
+	public double[] loadEdosData(int recodeDate, String[] points, int innum) throws Exception {
+
+		double[] data = new double[innum];
+
+		DNAVal[] inData = ednaApiUtil.getHistMatrix(points, recodeDate);
+
+		if (null != inData && inData.length > 0) {
+
+			for (int i = 0; i < inData.length; i++) {
+				data[i] = inData[i].DValue;
+			}
+
+			return data;
+		}
+
+		return null;
+	}
+
+	public void insertWtPoint(Date now, int value, Map<String, Windturbinetestingpointnew> wtpAimap, String unicode) throws Exception {
+		if (wtpAimap.containsKey(unicode)) {
+			Windturbinetestingpointnew ai = wtpAimap.get(unicode);
+			PointData point = new PointData();
+			point.setEdnaId(ai.getId());
+			point.setPointValueInDouble(value);
+			point.setPointTime(new BigDecimal(now.getTime()).divide(new BigDecimal(1000), 0, RoundingMode.HALF_EVEN).longValue());
+			// ednaApiUtil.sendSinglePoint(point);
+			ednaApiUtil.updatePoint(point);
+		}
+	}
+
+	public double normalized(double curData, double maxData, double minData) {
+
+		double result = new BigDecimal(curData - minData).divide(new BigDecimal(maxData - minData), digits, RoundingMode.HALF_EVEN).doubleValue();
+
+		return result;
+	}
+
+}

+ 66 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/MathRandom.java

@@ -0,0 +1,66 @@
+package com.gyee.datatraining.util.dd;
+
+/**
+ * JAVA 返回随机数,并根据概率、比率
+ * 
+ * @author shilin
+ * 
+ */
+public class MathRandom {
+
+	/**
+	 * 1出现的概率为%75
+	 */
+	public static double rate1 = 0.5;
+	/**
+	 * 2出现的概率为%15
+	 */
+	public static double rate2 = 0.3;
+	/**
+	 * 3出现的概率为%8
+	 */
+	public static double rate3 = 0.195;
+	/**
+	 * 4出现的概率为%2
+	 */
+	public static double rate4 = 0.005;
+
+	/**
+	 * Math.random()产生一个double型的随机数,判断一下 例如0出现的概率为%50,则介于0到0.50中间的返回0
+	 * 
+	 * @return int
+	 * 
+	 */
+	public static int percentageRandom() {
+		double randomNumber;
+		randomNumber = Math.random();
+		if (randomNumber > 0 && randomNumber <= rate1) {
+			return 1;
+		} else if (randomNumber > rate1 && randomNumber <= rate1 + rate2) {
+			return 2;
+		} else if (randomNumber > rate1 + rate2 && randomNumber <= rate1 + rate2 + rate3) {
+			return 3;
+		} else if (randomNumber > rate1 + rate2 + rate3 && randomNumber <= rate1 + rate2 + rate3 + rate4) {
+			return 4;
+		}else
+		{
+			return 1;
+		}
+
+	}
+
+	// /**
+	// * 测试主程序
+	// * @param agrs
+	// */
+	// public static void main(String[] agrs)
+	// {
+	// int i = 0;
+	// //java.lang.Math.random() 返回一个正符号的double值,大于或等于0.0且小于1.0
+	// MathRandom a = new MathRandom();
+	// for (i = 0; i <= 100; i++)//打印100个测试概率的准确性
+	// {
+	// System.out.println(a.PercentageRandom());
+	// }
+	// }
+}

+ 56 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/MatrixCalculation.java

@@ -0,0 +1,56 @@
+package com.gyee.datatraining.util.dd;
+
+import com.gyee.datatraining.util.StringUtils;
+import org.apache.commons.math3.linear.Array2DRowRealMatrix;
+import org.apache.commons.math3.linear.RealMatrix;
+
+
+public class MatrixCalculation {
+	
+	private int coment_bit = 4;
+	/**
+	 * 创建矩阵对象
+	 * 
+	 * @param arr
+	 * @return
+	 */
+	public RealMatrix createMatrix(double arr[][]) {
+		if (StringUtils.notEmp(arr)) {
+			RealMatrix matrix = new Array2DRowRealMatrix(arr);
+
+			return matrix;
+		}
+
+		return null;
+	}
+	/**
+	 * 矩阵相乘
+	 * @param rm1
+	 * @param rm2
+	 * @return
+	 */
+	public RealMatrix matrixMult(RealMatrix rm1,RealMatrix rm2) {
+		if (StringUtils.notEmp(rm1) && StringUtils.notEmp(rm2)) {
+			RealMatrix matrix =rm1.multiply(rm2);
+			return matrix;
+		}
+		return null;
+	}
+	/**
+	 * 返回最终结果集
+	 * @param matrix
+	 * @return
+	 */
+	public double[] matrixResult(RealMatrix matrix) {
+		if (StringUtils.notEmp(matrix)) {
+			double[] result=new double[coment_bit];
+			for(int i=0;i<matrix.getColumnDimension();i++)
+			{
+				result[i]=matrix.getEntry(0, i);
+			}
+			return result;
+		}
+		return null;
+	}
+
+}

+ 103 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/Membership.java

@@ -0,0 +1,103 @@
+package com.gyee.datatraining.util.dd;
+
+
+import com.gyee.datatraining.vo.MembershipRuleVo;
+
+public class Membership {
+
+	
+	
+	public Double getStateValue(Double value, Integer type, MembershipRuleVo vo)
+	{
+		String obj=vo.getCondition();//获得隶属度规则
+		
+		
+		String [] rules=obj.split(",");
+		double max=Double.valueOf(rules[0]);
+		double min=Double.valueOf(rules[1]);
+		double a=Double.valueOf(rules[2]);
+		double b=Double.valueOf(rules[3]);
+		double result=0;
+		
+		
+		if(type==0)
+		{
+			String [] state=vo.getStaterule1().split(",");
+			double x1=Double.valueOf(state[0]);
+			double x2=Double.valueOf(state[1]);
+			
+			if(value<=min)
+			{
+				return 1.0;
+			}else if(min<value && value<a)
+			{
+				result =x1 - x2*value;
+				return result;
+			}
+			else if(value>=a)
+			{
+				return 0.0;
+			}
+		}else if(type==1)
+		{
+			String [] state=vo.getStaterule2().split(",");
+			double x1=Double.valueOf(state[0]);
+			double x2=Double.valueOf(state[1]);
+			double x3=Double.valueOf(state[2]);
+			double x4=Double.valueOf(state[3]);
+			if(a<=value && value<b)
+			{
+				result =x1 - x2*value;
+				return result;
+			}else if(min<value && value<a)
+			{
+				result =x3*value - x4;
+				return result;
+			}
+			else if(value>=b || value<=min)
+			{
+				return 0.0;
+			}
+		}else if(type==2)
+		{
+			String [] state=vo.getStaterule3().split(",");
+			double x1=Double.valueOf(state[0]);
+			double x2=Double.valueOf(state[1]);
+			double x3=Double.valueOf(state[2]);
+			double x4=Double.valueOf(state[3]);
+			if(b<=value && value<max)
+			{
+				result =x1 - x2*value;
+				return result;
+			}else if(a<value && value<b)
+			{
+				result =x3*value - x4;
+				return result;
+			}
+			else if(value>=max || value<=a)
+			{
+				return 0.0;
+			}
+		}else if(type==3)
+		{
+			String [] state=vo.getStaterule4().split(",");
+			double x1=Double.valueOf(state[0]);
+			double x2=Double.valueOf(state[1]);
+			
+			if(value>=max)
+			{
+				return 1.0;
+			}else if(b<value && value<max)
+			{
+				result =x1*value - x2;
+				return result;
+			}
+			else if(value<=b)
+			{
+				return 0.0;
+			}
+		}
+
+		return null;
+	}
+}

+ 271 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/ModuleState.java

@@ -0,0 +1,271 @@
+package com.gyee.datatraining.util.dd;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Vector;
+
+import com.gyee.common.model.DNAVal;
+import com.gyee.datatraining.task.SaticScheduleTask;
+import com.gyee.datatraining.util.StringUtils;
+import com.gyee.datatraining.vo.ChangeWeightVo;
+import com.gyee.datatraining.vo.MembershipRuleVo;
+import com.gyee.datatraining.vo.ModuleVo;
+import com.gyee.datatraining.vo.WtTrainVo;
+import org.apache.commons.math3.linear.RealMatrix;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+
+@Component
+public class ModuleState {
+
+	private static Logger logger = LoggerFactory.getLogger(SaticScheduleTask.class);
+
+	@Resource
+	private Environment env;
+
+	private int digits = 4;
+	/**
+	 * 结果集数量
+	 */
+	private int coment_bit = 4;
+	/**
+	 * 指标点数量
+	 */
+	//private int point_bit = 4;
+	/**
+	 * 报警值数量
+	 */
+	private double warnnum = 0.95;
+	/**
+	 * 查询模块健康状况
+	 * @return
+	 */
+	public ModuleVo getModuleValue(List<String> wtId, List<String> code, List<Integer> typels, List<Double> cwdls, List<String> rules, MembershipRuleVo msvo, Date now)
+	{
+		
+		ModuleVo modelvo=new ModuleVo();
+		//初始化读取数据对象
+		LoadData load = new LoadData();
+		Vector<DNAVal[]> loadDataVc = new Vector<DNAVal[]>();
+		// 初始化变权对象数组
+		double[] cwchange = new double[code.size()];
+		//超过报警线直接判定严重健康状态为1
+		int breakstate = 0;
+		//结果状态值
+		int state = 1;
+		List<Double> result= new ArrayList<Double>();
+		List<ChangeWeightVo> cwls = new ArrayList<ChangeWeightVo>();
+		WtTrainVo vo = new WtTrainVo();
+
+
+		int recodeDate = new BigDecimal(now.getTime()).divide(new BigDecimal(1000), 0, RoundingMode.HALF_EVEN).intValue();
+
+		vo.setRecodeDate(recodeDate);
+		vo.setUniformcode(code);
+		vo.setWtId(wtId);
+
+		try {
+			load.loadEdosData(vo, loadDataVc);
+		} catch (Exception e) {
+
+			e.printStackTrace();
+		}
+
+		if (StringUtils.notEmp(loadDataVc) && !loadDataVc.isEmpty()) {
+			//取得一组指标的数据集合
+			DNAVal[] data = loadDataVc.get(0);
+			//劣化度结果集合
+			List<Double> ddls = new ArrayList<Double>();
+			//实例化劣化度对象
+			DegradationDegree dd = new DegradationDegree();
+
+			for (int i = 0; i < data.length; i++) {
+				double value = 0;
+				// 判断数据劣化度
+				if (typels.get(i) == 0) {
+					value = dd.getValueBySmall(data[i].DValue, rules.get(i));
+				} else if (typels.get(i) == 1) {
+					value = dd.getValueByMedium(data[i].DValue, rules.get(i));
+				}
+				// 实例化权重和劣化度对象
+				ChangeWeightVo cwvo = new ChangeWeightVo();
+				// 赋值权重和劣化度对象
+				cwvo.setDegradationDegree(value);
+				cwvo.setWeight(cwdls.get(i));
+
+				cwls.add(cwvo);
+				ddls.add(value);
+			}
+
+			// 实例化隶属度对象
+			Membership ms = new Membership();
+//			MembershipRuleVo msvo = new MembershipRuleVo();
+//			msvo.setCondition("");
+//			msvo.setStaterule1("");
+//			msvo.setStaterule2("");
+//			msvo.setStaterule3("");
+//			msvo.setStaterule4("");
+			
+			// 生成隶属度数组
+			double[][] msarr = new double[ddls.size()][coment_bit];
+			for (int i = 0; i < ddls.size(); i++) {
+				double[] temparr = new double[coment_bit];
+				for (int j = 0; j < coment_bit; j++) {
+					double msstate = ms.getStateValue(ddls.get(i), j, msvo);
+					temparr[j] = StringUtils.round(msstate, digits);
+				}
+				msarr[i] = temparr;
+			}
+
+			// 变权处理
+			ChangeWeight cw = new ChangeWeight();
+			for (int i = 0; i < ddls.size(); i++) {
+				double value = ddls.get(i);
+				if (value > warnnum) {
+					breakstate = 1;
+					break;
+				}
+			}
+
+			if (breakstate == 0) {
+				
+				for (int i = 0; i < ddls.size(); i++) {
+					double value = ddls.get(i);
+					cwchange[i] = cw.change(cwdls.get(i), value, cwls);
+				}
+				double cwarr[][] = new double[1][code.size()];
+				cwarr[0] = cwchange;
+
+				MatrixCalculation mc = new MatrixCalculation();
+
+				RealMatrix matrix1 = mc.createMatrix(cwarr);
+				RealMatrix matrix2 = mc.createMatrix(msarr);
+
+				RealMatrix rmresult = matrix1.multiply(matrix2);
+
+				double value = rmresult.getEntry(0, 0);
+				for (int i = 0; i < rmresult.getColumnDimension(); i++) {
+					double temp = rmresult.getEntry(0, i)<1?rmresult.getEntry(0, i):1;
+					if (temp > value) {
+						value = temp;
+						state = i+1;
+					}
+					result.add(temp);
+				}
+			} else {
+				state=4;
+				result=new ArrayList<Double>();
+				result.add(0.0);
+				result.add(0.0);
+				result.add(0.0);
+				result.add(1.0);
+			}
+
+		}else{
+			//没有查询到数据,默认为良好状态
+			state=1;
+			result=new ArrayList<Double>();
+			result.add(1.0);
+			result.add(0.0);
+			result.add(0.0);
+			result.add(0.0);
+		}
+		
+		modelvo.setModuleResult(result);
+		modelvo.setModuleState(state);;
+		return modelvo;
+	}
+	
+	
+	/**
+	 * 检查部件健康情况
+	 */
+	public ModuleVo checkPartState(String wtId,String part_clx,String type_clx,String weight_clx,String part_rule,String condition_lsd
+			,String params_lsd1,String params_lsd2,String params_lsd3,String params_lsd4,Date now) {
+		
+
+		List<String> wtIdls = new ArrayList<String>();
+		List<String> code = new ArrayList<String>();
+		List<Integer> typels = new ArrayList<Integer>();
+		List<Double> cwdls = new ArrayList<Double>();
+		List<String> rules = new ArrayList<String>();
+
+
+//		wtId.add("NG01_01");
+//		wtId.add("NG01_01");
+//		wtId.add("NG01_01");
+
+		// 遍历齿轮箱统一编码
+		String[] up82_part_clx = env.getProperty(part_clx).split(",");
+
+		for (int i = 0; i < up82_part_clx.length; i++) {
+			code.add(up82_part_clx[i]);
+			wtIdls.add(wtId);
+		}
+		// 遍历齿轮箱各指标对应算法
+		String[] up82_type_clx = env.getProperty(type_clx).split(",");
+
+		for (int i = 0; i < up82_type_clx.length; i++) {
+			typels.add(Integer.valueOf(up82_type_clx[i]));
+		}
+
+		// 遍历齿轮箱权重
+		String[] up82_weight_clx = env.getProperty(weight_clx).split(",");
+
+		for (int i = 0; i < up82_weight_clx.length; i++) {
+			cwdls.add(Double.valueOf(up82_weight_clx[i]));
+		}
+		// 获得齿轮箱范围值
+		String rule = env.getProperty(part_rule);
+
+		if (StringUtils.notEmp(rule)) {
+			String[] part_rules = rule.split(",");
+			for (int i = 0; i < part_rules.length; i++) {
+				String temp = env.getProperty(part_rules[i]);
+
+				rules.add(temp);
+			}
+		}
+
+		// 初始化隶属度计算参数
+		MembershipRuleVo msvo = new MembershipRuleVo();
+		msvo.setCondition(env.getProperty(condition_lsd));
+		msvo.setStaterule1(env.getProperty(params_lsd1));
+		msvo.setStaterule2(env.getProperty(params_lsd2));
+		msvo.setStaterule3(env.getProperty(params_lsd3));
+		msvo.setStaterule4(env.getProperty(params_lsd4));
+
+		ModuleVo vo = getModuleValue(wtIdls, code, typels, cwdls, rules, msvo,now);
+
+		if (StringUtils.notEmp(vo)) {
+			logger.info("状态值" + vo.getModuleState());
+			
+			logger.info("结果值是:" );
+
+			StringBuilder sb=new StringBuilder();
+			for(int i=0;i<vo.getModuleResult().size();i++)
+			{
+				if(i==vo.getModuleResult().size()-1)
+				{
+					sb.append(StringUtils.round(vo.getModuleResult().get(i), digits));
+				}else{
+					sb.append(StringUtils.round(vo.getModuleResult().get(i), digits)).append(",");
+				}
+			}
+			logger.info(String.valueOf(sb));
+		}
+		
+		return vo;
+	}
+
+}

+ 48 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/ApiGolden.java

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

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


+ 27 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/GoldenConfig.java

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

+ 233 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/IEdosUtil.java

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

+ 34 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/StringUtil.java

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

+ 28 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BaseTsQuery.java

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

+ 38 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BasicTsData.java

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

+ 29 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BasicTsPoint.java

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

+ 24 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BlobTsData.java

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

+ 22 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BlobWriteTsData.java

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

+ 24 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BooleanTsData.java

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

+ 19 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/BooleanWriteTsData.java

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

+ 18 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/Coordinate.java

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

+ 26 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/CoordinateTsData.java

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

+ 21 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/CoordinateWriteTsData.java

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

+ 30 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/DoubleStatData.java

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

+ 25 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/DoubleTsData.java

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

+ 19 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/DoubleWriteTsData.java

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

+ 38 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/ErrorRequest.java

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

+ 27 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/GeneralTsData.java

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

+ 8 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/Interpolation.java

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

+ 238 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/JsonObjectHelper.java

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

+ 0 - 0
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/realtimesource/timeseries/LongTsData.java


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