From c78ff4fdea800c3e7370d182bc9453c563c062e5 Mon Sep 17 00:00:00 2001 From: jiao Date: Wed, 13 May 2026 15:48:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=90=E8=A1=8C=E6=97=B6=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Auth服务: 添加RestTemplate Bean - 所有服务: JDBC URL characterEncoding=utf8mb4 -> utf8 - Gateway: CORS配置allowedOrigins -> allowedOriginPatterns - 所有服务pom.xml: 添加spring-boot-maven-plugin repackage execution --- backend/analytics-service/pom.xml | 7 +++++++ .../analytics-service/src/main/resources/application.yml | 2 +- backend/archive-service/pom.xml | 2 +- backend/archive-service/src/main/resources/application.yml | 2 +- backend/auth-service/pom.xml | 7 +++++++ .../main/java/com/artedu/auth/AuthServiceApplication.java | 7 +++++++ backend/auth-service/src/main/resources/application.yml | 2 +- backend/conversation-service/pom.xml | 2 +- .../src/main/resources/application.yml | 2 +- backend/gateway/pom.xml | 7 +++++++ backend/gateway/src/main/resources/application.yml | 2 +- backend/generation-service/pom.xml | 2 +- .../generation-service/src/main/resources/application.yml | 2 +- backend/intent-service/pom.xml | 2 +- backend/intent-service/src/main/resources/application.yml | 2 +- backend/kb-admin-service/pom.xml | 7 +++++++ .../kb-admin-service/src/main/resources/application.yml | 2 +- backend/recommendation-service/pom.xml | 2 +- .../src/main/resources/application.yml | 2 +- 19 files changed, 49 insertions(+), 14 deletions(-) diff --git a/backend/analytics-service/pom.xml b/backend/analytics-service/pom.xml index aa79249..ee7c99f 100644 --- a/backend/analytics-service/pom.xml +++ b/backend/analytics-service/pom.xml @@ -27,6 +27,13 @@ org.springframework.boot spring-boot-maven-plugin + + + + repackage + + + diff --git a/backend/analytics-service/src/main/resources/application.yml b/backend/analytics-service/src/main/resources/application.yml index dd133e3..0a41239 100644 --- a/backend/analytics-service/src/main/resources/application.yml +++ b/backend/analytics-service/src/main/resources/application.yml @@ -6,7 +6,7 @@ spring: name: analytics-service datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false + url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false username: ${MYSQL_USERNAME:root} password: ${MYSQL_PASSWORD:root} redis: diff --git a/backend/archive-service/pom.xml b/backend/archive-service/pom.xml index 515a9ba..7318d6a 100644 --- a/backend/archive-service/pom.xml +++ b/backend/archive-service/pom.xml @@ -18,7 +18,7 @@ - org.springframework.bootspring-boot-maven-plugin + org.springframework.bootspring-boot-maven-pluginrepackage diff --git a/backend/archive-service/src/main/resources/application.yml b/backend/archive-service/src/main/resources/application.yml index fc3437f..420d1bc 100644 --- a/backend/archive-service/src/main/resources/application.yml +++ b/backend/archive-service/src/main/resources/application.yml @@ -6,7 +6,7 @@ spring: name: archive-service datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false + url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false username: ${MYSQL_USERNAME:root} password: ${MYSQL_PASSWORD:root} redis: diff --git a/backend/auth-service/pom.xml b/backend/auth-service/pom.xml index c3076fc..e1d8ff9 100644 --- a/backend/auth-service/pom.xml +++ b/backend/auth-service/pom.xml @@ -46,6 +46,13 @@ org.springframework.boot spring-boot-maven-plugin + + + + repackage + + + diff --git a/backend/auth-service/src/main/java/com/artedu/auth/AuthServiceApplication.java b/backend/auth-service/src/main/java/com/artedu/auth/AuthServiceApplication.java index 0a089af..dc6f48f 100644 --- a/backend/auth-service/src/main/java/com/artedu/auth/AuthServiceApplication.java +++ b/backend/auth-service/src/main/java/com/artedu/auth/AuthServiceApplication.java @@ -2,6 +2,8 @@ package com.artedu.auth; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.web.client.RestTemplate; /** * 认证授权服务启动类 @@ -9,6 +11,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication(scanBasePackages = {"com.artedu.auth", "com.artedu.common"}) public class AuthServiceApplication { + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } + public static void main(String[] args) { SpringApplication.run(AuthServiceApplication.class, args); } diff --git a/backend/auth-service/src/main/resources/application.yml b/backend/auth-service/src/main/resources/application.yml index 03a0254..068291a 100644 --- a/backend/auth-service/src/main/resources/application.yml +++ b/backend/auth-service/src/main/resources/application.yml @@ -6,7 +6,7 @@ spring: name: auth-service datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false + url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false username: ${MYSQL_USERNAME:root} password: ${MYSQL_PASSWORD:root} redis: diff --git a/backend/conversation-service/pom.xml b/backend/conversation-service/pom.xml index 15b08c7..ea7f67f 100644 --- a/backend/conversation-service/pom.xml +++ b/backend/conversation-service/pom.xml @@ -18,7 +18,7 @@ - org.springframework.bootspring-boot-maven-plugin + org.springframework.bootspring-boot-maven-pluginrepackage diff --git a/backend/conversation-service/src/main/resources/application.yml b/backend/conversation-service/src/main/resources/application.yml index 6fc445b..5ab17b3 100644 --- a/backend/conversation-service/src/main/resources/application.yml +++ b/backend/conversation-service/src/main/resources/application.yml @@ -6,7 +6,7 @@ spring: name: conversation-service datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false + url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false username: ${MYSQL_USERNAME:root} password: ${MYSQL_PASSWORD:root} redis: diff --git a/backend/gateway/pom.xml b/backend/gateway/pom.xml index 771c2ad..ce7753b 100644 --- a/backend/gateway/pom.xml +++ b/backend/gateway/pom.xml @@ -22,6 +22,13 @@ org.springframework.boot spring-boot-maven-plugin + + + + repackage + + + diff --git a/backend/gateway/src/main/resources/application.yml b/backend/gateway/src/main/resources/application.yml index 8f95182..e594c69 100644 --- a/backend/gateway/src/main/resources/application.yml +++ b/backend/gateway/src/main/resources/application.yml @@ -42,7 +42,7 @@ spring: globalcors: cors-configurations: '[/**]': - allowedOrigins: "*" + allowedOriginPatterns: "*" allowedMethods: "*" allowedHeaders: "*" allowCredentials: true diff --git a/backend/generation-service/pom.xml b/backend/generation-service/pom.xml index 07c7103..e85f80d 100644 --- a/backend/generation-service/pom.xml +++ b/backend/generation-service/pom.xml @@ -17,7 +17,7 @@ - org.springframework.bootspring-boot-maven-plugin + org.springframework.bootspring-boot-maven-pluginrepackage diff --git a/backend/generation-service/src/main/resources/application.yml b/backend/generation-service/src/main/resources/application.yml index 6d9215d..fca4899 100644 --- a/backend/generation-service/src/main/resources/application.yml +++ b/backend/generation-service/src/main/resources/application.yml @@ -6,7 +6,7 @@ spring: name: generation-service datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false + url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false username: ${MYSQL_USERNAME:root} password: ${MYSQL_PASSWORD:root} redis: diff --git a/backend/intent-service/pom.xml b/backend/intent-service/pom.xml index b5d1b2b..c36a227 100644 --- a/backend/intent-service/pom.xml +++ b/backend/intent-service/pom.xml @@ -17,7 +17,7 @@ - org.springframework.bootspring-boot-maven-plugin + org.springframework.bootspring-boot-maven-pluginrepackage diff --git a/backend/intent-service/src/main/resources/application.yml b/backend/intent-service/src/main/resources/application.yml index 222fec7..877583a 100644 --- a/backend/intent-service/src/main/resources/application.yml +++ b/backend/intent-service/src/main/resources/application.yml @@ -6,7 +6,7 @@ spring: name: intent-service datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false + url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false username: ${MYSQL_USERNAME:root} password: ${MYSQL_PASSWORD:root} redis: diff --git a/backend/kb-admin-service/pom.xml b/backend/kb-admin-service/pom.xml index 1dd6636..ac96b88 100644 --- a/backend/kb-admin-service/pom.xml +++ b/backend/kb-admin-service/pom.xml @@ -27,6 +27,13 @@ org.springframework.boot spring-boot-maven-plugin + + + + repackage + + + diff --git a/backend/kb-admin-service/src/main/resources/application.yml b/backend/kb-admin-service/src/main/resources/application.yml index 2b92406..f1049ab 100644 --- a/backend/kb-admin-service/src/main/resources/application.yml +++ b/backend/kb-admin-service/src/main/resources/application.yml @@ -6,7 +6,7 @@ spring: name: kb-admin-service datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false + url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false username: ${MYSQL_USERNAME:root} password: ${MYSQL_PASSWORD:root} redis: diff --git a/backend/recommendation-service/pom.xml b/backend/recommendation-service/pom.xml index 95220f7..2f44f18 100644 --- a/backend/recommendation-service/pom.xml +++ b/backend/recommendation-service/pom.xml @@ -18,7 +18,7 @@ - org.springframework.bootspring-boot-maven-plugin + org.springframework.bootspring-boot-maven-pluginrepackage diff --git a/backend/recommendation-service/src/main/resources/application.yml b/backend/recommendation-service/src/main/resources/application.yml index 96f04b4..3589666 100644 --- a/backend/recommendation-service/src/main/resources/application.yml +++ b/backend/recommendation-service/src/main/resources/application.yml @@ -6,7 +6,7 @@ spring: name: recommendation-service datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false + url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false username: ${MYSQL_USERNAME:root} password: ${MYSQL_PASSWORD:root} redis: