瀏覽代碼

Merge remote-tracking branch 'origin/uat' into uat

zxfqwert 4 月之前
父節點
當前提交
a2f502f819

+ 3 - 2
suishenbang-admin/src/main/resources/application-uat-druid.yml

@@ -4,10 +4,11 @@ spring:
         type: com.alibaba.druid.pool.DruidDataSource
         driverClassName: com.mysql.jdbc.Driver
         druid:
-            #            break-after-acquire-failure: true
-            #            connection-error-retry-attempts: 1
             # 主库数据源
             master:
+#                url: jdbc:mysql://pc-uf637rafh16b6nl16.rwlb.rds.aliyuncs.com:3306/ssbtest?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+#                username: ssbtest
+#                password: Ssbtest#0812
                 url: jdbc:mysql://pc-uf6y41z2eu263pi22.rwlb.rds.aliyuncs.com:3306/ssbtest?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
                 username: ssbtest
                 password: Ssbtest#0617

+ 6 - 2
suishenbang-admin/src/main/resources/application-uat.yml

@@ -31,19 +31,23 @@ hana:
   #  hana-url: jdbc:sap://hanaentsltd.nipponpaint.com.cn:30015?reconnect=true
   #  hana-user: SSB_HANA
   #  hana-pwd: s$EW12445T
+#  hana-driver: com.sap.db.jdbc.Driver
+#  hana-url: jdbc:sap://hanaentsltd.nipponpaint.com.cn:30015?reconnect=true
+#  hana-user: SSB_HANA
+#  hana-pwd: s$EW12445T
   hana-driver: com.sap.db.jdbc.Driver
   hana-url: jdbc:sap://hanaentsltp.nipponpaint.com.cn:30015?reconnect=true
   hana-user: SSB_HANA
   hana-pwd: Erty567*
-#  mysql-driver: com.mysql.jdbc.Driver
+  mysql-driver: com.mysql.jdbc.Driver
 #  mysql-url: jdbc:mysql://pc-uf637rafh16b6nl16.rwlb.rds.aliyuncs.com:3306/ssbtest?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
 #  mysql-user: ssbtest
 #  mysql-pwd: Ssbtest#0812
-  mysql-driver: com.mysql.jdbc.Driver
   mysql-url: jdbc:mysql://pc-uf6y41z2eu263pi22.rwlb.rds.aliyuncs.com:3306/ssbtest?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
   mysql-user: ssbtest
   mysql-pwd: Ssbtest#0617
 
+
 qiyeweixin:
   #企业微信id
   corpid: ww5444eb205d75e730

+ 3 - 4
suishenbang-api/src/main/resources/application-uat-druid.yml

@@ -9,10 +9,9 @@ spring:
 #                url: jdbc:mysql://pc-uf637rafh16b6nl16.rwlb.rds.aliyuncs.com:3306/ssbtest?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
 #                username: ssbtest
 #                password: Ssbtest#0812
-                url: jdbc:mysql://pc-uf6y41z2eu263pi22.rwlb.rds.aliyuncs.com:3306/ssbtest?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-                username: ssbtest
-                password: Ssbtest#0617
-
+                 url: jdbc:mysql://pc-uf6y41z2eu263pi22.rwlb.rds.aliyuncs.com:3306/ssbtest?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                 username: ssbtest
+                 password: Ssbtest#0617
             # 从库数据源
             slave:
                 # 从数据源开关/默认关闭

+ 38 - 6
suishenbang-sync/suishenbang-sync-common/src/main/java/com/dgtly/sync/service/HanaOrderComponent.java

@@ -1390,20 +1390,29 @@ public class HanaOrderComponent {
                     int rows = this.bulkLoadFromInputStream(testSql, inputStream);
                     long endTime = System.currentTimeMillis();
                     log.info("importing salesOrder := {} rows data into mysql from {} and cost {} ms!", rows, filePath, (endTime - beginTime));
+                }catch (Exception e) {
+                    log.error("加载数据到临时表", e);
+                    throw e; // 抛出异常让上层处理
                 }
 
                 //删除旧表
