Browse Source

健康管理优化

shilin 1 year ago
parent
commit
79e25f4bb2
22 changed files with 3542 additions and 79 deletions
  1. 1091 0
      web/health/doc/springbootv2.sql
  2. BIN
      web/health/lib/ueditor-1.1.2.jar
  3. 520 0
      web/health/pom.xml
  4. 121 0
      web/health/src/main/java/com/gyee/frame/controller/health/HealthMainController.java
  5. 145 0
      web/health/src/main/java/com/gyee/frame/controller/health/HealthOperationController.java
  6. 499 0
      web/health/src/main/java/com/gyee/frame/controller/health/HealthSubController.java
  7. 9 0
      web/health/src/main/java/com/gyee/frame/mapper/auto/ProEconRecommenMainMapper.java
  8. 13 0
      web/health/src/main/java/com/gyee/frame/mapper/auto/ProEconShutdownEventMapper.java
  9. 17 0
      web/health/src/main/java/com/gyee/frame/mapper/auto/ProEconWarningMapper.java
  10. 4 3
      web/health/src/main/java/com/gyee/frame/model/auto/ProEconEarlyWarningMain.java
  11. 56 0
      web/health/src/main/java/com/gyee/frame/model/vo/HealthStatusValue.java
  12. 20 20
      web/health/src/main/java/com/gyee/frame/model/vo/StatusDetailValue.java
  13. 13 13
      web/health/src/main/java/com/gyee/frame/model/vo/StatusValue.java
  14. 8 1
      web/health/src/main/java/com/gyee/frame/service/auto/IProEconRecommenMainService.java
  15. 13 0
      web/health/src/main/java/com/gyee/frame/service/auto/IProEconShutdownEventService.java
  16. 5 1
      web/health/src/main/java/com/gyee/frame/service/auto/IProEconWarningService.java
  17. 48 0
      web/health/src/main/java/com/gyee/frame/service/auto/impl/ProEconRecommenMainServiceImpl.java
  18. 74 4
      web/health/src/main/java/com/gyee/frame/service/auto/impl/ProEconShutdownEventServiceImpl.java
  19. 102 0
      web/health/src/main/java/com/gyee/frame/service/auto/impl/ProEconWarningServiceImpl.java
  20. 40 37
      web/health/src/main/java/com/gyee/frame/service/health/HealthMainService.java
  21. 375 0
      web/health/src/main/java/com/gyee/frame/service/health/HealthOperationService.java
  22. 369 0
      web/health/src/main/java/com/gyee/frame/service/recommen/RecommenService.java

File diff suppressed because it is too large
+ 1091 - 0
web/health/doc/springbootv2.sql


BIN
web/health/lib/ueditor-1.1.2.jar


+ 520 - 0
web/health/pom.xml

