Browse Source

测试TD库

xieshengjie 2 years ago
parent
commit
ad58e26973

+ 3 - 0
realtime/generation-service/src/main/java/com/gyee/generation/service/StatusService.java

@@ -41,6 +41,8 @@ public class StatusService {
     public static Map<String,List<Windturbine>> linewtmap;
     @Resource
     private IEdosUtil edosUtil;
+    @Resource
+    private IEdosUtil edosUtilTd;
     @Value("${clauStatus.ai}")
     private String clauStatusAi;
     @Value("${clauStatus.di}")
@@ -225,6 +227,7 @@ public class StatusService {
                 }
             });
         });
+//        edosUtilTd.sendMultiPoint(resultList);
         edosUtil.sendMultiPoint(resultList);
     }
 

File diff suppressed because it is too large
+ 1316 - 0
realtime/generation-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtilTd.java


+ 24 - 19
realtime/generation-service/src/main/resources/application-td.yml

@@ -1,5 +1,5 @@
 server:
-  port: 7011
+  port: 7012
   servlet:
     context-path: /
 
@@ -9,16 +9,16 @@ spring:
     allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
   #redis集群
   redis:
-    host: 10.83.68.151
+    host: 10.81.3.155
     port: 6379
     timeout: 100000
     #    集群环境打开下面注释,单机不需要打开
-    cluster:
-      #集群信息
-      nodes: 10.83.68.151:6379,10.83.68.152:6379,10.83.68.153:6379,10.83.68.154:6379,10.83.68.155:6379,10.83.68.156:6379,10.83.68.157:6379,10.83.68.158:6379,10.83.68.159:6379
-      #默认值是5 一般当此值设置过大时,容易报:Too many Cluster redirections
-      maxRedirects: 3
-    password: Dsjpt@2021
+    #    cluster:
+    #      #集群信息
+    #      nodes: 10.83.68.151:6379,10.83.68.152:6379,10.83.68.153:6379,10.83.68.154:6379,10.83.68.155:6379,10.83.68.156:6379,10.83.68.157:6379,10.83.68.158:6379,10.83.68.159:6379
+    #      #默认值是5 一般当此值设置过大时,容易报:Too many Cluster redirections
+    #      maxRedirects: 3
+    password:
     application:
       name: test
     jedis:
@@ -32,9 +32,8 @@ spring:
     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
+    driver-class-name: org.postgresql.Driver
+    url: jdbc:postgresql://10.81.3.151:5432/wisdom
     username: gdprod
     password: gd123
     oracle-schema=:
@@ -84,21 +83,27 @@ logging:
     com.example: debug
 #db url
 db:
-  url: http://10.83.68.159:8011/ts
+  url: http://10.81.3.152:8011/ts
+td:
+  url: http://localhost:8011/ts
 #参与计算的场站
-runWindpowerstation: CL_FDC,KB_FDC,DX_FDC,SY_FDC
+runWindpowerstation: YLZ_FDC
 #计算状态用ai或者di
 clauStatus:
-  ai: CL_FDC,KB_FDC,DX_FDC,SY_FDC   #配置期次
-  di:
-
+  ai: GJY03_GC,YLZ01_GC,PTZ02_GC   #配置期次
+  di: GJY01_GC,GJY02_GC,DJY01_GC,DJY02_GC,YF01_GC,YF02_GC,HSM01_GC,PTZ01_GC,ZK01_GC,NJL01_GC
 #判断数据终端
-second: 90
+second: 1800
 #判断降出力
-AI134: 17.4
-AI178: 17.4
+AI134: 17.4    #叶轮转速给定
+AI178: 17.4    #转矩给定
 #AI443:容量
 
+#计算电量直接取,如果不是1就是相减算
+typeOfElectric:
+  #直接取
+  direct: GJY02_GC,YF01_GC,YF02_GC,HSM01_GC,PTZ01_GC,ZK01_GC
+
 
 
 

+ 2 - 2
realtime/generation-service/src/main/resources/application.yml

@@ -1,4 +1,4 @@
 spring:
   profiles:
-    active: jn
-#    active: dev
+#    active: jn
+    active: td

+ 2 - 2
realtime/generation-service/src/test/java/com/gyee/generation/GenerationTest.java