-                try (Connection tempConn = getMysqlConnection();
-                     Statement tempStmt = tempConn.createStatement()) {
+                // 删除旧表使用同一个连接
+                try (Statement tempStmt = conn.createStatement()) {
                     tempStmt.execute("DROP TABLE IF EXISTS meta_hana_sales_order_old");
                     log.info("成功删除旧表: meta_hana_sales_order_old");
                 } catch (Exception e) {
                     log.error("删除旧表失败,表名: meta_hana_sales_order_old", e);
+                    throw e; // 抛出异常让上层处理
                 }
 
+
+
                 // 1. 先设置会话级锁等待超时为3秒
                 try (Statement timeOut = conn.createStatement()) {
                     timeOut.execute("SET SESSION innodb_lock_wait_timeout = 3");
+                }catch (Exception e) {
+                    log.error("先设置会话级锁等待超时为3秒", e);
+                    throw e; // 抛出异常让上层处理
                 }
 
                 // 2. 执行RENAME并设置语句级超时(原子切换表(RENAME是原子操作))
@@ -1411,6 +1420,9 @@ public class HanaOrderComponent {
                     renameTable.setQueryTimeout(3); // 语句执行超时3秒
                     renameTable.execute("RENAME TABLE meta_hana_sales_order TO meta_hana_sales_order_old, " +
                             "meta_hana_sales_order_temp TO meta_hana_sales_order");
+                }catch (Exception e) {
+                    log.error("执行RENAME并设置语句级超时(原子切换表(RENAME是原子操作))", e);
+                    throw e; // 抛出异常让上层处理
                 }
 
                 // 提交事务
@@ -1518,20 +1530,28 @@ public class HanaOrderComponent {
                     int rows = this.bulkLoadFromInputStream(testSql, inputStream);
                     long endTime = System.currentTimeMillis();
                     log.info("importing selfDeliverOrder := {} rows data into mysql from {} and cost {} ms!", rows, filePath, (endTime - beginTime));
+                }catch (Exception e) {
+                    log.error("加载数据到临时表", e);
+                    throw e; // 抛出异常让上层处理
                 }
 
+
                 //删除旧表
-                try (Connection tempConn = getMysqlConnection();
-                     Statement tempStmt = tempConn.createStatement()) {
+                try (Statement tempStmt = conn.createStatement()) {
                     tempStmt.execute("DROP TABLE IF EXISTS meta_hana_self_deliver_order_old");
                     log.info("成功删除旧表: meta_hana_self_deliver_order_old");
                 } catch (Exception e) {
                     log.error("删除旧表失败,表名: meta_hana_self_deliver_order_old", e);
+                    throw e; // 抛出异常让上层处理
                 }
 
+
                 // 1. 先设置会话级锁等待超时为3秒
                 try (Statement timeOut = conn.createStatement()) {
                     timeOut.execute("SET SESSION innodb_lock_wait_timeout = 3");
+                }catch (Exception e) {
+                    log.error("先设置会话级锁等待超时为3秒", e);
+                    throw e; // 抛出异常让上层处理
                 }
 
                 // 2. 执行RENAME并设置语句级超时(原子切换表(RENAME是原子操作))
@@ -1539,6 +1559,9 @@ public class HanaOrderComponent {
                     renameTable.setQueryTimeout(3); // 语句执行超时3秒
                     renameTable.execute("RENAME TABLE meta_hana_self_deliver_order TO meta_hana_self_deliver_order_old, " +
                             "meta_hana_self_deliver_order_temp TO meta_hana_self_deliver_order");
+                }catch (Exception e) {
+                    log.error("执行RENAME并设置语句级超时(原子切换表(RENAME是原子操作))", e);
+                    throw e; // 抛出异常让上层处理
                 }
 
 
@@ -1602,21 +1625,27 @@ public class HanaOrderComponent {
                     int rows = this.bulkLoadFromInputStream(testSql, inputStream);
                     long endTime = System.currentTimeMillis();
                     log.info("importing deliverOrder := {} rows data into mysql from {} and cost {} ms!", rows, filePath, (endTime - beginTime));
+                }catch (Exception e) {
+                    log.error("加载数据到临时表", e);
+                    throw e; // 抛出异常让上层处理
                 }
 
                 //删除旧表
-                try (Connection tempConn = getMysqlConnection();
-                     Statement tempStmt = tempConn.createStatement()) {
+                try (Statement tempStmt = conn.createStatement()) {
                     tempStmt.execute("DROP TABLE IF EXISTS meta_hana_deliver_order_old");
                     log.info("成功删除旧表: meta_hana_deliver_order_old");
                 } catch (Exception e) {
                     log.error("删除旧表失败,表名: meta_hana_deliver_order_old", e);
+                    throw e; // 抛出异常让上层处理
                 }
 
 
                 // 1. 先设置会话级锁等待超时为3秒
                 try (Statement timeOut = conn.createStatement()) {
                     timeOut.execute("SET SESSION innodb_lock_wait_timeout = 3");
+                }catch (Exception e) {
+                    log.error("先设置会话级锁等待超时为3秒", e);
+                    throw e; // 抛出异常让上层处理
                 }
 
                 // 2. 执行RENAME并设置语句级超时(原子切换表(RENAME是原子操作))
@@ -1624,6 +1653,9 @@ public class HanaOrderComponent {
                     renameTable.setQueryTimeout(3); // 语句执行超时3秒
                     renameTable.execute("RENAME TABLE meta_hana_deliver_order TO meta_hana_deliver_order_old, " +
                             "meta_hana_deliver_order_temp TO meta_hana_deliver_order");
+                }catch (Exception e) {
+                    log.error("执行RENAME并设置语句级超时(原子切换表(RENAME是原子操作))", e);
+                    throw e; // 抛出异常让上层处理
                 }