Browse Source

更新测试和新增配置

andy 8 months ago
parent
commit
cb1666659b

+ 3 - 13
mainFactory/pom.xml

@@ -30,12 +30,6 @@
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
-<!--            <exclusions>-->
-<!--                <exclusion>-->
-<!--                    <groupId>org.springframework.boot</groupId>-->
-<!--                    <artifactId>spring-boot-starter-logging</artifactId>-->
-<!--                </exclusion>-->
-<!--            </exclusions>-->
         </dependency>
 
         <dependency>
@@ -61,8 +55,8 @@
         </dependency>
 
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -85,6 +79,7 @@
         <dependency>
             <groupId>com.mysql</groupId>
             <artifactId>mysql-connector-j</artifactId>
+            <scope>runtime</scope>
         </dependency>
 
         <dependency>
@@ -151,11 +146,6 @@
             <artifactId>com.ibm.mq.jakarta.client</artifactId>
             <version>9.3.4.1</version>
         </dependency>
-<!--        <dependency>-->
-<!--            <groupId>cn.hutool</groupId>-->
-<!--            <artifactId>hutool-all</artifactId>-->
-<!--            <version>5.8.18</version>-->
-<!--        </dependency>-->
         <dependency>
             <groupId>cn.com.kingbase</groupId>
             <artifactId>kingbase8</artifactId>

+ 6 - 2
mainFactory/src/main/java/org/bfkj/application/AuthApplicationImpl.java

