Browse Source

1.springboot框架由2.0.3.RELEASE升级为2.7.0
2.其他相应组件的升级
3.gradle 由5.x升级为7.x 添加依赖由compile 改为implementation/api,其中api可以进行依赖传递
4.所有工程的依赖版本进行统一管理(gradle.properties)
5.升级后jpa 分页类写法更改 new PageRequest(pageIndex, pageSize)->PageRequest.of(pageIndex, pageSize);
6.mysql-connecter 由5.1.28升级为8.0.28 配置文件写法
driver-class-name: com.mysql.jdbc.Driver 变为
driver-class-name: com.mysql.cj.jdbc.Driver
原来写法依旧可用,但建议修改为新写法
7.fastjson 全局序列化优化
8.其他相关依赖版本的升级,guava,commonslang3,fastjson,lombok等
9.feign没有升级,后续可能会升级为open-feign

wanghs 3 years ago
parent
commit
20c0ec53f3
47 changed files with 565 additions and 413 deletions
  1. 8 5
      build.gradle
  2. 5 12
      common/utils/build.gradle
  3. 11 9
      dao/dao-golden/build.gradle
  4. 6 4
      dao/dao-interface/build.gradle
  5. 16 14
      dao/dao-redis/build.gradle
  6. 10 8
      dao/dao-simulator/build.gradle
  7. 9 7
      dao/dao-sql/build.gradle
  8. 2 2
      dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/Windturbine/JpaPowerStationDao.java
  9. 2 2
      dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/alarm/JpaGyeePowerStationDao.java
  10. 1 1
      dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/point/JpaElectricalTestingPointDao.java
  11. 1 1
      dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/point/JpaLevelTypeTestingPointDao.java
  12. 1 1
      dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/point/JpaPowerStationTestingPointDao.java
  13. 1 1
      dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/point/JpaTestingPointDao.java
  14. 1 1
      dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/point/JpaWindturbineTestingPointDao.java
  15. 1 1
      dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/topic/JpaTopicDao.java
  16. 11 7
      dao/dao-taoscz/build.gradle
  17. 11 6
      gradle.properties
  18. 2 1
      gradle/wrapper/gradle-wrapper.properties
  19. 23 21
      schedule-job/alarm-schedule/build.gradle
  20. 24 20
      transport/redis2taos/build.gradle
  21. 8 8
      transport/redis2taos/src/main/resources/application.yaml
  22. 38 31
      warning-web/build.gradle
  23. 0 34
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/FastJsonHttpMessageConverterEx.java
  24. 20 5
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/InterceptorConfig.java
  25. 0 2
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/MyConfig.java
  26. 17 9
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/MyJsonConfig.java
  27. 22 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/MyStringSerializer.java
  28. 38 30
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/MyWebAppConfigurer.java
  29. 0 58
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/SwaggerConfig.java
  30. 3 1
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/AlarmCountController.java
  31. 9 10
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/AlertRuleEventLogController.java
  32. 6 6
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/Alertrule2Controller.java
  33. 14 13
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/DatadictionaryController.java
  34. 23 22
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/DeviceController.java
  35. 10 9
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/InfoController.java
  36. 8 6
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/ScadabjController.java
  37. 25 6
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/TestController.java
  38. 8 7
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/TestingPointDIController.java
  39. 85 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/UserSetController.java
  40. 8 6
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/Warning2Controller.java
  41. 2 2
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/entity/FaultInfo.java
  42. 5 6
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/AlarmCountService.java
  43. 30 1
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/DatadictionaryService.java
  44. 17 6
      warning-web/src/main/resources/application.yaml
  45. 8 9
      warning-web/src/main/resources/banner.txt
  46. 1 1
      warning-web/src/main/resources/mappers-oracle/FaultHistoryMapper.xml
  47. 14 1
      warning-web/src/main/resources/mappers/FaultInfoMapper.xml

+ 8 - 5
build.gradle

