浏览代码

Merge branch 'master' of http://124.70.43.205:3000/GYEE_R.D/early-warning

wangb 1 周之前
父节点
当前提交
545f8e22b2
共有 100 个文件被更改,包括 3584 次插入153 次删除
  1. 16 0
      alarm/custom/src/main/java/com/gyee/wisdom/alarm/model/TagInfo.java
  2. 3 0
      alarm/custom/src/main/java/com/gyee/wisdom/alarm/rule/AlarmFunction.java
  3. 6 0
      alarm/custom/src/main/java/com/gyee/wisdom/alarm/rule/AlarmFunctionMAX.java
  4. 35 0
      alarm/custom/src/main/java/com/gyee/wisdom/alarm/rule/AlarmFunctionMIN.java
  5. 1 0
      alarm/custom/src/main/java/com/gyee/wisdom/alarm/rule/AlarmRule.java
  6. 1 0
      alarm/custom/src/main/java/com/gyee/wisdom/alarm/rule/expression/Analyzer.java
  7. 3 3
      alarm/custom/src/main/resources/application.yaml
  8. 1 1
      alarm/sharding-mysql2/build.gradle
  9. 1 1
      alarm/sharding/src/main/resources/application-nx.yaml
  10. 6 0
      common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/BlobTsData.java
  11. 4 0
      common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/BooleanTsData.java
  12. 5 0
      common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/CoordinateTsData.java
  13. 4 0
      common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/DoubleTsData.java
  14. 4 1
      common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/GeneralTsData.java
  15. 5 0
      common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/IntegerTsData.java
  16. 5 0
      common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/LongTsData.java
  17. 5 0
      common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/StringTsData.java
  18. 1 1
      common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/TsData.java
  19. 26 1
      dao/dao-redis/src/main/java/com/gyee/wisdom/dao/redis/RedisLatestDao.java
  20. 1 0
      dao/dao-redis/src/main/java/com/gyee/wisdom/it235/util/RedisValUtil.java
  21. 1 1
      dao/dao-taoscz/build.gradle
  22. 4 13
      dao/dao-taoscz/src/main/java/com/gyee/wisdom/dao/taoscz/TaosConfig.java
  23. 15 16
      dao/dao-taoscz/src/main/java/com/gyee/wisdom/dao/taoscz/TaosHistoryDao.java
  24. 21 22
      dao/dao-taoscz/src/main/java/com/gyee/wisdom/dao/taoscz/TaosLatestDao.java
  25. 9 9
      dao/dao-taoscz/src/main/java/com/gyee/wisdom/dao/taoscz/TaskCallable.java
  26. 5 4
      data-adapter/build.gradle
  27. 30 0
      data-adapter/src/main/java/com/gyee/wisdom/dataadapter/configuration/FilePathConfig.java
  28. 19 0
      data-adapter/src/main/java/com/gyee/wisdom/dataadapter/entity/TaosEntity.java
  29. 2 2
      data-adapter/src/main/java/com/gyee/wisdom/dataadapter/runner/SpringStartAfter.java
  30. 96 0
      data-adapter/src/main/resources/application-bd.yaml
  31. 9 10
      data-adapter/src/main/resources/application-hf.yaml
  32. 162 0
      data-adapter/src/main/resources/application-nx.yaml
  33. 92 0
      data-adapter/src/main/resources/application-nxxnj.yaml
  34. 95 0
      data-adapter/src/main/resources/application-xnj.yaml
  35. 11 10
      data-adapter/src/main/resources/application.yaml
  36. 10 0
      data-adapter/src/test/java/com/gyee/wisdom/test/MyTest.java
  37. 0 0
      datalogs/dataChange.log
  38. 3 1
      gradle.properties
  39. 1 1
      gradle/wrapper/gradle-wrapper.properties
  40. 1 1
      risk-calc/build.gradle
  41. 15 3
      transport/redis2taos/build.gradle
  42. 8 13
      transport/redis2taos/src/main/java/com/gyee/wisdom/ApplicationReadyEventListener.java
  43. 58 11
      transport/redis2taos/src/main/java/com/gyee/wisdom/taos/TaosConfig.java
  44. 二进制
      transport/redis2taos/src/main/lib/eDosProxyApi.dll
  45. 488 0
      transport/redis2taos/src/main/lib/eDosProxyApi.h
  46. 二进制
      transport/redis2taos/src/main/lib/eDosProxyApi.lib
  47. 二进制
      transport/redis2taos/src/main/lib/jna.jar
  48. 二进制
      transport/redis2taos/src/main/lib/ojdbc6.jar
  49. 67 0
      transport/redis2taos/src/main/resources/application-hf.yaml
  50. 86 0
      transport/redis2taos/src/main/resources/application-nx1q.yaml
  51. 69 0
      transport/redis2taos/src/main/resources/application-xnj.yaml
  52. 35 13
      transport/redis2taos/src/main/resources/application.yaml
  53. 3 3
      warning-web/build.gradle
  54. 22 1
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/AlarmCountController.java
  55. 18 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/AlarmGrafanaContorller.java
  56. 1 1
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/Alertrule2Controller.java
  57. 1 1
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/schedule/FaultStatScheduled.java
  58. 5 4
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/AlarmCountService.java
  59. 5 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/AlarmUserService.java
  60. 5 4
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/Alertrule2Service.java
  61. 93 0
      warning-web/src/main/resources/application-hnj.yaml
  62. 103 0
      warning-web/src/main/resources/application-nx.yaml
  63. 94 0
      warning-web/src/main/resources/application-ys.yaml
  64. 4 1
      warning-web/src/main/resources/application.yaml
  65. 159 0
      warning-web/src/main/resources/mappers-mysql/AlarmCountMapper.xml
  66. 230 0
      warning-web/src/main/resources/mappers-mysql/AlarmHistoryMapper.xml
  67. 14 0
      warning-web/src/main/resources/mappers-mysql/AlarmPartsCountMapper.xml
  68. 14 0
      warning-web/src/main/resources/mappers-mysql/AlarmRuleCountMapper.xml
  69. 154 0
      warning-web/src/main/resources/mappers-mysql/AlarmSnapMapper.xml
  70. 35 0
      warning-web/src/main/resources/mappers-mysql/AlarmUserMapper.xml
  71. 9 0
      warning-web/src/main/resources/mappers-mysql/AlertKnowledge.xml
  72. 280 0
      warning-web/src/main/resources/mappers-mysql/Alertrule2Mapper.xml
  73. 16 0
      warning-web/src/main/resources/mappers-mysql/DatadictionaryMapper.xml
  74. 56 0
      warning-web/src/main/resources/mappers-mysql/DeviceFaultModeMapper.xml
  75. 10 0
      warning-web/src/main/resources/mappers-mysql/DeviceMapper.xml
  76. 117 0
      warning-web/src/main/resources/mappers-mysql/DeviceMetricsMapper.xml
  77. 34 0
      warning-web/src/main/resources/mappers-mysql/DeviceModelMapper.xml
  78. 54 0
      warning-web/src/main/resources/mappers-mysql/DeviceModelMetricsMapper.xml
  79. 48 0
      warning-web/src/main/resources/mappers-mysql/DeviceStructureMapper.xml
  80. 7 0
      warning-web/src/main/resources/mappers-mysql/EarlyReportAlarmMapper.xml
  81. 7 0
      warning-web/src/main/resources/mappers-mysql/EarlyReportConclusionMapper.xml
  82. 7 0
      warning-web/src/main/resources/mappers-mysql/EarlyReportMapper.xml
  83. 7 0
      warning-web/src/main/resources/mappers-mysql/EarlyReportWindturbineMapper.xml
  84. 18 0
      warning-web/src/main/resources/mappers-mysql/EarlyWarnScoreMapper.xml
  85. 17 0
      warning-web/src/main/resources/mappers-mysql/ElectricalTestingPointAIMapper.xml
  86. 17 0
      warning-web/src/main/resources/mappers-mysql/ElectricalTestingPointDIMapper.xml
  87. 10 0
      warning-web/src/main/resources/mappers-mysql/EquipmentmodelMapper.xml
  88. 44 0
      warning-web/src/main/resources/mappers-mysql/FaultHistoryMapper.xml
  89. 122 0
      warning-web/src/main/resources/mappers-mysql/FaultInfoMapper.xml
  90. 74 0
      warning-web/src/main/resources/mappers-mysql/FaultSnapMapper.xml
  91. 35 0
      warning-web/src/main/resources/mappers-mysql/FaultStatisticWindturbineMapper.xml
  92. 36 0
      warning-web/src/main/resources/mappers-mysql/FeatureStatMapper.xml
  93. 6 0
      warning-web/src/main/resources/mappers-mysql/InspectOrderMapper.xml
  94. 15 0
      warning-web/src/main/resources/mappers-mysql/MainBrownouts2Mapper.xml
  95. 4 0
      warning-web/src/main/resources/mappers-mysql/RiskHistoryMapper.xml
  96. 4 0
      warning-web/src/main/resources/mappers-mysql/RiskModelMapper.xml
  97. 4 0
      warning-web/src/main/resources/mappers-mysql/RiskModelRuleMapper.xml
  98. 4 0
      warning-web/src/main/resources/mappers-mysql/RiskSnapMapper.xml
  99. 17 0
      warning-web/src/main/resources/mappers-mysql/RuleUpdateEvent.xml
  100. 0 0
      warning-web/src/main/resources/mappers-mysql/RuleUpdateEventInfo.xml

+ 16 - 0
alarm/custom/src/main/java/com/gyee/wisdom/alarm/model/TagInfo.java

@@ -93,4 +93,20 @@ public class TagInfo {
     public long getLocalLastUpdateTime(){
         return this.localTs;
     }
+
+    public DoubleTsData getDoubleTsData() {
+        if (doubleTsData != null)
+            return doubleTsData;
+
+        if (longTsData != null) {
+            return  new DoubleTsData(longTsData.getTs(),(short)0, (double)longTsData.getLongValue());
+        }
+
+        if (booleanTsData != null) {
+            double dvalue = booleanTsData.getBooleanValue()?1:0;
+            return  new DoubleTsData(booleanTsData.getTs(),(short)0, dvalue);
+        }
+
+        return null;
+    }
 }

+ 3 - 0
alarm/custom/src/main/java/com/gyee/wisdom/alarm/rule/AlarmFunction.java

