xushili 11 months atrás
parent
commit
6f93016a89

+ 1 - 1
common/utils/build.gradle

@@ -5,6 +5,6 @@ dependencies {
     api("commons-codec:commons-codec:$commonsCodecVersion")
     api("org.apache.commons:commons-lang3:$commonsLang3Version")
     api("com.google.guava:guava:$guavaVersion")
-    api("com.alibaba:fastjson:$fastjsonVersion")
+    api("com.alibaba:fastjson:1.2.83")
     api("commons-beanutils:commons-beanutils:$commonsBeanUtilsVersion")
 }

+ 1 - 1
timeseries/dao-taoscz/build.gradle

@@ -23,7 +23,7 @@ dependencies {
     implementation project(":timeseries:dao-interface")
     implementation fileTree(dir: 'src/main/lib', include: '*.jar')
 //    implementation("$bootGroup:spring-boot-starter-log4j2")
-    implementation("com.taosdata.jdbc:taos-jdbcdriver:$taosVersion3") {
+    implementation("com.taosdata.jdbc:taos-jdbcdriver:$taosVersion2") {
         exclude group: 'com.alibaba', module: 'fastjson'
     }
 }

+ 5 - 4
timeseries/dao-taoscz/src/main/java/com/gyee/gaia/dao/taoscz/TaosHistoryDao.java

@@ -56,7 +56,7 @@ public class TaosHistoryDao implements IHistoryDao {
 
         Statement st = taosConfig.getInstance().createStatement();
         String point = tsQuery.getTsPoint().getId();
-        point = point.replaceFirst("\\.", "-");
+        point = point.replaceFirst("\\.", "__");
         StringBuilder sb = new StringBuilder();
         sb.append("select avg(val),max(val),min(val) from ");
         sb.append(taosConfig.getTableName(point));
@@ -82,7 +82,7 @@ public class TaosHistoryDao implements IHistoryDao {
         sb.append("insert into ");
         for (TsPointData obj : dataList) {
             long time = obj.getTsData().getTs();
-            String point = obj.getTagName().replaceFirst("\\.", "-");
+            String point = obj.getTagName().replaceFirst("\\.", "__");
             double value = obj.getTsData().getDoubleValue().get();
             // sb.append(TaosCovertUtil.coverStationPrefix(point)).append(".");
             sb.append(point).append(" values (");
@@ -222,7 +222,7 @@ public class TaosHistoryDao implements IHistoryDao {
      * @throws WisdomException
      */
     private String getHistory(TsQuery tsQuery) throws WisdomException {
-        String point = tsQuery.getTsPoint().getId().replaceFirst("\\.", "-");
+        String point = tsQuery.getTsPoint().getId().replaceFirst("\\.", "__");
         StringBuilder sb = new StringBuilder();
         if (tsQuery.getInterpolation() == Interpolation.RAW) {
             sb.append("select * from ");
@@ -231,7 +231,8 @@ public class TaosHistoryDao implements IHistoryDao {
             sb.append(" and ").append(tsQuery.getEndTs());
         } else if (tsQuery.getInterpolation() == Interpolation.SNAP) {
             if (tsQuery.getDateArray() != null && tsQuery.getDateArray().length > 0) {
-                sb.append("select _irowts,interp(val) from ");
+//                sb.append("select _irowts,interp(val) from ");
+                sb.append("select interp(val) from ");
                 sb.append(taosConfig.getTableName(point));
                 sb.append(" range(").append(tsQuery.getStartTs());
                 sb.append(",").append(tsQuery.getEndTs());

+ 5 - 5
timeseries/data-adapter/build.gradle

@@ -22,14 +22,14 @@ dependencies {
     implementation project(":timeseries:dao-sql")
     //compile project(":timeseries:dao-redis")
     // compile project(":timeseries:dao-simulator")
-    implementation project(":timeseries:dao-golden")
+//    implementation project(":timeseries:dao-golden")
     //compile project(":timeseries:dao-taos")
-    //implementation project(":timeseries:dao-taoscz")
+    implementation project(":timeseries:dao-taoscz")
     //implementation project(":timeseries:dao-taos")
     //implementation project(":timeseries:dao-redis-taos")
     //compile project(":timeseries:dao-hive")
     //compile project(":timeseries:dao-hadoop")
-    implementation fileTree(dir: 'src/main/lib', include: '*.jar') //// oracle连接驱动       2区使用
+//    implementation fileTree(dir: 'src/main/lib', include: '*.jar') //// oracle连接驱动       2区使用
     // implementation ("mysql:mysql-connector-java:$mysqlConnectorVersion")
     implementation("com.alibaba:druid:$alibabaDruidVersion")
     testImplementation("$bootGroup:spring-boot-starter-test")
@@ -48,8 +48,8 @@ dependencies {
     //implementation ("com.taosdata.jdbc:taos-jdbcdriver:$taosVersion")
     implementation 'org.postgresql:postgresql:42.4.0'
     implementation("org.springframework.cloud:spring-cloud-starter-bootstrap")
-    implementation("com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery")
-    implementation("com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config")
+//    implementation("com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery")
+//    implementation("com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-config")
 
 }
 

+ 157 - 0
timeseries/data-adapter/src/main/resources/application-db.yaml

@@ -0,0 +1,157 @@
+server:
+  port: 8012
+  max-http-header-size: 128KB
+
+spring:
+  application:
+    name: data-adapter
+  jpa:
+    show-sql: false
+  cache:
+    type: SIMPLE
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    driver-class-name: org.postgresql.Driver
+    url: jdbc:postgresql://172.16.12.102:5432/power_lcm
+    username: postgres
+    password: GYee@#56
+    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
+#  config:
+#    activate:
+#      on-profile: nx
+#  redis:
+#    database: 2
+#    host: 192.168.2.5
+#    password:
+#    port: 6379
+#    timeout: 60000
+#    jedis:
+#      pool:
+#        maxTotal: 20
+#        maxIdle: 20
+#        maxwait: 60000
+#        minIdle: 10
+# 此处Key不可改变
+knife4j:
+  redis:
+    # 是否采用json序列化方式,若不采用jackson序列化
+    jsonSerialType: 'Fastjson'
+    host: 114.55.105.194
+    password: wanghs123
+    port: 6379
+    databases: [ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ] # 要使用的库,会根据此处填写的库生成redisTemplate
+    timeout: 60s
+    lettuce: # lettuce基于netty,线程安全,支持并发
+      pool:
+        max-active: 50
+        max-wait: -1ms
+        max-idle: 8
+        min-idle: 0
+  cache:
+    type: Simple
+
+timeseries:
+  db-type: taoscz #"${DATABASE_TYPE:sql}" # cassandra/kairosDB/hbase/opentsDB/influxDB/TiDB
+  #db-type: hadoop #"${DATABASE_TYPE:sql}" # cassandra/kairosDB/hbase/opentsDB/influxDB/TiDB
+#golden 数据库信息
+golden:
+  #server_ip: 192.168.1.100
+  server_ip: 10.155.32.1
+  #server_ip: 172.168.1.3
+  server_port: 6327
+  user_name: sa
+  password: golden
+  pool_size: 10
+  max_pool_size: 100
+  #单次查询历史原始数据的数量上限
+  query_history_limit: 100000
+
+#hadoop数据库信息
+hadoop:
+  #查询上一个值的最多访问次数  2的8次方,增加步长为60分钟,如:t0-60,t0-120,t0-240....
+  lastValueSearch: 8
+  urlMap:
+    DJL: http://192.168.1.61:4242/api/
+    DQ: http://192.168.1.62:4242/api/
+    GF: http://192.168.1.63:4242/api/
+    GGL: http://192.168.1.64:4242/api/
+    FGL: http://192.168.1.66:4242/api/
+    FJ: http://192.168.1.69:4243/api/
+    JSFW: http://192.168.1.67:4242/api/
+    #仅限于查询NSSDQN,NXDQDI,SBQNWDQ,SBQXLDQ
+    DQ2: http://192.168.1.62:10001/api/
+
+#taos数据库
+taos:
+  server_ip: 18.6.30.71
+  #  server_ip: 192.168.1.67
+  #restful
+  server_port: 6041
+  #jni
+  #server_port: 6030
+  user_name: root
+  password: taosdata
+  pool_size: 500
+  max_pool_size: 2000
+
+#适配器链接taos数据库配置信息
+taoscz:
+  server_ip: 172.16.12.101
+  server_port: 6041
+  db_name: jsfw_db
+  user_name: root
+  password: taosdata
+  pool_size: 10
+  max_pool_size: 100
+  driver_type: com.taosdata.jdbc.rs.RestfulDriver
+  #driver_type: com.taosdata.jdbc.TSDBDriver
+  #taos中ai测点的超级表名
+  di_stable_name: pointdi
+  #taos中di测点的超级表名
+  ai_stable_name: pointci
+
+#EDOS 数据库信息
+edos:
+  server_ip: 192.168.1.100
+  server_port: 10010
+  default_connections: 1
+  incremental_connections: 1
+  max_connections: 10
+# Publish 发布服务配置
+publish:
+  rtdb_scan_interval: 1000
+  publish_interval: 5000
+
+#是否缓存所有风机测点
+isLoadAllTag: false
+#是否启动websocket推送
+websocket_start: false
+#websocket推送风机基本信息统一编码
+uniformcode:
+  wind_speed_code: AI022
+  roll_speed_code: AI128
+  power_code: AI130
+  status_code: FJZT8
+  lock_code: XDSL
+  pv_I: AIG060     #电流-A相
+  pv_U: AIG061     #电压-A相
+  pv_P: AI130      #功率-有功功率
+  pv_statue: FJZT  #状态
+
+redis:
+  host: 10.155.32.4
+  port: 6379
+  password: gdnxfd123
+
+
+
+