@@ -1,24 +1,27 @@
 subprojects {
-    apply plugin: "java"
+    apply plugin: "java-library"
     apply plugin: "idea"
     apply plugin: "eclipse"
-    apply plugin: "maven"
+    apply plugin: "maven-publish"
 
-    [compileJava,compileTestJava,javadoc]*.options*.encoding = "UTF-8"
+    [compileJava, compileTestJava, javadoc]*.options*.encoding = "UTF-8"
 
     configurations {
         all*.exclude module: "spring-boot-starter-tomcat"
         all*.exclude module: "spring-boot-starter-logging"
     }
 
-    dependencies{
+    dependencies {
         compileOnly("org.projectlombok:lombok:$lombokVersion")
         annotationProcessor("org.projectlombok:lombok:$lombokVersion")
     }
 
     repositories {
         mavenLocal()
-        maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
+        maven {
+            allowInsecureProtocol = true
+            url "http://maven.aliyun.com/nexus/content/groups/public/"
+        }
         mavenCentral()
     }
 }

+ 5 - 12
common/utils/build.gradle

@@ -2,16 +2,9 @@ buildscript {
 }
 
 dependencies {
-    compile("com.google.code.findbugs:jsr305:$jsr305Version")
-    compile("joda-time:joda-time:$jodaTimeVersion")
-    compile("commons-codec:commons-codec:$commonsCodecVersion")
-//    compile("org.apache.logging.log4j:log4j-api:$log4jVersion")
-//    compile("org.apache.logging.log4j:log4j-core:$log4jVersion")
-    compile("org.apache.commons:commons-lang3:$commonsLang3Version")
-    compile("com.google.guava:guava:$guavaVersion")
-    compile 'com.alibaba:fastjson:1.2.17'
-    //compile 'org.apache.commons:commons-lang3:3.4'
-    //compile 'commons-codec:commons-codec:1.10'
-    compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.3'
-    //compile 'com.google.guava:guava:19.0'
+    api("commons-codec:commons-codec:$commonsCodecVersion")
+    api("org.apache.commons:commons-lang3:$commonsLang3Version")
+    api("com.google.guava:guava:$guavaVersion")
+    api("com.alibaba:fastjson:$fastjsonVersion")
+    api("commons-beanutils:commons-beanutils:$commonsBeanUtilsVersion")
 }

+ 11 - 9
dao/dao-golden/build.gradle

@@ -1,7 +1,9 @@
 buildscript {
     repositories {
         mavenLocal()
-        maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
+        maven {
+            allowInsecureProtocol = true
+            url "http://maven.aliyun.com/nexus/content/groups/public" }
         mavenCentral()
     }
     dependencies {
@@ -15,12 +17,12 @@ bootJar.enabled = false
 jar.enabled = true
 
 dependencies {
-    compile project(":common:utils")
-    compile project(":common:data")
-    compile project(":dao:dao-interface")
-    compile fileTree(dir: 'src/main/lib', include: '*.jar')
-    compile('org.apache.logging.log4j:log4j-core:2.15.0')
-    compile('org.apache.logging.log4j:log4j-jul:2.15.0')
-    compile('org.apache.logging.log4j:log4j-api:2.15.0')
-    compile('org.apache.logging.log4j:log4j-slf4j-impl:2.15.0')
+    implementation project(":common:utils")
+    implementation project(":common:data")
+    implementation project(":dao:dao-interface")
+    implementation fileTree(dir: 'src/main/lib', include: '*.jar')
+    implementation("org.apache.logging.log4j:log4j-core:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-jul:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-api:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion")
 }

+ 6 - 4
dao/dao-interface/build.gradle

@@ -1,7 +1,9 @@
 buildscript {
     repositories {
         mavenLocal()
-        maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
+        maven {
+            allowInsecureProtocol = true
+            url "http://maven.aliyun.com/nexus/content/groups/public" }
         mavenCentral()
     }
     dependencies {
@@ -16,7 +18,7 @@ bootJar.enabled = false
 jar.enabled = true
 
 dependencies {
-    compile project(":common:data")
-    compile project(":common:utils")
-    compile("$bootGroup:spring-boot-starter")
+    implementation project(":common:data")
+    implementation project(":common:utils")
+    api("$bootGroup:spring-boot-starter")
 }

+ 16 - 14
dao/dao-redis/build.gradle

@@ -1,7 +1,9 @@
 buildscript {
     repositories {
         mavenLocal()
-        maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
+        maven {
+            allowInsecureProtocol = true
+            url "http://maven.aliyun.com/nexus/content/groups/public" }
         mavenCentral()
     }
     dependencies {
@@ -15,23 +17,23 @@ bootJar.enabled = false
 jar.enabled = true
 
 dependencies {
-    compile project(":common:utils")
-    compile project(":common:data")
-    compile project(":dao:dao-interface")
-    compile fileTree(dir: 'src/main/lib', include: '*.jar')
-    compile('org.apache.logging.log4j:log4j-core:2.15.0')
-    compile('org.apache.logging.log4j:log4j-jul:2.15.0')
-    compile('org.apache.logging.log4j:log4j-api:2.15.0')
-    compile('org.apache.logging.log4j:log4j-slf4j-impl:2.15.0')
+    implementation project(":common:utils")
+    implementation project(":common:data")
+    implementation project(":dao:dao-interface")
+    implementation fileTree(dir: 'src/main/lib', include: '*.jar')
+    implementation("org.apache.logging.log4j:log4j-core:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-jul:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-api:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion")
     //compile("com.github.it235:knife4j-redis-lettuce-stater")
 //    compile('org.springframework.boot:spring-boot-starter-data-redis')
 //    implementation "org.springframework.boot:spring-boot-starter-redis:1.3.5.RELEASE"
-    testCompile("$bootGroup:spring-boot-starter-test")
+    implementation("$bootGroup:spring-boot-starter-test")
     // https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt
-    compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.0'
-    compile 'org.apache.commons:commons-pool2'
-    compile("$bootGroup:spring-boot-starter-data-redis-reactive")
-    compile 'com.fasterxml.jackson.core:jackson-databind'
+    implementation group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.0'
+    implementation 'org.apache.commons:commons-pool2'
+    implementation("$bootGroup:spring-boot-starter-data-redis-reactive")
+    implementation 'com.fasterxml.jackson.core:jackson-databind'
 
 
 }

+ 10 - 8
dao/dao-simulator/build.gradle

@@ -1,7 +1,9 @@
 buildscript {
     repositories {
         mavenLocal()
-        maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
+        maven {
+            allowInsecureProtocol = true
+            url "http://maven.aliyun.com/nexus/content/groups/public" }
         mavenCentral()
     }
     dependencies {
@@ -15,12 +17,12 @@ bootJar.enabled = false
 jar.enabled = true
 
 dependencies {
-    compile project(":common:utils")
-    compile project(":common:data")
-    compile project(":dao:dao-interface")
-    compile fileTree(dir: 'src/main/lib', include: '*.jar')
-    compile("$bootGroup:spring-boot-starter-log4j2")
-    testCompile("$bootGroup:spring-boot-starter-test")
+    implementation project(":common:utils")
+    implementation project(":common:data")
+    implementation project(":dao:dao-interface")
+    implementation fileTree(dir: 'src/main/lib', include: '*.jar')
+    implementation("$bootGroup:spring-boot-starter-log4j2")
+    implementation("$bootGroup:spring-boot-starter-test")
     // https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt
-    compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.0'
+    implementation group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.0'
 }

+ 9 - 7
dao/dao-sql/build.gradle

@@ -1,7 +1,9 @@
 buildscript {
     repositories {
         mavenLocal()
-        maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
+        maven {
+            allowInsecureProtocol = true
+            url "http://maven.aliyun.com/nexus/content/groups/public" }
         mavenCentral()
     }
     dependencies {
@@ -16,11 +18,11 @@ bootJar.enabled = false
 jar.enabled = true
 
 dependencies {
-    compile project(":common:utils")
-    compile project(":common:data")
-    compile project(":dao:dao-interface")
-    compile("$bootGroup:spring-boot-starter-data-jpa:$springBootVersion")
-    compile("$bootGroup:spring-boot-starter-cache:$springBootVersion")
-    compile("$bootGroup:spring-boot-starter-jdbc:$springBootVersion")
+    implementation project(":common:utils")
+    implementation project(":common:data")
+    implementation project(":dao:dao-interface")
+    implementation("$bootGroup:spring-boot-starter-data-jpa:$springBootVersion")
+    implementation("$bootGroup:spring-boot-starter-cache:$springBootVersion")
+    implementation("$bootGroup:spring-boot-starter-jdbc:$springBootVersion")
 
 }

+ 2 - 2
dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/Windturbine/JpaPowerStationDao.java

@@ -31,8 +31,8 @@ public class JpaPowerStationDao implements IPowerStationDao {
 
     @Override
     public List<PowerStation> getListByPage(int pageIndex, int pageSize) {
-        Sort sort = new Sort(Sort.Direction.DESC, "createTime"); //创建时间降序排序
-        Pageable pageable = new PageRequest(pageIndex, pageSize, sort);
+        Sort sort =  Sort.by(Sort.Direction.DESC, "createTime"); //创建时间降序排序
+        Pageable pageable =  PageRequest.of(pageIndex, pageSize, sort);
         Page<PowerStationEntity> entityPage = powerStationRepository.findAll(pageable);
         List<PowerStation> stationList = DataUtil.convertDataList(entityPage.getContent());
         return stationList;

+ 2 - 2
dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/alarm/JpaGyeePowerStationDao.java

@@ -34,8 +34,8 @@ public class JpaGyeePowerStationDao implements IGyeePowerStationDao {
 
     @Override
     public List<GyeePowerStation> getListByPage(int pageIndex, int pageSize) {
-        Sort sort = new Sort(Sort.Direction.DESC, "createTime"); //创建时间降序排序
-        Pageable pageable = new PageRequest(pageIndex, pageSize, sort);
+        Sort sort =  Sort.by(Sort.Direction.DESC, "createTime"); //创建时间降序排序
+        Pageable pageable =  PageRequest.of(pageIndex, pageSize, sort);
         Page<GyeePowerStationEntity> entityPage = gyeepowerStationRepository.findAll(pageable);
         List<GyeePowerStation> stationList = DataUtil.convertDataList(entityPage.getContent());
         return stationList;

+ 1 - 1
dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/point/JpaElectricalTestingPointDao.java

@@ -31,7 +31,7 @@ public class JpaElectricalTestingPointDao implements IElectricalTestingPointDao
     @Override
     public List<ElectricalTestingPoint> getListByPage(int pageIndex, int pageSize) {
         // Sort sort = new Sort(Sort.Direction.DESC, "createTime"); //创建时间降序排序
-        Pageable pageable = new PageRequest(pageIndex, pageSize);
+        Pageable pageable =  PageRequest.of(pageIndex, pageSize);
         Page<ElectricalTestingPointEntity> entityPage = electricalTestingPointRepository.findAll(pageable);
         List<ElectricalTestingPoint> pointList = DataUtil.convertDataList(entityPage.getContent());
         return pointList;

+ 1 - 1
dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/point/JpaLevelTypeTestingPointDao.java

@@ -28,7 +28,7 @@ public class JpaLevelTypeTestingPointDao implements ILevelTypeTestingPointDao {
 
     @Override
     public List<LevelTypeTestingPoint> getListByPage(int pageIndex, int pageSize) {
-        Pageable pageable = new PageRequest(pageIndex, pageSize);
+        Pageable pageable =  PageRequest.of(pageIndex, pageSize);
         Page<LevelTypeTestingPointEntity> entityPage = levelTypeTestingPointRepository.findAll(pageable);
         List<LevelTypeTestingPoint> pointList = DataUtil.convertDataList(entityPage.getContent());
         return pointList;

+ 1 - 1
dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/point/JpaPowerStationTestingPointDao.java

@@ -30,7 +30,7 @@ public class JpaPowerStationTestingPointDao implements IPowerStationTestingPoint
 
     @Override
     public List<PowerStationTestingPoint> getListByPage(int pageIndex, int pageSize) {
-        Pageable pageable = new PageRequest(pageIndex, pageSize);
+        Pageable pageable =  PageRequest.of(pageIndex, pageSize);
         Page<PowerStationTestingPointEntity> entityPage = powerStationTestingPointRepository.findAll(pageable);
         List<PowerStationTestingPoint> pointList = DataUtil.convertDataList(entityPage.getContent());
         return pointList;

+ 1 - 1
dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/point/JpaTestingPointDao.java

@@ -29,7 +29,7 @@ public class JpaTestingPointDao implements ITestingPointDao {
 
     @Override
     public List<TestingPoint> getListByPage(int pageIndex, int pageSize) {
-        Pageable pageable = new PageRequest(pageIndex, pageSize);
+        Pageable pageable =  PageRequest.of(pageIndex, pageSize);
         Page<TestingPointEntity> entityPage = testingPointRepository.findAll(pageable);
         List<TestingPoint> pointList = DataUtil.convertDataList(entityPage.getContent());
         return pointList;

+ 1 - 1
dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/point/JpaWindturbineTestingPointDao.java

@@ -29,7 +29,7 @@ public class JpaWindturbineTestingPointDao implements IWindturbineTestingPointDa
 
     @Override
     public List<WindturbineTestingPoint> getListByPage(int pageIndex, int pageSize) {
-        Pageable pageable = new PageRequest(pageIndex, pageSize);
+        Pageable pageable =  PageRequest.of(pageIndex, pageSize);
         Page<WindturbineTestingPointEntity> entityPage = windturbineTestingPointRepository.findAll(pageable);
         List<WindturbineTestingPoint> pointList = DataUtil.convertDataList(entityPage.getContent());
         return pointList;

+ 1 - 1
dao/dao-sql/src/main/java/com/gyee/wisdom/dao/sql/topic/JpaTopicDao.java

@@ -48,7 +48,7 @@ public class JpaTopicDao implements ITopicDao {
 
     @Override
     public List<Topic> getListByPage(int pageIndex, int pageSize) {
-        Pageable pageable = new PageRequest(pageIndex, pageSize);
+        Pageable pageable =  PageRequest.of(pageIndex, pageSize);
         Page<TopicEntity> entityPage = topicRepository.findAll(pageable);
         List<Topic> list = DataUtil.convertDataList(entityPage.getContent());
         return list;

+ 11 - 7
dao/dao-taoscz/build.gradle

@@ -1,7 +1,9 @@
 buildscript {
     repositories {
         mavenLocal()
-        maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
+        maven {
+            allowInsecureProtocol = true
+            url "http://maven.aliyun.com/nexus/content/groups/public" }
         mavenCentral()
     }
     dependencies {
@@ -15,10 +17,12 @@ bootJar.enabled = false
 jar.enabled = true
 
 dependencies {
-    compile project(":common:utils")
-    compile project(":common:data")
-    compile project(":dao:dao-interface")
-    compile fileTree(dir: 'src/main/lib', include: '*.jar')
-    compile("$bootGroup:spring-boot-starter-log4j2")
-    implementation 'com.taosdata.jdbc:taos-jdbcdriver:2.0.35'
+    implementation project(":common:utils")
+    implementation project(":common:data")
+    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"){
+        exclude group: 'com.alibaba', module: 'fastjson'
+    }
 }

+ 11 - 6
gradle.properties

@@ -19,15 +19,20 @@ findbugsContribVersion=7.0.2
 findbugsSecVersion=1.6.0
 #log4jVersion=2.8.2
 jsr305Version=3.0.1
-lombokVersion=1.16.18
-guavaVersion=19.0
+lombokVersion=1.18.20
+guavaVersion=30.1.1-jre
 checkstyleVersion=8.0
-springBootVersion=2.0.3.RELEASE
-springCloudDependenciesVersion=Dalston.SR1
-commonsLang3Version=3.4
-commonsCodecVersion=1.10
+springBootVersion=2.7.0
+springCloudDependenciesVersion=Hoxton.SR9
+commonsLang3Version=3.12.0
+commonsCodecVersion=1.15
 jodaTimeVersion=2.9.9
 nettyVersion=4.1.12.Final
 cassandraVersion=3.0.0
 hbaseVersion=1.2.0-cdh5.16.2
 hadoopVersion=2.6.0-cdh5.16.2
+mysqlConnectorVersion=8.0.28
+log4jVersion=2.17.1
+fastjsonVersion=1.2.58
+commonsBeanUtilsVersion=1.9.4
+alibabaDruidVersion=1.2.9

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

@@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
 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-5.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip

+ 23 - 21
schedule-job/alarm-schedule/build.gradle

@@ -1,7 +1,9 @@
 buildscript {
     repositories {
         mavenLocal()
-        maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
+        maven {
+            allowInsecureProtocol = true
+            url "http://maven.aliyun.com/nexus/content/groups/public" }
         mavenCentral()
     }
     dependencies {
@@ -10,31 +12,31 @@ buildscript {
 }
 
 
-version = '1.0.3'
+version = "1.0.3"
 
 apply plugin: "$bootGroup"
-apply plugin: 'io.spring.dependency-management'
+apply plugin: "io.spring.dependency-management"
 
 
 dependencies {
-    compile project(":common:utils")
-    compile("$bootGroup:spring-boot-starter-web")
-    compile("$bootGroup:spring-boot-starter-undertow")
-    compile("$bootGroup:spring-boot-starter-websocket")
-    compile('org.apache.logging.log4j:log4j-core:2.15.0')
-    compile('org.apache.logging.log4j:log4j-jul:2.15.0')
-    compile('org.apache.logging.log4j:log4j-api:2.15.0')
-    compile('org.apache.logging.log4j:log4j-slf4j-impl:2.15.0')
-    compile 'mysql:mysql-connector-java:5.1.28'
-    compile 'com.alibaba:druid:1.0.25'
-    compile 'com.alibaba:fastjson:1.2.17'
-
-
-    compile 'com.baomidou:mybatis-plus-boot-starter:3.1.1'
-    compile 'com.baomidou:mybatis-plus-generator:3.1.1'
-
-    testCompile("$bootGroup:spring-boot-starter-test")
-    implementation 'com.xuxueli:xxl-job-core:2.3.0'
+    implementation project(":common:utils")
+    implementation("$bootGroup:spring-boot-starter-web")
+    implementation("$bootGroup:spring-boot-starter-undertow")
+    implementation("$bootGroup:spring-boot-starter-websocket")
+    implementation("org.apache.logging.log4j:log4j-core:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-jul:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-api:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion")
+    implementation ("mysql:mysql-connector-java:$mysqlConnectorVersion")
+    implementation "com.alibaba:druid:$alibabaDruidVersion"
+    implementation ("com.alibaba:fastjson:$fastjsonVersion")
+
+
+    implementation "com.baomidou:mybatis-plus-boot-starter:3.1.1"
+    implementation "com.baomidou:mybatis-plus-generator:3.1.1"
+
+    implementation("$bootGroup:spring-boot-starter-test")
+    implementation "com.xuxueli:xxl-job-core:2.3.0"
 
 
 }

+ 24 - 20
transport/redis2taos/build.gradle

@@ -1,7 +1,9 @@
 buildscript {
     repositories {
         mavenLocal()
-        maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
+        maven {
+            allowInsecureProtocol = true
+            url "http://maven.aliyun.com/nexus/content/groups/public" }
         mavenCentral()
     }
     dependencies {
@@ -14,26 +16,28 @@ apply plugin: 'io.spring.dependency-management'
 
 
 dependencies {
-    compile project(":common:utils")
-    compile project(":common:data")
-    compile project(":dao:dao-interface")
-    compile project(":dao:dao-sql")
-    compile project(":dao:dao-redis")
-    compile 'mysql:mysql-connector-java:5.1.28'
+    implementation project(":common:utils")
+    implementation project(":common:data")
+    implementation project(":dao:dao-interface")
+    implementation project(":dao:dao-sql")
+    implementation project(":dao:dao-redis")
+    implementation ("mysql:mysql-connector-java:$mysqlConnectorVersion")
 
-    testCompile("$bootGroup:spring-boot-starter-test")
-    compile 'com.alibaba:druid:1.0.25'
-    compile("$bootGroup:spring-boot-starter-web")
+    implementation("$bootGroup:spring-boot-starter-test")
+    implementation 'com.alibaba:druid:$alibabaDruidVersion'
+    implementation("$bootGroup:spring-boot-starter-web")
     //compile("$bootGroup:spring-boot-starter-session")
-    compile("$bootGroup:spring-boot-starter-websocket")
-    compile("$bootGroup:spring-boot-starter-undertow")
-    compile('org.apache.logging.log4j:log4j-core:2.15.0')
-    compile('org.apache.logging.log4j:log4j-jul:2.15.0')
-    compile('org.apache.logging.log4j:log4j-api:2.15.0')
-    compile('org.apache.logging.log4j:log4j-slf4j-impl:2.15.0')
-    compile("$bootGroup:spring-boot-starter-data-redis-reactive")
-    compile('com.fasterxml.jackson.datatype:jackson-datatype-jdk8')
-    implementation 'com.taosdata.jdbc:taos-jdbcdriver:2.0.35'
-    compile 'org.apache.commons:commons-pool2'
+    implementation("$bootGroup:spring-boot-starter-websocket")
+    implementation("$bootGroup:spring-boot-starter-undertow")
+    implementation("org.apache.logging.log4j:log4j-core:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-jul:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-api:$log4jVersion")
+    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"){
+        exclude group: 'com.alibaba', module: 'fastjson'
+    }
+    implementation 'org.apache.commons:commons-pool2'
 }
 

+ 8 - 8
transport/redis2taos/src/main/resources/application.yaml

@@ -17,9 +17,9 @@ spring:
     #    password: gdnxfd123
     # ----------------------------------------------------------------
     driver-class-name: com.mysql.jdbc.Driver
-    url: jdbc:mysql://123.60.219.66/wisdom_cs?useUnicode=true&characterEncoding=UTF-8
+    url: jdbc:mysql://192.168.1.252/wisdom_cs?useUnicode=true&characterEncoding=UTF-8
     username: root
-    password: 123
+    password: 123456
     # ----------------------------------------------------------------
     type: com.alibaba.druid.pool.DruidDataSource
     druid:
@@ -37,9 +37,9 @@ knife4j:
   redis:
     # 是否采用json序列化方式,若不采用jackson序列化
     jsonSerialType: 'Fastjson'
-    host: localhost
+    host: 192.168.1.252
     password: gyee123
-    port: 8082
+    port: 6379
     databases: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18] # 要使用的库,会根据此处填写的库生成redisTemplate
     timeout: 60s
     lettuce: # lettuce基于netty,线程安全,支持并发
@@ -56,14 +56,14 @@ timeseries:
 #JDBC-JNI方式驱动为com.taosdata.jdbc.TSDBDriver 端口为6030
 #JDBC-RESTful方式驱动为com.taosdata.jdbc.rs.RestfulDriver 端口为6041
 taoscz:
-  server_ip: 123.60.219.66
-  server_port: 6041
-  db_name: by_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.rs.RestfulDriver
+  driver_type: com.taosdata.jdbc.TSDBDriver
 
 #是否缓存所有风机测点
 isLoadAllTag: true

+ 38 - 31
warning-web/build.gradle

@@ -1,7 +1,9 @@
 buildscript {
     repositories {
         mavenLocal()
-        maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
+        maven {
+            allowInsecureProtocol = true
+            url "http://maven.aliyun.com/nexus/content/groups/public" }
         mavenCentral()
     }
     dependencies {
@@ -10,42 +12,47 @@ buildscript {
 }
 
 
-version = '2.0.1'
+version = "2.0.1"
 
 apply plugin: "$bootGroup"
-apply plugin: 'io.spring.dependency-management'
+apply plugin: "io.spring.dependency-management"
 
 
 dependencies {
 
-    compile project(":common:utils")
-
-  // compile fileTree(dir: 'src/main/lib', include: '*.jar')
-
-    compile("$bootGroup:spring-boot-starter-web")
-    compile("$bootGroup:spring-boot-starter-undertow")
-    compile("$bootGroup:spring-boot-starter-websocket")
-    compile('org.apache.logging.log4j:log4j-core:2.15.0')
-    compile('org.apache.logging.log4j:log4j-jul:2.15.0')
-    compile('org.apache.logging.log4j:log4j-api:2.15.0')
-    compile('org.apache.logging.log4j:log4j-slf4j-impl:2.15.0')
-    compile 'mysql:mysql-connector-java:5.1.28'
-    compile 'com.alibaba:druid:1.0.25'
-    compile 'com.alibaba:fastjson:1.2.58'
-
-    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'
-    testCompile("$bootGroup:spring-boot-starter-test")
+    implementation project(":common:utils")
+
+    // compile fileTree(dir: "src/main/lib", include: "*.jar")
+    implementation("org.apache.commons:commons-lang3:$commonsLang3Version")
+    implementation("$bootGroup:spring-boot-starter-web"){
+        exclude group:"org.springframework.boot:spring-boot-starter-json"
+        exclude group:"com.fasterxml.jackson.core:jackson-databind"
+    }
+    implementation("$bootGroup:spring-boot-starter-undertow")
+    implementation("$bootGroup:spring-boot-starter-websocket")
+    implementation("org.apache.logging.log4j:log4j-core:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-jul:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-api:$log4jVersion")
+    implementation("org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion")
+    implementation ("mysql:mysql-connector-java:$mysqlConnectorVersion")
+    implementation "com.alibaba:druid:$alibabaDruidVersion"
+    implementation ("com.alibaba:fastjson:$fastjsonVersion")
+
+    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"){
+        exclude group: 'com.alibaba', module: 'fastjson'
+    }
+    testImplementation("$bootGroup:spring-boot-starter-test")
     // https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt
-    compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.0'
-    compile("com.netflix.feign:feign-core:8.18.0")
-    compile("com.netflix.feign:feign-jackson:8.18.0")
-    compile("org.apache.poi:poi-ooxml:3.9")
-    compile("net.sourceforge.jexcelapi:jxl:2.6.12")
-
-    implementation 'io.springfox:springfox-swagger-ui:2.9.2'
-    implementation 'io.springfox:springfox-swagger2:2.9.2'
-    implementation 'io.swagger:swagger-models:1.5.21'
+    implementation group: "io.jsonwebtoken", name: "jjwt", version: "0.9.0"
+    implementation("com.netflix.feign:feign-core:8.18.0")
+    implementation("com.netflix.feign:feign-jackson:8.18.0")
+    implementation("org.apache.poi:poi-ooxml:3.9")
+    implementation("net.sourceforge.jexcelapi:jxl:2.6.12")
+
+    implementation "org.springdoc:springdoc-openapi-ui:1.6.6"
+//    implementation "io.springfox:springfox-boot-starter:3.0.0"
+
 }
 

+ 0 - 34
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/FastJsonHttpMessageConverterEx.java

@@ -1,34 +0,0 @@
-package com.gyee.wisdom.alarm.sharding.config;
-
-import com.alibaba.fastjson.serializer.SerializerFeature;
-import com.alibaba.fastjson.support.config.FastJsonConfig;
-import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
-import org.springframework.http.MediaType;
-
-import javax.print.attribute.standard.MediaSize;
-import java.awt.*;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-
-/**
- * @description:
- * @auther: Wanghs
- * @date: 2022-04-06
- */
-public class FastJsonHttpMessageConverterEx extends FastJsonHttpMessageConverter {
-    public FastJsonHttpMessageConverterEx() {
-        //在这里配置fastjson特性(全局设置的)
-        FastJsonConfig fastJsonConfig = new FastJsonConfig();
-        fastJsonConfig.setCharset(Charset.forName("UTF-8"));
-        fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");    //自定义时间格式
-
-        fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue);  //正常转换null值
-        fastJsonConfig.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);     //关闭循环引用
-        this.setFastJsonConfig(fastJsonConfig);
-    }
-
-    @Override
-    protected boolean supports(Class<?> clazz) {
-        return super.supports(clazz);
-    }
-}

+ 20 - 5
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/InterceptorConfig.java

@@ -3,6 +3,7 @@ package com.gyee.wisdom.alarm.sharding.config;
 import com.gyee.wisdom.alarm.sharding.filter.LoginInterceptor;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.web.bind.annotation.ControllerAdvice;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
@@ -12,7 +13,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  * @date:2020-05-21
  */
 @Configuration
-public class InterceptorConfig  implements  WebMvcConfigurer {
+public class InterceptorConfig implements WebMvcConfigurer {
 
     @Bean
     LoginInterceptor loginInterceptor() {
@@ -21,12 +22,26 @@ public class InterceptorConfig  implements  WebMvcConfigurer {
 
     /**
      * @Function: 配置生成器:添加一个拦截器,拦截路径为login以后的路径
-     * @author:   YangXueFeng
-     * @Date:     2019/4/14 13:10
+     * @author: YangXueFeng
+     * @Date: 2019/4/14 13:10
      */
     @Override
-    public void addInterceptors(InterceptorRegistry registry ) {
-        registry.addInterceptor(loginInterceptor()).addPathPatterns("/**").excludePathPatterns("/login", "/register", "/static");
+    public void addInterceptors(InterceptorRegistry registry) {
+        registry.addInterceptor(loginInterceptor()).addPathPatterns("/**").excludePathPatterns("/login",
+                "/register",
+                "/static",
+                "/swagger**/**",
+                "/swagger-ui.html",
+                "/swagger-ui/**",
+                "/swagger-resources/**",
+                "/v2/api-docs",
+                "/v3/api-docs",
+                "/v3/api-docs/swagger-config",
+                "/webjars/**",
+                "/doc.html",
+                "/**/api-docs/**"
+        );
 
     }
+
 }

+ 0 - 2
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/MyConfig.java

@@ -4,8 +4,6 @@ import com.gyee.wisdom.alarm.sharding.util.SpringContextUtil;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Configuration;
 
-import javax.validation.Valid;
-
 /**
  * @description:
  * @auther: Wanghs

+ 17 - 9
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/MyJsonConfig.java

@@ -8,8 +8,11 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.http.MediaType;
 import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 import java.util.ArrayList;
+import java.util.List;
+import java.util.TimeZone;
 
 /**
  * @description:
@@ -17,24 +20,29 @@ import java.util.ArrayList;
  * @date: 2022-04-06
  */
 @Configuration
-public class MyJsonConfig {
+public class MyJsonConfig   {
     //springboot 默认通过jackson来转化json,@JSONField(....)是fastjson的注解,因此要添加如下配置
     //Long类型在前端js中会丢失精度
     @Bean
     public HttpMessageConverters fastJsonHttpMessageConverters() {
+        TimeZone.setDefault(TimeZone.getTimeZone("GMT+8"));
         FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
         FastJsonConfig fastJsonConfig = new FastJsonConfig();
-        fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
+       fastJsonConfig.getSerializeConfig().put(String.class,MyStringSerializer.instance);
         fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");    //自定义时间格式
-        fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue);  //正常转换null值
-        fastJsonConfig.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);     //关闭循环引用
+        fastJsonConfig.setSerializerFeatures(
+                SerializerFeature.DisableCircularReferenceDetect
+                ,SerializerFeature.WriteMapNullValue
+                ,SerializerFeature.WriteDateUseDateFormat
+                );  //关闭循环引用,正常转换null值,格式化
+
+
         fastConverter.setFastJsonConfig(fastJsonConfig);
+        List<MediaType> fastMediaTypes = new ArrayList<>();
+        fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
+        fastConverter.setSupportedMediaTypes(fastMediaTypes);
         HttpMessageConverter<?> converter = fastConverter;
         return new HttpMessageConverters(converter);
     }
-    //避免fastjson 在序列化时因循环引用 导致报文出现$ref
-    @Bean
-    public FastJsonHttpMessageConverterEx fastJsonHttpMessageConverterEx(){
-        return new FastJsonHttpMessageConverterEx();
-    }
+
 }

+ 22 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/MyStringSerializer.java

@@ -0,0 +1,22 @@
+package com.gyee.wisdom.alarm.sharding.config;
+
+import com.alibaba.fastjson.serializer.JSONSerializer;
+import com.alibaba.fastjson.serializer.ObjectSerializer;
+import com.alibaba.fastjson.serializer.SerializeWriter;
+
+import java.io.IOException;
+import java.lang.reflect.Type;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-06-01
+ */
+public class MyStringSerializer implements ObjectSerializer {
+    public static final MyStringSerializer instance = new MyStringSerializer();
+    @Override
+    public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
+        SerializeWriter out = serializer.getWriter();
+        out.write(object.toString());
+    }
+}

+ 38 - 30
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/MyWebAppConfigurer.java

@@ -7,39 +7,47 @@ import org.springframework.web.servlet.config.annotation.*;
 
 /**
  * 拦截器
-* @ClassName: MyWebAppConfigurer
-* @author gyee
-* @date 2018年6月3日
-*
+ *
+ * @author gyee
+ * @ClassName: MyWebAppConfigurer
+ * @date 2018年6月3日
  */
 @Configuration
-public class MyWebAppConfigurer  implements  WebMvcConfigurer  {
-	
-	private static Logger logger=LoggerFactory.getLogger(WebMvcConfigurationSupport.class);
+public class MyWebAppConfigurer implements WebMvcConfigurer {
 
-	
-	
-	/** 解决跨域问题 **/
-	@Override
-	public void addCorsMappings(CorsRegistry registry){
+    private static Logger logger = LoggerFactory.getLogger(WebMvcConfigurationSupport.class);
+
+
+    /**
+     * 解决跨域问题
+     **/
+    @Override
+    public void addCorsMappings(CorsRegistry registry) {
 
         registry.addMapping("/**")
-			// 设置允许跨域请求的域名
-			.allowedOrigins("*")
-			// 是否允许证书
-			.allowCredentials(true)
-			// 设置允许的方法
-			.allowedMethods("GET", "POST", "DELETE", "PUT")
-			// 设置允许的header属性
-			.allowedHeaders("*")
-				// 跨域允许时间
-			.maxAge(3600);
-			//super.addCorsMappings(registry);
-
-	}
-	
-
-	
-	
-	
+                // 设置允许跨域请求的域名
+               // .allowedOrigins("*")
+                .allowedOriginPatterns("*")
+                // 是否允许证书
+                .allowCredentials(true)
+                // 设置允许的方法
+                .allowedMethods("GET", "POST", "DELETE", "PUT")
+                // 设置允许的header属性
+                .allowedHeaders("*")
+                // 跨域允许时间
+                .maxAge(3600);
+        //super.addCorsMappings(registry);
+
+    }
+
+    @Override
+    public void addResourceHandlers(ResourceHandlerRegistry registry) {
+        registry.addResourceHandler("swagger-ui/")
+                .addResourceLocations("classpath:/META-INF/resources/");
+        registry.addResourceHandler("swagger-ui.html")
+                .addResourceLocations("classpath:/META-INF/resources/");
+
+        registry.addResourceHandler("/webjars/**")
+                .addResourceLocations("classpath:/META-INF/resources/webjars/");
+    }
 }

+ 0 - 58
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/config/SwaggerConfig.java

@@ -1,58 +0,0 @@
-package com.gyee.wisdom.alarm.sharding.config;
-
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.bind.annotation.RequestMethod;
-import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.builders.ResponseMessageBuilder;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.ResponseMessage;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
-
-import java.util.Arrays;
-
-/**
- * @description:
- * @auther: Wanghs
- * @date: 2022-04-01
- */
-
-@Configuration
-@EnableSwagger2
-public class SwaggerConfig {
-    @Bean
-    public Docket customDocket() {
-
-        // 配置全局参数返回状态
-        java.util.List<ResponseMessage> resMsgList = Arrays.asList(
-                new ResponseMessageBuilder().code(200).message("成功!").build(),
-                new ResponseMessageBuilder().code(-1).message("失败!").build(),
-                new ResponseMessageBuilder().code(401).message("参数校验错误!").build(),
-                new ResponseMessageBuilder().code(403).message("没有权限操作,请后台添加相应权限!").build(),
-                new ResponseMessageBuilder().code(500).message("服务器内部异常,请稍后重试!").build(),
-                new ResponseMessageBuilder().code(501).message("请登录!").build());
-
-        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
-                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
-                .paths(PathSelectors.any())
-                .build()
-                .globalResponseMessage(RequestMethod.GET, resMsgList)
-                .globalResponseMessage(RequestMethod.POST, resMsgList)
-                .globalResponseMessage(RequestMethod.PUT, resMsgList)
-                .globalResponseMessage(RequestMethod.DELETE, resMsgList);
-    }
-
-    private ApiInfo apiInfo() {
-        return new ApiInfoBuilder()
-                .title("sharding-mysql2")
-                .description("接口文档说明")
-                .version("1.0.0")
-                .build();
-    }
-}

File diff suppressed because it is too large
+ 3 - 1
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/AlarmCountController.java


+ 9 - 10
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/AlertRuleEventLogController.java

@@ -5,13 +5,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gyee.wisdom.alarm.sharding.entity.RuleUpdateEvent;
 import com.gyee.wisdom.alarm.sharding.service.RuleUpdateEventService;
 import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import springfox.documentation.annotations.ApiIgnore;
 
 /**
  * @description: 报警规则日志
@@ -23,18 +22,18 @@ import springfox.documentation.annotations.ApiIgnore;
 @RestController
 @RequestMapping("/rulevent")
 @CrossOrigin
-@Api(tags = {"规则修改日志"})
+@Tag(name = "规则修改日志")
 public class AlertRuleEventLogController {
     @Autowired
     private RuleUpdateEventService ruleUpdateEventService;
 
-    @ApiOperation("分页查询报警规则修改日志")
+    @Operation(description = "分页查询报警规则修改日志")
     @GetMapping("/page")
     public ResponseWrapper getRuleEventLog(
-            @ApiParam(value = "当前页") @RequestParam(value = "pagenum",required = true) Integer pageNum,
-            @ApiParam(value = "分页大小") @RequestParam(value = "pagesize",required = true) Integer pageSize,
-            @ApiParam(value = "报警名称") @RequestParam(value = "ruleName",required = false) String ruleName,
-            @ApiParam(value = "规则类型(风机报警,升压站报警,自定义报警)") @RequestParam(value = "ruleType",required = false) String ruleType
+            @Parameter(name = "当前页") @RequestParam(value = "pagenum",required = true) Integer pageNum,
+            @Parameter(name = "分页大小") @RequestParam(value = "pagesize",required = true) Integer pageSize,
+            @Parameter(name = "报警名称") @RequestParam(value = "ruleName",required = false) String ruleName,
+            @Parameter(name = "规则类型(风机报警,升压站报警,自定义报警)") @RequestParam(value = "ruleType",required = false) String ruleType
 
 
             ) {

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

@@ -12,9 +12,9 @@ import com.gyee.wisdom.alarm.sharding.util.TokenUtil;
 import com.gyee.wisdom.alarm.sharding.util.UserLoginToken;
 import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
 import io.jsonwebtoken.Claims;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,7 +35,7 @@ import java.util.Map;
 @RestController
 @RequestMapping("/alertrule2")
 @CrossOrigin
-@Api(tags = {"自定义规则接口"})
+@Tag(name ="自定义规则接口")
 public class Alertrule2Controller {
 
     @Autowired
@@ -186,11 +186,11 @@ public class Alertrule2Controller {
     }
 
 
-    @ApiOperation("自定义规则批量导入")
+    @Operation(description = "自定义规则批量导入")
     @PostMapping(value ="/import")
     @ResponseBody
     @UserLoginToken
-    public ResponseWrapper<Alertrule2> importAlertrule(@ApiParam(value = "导入文件") @RequestParam("file") MultipartFile file, HttpServletRequest request) {
+    public ResponseWrapper<Alertrule2> importAlertrule(@Parameter(description = "导入文件") @RequestParam("file") MultipartFile file, HttpServletRequest request) {
         String token=request.getHeader("token");
         Claims claims = TokenUtil.parseJWT(token);
         String userName=claims.get("jti").toString();

+ 14 - 13
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/DatadictionaryController.java

@@ -5,9 +5,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gyee.wisdom.alarm.sharding.entity.Datadictionary;
 import com.gyee.wisdom.alarm.sharding.service.DatadictionaryService;
 import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -23,7 +24,7 @@ import java.util.List;
 @RestController
 @RequestMapping("/datadictionary")
 @CrossOrigin
-@Api(tags = {"字典接口"})
+@Tag(name = "字典接口")
 public class DatadictionaryController {
 
     @Autowired
@@ -35,13 +36,13 @@ public class DatadictionaryController {
         return datadictionaries;
     }
 
-    @ApiOperation("分页查询字典")
+    @Operation(description = "分页查询字典")
     @GetMapping(value = "/page")
     public ResponseWrapper queryByPage(
-            @ApiParam(value = "当前页") @RequestParam(value = "pagenum") Integer pageNum,
-            @ApiParam(value = "分页大小") @RequestParam(value = "pagesize") Integer pageSize,
-            @ApiParam(value = "字典名称") @RequestParam(value = "name", required = false) String name,
-            @ApiParam(value = "字典类型") @RequestParam(value = "category", required = false) String category
+            @Parameter(name = "当前页") @RequestParam(value = "pagenum") Integer pageNum,
+            @Parameter(name = "分页大小") @RequestParam(value = "pagesize") Integer pageSize,
+            @Parameter(name = "字典名称") @RequestParam(value = "name", required = false) String name,
+            @Parameter(name = "字典类型") @RequestParam(value = "category", required = false) String category
     ) {
         Page<Datadictionary> page = new Page(pageNum, pageSize);
         IPage<Datadictionary> pageResult = datadictionaryService.pageQueryAll(page, name,category);
@@ -49,10 +50,10 @@ public class DatadictionaryController {
         return ResponseWrapper.success("请求成功",pageResult);
     }
 
-    @ApiOperation("新增或修改字典")
+    @Operation(description = "新增或修改字典")
     @PostMapping(value = "/saveorupdate")
     @ResponseBody
-    public ResponseWrapper saveDatadictionary(@ApiParam(value = "字典对象") @RequestBody Datadictionary datadictionary){
+    public ResponseWrapper saveDatadictionary(@Parameter(description = "字典对象") @RequestBody Datadictionary datadictionary){
         ResponseWrapper<Datadictionary> wrapper = null;
         int result = datadictionaryService.saveOrUpdateDatadictionary(datadictionary);
         if (result <= 0) {
@@ -64,11 +65,11 @@ public class DatadictionaryController {
         return wrapper;
     }
 
-    @ApiOperation("删除字典")
+    @Operation(description = "删除字典")
     @DeleteMapping(value = "/{id}")
     @ResponseBody
     public ResponseWrapper deleteDatadictionary(
-            @ApiParam(value = "字典编号") @PathVariable("id") String id) {
+            @Parameter(name = "字典编号") @PathVariable("id") String id) {
         ResponseWrapper wrapper = null;
         int s = datadictionaryService.deleteDatadictionary(id);
         if (s > 0) {

+ 23 - 22
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/DeviceController.java

@@ -8,9 +8,10 @@ import com.gyee.wisdom.alarm.sharding.model.TreeNode;
 import com.gyee.wisdom.alarm.sharding.service.DeviceService;
 import com.gyee.wisdom.alarm.sharding.util.ExcelUtil;
 import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -32,7 +33,7 @@ import java.util.List;
 @RestController
 @RequestMapping("/device")
 @CrossOrigin
-@Api(tags = {"设备信息接口"})
+@Tag(name ="设备信息接口")
 public class DeviceController {
     Logger logger = LogManager.getLogger(DeviceController.class);
 
@@ -100,7 +101,7 @@ public class DeviceController {
 
     }
 
-    private ResponseWrapper<DeviceStructure> dataCheck(DeviceStructure ds) {
+    public ResponseWrapper<DeviceStructure> dataCheck(DeviceStructure ds) {
 
         ResponseWrapper<DeviceStructure> wrapper = null;
         String msg = "";
@@ -140,15 +141,15 @@ public class DeviceController {
         return deviceService.getDeviceMetricsByStructureCode(deviceId, structureCode);
     }
     @GetMapping(value = "/metrics/page")
-    @ApiOperation("分页查询标准测点")
+    @Operation(description = "分页查询标准测点")
     public IPage<DeviceMetrics> queryByPage(
-            @ApiParam(value = "当前页")  @RequestParam(value = "pagenum")Integer pageNum,
-            @ApiParam(value = "分页大小")@RequestParam(value = "pagesize")Integer pageSize,
-            @ApiParam(value = "测点类型 AI-遥测 CI-计算 MI-遥调")  @RequestParam(value = "categorydata")String categorydata,
-            @ApiParam(value = "名称关键字")  @RequestParam(value = "keyword",required = false)String  keyword,
-            @ApiParam(value = "型号")  @RequestParam(value = "model",required = false)String  model,
-            @ApiParam(value = "设备类型") @RequestParam(value = "deviceId", required = false) String deviceId,
-            @ApiParam(value = "结构码")   @RequestParam(value = "structureCode",required = false) String structureCode
+            @Parameter(description = "当前页")  @RequestParam(value = "pagenum")Integer pageNum,
+            @Parameter(description = "分页大小")@RequestParam(value = "pagesize")Integer pageSize,
+            @Parameter(description = "测点类型 AI-遥测 CI-计算 MI-遥调")  @RequestParam(value = "categorydata")String categorydata,
+            @Parameter(description = "名称关键字")  @RequestParam(value = "keyword",required = false)String  keyword,
+            @Parameter(description = "型号")  @RequestParam(value = "model",required = false)String  model,
+            @Parameter(description = "设备类型") @RequestParam(value = "deviceId", required = false) String deviceId,
+            @Parameter(description = "结构码")   @RequestParam(value = "structureCode",required = false) String structureCode
     ){
         Page<DeviceMetrics> page =new Page(pageNum,pageSize);
 
@@ -231,13 +232,13 @@ public class DeviceController {
         return deviceService.getDeviceModelList();
     }
 
-    @ApiOperation("风机型号分页查询")
+    @Operation(description = "风机型号分页查询")
     @GetMapping(value = "/model/page")
     public ResponseWrapper queryByPage(
-            @ApiParam(value = "当前页") @RequestParam(value = "pagenum") Integer pageNum,
-            @ApiParam(value = "分页大小") @RequestParam(value = "pagesize") Integer pageSize,
-            @ApiParam(value = "风机型号") @RequestParam(value = "code", required = false) String code,
-            @ApiParam(value = "场站名称") @RequestParam(value = "stationname", required = false) String stationname
+            @Parameter(name = "当前页") @RequestParam(value = "pagenum") Integer pageNum,
+            @Parameter(name = "分页大小") @RequestParam(value = "pagesize") Integer pageSize,
+            @Parameter(name = "风机型号") @RequestParam(value = "code", required = false) String code,
+            @Parameter(name = "场站名称") @RequestParam(value = "stationname", required = false) String stationname
     ) {
         Page<DeviceModel> page = new Page(pageNum, pageSize);
         IPage<DeviceModel> pageResult = deviceService.pageQueryDeviceModel(page, code,stationname);
@@ -269,7 +270,7 @@ public class DeviceController {
         }
         return wrapper;
     }
-    private ResponseWrapper<DeviceModel> dataCheck2(DeviceModel ds) {
+    public ResponseWrapper<DeviceModel> dataCheck2(DeviceModel ds) {
 
         ResponseWrapper<DeviceModel> wrapper = null;
         String msg = "";
@@ -300,10 +301,10 @@ public class DeviceController {
         return wrapper;
     }
 
-    @ApiOperation("将文件数据转化为json")
+    @Operation(description = "将文件数据转化为json")
     @PostMapping(value ="/conversion")
     @ResponseBody
-    public ResponseWrapper<DeviceMetrics> converSion(@ApiParam(value = "导入文件") @RequestParam("file") MultipartFile file){
+    public ResponseWrapper<DeviceMetrics> converSion(@Parameter(name = "导入文件") @RequestParam("file") MultipartFile file){
         ResponseWrapper<DeviceMetrics> wrapper = null;
         if (!file.isEmpty()) {
             try {
@@ -375,7 +376,7 @@ public class DeviceController {
         return AjaxResult.error("上传文件失败!");
     }
 
-    private ResponseWrapper<DeviceMetrics> dataCheck3(DeviceMetrics ds) {
+    public ResponseWrapper<DeviceMetrics> dataCheck3(DeviceMetrics ds) {
 
         ResponseWrapper<DeviceMetrics> wrapper = null;
         String msg = "";

+ 10 - 9
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/InfoController.java

@@ -10,9 +10,10 @@ import com.gyee.wisdom.alarm.sharding.mapper.*;
 import com.gyee.wisdom.alarm.sharding.service.DeviceService;
 import com.gyee.wisdom.alarm.sharding.service.WindturbineService;
 import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 
 import org.apache.commons.lang3.StringUtils;
@@ -35,7 +36,7 @@ import java.util.Map;
 @RestController
 @RequestMapping("/info")
 @CrossOrigin
-@Api(tags = {"获取基础数据,如风场,风机,测点等"})
+@Tag(name="获取基础数据,如风场,风机,测点等")
 public class InfoController {
 
     @Autowired
@@ -73,7 +74,7 @@ public class InfoController {
 
     @RequestMapping(value = "/station")
     @ResponseBody
-    @ApiOperation("获取风场")
+    @Operation(description = "获取风场")
     public List<WindPowerStation> getAllWindStation(@RequestParam(value = "id", required = false) String id) {
 
         if (StringUtils.isBlank(id)) {
@@ -85,17 +86,17 @@ public class InfoController {
 
     @RequestMapping(value = "/station/all")
     @ResponseBody
-    @ApiOperation("获取风场和广电场")
+    @Operation(description = "获取风场和光电场")
     public List<WindPowerStation> getAllStation(@RequestParam(value = "id", required = false) String id) {
         List<WindPowerStation> lst = windPowerStationMapper.getStationAll(id);
         return lst;
     }
 
 
-    @ApiOperation("根据场站名称查询所有风机编号")
+    @Operation(description = "根据场站名称查询所有风机编号")
     @RequestMapping(value = "/windturbine")
     @ResponseBody
-    public List<Windturbine> getWindturbineByStation( @ApiParam(value = "场站名称") @RequestParam(value = "stationId", required = false) String stationId) {
+    public List<Windturbine> getWindturbineByStation( @Parameter(name = "场站名称") @RequestParam(value = "stationId", required = false) String stationId) {
         List<Windturbine> lst = windturbineService.selectWindturbineByStationid(stationId);
         return lst;
     }
@@ -145,7 +146,7 @@ public class InfoController {
     }
 
 
-    @RequestMapping(value = "/windturbine_parts")
+    @GetMapping(value = "/windturbine_parts")
     public List<WindturbineParts> getWindturbineParts() {
         List<WindturbineParts> lst = new ArrayList<>();
         try {

+ 8 - 6
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/ScadabjController.java

@@ -8,9 +8,11 @@ import com.gyee.wisdom.alarm.sharding.service.Alertrule2Service;
 import com.gyee.wisdom.alarm.sharding.service.ScadabjService;
 import com.gyee.wisdom.alarm.sharding.util.*;
 import io.jsonwebtoken.Claims;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -26,7 +28,7 @@ import java.util.List;
 @RestController
 @RequestMapping("/scadabj")
 @CrossOrigin
-@Api(tags = {"scadabj接口"})
+@Tag(name="scadabj接口")
 public class ScadabjController {
 
     @Autowired
@@ -110,11 +112,11 @@ public class ScadabjController {
 
     }
 
-    @ApiOperation("Scadabj批量导入")
+    @Operation(description = "Scadabj批量导入")
     @PostMapping(value = "/import")
     @ResponseBody
     @UserLoginToken
-    public ResponseWrapper<Scadabj> saveScadabjImport(@ApiParam(value = "导入文件") @RequestParam("file") MultipartFile file, HttpServletRequest request) {
+    public ResponseWrapper<Scadabj> saveScadabjImport(@Parameter(description= "导入文件") @RequestParam("file") MultipartFile file, HttpServletRequest request) {
         String token=request.getHeader("token");
         Claims claims = TokenUtil.parseJWT(token);
         String userName=claims.get("jti").toString();

+ 25 - 6
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/TestController.java

@@ -1,5 +1,7 @@
 package com.gyee.wisdom.alarm.sharding.controller;
 
+import com.alibaba.fastjson.JSON;
+import com.gyee.wisdom.alarm.sharding.entity.Windturbine;
 import com.gyee.wisdom.alarm.sharding.service.AlarmReportService;
 import com.gyee.wisdom.alarm.sharding.service.AlarmSnapService;
 import lombok.extern.slf4j.Slf4j;
@@ -9,6 +11,9 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * @description:
  * @auther: Wanghs
@@ -24,20 +29,34 @@ public class TestController {
     private AlarmReportService reportService;
 
     @GetMapping(value = "/earlywarnscore")
-    public String startCalcEarlyWarnScore(){
-        String result="";
+    public String startCalcEarlyWarnScore() {
+        String result = "";
         try {
             reportService.startCount();
-            result="诊断报告生成成功";
+            result = "诊断报告生成成功";
 
 
-        }catch (Exception ex){
-            result=ex.getMessage().toString();
+        } catch (Exception ex) {
+            result = ex.getMessage().toString();
             log.error(ex.getStackTrace().toString());
-        }finally {
+        } finally {
             return result;
         }
 
 
     }
+
+    @GetMapping(value = "/info")
+    public Map<String, Windturbine> getTestInfo() {
+        Windturbine w = new Windturbine();
+        w.setId("123");
+        w.setName("麻黄山1号风机");
+
+        Map<String, Windturbine> mp = new HashMap<>();
+        mp.put("1", w);
+        mp.put("2", w);
+        mp.put("3", w);
+        System.out.println(JSON.toJSONString(mp));
+        return mp;
+    }
 }

+ 8 - 7
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/TestingPointDIController.java

@@ -4,9 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.wisdom.alarm.sharding.entity.TestingPointDI;
 import com.gyee.wisdom.alarm.sharding.service.TestingPointDIService;
 import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,13 +25,13 @@ import java.util.List;
 @RestController
 @RequestMapping("/testingpointDI")
 @CrossOrigin
-@Api(tags = {"TestingPointDI数据接口"})
+@Tag(name = "TestingPointDI数据接口")
 public class TestingPointDIController {
 
     @Autowired
     private TestingPointDIService testingPointDIService;
 
-    @ApiOperation("获取所有子型号")
+    @Operation(description = "获取所有子型号")
     @GetMapping("/model")
     public ResponseWrapper getModel() {
         List<String> model = testingPointDIService.getModel();
@@ -40,9 +41,9 @@ public class TestingPointDIController {
 
     @RequestMapping(value = "/point")
     @ResponseBody
-    @ApiOperation("根据子型号获取测点")
+    @Operation(description = "根据子型号获取测点")
     public ResponseWrapper getTestingPointDIByModel(
-            @ApiParam(value = "风机子型号如UP82_NSS")   @RequestParam(value = "minModel", required = true) String minModel
+            @Parameter(description = "风机子型号如UP82_NSS")   @RequestParam(value = "minModel", required = true) String minModel
     ) {
         List<TestingPointDI> lst = testingPointDIService.getTestingPointDIByMinModelId(minModel);
         ResponseWrapper result = ResponseWrapper.success("查询成功", lst);

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

@@ -0,0 +1,85 @@
+package com.gyee.wisdom.alarm.sharding.controller;
+
+import com.gyee.wisdom.alarm.sharding.entity.Datadictionary;
+import com.gyee.wisdom.alarm.sharding.service.DatadictionaryService;
+import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-05-24
+ */
+
+@Slf4j
+@RestController
+@RequestMapping("/userset")
+@CrossOrigin
+@Tag(name = "用户设置")
+public class UserSetController {
+
+    @Autowired
+    private DatadictionaryService datadictionaryService;
+
+    @Operation(description = "是否故障弹窗提示")
+    @PostMapping("/jumpwindow")
+    public ResponseWrapper saveJumpWindow(@Parameter(name = "是否弹窗") @RequestParam(value = "isjump", required = true) boolean isJump) {
+
+        boolean b = datadictionaryService.saveOrUpdateUserSet("userset", "jumpwindow", isJump);
+        String msg = isJump?"故障弹窗开启":"故障弹窗关闭";
+        ResponseWrapper resultWrapper=null;
+        if(b)
+            resultWrapper=  ResponseWrapper.success(msg+"设置成功");
+        else
+            resultWrapper=ResponseWrapper.error(msg+"设置失败");
+        return  resultWrapper;
+    }
+
+    @Operation(description = "是否故障语音播报")
+    @PostMapping("/faultread")
+    public ResponseWrapper saveFaultRead(@Parameter(name = "是否播报") @RequestParam(value = "isread", required = true) boolean isread) {
+        boolean b = datadictionaryService.saveOrUpdateUserSet("userset", "faultread", isread);
+        String msg = isread?"语音播报开启":"语音播报关闭";
+        ResponseWrapper resultWrapper=null;
+        if(b)
+            resultWrapper=  ResponseWrapper.success(msg+"设置成功");
+        else
+            resultWrapper=ResponseWrapper.error(msg+"设置失败");
+        return  resultWrapper;
+    }
+
+
+    @Operation(description = "获取是否故障弹窗提示")
+    @GetMapping("/jumpwindow")
+    public ResponseWrapper getJumpWindow() {
+        Datadictionary userSet = datadictionaryService.getUserSet("userset", "jumpwindow");
+        if(userSet!=null){
+            boolean isJump=userSet.getEnabled()==0?false:true;
+            return ResponseWrapper.success("获取成功", isJump);
+
+        }else{
+            return ResponseWrapper.error("获取失败");
+
+        }
+    }
+
+    @Operation(description = "获取是否故障语音播报")
+    @GetMapping("/faultread")
+    public ResponseWrapper getFaultRead() {
+        Datadictionary userSet = datadictionaryService.getUserSet("userset", "faultread");
+        if(userSet!=null){
+            boolean isRead=userSet.getEnabled()==0?false:true;
+            return ResponseWrapper.success("获取成功", isRead);
+
+        }else{
+            return ResponseWrapper.error("获取失败");
+        }
+    }
+
+
+}

+ 8 - 6
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/Warning2Controller.java

@@ -12,9 +12,10 @@ import com.gyee.wisdom.alarm.sharding.util.UserLoginToken;
 import com.gyee.wisdom.alarm.sharding.service.Warning2Service;
 import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
 import io.jsonwebtoken.Claims;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,13 +26,14 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 @Slf4j
 @RestController
 @RequestMapping("/warning2")
 @CrossOrigin
-@Api(tags = {"warning2接口"})
+@Tag(name = "warning2接口")
 public class Warning2Controller {
 
     @Autowired
@@ -92,11 +94,11 @@ public class Warning2Controller {
 
     }
 
-    @ApiOperation("Warning2批量导入")
+    @Operation(description = "Warning2批量导入")
     @PostMapping(value ="/import")
     @ResponseBody
     @UserLoginToken
-    public ResponseWrapper<Warning2> importWarning(@ApiParam(value = "导入文件") @RequestParam("file") MultipartFile file, HttpServletRequest request) {
+    public ResponseWrapper<Warning2> importWarning(@Parameter(description = "文件") @RequestParam("file") MultipartFile file, HttpServletRequest request) {
         String token=request.getHeader("token");
         Claims claims = TokenUtil.parseJWT(token);
         String userName=claims.get("jti").toString();

+ 2 - 2
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/entity/FaultInfo.java

@@ -17,13 +17,13 @@ import java.util.Date;
 public class FaultInfo implements Serializable {
 
 
-    private long id;
+    private Long id;
     //报警时间
     private Date faultTime;
     //对象类型
     private int messageType;
     //报警内容
-    private long snapID;
+    private Long snapID;
 
     private Integer confirmType;
 

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

@@ -48,8 +48,7 @@ public class AlarmCountService extends ServiceImpl<AlarmCountMapper, AlarmCount>
 
     @Autowired
     private WindturbineService windturbineService;
-    @Autowired
-    private AlarmCountService alarmCountService;
+
 
     @Value("${count.custom}")
     public boolean custom;
@@ -150,7 +149,7 @@ public class AlarmCountService extends ServiceImpl<AlarmCountMapper, AlarmCount>
                 break;
             }
 
-            List<AlarmStat> alarmStats = alarmCountService.statAlarmCount(stId, startDate, startDate);
+            List<AlarmStat> alarmStats = statAlarmCount(stId, startDate, startDate);
             for (AlarmStat alarmStat : alarmStats) {
                 for (Windturbine windturbine : windturbines) {
                     String str = windturbine.getId();
@@ -200,7 +199,7 @@ public class AlarmCountService extends ServiceImpl<AlarmCountMapper, AlarmCount>
                 break;
             }
 
-            List<AlarmStat> alarmStats = alarmCountService.statAlarmCountByname(stId, startDatetmp, startDatetmp, stringIntegerMapfinal.get(name).getAlarmtext());
+            List<AlarmStat> alarmStats = statAlarmCountByname(stId, startDatetmp, startDatetmp, stringIntegerMapfinal.get(name).getAlarmtext());
             for (AlarmStat alarmStat : alarmStats) {
                 for (Windturbine windturbine : windturbines) {
                     String str = windturbine.getId();
@@ -277,7 +276,7 @@ public class AlarmCountService extends ServiceImpl<AlarmCountMapper, AlarmCount>
                 break;
             }
 
-            List<AlarmStat> alarmStats = alarmCountService.statAlarmCountByname(stId, startDatetmp, startDatetmp, alarmSnap.getAlertText());
+            List<AlarmStat> alarmStats = statAlarmCountByname(stId, startDatetmp, startDatetmp, alarmSnap.getAlertText());
             for (AlarmStat alarmStat : alarmStats) {
                 for (Windturbine windturbine : windturbines) {
                     String str = windturbine.getId();
@@ -325,7 +324,7 @@ public class AlarmCountService extends ServiceImpl<AlarmCountMapper, AlarmCount>
                 break;
             }
 
-            List<AlarmStat> alarmStats = alarmCountService.statAlarmCount1(stationid, startDate, startDate, windturbineid);
+            List<AlarmStat> alarmStats = statAlarmCount1(stationid, startDate, startDate, windturbineid);
             for (AlarmStat alarmStat : alarmStats) {
                 for (Windturbine windturbine : windturbines) {
                     String str = windturbine.getId();

+ 30 - 1
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/DatadictionaryService.java

@@ -3,8 +3,11 @@ package com.gyee.wisdom.alarm.sharding.service;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gyee.wisdom.alarm.sharding.entity.Datadictionary;
+import com.gyee.wisdom.alarm.sharding.entity.Warning2;
 import com.gyee.wisdom.alarm.sharding.mapper.DatadictionaryMapper;
+import com.gyee.wisdom.alarm.sharding.mapper.Warning2Mapper;
 import com.gyee.wisdom.alarm.sharding.util.StringUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,7 +18,7 @@ import java.util.List;
 
 @Service
 @Slf4j
-public class DatadictionaryService {
+public class DatadictionaryService extends ServiceImpl<DatadictionaryMapper, Datadictionary> {
 
     @Autowired
     private DatadictionaryMapper datadictionaryMapper;
@@ -56,4 +59,30 @@ public class DatadictionaryService {
     public int deleteDatadictionary(String id) {
         return datadictionaryMapper.deleteById(id);
     }
+
+    public boolean saveOrUpdateUserSet(String category,String code,boolean b){
+        QueryWrapper<Datadictionary> wrapper=new QueryWrapper();
+        wrapper.eq("CATEGORY",category);
+        wrapper.eq("CODE",code);
+        List<Datadictionary> lst = baseMapper.selectList(wrapper);
+        if(lst.size()==1){
+            Datadictionary datadictionary = lst.get(0);
+            datadictionary.setEnabled(b?1:0);
+            int i = baseMapper.updateById(datadictionary);
+            return  i>0?true:false;
+        }else{
+            return false;
+        }
+    }
+
+    public Datadictionary getUserSet(String category,String code){
+        QueryWrapper<Datadictionary> wrapper=new QueryWrapper();
+        wrapper.eq("CATEGORY",category);
+        wrapper.eq("CODE",code);
+        List<Datadictionary> lst = baseMapper.selectList(wrapper);
+        if(lst.size()==1)
+            return lst.get(0);
+        else
+            return null;
+    }
 }

+ 17 - 6
warning-web/src/main/resources/application.yaml

@@ -4,9 +4,20 @@
 spring:
   application:
     name: alarm-sharding
+#  #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: com.mysql.jdbc.Driver
-    url: jdbc:mysql://123.60.219.66/wisdom_cs?useUnicode=true&characterEncoding=UTF-8
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    url: jdbc:mysql://123.60.219.66/wisdom_cs_hnj?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
     username: root
     password: gyeepd@123
 #    driver-class-name: oracle.jdbc.OracleDriver
@@ -29,7 +40,6 @@ spring:
     time-zone: GMT+8
     default-property-inclusion: always
 
-
 mybatis-plus:
   typeAliasesPackage: com.gyee.wisdom.alarm.sharding.entity
   mapper-locations: classpath:mappers/*.xml
@@ -79,9 +89,10 @@ sharding:
 count:
   custom: true
   fault: false
-stationname:
-  BY
+stationname: HNJ
 #tablespace: TS_GDSJ_DATA
 tablespace: TS_NXFD_DATA
 adapterUrl: http://123.60.219.66:8011/ts
-rule_encryption: false
+rule_encryption: false
+
+

+ 8 - 9
warning-web/src/main/resources/banner.txt

@@ -1,9 +1,8 @@
-          _                                      _                          _   _
-   __ _  | |   __ _   _ __   _ __ ___      ___  | |__     __ _   _ __    __| | (_)  _ __     __ _
-  / _` | | |  / _` | | '__| | '_ ` _ \    / __| | '_ \   / _` | | '__|  / _` | | | | '_ \   / _` |
- | (_| | | | | (_| | | |    | | | | | |   \__ \ | | | | | (_| | | |    | (_| | | | | | | | | (_| |
-  \__,_| |_|  \__,_| |_|    |_| |_| |_|   |___/ |_| |_|  \__,_| |_|     \__,_| |_| |_| |_|  \__, |
-                                                                                            |___/
-
-
- :: alarm-sharding ::                    version 1.0.0
+                               _                                       _
+                              (_)                                     | |
+ __      __ __ _  _ __  _ __   _  _ __    __ _  ______ __      __ ___ | |__
+ \ \ /\ / // _` || '__|| '_ \ | || '_ \  / _` ||______|\ \ /\ / // _ \| '_ \
+  \ V  V /| (_| || |   | | | || || | | || (_| |         \ V  V /|  __/| |_) |
+   \_/\_/  \__,_||_|   |_| |_||_||_| |_| \__, |          \_/\_/  \___||_.__/
+                                          __/ |
+                                         |___/

+ 1 - 1
warning-web/src/main/resources/mappers-oracle/FaultHistoryMapper.xml

@@ -26,7 +26,7 @@
 
 
     <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 faulthistory  SET  CONFIRMTYPE=#{confirmType} ,CONFIRMPERSON=#{userName},ALERTSNAPID=#{alarmSnpaId},CONFIRMTIME=sysdate  where SNAPID = #{faultSnapId} and CONFIRMTYPE=0
     </update>
 
 

+ 14 - 1
warning-web/src/main/resources/mappers/FaultInfoMapper.xml

@@ -47,7 +47,7 @@
         order by h.faultTime desc
     </select>
 
-    <select id="getRecentFault" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.FaultInfo">
+    <select id="getRecentFault2" 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,
@@ -62,6 +62,19 @@
         AND h.faultTime >= #{faulttime}
         order by h.faultTime desc
     </select>
+    <select id="getRecentFault" 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">