Procházet zdrojové kódy

国电山西风机运行分析

xieshengjie před 2 roky
rodič
revize
0ab6d2cbef

+ 8 - 0
web/gdsx-ghost/src/main/java/com/gyee/ghost/init/CacheContext.java

@@ -4,6 +4,7 @@ package com.gyee.ghost.init;
 
 import com.gyee.ghost.model.auto.Windpowerstation;
 import com.gyee.ghost.model.auto.Windturbine;
+import com.gyee.ghost.service.auto.GhostService;
 import com.gyee.ghost.service.auto.IWindpowerstationService;
 import com.gyee.ghost.service.auto.IWindturbineService;
 import org.slf4j.Logger;
@@ -27,6 +28,9 @@ import java.util.Map;
 @Component
 public class CacheContext implements CommandLineRunner {
     Logger logger = LoggerFactory.getLogger(CacheContext.class);
+
+    @Resource
+    private GhostService ghostService;
     @Resource
     private IWindturbineService windturbineService;
     @Resource
@@ -46,5 +50,9 @@ public class CacheContext implements CommandLineRunner {
         });
 
         wpls = windpowerstationService.list();
+
+
+
+        ghostService.saveFanoperation("2022-08-01","2022-08-02");
     }
 }

+ 7 - 5
web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/GhostService.java

@@ -8,6 +8,7 @@ import com.gyee.common.model.StringUtils;
 import com.gyee.common.util.CommonUtils;
 import com.gyee.common.util.DateUtils;
 import com.gyee.common.util.DoubleUtils;
+import com.gyee.common.util.SortUtils;
 import com.gyee.ghost.init.CacheContext;
 import com.gyee.ghost.model.auto.Fanoperation;
 import com.gyee.ghost.model.auto.Windturbine;
@@ -20,7 +21,6 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Optional;
-import java.util.stream.Collectors;
 
 @Service
 public class GhostService {
@@ -86,8 +86,6 @@ public class GhostService {
                 fanoperation.setRecorddate(date);
                 fanoperation.setStormtime(0.0);
 
-
-
                 resultList.add(fanoperation);
             });
 