@@ -49,8 +49,8 @@ public class GenerationTest {
     @Test
     public void test1() throws Exception {
 //        averageAndGeneratingService.saveAvespeedAndAvepowerAndScada();
-//        statusService.calculateStatus();
-        realtimeSpeedPowerService.calculateRealtimeSpeedPower();
+        statusService.calculateStatus();
+//        realtimeSpeedPowerService.calculateRealtimeSpeedPower();
 //        generationService.saveMeterpointValueRealtime();
 //        theorypowerService.fittingPower();
 //        theorypowerService.theropower();

+ 1 - 1
web/adapter-td-hb/src/main/java/com/gyee/adapter/common/config/OracleConfiguration.java

@@ -19,7 +19,7 @@ public class OracleConfiguration {
     @Value("${windturbine.point.table_name:view_tspoint}")
     public String tableName;
 
-    @Value("${springdatasource.url:jdbc:oracle:thin:@10.83.68.165:1521:gdsj}")
+    @Value("${spring.datasource.url:jdbc:oracle:thin:@10.83.68.165:1521:gdsj}")
     private String url;
 
     @Value("${spring.datasource.driver-class-name:oracle.jdbc.OracleDriver}")

+ 5 - 5
web/adapter-td-hb/src/main/java/com/gyee/adapter/dao/TaosHistoryDao.java

@@ -78,7 +78,7 @@ public class TaosHistoryDao implements IHistoryDao {
 
         try {
             Statement st = connect.createStatement();
-            String point = tsQuery.getTsPoint().getId();
+            String point = tsQuery.getTsPoint().getId().replace(".","_");
 
             StringBuilder sb = new StringBuilder();
             sb.append("select avg(value_double),max(value_double),min(value_double) from ").append(point);
@@ -117,7 +117,7 @@ public class TaosHistoryDao implements IHistoryDao {
             sb.append("insert into ");
             for (TsPointData obj : dataList) {
                 long time = obj.getTsData().getTs();
-                String point = obj.getTagName();
+                String point = obj.getTagName().replace(".","_");
                 double value = obj.getTsData().getDoubleValue().get();
 //                sb.append(TaosCovertUtil.coverStationPrefix(point)).append(".");
                 sb.append(point).append(" values (");
@@ -288,7 +288,7 @@ public class TaosHistoryDao implements IHistoryDao {
      * @throws WisdomException
      */
     private String getHistory(TsQuery tsQuery) throws WisdomException {
-        String point = tsQuery.getTsPoint().getId();
+        String point = tsQuery.getTsPoint().getId().replace(".","_");
         StringBuilder sb = new StringBuilder();
         if (tsQuery.getInterpolation() == Interpolation.RAW) {
             sb.append("select * from ").append(point);
@@ -323,9 +323,9 @@ public class TaosHistoryDao implements IHistoryDao {
      */
     private String getSectionSql(String tag, long ts) {
 //        String point = TaosCovertUtil.coverStationPrefix(tag) + "." + tag.replace(".", "_");
-
+        String point = tag.replace(".", "_");
         StringBuilder sb = new StringBuilder();
-        sb.append("select last_row(*) from ").append(tag);
+        sb.append("select last_row(*) from ").append(point);
         sb.append(" where point_time>='");
         sb.append(DateFormatUtils.format(ts - half_year_time, "yyyy-MM-dd HH:mm:ss:SSS") + "'");
         sb.append(" and point_time <='" + DateFormatUtils.format(ts, "yyyy-MM-dd HH:mm:ss:SSS") + "'");

+ 2 - 2
web/adapter-td-hb/src/main/java/com/gyee/adapter/dao/TaosLatestDao.java

@@ -807,11 +807,11 @@ public class TaosLatestDao implements ILatestDao {
             sb.append("insert into ");
             for (TsPointData obj : list) {
                 long time = obj.getTsData().getTs();
-                String point = obj.getTagName();
+                String point = obj.getTagName().replace(".","_");
                 double value = obj.getTsData().getDoubleValue().get();
 //                sb.append(TaosCovertUtil.coverStationPrefix(point)).append(".");
                 sb.append(point).append(" values (");
-                sb.append(time).append(",").append(value).append(")");
+                sb.append(time).append(",").append(value).append(") ");
             }
 
             flag = st.execute(sb.toString());

+ 6 - 6
web/adapter-td-hb/src/main/java/com/gyee/adapter/init/RestInsertExample.java

@@ -32,10 +32,10 @@ public class RestInsertExample {
 //        INSERT INTO d1001 VALUES (1538548685000, 10.3, 219, 0.31) (1538548695000, 12.6, 218, 0.33)
 //        d1002 VALUES (1538548696800, 12.3, 221, 0.31);
         StringBuilder sb = new StringBuilder();
-        String replace = name.replace(".", "_");
-        sb.append("INSERT INTO ").append(database).append(".").append(table).append(" USING ").append(stable);
+        String replace = table.replace(".", "_");
+        sb.append("INSERT INTO ").append(database).append(".").append(replace).append(" USING ").append(database).append(".").append(stable);
         sb.append(" TAGS (\"").append(table).append("\",\"");
-        sb.append(replace).append("\") VALUES (now, 0.0)");
+        sb.append(name).append("\") VALUES (now, 0.0)");
         return String.valueOf(sb);
     }
 
@@ -79,7 +79,7 @@ public class RestInsertExample {
             String sql = getSQL(stable, database, code,name);
             Connection connection = getConnection();
             Statement statement1 = connection.createStatement();
-            statement1.execute(sql);
+            statement1.executeUpdate(sql);
             connection.close();
             statement1.close();
         }
@@ -89,7 +89,7 @@ public class RestInsertExample {
     }
 
     public static void main(String[] args) throws SQLException {
-        createStable("wisdom","stag_double");
-//        initPoint("windpowerstationpointnew","SXJN.JSFWYLZFC","YLZFCJSFW","wisdom");
+        createStable("wisdom","JSFW");
+        initPoint("windpowerstationpointnew","JSFW","JSFW","wisdom");
     }
 }