@@ -260,7 +260,9 @@ public class AuthApplicationImpl {
         String userToken = MapTools.getMD5Str(String.valueOf(new Date().getTime()));
         try {
             Object token_valid_duration = userInfoList.get(0).get("token_valid_duration");
-            myDbHelper.updateByCondition("update t_user set user_token = ?,user_status = 1,signInTime = NOW(),token_valid_time = if(" + Objects.isNull(token_valid_duration) + ",null, DATE_ADD(NOW(),INTERVAL   " + (Objects.isNull(token_valid_duration) ? 0 : Integer.parseInt(token_valid_duration.toString())) + " SECOND) )  where user_id= ? ", null, userToken, userID);
+            myDbHelper.updateByCondition("update t_user set user_token = ?,user_status = 1,LogoutTime = null," +
+                                                 "signInTime = NOW()," +
+                                                 "token_valid_time = if(" + Objects.isNull(token_valid_duration) + ",null, DATE_ADD(NOW(),INTERVAL   " + (Objects.isNull(token_valid_duration) ? 0 : Integer.parseInt(token_valid_duration.toString())) + " SECOND) )  where user_id= ? ", null, userToken, userID);
             return processSuccess(new HashMap<String, Object>() {{
                 put("user_token", userToken);
                 put("user_id", userID);
@@ -274,7 +276,9 @@ public class AuthApplicationImpl {
     public String verificationUserToken(Map<String, String> params) {
         String user_token = params.get("user_token");
         String user_id = params.get("user_id");
-        if (Objects.isNull(user_token) || Objects.isNull(user_id)) return "user_token 或则 user_id为空";
+        if (Objects.isNull(user_token) || Objects.isNull(user_id)) {
+            return "user_token 或则 user_id为空";
+        }
         MyDbHelper myDbHelper = ObjectMap.getordropMyDbHelper(AppConfig.REMOTE_DB_CONNECT);
         if (Objects.nonNull(myDbHelper.getErrorMessage())) {
             return "验证user_token获取远程数据库连接失败" + myDbHelper.getErrorMessage();

+ 71 - 0
mainFactory/src/main/resources/application-jf.yml

@@ -0,0 +1,71 @@
+server:
+  port: 8043
+  #  ssl:
+  #    key-store: file:/app/database2.0/ssl/shiyq.xyz.jks
+  #    enable: true
+  #    key-store-password: dr41d2jn58c2b88
+  #    key-store-type: JKS
+  servlet:
+    encoding:
+      charset: UTF-8
+      force: true
+      enabled: true
+  codec:
+    max-in-memory-size: -1
+  application:
+    name: mainFactory
+spring:
+  web:
+    resources:
+      static-locations: file:/app/module/dist
+  mvc:
+    view:
+      prefix: /
+      suffix: .html
+    pathmatch:
+      matching-strategy: ant_path_matcher
+
+
+log:
+  url: jdbc:mysql://192.168.243.11:3306/DPFBLOG
+  title: bigdata
+  cipher: ml9*pO4866
+  type: com.mysql.cj.jdbc.Driver
+
+mydb:
+  url: jdbc:mysql://192.168.243.11:3306/DISACenter_2
+  title: bigdata
+  cipher: ml9*pO4866
+  type: com.mysql.cj.jdbc.Driver
+  serviceURL: 192.168.243.11:8043
+#isEs:
+#  open: true
+#  scheme: http
+#  hostname: 120.26.64.82
+#  port: 9200
+#  auth: false
+#  username: ""
+#  password: ""
+#  successIndexName: "success_log_center2"
+#  errorIndexName: "error_log_center2"
+
+isEs:
+  open: false
+  scheme: http
+  hostname: 10.211.67.175
+  port: 9201
+  auth: true
+  username: "elastic"
+  password: "TUihk5^a0J+GkI4!4"
+  successIndexName: "success_log_center2"
+  errorIndexName: "error_log_center2"
+
+
+service:
+  pool:
+    maxPoolSize: 512
+    corePoolSize: 6
+    queueCapacity: 1024
+    keepAliveSeconds: 60
+    threadNamePrefix: logthreadpool
+    waitForTasksToCompleteOnShutdown: true

+ 0 - 2
mainFactory/src/main/resources/application.yml

@@ -19,8 +19,6 @@ spring:
     additional-location: file:/app/config/
   application:
     name: mainFactory
-  profiles:
-    active:
 log:
   url: ${LOG_DB_URL:jdbc:mysql://localhost:3306/DPFBLOG}
   title: ${LOG_DB_USER:root}

+ 1 - 1
mainFactory/src/test/java/org/bfkj/protocol/MyRabbitMQTest.java

@@ -1,6 +1,6 @@
 package org.bfkj.protocol;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public class MyRabbitMQTest {
 

+ 3 - 1
mainFactory/src/test/java/org/bfkj/protocol/WebAPITest.java

@@ -1,6 +1,8 @@
 package org.bfkj.protocol;
 
-import org.junit.Test;
+
+
+import org.junit.jupiter.api.Test;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;

+ 25 - 0
mainFactory/src/test/java/org/bfkj/utils/MyDbHelperTest.java

@@ -0,0 +1,25 @@
+package org.bfkj.utils;
+
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.test.context.ActiveProfiles;
+
+import java.sql.SQLException;
+import java.util.List;
+import java.util.Map;
+
+@SpringBootTest
+@ActiveProfiles("jf")
+public class MyDbHelperTest  {
+    @Test
+    public void testJdbcDriver() throws SQLException {
+       MyDbHelper myDbHelper = new MyDbHelper("{\"username\":\"system\",  \"password\":\"ml9*pO4866\",  \"url\":\"jdbc:kingbase8://192.168.243.13:54321/baggagebusiness\",  \"driver-class-name\":\"com.kingbase8.Driver\"}");
+        JdbcTemplate theJdbcTemplate = myDbHelper.getTheJdbcTemplate();
+        List<Map<String, Object>> maps = theJdbcTemplate.queryForList("""
+                                                                              select * from baggagebusiness.flight_schedule t1
+                                                                                       where carrierFlightsDate = '2024-04-01'
+                                                                                       """);
+        System.out.println(maps);
+    }
+}

+ 1 - 1
mainFactory/src/test/java/org/bfkj/utils/ScriptEngineProTest.java

@@ -1,7 +1,7 @@
 package org.bfkj.utils;
 
 import org.bfkj.protocol.WebAPI;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory;
 import org.openjdk.nashorn.api.scripting.ScriptObjectMirror;