Browse Source

1.risk-calc 相关bug修改

wanghs 2 years ago
parent
commit
bb1e5f0d8b

+ 2 - 2
risk-calc/build.gradle

@@ -17,9 +17,9 @@ apply plugin: 'io.spring.dependency-management'
 
 dependencies {
 
-   // implementation fileTree(dir: 'src/main/lib', include: '*.jar')
+   implementation fileTree(dir: 'src/main/lib', include: '*.jar')
     //implementation ("org.postgresql:postgresql:$postgresqlDriverVersion")
-    implementation ("mysql:mysql-connector-java:$mysqlConnectorVersion")
+   // implementation ("mysql:mysql-connector-java:$mysqlConnectorVersion")
 
     implementation("$bootGroup:spring-boot-starter-web")
     implementation("$bootGroup:spring-boot-starter-undertow")

BIN
risk-calc/src/main/lib/ojdbc6.jar


+ 10 - 10
risk-calc/src/main/resources/application.yaml

@@ -5,19 +5,19 @@ spring:
   application:
     name: risk-calc
   datasource:
-#    driver-class-name: oracle.jdbc.OracleDriver
-#    url: jdbc:oracle:thin:@10.83.68.165:1521:gdsj
-#    username: gdprod
-#    password: gd123
-    driver-class-name: com.mysql.jdbc.Driver
-    url: jdbc:mysql://123.60.219.66/wisdom_cs?useUnicode=true&characterEncoding=UTF-8
-    username: root
-    password: gyeepd@123
+    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?useUnicode=true&characterEncoding=UTF-8
+#    username: root
+#    password: gyeepd@123
 #    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
+    type: com.alibaba.druid.pool.DruidDataSource
     druid:
       max-active: 20
       initial-size: 1
@@ -32,7 +32,7 @@ spring:
 
 mybatis-plus:
   typeAliasesPackage: com.gyee.wisdom.riskcalc.entity
-  mapper-locations: classpath:mappers/*.xml
+  mapper-locations: classpath:mappers-oracle/*.xml
   global-config:
     #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
     id-type: 3

+ 12 - 3
risk-calc/src/main/resources/mappers-oracle/AlarmSnapMapper.xml

@@ -140,6 +140,7 @@
         WHERE category1 = #{category1} and lastupdatetime >= #{lastupdatetime}
         order by lastupdatetime desc
     </select>
+
     <select id="getLatest" parameterType="java.util.Map" resultType="com.gyee.wisdom.riskcalc.entity.AlarmSnapInfo">
         SELECT
         s.id as id,
@@ -147,20 +148,28 @@
         s.stationid as stationId,
         s.alertvalue as alertValue,
         s.stationname as stationName,
-        s.windturbineid  as windturbineId,
+        s.windturbineid as windturbineId,
+        s.category1 as alarmType,
         s.isopened as isOpened,
         s.lastupdatetime as lastUpdateTime,
         s.rank as rank,
         r.id as ruleId
         from
         alarmsnap s
-        left join alertrule2 r on s.alertvalue = r.ednavalue
+        <if test="ruleType !=null and ruleType !=''">
+            <if test="ruleType=='custom'">
+                left join alertrule2 r on s.alertvalue = r.ednavalue
+            </if>
+            <if test="ruleType=='windturbine'">
+                left join warning2 r on s.alertvalue = r.ednavalue
+            </if>
+        </if>
         where
         1=1
         <if test="ruleType!= null">
             and s.category1 =#{ruleType}
         </if>
-        <if test="category1 !=null and category1 !=''">
+        <if test="ruleIdList !=null and ruleIdList.size>0">
             and r.id in
             <foreach item="item" index="index" collection="ruleIdList"  open="(" separator="," close=")">
                 #{item}

+ 11 - 2
risk-calc/src/main/resources/mappers-postgresql/AlarmSnapMapper.xml

@@ -133,6 +133,7 @@
         WHERE category1 = #{category1} and lastupdatetime >= #{lastupdatetime}
         order by lastupdatetime desc
     </select>
+
     <select id="getLatest" parameterType="java.util.Map" resultType="com.gyee.wisdom.riskcalc.entity.AlarmSnapInfo">
         SELECT
         s.id as id,
@@ -141,19 +142,27 @@
         s.alertvalue as alertValue,
         s.stationname as stationName,
         s.windturbineid as windturbineId,
+        s.category1 as alarmType,
         s.isopened as isOpened,
         s.lastupdatetime as lastUpdateTime,
         s.rank as rank,
         r.id as ruleId
         from
         alarmsnap s
-        left join alertrule2 r on s.alertvalue = r.ednavalue
+        <if test="ruleType !=null and ruleType !=''">
+            <if test="ruleType=='custom'">
+                left join alertrule2 r on CONVERT(s.alertvalue,SIGNED) = r.ednavalue
+            </if>
+            <if test="ruleType=='windturbine'">
+                left join warning2 r on s.alertvalue = r.ednavalue
+            </if>
+        </if>
         where
         1=1
         <if test="ruleType!= null">
             and s.category1 =#{ruleType}
         </if>
-        <if test="category1 !=null and category1 !=''">
+        <if test="ruleIdList !=null and ruleIdList.size>0">
             and r.id in
             <foreach item="item" index="index" collection="ruleIdList"  open="(" separator="," close=")">
                 #{item}