Sfoglia il codice sorgente

chore(P2): 替换mysql驱动,移除emoji统一日志格式

- mysql-connector-java → mysql-connector-j 8.0.33
- TDengineService: 移除9处emoji(✅❌⚠️)
- 统一使用SLF4J {}占位符,无字符串拼接
mqy20260511
humanleft 4 giorni fa
parent
commit
5cbb11d169

+ 3
- 2
iot-platform/pom.xml Vedi File

@@ -65,8 +65,9 @@
65 65
 
66 66
         <!-- Mysql驱动 -->
67 67
         <dependency>
68
-            <groupId>mysql</groupId>
69
-            <artifactId>mysql-connector-java</artifactId>
68
+            <groupId>com.mysql</groupId>
69
+            <artifactId>mysql-connector-j</artifactId>
70
+            <version>8.0.33</version>
70 71
         </dependency>
71 72
 
72 73
         <!-- TDengine JDBC -->

+ 8
- 8
iot-platform/src/main/java/com/iot/platform/service/TDengineService.java Vedi File

@@ -61,9 +61,9 @@ public class TDengineService {
61 61
             config.setConnectionTestQuery("SELECT NOW()");
62 62
             config.setValidationTimeout(3000);
63 63
             this.dataSource = new HikariDataSource(config);
64
-            log.info("TDengine 连接池初始化完成");
64
+            log.info("TDengine 连接池初始化完成");
65 65
         } catch (Exception e) {
66
-            log.warn("⚠️ TDengine 连接池初始化失败: {}", e.getMessage());
66
+            log.warn("TDengine 连接池初始化失败: {}", e.getMessage());
67 67
             this.dataSource = null;
68 68
         }
69 69
         dataSourceInitialized = true;
@@ -205,7 +205,7 @@ public class TDengineService {
205 205
             return true;
206 206
 
207 207
         } catch (SQLException e) {
208
-            log.error("表结构初始化失败: {}.{} | {}", dbName, table, e.getMessage());
208
+            log.error("表结构初始化失败: {}.{} | {}", dbName, table, e.getMessage());
209 209
             return false;
210 210
         } finally {
211 211
             if (stmt != null) try { stmt.close(); } catch (SQLException ignored) {}
@@ -238,7 +238,7 @@ public class TDengineService {
238 238
             }
239 239
         }
240 240
 
241
-        log.info("批量写入成功: {} | 条数: {}", table, dataList.size());
241
+        log.info("批量写入成功: {} | 条数: {}", table, dataList.size());
242 242
         return true;
243 243
     }
244 244
 
@@ -282,11 +282,11 @@ public class TDengineService {
282 282
         } catch (SQLException e) {
283 283
             // 表不存在时尝试重建表后重试
284 284
             if (e.getMessage().contains("Table does not exist")) {
285
-                log.warn("⚠️ 表不存在,重建表: {}", table);
285
+                log.warn("表不存在,重建表: {}", table);
286 286
                 initTableStructure(dbName, supertablename, table, Collections.emptySet());
287 287
                 return insertBatchRetry(dbName, supertablename, table, dataList);
288 288
             }
289
-            log.error("批量写入 SQL 失败: {} | 错误: {}", table, e.getMessage());
289
+            log.error("批量写入 SQL 失败: {} | 错误: {}", table, e.getMessage());
290 290
             return false;
291 291
         } finally {
292 292
             if (stmt != null) try { stmt.close(); } catch (SQLException ignored) {}
@@ -326,7 +326,7 @@ public class TDengineService {
326 326
             stmt.executeUpdate(finalSql);
327 327
             return true;
328 328
         } catch (SQLException e) {
329
-            log.error("重试插入失败: {} | 错误: {}", table, e.getMessage());
329
+            log.error("重试插入失败: {} | 错误: {}", table, e.getMessage());
330 330
             return false;
331 331
         } finally {
332 332
             if (stmt != null) try { stmt.close(); } catch (SQLException ignored) {}
@@ -381,7 +381,7 @@ public class TDengineService {
381 381
                         escapeValue(supertablename)
382 382
                 );
383 383
                 stmt.executeUpdate(tableSql);
384
-                log.info("子表创建成功: {}", table);
384
+                log.info("子表创建成功: {}", table);
385 385
             }
386 386
         } catch (SQLException e) {
387 387
             log.warn("检查表存在性失败,继续尝试插入: {}", e.getMessage());

Loading…
Annulla
Salva