@@ -127,6 +127,9 @@ public class AlarmFunction {
                 else if (subExp.getFunType() != null && subExp.getFunType().equals("MAX")) {
                     aFun = new AlarmFunctionMAX(subExp, tType, tId);
                 }
+                else if (subExp.getFunType() != null && subExp.getFunType().equals("MIN")) {
+                    aFun = new AlarmFunctionMIN(subExp, tType, tId);
+                }
                 else if (subExp.getFunType() != null && subExp.getFunType().equals("AVG")) {
                     aFun = new AlarmFunctionAVG(subExp, tType, tId);
                 }

+ 6 - 0
alarm/custom/src/main/java/com/gyee/wisdom/alarm/rule/AlarmFunctionMAX.java

@@ -25,6 +25,12 @@ public class AlarmFunctionMAX extends AlarmFunction {
 
         for (int i = 0; i < this.getAlarmExpression().getVarList().size(); i++) {
             TagInfo tagInfo = this.getTagInfo(this.getAlarmExpression().getVarList().get(i));
+
+            if (tagInfo == null) {
+                continue;
+            }
+
+            //System.out.println("@@@@@" + this.getAlarmExpression().getVarList().get(i));
             if (!maxValue.isPresent()) {
                 maxValue = Optional.of(tagInfo.getDoubleTsData().getDoubleValue());
             } else {

+ 35 - 0
alarm/custom/src/main/java/com/gyee/wisdom/alarm/rule/AlarmFunctionMIN.java

@@ -0,0 +1,35 @@
+package com.gyee.wisdom.alarm.rule;
+
+import com.gyee.wisdom.alarm.model.TagInfo;
+import com.gyee.wisdom.alarm.rule.expression.AlarmExpression;
+
+import java.util.Optional;
+
+
+public class AlarmFunctionMIN extends AlarmFunction {
+    public AlarmFunctionMIN(AlarmExpression alarmExpression, ThingType tType, String tId) {
+        super(alarmExpression, tType, tId);
+    }
+
+    @Override
+    public Object explain() {
+        if (this.getAlarmExpression().getVarList() == null || this.getAlarmExpression().getVarList().size() < 1)
+            return 0;
+
+        Optional<Double> minValue = Optional.empty();
+
+        for (int i = 0; i < this.getAlarmExpression().getVarList().size(); i++) {
+            TagInfo tagInfo = this.getTagInfo(this.getAlarmExpression().getVarList().get(i));
+            if (!minValue.isPresent()) {
+                minValue = Optional.of(tagInfo.getDoubleTsData().getDoubleValue());
+            } else {
+                if (minValue.get() >= tagInfo.getDoubleTsData().getDoubleValue()) {
+                    minValue = Optional.of(tagInfo.getDoubleTsData().getDoubleValue());
+                }
+            }
+        }
+
+        return minValue.get().doubleValue();
+    }
+
+}

+ 1 - 0
alarm/custom/src/main/java/com/gyee/wisdom/alarm/rule/AlarmRule.java

@@ -179,6 +179,7 @@ public class AlarmRule {
                         System.out.print(obj.toString());
                     }
                 } catch (Exception ex) {
+                   // ex.printStackTrace();
                     log.error("自定义报警规则执行时出错!"+fun.getThingId()+"--"+this.alertRule.getId()+"----"+this.alertRule.getName()+"------" + ex.getMessage());
                 }
             }

+ 1 - 0
alarm/custom/src/main/java/com/gyee/wisdom/alarm/rule/expression/Analyzer.java

@@ -17,6 +17,7 @@ public class Analyzer {
         add("MR");
         add("MAR");
         add("MAX");
+        add("MIN");
         add("AVG");
     }};
 

+ 3 - 3
alarm/custom/src/main/resources/application.yaml

@@ -8,7 +8,7 @@ spring:
     show-sql: false
   datasource:
     driver-class-name: oracle.jdbc.OracleDriver
-    url: jdbc:oracle:thin:@123.60.213.70:1521:gdnxfd
+    url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
     username: nxfdprod
     password: gdnxfd123
 #    driver-class-name: com.mysql.jdbc.Driver
@@ -29,9 +29,9 @@ spring:
 calculate:
   config:
     #服务地址  ws://localhost:8011/wisdom
-    serviceUrl: http://127.0.0.1:8011/ts
+    serviceUrl: http://192.168.1.82:8011/ts
     #服务地址  ws://localhost:8011/wisdom
-    shardingServiceUrl: http://192.168.100.204:8075
+    shardingServiceUrl: http://192.168.1.18:8075
     #扫描线程轮询时间(单位:毫秒)
     readThreadInterval: 1000
     #计算线程轮询时间(单位:毫秒)

+ 1 - 1
alarm/sharding-mysql2/build.gradle

@@ -35,7 +35,7 @@ dependencies {
 
     compile 'com.baomidou:mybatis-plus-boot-starter:3.1.1'
     compile 'com.baomidou:mybatis-plus-generator:3.1.1'
-    implementation 'com.taosdata.jdbc:taos-jdbcdriver:2.0.35'
+    implementation 'com.taosdata.jdbc:taos-jdbcdriver:$taosVersion'
     testCompile("$bootGroup:spring-boot-starter-test")
     // https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt
     compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.0'

+ 1 - 1
alarm/sharding/src/main/resources/application-nx.yaml

@@ -76,7 +76,7 @@ sharding:
     #分表开始时间  格式:yyyy-MM-dd
     startDate: 2018-01-01
 count:
-  custom: false
+  custom: true
   fault: false
 
 stationname:

+ 6 - 0
common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/BlobTsData.java

@@ -1,5 +1,6 @@
 package com.gyee.wisdom.common.data.timeseries;
 
+import java.nio.ByteBuffer;
 import java.util.Base64;
 
 /**
@@ -20,5 +21,10 @@ public class BlobTsData extends BasicTsData {
         return Base64.getEncoder().encodeToString(blob);
     }
 
+    @Override
+    public double getValue() {
+        return ByteBuffer.wrap(blob).getDouble();
+    }
+
 }
 

+ 4 - 0
common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/BooleanTsData.java

@@ -15,5 +15,9 @@ public class BooleanTsData extends BasicTsData {
         return actualValue;
     }
 
+    @Override
+    public double getValue() {
+        return actualValue ? 1 : 0;
+    }
 }
 

+ 5 - 0
common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/CoordinateTsData.java

@@ -22,5 +22,10 @@ public class CoordinateTsData extends BasicTsData {
         //return String.format("{\"longitude\":%f,\"latitude\":\"%f\"}", longitude, latitude);
     }
 
+    @Override
+    public double getValue() {
+        return coordinate.getLongitude();
+    }
+
 }
 

+ 4 - 0
common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/DoubleTsData.java

@@ -29,5 +29,9 @@ public class DoubleTsData extends BasicTsData {
                 "'}";
     }
 
+    @Override
+    public double getValue() {
+        return actualValue;
+    }
 }
 

+ 4 - 1
common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/GeneralTsData.java

@@ -23,6 +23,9 @@ public class GeneralTsData implements TsData {
     private Optional<String> blobValue;
     private Optional<Coordinate> coordinateValue;
 
-
+    @Override
+    public double getValue() {
+        return doubleValue.get();
+    }
 }
 

+ 5 - 0
common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/IntegerTsData.java

@@ -15,4 +15,9 @@ public class IntegerTsData extends BasicTsData {
     public Integer getIntegerValue() {
         return actualValue;
     }
+
+    @Override
+    public double getValue() {
+        return actualValue;
+    }
 }

+ 5 - 0
common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/LongTsData.java

@@ -20,5 +20,10 @@ public class LongTsData extends BasicTsData {
 //        return Long.toString(actualValue);
 //    }
 
+    @Override
+    public double getValue() {
+        return actualValue;
+    }
+
 }
 

+ 5 - 0
common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/StringTsData.java

@@ -20,5 +20,10 @@ public class StringTsData extends BasicTsData {
         return actualValue;
     }
 
+    @Override
+    public double getValue() {
+        return Double.valueOf(actualValue);
+    }
+
 }
 

+ 1 - 1
common/data/src/main/java/com/gyee/wisdom/common/data/timeseries/TsData.java

@@ -9,7 +9,7 @@ public interface TsData {
 
     short getStatus();
 
-    //double getValue();
+    double getValue();
 
 }
 

+ 26 - 1
dao/dao-redis/src/main/java/com/gyee/wisdom/dao/redis/RedisLatestDao.java

@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -24,13 +25,37 @@ public class RedisLatestDao implements ILatestDao {
     @Autowired
     private RedisValUtil redisValUtil;
 
+    public static void main(String[] args) {
+        String binaryString = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000011001011011011000001001111101011101111000";
+        byte[] byteArray = binaryStringToByteArray(binaryString);
+        double val = ByteUtil.getDouble(byteArray, 0);
+        long ts = ByteUtil.getLong2(byteArray, 8);
+        System.out.println(ts);
+        System.out.println(val);
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+        Date date = new Date(ts);
+
+        String formattedDateTime = formatter.format(date);
+
+        System.out.println(formattedDateTime);
+    }
+
+    public static byte[] binaryStringToByteArray(String binaryString) {
+        byte[] byteArray = new byte[binaryString.length() / 8];
+        for (int i = 0; i < byteArray.length; i++) {
+            String byteString = binaryString.substring(i * 8, i * 8 + 8);
+            byteArray[i] = (byte) Integer.parseInt(byteString, 2);
+        }
+        return byteArray;
+    }
 
     public Map<String, TsData> getTsDataLatest(List<TsPoint> tsPoints) throws Exception {
 
         Map<String, TsData> resultTest = new HashMap<>();
         try {
             List<String> collect = tsPoints.stream().map(s -> s.getId()).collect(Collectors.toList());
-            List<byte[]> bytesList = redisValUtil.getBytesList(Integer.parseInt(tsPoints.get(0).getTag()), collect);
+            List<byte[]> bytesList = redisValUtil.getBytesList(0, collect);
             for (int i = 0; i < bytesList.size(); i++) {
                 double val = ByteUtil.getDouble(bytesList.get(i), 0);
                 long ts = ByteUtil.getLong2(bytesList.get(i), 8);

+ 1 - 0
dao/dao-redis/src/main/java/com/gyee/wisdom/it235/util/RedisValUtil.java

@@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
 import org.springframework.data.redis.connection.RedisConnection;
 
 import java.io.UnsupportedEncodingException;
+import java.net.URI;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.ThreadLocalRandom;

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

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

+ 4 - 13
dao/dao-taoscz/src/main/java/com/gyee/wisdom/dao/taoscz/TaosConfig.java

@@ -5,10 +5,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
 
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.Statement;
+import java.sql.*;
 import java.util.Date;
 import java.util.Properties;
 import java.util.Random;
@@ -49,7 +46,7 @@ public class TaosConfig {
 
     private Connection connection = null;
 
-    public Connection getInstance() {
+    public Connection getInstance() throws Exception {
         if (null == connection)
             connection = getConnection();
 
@@ -57,11 +54,9 @@ public class TaosConfig {
     }
 
 
-    private Connection getConnection() {
+    private Connection getConnection() throws Exception {
         Connection connection = null;
 
-        try {
-
             Class.forName(driverType);
             String jdbcUrl = "jdbc:TAOS-RS://" + serverIp + ":" + serverPort + "/" + dbName + "?user=" + userName + "&password=" + password;
             if (driverType.equals("com.taosdata.jdbc.TSDBDriver"))
@@ -71,16 +66,12 @@ public class TaosConfig {
             connProps.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8");
             connProps.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
             connection = DriverManager.getConnection(jdbcUrl, connProps);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
 
         return connection;
     }
 
     public String getTableName(String tagName) {
-        return dbName + "." + tagName;
+        return dbName + "." + tagName.toLowerCase();
     }
 
     public String getDbName() {

+ 15 - 16
dao/dao-taoscz/src/main/java/com/gyee/wisdom/dao/taoscz/TaosHistoryDao.java

@@ -58,16 +58,16 @@ public class TaosHistoryDao implements IHistoryDao {
         Statement st = taosConfig.getInstance().createStatement();
         String point = tsQuery.getTsPoint().getId();
         StringBuilder sb = new StringBuilder();
-        sb.append("select avg(value),max(value),min(value) from ");
+        sb.append("select avg(val),max(val),min(val) from ");
         sb.append(taosConfig.getTableName(tsQuery.getTsPoint().getId()));
-        sb.append(" where ts>='").append(DateFormatUtils.format(tsQuery.getStartTs(), "yyyy-MM-dd HH:mm:ss:SSS"));
-        sb.append("' and ts<='").append(DateFormatUtils.format(tsQuery.getEndTs(), "yyyy-MM-dd HH:mm:ss:SSS"));
-        sb.append("' interval(").append(tsQuery.getInterval()).append("s)");
+        sb.append(" where ts between ").append(tsQuery.getStartTs());
+        sb.append(" and ").append(tsQuery.getEndTs());
+        //sb.append(" interval(").append(tsQuery.getInterval()).append("s)");
         ResultSet rs = st.executeQuery(sb.toString());
         while (rs.next()) {
-            DoubleTsData avgData = new DoubleTsData(rs.getLong(1), (short) 1, rs.getDouble(2));
-            DoubleTsData maxData = new DoubleTsData(rs.getLong(1), (short) 1, rs.getDouble(3));
-            DoubleTsData minData = new DoubleTsData(rs.getLong(1), (short) 1, rs.getDouble(4));
+            DoubleTsData avgData = new DoubleTsData(tsQuery.getStartTs(), (short) 1, rs.getDouble(1));
+            DoubleTsData maxData = new DoubleTsData(tsQuery.getStartTs(), (short) 1, rs.getDouble(2));
+            DoubleTsData minData = new DoubleTsData(tsQuery.getStartTs(), (short) 1, rs.getDouble(3));
             DoubleStatData statData = new DoubleStatData(avgData, maxData, minData);
             result.add(statData);
         }
@@ -104,13 +104,13 @@ public class TaosHistoryDao implements IHistoryDao {
             String[] tagNames = entry.getValue().stream().map(TsPoint::getId).toArray(String[]::new);
             if (entry.getKey() == TsDataType.DOUBLE)
                 for (String tag : tagNames) {
-                    TaskCallable task = new TaskCallable(taosConfig.getInstance(), ts, tag, TsDataType.DOUBLE);
+                    TaskCallable task = new TaskCallable(taosConfig, ts, tag, TsDataType.DOUBLE);
                     Future<Map<String, TsData>> submit = taskConfig.getInstance().submit(task);
                     results.add(submit);
                 }
             if (entry.getKey() == TsDataType.BOOLEAN) {
                 for (String tag : tagNames) {
-                    TaskCallable task = new TaskCallable(taosConfig.getInstance(), ts, tag, TsDataType.BOOLEAN);
+                    TaskCallable task = new TaskCallable(taosConfig, ts, tag, TsDataType.BOOLEAN);
                     Future<Map<String, TsData>> submit = taskConfig.getInstance().submit(task);
                     results.add(submit);
                 }
@@ -223,16 +223,15 @@ public class TaosHistoryDao implements IHistoryDao {
         if (tsQuery.getInterpolation() == Interpolation.RAW) {
             sb.append("select * from ");
             sb.append(taosConfig.getTableName(point));
-            sb.append(" where ts>='").append(DateFormatUtils.format(tsQuery.getStartTs(), "yyyy-MM-dd HH:mm:ss:SSS"));
-            sb.append("' and ts<='").append(DateFormatUtils.format(tsQuery.getEndTs(), "yyyy-MM-dd HH:mm:ss:SSS"));
-            sb.append("'");
+            sb.append(" where ts between ").append(tsQuery.getStartTs());
+            sb.append(" and ").append(tsQuery.getEndTs());
         } else if (tsQuery.getInterpolation() == Interpolation.SNAP) {
             if (tsQuery.getDateArray() != null && tsQuery.getDateArray().length > 0) {
-                sb.append("select last(value) from ");
+                sb.append("select _irowts,interp(val) from ");
                 sb.append(taosConfig.getTableName(point));
-                sb.append(" where ts>='").append(DateFormatUtils.format(tsQuery.getStartTs(), "yyyy-MM-dd HH:mm:ss:SSS"));
-                sb.append("' and ts<'").append(DateFormatUtils.format(tsQuery.getEndTs(), "yyyy-MM-dd HH:mm:ss:SSS"));
-                sb.append("' interval(").append(tsQuery.getInterval()).append("s) fill(prev)");
+                sb.append(" range(").append(tsQuery.getStartTs());
+                sb.append(",").append(tsQuery.getEndTs());
+                sb.append(") every(").append(tsQuery.getInterval()).append("s) fill(prev)");
             } else {
                 throw new WisdomException("无效的查询条件!");
             }

+ 21 - 22
dao/dao-taoscz/src/main/java/com/gyee/wisdom/dao/taoscz/TaosLatestDao.java

@@ -12,7 +12,9 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
 import java.sql.Statement;
+import java.sql.Timestamp;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
@@ -38,10 +40,10 @@ public class TaosLatestDao implements ILatestDao {
             String[] tagNames = entry.getValue().stream().map(TsPoint::getId).toArray(String[]::new);
             if (entry.getKey() == TsDataType.DOUBLE) {
                 result.putAll(getDoubleTsDataSnapshots(tagNames));
-            } else if (entry.getKey() == TsDataType.LONG) {
-                result.putAll(getLongTsDataSnapshots(tagNames));
             } else if (entry.getKey() == TsDataType.BOOLEAN) {
                 result.putAll(getBooleanTsDataSnapshots(tagNames));
+            } else if (entry.getKey() == TsDataType.LONG) {
+                result.putAll(getLongTsDataSnapshots(tagNames));
             } else {
                 throw new WisdomException("Taos不支持数据类型:" + entry.getKey());
             }
@@ -55,16 +57,16 @@ public class TaosLatestDao implements ILatestDao {
     public int writeDoubleLatest(List<TsPointData> list) throws Exception {
         Statement st = config.getInstance().createStatement();
         StringBuilder sb = new StringBuilder();
-        sb.append("insert into ");
+        sb.append("INSERT INTO ");
         for (TsPointData obj : list) {
             long time = obj.getTsData().getTs();
             String point = config.getTableName(obj.getTagName());
             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(point).append(" VALUES (");
+            sb.append(time).append(",").append(value).append(") ");
         }
-
+        sb.append(";");
         val i = st.executeUpdate(sb.toString());
 
         return i == list.size() ? list.size() : 0;
@@ -99,11 +101,12 @@ public class TaosLatestDao implements ILatestDao {
             boolean value = obj.getTsData().getBooleanValue().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(") ");
         }
-        boolean flag = st.execute(sb.toString());
+        sb.append(";");
+        int i = st.executeUpdate(sb.toString());
 
-        return flag == true ? list.size() : 0;
+        return i;
     }
 
     @Override
@@ -174,17 +177,11 @@ public class TaosLatestDao implements ILatestDao {
     public Map<String, TsData> getDoubleTsDataSnapshots(String... tagNames) throws Exception {
         Map<String, TsData> tsDataMap = new HashMap<>();
         Statement st = config.getInstance().createStatement();
-//        for (String tag : tagNames) {
-//            String tableName = config.getTableName(tag);
-//
-//            ResultSet rs = st.executeQuery("select last_row(*) from " + tableName);
-//            while (rs.next()) {
-//                tsDataMap.put(tag, new DoubleTsData(rs.getTimestamp(1).getTime(), (short) 0, rs.getDouble(2)));
-//            }
-//        }
-
-        String inString = Arrays.stream(tagNames).map(s -> "'" + s + "'").collect(Collectors.joining(","));
-        ResultSet rs = st.executeQuery("select last_row(*) from " + config.getDbName() + "." + config.getAIStableName() + " where point in (" + inString + ") group by tbname;");
+
+        String inString = Arrays.stream(tagNames).map(s -> "'" + s.toLowerCase() + "'").collect(Collectors.joining(","));
+        inString = "select last_row(*),tbname from " + config.getDbName() + "." + config.getAIStableName()
+                + " where tbname in (" + inString + ") group by tbname;";
+        ResultSet rs = st.executeQuery(inString);
 
         while (rs.next()) {
             tsDataMap.put(rs.getString(3).toUpperCase(), new DoubleTsData(rs.getTimestamp(1).getTime(), (short) 0, rs.getDouble(2)));
@@ -209,8 +206,10 @@ public class TaosLatestDao implements ILatestDao {
         Map<String, TsData> tsDataMap = new HashMap<>();
         Statement st = config.getInstance().createStatement();
 
-        String inString = Arrays.stream(tagNames).map(s -> "'" + s + "'").collect(Collectors.joining(","));
-        ResultSet rs = st.executeQuery("select last_row(*) from " + config.getDbName() + "." + config.getDIStableName() + " where point in (" + inString + ") group by tbname;");
+        String inString = Arrays.stream(tagNames).map(s -> "'" + s.toLowerCase() + "'").collect(Collectors.joining(","));
+        inString = "select last_row(*),tbname from " + config.getDbName() + "." + config.getDIStableName() +
+                " where tbname in (" + inString + ") group by tbname;";
+        ResultSet rs = st.executeQuery(inString);
 
         while (rs.next()) {
             tsDataMap.put(rs.getString(3).toUpperCase(), new BooleanTsData(rs.getTimestamp(1).getTime(), (short) 0, rs.getBoolean(2)));

+ 9 - 9
dao/dao-taoscz/src/main/java/com/gyee/wisdom/dao/taoscz/TaskCallable.java

@@ -18,7 +18,7 @@ import java.util.concurrent.Callable;
 @Slf4j
 public class TaskCallable implements Callable<Map<String, TsData>> {
 
-    private Connection connection;
+    private TaosConfig taosConfig;
     private long time;
     private String tagName;
     private TsDataType type;
@@ -26,8 +26,8 @@ public class TaskCallable implements Callable<Map<String, TsData>> {
     private long day_time = 86400000L;
     private long year_time = 8640000000L;
 
-    public TaskCallable(Connection connection, long time, String tagName, TsDataType type) {
-        this.connection = connection;
+    public TaskCallable(TaosConfig taosConfig, long time, String tagName, TsDataType type) {
+        this.taosConfig = taosConfig;
         this.time = time;
         this.tagName = tagName;
         this.type = type;
@@ -45,14 +45,14 @@ public class TaskCallable implements Callable<Map<String, TsData>> {
             return result;
 
         try {
-            st = this.connection.createStatement();
+            st = taosConfig.getInstance().createStatement();
 //            String point = TaosCovertUtil.coverStationPrefix(this.tagName) + "." + this.tagName.replace(".", "_");
 //            String tableName = dbName+ "." + this.tagName;
-            String sql = "select last_row(*) from " + "tst" + " where point_time>='"
-                    + DateFormatUtils.format(this.time - year_time, "yyyy-MM-dd HH:mm:ss:SSS") + "'"
-                    + " and point_time <='" + DateFormatUtils.format(this.time, "yyyy-MM-dd HH:mm:ss:SSS") + "'";
-            log.info(sql);
-            rs = st.executeQuery(sql);
+            StringBuilder sb = new StringBuilder();
+            sb.append("select last_row(*) from ").append(taosConfig.getDbName()).append(".")
+                    .append(tagName).append(" where ts<=").append(time);
+            //log.info(sql);
+            rs = st.executeQuery(sb.toString());
             if (rs.next()) {
                 if (this.type == TsDataType.DOUBLE)
                     tsData = new DoubleTsData(this.time, (short) 0, rs.getDouble(2));

+ 5 - 4
data-adapter/build.gradle

@@ -22,12 +22,12 @@ dependencies {
     implementation project(":dao:dao-sql")
     //compile project(":dao:dao-redis")
    // compile project(":dao:dao-simulator")
-    implementation project(":dao:dao-golden")
+    //implementation project(":dao:dao-golden")
     //compile project(":dao:dao-taos")
-   // implementation project(":dao:dao-taoscz")
+    implementation project(":dao:dao-taoscz")
     //compile project(":dao:dao-hive")
     //compile project(":dao: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")
@@ -43,7 +43,8 @@ dependencies {
     //implementation "org.springframework.boot:spring-boot-starter-redis:1.3.5.RELEASE"
     //compile('io.moquette:moquette-broker:0.10')
     implementation('com.fasterxml.jackson.datatype:jackson-datatype-jdk8')
-    implementation ("com.taosdata.jdbc:taos-jdbcdriver:2.0.35")
+    implementation ("com.taosdata.jdbc:taos-jdbcdriver:$taosVersion")
+    implementation 'org.postgresql:postgresql:42.4.0'
 
 }
 

+ 30 - 0
data-adapter/src/main/java/com/gyee/wisdom/dataadapter/configuration/FilePathConfig.java

@@ -0,0 +1,30 @@
+package com.gyee.wisdom.dataadapter.configuration;
+
+import org.springframework.boot.system.ApplicationHome;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+
+@Component
+public class FilePathConfig {
+    private static String filePath;
+    private static String excelPath;
+
+    public static String getFilePath() {
+        if(filePath==null){
+            ApplicationHome home = new ApplicationHome(FilePathConfig.class);
+            filePath=home.getSource().getParentFile().getAbsolutePath();
+        }
+        return filePath;
+    }
+
+    public static String getExcelPath() {
+        if(excelPath==null){
+            getFilePath();
+            excelPath = filePath+"\\excel\\";
+            File file = new File(excelPath);
+            if(!file.exists()) file.mkdirs();
+        }
+        return excelPath;
+    }
+}

+ 19 - 0
data-adapter/src/main/java/com/gyee/wisdom/dataadapter/entity/TaosEntity.java

@@ -0,0 +1,19 @@
+package com.gyee.wisdom.dataadapter.entity;
+
+import lombok.Data;
+
+import javax.persistence.Entity;
+
+@Data
+public class TaosEntity {
+    private String point;
+    private String description;
+    private String station;
+    private String category;
+    private String equipment;
+    private String uniformcode;
+    private String rate;
+    private String datatype;
+    private String operate;
+    private String remark;
+}

+ 2 - 2
data-adapter/src/main/java/com/gyee/wisdom/dataadapter/runner/SpringStartAfter.java

@@ -24,7 +24,7 @@ import java.sql.Statement;
 import java.util.*;
 import java.util.stream.Collectors;
 
-@Component
+//@Component
 @Slf4j
 public class SpringStartAfter implements ApplicationRunner {
 
@@ -60,7 +60,7 @@ public class SpringStartAfter implements ApplicationRunner {
         //牛首山风电场 taos库创建,taos库保存数据为90天
         //initDatabase("FS_FDC", 90);
 //        //牛首山风电场 ai测点表创建,超级表名为windturbineai,风机型号为UP82
-        initTableAI("FS_FDC", "pointai", "UP82-1500");
+        //initTableAI("FS_FDC", "pointai", "UP82-1500");
 //        //牛首山风电场 di测点表创建,超级表名为windturbinedi,风机型号为UP82
         //initTableDI("FS_FDC", "pointdi", "UP82-1500");
 

+ 96 - 0
data-adapter/src/main/resources/application-bd.yaml

@@ -0,0 +1,96 @@
+server:
+  port: 8012
+  max-http-header-size: 128KB
+
+spring:
+  application:
+    name: data-adapter
+  jpa:
+    show-sql: false
+  cache:
+    type: SIMPLE
+    # -------------------------1区mysql/2区oracle---------------------------------------
+  datasource:
+    driver-class-name: org.postgresql.Driver
+    url: jdbc:postgresql://10.220.1.5:15432/smartwindpower
+    username: smartuser
+    password: smart123!@#
+    type: com.alibaba.druid.pool.DruidDataSource
+    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: bd
+
+knife4j:
+  redis:
+    # 是否采用json序列化方式,若不采用jackson序列化
+    jsonSerialType: 'Fastjson'
+#    host: 114.55.105.194
+    host: 114.55.105.194
+    password: 127.0.0.1
+    port: 6379
+    databases: [0] # 要使用的库,会根据此处填写的库生成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
+
+#适配器链接taos数据库配置信息
+taoscz:
+  server_ip: 192.168.23.128
+  server_port: 6030
+  db_name: nxxny
+  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: pointai
+
+# 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  #状态
+
+
+
+
+
+

+ 9 - 10
data-adapter/src/main/resources/application-hf.yaml

@@ -1,6 +1,5 @@
 server:
   port: 8012
-  connection-timeout: 3000
   max-http-header-size: 128KB
 
 
@@ -51,10 +50,10 @@ knife4j:
   redis:
     # 是否采用json序列化方式,若不采用jackson序列化
     jsonSerialType: 'Fastjson'
-    host: 10.0.118.70
-    password: wanghs123
+    host: 10.0.118.76
+    password:
     port: 6379
-    databases: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] # 要使用的库,会根据此处填写的库生成redisTemplate
+    databases: [0] # 要使用的库,会根据此处填写的库生成redisTemplate
     timeout: 60s
     lettuce: # lettuce基于netty,线程安全,支持并发
       pool:
@@ -106,19 +105,19 @@ taos:
 
 #适配器链接taos数据库配置信息
 taoscz:
-  server_ip: 192.168.2.10
-  server_port: 6041
+  server_ip: 10.0.118.76
+  server_port: 6030
   db_name: hfxny
   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
+  #driver_type: com.taosdata.jdbc.rs.RestfulDriver
+  driver_type: com.taosdata.jdbc.TSDBDriver
   #taos中ai测点的超级表名
-  di_stable_name: windturbinedi
+  di_stable_name: pointdi
   #taos中di测点的超级表名
-  ai_stable_name: windturbineai
+  ai_stable_name: pointai
 
 #EDOS 数据库信息
 edos:

+ 162 - 0
data-adapter/src/main/resources/application-nx.yaml

@@ -0,0 +1,162 @@
+server:
+  port: 8012
+  max-http-header-size: 128KB
+
+
+spring:
+  application:
+    name: data-adapter
+  jpa:
+    show-sql: false
+  cache:
+    type: SIMPLE
+  datasource:
+    # -------------------------1区mysql/2区oracle---------------------------------------
+    driver-class-name: oracle.jdbc.OracleDriver
+    url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
+    username: nxfdprod
+    password: gdnxfd123
+    # -------------------------1区mysql/2区oracle---------------------------------------
+#    driver-class-name: oracle.jdbc.OracleDriver
+#    url: jdbc:oracle:thin:@123.60.213.70:1521:gdnxfd
+#    username: nxfdprod
+#    password: gdnxfd123
+    # ----------------------------------------------------------------
+#    driver-class-name: com.mysql.jdbc.Driver
+#    url: jdbc:mysql://123.60.219.66/wisdom_cs_hnj?useUnicode=true&characterEncoding=UTF-8
+#    username: root
+#    password: gyeepd@123
+    # ----------------------------------------------------------------
+    type: com.alibaba.druid.pool.DruidDataSource
+    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: 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: 192.168.2.252
+  server_port: 6030
+  user_name: root
+  password: taosdata
+  pool_size: 10
+  max_pool_size: 100
+
+#适配器链接taos数据库配置信息
+taoscz:
+  server_ip: 192.168.23.128
+  server_port: 6030
+  db_name: nxxny
+  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: pointai
+
+#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: true
+#是否启动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  #状态
+
+
+
+
+
+

+ 92 - 0
data-adapter/src/main/resources/application-nxxnj.yaml

@@ -0,0 +1,92 @@
+server:
+  port: 8012
+  max-http-header-size: 128KB
+
+spring:
+  application:
+    name: data-adapter
+  jpa:
+    show-sql: false
+  cache:
+    type: SIMPLE
+  datasource:
+    # -------------------------1区mysql/2区oracle---------------------------------------
+    driver-class-name: oracle.jdbc.OracleDriver
+    url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
+    username: nxfdprod
+    password: gdnxfd123
+    type: com.alibaba.druid.pool.DruidDataSource
+    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
+
+knife4j:
+  redis:
+    # 是否采用json序列化方式,若不采用jackson序列化
+    jsonSerialType: 'Fastjson'
+    host: 192.168.126.128
+    password: zghww693
+    port: 6379
+    databases: [0] # 要使用的库,会根据此处填写的库生成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
+
+#适配器链接taos数据库配置信息
+taoscz:
+  server_ip: 192.168.126.128
+  server_port: 6030
+  db_name: nxxny
+  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: pointai
+
+# 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  #状态
+
+
+
+
+
+

+ 95 - 0
data-adapter/src/main/resources/application-xnj.yaml

@@ -0,0 +1,95 @@
+server:
+  port: 8012
+  max-http-header-size: 128KB
+
+spring:
+  application:
+    name: data-adapter
+  jpa:
+    show-sql: false
+  cache:
+    type: SIMPLE
+    # -------------------------1区mysql/2区oracle---------------------------------------
+  datasource:
+    driver-class-name: org.postgresql.Driver
+    url: jdbc:postgresql://123.60.219.66:5432/wisdom_cs
+    username: postgres
+    password: gyeepd@123
+    type: com.alibaba.druid.pool.DruidDataSource
+    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: xnj
+
+knife4j:
+  redis:
+    # 是否采用json序列化方式,若不采用jackson序列化
+    jsonSerialType: 'Fastjson'
+    host: 114.55.105.194
+    password: wanghs123
+    port: 6379
+    databases: [0] # 要使用的库,会根据此处填写的库生成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
+
+#适配器链接taos数据库配置信息
+taoscz:
+  server_ip: 192.168.23.128
+  server_port: 6030
+  db_name: nxxny
+  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: pointai
+
+# 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  #状态
+
+
+
+
+
+

+ 11 - 10
data-adapter/src/main/resources/application.yaml

@@ -1,7 +1,8 @@
 server:
   port: 8012
-  connection-timeout: 3000
   max-http-header-size: 128KB
+  tomcat:
+    connection-timeout: 3000
 
 
 spring:
@@ -13,15 +14,15 @@ spring:
     type: SIMPLE
   datasource:
     # -------------------------1区mysql/2区oracle---------------------------------------
-#    driver-class-name: oracle.jdbc.OracleDriver
-#    url: jdbc:oracle:thin:@123.60.213.70:1521:gdnxfd
-#    username: nxfdprod
-#    password: gdnxfd123
+    driver-class-name: oracle.jdbc.OracleDriver
+    url: jdbc:oracle:thin:@123.60.213.70:1521:gdnxfd
+    username: nxfdprod
+    password: gdnxfd123
     # ----------------------------------------------------------------
-    driver-class-name: com.mysql.jdbc.Driver
-    url: jdbc:mysql://123.60.219.66/wisdom_cs_hnj?useUnicode=true&characterEncoding=UTF-8
-    username: root
-    password: gyeepd@123
+#    driver-class-name: com.mysql.jdbc.Driver
+#    url: jdbc:mysql://123.60.219.66/wisdom_cs_hnj?useUnicode=true&characterEncoding=UTF-8
+#    username: root
+#    password: gyeepd@123
     # ----------------------------------------------------------------
     type: com.alibaba.druid.pool.DruidDataSource
     druid:
@@ -35,7 +36,7 @@ spring:
           test-on-borrow: false
           test-on-return: false
   profiles:
-    active: hf
+    active: nxxnj
 #  redis:
 #    database: 2
 #    host: 192.168.2.5

+ 10 - 0
data-adapter/src/test/java/com/gyee/wisdom/test/MyTest.java

@@ -0,0 +1,10 @@
+package com.gyee.wisdom.test;
+
+public class MyTest {
+    public static void main(String[] args) {
+        double a = 8.997646d;
+        double b = 8.9976460d;
+        double v = a * b;
+        System.out.println(a==b);
+    }
+}

+ 0 - 0
datalogs/dataChange.log


+ 3 - 1
gradle.properties

@@ -37,4 +37,6 @@ commonsBeanUtilsVersion=1.9.4
 alibabaDruidVersion=1.2.9
 groovyVersion=3.0.9
 openFeignVersion=11.8
-postgresqlDriverVersion=42.4.0
+postgresqlDriverVersion=42.4.0
+taosVersion=2.0.35
+#taosVersion=3.0.3

+ 1 - 1
gradle/wrapper/gradle-wrapper.properties

@@ -4,4 +4,4 @@ distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
 #distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-all.zip
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip

+ 1 - 1
risk-calc/build.gradle

@@ -34,7 +34,7 @@ dependencies {
 
     implementation "com.baomidou:mybatis-plus-boot-starter:3.1.1"
     implementation "com.baomidou:mybatis-plus-generator:3.1.1"
-    implementation("com.taosdata.jdbc:taos-jdbcdriver:2.0.35") {
+    implementation("com.taosdata.jdbc:taos-jdbcdriver:$taosVersion") {
         exclude group: 'com.alibaba', module: 'fastjson'
     }
 

+ 15 - 3
transport/redis2taos/build.gradle

@@ -14,6 +14,9 @@ buildscript {
 apply plugin: "$bootGroup"
 apply plugin: 'io.spring.dependency-management'
 
+configurations {
+    compile.exclude group: 'org.apache.commons', module: 'commons-pool2'
+}
 
 dependencies {
     implementation project(":common:utils")
@@ -21,7 +24,7 @@ dependencies {
     implementation project(":dao:dao-interface")
     implementation project(":dao:dao-sql")
     implementation project(":dao:dao-redis")
-    implementation ("mysql:mysql-connector-java:$mysqlConnectorVersion")
+    //implementation ("mysql:mysql-connector-java:$mysqlConnectorVersion")
 
     implementation("$bootGroup:spring-boot-starter-test")
     implementation ("com.alibaba:druid:$alibabaDruidVersion")
@@ -35,9 +38,18 @@ dependencies {
     implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion")
     implementation("$bootGroup:spring-boot-starter-data-redis-reactive")
     implementation('com.fasterxml.jackson.datatype:jackson-datatype-jdk8')
-    implementation ("com.taosdata.jdbc:taos-jdbcdriver:2.0.35"){
+    implementation ("com.taosdata.jdbc:taos-jdbcdriver:$taosVersion"){
         exclude group: 'com.alibaba', module: 'fastjson'
     }
-    implementation 'org.apache.commons:commons-pool2'
+    //implementation 'org.apache.commons:commons-pool2'
+
+    implementation fileTree(dir: 'src/main/lib', include: '*.jar') //// oracle连接驱动       2区使用
+
+    implementation 'xerces:xercesImpl:2.12.2'
+    implementation 'org.apache.poi:poi-ooxml:5.2.3'
+    implementation 'cn.hutool:hutool-poi:5.8.12'
+    implementation 'cn.hutool:hutool-core:5.8.13'
+    implementation 'org.postgresql:postgresql:42.4.0'
+    //implementation 'redis.clients:jedis:4.3.1'
 }
 

+ 8 - 13
transport/redis2taos/src/main/java/com/gyee/wisdom/ApplicationReadyEventListener.java

@@ -13,26 +13,21 @@ import org.springframework.stereotype.Component;
 
 @Component
 @Slf4j
-public class ApplicationReadyEventListener implements
-        ApplicationListener<ApplicationReadyEvent> {
+public class ApplicationReadyEventListener implements ApplicationListener<ApplicationReadyEvent> {
 
-     @Autowired
-     private TsPointService tsPointService;
-     @Autowired
-     private ILatestDao latestDao;
-     @Autowired
-     private WriteRealValue writeRealValue;
+    @Autowired
+    private ReadAndWrite readAndWrite;
 
     @Override
     public void onApplicationEvent(ApplicationReadyEvent event) {
         log.info("ApplicationReadyEvent  rised!");
         log.info("listener: " + event.toString());
-        ReadAndWrite readAndWrite = new ReadAndWrite();
-        readAndWrite.setLatestDao(latestDao);
-        readAndWrite.setTsPointService(tsPointService);
-        readAndWrite.setWriteHistoryValue(writeRealValue);
         //执行线程
-        readAndWrite.start();
+        try {
+            readAndWrite.start();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 
 }

+ 58 - 11
transport/redis2taos/src/main/java/com/gyee/wisdom/taos/TaosConfig.java

@@ -13,13 +13,13 @@ import java.util.Properties;
 @Configuration
 public class TaosConfig {
 
-    @Value("${taoscz.server_ip:123.60.219.66}")
+    @Value("${taoscz.server_ip:192.168.1.60}")
     private String serverIp;
 
-    @Value("${taoscz.server_port:6041}")
+    @Value("${taoscz.server_port:6030}")
     private int serverPort;
 
-    @Value("${taoscz.db_name:by_fdc}")
+    @Value("${taoscz.db_name:power_test}")
     private String dbName;
 
     @Value("${taoscz.user_name:root}")
@@ -37,20 +37,60 @@ public class TaosConfig {
     @Value("${taoscz.driver_type:com.taosdata.jdbc.rs.RestfulDriver}")
     private String driverType;
 
+    @Value("${taoscz.ai_stable_name:windturbineai}")
+    private String aiStableName;
+
+    @Value("${taoscz.di_stable_name:windturbinedi}")
+    private String diStableName;
+
     private Connection connection = null;
+    private Connection createCon = null;
 
-    public Connection getInstance() {
+    public Connection getInstance() throws Exception {
         if (null == connection)
             connection = getConnection();
 
         return connection;
     }
 
+    public Connection getCreateCon() throws Exception {
+        if (null == createCon || createCon.isClosed()){
+            Class.forName(driverType);
+            String jdbcUrl = "jdbc:TAOS-RS://" + serverIp + ":" + serverPort + "?user=" + userName + "&password=" + password;
+            if (driverType.equals("com.taosdata.jdbc.TSDBDriver"))
+                jdbcUrl = "jdbc:TAOS://" + serverIp + ":" + serverPort + "?user=" + userName + "&password=" + password;
+            Properties connProps = new Properties();
+            connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
+            connProps.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8");
+            connProps.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
+            createCon = DriverManager.getConnection(jdbcUrl, connProps);
+        }
+        return createCon;
+    }
 
-    private Connection getConnection() {
+    public void closeCon() throws Exception {
+        if (null != createCon)
+            connection.close();
+    }
+
+    private Connection getConnection2() throws Exception {
         Connection connection = null;
 
-        try {
+        Class.forName(driverType);
+        String jdbcUrl = "jdbc:TAOS-RS://" + serverIp + ":" + serverPort + "?user=" + userName + "&password=" + password;
+        if (driverType.equals("com.taosdata.jdbc.TSDBDriver"))
+            jdbcUrl = "jdbc:TAOS://" + serverIp + ":" + serverPort + "?user=" + userName + "&password=" + password;
+        Properties connProps = new Properties();
+        connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
+        connProps.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8");
+        connProps.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
+        connection = DriverManager.getConnection(jdbcUrl, connProps);
+
+        return connection;
+    }
+
+    private Connection getConnection() throws Exception {
+        Connection connection = null;
 
             Class.forName(driverType);
             String jdbcUrl = "jdbc:TAOS-RS://" + serverIp + ":" + serverPort + "/" + dbName + "?user=" + userName + "&password=" + password;
@@ -61,17 +101,24 @@ public class TaosConfig {
             connProps.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8");
             connProps.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
             connection = DriverManager.getConnection(jdbcUrl, connProps);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
 
         return connection;
     }
 
     public String getTableName(String tagName) {
-
         return dbName + "." + tagName;
     }
 
+    public String getDbName() {
+        return dbName;
+    }
+
+
+    public String getAIStableName() {
+        return aiStableName;
+    }
+
+    public String getDIStableName() {
+        return diStableName;
+    }
 }

二进制
transport/redis2taos/src/main/lib/eDosProxyApi.dll


+ 488 - 0
transport/redis2taos/src/main/lib/eDosProxyApi.h

@@ -0,0 +1,488 @@
+#ifndef __EDOS_PROXY_API__
+#define __EDOS_PROXY_API__
+
+#define EDOSPROXYAPI_EXPORTS
+
+#ifdef EDOSPROXYAPI_EXPORTS
+#define EDOSPROXYAPI_API __declspec(dllexport) 
+#else
+#define EDOSPROXYAPI_API __declspec(dllimport)
+#endif
+
+#pragma pack(push, __EDOS_PROXY__)
+#pragma pack(1)
+
+#define ERROR_LOGIN_FAILED				 -2000
+#define ERROR_USER_ALREADY_EXIST  -2001
+#define ERROR_USER_NOT_EXIST  -2002
+#define ERROR_USER_ACCOUNT_ALREADY_EXIST  -2003
+#define ERROR_IDENTITY_ALREADY_EXIST  -2004
+#define ERROR_IDENTITY_NOT_EXIST  -2005
+#define ERROR_SERVICE_ALREADY_EXIST  -2006
+#define ERROR_SERVICE_NOT_EXIST  -2007
+#define ERROR_POINT_ALREADY_EXIST  -2008
+#define ERROR_POINT_NOT_EXIST  -2009
+#define ERROR_HISTORY_FULL  -2010
+#define ERROR_NO_LOGIN		  -2011
+#define ERROR_NO_PERMISSION  -2012
+#define ERROR_CHANGE_ADMIN_SETTING  -2013
+#define ERROR_CONNECT_TO_HISTORY  -2014
+#define ERROR_GET_CAPACITY_FAILED = -2015
+#define ERROR_NOT_EQUAL_CAPACITY = -2016
+#define ERROR_HISTORY_NAME  -2017
+#define ERROR_PARAM_EMPTY  -2018
+#define ERROR_PARAM_VALUE_ERROR  -2019
+#define ERROR_GET_POINT_INFO  -2020
+#define ERROR_DELETE_POINT  -2021
+#define ERROR_GET_POINT_INDEXES  -2022
+#define ERROR_PARAM_CONTAIN_DOT  -2023
+#define ERROR_HISTORY_NOT_RUNNING -2024
+#define ERROR_POINT_NAME = -2025
+#define ERROR_NOT_STRING_HISTORY -2026
+#define ERROR_NOT_DOUBLE_HISTORY -2027
+#define ERROR_INSTANCE_TYPE -2028
+#define ERROR_NOT_POINT_EXTEND_DATA -2029
+#define ERROR_NOT_INSTANCE_DESC -2030
+#define ERROR_NOT_IMAGE_HISTORY -2031
+
+#define SERVICE_BUSY									 -1
+#define PROXY_NOT_WORKING					-1001
+#define SEND_DATA_TO_BUF						-1002
+#define SOCKET_NOT_OPEN						-1003
+#define REQUEST_BUFFER_NOT_ENOUGH	-1004
+#define NO_COMMUNICATION_KEY			-1005
+#define ERROR_HIST_REQUEST_TIME -1006
+
+#define  INFO_LENGTH					200
+#define  IMAGE_SIZE						10000
+
+#define POINT_ALLOW_READ   1
+#define POINT_ALLOW_WRITE  2
+#define POINT_FULL_CONTROL 3
+
+#define FLOAT_ERROR -1.7E308
+
+typedef struct
+{
+	int dateUTC;
+	int bLowWarn;
+	double lowWarn;
+	int bLowAlarm;
+	double lowAlarm;
+	int bLowOutOfRange;
+	double lowOutOfRange;
+	int bHighWarn;
+	double highWarn;
+	int bHighAlarm;
+	double highAlarm;
+	int bHighOutOfRange;
+	double highOutOfRange;
+	char reservedField[INFO_LENGTH];
+	char reservedField2[INFO_LENGTH];
+	char reservedField3[INFO_LENGTH];
+	char reservedField4[INFO_LENGTH];
+	char reservedField5[INFO_LENGTH];
+	char reservedField6[INFO_LENGTH];
+	char reservedField7[INFO_LENGTH];
+	char reservedField8[INFO_LENGTH];
+	char reservedField9[INFO_LENGTH];
+	char reservedField10[INFO_LENGTH];
+	int bNoDataCheck;
+	int bForceDataToHistory;
+	int forcePeriod;
+} POINT_EXTEND_BACKUP_DATA;
+
+
+typedef struct
+{
+	int bLowWarn;
+	double lowWarn;
+	int bLowAlarm;
+	double lowAlarm;
+	int bLowOutOfRange;
+	double lowOutOfRange;
+	int bHighWarn;
+	double highWarn;
+	int bHighAlarm;
+	double highAlarm;
+	int bHighOutOfRange;
+	double highOutOfRange;
+	char reservedField[INFO_LENGTH];
+	char reservedField2[INFO_LENGTH];
+	char reservedField3[INFO_LENGTH];
+	char reservedField4[INFO_LENGTH];
+	char reservedField5[INFO_LENGTH];
+	char reservedField6[INFO_LENGTH];
+	char reservedField7[INFO_LENGTH];
+	char reservedField8[INFO_LENGTH];
+	char reservedField9[INFO_LENGTH];
+	char reservedField10[INFO_LENGTH];
+	int bNoDataCheck;
+	int bForceDataToHistory;
+	int forcePeriod;
+} POINT_EXTEND_DATA;
+
+typedef struct  
+{
+	char name[INFO_LENGTH];
+	char description[INFO_LENGTH];
+	char ip[50];
+	unsigned short port;
+	int capacity;
+}	HISTORY;
+
+typedef struct  
+{
+	char name[INFO_LENGTH];
+	char description[INFO_LENGTH];
+} IDENTITY;
+
+typedef struct
+{
+	char name[INFO_LENGTH];
+	char description[INFO_LENGTH];
+} PERMISSION;
+
+typedef struct
+{
+	char name[INFO_LENGTH];
+	char description[INFO_LENGTH];
+	char account[INFO_LENGTH];
+	char password[INFO_LENGTH];
+} USER;
+
+typedef struct
+{
+	char name[INFO_LENGTH];
+	int  count;
+	int  stringCount;
+	char description[INFO_LENGTH];
+	char system[INFO_LENGTH];
+	char subSystem[INFO_LENGTH];
+} POINT_INSTANCE_INFO;
+
+typedef struct
+{
+	char name[INFO_LENGTH];
+	char description[INFO_LENGTH];
+	char system[INFO_LENGTH];
+	char subSystem[INFO_LENGTH];
+} POINT_INSTANCE_DESC;
+
+typedef struct
+{
+	char name[INFO_LENGTH];
+	char description[INFO_LENGTH];
+	unsigned short nPrecision;
+	double deadBand;
+	int expireDays;
+	unsigned short pointType;
+	char units[50];
+	char instance[INFO_LENGTH];
+	char instanceAttribute[INFO_LENGTH];
+	char instanceAttributeDescription[INFO_LENGTH];
+	char type[INFO_LENGTH];
+	int minimumUpdateFreq;
+	double dValue;
+	int tTime;
+	unsigned short status;
+} HISTORY_POINT;
+
+typedef struct
+{
+	HISTORY_POINT point;
+	POINT_EXTEND_DATA data;
+} HISTORY_POINT_EX;
+
+
+typedef struct
+{
+	char name[INFO_LENGTH];
+	char description[INFO_LENGTH];
+	int expireDays;
+	char units[50];
+	char instance[INFO_LENGTH];
+	char instanceAttribute[INFO_LENGTH];
+	char instanceAttributeDescription[INFO_LENGTH];
+	char type[INFO_LENGTH];
+	int minimumUpdateFreq;
+	char sValue[INFO_LENGTH];
+	int tTime;
+	unsigned short status;
+} HISTORY_STRING_POINT;
+
+typedef struct
+{
+	char name[INFO_LENGTH];
+	char description[INFO_LENGTH];
+	int expireDays;
+	char units[50];
+	char instance[INFO_LENGTH];
+	char instanceAttribute[INFO_LENGTH];
+	char instanceAttributeDescription[INFO_LENGTH];
+	char type[INFO_LENGTH];
+	int minimumUpdateFreq;
+	char image[IMAGE_SIZE];
+	int tTime;
+	unsigned short status;
+} HISTORY_IMAGE_POINT;
+
+typedef struct
+{
+	int tTime;
+	double dValue;
+	unsigned short status;
+} HISTORY_VALUE;
+
+typedef struct
+{
+	int tTime;
+	char sValue[INFO_LENGTH];
+	unsigned short status;
+} HISTORY_STRING_VALUE;
+
+typedef struct
+{
+	char name[INFO_LENGTH];
+	HISTORY_VALUE rec;
+} POINT_VALUE;
+
+typedef struct
+{
+	char name[INFO_LENGTH];
+	HISTORY_STRING_VALUE rec;
+} POINT_STRING_VALUE;
+
+typedef struct
+{
+	int tTime;
+	char image[IMAGE_SIZE];
+	unsigned short status;
+} HISTORY_IMAGE_VALUE;
+
+typedef struct
+{
+	char name[INFO_LENGTH];
+	HISTORY_IMAGE_VALUE rec;
+} POINT_IMAGE_VALUE;
+
+
+typedef struct
+{
+	HISTORY_VALUE maxValue;
+	HISTORY_VALUE minValue;
+	HISTORY_VALUE avgValue;
+} HIST_STAT_VALUE;
+
+typedef struct
+{
+	char name[INFO_LENGTH];
+	int instanceCount;
+} TYPE_INSTANCE_INFO;
+
+typedef struct
+{
+	unsigned short n_days;      /* number of days until data expires */
+	long           earliest;    /* time of earliest entry for this point */
+	long           latest;      /* time of last entry for this point */
+	long           n_entries;   /* how many entries available for point */
+} POINT_INFO;
+
+
+extern "C" EDOSPROXYAPI_API int InitCommunicationKey(unsigned long *key,bool cacheEnable,char *cacheFolder,int maxCacheSizeInMB);
+
+extern "C" EDOSPROXYAPI_API int ConnectToServer(unsigned long key,char *serverIP,unsigned short serverPort);
+
+extern "C" EDOSPROXYAPI_API int Login(unsigned long key,char *account,char *password);
+
+extern "C" EDOSPROXYAPI_API int CreateServ(unsigned long key,HISTORY service);
+
+extern "C" EDOSPROXYAPI_API int UpdateServ(unsigned long key,HISTORY service);
+
+extern "C" EDOSPROXYAPI_API int DeleteServ(unsigned long key,HISTORY service);
+
+extern "C" EDOSPROXYAPI_API int LoadAllServices(unsigned long key,HISTORY *service,unsigned short nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int LoadHistoryInfo(unsigned long key,HISTORY service,int *pointCount,int *capacity);
+
+extern "C" EDOSPROXYAPI_API int CreateIdentity(unsigned long key,IDENTITY identity,PERMISSION *permission,unsigned short nCount);
+
+extern "C" EDOSPROXYAPI_API int UpdateIdentity(unsigned long key,IDENTITY identity,PERMISSION *permission,unsigned short nCount);
+
+extern "C" EDOSPROXYAPI_API int DeleteIdentity(unsigned long key,IDENTITY identity);
+
+extern "C" EDOSPROXYAPI_API int LoadAllIdentity(unsigned long key,IDENTITY *identities,unsigned short nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int LoadIdentityPermission(unsigned long key,IDENTITY identity,PERMISSION *permission,unsigned short nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int LoadAllPermission(unsigned long key,PERMISSION *permission,unsigned short nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int CreateUser(unsigned long key,USER user,IDENTITY identity);
+
+extern "C" EDOSPROXYAPI_API int UpdateUser(unsigned long key,USER user,IDENTITY identity);
+
+extern "C" EDOSPROXYAPI_API int DeleteUser(unsigned long key,USER user);
+
+extern "C" EDOSPROXYAPI_API int GetCurrentLoginIdentity(unsigned long key,IDENTITY *identity);
+
+extern "C" EDOSPROXYAPI_API int LoadAllUsers(unsigned long key,USER *user,IDENTITY *identities,unsigned short nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int CreatePoint(unsigned long key,HISTORY_POINT point,IDENTITY *identities,unsigned short *usMode,unsigned short nCount); // usMode can be POINT_ALLOW_READ,POINT_ALLOW_WRITE,POINT_FULL_CONTROL
+
+extern "C" EDOSPROXYAPI_API int UpdatePoint(unsigned long key,HISTORY_POINT point,IDENTITY *identities,unsigned short *usMode,unsigned short nCount); // usMode can be POINT_ALLOW_READ,POINT_ALLOW_WRITE,POINT_FULL_CONTROL
+
+extern "C" EDOSPROXYAPI_API int DeletePoint(unsigned long key,HISTORY_POINT point);
+
+extern "C" EDOSPROXYAPI_API int GetHistoryPoints(unsigned long key,HISTORY service,char *filterName,char *filterDesc,char *filterInstance,char * filterInstanceAttribute,char * filterInstanceAttributeDescription,char *type,HISTORY_POINT *point,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetHistoryPointsEX(unsigned long key, HISTORY service, char *filterName, char *filterDesc, char *filterInstance, char * filterInstanceAttribute, char * filterInstanceAttributeDescription, char *type, HISTORY_POINT_EX *point, int nCount, int *retsize);
+
+extern "C" EDOSPROXYAPI_API int SendMultiPoint(unsigned long key,POINT_VALUE *recs,unsigned short nCount);
+
+extern "C" EDOSPROXYAPI_API int SendMultiPointBigData(unsigned long key, POINT_VALUE *recs,int nCount);
+
+extern "C" EDOSPROXYAPI_API int InitMultiPoint(unsigned long key, POINT_VALUE *recs, unsigned short nCount);
+
+extern "C" EDOSPROXYAPI_API int InitMultiPointBigData(unsigned long key, POINT_VALUE *recs, int nCount);
+
+extern "C" EDOSPROXYAPI_API int SendSinglePoint(unsigned long key,char *name,HISTORY_VALUE *recs,unsigned short nCount);
+
+extern "C" EDOSPROXYAPI_API int GetRTValue(unsigned long key,char *name,HISTORY_VALUE *rec);
+
+extern "C" EDOSPROXYAPI_API int GetPointID(unsigned long key, char *name, int *id);
+
+extern "C" EDOSPROXYAPI_API int GetRTValueList(unsigned long key,char **nameList,HISTORY_VALUE *rec,int nCount);
+
+extern "C" EDOSPROXYAPI_API int GetHistSnap(unsigned long key,char *name,int tStart,int tEnd,int period,HISTORY_VALUE *rec,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetHistStat(unsigned long key,char *name,int tStart,int tEnd,int period,HIST_STAT_VALUE *rec,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetHistRaw(unsigned long key,char *name,int tStart,int tEnd,HISTORY_VALUE *rec,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetHistMatrix(unsigned long key,char **nameList,int tTime,HISTORY_VALUE *rec,int nCount);
+
+extern "C" EDOSPROXYAPI_API int UpdatePointData(unsigned long key,char *name,HISTORY_VALUE *rec,unsigned short nCount);
+
+extern "C" EDOSPROXYAPI_API int UpdateBigPointData(unsigned long key, char *name, HISTORY_VALUE *rec, int nCount);
+
+extern "C" EDOSPROXYAPI_API int GetPointIdentities(unsigned long key,char *name,IDENTITY *identities,unsigned short *usModes,unsigned short nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetPointInstances(unsigned long key,POINT_INSTANCE_INFO *rec,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetInstancePoints(unsigned long key,char *instance,int start,int count,HISTORY_POINT *point,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetPointsUnderHistory(unsigned long key,char *history,int start,int count,HISTORY_POINT *point,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetPointInfo(unsigned long key,char *name,HISTORY_POINT *point);
+
+extern "C" EDOSPROXYAPI_API int SendData(unsigned long key,unsigned char *data,unsigned long len);
+
+extern "C" EDOSPROXYAPI_API int CreateStringPoint(unsigned long key,HISTORY_STRING_POINT point);
+
+extern "C" EDOSPROXYAPI_API int UpdateStringPoint(unsigned long key,HISTORY_STRING_POINT point);
+
+extern "C" EDOSPROXYAPI_API int DeleteStringPoint(unsigned long key,HISTORY_STRING_POINT point);
+
+extern "C" EDOSPROXYAPI_API int SendMultiStringPoint(unsigned long key,POINT_STRING_VALUE *recs,unsigned short nCount);
+
+extern "C" EDOSPROXYAPI_API int SendSingleStringPoint(unsigned long key,char *name,HISTORY_STRING_VALUE *recs,unsigned short nCount);
+
+extern "C" EDOSPROXYAPI_API int GetPointsUnderStringHistory(unsigned long key,char *history,int start,int count,HISTORY_STRING_POINT *point,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetStringRTValue(unsigned long key,char *name,HISTORY_STRING_VALUE *rec);
+
+extern "C" EDOSPROXYAPI_API int GetStringRTValueList(unsigned long key,char **nameList,HISTORY_STRING_VALUE *rec,int nCount);
+
+extern "C" EDOSPROXYAPI_API int GetStringHistoryPoints(unsigned long key,HISTORY service,char *filterName,char *filterDesc,char *filterInstance,char * filterInstanceAttribute,char * filterInstanceAttributeDescription,char *type,HISTORY_STRING_POINT *point,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetStringHistSnap(unsigned long key,char *name,int tStart,int tEnd,int period,HISTORY_STRING_VALUE *rec,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetStringHistRaw(unsigned long key,char *name,int tStart,int tEnd,HISTORY_STRING_VALUE *rec,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetStringHistMatrix(unsigned long key,char **nameList,int tTime,HISTORY_STRING_VALUE *rec,int nCount);
+
+extern "C" EDOSPROXYAPI_API int UpdateStringPointData(unsigned long key,char *name,HISTORY_STRING_VALUE *rec,unsigned short nCount);
+
+extern "C" EDOSPROXYAPI_API int GetInstanceStringPoints(unsigned long key,char *instance,int start,int count,HISTORY_STRING_POINT *point,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int CreateStringService(unsigned long key,HISTORY service);
+
+extern "C" EDOSPROXYAPI_API int UpdateStringService(unsigned long key,HISTORY service);
+
+extern "C" EDOSPROXYAPI_API int DeleteStringService(unsigned long key,HISTORY service);
+
+extern "C" EDOSPROXYAPI_API int GetStringPointInfo(unsigned long key,char *name,HISTORY_STRING_POINT *point);
+
+extern "C" EDOSPROXYAPI_API int LoadAllTypes(unsigned long key,TYPE_INSTANCE_INFO *types,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetPointInstancesUnderType(unsigned long key,char* type,POINT_INSTANCE_INFO *rec,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int DeletePointData(unsigned long key,char *name,int tStart,int tEnd);
+
+extern "C" EDOSPROXYAPI_API int GetPointStat(unsigned long key,char *name,POINT_INFO* info);
+
+extern "C" EDOSPROXYAPI_API bool IsConnected(unsigned long key);
+
+extern "C" EDOSPROXYAPI_API int DisposeKey(unsigned long key);
+
+extern "C" EDOSPROXYAPI_API int CreateOrUpdatePointExtendData(unsigned long key,char *name,POINT_EXTEND_DATA data);
+
+extern "C" EDOSPROXYAPI_API int SearchPointExtendData(unsigned long key,char *name,POINT_EXTEND_DATA *data);
+
+extern "C" EDOSPROXYAPI_API int DeletePointExtendData(unsigned long key,char *name);
+
+extern "C" EDOSPROXYAPI_API int SearchPointExtendBackUpData(unsigned long key,char *name,int tStart,int tEnd,POINT_EXTEND_BACKUP_DATA *data,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetStringHistSnapRaw(unsigned long key,char *name,int tStart,int tEnd,int period,HISTORY_STRING_VALUE *rec,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetHistSnapRaw(unsigned long key,char *name,int tStart,int tEnd,int period,HISTORY_VALUE *rec,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int CreateOrUpdateInstanceDesc(unsigned long key,POINT_INSTANCE_DESC desc);
+
+extern "C" EDOSPROXYAPI_API int RemoveInstanceDesc(unsigned long key,char *instanceName);
+
+extern "C" EDOSPROXYAPI_API int SearchInstance(unsigned long key,char *type,char *description,char *system,char *subSystem,POINT_INSTANCE_INFO *rec,int nCount,int *retsize);
+
+extern "C" EDOSPROXYAPI_API int CreateImageService(unsigned long key, HISTORY service);
+
+extern "C" EDOSPROXYAPI_API int UpdateImageService(unsigned long key, HISTORY service);
+
+extern "C" EDOSPROXYAPI_API int DeleteImageService(unsigned long key, HISTORY service);
+
+extern "C" EDOSPROXYAPI_API int CreateImagePoint(unsigned long key, HISTORY_IMAGE_POINT point);
+
+extern "C" EDOSPROXYAPI_API int UpdateImagePoint(unsigned long key, HISTORY_IMAGE_POINT point);
+
+extern "C" EDOSPROXYAPI_API int DeleteImagePoint(unsigned long key, HISTORY_IMAGE_POINT point);
+
+extern "C" EDOSPROXYAPI_API int SendMultiImagePoint(unsigned long key, POINT_IMAGE_VALUE *recs, unsigned short nCount);
+
+extern "C" EDOSPROXYAPI_API int SendSingleImagePoint(unsigned long key, char *name, HISTORY_IMAGE_VALUE *recs, unsigned short nCount);
+
+extern "C" EDOSPROXYAPI_API int GetPointsUnderImageHistory(unsigned long key, char *history, int start, int count, HISTORY_IMAGE_POINT *point, int nCount, int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetImageRTValue(unsigned long key, char *name, HISTORY_IMAGE_VALUE *rec);
+
+extern "C" EDOSPROXYAPI_API int GetImageRTValueList(unsigned long key, char **nameList, HISTORY_IMAGE_VALUE *rec, int nCount);
+
+extern "C" EDOSPROXYAPI_API int GetImageHistoryPoints(unsigned long key, HISTORY service, char *filterName, char *filterDesc, char *filterInstance, char * filterInstanceAttribute, char * filterInstanceAttributeDescription, char *type, HISTORY_IMAGE_POINT *point, int nCount, int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetImageHistSnap(unsigned long key, char *name, int tStart, int tEnd, int period, HISTORY_IMAGE_VALUE *rec, int nCount, int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetImageHistSnapRaw(unsigned long key, char *name, int tStart, int tEnd, int period, HISTORY_IMAGE_VALUE *rec, int nCount, int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetImageHistRaw(unsigned long key, char *name, int tStart, int tEnd, HISTORY_IMAGE_VALUE *rec, int nCount, int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetImageHistMatrix(unsigned long key, char **nameList, int tTime, HISTORY_IMAGE_VALUE *rec, int nCount);
+
+extern "C" EDOSPROXYAPI_API int GetInstanceImagePoints(unsigned long key, char *instance, int start, int count, HISTORY_IMAGE_POINT *point, int nCount, int *retsize);
+
+extern "C" EDOSPROXYAPI_API int GetImagePointInfo(unsigned long key, char *name, HISTORY_IMAGE_POINT *point);
+
+extern "C" EDOSPROXYAPI_API int UpdateImagePointData(unsigned long key, char *name, HISTORY_IMAGE_VALUE *rec, unsigned short nCount);
+
+extern "C" EDOSPROXYAPI_API int TracePoint(unsigned long key, char *name);
+
+#pragma pack(pop, __EDOS_PROXY__)
+
+#endif

二进制
transport/redis2taos/src/main/lib/eDosProxyApi.lib


二进制
transport/redis2taos/src/main/lib/jna.jar


二进制
transport/redis2taos/src/main/lib/ojdbc6.jar


+ 67 - 0
transport/redis2taos/src/main/resources/application-hf.yaml

@@ -0,0 +1,67 @@
+server:
+  port: 8085
+
+spring:
+  datasource:
+    driver-class-name: oracle.jdbc.OracleDriver
+    url: jdbc:oracle:thin:@10.0.118.71:1521:gdsj
+    username: gdprod
+    password: gd123
+    type: com.alibaba.druid.pool.DruidDataSource
+    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
+  application:
+    name: transport
+  jpa:
+    show-sql: false
+  cache:
+    type: SIMPLE
+
+knife4j:
+  redis:
+    # 是否采用json序列化方式,若不采用jackson序列化
+    jsonSerialType: 'Fastjson'
+    host: 10.0.118.76
+    password:
+    port: 6379
+    databases: [0] # 要使用的库,会根据此处填写的库生成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: redis
+#taoscz场站数据 数据连接方式分为两种 JDBC-JNI和JDBC-RESTful
+#JDBC-JNI方式驱动为com.taosdata.jdbc.TSDBDriver 端口为6030
+#JDBC-RESTful方式驱动为com.taosdata.jdbc.rs.RestfulDriver 端口为6041
+taoscz:
+  server_ip: 10.0.118.76
+  server_port: 6030
+  db_name: hfxny
+  user_name: root
+  password: taosdata
+  pool_size: 10
+  max_pool_size: 100
+  driver_type: com.taosdata.jdbc.TSDBDriver
+
+#是否缓存所有风机测点
+isLoadAllTag: true
+
+
+
+
+
+

+ 86 - 0
transport/redis2taos/src/main/resources/application-nx1q.yaml

@@ -0,0 +1,86 @@
+server:
+  port: 8085
+
+spring:
+  application:
+    name: transport
+  jpa:
+    show-sql: false
+  cache:
+    type: SIMPLE
+  datasource:
+    driver-class-name: oracle.jdbc.OracleDriver
+    url: jdbc:oracle:thin:@18.6.30.55:1521:gdnxfd
+    username: nxfdprod
+    password: gdnxfd123
+    type: com.alibaba.druid.pool.DruidDataSource
+    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
+
+knife4j:
+  redis:
+    # 是否采用json序列化方式,若不采用jackson序列化
+    jsonSerialType: 'Fastjson'
+    host: 18.6.30.75
+    password: 123456
+    port: 6379
+    databases: [0] # 要使用的库,会根据此处填写的库生成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: redis
+#taoscz场站数据 数据连接方式分为两种 JDBC-JNI和JDBC-RESTful
+#JDBC-JNI方式驱动为com.taosdata.jdbc.TSDBDriver 端口为6030
+#JDBC-RESTful方式驱动为com.taosdata.jdbc.rs.RestfulDriver 端口为6041
+taoscz:
+#  server_ip: 192.168.1.252
+#  server_port: 6030
+#  db_name: hnj_fdc
+#  user_name: root
+#  password: taosdata
+#  pool_size: 10
+#  max_pool_size: 100
+#  driver_type: com.taosdata.jdbc.TSDBDriver
+
+#  server_ip: 123.60.219.66
+#  server_port: 6041
+#  db_name: hnj_fdc
+#  user_name: root
+#  password: taosdata
+#  pool_size: 10
+#  max_pool_size: 100
+#  driver_type: com.taosdata.jdbc.rs.RestfulDriver
+
+  server_ip: 192.168.1.67
+  server_port: 6041
+  db_name: gdnxxny
+  user_name: root
+  password: taosdata
+  pool_size: 10
+  max_pool_size: 100
+  driver_type: com.taosdata.jdbc.rs.RestfulDriver
+
+#是否缓存所有风机测点
+isLoadAllTag: false
+
+redis:
+  host: 18.6.30.75
+  port: 6379
+  password: 123456
+
+

+ 69 - 0
transport/redis2taos/src/main/resources/application-xnj.yaml

@@ -0,0 +1,69 @@
+server:
+  port: 8085
+
+spring:
+  datasource:
+#    driver-class-name: org.postgresql.Driver
+#    url: jdbc:postgresql://123.60.219.66:5432/wisdom_cs
+#    username: postgres
+#    password: gyeepd@123
+    driver-class-name: oracle.jdbc.OracleDriver
+    url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
+    username: nxfdprod
+    password: gdnxfd123
+    type: com.alibaba.druid.pool.DruidDataSource
+    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
+
+knife4j:
+  redis:
+    # 是否采用json序列化方式,若不采用jackson序列化
+    jsonSerialType: 'Fastjson'
+    host: 192.168.126.128
+    password: zghww693
+    port: 6379
+    databases: [0] # 要使用的库,会根据此处填写的库生成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: redis
+
+#适配器链接taos数据库配置信息
+taoscz:
+  server_ip: 192.168.126.128
+  server_port: 6030
+  db_name: nxxny
+  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测点的超级表名
+  ai_stable_name: pointai
+  #taos中di测点的超级表名
+  di_stable_name: pointdi
+
+#是否缓存所有风机测点
+isLoadAllTag: false
+
+
+
+
+
+

+ 35 - 13
transport/redis2taos/src/main/resources/application.yaml

@@ -1,6 +1,7 @@
 server:
   port: 8085
-  connection-timeout: 3000
+  tomcat:
+    connection-timeout: 3000
 
 spring:
   application:
@@ -11,15 +12,16 @@ spring:
     type: SIMPLE
   datasource:
     # -------------------------1区mysql/2区oracle---------------------------------------
-    #    driver-class-name: oracle.jdbc.OracleDriver
-    #    url: jdbc:oracle:thin:@123.60.213.70:1521:gdnxfd
-    #    username: nxfdprod
-    #    password: gdnxfd123
+    driver-class-name: oracle.jdbc.OracleDriver
+    #url: jdbc:oracle:thin:@123.60.213.70:1521:gdnxfd
+    url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
+    username: nxfdprod
+    password: gdnxfd123
     # ----------------------------------------------------------------
-    driver-class-name: com.mysql.jdbc.Driver
-    url: jdbc:mysql://192.168.1.252/wisdom_cs?useUnicode=true&characterEncoding=UTF-8
-    username: root
-    password: 123456
+#    driver-class-name: com.mysql.jdbc.Driver
+#    url: jdbc:mysql://192.168.1.252/wisdom_cs?useUnicode=true&characterEncoding=UTF-8
+#    username: root
+#    password: 123456
     # ----------------------------------------------------------------
     type: com.alibaba.druid.pool.DruidDataSource
     druid:
@@ -32,6 +34,8 @@ spring:
       test-while-idle: true
       test-on-borrow: false
       test-on-return: false
+  profiles:
+    active: xnj
 
 knife4j:
   redis:
@@ -56,14 +60,32 @@ timeseries:
 #JDBC-JNI方式驱动为com.taosdata.jdbc.TSDBDriver 端口为6030
 #JDBC-RESTful方式驱动为com.taosdata.jdbc.rs.RestfulDriver 端口为6041
 taoscz:
-  server_ip: 192.168.1.252
-  server_port: 6030
-  db_name: hnj_fdc
+#  server_ip: 192.168.1.252
+#  server_port: 6030
+#  db_name: hnj_fdc
+#  user_name: root
+#  password: taosdata
+#  pool_size: 10
+#  max_pool_size: 100
+#  driver_type: com.taosdata.jdbc.TSDBDriver
+
+#  server_ip: 123.60.219.66
+#  server_port: 6041
+#  db_name: hnj_fdc
+#  user_name: root
+#  password: taosdata
+#  pool_size: 10
+#  max_pool_size: 100
+#  driver_type: com.taosdata.jdbc.rs.RestfulDriver
+
+  server_ip: 192.168.1.67
+  server_port: 6041
+  db_name: gdnxxny
   user_name: root
   password: taosdata
   pool_size: 10
   max_pool_size: 100
-  driver_type: com.taosdata.jdbc.TSDBDriver
+  driver_type: com.taosdata.jdbc.rs.RestfulDriver
 
 #是否缓存所有风机测点
 isLoadAllTag: true

+ 3 - 3
warning-web/build.gradle

@@ -25,8 +25,8 @@ tasks.named('test') {
 dependencies {
 
     implementation project(":common:utils")
-   //implementation fileTree(dir: "src/main/lib", include: "*.jar")
-   //implementation ("mysql:mysql-connector-java:$mysqlConnectorVersion")
+    implementation fileTree(dir: "src/main/lib", include: "*.jar")
+   implementation ("mysql:mysql-connector-java:$mysqlConnectorVersion")
     implementation ("org.postgresql:postgresql:$postgresqlDriverVersion")
 
     implementation("org.apache.commons:commons-lang3:$commonsLang3Version")
@@ -47,7 +47,7 @@ dependencies {
 
     implementation "com.baomidou:mybatis-plus-boot-starter:3.1.1"
     implementation "com.baomidou:mybatis-plus-generator:3.1.1"
-    implementation("com.taosdata.jdbc:taos-jdbcdriver:2.0.35") {
+    implementation("com.taosdata.jdbc:taos-jdbcdriver:$taosVersion") {
         exclude group: 'com.alibaba', module: 'fastjson'
     }
     testImplementation("$bootGroup:spring-boot-starter-test")

文件差异内容过多而无法显示
+ 22 - 1
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/AlarmCountController.java


+ 18 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/AlarmGrafanaContorller.java

@@ -0,0 +1,18 @@
+package com.gyee.wisdom.alarm.sharding.controller;
+
+import com.gyee.wisdom.alarm.sharding.entity.AlarmSnap;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/alarm")
+@CrossOrigin
+public class AlarmGrafanaContorller {
+
+
+    @PostMapping("/grafana")
+    public void grafana(@RequestBody Object alarmInfos) {
+
+    }
+}

+ 1 - 1
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/Alertrule2Controller.java

@@ -113,7 +113,7 @@ public class Alertrule2Controller {
 //        Claims claims = TokenUtil.parseJWT(token);
 //        AlarmUser userData= JSONObject.parseObject(claims.getSubject(),AlarmUser.class);
 //        IPage<Alertrule2> pageResult = alertrule2Service.pageQueryAll(userData,page, name,station,modelId,rank,category,enabled,relatedparts);
-//
+            if("QT".equals(relatedparts)) relatedparts = "JC";
           IPage<Alertrule2> pageResult = alertrule2Service.pageQueryAll2(page, name,station,modelId,rank,category,enabled,relatedparts);
 
         return pageResult;

+ 1 - 1
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/schedule/FaultStatScheduled.java

@@ -26,7 +26,7 @@ public class FaultStatScheduled {
     @Autowired
     private FaultStatisticWindturbineService faultStatisticWindturbineService;
 
-    /*@Scheduled(cron = "0 20 0 ? * *")*/
+    @Scheduled(cron = "0 02 11 ? * *")
     public String doTask() throws Exception {
         if (!fault) {
             return null;

+ 5 - 4
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/AlarmCountService.java

@@ -247,16 +247,17 @@ public class AlarmCountService extends ServiceImpl<AlarmCountMapper, AlarmCount>
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
             Date dtStart = sdf.parse(startDate);
             Date dtEnd = sdf.parse(endDate);
-
-            if (StringUtil.isNotBlank(stationId) && dtEnd.after(dtStart))
-                return alarmCountMapper.statAlarmCount1(stationId, dtStart, dtEnd);
+            List<AlarmStat1> alarmStat1s = new ArrayList<>();
+            if (StringUtil.isNotBlank(stationId) && dtEnd.after(dtStart)){
+                alarmStat1s = alarmCountMapper.statAlarmCount1(stationId, dtStart, dtEnd);
+            }
+                return alarmStat1s;
 
         } catch (Exception ex) {
             log.error(ex.getMessage());
             log.error(ex.getStackTrace().toString());
             return null;
         }
-        return null;
     }
 
     public List<AlarmStat1> statAlarmCount2(String stationId, Date currentDate) throws Exception {

+ 5 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/AlarmUserService.java

@@ -81,6 +81,11 @@ public class AlarmUserService {
         }
     }
 
+    public static void main(String[] args) {
+        String md5str = DigestUtils.md5Hex("admin@123"+"gdnxfd");
+        System.out.println(md5str);
+    }
+
     public AlarmUser login2(AlarmUser user) {
 
 

+ 5 - 4
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/Alertrule2Service.java

@@ -183,7 +183,7 @@ public class Alertrule2Service extends ServiceImpl<Alertrule2Mapper, Alertrule2>
         Map<String, Integer> map2 = new HashMap<>();
         map2.put("CLX", 0);
         map2.put("YP", 0);
-        map2.put("YY", 0);
+        map2.put("YYXT", 0);
         map2.put("BJXT", 0);
         map2.put("PHXT", 0);
         map2.put("BPXT", 0);
@@ -205,9 +205,9 @@ public class Alertrule2Service extends ServiceImpl<Alertrule2Mapper, Alertrule2>
                     cnt = map2.get("YP").intValue();
                     map2.put("YP", ++cnt);
                     break;
-                case "YY":
-                    cnt = map2.get("YY").intValue();
-                    map2.put("YY", ++cnt);
+                case "YYXT":
+                    cnt = map2.get("YYXT").intValue();
+                    map2.put("YYXT", ++cnt);
                     break;
                 case "BJXT":
                     cnt = map2.get("BJXT").intValue();
@@ -236,6 +236,7 @@ public class Alertrule2Service extends ServiceImpl<Alertrule2Mapper, Alertrule2>
                 default:
                     cnt = map2.get("QT").intValue();
                     map2.put("QT", ++cnt);
+                    System.out.println(ar.getRelatedParts());
                     break;
             }
         }

+ 93 - 0
warning-web/src/main/resources/application-hnj.yaml

@@ -0,0 +1,93 @@
+server:
+  port: 8075
+
+spring:
+  application:
+    name: alarm-sharding
+  datasource:
+    driver-class-name: com.mysql.jdbc.Driver
+#    url: jdbc:mysql://192.168.1.252/wisdom_cs?useUnicode=true&characterEncoding=UTF-8
+#    username: root
+#    password: 123456
+    url: jdbc:mysql://192.168.126.128/wisdom_cs?useUnicode=true&characterEncoding=UTF-8
+    username: root
+    password: zghww693
+#    driver-class-name: oracle.jdbc.OracleDriver
+#    url: jdbc:oracle:thin:@123.60.213.70:1521:gdnxfd
+#    username: nxfdprod
+#    password: gdnxfd123
+    type: com.alibaba.druid.pool.DruidDataSource
+    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
+  jackson:
+    date-format: yyyy-MM-dd HH:mm:ss
+    time-zone: GMT+8
+    default-property-inclusion: always
+
+
+mybatis-plus:
+  typeAliasesPackage: com.gyee.wisdom.alarm.sharding.entity
+#  mapper-locations: file:mappers/*.xml
+  mapper-locations: classpath:mappers-mysql/*.xml
+  global-config:
+    #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+    id-type: 3
+    #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+    field-strategy: 2
+    #驼峰下划线转换
+    db-column-underline: true
+    #mp2.3+ 全局表前缀 mp_
+    #table-prefix: mp_
+    #刷新mapper 调试神器
+    #refresh-mapper: true
+    #数据库大写下划线转换
+    #capital-mode: true
+    # Sequence序列接口实现类配置
+    key-generator: com.baomidou.mybatisplus.incrementer.OracleKeyGenerator
+    #逻辑删除配置(下面3个配置)
+    logic-delete-value: 1
+    logic-not-delete-value: 0
+    #sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector
+    #自定义填充策略接口实现
+    #meta-object-handler: com.baomidou.springboot.MyMetaObjectHandler
+  configuration:
+    #配置返回数据库(column下划线命名&&返回java实体是驼峰命名),自动匹配无需as(没开启这个,SQL需要写as: select user_id as userId)
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+    #配置JdbcTypeForNull, oracle数据库必须配置
+    jdbc-type-for-null: 'null'
+    callSettersOnNulls: true
+
+logging:
+  level:
+    com:
+      gyee:
+        wisdom:
+          alarm:
+            sharding:
+              mapper: debug
+              service: info
+
+sharding:
+  config:
+    #分表开始时间  格式:yyyy-MM-dd
+    startDate: 2018-01-01
+count:
+  custom: true
+  fault: false
+stationname:
+  HNJ
+#tablespace: TS_GDSJ_DATA
+tablespace: TS_NXFD_DATA
+adapterUrl: http://192.168.1.252:8012/ts
+rule_encryption: false
+homestat: 
+ alertIds: ZX003,ZX005,ZX010,ZX037,ZX039,ZX032,ZX008

+ 103 - 0
warning-web/src/main/resources/application-nx.yaml

@@ -0,0 +1,103 @@
+server:
+  port: 8075
+
+spring:
+  application:
+    name: warning-web
+#  #springboot2.6后默认不支持循环依赖,因此暴力设置允许循环依赖,轻易不要使用
+#  main:
+#    allow-circular-references: true
+  mvc:
+    pathmatch:
+      matching-strategy: ANT_PATH_MATCHER
+  http:
+    encoding:
+      force: true
+      charset: UTF-8
+      enabled: true
+  datasource:
+    driver-class-name: oracle.jdbc.OracleDriver
+    url: jdbc:oracle:thin:@192.168.1.105:1521:gdnxfd
+    #url: jdbc:oracle:thin:@123.60.213.70:1521:gdnxfd
+    username: nxfdprod
+    password: gdnxfd123
+#    driver-class-name: com.mysql.cj.jdbc.Driver
+#    url: jdbc:mysql://123.60.219.66/wisdom_cs?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
+#    username: root
+#    password: gyeepd@123
+    type: com.alibaba.druid.pool.DruidDataSource
+    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
+  jackson:
+    date-format: yyyy-MM-dd HH:mm:ss
+    time-zone: GMT+8
+    default-property-inclusion: always
+
+mybatis-plus:
+  typeAliasesPackage: com.gyee.wisdom.alarm.sharding.entity
+  mapper-locations: classpath:mappers-oracle/*.xml
+  global-config:
+    #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+    id-type: 3
+    #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+    field-strategy: 2
+    #驼峰下划线转换
+    db-column-underline: true
+    #mp2.3+ 全局表前缀 mp_
+    #table-prefix: mp_
+    #刷新mapper 调试神器
+    #refresh-mapper: true
+    #数据库大写下划线转换
+    #capital-mode: true
+    # Sequence序列接口实现类配置
+    key-generator: com.baomidou.mybatisplus.incrementer.OracleKeyGenerator
+    #逻辑删除配置(下面3个配置)
+    logic-delete-value: 1
+    logic-not-delete-value: 0
+    #sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector
+    #自定义填充策略接口实现
+    #meta-object-handler: com.baomidou.springboot.MyMetaObjectHandler
+  configuration:
+    #配置返回数据库(column下划线命名&&返回java实体是驼峰命名),自动匹配无需as(没开启这个,SQL需要写as: select user_id as userId)
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+    #配置JdbcTypeForNull, oracle数据库必须配置
+    jdbc-type-for-null: 'null'
+    callSettersOnNulls: true
+
+logging:
+  level:
+    com:
+      gyee:
+        wisdom:
+          alarm:
+            sharding:
+              mapper: debug
+              service: info
+
+sharding:
+  config:
+    #分表开始时间  格式:yyyy-MM-dd
+    startDate: 2018-01-01
+count:
+  custom: true
+  fault: true
+stationname: MHS,XS,NSS,QS,SBQ,DWK,HZJ,MCH,PL,XH,XS
+#tablespace: TS_GDSJ_DATA
+tablespace: TS_NXFD_DATA
+adapterUrl: http://123.60.219.66:8011/ts
+rule_encryption: true
+rule_encryption_key: gyee-alarm123456
+#升压站开关首页top查询是否显示解除的流水,默认为true
+syz_kg_relieve_show: false
+
+homestat:
+  alertIds: HD03,HD04,HD06,HD07,HD13,HD15,HD19,HD31

+ 94 - 0
warning-web/src/main/resources/application-ys.yaml

@@ -0,0 +1,94 @@
+server:
+  port: 8075
+
+spring:
+  application:
+    name: warning-web
+  mvc:
+    pathmatch:
+      matching-strategy: ANT_PATH_MATCHER
+  http:
+    encoding:
+      force: true
+      charset: UTF-8
+      enabled: true
+  datasource:
+    driver-class-name: org.postgresql.Driver
+    url: jdbc:postgresql://123.60.219.66:5432/early_warning
+    username: postgres
+    password: gyeepd@123 #HDgyee1234
+    type: com.alibaba.druid.pool.DruidDataSource
+    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
+  jackson:
+    date-format: yyyy-MM-dd HH:mm:ss
+    time-zone: GMT+8
+    default-property-inclusion: always
+
+mybatis-plus:
+  typeAliasesPackage: com.gyee.wisdom.alarm.sharding.entity
+  mapper-locations: classpath:mappers-postgresql/*.xml
+  global-config:
+    #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+    id-type: 3
+    #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+    field-strategy: 2
+    #驼峰下划线转换
+    db-column-underline: true
+    #mp2.3+ 全局表前缀 mp_
+    #table-prefix: mp_
+    #刷新mapper 调试神器
+    #refresh-mapper: true
+    #数据库大写下划线转换
+    #capital-mode: true
+    # Sequence序列接口实现类配置
+    key-generator: com.baomidou.mybatisplus.incrementer.OracleKeyGenerator
+    #逻辑删除配置(下面3个配置)
+    logic-delete-value: 1
+    logic-not-delete-value: 0
+    #sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector
+    #自定义填充策略接口实现
+    #meta-object-handler: com.baomidou.springboot.MyMetaObjectHandler
+  configuration:
+    #配置返回数据库(column下划线命名&&返回java实体是驼峰命名),自动匹配无需as(没开启这个,SQL需要写as: select user_id as userId)
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+    #配置JdbcTypeForNull, oracle数据库必须配置
+    jdbc-type-for-null: 'null'
+    callSettersOnNulls: true
+
+logging:
+  level:
+    com:
+      gyee:
+        wisdom:
+          alarm:
+            sharding:
+              mapper: debug
+              service: info
+
+sharding:
+  config:
+    #分表开始时间  格式:yyyy-MM-dd
+    startDate: 2018-01-01
+count:
+  custom: true
+  fault: true
+stationname: MHS,XS,NSS,QS,SBQ,DWK,HZJ,MCH,PL,XH,XS
+tablespace: TS_NXFD_DATA
+adapterUrl: http://123.60.219.66:8011/ts
+rule_encryption: true
+rule_encryption_key: gyee-alarm123456
+#升压站开关首页top查询是否显示解除的流水,默认为true
+syz_kg_relieve_show: false
+
+homestat:
+  alertIds: HD03,HD04,HD06,HD07,HD13,HD15,HD19,HD31

+ 4 - 1
warning-web/src/main/resources/application.yaml

@@ -2,6 +2,8 @@
   port: 8075
 
 spring:
+  profiles:
+    active: ys
   application:
     name: warning-web
 #  #springboot2.6后默认不支持循环依赖,因此暴力设置允许循环依赖,轻易不要使用
@@ -93,7 +95,8 @@ count:
 stationname: MHS,XS,NSS,QS,SBQ,DWK,HZJ,MCH,PL,XH,XS
 #tablespace: TS_GDSJ_DATA
 tablespace: TS_NXFD_DATA
-adapterUrl: http://123.60.219.66:8011/ts
+#adapterUrl: http://123.60.219.66:8011/ts
+adapterUrl: http://localhost:8011/ts
 rule_encryption: true
 rule_encryption_key: gyee-alarm123456
 #升压站开关首页top查询是否显示解除的流水,默认为true

+ 159 - 0
warning-web/src/main/resources/mappers-mysql/AlarmCountMapper.xml

@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.AlarmCountMapper">
+
+    <insert id="singleInsert" >
+        insert into alarmcount (id, alarmdate, snapid, count)
+        values
+        (#{item.id}, #{item.alarmdate}, #{item.snapId}, #{item.count})
+    </insert>
+
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
+        insert into alarmcount ( ID, alarmdate, snapid, count,time )
+        <foreach collection="list" item="item" index="index" separator="union all" >
+            ( select
+            #{item.id}, #{item.alarmDate}, #{item.snapId}, #{item.count} ,#{item.time}
+            from dual )
+        </foreach>
+    </insert>
+
+
+
+    <select id="selectAlarmHistoryBySnapid" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmHistory"  >
+             select * from ${alarmhistory} where snapid = #{snapid}
+             and alerttime &gt;= #{startdate,jdbcType=DATE} and alerttime &lt; #{enddate,jdbcType=DATE} order by alerttime asc
+    </select>
+
+
+
+
+    <select id="statAlarmCount1" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmStat1"  >
+        select t.*, s.stationid, s.windturbineid, s.alerttext from (
+            select snapid, sum(count) as count,sum(time) time from alarmcount a
+            left join alarmsnap ss on a.snapid = ss.id
+            where ss.stationid = #{stationid} and ss.windturbineid is not null
+            and alarmdate &gt;= #{startdate,jdbcType=DATE} and alarmdate &lt; #{enddate,jdbcType=DATE}
+            group by snapid ) t
+        left join alarmsnap s on t.snapid = s.id
+        order by s.windturbineid
+    </select>
+
+    <select id="statAlarmCount5" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmStat1"  >
+        select * from alarmcount a
+            LEFT JOIN alarmsnap s on a.snapid = s.id
+        <where>
+            1=1
+            <if test="startdate !=null and enddate !=null">
+                and a.alarmdate &gt;= #{startdate,jdbcType=DATE} and a.alarmdate &lt;= #{enddate,jdbcType=DATE}
+            </if>
+            <if test="stationid !=null and stationid !=''">
+                and s.stationid=#{stationid}
+            </if>
+            <if test="windturbineid !=null and windturbineid !=''">
+                and s.windturbineid=#{windturbineid}
+            </if>
+        </where>
+    </select>
+
+    <select id="statAlarmCount" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmStat"  >
+        select t.snapid, t.count as sum, t.times as times, s.windturbineid as wtnum, s.alerttext as text from (
+        select snapid, sum(count)  as count, sum(time) as times  from alarmcount a
+        left join alarmsnap ss on a.snapid = ss.id
+        where ss.stationid = #{stationid} and ss.windturbineid is not null
+        and alarmdate >= #{startdate,jdbcType=DATE} and alarmdate &lt;= #{enddate,jdbcType=DATE}
+        group by snapid ) t
+        left join alarmsnap s on t.snapid = s.id
+        order by s.windturbineid
+    </select>
+
+    <select id="statAlarmCount3" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmStat"  >
+        select t.snapid, t.count as sum, t.times as times, s.windturbineid as wtnum, s.alerttext as text from (
+            select snapid, sum(count)  as count, sum(time) as times  from alarmcount a
+            left join alarmsnap ss on a.snapid = ss.id
+        <where>
+        1=1
+            <if test="startdate !=null and enddate !=null">
+                and a.alarmdate &gt;= #{startdate,jdbcType=DATE} and a.alarmdate &lt;= #{enddate,jdbcType=DATE}
+            </if>
+            <if test="stationid !=null and stationid !=''">
+                and ss.stationid=#{stationid}
+            </if>
+            <if test="windturbineid !=null and windturbineid !=''">
+                and ss.windturbineid=#{windturbineid}
+            </if>
+        </where>
+            group by snapid ) t
+            left join alarmsnap s on t.snapid = s.id
+        order by s.windturbineid
+    </select>
+
+    <select id="statAlarmCountByName" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmStat"  >
+        select t.count as sum,t.times as times, s.windturbineid as wtnum, s.alerttext as text from (
+        select snapid, sum(count)  as count, sum(time) as times  from alarmcount a
+        left join alarmsnap ss on a.snapid = ss.id
+        where ss.alerttext=#{name} and ss.stationid = #{stationid} and ss.windturbineid is not null
+        and alarmdate >= #{startdate,jdbcType=DATE} and alarmdate &lt;= #{enddate,jdbcType=DATE}
+        group by snapid ) t
+        left join alarmsnap s on t.snapid = s.id
+        order by s.windturbineid
+    </select>
+
+    <select id="selectAlertRuleNames" resultType="com.gyee.wisdom.alarm.sharding.model.CodeValue" >
+        select name as code, description as value from alertrule2 group by name, description
+    </select>
+
+
+    <select id="statAlarmCount2" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmStat1">
+        select t.*, s.stationid, s.windturbineid, s.alerttext from (
+            select snapid, sum(count) as count,sum(time) time from alarmcount a
+            left join alarmsnap ss on a.snapid = ss.id
+            where
+            ss.windturbineid is not null
+            and a.alarmdate &gt;= #{currentDate,jdbcType=DATE}
+            <if test="stationid !=null and stationid !=''">
+                and  ss.stationid = #{stationid}
+            </if>
+            group by snapid ) t
+        left join alarmsnap s on t.snapid = s.id
+        order by s.windturbineid
+    </select>
+
+    <select id="getAlarmCountInfo" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmCountInfo">
+        SELECT
+            a.id, a.alarmdate,a.snapid,a.count, a.time,
+            s.ALERTTEXT, s.WINDTURBINEID, s.RANK,
+            r.id as alertruleid, r.relatedParts, r.PROJECT
+        FROM
+            alarmcount a
+        LEFT JOIN alarmsnap s ON a.snapid = s.id
+        LEFT JOIN alertrule2 r ON s.ALERTVALUE = r.ednaValue
+        WHERE
+            a.alarmdate = #{currentDate}
+        AND s.windturbineid = #{windturbineid}
+    </select>
+
+    <select id="selectBySnapId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmCount">
+        select * from alarmcount a
+        <where>
+            1=1
+            <if test="dtStart !=null and dtEnd !=null">
+                and a.alarmdate &gt;= #{dtStart,jdbcType=DATE} and a.alarmdate &lt;= #{dtEnd,jdbcType=DATE}
+            </if>
+            <if test="id !=null and id !=''">
+                and a.snapid=#{id}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectAlarmCountBydate" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmStat">
+        select s.id as snapid, s.category3 as parts,t.count as sum,t.times as times, s.windturbineid as wtnum,s.windturbinename as wname, s.alerttext as text,s.alertValue as alertvalue from (
+            select snapid, sum(count)  as count, sum(time) as times  from alarmcount a
+            left join alarmsnap ss on a.snapid = ss.id
+            where ss.windturbineid is not null
+            and alarmdate >= #{dtStart,jdbcType=DATE} and alarmdate &lt;= #{dtEnd,jdbcType=DATE}
+            group by snapid ) t
+            left join alarmsnap s on t.snapid = s.id
+
+    </select>
+
+</mapper>

+ 230 - 0
warning-web/src/main/resources/mappers-mysql/AlarmHistoryMapper.xml

@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.AlarmHisotryMapper">
+
+    <insert id="singleInsert" >
+        insert into ${tbName} (id, alerttime, messagetype,snapid, datainfo)
+        values
+        (#{item.id}, #{item.alertTime}, #{item.messageType},#{item.snapId},#{item.dataInfo})
+    </insert>
+
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
+        insert into ${tbName} ( ID, ALERTTIME, MESSAGETYPE, SNAPID, DATAINFO,ALERTTEXTLAST)
+        <foreach collection="list" item="item" index="index" separator="union all" >
+            ( select
+            #{item.id}, #{item.alertTime}, #{item.messageType},#{item.snapId},#{item.dataInfo},#{item.alertTextLast}
+            from dual )
+        </foreach>
+    </insert>
+
+    <!--<insert id="batchInsert" useGeneratedKeys="false">-->
+        <!--INSERT ALL-->
+        <!--<foreach item="item" index="index" collection="list">-->
+            <!--into ${tbName}-->
+            <!--values-->
+            <!--(#{item.id}, #{item.alertTime}, #{item.messageType},#{item.snapId},#{item.dataInfo})-->
+        <!--</foreach>-->
+        <!--SELECT 1 FROM DUAL-->
+    <!--</insert>-->
+
+    <!-- 单表查询 -->
+    <select id="pageQueryAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.model.AlarmHistoryInfo">
+        select a.*,
+        b.stationid,
+        b.windturbineid,
+        b.projectid,
+        b.lineid,
+        b.alertvalue,
+        b.category1,
+        b.category2,
+        b.category3,
+        b.rank,
+        b.stationname,
+        b.projectname,
+        b.linename,
+        b.windturbinename,
+        b.alerttext,
+        b.modelid
+        from ${tbName} a
+        left join alarmsnap b on a.snapid = b.id
+        <where>
+            1=1
+            <if test="starttime !=null and endtime !=null">
+                and a.alerttime &gt;= #{starttime} and a.alerttime &lt;= #{endtime}
+            </if>
+            <if test="stid !=null and stid !=''">
+                and b.stationid=#{stid}
+            </if>
+            <if test="wtid !=null and wtid !=''">
+                and b.windturbineid=#{wtid}
+            </if>
+            <if test="category1 !=null and category1 !=''">
+                and b.category1=#{category1}
+            </if>
+            <if test="category2 !=null and category2 !=''">
+                and b.category2=#{category2}
+            </if>
+            <if test="rank !=null and rank !=''">
+                and b.rank=#{rank}
+            </if>
+            <if test="modelid !=null and modelid !=''">
+                and b.modelid=#{modelid}
+            </if>
+            <if test="snapid !=null ">
+                and a.snapid=#{snapid}
+            </if>
+            <if test="messagetype !=null ">
+                and a.messagetype=#{messagetype}
+            </if>
+            <if test="keyword !=null and keyword !=''">
+                and b.alerttext like '%${keyword}%'
+            </if>
+        </where>
+        order by a.alerttime  desc
+    </select>
+
+
+    <!-- 联合查询 -->
+    <select id="pageQueryAll2" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.model.AlarmHistoryInfo">
+        select a.*,
+        b.stationid,
+        b.windturbineid,
+        b.projectid,
+        b.lineid,
+        b.alertvalue,
+        b.category1,
+        b.category2,
+        b.category3,
+        b.rank,
+        b.stationname,
+        b.projectname,
+        b.linename,
+        b.windturbinename,
+        b.alerttext,
+        b.modelid
+        from (
+        <foreach collection="simpleStationIdList" item="station" index="index" separator="union">
+            select * from alarmhistory_${station}_${yearmonth}
+        </foreach>
+        ) a
+        left join alarmsnap b on a.snapid = b.id
+        <where>
+            1=1
+            <if test="starttime !=null and endtime !=null">
+                and a.alerttime &gt;= #{starttime,jdbcType=DATE} and a.alerttime &lt;= #{endtime,jdbcType=DATE}
+            </if>
+            <if test="stid !=null and stid !=''">
+                and b.stationid=#{stid}
+            </if>
+            <if test="wtid !=null and wtid !=''">
+                and b.windturbineid=#{wtid}
+            </if>
+            <if test="category1 !=null and category1 !=''">
+                and b.category1=#{category1}
+            </if>
+            <if test="category2 !=null and category2 !=''">
+                and b.category2=#{category2}
+            </if>
+            <if test="rank !=null and rank !=''">
+                and b.rank=#{rank}
+            </if>
+            <if test="modelid !=null and modelid !=''">
+                and b.modelid=#{modelid}
+            </if>
+            <if test="snapid !=null ">
+                and a.snapid=#{snapid}
+            </if>
+            <if test="messagetype !=null ">
+                and a.messagetype=#{messagetype}
+            </if>
+            <if test="keyword !=null and keyword !=''">
+                and b.alerttext like '%${keyword}%'
+            </if>
+        </where>
+        order by a.alerttime  desc
+    </select>
+
+    <select id="selectSnapCount" parameterType="java.util.Map" resultType="java.lang.Integer">
+        select count(*) from ${tbName} where snapid = #{snapid}
+            and messagetype = '1'
+            and alerttime &gt;= #{starttime,jdbcType=DATE} and alerttime &lt; #{endtime,jdbcType=DATE}
+    </select>
+
+    <select id="selectAlarmSnapCount" parameterType="java.util.Map" resultType="java.lang.Integer">
+        select count(*) from ${tbName} where id = #{id}
+    </select>
+
+    <select id="selectAlarmHistory" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmHistory">
+        select * from ${tbName} where snapid = #{snapid}
+                                  and messagetype = '1'
+                                  and alerttime &gt;= #{starttime,jdbcType=DATE} and alerttime &lt; #{endtime,jdbcType=DATE}
+    </select>
+
+    <select id="selectHistoryAlarmSnapAndWarning"
+            resultType="com.gyee.wisdom.alarm.sharding.entity.FaultWarning">
+
+        select h.id,
+        a.stationid,
+        h.snapid,
+        a.windturbineid,
+        a.windturbinename,
+        a.lastupdatetime,
+        w.ednavalue,
+        h.alerttime,
+        w.warningtypeid
+        from ${tbName} h
+        left join alarmsnap a on h.snapid = a.id
+        left join warning2 w on a.alertvalue = w.ednavalue
+        and a.modelid = w.modelid
+        <where>
+            and a.category1 = 'windturbine'
+            and h.messagetype = '1'
+            and
+            <if test="starttime !=null and endtime !=null">
+                h.alerttime  &gt;= #{starttime,jdbcType=DATE} and h.alerttime  &lt; #{endtime,jdbcType=DATE}
+            </if>
+        </where>
+
+
+    </select>
+
+    <update id="timedCreatTable">
+        CREATE TABLE alarmhistory_${stationname}_${yearmonth} (
+                                                   `ID` decimal(65,0) NOT NULL,
+                                                   `ALERTTIME` datetime(6) NOT NULL,
+                                                   `MESSAGETYPE` char(1) NOT NULL,
+                                                   `SNAPID` decimal(65,0) NOT NULL,
+                                                   `DATAINFO` text,
+                                                   `ALERTTEXTLAST` varchar(50)
+        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+    </update>
+    <update id="timedAlterTable">
+        alter table alarmhistory_${stationname}_${yearmonth}
+            add primary key (`id`)
+    </update>
+    <update id="timedCreatAlerttimeIndex">
+        create index IX_AH_${stationname}_${yearmonth}_ALARMTIME on alarmhistory_${stationname}_${yearmonth} (alerttime)
+    </update>
+    <update id="timedCreatSnapidIndex">
+        create index IX_AH_${stationname}_${yearmonth}_SNAPID on alarmhistory_${stationname}_${yearmonth} (snapid)
+    </update>
+    <select id="isHasTable" resultType="java.lang.Integer">
+        select count(*) from information_schema.TABLES where table_name =upper('ALARMHISTORY_${stationname}_${yearmonth}')
+    </select>
+
+    <select id="getlatestAlarmHistory" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.model.AlarmHistoryInfo">
+        SELECT * FROM  ${tbName} a
+        <where>
+            <if test="snapId !=null and snapId !=''">
+                and a.SNAPID=#{snapId}
+            </if>
+            <if test="messageType !=null and messageType !=''">
+                and a.MESSAGETYPE=#{messageType}
+            </if>
+            <if test="starttime !=null and endtime !=null">
+                and a.alerttime &gt;= #{starttime,jdbcType=DATE} and a.alerttime &lt;= #{endtime,jdbcType=DATE}
+            </if>
+        </where>
+        order by a.ALERTTIME DESC LIMIT 0,1
+    </select>
+</mapper>

+ 14 - 0
warning-web/src/main/resources/mappers-mysql/AlarmPartsCountMapper.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.AlarmPartsCountMapper">
+
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
+        insert into alarmpartscount ( ID, alarmdate, parts,count,windturbineid )
+        <foreach collection="list" item="item" index="index" separator="union all" >
+            ( select
+            #{item.id}, #{item.alarmDate},#{item.parts},#{item.count},#{item.windturbineId}
+            from dual )
+        </foreach>
+    </insert>
+
+</mapper>

+ 14 - 0
warning-web/src/main/resources/mappers-mysql/AlarmRuleCountMapper.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.AlarmRuleCountMapper">
+
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
+        insert into alarmrulecount ( ID, alarmdate, parts,rulesid,count,windturbineid)
+        <foreach collection="list" item="item" index="index" separator="union all" >
+            ( select
+            #{item.id}, #{item.alarmDate},#{item.parts},#{item.rulesId},#{item.count},#{item.windturbineId}
+            from dual )
+        </foreach>
+    </insert>
+
+</mapper>

+ 154 - 0
warning-web/src/main/resources/mappers-mysql/AlarmSnapMapper.xml

@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.AlarmSnapMapper">
+
+    <select id="queryAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
+        select * from ALARMSNAP a
+        <where>
+            1=1
+            <if test="starttime !=null and endtime !=null">
+                and lastupdatetime &gt;= #{starttime,jdbcType=DATE} and lastupdatetime &lt;= #{endtime,jdbcType=DATE}
+            </if>
+            <if test="stid !=null and stid !=''">
+                and a.stationid=#{stid}
+            </if>
+            <if test="wtid !=null and wtid !=''">
+                and a.windturbineid=#{wtid}
+            </if>
+            <if test="category1 !=null and category1 !=''">
+                and a.category1=#{category1}
+            </if>
+            <if test="category2 !=null and category2 !=''">
+                and a.category2=#{category2}
+            </if>
+            <if test="rank !=null and rank !=''">
+                and a.rank=#{rank}
+            </if>
+            <if test="modelid !=null and modelid !=''">
+                and a.modelid=#{modelid}
+            </if>
+            <if test="isopened !=null ">
+                and a.isopened=#{isopened}
+            </if>
+            <if test="keyword !=null and keyword !=''">
+                and a.alerttext like '%${keyword}%'
+            </if>
+        </where>
+        order by a.lastupdatetime desc
+    </select>
+
+    <select id="pageQueryAll" parameterType="java.util.Map"
+            resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
+        select * from ALARMSNAP a
+        <where>
+            1=1
+            <if test="starttime !=null and endtime !=null">
+                and lastupdatetime &gt;= #{starttime,jdbcType=DATE} and lastupdatetime &lt;= #{endtime,jdbcType=DATE}
+            </if>
+            <if test="stid !=null and stid !=''">
+                and a.stationid=#{stid}
+            </if>
+            <if test="wtid !=null and wtid !=''">
+                and a.windturbineid=#{wtid}
+            </if>
+            <if test="category1 !=null and category1 !=''">
+                and a.category1=#{category1}
+            </if>
+            <if test="category2 !=null and category2 !=''">
+                and a.category2=#{category2}
+            </if>
+            <if test="rank !=null and rank !=''">
+                and a.rank=#{rank}
+            </if>
+            <if test="modelid !=null and modelid !=''">
+                and a.modelid=#{modelid}
+            </if>
+            <if test="isopened !=null ">
+                and a.isopened=#{isopened}
+            </if>
+            <if test="keyword !=null and keyword !=''">
+                and a.alerttext like '%${keyword}%'
+            </if>
+        </where>
+        order by a.lastupdatetime desc
+    </select>
+
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
+        insert into alarmsnap ( ID, STATIONID, PROJECTID, LINEID, WINDTURBINEID, ALERTVALUE, CATEGORY1, CATEGORY2,
+        CATEGORY3, RANK, ISOPENED, LASTUPDATETIME, STATIONNAME, PROJECTNAME, LINENAME, WINDTURBINENAME, ALERTTEXT,
+        MODELID, TESTINGPOINTKEY, DATAINFO )
+        <foreach collection="list" item="item" index="index" separator="union all">
+            ( select
+            #{item.id},#{item.stationId},#{item.projectId},#{item.lineId},#{item.windturbineId},
+            #{item.alertValue},#{item.category1},#{item.category2},#{item.category3},#{item.rank},
+            #{item.isOpened},#{item.lastUpdateTime},#{item.stationName},#{item.projectName},
+            #{item.lineName},#{item.windturbineName},#{item.alertText},#{item.modelId},
+            #{item.testingpointKey},#{item.dataInfo}
+            from dual )
+        </foreach>
+    </insert>
+
+    <update id="batchUpdate" parameterType="java.util.List">
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
+            UPDATE ALARMSNAP
+            <set>
+                <if test="item.isOpened != null">ISOPENED = #{item.isOpened}</if>
+                <if test="item.lastUpdateTime != null">,LASTUPDATETIME = #{item.lastUpdateTime}</if>
+                <if test="item.category3 != null">,CATEGORY3 = #{item.category3}</if>
+                <if test="item.dataInfo != null">,DATAINFO = #{item.dataInfo}</if>
+            </set>
+            <where>
+                <if test="item.id != null">
+                    and id = #{item.id}
+                </if>
+            </where>
+        </foreach>
+    </update>
+
+    <select id="findByStationIdAndAlertValue" parameterType="java.util.Map"
+            resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
+        select * from ALARMSNAP a
+        <where>
+            a.stationid=#{stationid} and a.alertvalue = #{alertvalue} limit 1
+        </where>
+    </select>
+
+    <select id="findByWindturbineIdAndAlertValue" parameterType="java.util.Map"
+            resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
+        select * from ALARMSNAP a
+        <where>
+            a.windturbineid=#{windturbineid} and a.alertvalue = #{alertvalue} limit 1
+        </where>
+    </select>
+
+    <select id="findByTestingpointkey" parameterType="java.util.Map"
+            resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
+        select * from ALARMSNAP a
+        <where>
+            a.testingpointkey=#{testingpointkey} limit 1
+        </where>
+    </select>
+
+    <select id="getTopNumAlarm" parameterType="java.util.Map"
+            resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
+        <!--select * from ( select * from alarmsnap h
+                        where isOpened=1
+        order by h.lastupdatetime desc) t
+        where t.category1 = #{category1} limit 0,#{topnum}-->
+        SELECT *
+        FROM alarmsnap h
+        WHERE h.isOpened = 1
+          AND h.lastupdatetime > DATE_SUB(NOW(), INTERVAL 1 DAY)
+          AND h.category1 = #{category1}
+        ORDER BY h.lastupdatetime DESC
+            LIMIT #{topnum}
+    </select>
+
+    <select id="getRecentAlarm" parameterType="java.util.Map"
+            resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmSnap">
+        SELECT * FROM alarmsnap
+        WHERE category1 = #{category1} and lastupdatetime >= #{lastupdatetime}
+        order by lastupdatetime desc
+    </select>
+
+</mapper>

+ 35 - 0
warning-web/src/main/resources/mappers-mysql/AlarmUserMapper.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.AlarmUserMapper">
+
+    <select id="login" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmUser">
+        select * from  ALARM_USER a
+        <where>
+            1=1
+            <if test="userName !=null and userName !=''">
+                and a.username=#{userName}
+            </if>
+            <if test="passWord !=null and passWord !=''">
+                and a.password=#{passWord}
+            </if>
+        </where>
+    </select>
+
+    <select id="getUserByUserName" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmUser">
+        select * from  ALARM_USER a
+        <where>
+            1=1
+            <if test="userName !=null and userName !=''">
+                and a.username=#{userName}
+            </if>
+
+        </where>
+    </select>
+    <select id="getAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlarmUser">
+        select * from  ALARM_USER a
+    </select>
+
+    <delete id="deleteByIds" parameterType="String">
+        delete from ALARM_USER where id = #{id}
+    </delete>
+</mapper>

+ 9 - 0
warning-web/src/main/resources/mappers-mysql/AlertKnowledge.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.AlertKnowledgeMapper">
+
+
+    <select id="searchAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.AlertKnowledge">
+        select * from  ALERT_KNOWLEDGE a
+    </select>
+</mapper>

+ 280 - 0
warning-web/src/main/resources/mappers-mysql/Alertrule2Mapper.xml

@@ -0,0 +1,280 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.Alertrule2Mapper">
+    <resultMap id="BaseResultMap" type="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        <!--
+          WARNING - @mbg.generated
+          This element is automatically generated by MyBatis Generator, do not modify.
+        -->
+        <id column="id" property="id" />
+        <result column="name"  property="name" />
+        <result column="description"  property="description" />
+        <result column="expression"  property="expression" />
+        <result column="rank"  property="rank" />
+        <result column="rank"  property="rank" />
+        <result column="enabled"  property="enabled" />
+        <result column="modelId"  property="modelId" />
+        <result column="ednaValue"  property="ednaValue" />
+        <result column="category"  property="category" />
+        <result column="range"  property="range" />
+        <result column="station"  property="station" />
+        <result column="windturbine"  property="windturbine" />
+        <result column="line"  property="line" />
+        <result column="project"  property="project" />
+        <result column="electrical"  property="electrical" />
+        <result column="taskstart"  property="taskstart" />
+        <result column="relatedParts"  property="relatedParts" />
+    </resultMap>
+    <resultMap type="Alertrule2" id="Alertrule2Result">
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="station"    column="station"    />
+        <result property="relatedParts"    column="relatedParts"    />
+        <association  property="windPowerStation"  column="station"     javaType="WindPowerStation"  select="com.gyee.wisdom.alarm.sharding.mapper.WindPowerStationMapper.selectByid"/>
+        <association  property="datadictionary"  column="relatedParts"     javaType="Datadictionary"  select="com.gyee.wisdom.alarm.sharding.mapper.DatadictionaryMapper.selectBycode"/>
+    </resultMap>
+    <select id="pageQueryAll" parameterType="java.util.Map" resultMap="Alertrule2Result">
+        select a.* from  ALERTRULE2 a
+        left join windpowerstation w on w.id = a.station
+        <where>
+            1=1
+
+            <if test="name !=null and name !=''">
+                and a.name like  '%${name}%'
+            </if>
+            <if test="station !=null and station !=''">
+                and a.station like  '%${station}%'
+            </if>
+            <if test="modelId !=null and modelId !=''">
+                and a.modelid like  '%${modelId}%'
+            </if>
+            <if test="rank !=null and rank !=''">
+                and a.rank = #{rank}
+            </if>
+            <if test="category !=null and category !=''">
+                and a.category = #{category}
+            </if>
+            <if test="enabled !=null and enabled !=''">
+                and a.enabled = #{enabled}
+            </if>
+            <if test="relatedparts !=null and relatedparts !=''">
+                and a.relatedparts = #{relatedparts}
+            </if>
+<!--            and a.range = 0-->
+        </where>
+
+    </select>
+
+    <select id="getAllByStationIdAndModelId2" parameterType="java.util.Map"
+            resultMap="Alertrule2Result">
+        select * from  ALERTRULE2 a
+        <where>
+            1=1
+            <if test="station !=null and station !=''">
+                and a.station = #{station}
+            </if>
+            <if test="modelid !=null and modelid !=''">
+                and a.modelid = #{modelid}
+            </if>
+        </where>
+    </select>
+
+    <select id="getMaxEdnaValue" parameterType="java.util.Map" resultType="java.lang.Integer">
+        select max(a.ednavalue) from  ALERTRULE2 a
+    </select>
+    <select id="getAllByStationIdAndModelId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        select * from  ALERTRULE2 a
+        <where>
+            1=1
+            <if test="idString !=null and idString !=''">
+                and a.id like  '%${idString}%'
+            </if>
+        </where>
+    </select>
+    <select id="getById" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        select * from  ALERTRULE2 a
+        <where>
+            1=1
+            <if test="idString !=null and idString !=''">
+                and a.id = #{idString}
+            </if>
+        </where>
+    </select>
+
+    <select id="quertByrelatedParts"  resultType="java.util.HashMap">
+        select a.name from  ALERTRULE2 a
+        where a.relatedparts = #{relatedParts}
+        group by a.name
+    </select>
+
+    <select id="queryTree" resultMap="Alertrule2Result" >
+        select distinct a.relatedparts,a.name,d.name from alertrule2 a
+        left join DATADICTIONARY d
+        on d.code = a.relatedparts
+        where
+        relatedparts is not null
+    </select>
+
+    <select id="queryMap" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        select t.relatedparts,d.name from
+            (select a.relatedparts from alertrule2 a
+             where relatedparts  is not null
+             group by a.relatedparts) t
+        left join DATADICTIONARY d
+        on d.code = t.relatedparts
+    </select>
+    <insert id="insertAlerture2" parameterType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2" useGeneratedKeys="true" keyProperty="id">
+        insert into alertrule2
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="name != null">Name,</if>
+            <if test="description != null">description,</if>
+            <if test="expression != null">expression,</if>
+            <if test="tag != null">tag,</if>
+            <if test="rank != null">rank,</if>
+            <if test="enabled != null">enabled,</if>
+            <if test="modelId != null">modelId,</if>
+            <if test="ednaValue != null">ednaValue,</if>
+            <if test="category != null">category,</if>
+            <if test="range != null">`range`,</if>
+            <if test="station != null">station,</if>
+            <if test="windturbine != null">windturbine,</if>
+            <if test="line != null">line,</if>
+            <if test="project != null">project,</if>
+            <if test="electrical != null">electrical,</if>
+            <if test="taskstart != null">taskstart,</if>
+            <if test="relatedParts != null">relatedParts,</if>
+            <if test="createtime != null">createtime</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="name != null">#{name},</if>
+            <if test="description != null">#{description},</if>
+            <if test="expression != null">#{expression},</if>
+            <if test="tag != null">#{tag},</if>
+            <if test="rank != null">#{rank},</if>
+            <if test="enabled != null">#{enabled},</if>
+            <if test="modelId != null">#{modelId},</if>
+            <if test="ednaValue != null">#{ednaValue},</if>
+            <if test="category != null">#{category},</if>
+            <if test="range != null">#{range},</if>
+            <if test="station != null">#{station},</if>
+            <if test="windturbine != null">#{windturbine},</if>
+            <if test="line != null">#{line},</if>
+            <if test="project != null">#{project},</if>
+            <if test="electrical != null">#{electrical},</if>
+            <if test="taskstart != null">#{taskstart},</if>
+            <if test="relatedParts != null">#{relatedParts},</if>
+            <if test="createtime != null">#{createtime}</if>
+        </trim>
+    </insert>
+    <update id="updateByAlertrule2Id" parameterType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        update alertrule2 a
+        <set >
+            <if test="name != null">a.name = #{name},</if>
+            <if test="description != null">a.description = #{description},</if>
+            <if test="expression != null">a.expression = #{expression},</if>
+            <if test="tag != null">a.tag = #{tag},</if>
+            <if test="rank != null">a.rank = #{rank},</if>
+            <if test="enabled != null">a.enabled = #{enabled},</if>
+            <if test="modelId != null">a.modelId = #{modelId},</if>
+            <if test="ednaValue != null and ednaValue!=0">a.ednaValue = #{ednaValue},</if>
+            <if test="category != null">a.category = #{category},</if>
+            <if test="range != null">a.range = #{range},</if>
+            <if test="station != null">a.station = #{station},</if>
+            <if test="windturbine != null">a.windturbine = #{windturbine},</if>
+            <if test="line != null">a.line = #{line},</if>
+            <if test="project != null">a.project = #{project},</if>
+            <if test="electrical != null">a.electrical = #{electrical},</if>
+            <if test="taskstart != null">a.taskstart = #{taskstart},</if>
+            <if test="relatedParts != null">a.relatedParts = #{relatedParts},</if>
+            <if test="createtime != null">a.createtime = #{createtime}</if>
+        </set>
+        where a.id = #{id}
+    </update>
+
+
+
+    <select id="selectByAlertrule2Id" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        select * from  alertrule2 a where a.id=#{id}
+    </select>
+
+    <select id="selectByNameAndSataionAndModelid" resultType="com.gyee.wisdom.alarm.sharding.entity.Alertrule2">
+        select * from  alertrule2 a
+        <where>
+            1=1
+            <if test="name !=null and name !=''">
+                and a.name = #{name}
+            </if>
+            <if test="station !=null and station !=''">
+                and a.station = #{station}
+            </if>
+            <if test="modelid !=null and modelid !=''">
+                and a.modelid = #{modelid}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectByExample" parameterType="com.gyee.wisdom.alarm.sharding.model.Alertrule2Example" resultMap="BaseResultMap">
+        <!--
+          WARNING - @mbg.generated
+          This element is automatically generated by MyBatis Generator, do not modify.
+        -->
+        select
+        <if test="distinct">
+            distinct
+        </if>
+        *
+<!--        <include refid="Base_Column_List" />-->
+        from ALERTRULE2
+        <if test="_parameter != null">
+            <include refid="Example_Where_Clause" />
+        </if>
+        <if test="orderByClause != null">
+            order by ${orderByClause}
+        </if>
+    </select>
+
+    <sql id="Base_Column_List">
+        <!--
+          WARNING - @mbg.generated
+          This element is automatically generated by MyBatis Generator, do not modify.
+        -->
+        id, name, description, expression, tag, rank, enabled, modelid, ednavalue, category,
+        range, station, windturbine, line, project, electrical, taskstart, relatedparts
+    </sql>
+
+    <sql id="Example_Where_Clause">
+        <!--
+          WARNING - @mbg.generated
+          This element is automatically generated by MyBatis Generator, do not modify.
+        -->
+        <where>
+            <foreach collection="oredCriteria" item="criteria" separator="or">
+                <if test="criteria.valid">
+                    <trim prefix="(" prefixOverrides="and" suffix=")">
+                        <foreach collection="criteria.criteria" item="criterion">
+                            <choose>
+                                <when test="criterion.noValue">
+                                    and ${criterion.condition}
+                                </when>
+                                <when test="criterion.singleValue">
+                                    and ${criterion.condition} #{criterion.value}
+                                </when>
+                                <when test="criterion.betweenValue">
+                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                                </when>
+                                <when test="criterion.listValue">
+                                    and ${criterion.condition}
+                                    <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                                        #{listItem}
+                                    </foreach>
+                                </when>
+                            </choose>
+                        </foreach>
+                    </trim>
+                </if>
+            </foreach>
+        </where>
+    </sql>
+</mapper>

+ 16 - 0
warning-web/src/main/resources/mappers-mysql/DatadictionaryMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.DatadictionaryMapper">
+
+
+    <select id="selectBycode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Datadictionary">
+        select * from Datadictionary where code = #{relatedParts}
+    </select>
+
+
+    <select id="getAllDatadictionary" resultType="com.gyee.wisdom.alarm.sharding.entity.Datadictionary" >
+        select * from Datadictionary a
+        where category = 'early_category'
+    </select>
+
+</mapper>

+ 56 - 0
warning-web/src/main/resources/mappers-mysql/DeviceFaultModeMapper.xml

@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.DeviceFaultModeMapper">
+
+    <select id="getDeviceFaultModeByDeviceId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceFaultMode">
+        select * from device_fault_mode a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+            </if>
+        </where>
+    </select>
+
+    <select id="getDeviceFaultModeByStructureCode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceFaultMode">
+        select * from device_fault_mode a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+                <if test="structureCode !=null and structureCode !=''">
+                    and a.structurecode like '${structureCode}%'
+                </if>
+            </if>
+
+        </where>
+    </select>
+
+    <select id="getDeviceFaultModeByCode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceFaultMode">
+        select * from device_fault_mode a
+        <where>
+            1=1
+            <if test="code !=null and code !=''">
+                    and a.code=#{code}
+            </if>
+        </where>
+    </select>
+
+    <select id="getDeviceFaultModeTree" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceFaultMode">
+        select * from device_fault_mode a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+                <if test="nodeCode !=null and nodeCode !=''">
+                    and a.code=#{nodeCode}
+                </if>
+            </if>
+
+        </where>
+    </select>
+
+    <delete id="deleteDeviceFaultMode" parameterType="Long">
+        delete from device_fault_mode where id = #{id}
+    </delete>
+</mapper>

+ 10 - 0
warning-web/src/main/resources/mappers-mysql/DeviceMapper.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.DeviceMapper">
+
+
+    <select id="getAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Device">
+        select * from  Device a
+    </select>
+
+</mapper>

+ 117 - 0
warning-web/src/main/resources/mappers-mysql/DeviceMetricsMapper.xml

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.DeviceMetricsMapper">
+    <resultMap type="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics" id="deviceModelMetricsResult">
+        <result property="id"    column="id"    />
+        <result property="deviceid"    column="deviceid"    />
+        <result property="structurecode"    column="structurecode"    />
+        <result property="metriccode"    column="metriccode"    />
+        <collection  property="deviceModelMetrics"  column="metriccode"      javaType="java.util.List"  select="com.gyee.wisdom.alarm.sharding.mapper.DeviceModelMetricsMapper.getDeviceModelMetricsById"/>
+    </resultMap>
+    <update id="updateByMetricsId" parameterType="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics">
+        update device_metrics
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="deviceid != null">deviceid = #{deviceid},</if>
+            <if test="structurecode != null">structurecode = #{structurecode},</if>
+            <if test="metriccode != null">metriccode = #{metriccode},</if>
+            <if test="name != null">name = #{name},</if>
+            <if test="enname != null">enname = #{enname},</if>
+            <if test="unitname != null">unitname = #{unitname},</if>
+            <if test="unitnamecn != null">unitnamecn = #{unitnamecn},</if>
+            <if test="categorydata != null">categorydata = #{categorydata},</if>
+            <if test="categorysci != null">categorysci = #{categorysci},</if>
+            <if test="categorysys != null">categorysys = #{categorysys},</if>
+            <if test="categoryres1 != null">categoryres1 = #{categoryres1},</if>
+            <if test="categoryres2 != null">categoryres2 = #{categoryres2},</if>
+            <if test="categoryres3 != null">categoryres3 = #{categoryres3},</if>
+            <if test="categoryres4 != null">categoryres4 = #{categoryres4},</if>
+            <if test="categoryres5 != null">categoryres5 = #{categoryres5},</if>
+            <if test="description != null">description = #{description},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <insert id="insertByMetrics" parameterType="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics" useGeneratedKeys="true">
+        insert into device_metrics(id, deviceid, structurecode, metriccode, name, enname,
+                                   unitname,unitnamecn,categorydata,categorysci,categorysys,categoryres1,categoryres2,categoryres3,categoryres4,categoryres5,description)
+        values (#{id}, #{deviceid}, #{structurecode},
+                #{metriccode}, #{name}, #{enname},#{unitname}, #{unitnamecn}, #{categorydata},#{categorysci},#{categorysys}, #{categoryres1}, #{categoryres2},#{categoryres3}, #{categoryres4}, #{categoryres5},#{description})
+    </insert>
+
+
+
+    <select id="getDeviceMetricsByDeviceId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics">
+        select * from device_metrics a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+            </if>
+        </where>
+        order by metriccode
+    </select>
+
+    <select id="getDeviceMetricsByStructureCode" parameterType="java.util.Map" resultMap="deviceModelMetricsResult">
+        select * from device_metrics a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+                <if test="structureCode !=null and structureCode !=''">
+                    and a.structurecode like '${structureCode}%'
+                </if>
+            </if>
+
+        </where>
+    </select>
+
+    <select id="pageQueryAll" parameterType="java.util.Map" resultMap="deviceModelMetricsResult">
+        select m.* from  device_metrics m
+        <if test="model !=null and model !=''">
+            inner join device_model_metrics mm ON mm.METRICCODE = m.METRICCODE
+        </if>
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and m.deviceId=#{deviceId}
+            </if>
+            <if test="categorydata !=null and categorydata !=''">
+                and m.categorydata=#{categorydata}
+            </if>
+            <if test="model !=null and model !=''">
+                and mm.devicemodel=#{model}
+            </if>
+            <if test="keyword !=null and keyword !=''">
+                and m.name like '%${keyword}%'
+            </if>
+            <if test="structureCode !=null and structureCode !=''">
+                and m.structurecode like '${structureCode}%'
+            </if>
+        </where>
+
+        order by m.metriccode  asc
+    </select>
+
+    <select id="getDeviceMetricsByCode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics">
+        select * from device_metrics a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+                <if test="metricCode !=null and metricCode !=''">
+                    and a.metricCode=#{metricCode}
+                </if>
+            </if>
+
+        </where>
+    </select>
+    <select id="selectByMetricsId" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics">
+        select id,deviceid,structurecode,metriccode,name,enname,unitname,unitnamecn,categorydata,categorysci,categorysys,categoryres1,categoryres2,
+               categoryres3,categoryres4,categoryres5,description from device_metrics where id=#{id}
+    </select>
+
+    <select id="selectByMetriccode" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceMetrics">
+        select * from device_metrics where metriccode=#{metriccode}
+    </select>
+
+</mapper>

+ 34 - 0
warning-web/src/main/resources/mappers-mysql/DeviceModelMapper.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.DeviceModelMapper">
+
+
+    <select id="getDeviceModelsById" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModel">
+        select * from device_model a
+        <where>
+            1=1
+            <if test="_parameter !=null and _parameter !=''">
+                and a.orderno=#{_parameter}
+            </if>
+        </where>
+    </select>
+
+    <select id="getDeviceModelByCode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModel">
+        select * from device_model a
+        <where>
+            1=1
+            <if test="deviceid !=null and deviceid !=''">
+                and a.deviceid=#{deviceid}
+                <if test="code !=null and code !=''">
+                    and a.code=#{code}
+                </if>
+            </if>
+
+        </where>
+    </select>
+
+    <select id="getAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModel">
+        select * from  device_model a
+    </select>
+
+</mapper>

+ 54 - 0
warning-web/src/main/resources/mappers-mysql/DeviceModelMetricsMapper.xml

@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.DeviceModelMetricsMapper">
+
+
+    <select id="getDeviceModelMetricsById" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModelMetrics">
+        select * from device_model_metrics a
+        <where>
+            1=1
+            <if test="_parameter  !=null and _parameter  !=''">
+                and a.metriccode=#{_parameter }
+            </if>
+        </where>
+    </select>
+
+    <select id="getAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModelMetrics">
+        select * from  device_model_metrics a
+    </select>
+    <select id="selectModelMetricsById" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModelMetrics">
+        select * from  device_model_metrics a where a.id=#{id}
+    </select>
+    <update id="updateModelMetricsById" parameterType="com.gyee.wisdom.alarm.sharding.entity.DeviceModelMetrics">
+        update device_model_metrics
+        <set >
+            <if test="deviceid != null">deviceid = #{deviceid},</if>
+            <if test="devicemodel != null">devicemodel = #{devicemodel},</if>
+            <if test="metriccode != null">metriccode = #{metriccode},</if>
+            <if test="uniformcode != null">uniformcode = #{uniformcode},</if>
+            <if test="multiplier != null">multiplier = #{multiplier}</if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <insert id="insertModelMetrics" parameterType="com.gyee.wisdom.alarm.sharding.entity.DeviceModelMetrics" useGeneratedKeys="true">
+        insert into device_model_metrics(id, deviceid, devicemodel, metriccode, uniformcode,multiplier)
+        values (#{id}, #{deviceid}, #{devicemodel},#{metriccode}, #{uniformcode},#{multiplier})
+    </insert>
+
+    <select id="getDeviceModelMetrics" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceModelMetrics">
+        select * from device_model_metrics a
+        <where>
+            1=1
+            <if test="modelId  !=null and modelId  !=''">
+                and a.devicemodel =#{modelId}
+            </if>
+            <if test="metricCodeList !=null and metricCodeList.size > 0">
+                and a.metriccode in
+                <foreach collection="metricCodeList" item="metricCode" index="index" open="(" close=")" separator=",">
+                    #{metricCode}
+                </foreach>
+            </if>
+        </where>
+    </select>
+</mapper>

+ 48 - 0
warning-web/src/main/resources/mappers-mysql/DeviceStructureMapper.xml

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.DeviceStructureMapper">
+
+
+    <select id="getAllDeviceStructure" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceStructure">
+        select * from device_structure a
+    </select>
+
+    <select id="getDeviceStructureByDeviceId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceStructure">
+        select * from device_structure a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+            </if>
+        </where>
+    </select>
+
+    <select id="getDeviceStructureChildNode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceStructure">
+        select * from device_structure a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+                <if test="nodeCode !=null and nodeCode !=''">
+                    and a.parentCode=#{nodeCode}
+                </if>
+            </if>
+
+        </where>
+    </select>
+
+    <select id="getDeviceStructureByCode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.DeviceStructure">
+        select * from device_structure a
+        <where>
+            1=1
+            <if test="deviceId !=null and deviceId !=''">
+                and a.deviceId=#{deviceId}
+                <if test="nodeCode !=null and nodeCode !=''">
+                    and a.code=#{nodeCode}
+                </if>
+            </if>
+
+        </where>
+    </select>
+
+</mapper>

+ 7 - 0
warning-web/src/main/resources/mappers-mysql/EarlyReportAlarmMapper.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.EarlyReportAlarmMapper">
+
+
+
+</mapper>

+ 7 - 0
warning-web/src/main/resources/mappers-mysql/EarlyReportConclusionMapper.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.EarlyReportConclusionMapper">
+
+
+
+</mapper>

+ 7 - 0
warning-web/src/main/resources/mappers-mysql/EarlyReportMapper.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.EarlyReportMapper">
+
+
+
+</mapper>

+ 7 - 0
warning-web/src/main/resources/mappers-mysql/EarlyReportWindturbineMapper.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.EarlyReportWindturbineMapper">
+
+
+
+</mapper>

+ 18 - 0
warning-web/src/main/resources/mappers-mysql/EarlyWarnScoreMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.EarlyWarnScoreMapper">
+
+
+    <select id="getListEarlyWarnScore" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.EarlyWarnScore">
+        select * from earlywarnscore e
+        <where>
+            1=1
+            <if test="windturbineid !=null and windturbineid !=''">
+                and e.windturbineid = #{windturbineid}
+            </if>
+            and e.statdate =DATE_SUB(curdate(),INTERVAL 1 day)
+        </where>
+    </select>
+
+
+</mapper>

+ 17 - 0
warning-web/src/main/resources/mappers-mysql/ElectricalTestingPointAIMapper.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.ElectricalTestingPointAIMapper">
+
+    <select id="selectPointByStation" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.ElectricalTestingPointAI">
+        select * from  ELECTRICALTESTINGPOINTAI a
+        <where>
+            1=1
+            <if test="stationId !=null and stationId !=''">
+                and a.windpowerstationid = #{stationId}
+            </if>
+        </where>
+    </select>
+
+
+
+</mapper>

+ 17 - 0
warning-web/src/main/resources/mappers-mysql/ElectricalTestingPointDIMapper.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.ElectricalTestingPointDIMapper">
+
+    <select id="selectPointByStation" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.ElectricalTestingPointDI">
+        select * from  ELECTRICALTESTINGPOINTDI a
+        <where>
+            1=1
+            <if test="stationId !=null and stationId !=''">
+                and a.windpowerstationid = #{stationId}
+            </if>
+        </where>
+    </select>
+
+
+
+</mapper>

+ 10 - 0
warning-web/src/main/resources/mappers-mysql/EquipmentmodelMapper.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.EquipmentmodelMapper">
+
+
+    <select id="getAllEquipmentmodel" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Equipmentmodel">
+        select * from Equipmentmodel a
+    </select>
+
+</mapper>

+ 44 - 0
warning-web/src/main/resources/mappers-mysql/FaultHistoryMapper.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.FaultHisotryMapper">
+
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
+        insert into faulthistory (id, faulttime, operator, snapid,confirmtype, confirmtime, confirmperson,messagetype,alerttextlast)
+        <foreach collection="list" item="item" index="index" separator="union all" >
+            ( select
+            #{item.id}, #{item.faultTime}, #{item.operator},#{item.snapId},#{item.confirmType},#{item.confirmTime},#{item.confirmPerson},#{item.messageType},#{item.alertTextLast}
+            from dual )
+        </foreach>
+    </insert>
+
+
+
+    <select id="queryFaultHistoryById" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultHistory">
+        SELECT * FROM faulthistory
+        <where>
+            id=#{historyid}
+        </where>
+    </select>
+
+    <update id="faultClear" parameterType="java.util.Map">
+        UPDATE faulthistory  SET  CONFIRMTYPE=1   where FAULTTIME > #{startTime} AND FAULTTIME <![CDATA[ <= ]]>#{endTime}
+    </update>
+
+
+    <update id="batchConfirm" parameterType="java.util.Map">
+            UPDATE faulthistory  SET  CONFIRMTYPE=#{confirmType} ,CONFIRMPERSON=#{userName},ALERTSNAPID=#{alarmSnpaId},CONFIRMTIME=now()  where SNAPID = #{faultSnapId} and CONFIRMTYPE=0
+    </update>
+
+
+    <update id="updateHistoryById" parameterType="com.gyee.wisdom.alarm.sharding.entity.FaultHistory">
+        UPDATE
+        faulthistory
+        SET
+            CONFIRMTYPE = #{confirmType} ,
+            CONFIRMPERSON = #{confirmPerson} ,
+            ALERTSNAPID = #{alertSnapId} ,
+            CONFIRMTIME = #{confirmTime}
+        WHERE SNAPID = #{snapId}
+    </update>
+
+</mapper>

+ 122 - 0
warning-web/src/main/resources/mappers-mysql/FaultInfoMapper.xml

@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.FaultInfoMapper">
+
+    <select id="queryFaultInfo" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+        SELECT
+        h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
+        s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
+        s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
+        s.alertText,s.modelId
+        FROM
+        faulthistory h left join faultsnap s on h.snapid = s.id
+        <where>
+            1=1
+            <if test="starttime !=null and endtime !=null">
+                and h.faulttime &gt;= #{starttime} and h.faulttime &lt;= #{endtime}
+            </if>
+            <if test="stid !=null and stid !=''">
+                and s.stationid=#{stid}
+            </if>
+            <if test="keyword !=null and keyword !=''">
+                and s.alerttext like #{keyword}
+            </if>
+            <if test="messageType !=null and messageType !=''">
+                and h.messagetype = #{messageType}
+            </if>
+            <if test="likeString !=null and likeString !=''">
+                and (s.alerttext like '%故障停机状态%'  or s.alerttext like '%总故障%')
+            </if>
+
+        </where>
+        order by h.faultTime desc
+    </select>
+
+    <select id="getFaultInfoByIds" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+        SELECT
+        h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
+        s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
+        s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
+        s.alertText,s.modelId
+        FROM
+        faulthistory h left join faultsnap s on h.snapid = s.id
+            where h.id in
+        <foreach collection="array" item="ids" index="index" open="(" close=")" separator=",">
+            #{ids}
+        </foreach>
+        order by h.faultTime desc
+    </select>
+
+    <select id="getRecentFault" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+        SELECT
+        h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
+        s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
+        s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
+        s.alertText,s.modelId
+        FROM
+        faulthistory h left join faultsnap s on h.snapid = s.id
+        WHERE
+        h.confirmType = 0
+        AND s.isopened = 1
+        AND h.messageType = 1
+        AND h.faultTime >= #{faulttime}
+        order by h.faultTime desc
+    </select>
+    <select id="getRecentFault_bak" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+        SELECT
+        s.lastupdatetime as faultTime , s.isopened as messageType, s.id as snapID, '0' as confirmType,s.lastupdatetime as confirmTime, '' as confirmPerson,
+        s.id,
+        s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
+        s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
+        s.alertText,s.modelId
+        FROM
+        faultsnap s
+        WHERE
+        s.lastupdatetime >= #{faulttime}
+        order by s.lastupdatetime asc limit 0,16
+    </select>
+
+
+    <select id="getTopNumFault" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+        select * from (
+        SELECT
+        h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
+        s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
+        s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
+       (concat(concat(s.alertText,''),h.ALERTTEXTLAST)) AS alertText,s.modelId
+        FROM
+        faulthistory h left join faultsnap s on h.snapid = s.id
+        order by h.faultTime desc)
+         where limit 0,#{topnum}
+    </select>
+
+    <select id="queryFaultInfo1" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+        SELECT
+        h.id,h.faultTime,h.messageType,h.snapID,h.confirmType,h.confirmTime,h.confirmPerson,
+        s.stationId,s.projectId,s.lineId,s.windturbineId,s.alertValue,s.rank,s.category1,s.category2,s.category3,
+        s.isOpened,s.lastUpdateTime,s.lastUpdatePerson,s.stationName,s.projectName,s.lineName,s.windturbineName,
+        (concat(concat(s.alertText,''),h.ALERTTEXTLAST)) AS alertText,s.modelId
+        FROM
+        faulthistory h left join faultsnap s on h.snapid = s.id
+        <where>
+            1=1
+            <if test="starttime !=null and endtime !=null">
+                and h.faulttime &gt;= #{starttime} and h.faulttime &lt;= #{endtime}
+            </if>
+            <if test="stid !=null and stid !=''">
+                and s.stationid=#{stid}
+            </if>
+            <if test="keyword !=null and keyword !=''">
+                and s.alerttext like #{keyword}
+            </if>
+            <if test="category1 !=null and category1 !=''">
+                and s.category1=#{category1}
+            </if>
+            <if test="isopened !=null ">
+                and s.isopened=#{isopened}
+            </if>
+        </where>
+        order by h.faultTime desc
+    </select>
+
+</mapper>

+ 74 - 0
warning-web/src/main/resources/mappers-mysql/FaultSnapMapper.xml

@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.FaultSnapMapper">
+
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="false">
+        insert into faultsnap ( ID, STATIONID, PROJECTID, LINEID, WINDTURBINEID, ALERTVALUE, CATEGORY1, CATEGORY2, CATEGORY3, RANK, ISOPENED, LASTUPDATETIME, STATIONNAME, PROJECTNAME, LINENAME, WINDTURBINENAME, ALERTTEXT, MODELID, TESTINGPOINTKEY,ALARMSNAPID )
+        <foreach collection="list" item="item" index="index" separator="union all" >
+            ( select
+                #{item.id},#{item.stationId},#{item.projectId},#{item.lineId},#{item.windturbineId},
+                #{item.alertValue},#{item.category1},#{item.category2},#{item.category3},#{item.rank},
+                #{item.isOpened},#{item.lastUpdateTime},#{item.stationName},#{item.projectName},
+                #{item.lineName},#{item.windturbineName},#{item.alertText},#{item.modelId},
+                #{item.testingpointKey},#{item.alarmSnapId}
+            from dual )
+        </foreach>
+    </insert>
+
+    <update id="batchUpdate" parameterType="java.util.List">
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
+            UPDATE faultsnap
+            <set>
+                <if test="item.isOpened != null">ISOPENED = #{item.isOpened},</if>
+                <if test="item.lastUpdateTime != null">LASTUPDATETIME = #{item.lastUpdateTime},</if>
+                <if test="item.alertText != null">ALERTTEXT = #{item.alertText},</if>
+            </set>
+            <where>
+                <if test="item.id != null">
+                    and id = #{item.id}
+                </if>
+            </where>
+        </foreach>
+    </update>
+
+    <select id="findByAlarmSnapId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultSnap">
+        select * from  FAULTSNAP a
+        <where>
+            a.alarmsnapid=#{alarmSnapId}  limit 1
+        </where>
+    </select>
+
+
+
+    <select id="queryMultiFaultSnap" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultSnap">
+        select  ID,STATIONID,PROJECTID,LINEID,WINDTURBINEID,ALERTVALUE,CATEGORY1,CATEGORY2,CATEGORY3,RANK,ISOPENED,LASTUPDATETIME,LASTUPDATEPERSON,STATIONNAME,PROJECTNAME,LINENAME,WINDTURBINENAME,ALERTTEXT,MODELID,TESTINGPOINTKEY,ALARMSNAPID
+        from  FAULTSNAP a where a.id in
+        <foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </select>
+
+
+    <select id="queryByTagId" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultSnap">
+        select * from  FAULTSNAP a
+        <where>
+            a.testingpointkey=#{tagId} limit 1
+        </where>
+    </select>
+
+    <select id="queryByTimeAndStation"  resultType="com.gyee.wisdom.alarm.sharding.entity.FaultSnap">
+        select * from  FAULTSNAP a
+        <where>
+            a.LASTUPDATETIME &gt;= #{startTime}
+            and a.LASTUPDATETIME &lt;= #{endTime}
+            and a.STATIONID = #{stationId}
+            and a.CATEGORY1 = 'FJ'
+        </where>
+    </select>
+
+    <select id="getTopNumFault" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultSnap">
+        select * from ( select * from faultsnap h order by h.lastupdatetime desc) t
+         limit 0,#{topnum}
+    </select>
+
+</mapper>

+ 35 - 0
warning-web/src/main/resources/mappers-mysql/FaultStatisticWindturbineMapper.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.FaultStatisticWindturbineMapper">
+
+
+    <select id="selectFaultStatisticWindturbineByyearandmonth"
+            resultType="com.gyee.wisdom.alarm.sharding.entity.FaultStatisticWindturbine">
+
+        select *
+        from FaultStatisticWindturbine
+        <where>
+
+            <if test="year !=null and year !=''">
+                and year = #{year}
+            </if>
+
+            <if test="month !=null and month !=''">
+                and month = #{month}
+            </if>
+
+            <if test="warningtype !=null and warningtype !=''">
+                and warningtype =#{warningtype}
+            </if>
+            <if test="windturbineId !=null and windturbineId !=''">
+                and windturbineId = #{windturbineId}
+            </if>
+
+            <if test="stationid !=null and stationid !=''">
+                and windpowerstationid = #{stationid}
+            </if>
+
+        </where>
+
+    </select>
+</mapper>

+ 36 - 0
warning-web/src/main/resources/mappers-mysql/FeatureStatMapper.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.FeatureStatMapper">
+
+    <select id="searchByCondition" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FeatureStat">
+        select * from  FEATURE_STAT a
+        <where>
+            1=1
+            <if test="starttime !=null and endtime !=null">
+                and statdate &gt;= #{starttime,jdbcType=DATE} and statdate &lt; #{endtime,jdbcType=DATE}
+            </if>
+            <if test="stationId !=null and stationId !=''">
+                and a.stationid=#{stationId}
+            </if>
+        </where>
+        order by a.id  desc
+    </select>
+    <select id="searchAll" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FeatureStat">
+        select * from  FEATURE_STAT a   order by a.id  desc
+    </select>
+
+    <select id="searchByCondition2" resultType="com.gyee.wisdom.alarm.sharding.entity.FeatureStat">
+
+        select * from  FEATURE_STAT a
+        <where>
+            and statdate &gt;= #{currentDate,jdbcType=DATE}
+            <if test="stationId !=null and stationId !=''">
+                and a.stationid=#{stationId}
+            </if>
+        </where>
+        order by a.id  desc
+
+    </select>
+
+
+</mapper>

+ 6 - 0
warning-web/src/main/resources/mappers-mysql/InspectOrderMapper.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.InspectOrderMapper">
+
+
+</mapper>

+ 15 - 0
warning-web/src/main/resources/mappers-mysql/MainBrownouts2Mapper.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.MainBrownoutsMapper">
+
+    <select id="queryMainBrownouts2Count" resultType="java.util.Map">
+
+                        select count(t.id) count
+          from mainbrownouts2 t
+         where t.stoptime >=  #{currentDate,jdbcType=DATE}
+         order by t.stoptime desc
+
+
+    </select>
+</mapper>
+

+ 4 - 0
warning-web/src/main/resources/mappers-mysql/RiskHistoryMapper.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.RiskHistoryMapper">
+</mapper>

+ 4 - 0
warning-web/src/main/resources/mappers-mysql/RiskModelMapper.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.RiskModelMapper">
+</mapper>

+ 4 - 0
warning-web/src/main/resources/mappers-mysql/RiskModelRuleMapper.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.RiskModelRuleMapper">
+</mapper>

+ 4 - 0
warning-web/src/main/resources/mappers-mysql/RiskSnapMapper.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.RiskSnapMapper">
+</mapper>

+ 17 - 0
warning-web/src/main/resources/mappers-mysql/RuleUpdateEvent.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.RuleUpdateEventMapper">
+    <resultMap type="com.gyee.wisdom.alarm.sharding.entity.RuleUpdateEvent" id="ruleUpdateEventResult">
+        <result property="id" column="ID"/>
+        <result property="ruleType" column="RULETYPE"/>
+        <result property="ruleName" column="RULENAME"/>
+        <result property="ruleId" column="RULEID"/>
+        <result property="updateTime" column="UPDATETIME"/>
+        <result property="updateType" column="UPDATETYPE"/>
+        <result property="updateUser" column="UPDATEUSER"/>
+        <collection property="infoList" column="ID" javaType="java.util.List"
+                    ofType="com.gyee.wisdom.alarm.sharding.entity.RuleUpdateEventInfo"
+                    select="com.gyee.wisdom.alarm.sharding.mapper.RuleUpdateEventInfoMapper.getInfoByEventId"/>
+    </resultMap>
+
+</mapper>

+ 0 - 0
warning-web/src/main/resources/mappers-mysql/RuleUpdateEventInfo.xml


部分文件因为文件数量过多而无法显示