@@ -0,0 +1,520 @@
+<?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>web</artifactId>
+        <groupId>com.gyee</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>health</artifactId>
+
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <java.version>1.8</java.version>
+        <commons.fileupload.version>1.3.3</commons.fileupload.version>
+        <commons.io.version>2.5</commons.io.version>
+        <tomcat.version>9.0.35</tomcat.version>
+        <spring-boot.version>2.3.7.RELEASE</spring-boot.version>
+        <spring-cloud-alibaba.version>2.2.5.RELEASE</spring-cloud-alibaba.version>
+        <pgsql.version>42.2.5</pgsql.version>
+    </properties>
+
+    <!-- https://mvnrepository.com/ 查找jar网站 -->
+    <dependencies>
+        <!-- SpringBoot Web容器 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+
+        <!--		<dependency>-->
+        <!--			<groupId>org.mybatis.caches</groupId>-->
+        <!--			<artifactId>mybatis-ehcache</artifactId>-->
+        <!--			<version>1.2.1</version>-->
+        <!--		</dependency>-->
+        <!-- SpringBoot 测试 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <!-- 添加swagger2 -->
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger2</artifactId>
+            <version>2.9.2</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>io.swagger</groupId>
+                    <artifactId>swagger-annotations</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>io.swagger</groupId>
+                    <artifactId>swagger-models</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-swagger-ui</artifactId>
+            <version>2.9.2</version>
+        </dependency>
+        <dependency>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-annotations</artifactId>
+            <version>1.5.21</version>
+        </dependency>
+        <dependency>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-models</artifactId>
+            <version>1.5.21</version>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus</artifactId>
+            <version>3.5.3.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.gyee</groupId>
+            <artifactId>common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!--GSON -->
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+        </dependency>
+        <!-- pageHelper -->
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.2.5</version>
+        </dependency>
+        <!-- mysql驱动7.0-->
+        <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.taosdata.jdbc</groupId>
+            <artifactId>taos-jdbcdriver</artifactId>
+            <version>2.0.30</version>
+        </dependency>
+        <!-- mysql驱动8.0
+         <dependency>
+             <groupId>mysql</groupId>
+             <artifactId>mysql-connector-java</artifactId>
+            <version>8.0.11</version>
+         </dependency>
+         -->
+        <!--druid 数据源监控-->
+        <!-- https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.1.10</version>
+        </dependency>
+        <!-- shiro权限 -->
+        <dependency>
+            <groupId>org.apache.shiro</groupId>
+            <artifactId>shiro-spring</artifactId>
+            <version>1.4.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+        <!-- shiro权限支持thymeleaf -->
+        <dependency>
+            <groupId>com.github.theborakompanioni</groupId>
+            <artifactId>thymeleaf-extras-shiro</artifactId>
+            <version>2.0.0</version>
+        </dependency>
+
+        <!-- thymeleaf模版 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-thymeleaf</artifactId>
+        </dependency>
+
+        <!--常用工具类 -->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.4</version>
+        </dependency>
+
+        <!--io常用工具类 -->
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>${commons.io.version}</version>
+        </dependency>
+
+        <!--文件上传工具类 -->
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>${commons.fileupload.version}</version>
+        </dependency>
+
+
+        <!-- 热部署 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-devtools</artifactId>
+            <optional>false</optional>
+        </dependency>
+
+        <!-- Hutool是一个Java工具包 http://hutool.cn/ -->
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>4.1.12</version>
+        </dependency>
+        <!-- google验证码 -->
+        <dependency>
+            <groupId>com.github.penggle</groupId>
+            <artifactId>kaptcha</artifactId>
+            <version>2.3.2</version>
+        </dependency>
+        <!-- https://mvnrepository.com/artifact/org.apache.velocity/velocity -->
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity</artifactId>
+            <version>1.7</version>
+        </dependency>
+        <!-- websocket -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-websocket</artifactId>
+        </dependency>
+        <!-- 配置文件读取 -->
+        <dependency>
+            <groupId>commons-configuration</groupId>
+            <artifactId>commons-configuration</artifactId>
+            <version>1.10</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-configuration-processor</artifactId>
+            <optional>true</optional>
+        </dependency>
+
+        <!-- mail -->
+        <dependency>
+            <groupId>javax.mail</groupId>
+            <artifactId>mail</artifactId>
+            <version>1.4.7</version>
+        </dependency>
+
+        <!--百度UEditor依赖的jar包 -->
+        <dependency>
+            <groupId>org.json</groupId>
+            <artifactId>json</artifactId>
+            <version>20180813</version>
+        </dependency>
+        <dependency>
+            <groupId>ueditor</groupId>
+            <artifactId>1.4.3</artifactId>
+            <version>1.8</version>
+            <scope>system</scope>
+            <systemPath>${basedir}/lib/ueditor-1.1.2.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-integration</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-logging</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.integration</groupId>
+            <artifactId>spring-integration-ip</artifactId>
+        </dependency>
+
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.17</version>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.18.12</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tomcat</groupId>
+            <artifactId>tomcat-juli</artifactId>
+            <version>${tomcat.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-core</artifactId>
+            <version>${tomcat.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-el</artifactId>
+            <version>${tomcat.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tomcat.embed</groupId>
+            <artifactId>tomcat-embed-websocket</artifactId>
+            <version>${tomcat.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>redis.clients</groupId>
+            <artifactId>jedis</artifactId>
+            <version>3.2.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>4.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi</artifactId>
+            <version>4.0.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.pegdown</groupId>
+            <artifactId>pegdown</artifactId>
+            <version>1.4.2</version>
+        </dependency>
+        <!-- webservice-->
+        <dependency>
+            <groupId>org.apache.ws.commons.axiom</groupId>
+            <artifactId>axiom-api</artifactId>
+            <version>1.2.12</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2</artifactId>
+            <version>1.6.1</version>
+            <type>pom</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-kernel</artifactId>
+            <version>1.6.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-adb</artifactId>
+            <version>1.6.1</version>
+        </dependency>
+        <!-- webservice-->
+
+        <!--http请求-->
+        <dependency>
+            <groupId>com.netflix.feign</groupId>
+            <artifactId>feign-core</artifactId>
+            <version>8.18.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.netflix.feign</groupId>
+            <artifactId>feign-jackson</artifactId>
+            <version>8.18.0</version>
+        </dependency>
+        <!--http请求-->
+
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+            <version>${pgsql.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-annotations</artifactId>
+            <version>1.6.2</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>com.alibaba.cloud</groupId>
+                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
+                <version>${spring-cloud-alibaba.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <!-- spring-cloud-dependencies -->
+            <dependency>
+                <groupId>org.springframework.cloud</groupId>
+                <artifactId>spring-cloud-dependencies</artifactId>
+                <version>Hoxton.SR5</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${spring-boot.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <build>
+
+
+        <!-- 打包不带版本号 -->
+        <!-- <finalName>Gyee_Frame_HF</finalName> -->
+        <plugins>
+            <!-- JUnit 配置 -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <!--忽略测试启动类 -->
+                <configuration>
+                    <skip>true</skip>
+                </configuration>
+            </plugin>
+
+
+
+
+            <!-- generator 配置-->
+            <plugin>
+                <groupId>org.mybatis.generator</groupId>
+                <artifactId>mybatis-generator-maven-plugin</artifactId>
+                <version>1.3.7</version>
+                <configuration>
+                    <!--允许移动生成的文件 -->
+                    <verbose>false</verbose>
+                    <!--允许覆盖生成的文件 -->
+                    <overwrite>false</overwrite>
+                    <!--配置文件的路径 -->
+                    <configurationFile>src/main/resources/mybatis-generator.xml</configurationFile>
+                </configuration>
+                <dependencies>
+                    <!--					<dependency>-->
+                    <!--						<groupId>mysql</groupId>-->
+                    <!--						<artifactId>mysql-connector-java</artifactId>-->
+                    <!--						<version>${mysql.version}</version>-->
+                    <!--					</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>-->
+
+                </dependencies>
+            </plugin>
+            <!-- jar运行配置 -->
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                    <encoding>UTF-8</encoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.3.7.RELEASE</version>
+                 <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <mainClass>com.gyee.SpringbootStart</mainClass>
+                    <!--maven编译时将本地引用的jar包一起打包-->
+                    <includeSystemScope>true</includeSystemScope>
+                </configuration>
+
+            </plugin>
+
+
+
+        </plugins>
+    </build>
+
+    <!-- 阿里云maven仓库 -->
+    <repositories>
+        <repository>
+            <id>public</id>
+            <name>aliyun nexus</name>
+            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+        </repository>
+    </repositories>
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>public</id>
+            <name>aliyun nexus</name>
+            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+        </pluginRepository>
+    </pluginRepositories>
+
+
+</project>

+ 121 - 0
web/health/src/main/java/com/gyee/frame/controller/health/HealthMainController.java

@@ -0,0 +1,121 @@
+package com.gyee.frame.controller.health;
+
+import com.gyee.frame.common.conf.AjaxStatus;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.service.health.HealthMainService;
+import com.gyee.frame.util.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+
+@Controller
+@RequestMapping("/healthmain")
+@Api(value = "健康管理主页面" ,tags =  "健康管理主页面")
+public class HealthMainController {
+
+    @Resource
+    private HealthMainService healthMainService;
+
+
+    @GetMapping("/findAllChart")
+    @ResponseBody
+    @ApiOperation(value = "获得健康状态情况图表", notes = "获得健康状态情况图表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "num", value = "结果数量", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult findAllChart(String wpId, String num, String type) throws Exception {
+
+
+        Map<String, Object[]>  map = new HashMap<>();
+
+        if(StringUtils.notEmp(wpId) && StringUtils.notEmp(num) && StringUtils.notEmp(type))
+        {
+            map = healthMainService.findAllChart(wpId,Integer.valueOf(num), Integer.valueOf(type));
+        }
+
+        if (null!=map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+
+    @GetMapping("/findAllMap")
+    @ResponseBody
+    @ApiOperation(value = "获得全省健康状态基础数据", notes = "获得全省健康状态基础数据")
+    @ApiImplicitParams({
+           })
+    public AjaxResult findAllMap() throws Exception {
+
+
+        Map<String, Object>  map = new HashMap<>();
+
+        map = healthMainService.findAllMap();
+
+        if (null!=map && !map.isEmpty()) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+
+    @GetMapping("/findWpMap")
+    @ResponseBody
+    @ApiOperation(value = "获得场站健康状态基础数据", notes = "获得场站健康状态基础数据")
+    @ApiImplicitParams({
+    })
+    public AjaxResult findWpMap(String wpId) throws Exception {
+
+
+        Map<String, Object>  map = new HashMap<>();
+
+
+        if(StringUtils.notEmp(wpId))
+        {
+            map = healthMainService.findWpMap(wpId);
+        }
+
+
+        if (null!=map && !map.isEmpty()) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+
+
+    @GetMapping("/findHealthMatrixMap")
+    @ResponseBody
+    @ApiOperation(value = "获得健康矩阵", notes = "获得健康矩阵")
+    @ApiImplicitParams({
+    })
+    public AjaxResult findHealthMatrixMap() throws Exception {
+
+
+        Map<String, Object>  map = new HashMap<>();
+
+
+        map = healthMainService.findHealthMatrixMap();
+
+
+        if (null!=map && !map.isEmpty()) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+}

+ 145 - 0
web/health/src/main/java/com/gyee/frame/controller/health/HealthOperationController.java

@@ -0,0 +1,145 @@
+package com.gyee.frame.controller.health;
+
+import com.gyee.frame.common.conf.AjaxStatus;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.model.custom.SimpleVo;
+import com.gyee.frame.service.auto.IProEconShutdownEventService;
+import com.gyee.frame.service.auto.IProEconWarningService;
+import com.gyee.frame.service.health.HealthOperationService;
+import com.gyee.frame.util.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Controller
+@RequestMapping("/healthoperation")
+@Api(value = "健康管理主页面" ,tags =  "健康管理主页面")
+public class HealthOperationController {
+
+    @Resource
+    private HealthOperationService healthOperationService;
+    @Resource
+    private IProEconShutdownEventService proEconShutdownEventService;
+
+    @Resource
+    private IProEconWarningService proEconWarningService;
+
+
+
+    @GetMapping("/countWpwarn")
+    @ResponseBody
+    @ApiOperation(value = "近7天报警事件统计 type 1风场2项目", notes = "近7天报警事件统计 ype 1风场2项目")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult countWpwarn(String type) throws Exception {
+
+
+        List<SimpleVo> vos = new ArrayList<>();
+
+        if(StringUtils.notEmp(type))
+        {
+            if(type.equals("1"))
+            {
+                vos = proEconWarningService.countWpwarnByWp();
+            }else  if(type.equals("2"))
+            {
+                vos = proEconWarningService.countWpwarnByPj();
+            }
+
+        }
+
+        if (null!=vos) {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, vos);
+        }
+
+    }
+
+    @GetMapping("/countStop")
+    @ResponseBody
+    @ApiOperation(value = "近7天停机事件统计 type 1风场2项目", notes = "近7天停机事件统计 ype 1风场2项目")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult countStop(String type) throws Exception {
+
+
+        List<SimpleVo> vos = new ArrayList<>();
+
+        if(StringUtils.notEmp(type))
+        {
+            if(type.equals("1"))
+            {
+                vos = proEconShutdownEventService.countStopByWp();
+            }else  if(type.equals("2"))
+            {
+                vos = proEconShutdownEventService.countStopByPj();
+            }
+
+        }
+
+        if (null!=vos) {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, vos);
+        }
+
+    }
+    @GetMapping("/countWpOrProStatus")
+    @ResponseBody
+    @ApiOperation(value = "健康状态占比图表 type 1风场2项目", notes = "健康状态占比图表 type 1风场2项目")
+    @ApiImplicitParams({
+                @ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult countWpOrProStatus(String type) throws Exception {
+
+
+        Map<String, Object>  map = new HashMap<>();
+
+        if(StringUtils.notEmp(type))
+        {
+            map = healthOperationService.countWpOrProStatus(type);
+        }
+
+        if (null!=map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+
+    @GetMapping("/findWpOrProStatusForHistory")
+    @ResponseBody
+    @ApiOperation(value = "健康状态曲线图表 type 1风场2项目 status 1良好2注意", notes = "健康状态曲线图表 type 1风场2项目 status 1良好2注意")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "status", value = "状态", required = true, dataType = "string", paramType = "query")})
+    public AjaxResult findWpOrProStatusForHistory(String type, String status) throws Exception {
+
+
+        Map<String, Object>  map = new HashMap<>();
+
+        if(StringUtils.notEmp(type) && StringUtils.notEmp(status))
+        {
+            map = healthOperationService.findWpOrProStatusForHistory(type,status);
+        }
+
+        if (null!=map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+}

+ 499 - 0
web/health/src/main/java/com/gyee/frame/controller/health/HealthSubController.java

@@ -0,0 +1,499 @@
+package com.gyee.frame.controller.health;
+
+import com.gyee.frame.common.conf.AjaxStatus;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.model.auto.ProEconShutdownEvent;
+import com.gyee.frame.model.custom.*;
+import com.gyee.frame.service.health.HealthSubService;
+import com.gyee.frame.service.weather.WeatherDay5Service;
+import com.gyee.frame.util.DateUtils;
+import com.gyee.frame.util.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+@Controller
+@RequestMapping("/healthsub")
+@Api(value = "健康管理风机页面" ,tags =  "健康管理风机页面")
+public class HealthSubController {
+
+    @Resource
+    private HealthSubService healthSubService;
+
+    @Resource
+    private WeatherDay5Service weatherDay5Service;
+
+
+
+    @GetMapping("/findWtHealthInfo")
+    @ResponseBody
+    @ApiOperation(value = "获取健康管理风机信息", notes = "获取健康管理风机信息")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult findWtHealthInfo(String wtId) throws Exception {
+
+
+        Map<String, Object>  map = new HashMap<>();
+
+        if(StringUtils.notEmp(wtId))
+        {
+
+
+            Calendar cal = Calendar.getInstance();
+
+            Date recodedate = DateUtils.truncate(cal.getTime());
+            //获取故障类型和风机健康得分
+            Map<String,String>  stoptypemap = healthSubService.findWtInfo(wtId);
+            //获取健康管理风机部件基础信息
+            Map<String, Map<String, Object>>  partmap = healthSubService.findPartHealthInfo(wtId);
+            //故障数据统计
+            List<GzfxVo>  gzls = healthSubService.initalGzjfx(wtId,recodedate);
+            //预警数据统计
+            List<YjfxVo>  yjls = healthSubService.initalYjfx(wtId,recodedate);
+            //部件运行数据
+            List<YxfxVo>  bjyxls = healthSubService.initalYxfx(wtId,recodedate);
+            //获得日、月等级评估
+            List<XnfxVo>  djpgls = healthSubService.initalXnfx(wtId,cal);
+            //当日停机
+            List<ShutdowneventVo>  stopls = healthSubService.initalShutdown(wtId);
+            //各个区间曲线偏差率
+            List<QxpcVo>  qxpcls = healthSubService.findQxpcList(wtId);
+            //温度范围
+            List<YxfxVo>  wdls = healthSubService.findWdList(wtId);
+            //获得健康评价列表
+            List<ValueVo>  jkls = healthSubService.findJudgmentList(wtId);
+
+
+            map.put("stoptypemap",stoptypemap);
+            map.put("partmap",partmap);
+            map.put("gzls",gzls);
+            map.put("yjls",yjls);
+            map.put("bjyxls",bjyxls);
+            map.put("djpgls",djpgls);
+            map.put("stopls",stopls);
+            map.put("qxpcls",qxpcls);
+            map.put("wdls",wdls);
+            map.put("jkls",jkls);
+
+
+
+        }
+
+        if (null!=map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+
+    @GetMapping("/findWtHealthInfo1")
+    @ResponseBody
+    @ApiOperation(value = "获取健康管理风机信息", notes = "获取健康管理风机信息")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult findWtHealthInfo1(String wtId) throws Exception {
+
+
+        Map<String, Object>  map = new HashMap<>();
+
+        if(StringUtils.notEmp(wtId))
+        {
+
+
+            Calendar cal = Calendar.getInstance();
+
+            Date recodedate = DateUtils.truncate(cal.getTime());
+//            //获取故障类型和风机健康得分
+//            Map<String,String>  stoptypemap = healthSubService.findWtInfo(wtId);
+//            //获取健康管理风机部件基础信息
+//            Map<String, Map<String, Object>>  partmap = healthSubService.findPartHealthInfo(wtId);
+//            //故障数据统计
+//            List<GzfxVo>  gzls = healthSubService.initalGzjfx(wtId,recodedate);
+//            //预警数据统计
+//            List<YjfxVo>  yjls = healthSubService.initalYjfx(wtId,recodedate);
+//            //部件运行数据
+//            List<YxfxVo>  bjyxls = healthSubService.initalYxfx(wtId,recodedate);
+//            //获得日、月等级评估
+//            List<XnfxVo>  djpgls = healthSubService.initalXnfx(wtId,cal);
+//            //当日停机
+//            List<ShutdowneventVo>  stopls = healthSubService.initalShutdown(wtId);
+//            //各个区间曲线偏差率
+//            List<QxpcVo>  qxpcls = healthSubService.findQxpcList(wtId);
+//            //温度范围
+//            List<YxfxVo>  wdls = healthSubService.findWdList(wtId);
+//            //获得健康评价列表
+//            List<ValueVo>  jkls = healthSubService.findJudgmentList(wtId);
+//
+//
+//            map.put("stoptypemap",stoptypemap);
+//            map.put("partmap",partmap);
+//            map.put("gzls",gzls);
+//            map.put("yjls",yjls);
+//            map.put("bjyxls",bjyxls);
+//            map.put("djpgls",djpgls);
+//            map.put("stopls",stopls);
+//            map.put("qxpcls",qxpcls);
+//            map.put("wdls",wdls);
+//            map.put("jkls",jkls);
+
+            //获取故障类型和风机健康得分
+            Map<String,String>  stoptypemap = healthSubService.findWtInfo(wtId);
+            //获取健康管理风机部件基础信息
+            Map<String, Map<String, Object>>  partmap = healthSubService.findPartHealthInfo(wtId);
+            //故障数据统计
+            List<GzfxVo>  gzls = healthSubService.initalGzjfx(wtId,recodedate);
+            //预警数据统计
+            List<YjfxVo>  yjls = healthSubService.initalYjfx(wtId,recodedate);
+
+
+            map.put("stoptypemap",stoptypemap);
+            map.put("partmap",partmap);
+            map.put("gzls",gzls);
+            map.put("yjls",yjls);
+
+        }
+
+        if (null!=map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+
+/********************************************************************************************************/
+
+
+@GetMapping("/findWtHealthInfo2")
+@ResponseBody
+@ApiOperation(value = "获取健康管理风机信息", notes = "获取健康管理风机信息")
+@ApiImplicitParams({
+        @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query")
+})
+public AjaxResult findWtHealthInfo2(String wtId) throws Exception {
+
+
+    Map<String, Object>  map = new HashMap<>();
+
+    if(StringUtils.notEmp(wtId))
+    {
+
+
+        Calendar cal = Calendar.getInstance();
+
+        Date recodedate = DateUtils.truncate(cal.getTime());
+
+        //部件运行数据
+        List<YxfxVo>  bjyxls = healthSubService.initalYxfx(wtId,recodedate);
+        //获得日、月等级评估
+        List<XnfxVo>  djpgls = healthSubService.initalXnfx(wtId,cal);
+        //当日停机
+        List<ShutdowneventVo>  stopls = healthSubService.initalShutdown(wtId);
+
+
+        map.put("bjyxls",bjyxls);
+        map.put("djpgls",djpgls);
+        map.put("stopls",stopls);
+
+    }
+
+    if (null!=map) {
+        return AjaxResult.successData(AjaxStatus.success.code, map);
+    } else {
+        return AjaxResult.successData(AjaxStatus.error.code, map);
+    }
+
+}
+
+    /********************************************************************************************************/
+
+    @GetMapping("/findWtHealthInfo3")
+    @ResponseBody
+    @ApiOperation(value = "获取健康管理风机信息", notes = "获取健康管理风机信息")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult findWtHealthInfo3(String wtId) throws Exception {
+
+
+        Map<String, Object>  map = new HashMap<>();
+
+        if(StringUtils.notEmp(wtId))
+        {
+
+
+            Calendar cal = Calendar.getInstance();
+
+            Date recodedate = DateUtils.truncate(cal.getTime());
+
+            //各个区间曲线偏差率
+            List<QxpcVo>  qxpcls = healthSubService.findQxpcList(wtId);
+            //温度范围
+            List<YxfxVo>  wdls = healthSubService.findWdList(wtId);
+            //获得健康评价列表
+            List<ValueVo>  jkls = healthSubService.findJudgmentList(wtId);
+
+
+            map.put("qxpcls",qxpcls);
+            map.put("wdls",wdls);
+            map.put("jkls",jkls);
+        }
+
+        if (null!=map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+
+    /********************************************************************************************************/
+
+    @GetMapping("/gadaytop5")
+    @ResponseBody
+    @ApiOperation(value = "获得等级评估前5数据", notes = "获得等级评估前5数据")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult gadaytop5(String wtId) throws Exception {
+
+
+        Map<String, Object> map = new HashMap<>();
+
+        if(StringUtils.notEmp(wtId))
+        {
+
+            map = healthSubService.gadaytop5(wtId);
+        }
+
+        if (null!=map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+
+
+    @GetMapping("/queryStopTop10")
+    @ResponseBody
+    @ApiOperation(value = "获取最新的十次停机事件", notes = "获取最新的十次停机事件")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult queryStopTop10(String wtId) throws Exception {
+
+
+        List<ProEconShutdownEvent> vos = new ArrayList<>();
+
+        if(StringUtils.notEmp(wtId))
+        {
+
+            vos = healthSubService.queryStopTop10(wtId);
+        }
+
+        if (null!=vos) {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, vos);
+        }
+
+    }
+
+
+    @GetMapping("/getWtMttrandMtbfByBj")
+    @ResponseBody
+    @ApiOperation(value = "获取风机部件MTTR和MTBF  数组 0健康状态、1部件名称 2 7天健康状态 3 故障进度 4 mtbf 5 mttr 6损失电量", notes = "获取风机部件MTTR和MTBF 数组 0健康状态、1部件名称 2 7天健康状态 3 故障进度 4 mtbf 5 mttr 6损失电量")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult getWtMttrandMtbfByBj(String wtId) throws Exception {
+
+
+        Map<String, Object> map = new HashMap<String, Object>();
+
+        if(StringUtils.notEmp(wtId))
+        {
+
+            map = healthSubService.getWtMttrandMtbfByBj(wtId);
+        }
+
+        if (null!=map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+
+    @GetMapping("/getWeatherRealDay5Info")
+    @ResponseBody
+    @ApiOperation(value = "获取近5天气象数据", notes = "获取近5天气象数据")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult getWeatherRealDay5Info(String wpId) throws Exception {
+
+
+        Map<String, Object> map = new HashMap<String, Object>();
+
+        if(StringUtils.notEmp(wpId))
+        {
+
+            map = weatherDay5Service.getWeatherRealDay5Info(wpId);
+        }
+
+        if (null!=map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+
+
+
+    @GetMapping("/findPowerChar")
+    @ResponseBody
+    @ApiOperation(value = "获得实际功率和理论功率曲线", notes = "获得实际功率和理论功率曲线")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult findPowerChar(String wtId) throws Exception {
+
+
+        Map<String, Object[]> map = new HashMap<>();
+
+        if(StringUtils.notEmp(wtId))
+        {
+
+            map = healthSubService.findPowerChar(wtId);
+        }
+
+        if (null!=map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+/**************************************************************************************************************************************************/
+
+    @GetMapping("/hsFjValueIndex")
+    @ResponseBody
+    @ApiOperation(value = "获取部件图表", notes = "获取部件图表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult hsFjValueIndex(String wtId) throws Exception {
+
+
+        ActivityVo vo = new ActivityVo();
+
+        if(StringUtils.notEmp(wtId))
+        {
+            Calendar cal = Calendar.getInstance();
+
+            cal.set(Calendar.HOUR_OF_DAY, 0);
+            cal.set(Calendar.MINUTE, 0);
+            cal.set(Calendar.SECOND, 0);
+
+
+            Date endDate = cal.getTime();
+
+            cal.add(Calendar.DAY_OF_MONTH, -1);
+            Date beginDate = cal.getTime();
+            vo = healthSubService.hsFjValueIndex(wtId,beginDate,endDate);
+        }
+
+        if (null!=vo) {
+            return AjaxResult.successData(AjaxStatus.success.code, vo);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, vo);
+        }
+
+    }
+
+
+    @GetMapping("/findWtHisValueForBj")
+    @ResponseBody
+    @ApiOperation(value = "获取风机部件健康曲线图表", notes = "获取风机部件健康曲线图表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult findWtHisValueForBj(String wtId) throws Exception {
+
+
+        Map<String,Object> map = new HashMap();
+
+
+        if(StringUtils.notEmp(wtId))
+        {
+
+            map = healthSubService.findWtHisValueForBj(wtId);
+        }
+
+        if (null!=map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, map);
+        }
+
+    }
+
+
+    @GetMapping("/hsFjValueIndexByPart")
+    @ResponseBody
+    @ApiOperation(value = "获取风机健康部件曲线图", notes = "获取风机健康部件曲线图")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "type", value = "部件类型", required = true, dataType = "string", paramType = "query")
+    })
+    public AjaxResult hsFjValueIndexByPart(String wtId,String type) throws Exception {
+
+        Map<String, Object> result = new HashMap<String, Object>();
+        ActivityVo vo=new ActivityVo();
+
+        if(StringUtils.notEmp(wtId) && StringUtils.notEmp(type))
+        {
+            if (type.equals("1")) {
+                vo = healthSubService.getWTChart(wtId);
+            } else if (type.equals("2")) {
+                vo = healthSubService.getClxChart(wtId);
+            } else if (type.equals("3")) {
+                vo = healthSubService.getFdjChart(wtId);
+            } else if (type.equals("4")) {
+                vo = healthSubService.getKzysChart(wtId);
+            } else if (type.equals("5")) {
+                vo = healthSubService.getJcxtChart(wtId);
+            }
+
+            result.put(wtId, healthSubService.getrealValue(wtId, type));
+        }
+
+
+        result.put("activity", vo);
+
+        if (null!=vo) {
+            return AjaxResult.successData(AjaxStatus.success.code, vo);
+        } else {
+            return AjaxResult.successData(AjaxStatus.error.code, vo);
+        }
+
+    }
+
+
+
+
+}

+ 9 - 0
web/health/src/main/java/com/gyee/frame/mapper/auto/ProEconRecommenMainMapper.java

@@ -2,6 +2,11 @@ package com.gyee.frame.mapper.auto;
 
 import com.gyee.frame.model.auto.ProEconRecommenMain;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.Date;
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +18,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface ProEconRecommenMainMapper extends BaseMapper<ProEconRecommenMain> {
 
+    @Select("    select * from pro_econ_recommen_main  where id in" +
+            "    (select max(id) from pro_econ_recommen_main where ismain=#{ismain} and  record_date >= #{beginDate} and record_date < #{endDate} group by wt_id )" +
+            "    order by record_date")
+    public List<ProEconRecommenMain> getRecommenmainDay(@Param("ismain") Integer ismain,@Param("beginDate")  Date beginDate,@Param("endDate")  Date endDate);
 }

+ 13 - 0
web/health/src/main/java/com/gyee/frame/mapper/auto/ProEconShutdownEventMapper.java

@@ -3,6 +3,7 @@ package com.gyee.frame.mapper.auto;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.frame.model.auto.ProEconShutdownEvent;
 import com.gyee.frame.model.custom.ShutdowneventVo;
+import com.gyee.frame.model.custom.SimpleVo;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
@@ -33,4 +34,16 @@ public interface ProEconShutdownEventMapper extends BaseMapper<ProEconShutdownEv
                                       @Param("beginDate")Date beginDate, @Param("endDate")Date endDate,
                                       @Param("type") String type);
 
+
+
+    @Select(" select b.windpowerstationid id, count(*) filter(where a.stoptime between (SELECT current_date - interval '7 day') and current_date) as" +
+            "        value from shutdownevent a,windturbine b" +
+            "    where  a.windturbineid = b.id and a.statuscode=2   group by b.windpowerstationid")
+   
+    List<SimpleVo> countStopByWp();
+    @Select("select b.projectid id, count(*) filter(where a.stoptime between (SELECT current_date - interval '7 day') and current_date) as" +
+            "        value from shutdownevent a,windturbine b" +
+            "    where  a.windturbineid = b.id and a.statuscode=2   group by b.projectid")
+    List<SimpleVo> countStopByPj();
+
 }

+ 17 - 0
web/health/src/main/java/com/gyee/frame/mapper/auto/ProEconWarningMapper.java

@@ -2,6 +2,11 @@ package com.gyee.frame.mapper.auto;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.frame.model.auto.ProEconWarning;
+import com.gyee.frame.model.custom.SimpleVo;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +18,16 @@ import com.gyee.frame.model.auto.ProEconWarning;
  */
 public interface ProEconWarningMapper extends BaseMapper<ProEconWarning> {
 
+
+    @Select(" " +
+            "    select b.stationid id, count(*) filter(where a.alerttime between (SELECT current_date - interval '7 day') and current_date) as" +
+            "        value   from ${tname} a,alarmsnap b" +
+            "    where a.snapid = b.id and category1='windturbine' and b.category2 is not null" +
+            "      and b.category2!='other' group by b.stationid")
+    List<SimpleVo> countWpwarnByWp(@Param("tname") String tname);
+    @Select(" select b.projectid id, count(*) filter(where a.alerttime between (SELECT current_date - interval '7 day') and current_date) as" +
+            "        value   from ${tname} a,alarmsnap b" +
+            "    where a.snapid = b.id and category1='windturbine' and b.category2 is not null" +
+            "      and b.category2!='other' group by b.projectid")
+    List<SimpleVo> countWpwarnByPj(@Param("tname") String tname);
 }

+ 4 - 3
web/health/src/main/java/com/gyee/frame/model/auto/ProEconEarlyWarningMain.java

@@ -1,10 +1,11 @@
 package com.gyee.frame.model.auto;
 
 import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.time.LocalDate;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.time.LocalDate;
+
 /**
  * <p>
  * 预警统计主表
@@ -172,7 +173,7 @@ public class ProEconEarlyWarningMain extends Model {
     /**
      * 1月排名
      */
-    private String month1topnum;
+    private Integer month1topnum;
 
     /**
      * 7天排名
@@ -227,7 +228,7 @@ public class ProEconEarlyWarningMain extends Model {
     /**
      * 1天排名1
      */
-    private Integer day1topnum1;
+    private Integer day1topnum;
 
 
 }

+ 56 - 0
web/health/src/main/java/com/gyee/frame/model/vo/HealthStatusValue.java

@@ -0,0 +1,56 @@
+package com.gyee.frame.model.vo;
+
+public enum HealthStatusValue {
+
+
+
+    ZC(1.0, "正常"),
+    LH(2.0, "良好"),
+    ZY(3.0, "注意"),
+    YZ(4.0, "严重");
+
+    private Double code;
+    private String name;
+
+    HealthStatusValue(Double code) {
+        this.code = code;
+    }
+
+    HealthStatusValue(Double code, String name) {
+        this.code = code;
+        this.name = name;
+    }
+
+    public Double getCode() {
+        return code;
+    }
+
+    public void setCode(Double code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * 根据code获取message
+     *
+     * @param code
+     * @return
+     */
+    public static String getNmaeByCode(Double code) {
+        for (HealthStatusValue ele : values()) {
+            if (ele.getCode().equals(code)) {
+                return ele.getName();
+            }
+        }
+        return null;
+    }
+
+
+}

+ 20 - 20
web/health/src/main/java/com/gyee/frame/model/vo/StatusDetailValue.java

@@ -17,38 +17,38 @@ public enum StatusDetailValue {
     //13	设备离线
 
 
-    DJ(0, "待机"),
-    SDTJ(1, "手动停机"),
-    ZCFD(2, "正常发电"),
-    FDJCL(3, "发电降出力"),
-    GZ(4, "故障"),
-    GZSL(5, "故障受累"),
-    JX(6, "检修"),
-    JXSL(7, "检修受累"),
-    XDJCL(8, "限电降出力"),
-    XDTJ(9, "限电停机"),
-    DWSL(10, "电网受累"),
-    HJSL(11, "环境受累"),
-    TXZD(12, "通讯中断"),
-    SBLX(13, "设备离线");
+    DJ(0.0, "待机"),
+    SDTJ(1.0, "手动停机"),
+    ZCFD(2.0, "正常发电"),
+    FDJCL(3.0, "发电降出力"),
+    GZ(4.0, "故障"),
+    GZSL(5.0, "故障受累"),
+    JX(6.0, "检修"),
+    JXSL(7.0, "检修受累"),
+    XDJCL(8.0, "限电降出力"),
+    XDTJ(9.0, "限电停机"),
+    DWSL(10.0, "电网受累"),
+    HJSL(11.0, "环境受累"),
+    TXZD(12.0, "通讯中断"),
+    SBLX(13.0, "设备离线");
 
-    private Integer code;
+    private Double code;
     private String name;
 
-    StatusDetailValue(Integer code) {
+    StatusDetailValue(Double code) {
         this.code = code;
     }
 
-    StatusDetailValue(Integer code, String name) {
+    StatusDetailValue(Double code, String name) {
         this.code = code;
         this.name = name;
     }
 
-    public Integer getCode() {
+    public Double getCode() {
         return code;
     }
 
-    public void setCode(Integer code) {
+    public void setCode(Double code) {
         this.code = code;
     }
 
@@ -66,7 +66,7 @@ public enum StatusDetailValue {
      * @param code
      * @return
      */
-    public static String getNmaeByCode(Integer code) {
+    public static String getNmaeByCode(Double code) {
         for (StatusDetailValue ele : values()) {
             if (ele.getCode().equals(code)) {
                 return ele.getName();

+ 13 - 13
web/health/src/main/java/com/gyee/frame/model/vo/StatusValue.java

@@ -10,31 +10,31 @@ public enum StatusValue {
     //5	受累
     //6	离线
 
-    DJ(0, "待机"),
-    YX(1, "运行"),
-    GZ(2, "故障"),
-    JX(3, "检修"),
-    XD(4, "限电"),
-    SL(5, "受累"),
-    LX(6, "离线");
+    DJ(0.0, "待机"),
+    YX(1.0, "运行"),
+    GZ(2.0, "故障"),
+    JX(3.0, "检修"),
+    XD(4.0, "限电"),
+    SL(5.0, "受累"),
+    LX(6.0, "离线");
 
-    private Integer code;
+    private Double code;
     private String name;
 
-    StatusValue(Integer code) {
+    StatusValue(Double code) {
         this.code = code;
     }
 
-    StatusValue(Integer code, String name) {
+    StatusValue(Double code, String name) {
         this.code = code;
         this.name = name;
     }
 
-    public Integer getCode() {
+    public Double getCode() {
         return code;
     }
 
-    public void setCode(Integer code) {
+    public void setCode(Double code) {
         this.code = code;
     }
 
@@ -52,7 +52,7 @@ public enum StatusValue {
      * @param code
      * @return
      */
-    public static String getNmaeByCode(Integer code) {
+    public static String getNmaeByCode(Double code) {
         for (StatusValue ele : values()) {
             if (ele.getCode().equals(code)) {
                 return ele.getName();

+ 8 - 1
web/health/src/main/java/com/gyee/frame/service/auto/IProEconRecommenMainService.java

@@ -1,7 +1,10 @@
 package com.gyee.frame.service.auto;
 
-import com.gyee.frame.model.auto.ProEconRecommenMain;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.frame.model.auto.ProEconRecommenMain;
+
+import java.util.Date;
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +16,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IProEconRecommenMainService extends IService<ProEconRecommenMain> {
 
+
+    public List<ProEconRecommenMain> getRecommenmainListByStatus(String ismain, Date beginDate, Date endDate);
+
+    public ProEconRecommenMain getRecommenmain(String rId) ;
 }

+ 13 - 0
web/health/src/main/java/com/gyee/frame/service/auto/IProEconShutdownEventService.java

@@ -3,6 +3,7 @@ package com.gyee.frame.service.auto;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.gyee.frame.model.auto.ProEconShutdownEvent;
 import com.gyee.frame.model.custom.ShutdowneventVo;
+import com.gyee.frame.model.custom.SimpleVo;
 
 import java.util.Date;
 import java.util.List;
@@ -24,4 +25,16 @@ public interface IProEconShutdownEventService extends IService<ProEconShutdownEv
 
     public List<ProEconShutdownEvent> queryStopWtByPart(String wtId);
 
+
+    /**
+     * 获取七天内各个风场停机统计
+     * @return
+     */
+    public List<SimpleVo> countStopByWp();
+    /**
+     * 获取七天内各个项目停机统计
+     * @return
+     */
+    public List<SimpleVo> countStopByPj();
+
 }

+ 5 - 1
web/health/src/main/java/com/gyee/frame/service/auto/IProEconWarningService.java

@@ -2,6 +2,9 @@ package com.gyee.frame.service.auto;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.gyee.frame.model.auto.ProEconWarning;
+import com.gyee.frame.model.custom.SimpleVo;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +15,6 @@ import com.gyee.frame.model.auto.ProEconWarning;
  * @since 2022-10-21
  */
 public interface IProEconWarningService extends IService<ProEconWarning> {
-
+     List<SimpleVo> countWpwarnByWp();
+     List<SimpleVo> countWpwarnByPj();
 }

+ 48 - 0
web/health/src/main/java/com/gyee/frame/service/auto/impl/ProEconRecommenMainServiceImpl.java

@@ -1,11 +1,18 @@
 package com.gyee.frame.service.auto.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.frame.model.auto.ProEconRecommenMain;
 import com.gyee.frame.mapper.auto.ProEconRecommenMainMapper;
 import com.gyee.frame.service.auto.IProEconRecommenMainService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.frame.util.StringUtils;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 /**
  * <p>
  * 健康追踪主表 服务实现类
@@ -17,4 +24,45 @@ import org.springframework.stereotype.Service;
 @Service
 public class ProEconRecommenMainServiceImpl extends ServiceImpl<ProEconRecommenMainMapper, ProEconRecommenMain> implements IProEconRecommenMainService {
 
+
+    @Resource
+    private ProEconRecommenMainMapper proEconRecommenMainMapper;
+    public List<ProEconRecommenMain> getRecommenmainListByStatus(String ismain, Date beginDate, Date endDate) {
+
+
+        List<ProEconRecommenMain> list=new ArrayList<>();
+
+        if (StringUtils.notEmp(ismain) &&StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate)) {
+
+            list=proEconRecommenMainMapper.getRecommenmainDay(Integer.valueOf(ismain),beginDate,endDate);
+
+
+        }
+        return list;
+
+    }
+
+
+    public ProEconRecommenMain getRecommenmain(String rId) {
+
+        ProEconRecommenMain po=new ProEconRecommenMain();
+
+        if (StringUtils.notEmp(rId) ) {
+
+            QueryWrapper<ProEconRecommenMain> qw = new QueryWrapper<>();
+            qw.eq("id",rId);
+
+            qw.orderByAsc("record_date");
+            List<ProEconRecommenMain> list = proEconRecommenMainMapper.selectList(qw);
+
+            if(!list.isEmpty())
+            {
+                po=list.get(0);
+            }
+
+        }
+
+        return po;
+
+    }
 }

+ 74 - 4
web/health/src/main/java/com/gyee/frame/service/auto/impl/ProEconShutdownEventServiceImpl.java

@@ -4,18 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.mapper.auto.ProEconShutdownEventMapper;
+import com.gyee.frame.model.auto.ProBasicPowerstation;
+import com.gyee.frame.model.auto.ProBasicProject;
 import com.gyee.frame.model.auto.ProEconShutdownEvent;
 import com.gyee.frame.model.custom.ShutdowneventVo;
+import com.gyee.frame.model.custom.SimpleVo;
 import com.gyee.frame.service.auto.IProEconShutdownEventService;
 import com.gyee.frame.util.StringUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * <p>
@@ -120,4 +121,73 @@ public class ProEconShutdownEventServiceImpl extends ServiceImpl<ProEconShutdown
         return list;
 
     }
+
+
+    /**
+     * 获取七天内各个风场停机统计
+     * @return
+     */
+    public List<SimpleVo> countStopByWp() {
+
+        List<SimpleVo> vos=new ArrayList<>();
+        List<SimpleVo> ls= proEconShutdownEventMapper.countStopByWp();
+        if(!ls.isEmpty())
+        {
+            Map<String,SimpleVo> map=new HashMap<>();
+            for(SimpleVo vo:ls)
+            {
+                map.put(vo.getId(),vo);
+            }
+
+            for(ProBasicPowerstation wp: InitialRunner.wpls)
+            {
+                SimpleVo vo=new SimpleVo();
+                vo.setId(wp.getId());
+                vo.setName(wp.getName());
+                vo.setValue(0);
+                if(map.containsKey(wp.getId()))
+                {
+                    SimpleVo votemp=map.get(wp.getId());
+                    vo.setValue(votemp.getValue());
+                }
+                vos.add(vo);
+            }
+        }
+        return vos;
+
+    }
+
+    /**
+     * 获取七天内各个项目停机统计
+     * @return
+     */
+    public List<SimpleVo> countStopByPj() {
+
+        List<SimpleVo> vos=new ArrayList<>();
+        List<SimpleVo> ls= proEconShutdownEventMapper.countStopByPj();
+        if(!ls.isEmpty())
+        {
+            Map<String,SimpleVo> map=new HashMap<>();
+            for(SimpleVo vo:ls)
+            {
+                map.put(vo.getId(),vo);
+            }
+
+            for(ProBasicProject pj:InitialRunner.pjls)
+            {
+                SimpleVo vo=new SimpleVo();
+                vo.setId(pj.getId());
+                vo.setName(pj.getName());
+                vo.setValue(0);
+                if(map.containsKey(pj.getId()))
+                {
+                    SimpleVo votemp=map.get(pj.getId());
+                    vo.setValue(votemp.getValue());
+                }
+                vos.add(vo);
+            }
+        }
+        return vos;
+
+    }
 }

+ 102 - 0
web/health/src/main/java/com/gyee/frame/service/auto/impl/ProEconWarningServiceImpl.java

@@ -1,11 +1,21 @@
 package com.gyee.frame.service.auto.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.mapper.auto.ProEconWarningMapper;
+import com.gyee.frame.model.auto.ProBasicPowerstation;
 import com.gyee.frame.model.auto.ProEconWarning;
+import com.gyee.frame.model.custom.SimpleVo;
 import com.gyee.frame.service.auto.IProEconWarningService;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
 /**
  * <p>
  * 报警 服务实现类
@@ -17,4 +27,96 @@ import org.springframework.stereotype.Service;
 @Service
 public class ProEconWarningServiceImpl extends ServiceImpl<ProEconWarningMapper, ProEconWarning> implements IProEconWarningService {
 
+    @Resource
+    private ProEconWarningMapper proEconWarningMapper;
+    /**
+     * 获取七天内各个风场报警统计
+     * @return
+     */
+    @Override
+    public List<SimpleVo> countWpwarnByWp() {
+
+        List<SimpleVo> vos=new ArrayList<>();
+        SimpleDateFormat sdf_no_underline = new SimpleDateFormat("yyyyMM");
+        Calendar cal = Calendar.getInstance();
+        Date endDate = cal.getTime();
+
+        for(ProBasicPowerstation wp: InitialRunner.wpls)
+        {
+
+            if (wp.getId().endsWith("_FDC")) {
+
+                SimpleVo vo=null;
+
+                StringBuilder tablename = new StringBuilder();
+                tablename.append("alarmhistory_");
+                tablename.append(wp.getId().split("_")[0]);
+                tablename.append("_");
+                tablename.append(sdf_no_underline.format(endDate));
+                List<SimpleVo> ls= proEconWarningMapper.countWpwarnByWp(String.valueOf(tablename));
+                if(!ls.isEmpty())
+                {
+                    vo=ls.get(0);
+                    vo.setName(wp.getName());
+                }else
+                {
+                    vo=new SimpleVo();
+                    vo.setId(wp.getId());
+                    vo.setName(wp.getName());
+                    vo.setValue(0);
+                }
+
+                vos.add(vo);
+            }
+
+
+        }
+
+        return vos;
+
+    }
+
+    @Override
+    public List<SimpleVo> countWpwarnByPj() {
+
+        List<SimpleVo> vos=new ArrayList<>();
+        SimpleDateFormat sdf_no_underline = new SimpleDateFormat("yyyyMM");
+        Calendar cal = Calendar.getInstance();
+        Date endDate = cal.getTime();
+
+        for(ProBasicPowerstation wp:InitialRunner.wpls)
+        {
+
+            if (wp.getId().endsWith("_FDC")) {
+
+                SimpleVo vo=null;
+
+                StringBuilder tablename = new StringBuilder();
+                tablename.append("alarmhistory_");
+                tablename.append(wp.getId().split("_")[0]);
+                tablename.append("_");
+                tablename.append(sdf_no_underline.format(endDate));
+                List<SimpleVo> ls= proEconWarningMapper.countWpwarnByPj(String.valueOf(tablename));
+                if(!ls.isEmpty())
+                {
+                    vo=ls.get(0);
+                    vo.setName(wp.getName());
+                }else
+                {
+                    vo=new SimpleVo();
+                    vo.setId(wp.getId());
+                    vo.setName(wp.getName());
+                    vo.setValue(0);
+                }
+
+                vos.add(vo);
+            }
+
+
+        }
+        return vos;
+
+    }
+
+
 }

+ 40 - 37
web/health/src/main/java/com/gyee/frame/service/health/HealthMainService.java

@@ -1,14 +1,16 @@
 package com.gyee.frame.service.health;
 
-import com.gyee.common.model.DNAVal;
 import com.gyee.common.model.PointData;
+import com.gyee.frame.common.conf.GyeeConfig;
 import com.gyee.frame.common.spring.Constant;
 import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.model.auto.*;
 import com.gyee.frame.model.custom.MatrixVo;
 import com.gyee.frame.model.custom.ShutdowneventVo;
 import com.gyee.frame.model.custom.SimpleVo;
+import com.gyee.frame.model.vo.HealthStatusValue;
 import com.gyee.frame.model.vo.ShutdowneventType;
+import com.gyee.frame.model.vo.StatusDetailValue;
 import com.gyee.frame.model.vo.StopType;
 import com.gyee.frame.service.auto.IProBasicEquipmentPointService;
 import com.gyee.frame.service.auto.IProBasicPowerstationPointService;
@@ -28,7 +30,7 @@ public class HealthMainService {
 
     @Resource
     private IProBasicEquipmentPointService proBasicEquipmentPointService;
-//    @Resource
+    //    @Resource
 //    private IProEconWeatherFhService proEconWeatherFhService;
 //    @Resource
 //    private IProEconWeatherFdService proEconWeatherFdService;
@@ -36,7 +38,7 @@ public class HealthMainService {
     private IProEconShutdownEventService proEconShutdownEventService;
     @Resource
     private IProBasicPowerstationPointService proBasicPowerstationPointService;
-//    @Resource
+    //    @Resource
 //    private WeatherService weatherService;
 //    @Resource
 //    private WeatherDay5Service weatherDay5Service;
@@ -140,9 +142,9 @@ public class HealthMainService {
 
     /**
      * 获得健康状态日情况图表
-     *  wpId
-     *  num  多少个点
-     *  type 1、当日2、 7日3、当月
+     * wpId
+     * num  多少个点
+     * type 1、当日2、 7日3、当月
      */
     public Map<String, Object[]> findAllChart(String wpId, int num, int type) throws Exception {
 
@@ -211,17 +213,18 @@ public class HealthMainService {
 
             }
 
-            String[] jkpoints = new String[wtidls.size()];
+            List<String> jkpoints = new ArrayList<>();
 
             // 获得训练参数对象
             for (int x = 0; x < wtidls.size(); x++) {
 
 
                 ProBasicEquipmentPoint ai = proBasicEquipmentPointService.getEquipmentPoint(wtidls.get(x), codejkls.get(x));
-                jkpoints[x] = ai.getNemCode();
+                jkpoints.add(ai.getNemCode());
             }
 
             for (int i = 0; i < num; i++) {
+
                 ysl = 0;// 优数量
                 lsl = 0;// 良数量
                 csl = 0;// 差数量
@@ -230,19 +233,19 @@ public class HealthMainService {
                 int recodeDate = new BigDecimal(cal.getTime().getTime()).divide(new BigDecimal(1000), 0, RoundingMode.HALF_EVEN).intValue();
 
                 // 获得风机健康状态结果数组
-                DNAVal[] jkvalues = realApiUtil.getHistMatrix(jkpoints, recodeDate);
+                List<PointData> jkvalues = realApiUtil.getHistMatrix(jkpoints, recodeDate);
 
                 for (int x = 0; x < wtidls.size(); x++) {
 
-                    double jk = jkvalues[x].DValue;
+                    double jk = jkvalues.get(x).getPointValueInDouble();
 
-                    if (jk == 4.0) {
+                    if (jk == HealthStatusValue.YZ.getCode()) {
 
                         csl++;
-                    } else if (jk == 3.0) {
+                    } else if (jk == HealthStatusValue.ZY.getCode()) {
 
                         lsl++;
-                    } else if (jk == 2.0 || jk == 1.0) {
+                    } else if (jk == HealthStatusValue.ZC.getCode() || jk == HealthStatusValue.LH.getCode()) {
 
                         ysl++;
                     } else {
@@ -480,11 +483,11 @@ public class HealthMainService {
                         gzIdLs.add(vo);
                         csl++;
                     } else {
-                        if (jk == 1) {
+                        if (jk == HealthStatusValue.ZC.getCode()) {
 
                             ysl++;
 
-                        } else if (jk == 2 || jk == 3) {
+                        } else if (jk == HealthStatusValue.LH.getCode() || jk == HealthStatusValue.ZY.getCode()) {
                             lsl++;
                         } else {
 
@@ -745,27 +748,27 @@ public class HealthMainService {
 
                     wtidls.add(wt.getId());
                     codejkls.add(Constant.FJJKZT);
-                    codeztls.add(Constant.FJZT);
+                    codeztls.add(Constant.ZTMX);
 
                 }
 
-                String[] jkpoints = new String[wtidls.size()];
-                String[] ztpoints = new String[wtidls.size()];
+                List<String> jkpoints = new ArrayList<>();
+                List<String> ztpoints = new ArrayList<>();
 
                 // 获得训练参数对象
                 for (int x = 0; x < wtidls.size(); x++) {
 
                     ProBasicEquipmentPoint ai1 = proBasicEquipmentPointService.getEquipmentPoint(wtidls.get(x), codejkls.get(x));
-                    jkpoints[x] = ai1.getNemCode();
+                    jkpoints.add(ai1.getNemCode());
                     ProBasicEquipmentPoint ai2 = proBasicEquipmentPointService.getEquipmentPoint(wtidls.get(x), codeztls.get(x));
-                    ztpoints[x] = ai2.getNemCode();
+                    ztpoints.add(ai2.getNemCode());
 
                 }
 
                 // 获得风机健康状态结果数组
-                DNAVal[] jkvalues = realApiUtil.getRealtimeTagValues(jkpoints);
+                List<PointData> jkvalues = realApiUtil.getRealData(jkpoints);
                 // 获得风机实时状态结果数组
-                DNAVal[] ztvalues = realApiUtil.getRealtimeTagValues(ztpoints);
+                List<PointData> ztvalues = realApiUtil.getRealData(ztpoints);
 
 
                 Calendar cal2 = Calendar.getInstance();
@@ -774,11 +777,11 @@ public class HealthMainService {
                 Date begin = cal2.getTime();
                 for (int x = 0; x < wtidls.size(); x++) {
                     String wtId = wtidls.get(x);
-                    double jk = jkvalues[x].DValue;
-                    double zt = ztvalues[x].DValue;
+                    double jk = jkvalues.get(x).getPointValueInDouble();
+                    double zt = ztvalues.get(x).getPointValueInDouble();
 
 
-                    if (zt == 2.0) {
+                    if (zt == StatusDetailValue.GZ.getCode()) {
 
                         List<ShutdowneventVo> svos = proEconShutdownEventService.queryEvents(null, wtId, begin, end, null);
 
@@ -822,12 +825,12 @@ public class HealthMainService {
                         csl++;
                     } else {
                         String[] str = new String[3];
-                        if (jk == 1) {
+                        if (jk == HealthStatusValue.ZC.getCode()) {
                             str[0] = wtId;
                             str[1] = "1";
                             wtIdls.add(str);
                             ysl++;
-                        } else if (jk == 2 || jk == 3) {
+                        } else if (jk == HealthStatusValue.LH.getCode() || jk == HealthStatusValue.ZY.getCode()) {
                             str[0] = wtId;
                             str[1] = "2";
                             wtIdls.add(str);
@@ -846,16 +849,16 @@ public class HealthMainService {
 
                             }
                         }
-                        if (jk == 1) {
+                        if (jk == HealthStatusValue.ZC.getCode()) {
 
                             sl1++;
-                        } else if (jk == 2) {
+                        } else if (jk == HealthStatusValue.LH.getCode()) {
 
                             sl2++;
-                        } else if (jk == 3) {
+                        } else if (jk == HealthStatusValue.ZY.getCode()) {
 
                             sl3++;
-                        } else if (jk == 4) {
+                        } else if (jk == HealthStatusValue.YZ.getCode()) {
 
                             sl4++;
                         } else {
@@ -880,14 +883,14 @@ public class HealthMainService {
                 map.put("csl", csl);
                 map.put("lsl", lsl);
                 map.put("ysl", ysl);
-                map.put("ycdl15minute", ycdl15minute);
-                map.put("ycdl1hour", ycdl1hour);
-                map.put("ycdl1day", ycdl1day);
-                map.put("ycdl1month", ycdl1month);
+                map.put("ycdl15minute", StringUtils.round(ycdl15minute, GyeeConfig.getDigit()));
+                map.put("ycdl1hour", StringUtils.round(ycdl1hour, GyeeConfig.getDigit()));
+                map.put("ycdl1day", StringUtils.round(ycdl1day, GyeeConfig.getDigit()));
+                map.put("ycdl1month", StringUtils.round(ycdl1month, GyeeConfig.getDigit()));
                 map.put("rfdl", rfdl);
                 map.put("yfdl", yfdl);
-                map.put("yczqlday", yczqlday);
-                map.put("yczqlmonth", yczqlmonth);
+                map.put("yczqlday", StringUtils.round(yczqlday, GyeeConfig.getDigit()));
+                map.put("yczqlmonth", StringUtils.round(yczqlmonth, GyeeConfig.getDigit()));
                 map.put("wtIdls", wtIdls);
                 gzls.sort((o1, o2) -> {
                     String stopTime1 = o1.get("stopTime");//name1是从你list里面拿出来的一个

+ 375 - 0
web/health/src/main/java/com/gyee/frame/service/health/HealthOperationService.java

@@ -0,0 +1,375 @@
+package com.gyee.frame.service.health;
+
+import com.gyee.common.model.PointData;
+import com.gyee.frame.common.spring.Constant;
+import com.gyee.frame.common.spring.InitialRunner;
+import com.gyee.frame.model.auto.ProBasicPowerstation;
+import com.gyee.frame.model.auto.ProBasicPowerstationPoint;
+import com.gyee.frame.model.auto.ProBasicProject;
+import com.gyee.frame.service.auto.*;
+import com.gyee.frame.util.IRealTimeDataBaseUtil;
+import com.gyee.frame.util.RealTimeDataBaseFactory;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@Service
+public class HealthOperationService {
+
+    @Resource
+    private IProBasicEquipmentPointService proBasicEquipmentPointService;
+    @Resource
+    private IProEconWeatherFdService proEconWeatherFdService;
+    @Resource
+    private IProEconWeatherFhService proEconWeatherFhService;
+    @Resource
+    private IProEconShutdownEventService proEconShutdownEventService;
+    @Resource
+    private IProBasicPowerstationPointService proBasicPowerstationPointService;
+
+    private final String QS = "0";
+
+    private final int digit = 2;
+    private final double NUM = 3.6;
+    private final double XZNUM = 1.25;
+    IRealTimeDataBaseUtil realApiUtil = RealTimeDataBaseFactory.createRealTimeDataBase();
+
+    /**
+     * 获得全省各种状态数量
+     * @return
+     * @throws Exception
+     */
+    public Map<String, Integer> countWpNumStatus() throws Exception {
+
+        Map<String, Integer> mapstatus = new HashMap<String, Integer>();
+
+        List<String> idls=new ArrayList<>();
+
+        ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(QS, Constant.FJZCSL);
+        idls.add(point.getNemCode());// 合格(正常)
+        point = proBasicPowerstationPointService.getPowerstationPoint(QS, Constant.FJLHSL);
+        idls.add(point.getNemCode());// 良好
+        point = proBasicPowerstationPointService.getPowerstationPoint(QS, Constant.FJZYSL);
+        idls.add(point.getNemCode());// 注意
+        point = proBasicPowerstationPointService.getPowerstationPoint(QS, Constant.FJYZSL);
+        idls.add(point.getNemCode());// 严重
+
+
+        List<PointData> pols=realApiUtil.getRealData(idls);
+
+        if(!pols.isEmpty() && pols.size()==idls.size())
+        {
+            Integer zc = ((Double) pols.get(0).getPointValueInDouble()).intValue();
+            Integer lh = ((Double) pols.get(1).getPointValueInDouble()).intValue();
+            Integer zy = ((Double) pols.get(2).getPointValueInDouble()).intValue();
+            Integer yz = ((Double) pols.get(3).getPointValueInDouble()).intValue();
+
+            mapstatus.put("zc", zc);
+            mapstatus.put("lh", lh);
+            mapstatus.put("zy", zy);
+            mapstatus.put("yz", yz);
+        }
+
+
+        return mapstatus;
+    }
+
+    /**
+     * 健康状态占比图表
+     * @param type
+     * @return
+     * @throws Exception
+     */
+    public Map<String, Object> countWpOrProStatus(String type) throws Exception {
+
+        Map<String, Object> mapstatus = new HashMap<String, Object>();
+
+
+        List<Integer> hgList = new ArrayList<Integer>();
+        List<Integer> lhList = new ArrayList<Integer>();
+        List<Integer> zyList = new ArrayList<Integer>();
+        List<Integer> yzList = new ArrayList<Integer>();
+        List<String> name = new ArrayList<String>();
+        if ("1".equals(type)) {
+            List<ProBasicPowerstation> wpList = InitialRunner.wpls;
+            for (int i = 0; i < wpList.size(); i++) {
+
+                    List<String> idls=new ArrayList<>();
+
+                    ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), Constant.FJZCSL);
+                    idls.add(point.getNemCode());// 合格(正常)
+               // System.out.println("测点编号" +point.getNemCode());
+                    point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), Constant.FJLHSL);
+                    idls.add(point.getNemCode());// 良好
+               // System.out.println("测点编号" +point.getNemCode());
+                    point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), Constant.FJZYSL);
+                    idls.add(point.getNemCode());// 注意
+               // System.out.println("测点编号" +point.getNemCode());
+                    point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), Constant.FJYZSL);
+                    idls.add(point.getNemCode());// 严重
+
+                //System.out.println("测点编号" +point.getNemCode());
+                    List<PointData> pols=realApiUtil.getRealData(idls);
+
+                    if(!pols.isEmpty() && pols.size()==idls.size())
+                    {
+                     //   System.out.println("取实时数据");
+                        Integer zc = ((Double) pols.get(0).getPointValueInDouble()).intValue();
+                    //    System.out.println("ZC---"+zc);
+                        Integer lh = ((Double) pols.get(1).getPointValueInDouble()).intValue();
+                     //   System.out.println("lh---"+lh);
+                        Integer zy = ((Double) pols.get(2).getPointValueInDouble()).intValue();
+                       // System.out.println("zy---"+zy);
+                        Integer yz = ((Double) pols.get(3).getPointValueInDouble()).intValue();
+                      //  System.out.println("yz---"+yz);
+
+                        hgList.add(zc);
+                        lhList.add(lh);
+                        zyList.add(zy);
+                        yzList.add(yz);
+
+                    }
+
+                    name.add(wpList.get(i).getName());
+                }
+
+            mapstatus.put("hgList", hgList);
+            mapstatus.put("lhList", lhList);
+            mapstatus.put("zyList", zyList);
+            mapstatus.put("yzList", yzList);
+            mapstatus.put("name", name);
+
+        } else if ("2".equals(type)) {
+            List<ProBasicProject> pList = InitialRunner.pjls;
+            for (int i = 0; i < pList.size(); i++) {
+
+                    List<String> idls=new ArrayList<>();
+
+                    ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), Constant.FJZCSL);
+                    idls.add(point.getNemCode());// 合格(正常)
+                    point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), Constant.FJLHSL);
+                    idls.add(point.getNemCode());// 良好
+                    point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), Constant.FJZYSL);
+                    idls.add(point.getNemCode());// 注意
+                    point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), Constant.FJYZSL);
+                    idls.add(point.getNemCode());// 严重
+
+                    List<PointData> pols=realApiUtil.getRealData(idls);
+
+                    if(!pols.isEmpty() && pols.size()==idls.size())
+                    {
+                        Integer zc = ((Double) pols.get(0).getPointValueInDouble()).intValue();
+                        Integer lh = ((Double) pols.get(1).getPointValueInDouble()).intValue();
+                        Integer zy = ((Double) pols.get(2).getPointValueInDouble()).intValue();
+                        Integer yz = ((Double) pols.get(3).getPointValueInDouble()).intValue();
+
+                        hgList.add(zc);
+                        lhList.add(lh);
+                        zyList.add(zy);
+                        yzList.add(yz);
+
+                    }
+                    name.add(pList.get(i).getName());
+                }
+
+            mapstatus.put("hgList", hgList);
+            mapstatus.put("lhList", lhList);
+            mapstatus.put("zyList", zyList);
+            mapstatus.put("yzList", yzList);
+            mapstatus.put("name", name);
+        }
+
+        return mapstatus;
+    }
+
+
+    public Map<String, Object> findWpOrProStatusForHistory(String type, String status) throws Exception {
+        Map<String, Object> mapstatus = new HashMap<String, Object>();
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+        List<Integer> lhList = new ArrayList<Integer>();
+        List<Integer> zyList = new ArrayList<Integer>();
+        List<Integer> yzList = new ArrayList<Integer>();
+        Calendar cl = Calendar.getInstance();
+        cl.set(Calendar.HOUR_OF_DAY, 0);
+        cl.set(Calendar.MINUTE, 0);
+        cl.set(Calendar.SECOND, 0);
+        Long start = cl.getTimeInMillis();
+        Long end = new Date().getTime();
+        List<Map<String,String>> nameList = new ArrayList<Map<String,String>>();
+        if ("1".equals(type)) {
+            List<ProBasicPowerstation> wpList = InitialRunner.wpls;
+            Map<String,String> map=new HashMap<>();
+            for (int i = 0; i < wpList.size(); i++) {
+                List<Integer> hgList = new ArrayList<Integer>();
+                List<String> tList = new ArrayList<String>();
+
+                if ("1".equals(status)) {
+                    ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), Constant.FJZCSL);
+                    String hgCode = point.getNemCode();// 合格(正常)
+                    point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), Constant.FJLHSL);
+                    String lhCode = point.getNemCode();// 良好
+                    List<PointData> phgList = realApiUtil.getHistoryDatasSnap(hgCode, start / 1000, end / 1000, 1L,
+                            15 * 60L);
+                    List<PointData> plhList = realApiUtil.getHistoryDatasSnap(lhCode, start / 1000, end / 1000, 1L,
+                            15 * 60L);
+
+                    if (!phgList.isEmpty() && !plhList.isEmpty() && phgList.size() >= plhList.size()) {
+                        for (int ii = 0; ii < phgList.size(); ii++) {
+                            if (plhList.get(ii) == null) {
+                                Integer total = ((Double) phgList.get(ii).getPointValueInDouble()).intValue();
+                                String time = sdf.format(new Date(phgList.get(ii).getPointTime() * 1000));
+                                time = time.substring(time.length() - 5);
+                                hgList.add(total);
+                                tList.add(time);
+                            } else {
+                                Integer total = ((Double) phgList.get(ii).getPointValueInDouble()).intValue()
+                                        + ((Double) plhList.get(ii).getPointValueInDouble()).intValue();
+                                String time = sdf.format(new Date(phgList.get(ii).getPointTime() * 1000));
+                                time = time.substring(time.length() - 5);
+                                hgList.add(total);
+                                tList.add(time);
+                            }
+
+
+                        }
+
+                        mapstatus.put(wpList.get(i).getId(), hgList);
+                        mapstatus.put("time", tList);
+
+                    }
+
+                } else {
+
+                    ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), Constant.FJZYSL);
+                    String zyCode = point.getNemCode();// 注意
+                    point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), Constant.FJYZSL);
+                    String yzCode = point.getNemCode();// 严重
+                    List<PointData> pzyList = realApiUtil.getHistoryDatasSnap(zyCode, start / 1000, end / 1000, 0L,
+                            15 * 60L);
+                    List<PointData> pyzList = realApiUtil.getHistoryDatasSnap(yzCode, start / 1000, end / 1000, 0L,
+                            15 * 60L);
+
+                    if (!pzyList.isEmpty() && !pyzList.isEmpty() && pzyList.size() >= pyzList.size()) {
+                        for (int ii = 0; ii < pzyList.size(); ii++) {
+                            if (pyzList.get(ii) == null) {
+                                Integer total = ((Double) pzyList.get(ii).getPointValueInDouble()).intValue();
+                                String time = sdf.format(new Date(pzyList.get(ii).getPointTime() * 1000));
+                                time = time.substring(time.length() - 5);
+                                hgList.add(total);
+                                tList.add(time);
+                            } else {
+                                Integer total = ((Double) pzyList.get(ii).getPointValueInDouble()).intValue()
+                                        + ((Double) pyzList.get(ii).getPointValueInDouble()).intValue();
+                                String time = sdf.format(new Date(pzyList.get(ii).getPointTime() * 1000));
+                                time = time.substring(time.length() - 5);
+                                hgList.add(total);
+                                tList.add(time);
+                            }
+
+                            mapstatus.put(wpList.get(i).getId(), hgList);
+                            mapstatus.put("time", tList);
+
+                        }
+                    }
+
+                }
+                map.put(wpList.get(i).getId(),wpList.get(i).getName());
+
+
+            }
+            nameList.add(map);
+            mapstatus.put("name", nameList);
+
+        } else if ("2".equals(type)) {
+            List<ProBasicProject> pList = InitialRunner.pjls;
+            Map<String,String> map=new HashMap<>();
+            for (int i = 0; i < pList.size(); i++) {
+                List<Integer> hgList = new ArrayList<Integer>();
+                List<String> tList = new ArrayList<String>();
+
+
+                    if ("1".equals(status)) {
+                        ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), Constant.FJZCSL);
+                        String hgCode = point.getNemCode();// 合格(正常)
+                        point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), Constant.FJLHSL);
+                        String lhCode = point.getNemCode();// 良好
+                        List<PointData> phgList = realApiUtil.getHistoryDatasSnap(hgCode, start / 1000, end / 1000, 0L,
+                                15 * 60L);
+                        List<PointData> plhList = realApiUtil.getHistoryDatasSnap(lhCode, start / 1000, end / 1000, 0L,
+                                15 * 60L);
+
+                        if (!phgList.isEmpty() && !plhList.isEmpty() && phgList.size() >= plhList.size()) {
+                            for (int ii = 0; ii < phgList.size(); ii++) {
+                                if (plhList.get(ii) == null) {
+                                    Integer total = ((Double) phgList.get(ii).getPointValueInDouble()).intValue();
+                                    String time = sdf.format(new Date(phgList.get(ii).getPointTime() * 1000));
+                                    time = time.substring(time.length() - 5);
+                                    hgList.add(total);
+                                    tList.add(time);
+                                } else {
+                                    Integer total = ((Double) phgList.get(ii).getPointValueInDouble()).intValue()
+                                            + ((Double) plhList.get(ii).getPointValueInDouble()).intValue();
+                                    String time = sdf.format(new Date(phgList.get(ii).getPointTime() * 1000));
+                                    time = time.substring(time.length() - 5);
+                                    hgList.add(total);
+                                    tList.add(time);
+                                }
+
+                            }
+
+                            mapstatus.put(pList.get(i).getNemCode(), hgList);
+                            mapstatus.put("time", tList);
+
+                        }
+
+                    } else {
+                        ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), Constant.FJZYSL);
+                        String zyCode = point.getNemCode();// 注意
+                        point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), Constant.FJYZSL);
+                        String yzCode = point.getNemCode();// 严重
+                        List<PointData> pzyList = realApiUtil.getHistoryDatasSnap(zyCode, start / 1000, end / 1000, 0L,
+                                15 * 60L);
+                        List<PointData> pyzList = realApiUtil.getHistoryDatasSnap(yzCode, start / 1000, end / 1000, 0L,
+                                15 * 60L);
+
+                        if (!pzyList.isEmpty() && !pyzList.isEmpty() && pzyList.size() >= pyzList.size()) {
+                            for (int ii = 0; ii < pzyList.size(); ii++) {
+                                if (pyzList.get(ii) == null) {
+                                    Integer total = ((Double) pzyList.get(ii).getPointValueInDouble()).intValue();
+                                    String time = sdf.format(new Date(pzyList.get(ii).getPointTime() * 1000));
+                                    time = time.substring(time.length() - 5);
+                                    hgList.add(total);
+                                    tList.add(time);
+                                } else {
+                                    Integer total = ((Double) pzyList.get(ii).getPointValueInDouble()).intValue()
+                                            + ((Double) pyzList.get(ii).getPointValueInDouble()).intValue();
+                                    String time = sdf.format(new Date(pzyList.get(ii).getPointTime() * 1000));
+                                    time = time.substring(time.length() - 5);
+                                    hgList.add(total);
+                                    tList.add(time);
+                                }
+                            }
+
+                            mapstatus.put(pList.get(i).getNemCode(), hgList);
+                            mapstatus.put("time", tList);
+
+                        }
+
+                    }
+
+
+                map.put(pList.get(i).getId(),pList.get(i).getName());
+
+
+            }
+            nameList.add(map);
+            mapstatus.put("name", nameList);
+        }
+        return mapstatus;
+    }
+
+
+}

+ 369 - 0
web/health/src/main/java/com/gyee/frame/service/recommen/RecommenService.java

@@ -0,0 +1,369 @@
+package com.gyee.frame.service.recommen;
+
+import com.gyee.common.model.PointData;
+import com.gyee.frame.common.spring.Constant;
+import com.gyee.frame.common.spring.InitialRunner;
+import com.gyee.frame.model.auto.ProBasicEquipment;
+import com.gyee.frame.model.auto.ProBasicEquipmentPoint;
+import com.gyee.frame.model.auto.ProEconRecommenMain;
+import com.gyee.frame.model.vo.HealthStatusValue;
+import com.gyee.frame.service.auto.IProBasicEquipmentPointService;
+import com.gyee.frame.service.auto.IProEconRecommenMainService;
+import com.gyee.frame.util.IRealTimeDataBaseUtil;
+import com.gyee.frame.util.RealTimeDataBaseFactory;
+import com.gyee.frame.util.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * RecommenService
+ * @Title: RecommenService.java
+ * @Package com.gyee.frame.service
+ * @author gyee_自动生成
+ * @email 1@qq.com
+ * @date 2019-12-31 14:58:09
+ **/
+@Service
+public class RecommenService {
+
+	private final String XQQR = "是";
+	@Resource
+	private IProEconRecommenMainService proEconRecommenMainService;
+	@Resource
+	private IProBasicEquipmentPointService proBasicEquipmentPointService;
+	
+
+	private final String QS = "0";
+	private final String FD = "-1";
+	private final String GF = "-2";
+
+	IRealTimeDataBaseUtil realApiUtil = RealTimeDataBaseFactory.createRealTimeDataBase();
+
+	private long INTERVAL=600;
+
+	/**
+	 * 获得当日健康推荐检修风机
+	 * @return
+	 */
+	public List<ProEconRecommenMain> getRecommenmainDay1() {
+
+		List<ProEconRecommenMain> list=new ArrayList<>();
+
+		Calendar cal = Calendar.getInstance();
+		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.DAY_OF_MONTH, 1);
+		Date endDate = cal.getTime();
+
+		list=proEconRecommenMainService.getRecommenmainListByStatus("0",beginDate,endDate);
+
+		return list;
+	}
+
+	/**
+	 * 获得3日健康推荐检修风机
+	 * @return
+	 */
+	public List<ProEconRecommenMain> getRecommenmainDay3() {
+
+		List<ProEconRecommenMain> list=new ArrayList<>();
+
+		Calendar cal = Calendar.getInstance();
+		cal.set(Calendar.HOUR_OF_DAY, 0);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND,0);
+		cal.set(Calendar.MILLISECOND, 0);
+		cal.add(Calendar.DAY_OF_MONTH, 1);
+		Date beginDate = cal.getTime();
+		cal.add(Calendar.DAY_OF_MONTH, 2);
+		Date endDate = cal.getTime();
+
+		list=proEconRecommenMainService.getRecommenmainListByStatus("0",beginDate,endDate);
+
+		return list;
+	}
+
+	/**
+	 * 获得7日健康推荐检修风机
+	 * @return
+	 */
+	public List<ProEconRecommenMain> getRecommenmainDay7() {
+
+		List<ProEconRecommenMain> list=new ArrayList<>();
+
+		Calendar cal = Calendar.getInstance();
+		cal.set(Calendar.HOUR_OF_DAY, 0);
+		cal.set(Calendar.MINUTE, 0);
+		cal.set(Calendar.SECOND,0);
+		cal.set(Calendar.MILLISECOND, 0);
+
+		cal.add(Calendar.DAY_OF_MONTH, 3);
+		Date beginDate = cal.getTime();
+		cal.add(Calendar.DAY_OF_MONTH, 7);
+		Date endDate = cal.getTime();
+
+		list=proEconRecommenMainService.getRecommenmainListByStatus("0",beginDate,endDate);
+
+		return list;
+	}
+
+	/**
+	 * 确认推荐检修风机,并添加记录到生产系统
+	 * @param rid
+	 */
+	public int confirpush(String rid)
+	{
+		int result=0;
+		if(StringUtils.notEmp(rid))
+		{
+			ProEconRecommenMain po=proEconRecommenMainService.getRecommenmain(rid);
+			if(StringUtils.notEmp(po) && StringUtils.notEmp(po.getCreateDate()))
+			{
+
+				po.setIsmain(1);
+				proEconRecommenMainService.saveOrUpdate(po);
+
+
+			}
+		}
+		return result;
+	}
+	/**
+	 * 取消推荐检修风机
+	 * @param rid
+	 */
+	public int ignorepush(String rid)
+	{
+		int result=0;
+		if(StringUtils.notEmp(rid))
+		{
+			ProEconRecommenMain po=proEconRecommenMainService.getRecommenmain(rid);
+			if(StringUtils.notEmp(po) && StringUtils.notEmp(po.getCreateDate()))
+			{
+				po.setIsmain(2);
+
+				boolean status=proEconRecommenMainService.saveOrUpdate(po);
+				if(status)
+				{
+					result=1;
+				}
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * 获得确认检修风机
+	 * @return
+	 */
+	public List<ProEconRecommenMain> recommenConfirmedList() {
+
+		List<ProEconRecommenMain> list=new ArrayList<>();
+
+		Calendar cal = Calendar.getInstance();
+		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.DAY_OF_MONTH, 7);
+		Date endDate = cal.getTime();
+
+		list=proEconRecommenMainService.getRecommenmainListByStatus("1",beginDate,endDate);
+
+		return list;
+	}
+
+	/**
+	 * 获得健康状态预测
+	 * @param wpId
+	 * @param type 1 表示24小时健康趋势,2 表示七天健康趋势 3 表示30天健康趋势,
+	 * @return
+	 * @throws Exception
+	 */
+	public Map<String, Object[]> findAllChartjz(String wpId,  String type) throws Exception {
+
+		Map<String, Object[]> map = new HashMap<String, Object[]>();
+
+		if (StringUtils.notEmp(wpId) &&  StringUtils.notEmp(type)) {
+
+			int num=0;
+			String format1 = "yyyy-MM-dd HH点";
+			String format2 = "yyyy-MM-dd";
+			String format3 = "MM-dd";
+
+			SimpleDateFormat df1 = new SimpleDateFormat(format1);
+			SimpleDateFormat df2 = new SimpleDateFormat(format2);
+			SimpleDateFormat df3 = new SimpleDateFormat(format3);
+
+			Calendar cal = Calendar.getInstance();
+
+			String uniformcode = Constant.YCFJJKZT1DAY;
+			switch (type) {
+				case "1":
+					cal.add(Calendar.HOUR_OF_DAY, 2);
+					cal.set(Calendar.MINUTE, 0);
+					cal.set(Calendar.SECOND, 0);
+
+					uniformcode = Constant.YCFJJKZT1DAY;
+
+					num=12;
+					break;
+				case "2":
+					cal.add(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);
+					//  uniformcode = Constant.YCFJJKZT7DAY;
+					uniformcode = Constant.YCFJJKZT1MONTH;
+					num=7;
+					break;
+
+				case "3":
+					cal.add(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);
+					uniformcode = Constant.YCFJJKZT1MONTH;
+					num=30;
+					break;
+				default:
+					break;
+			}
+
+			int ysl = 0;// 优数量
+			int lsl = 0;// 良数量
+			int csl = 0;// 差数量
+			double jkd = 0.0;
+
+			Double[] yslchart = new Double[num];
+			Double[] lslchart = new Double[num];
+			Double[] cslchart = new Double[num];
+			Double[] lvchart = new Double[num];
+
+			String[] datechart = new String[num];
+			List<ProBasicEquipment> wtls = new ArrayList<ProBasicEquipment>();
+
+			if (wpId.equals(QS) || wpId.equals(FD) || wpId.equals(GF)) {
+				for (ProBasicEquipment wt : InitialRunner.wtls) {
+					wtls.add(wt);
+				}
+			}else if (InitialRunner.wpmap.containsKey(wpId)) {
+				wtls = InitialRunner.wpwtmap.get(wpId);
+			} else if (InitialRunner.pjmap.containsKey(wpId))  {
+				wtls = InitialRunner.pjwtmap.get(wpId);
+			} else if (InitialRunner.lnmap.containsKey(wpId))  {
+				wtls = InitialRunner.lnwtmap.get(wpId);
+			} else if (InitialRunner.wtmap.containsKey(wpId))  {
+				wtls.add(InitialRunner.wtmap.get(wpId)) ;
+			}
+
+			List<String> wtidls = new ArrayList<String>();
+			List<String> codejkls = new ArrayList<String>();
+			List<String> codeztls = new ArrayList<String>();
+
+			for (ProBasicEquipment wt : wtls) {
+				wtidls.add(wt.getId());
+				codejkls.add(uniformcode);
+
+			}
+
+			List<String> jkpoints = new ArrayList<>();
+
+			// 获得训练参数对象
+			for (int x = 0; x < wtidls.size(); x++) {
+
+				ProBasicEquipmentPoint ai = proBasicEquipmentPointService.getEquipmentPoint(wtidls.get(x), codejkls.get(x));
+				if(StringUtils.notEmp(ai))
+				{
+					jkpoints.add(ai.getNemCode());
+				}
+
+			}
+
+			for (int i = 0; i < num; i++) {
+				ysl = 0;// 优数量
+				lsl = 0;// 良数量
+				csl = 0;// 差数量
+				jkd = 0.0;
+
+
+
+				int recodeDate = new BigDecimal(cal.getTime().getTime()).divide(new BigDecimal(1000), 0, RoundingMode.DOWN).intValue();
+
+				// 获得风机健康状态结果数组
+				List<PointData> jkvalues = realApiUtil.getHistMatrix(jkpoints, recodeDate);
+
+				for (int x = 0; x < wtidls.size(); x++) {
+
+					double jk = jkvalues.get(x).getPointValueInDouble();
+
+					if (jk == HealthStatusValue.YZ.getCode()) {
+
+						csl++;
+					} else if (jk == HealthStatusValue.ZY.getCode()) {
+
+						lsl++;
+					} else if (jk == HealthStatusValue.ZC.getCode() || jk == HealthStatusValue.LH.getCode()) {
+
+						ysl++;
+					} else {
+
+						ysl++;
+					}
+				}
+				jkd = new BigDecimal(ysl + lsl).divide(new BigDecimal(wtidls.size()), 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(100)).doubleValue();
+
+				yslchart[i] = Double.valueOf(ysl);
+				lslchart[i] = Double.valueOf(lsl);
+				cslchart[i] = Double.valueOf(csl);
+				lvchart[i] = Double.valueOf(jkd);
+
+				switch (type) {
+					case "1":
+						datechart[i] = df1.format(cal.getTime());
+						cal.add(Calendar.HOUR_OF_DAY, 2);
+
+						break;
+					case "2":
+						datechart[i] = df2.format(cal.getTime());
+						cal.add(Calendar.DAY_OF_MONTH, 1);
+						break;
+					case "3":
+						datechart[i] = df3.format(cal.getTime());
+						cal.add(Calendar.DAY_OF_MONTH, 1);
+						break;
+					default:
+						break;
+				}
+
+			}
+
+			map.put("yslchart", yslchart);
+			map.put("lslchart", lslchart);
+			map.put("cslchart", cslchart);
+			map.put("lvchart", lvchart);
+			map.put("datechart", datechart);
+
+		}
+
+		return map;
+
+	}
+
+
+
+	
+}