@@ -115,6 +113,7 @@ public class GhostService {
         qw.groupBy("windturbineid,windturbinename");
         List<Fanoperation> list = fanoperationService.list(qw);
         resultList.addAll(list);
+        SortUtils.sort(resultList,"windturbineid",SortUtils.ASC);
 
         qw.clear();
         qw.select("sum(generatingcapacity) generatingcapacity,sum(theoreticalcapacity) theoreticalcapacity,sum(daynhgzssdl) daynhgzssdl,sum(daynhwhssdl) daynhwhssdl,sum(daynhxdssdl) daynhxdssdl,sum(daynhqfdl) daynhqfdl,sum(daynhcfdl) daynhcfdl,avg(availability) availability,avg(powerfactor) powerfactor,sum(runtime) runtime,sum(maintime) maintime,sum(faulttime) faulttime,sum(stoptime) stoptime,sum(stormtime) stormtime,sum(offtime) offtime");
@@ -123,8 +122,11 @@ public class GhostService {
             qw.eq("windpowerstationid",wpid);
         }
         List<Fanoperation> hjlist = fanoperationService.list(qw);
-        if (StringUtils.isNotEmpty(hjlist)){
-            resultList.add(hjlist.get(0));
+        if (StringUtils.isNotNull(hjlist)){
+            Fanoperation fanoperation = hjlist.get(0);
+            fanoperation.setWindpowerstationid("合计");
+            fanoperation.setWindturbinename("合计");
+            resultList.add(fanoperation);
         }
         return resultList;
     }

+ 33 - 34
web/gdsx-ghost/src/main/resources/application-dev.yml

@@ -19,49 +19,48 @@ spring:
 #      username: nacos
 #      password: nacos
   #redis集群
-#  redis:
-##    host: 10.83.68.94
-#    host: 192.168.2.202
-#    port: 6379
-#    timeout: 100000
-#    #    集群环境打开下面注释,单机不需要打开
-#    #    cluster:
-#    #      集群信息
-#    #      nodes: xxx.xxx.xxx.xxx:xxxx,xxx.xxx.xxx.xxx:xxxx,xxx.xxx.xxx.xxx:xxxx
-#    #      #默认值是5 一般当此值设置过大时,容易报:Too many Cluster redirections
-#    #      maxRedirects: 3
-#    password:
-#    application:
-#      name: test
-#    jedis:
-#      pool:
-#        max-active: 8
-#        min-idle: 0
-#        max-idle: 8
-#        max-wait: -1
-#    database: 1
+  redis:
+#    host: 10.83.68.94
+    host: 11.0.118.57
+    port: 6379
+    timeout: 100000
+    #    集群环境打开下面注释,单机不需要打开
+    #    cluster:
+    #      集群信息
+    #      nodes: xxx.xxx.xxx.xxx:xxxx,xxx.xxx.xxx.xxx:xxxx,xxx.xxx.xxx.xxx:xxxx
+    #      #默认值是5 一般当此值设置过大时,容易报:Too many Cluster redirections
+    #      maxRedirects: 3
+    password:
+    application:
+      name: test
+    jedis:
+      pool:
+        max-active: 8
+        min-idle: 0
+        max-idle: 8
+        max-wait: -1
+    database: 1
   autoconfigure:
     exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource
-#    driver-class-name: oracle.jdbc.OracleDriver
-    #外网
-#    url: jdbc:oracle:thin:@10.83.68.165:1521:gdsj
-#    url: jdbc:oracle:thin:@192.168.2.215:1521:gdsj
-#    username: gdprod
-#    password: gd123
-#    oracle-schema=:
+    driver-class-name: oracle.jdbc.OracleDriver
+    外网
+    url: jdbc:oracle:thin:@11.0.118.57:1521:gdsj
+    username: gdprod
+    password: gd123
+    oracle-schema=:
 
 #    url: jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8&serverTimezone=UTC
 #    username: root
 #    password: root
 #    driver-class-name: com.mysql.jdbc.Driver
 
-    driver-class-name: org.postgresql.Driver
-    url: jdbc:postgresql://10.81.3.151:5432/wisdom
-    username: gdprod
-    password: gd123
-    oracle-schema=:
+#    driver-class-name: org.postgresql.Driver
+#    url: jdbc:postgresql://10.81.3.151:5432/wisdom
+#    username: gdprod
+#    password: gd123
+#    oracle-schema=:
 
     druid:
       max-active: 20
@@ -104,6 +103,6 @@ logging:
     com.example: debug
 #db url
 db:
-  url: http://10.81.3.152:8011/ts
+  url: http://11.0.118.58:8011/ts
 
 

+ 107 - 3
web/gdsx-ghost/src/main/resources/application.yml

@@ -1,4 +1,108 @@
+server:
+  port: 8082
+  servlet:
+    context-path: /
+
+
 spring:
-  profiles:
-#    active: hf
-    active: dev
+  application:
+    name:
+  main:
+    allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
+  #  cloud:
+  #    nacos:
+  #      discovery:
+  #        server-addr: 192.168.2.216:8848
+  #        #指定yaml格式的配置
+  #        file-extension: yaml
+  #        cluster-name: master
+  #      username: nacos
+  #      password: nacos
+  #redis集群
+  redis:
+    #    host: 10.83.68.94
+    host: 11.0.118.57
+    port: 6379
+    timeout: 100000
+    #    集群环境打开下面注释,单机不需要打开
+    #    cluster:
+    #      集群信息
+    #      nodes: xxx.xxx.xxx.xxx:xxxx,xxx.xxx.xxx.xxx:xxxx,xxx.xxx.xxx.xxx:xxxx
+    #      #默认值是5 一般当此值设置过大时,容易报:Too many Cluster redirections
+    #      maxRedirects: 3
+    password:
+    application:
+      name: test
+    jedis:
+      pool:
+        max-active: 8
+        min-idle: 0
+        max-idle: 8
+        max-wait: -1
+    database: 1
+  autoconfigure:
+    exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    driver-class-name: oracle.jdbc.OracleDriver
+    #外网
+    url: jdbc:oracle:thin:@11.0.118.57:1521:gdsj
+    username: gdprod
+    password: gd123
+    oracle-schema=:
+
+    #    url: jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8&serverTimezone=UTC
+    #    username: root
+    #    password: root
+    #    driver-class-name: com.mysql.jdbc.Driver
+
+#        driver-class-name: org.postgresql.Driver
+#        url: jdbc:postgresql://10.81.3.151:5432/wisdom
+#        username: gdprod
+#        password: gd123
+#        oracle-schema=:
+
+    druid:
+      max-active: 20
+      initial-size: 1
+      min-idle: 3
+      max-wait: 60000
+      time-between-eviction-runs-millis: 60000
+      min-evictable-idle-time-millis: 300000
+      test-while-idle: true
+      test-on-borrow: false
+      test-on-return: false
+  servlet:
+    multipart:
+      # 开启 multipart 上传功能
+      enabled: true
+      # 文件写入磁盘的阈值
+      file-size-threshold: 2KB
+      # 最大文件大小
+      max-file-size: 200MB
+      # 最大请求大小
+      max-request-size: 215MB
+
+mybatis-plus:
+  configuration:
+    map-underscore-to-camel-case: true
+    auto-mapping-behavior: full
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+  mapper-locations: classpath*:mapper/**/*Mapper.xml
+  global-config:
+    # 逻辑删除配置
+    db-config:
+      id-type: auto
+      # 删除前
+      logic-not-delete-value: 1
+      # 删除后
+      logic-delete-value: 0
+logging:
+  level:
+    root: info
+    com.example: debug
+#db url
+db:
+  url: http://11.0.118.58:8011/ts
+
+