Ver Fonte

refactor: 单体应用架构重构与配置统一

- 移除各模块独立的 MyBatisPlusConfig,统一到 lingyue-starter
- 移除各模块 yml 配置文件,统一使用 properties 格式
- 移除 SpringDoc 配置(暂时禁用 Swagger)
- 移除 Feign Client(单体应用直接注入 Service)
- 修复 AjaxResult getter/setter 和 ServiceException 构造函数
- 更新依赖版本(Spring Boot 3.1.5, MyBatis-Plus 3.5.8)
- 更新进度报告(整体进度 45%)
何文松 há 1 mês atrás
pai
commit
579dc4bce2
41 ficheiros alterados com 294 adições e 1062 exclusões
  1. 0 24
      backend/ai-service/src/main/java/com/lingyue/ai/config/MyBatisPlusConfig.java
  2. 20 0
      backend/ai-service/src/main/resources/application.properties
  3. 0 60
      backend/ai-service/src/main/resources/application.yml
  4. 8 1
      backend/auth-service/pom.xml
  5. 0 24
      backend/auth-service/src/main/resources/application-dev.yml
  6. 0 25
      backend/auth-service/src/main/resources/application-prod.yml
  7. 23 0
      backend/auth-service/src/main/resources/application.properties
  8. 0 80
      backend/auth-service/src/main/resources/application.yml
  9. 18 0
      backend/common/src/main/java/com/lingyue/common/domain/AjaxResult.java
  10. 11 0
      backend/common/src/main/java/com/lingyue/common/exception/ServiceException.java
  11. 2 1
      backend/document-service/pom.xml
  12. 0 24
      backend/document-service/src/main/java/com/lingyue/document/config/MyBatisPlusConfig.java
  13. 16 0
      backend/document-service/src/main/resources/application.properties
  14. 0 57
      backend/document-service/src/main/resources/application.yml
  15. 0 11
      backend/gateway-service/src/main/resources/application-dev.yml
  16. 0 14
      backend/gateway-service/src/main/resources/application-prod.yml
  17. 0 88
      backend/gateway-service/src/main/resources/application.yml
  18. 0 24
      backend/graph-service/src/main/java/com/lingyue/graph/config/MyBatisPlusConfig.java
  19. 4 4
      backend/graph-service/src/main/java/com/lingyue/graph/controller/TextStorageController.java
  20. 15 0
      backend/graph-service/src/main/resources/application.properties
  21. 0 54
      backend/graph-service/src/main/resources/application.yml
  22. 15 1
      backend/lingyue-starter/pom.xml
  23. 4 5
      backend/lingyue-starter/src/main/java/com/lingyue/LingyueApplication.java
  24. 15 4
      backend/lingyue-starter/src/main/java/com/lingyue/config/MyBatisPlusConfig.java
  25. 0 109
      backend/lingyue-starter/src/main/java/com/lingyue/config/SpringDocConfig.java
  26. 0 32
      backend/lingyue-starter/src/main/resources/application-dev.yml
  27. 0 33
      backend/lingyue-starter/src/main/resources/application-prod.yml
  28. 0 193
      backend/lingyue-starter/src/main/resources/application.yml
  29. 2 1
      backend/notification-service/pom.xml
  30. 12 0
      backend/notification-service/src/main/resources/application.properties
  31. 0 21
      backend/notification-service/src/main/resources/application.yml
  32. 11 3
      backend/parse-service/pom.xml
  33. 2 4
      backend/parse-service/src/main/java/com/lingyue/parse/ParseServiceApplication.java
  34. 0 28
      backend/parse-service/src/main/java/com/lingyue/parse/client/GraphServiceClient.java
  35. 0 24
      backend/parse-service/src/main/java/com/lingyue/parse/config/MyBatisPlusConfig.java
  36. 1 1
      backend/parse-service/src/main/java/com/lingyue/parse/controller/FileUploadController.java
  37. 2 2
      backend/parse-service/src/main/java/com/lingyue/parse/service/PdfTextExtractionService.java
  38. 43 0
      backend/parse-service/src/main/resources/application.properties
  39. 0 104
      backend/parse-service/src/main/resources/application.yml
  40. 22 6
      backend/pom.xml
  41. 48 0
      进度报告.md

+ 0 - 24
backend/ai-service/src/main/java/com/lingyue/ai/config/MyBatisPlusConfig.java

@@ -1,24 +0,0 @@
-package com.lingyue.ai.config;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
-import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * MyBatis Plus 配置
- */
-@Configuration
-@MapperScan("com.lingyue.ai.repository")
-public class MyBatisPlusConfig {
-    
-    @Bean
-    public MybatisPlusInterceptor mybatisPlusInterceptor() {
-        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
-        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL));
-        return interceptor;
-    }
-}
-

+ 20 - 0
backend/ai-service/src/main/resources/application.properties

@@ -0,0 +1,20 @@
+# ============================================
+# AI Service 配置
+# ============================================
+
+# 引入公共配置
+spring.config.import=classpath:application-common.properties,classpath:application-infra.properties
+
+# 服务端口
+server.port=8004
+
+# 服务名称
+spring.application.name=ai-service
+
+# MyBatis Plus配置(覆盖公共配置中的type-aliases-package)
+mybatis-plus.type-aliases-package=com.lingyue.ai.entity
+
+# DeepSeek API配置
+deepseek.api-url=${DEEPSEEK_API_URL:https://api.deepseek.com}
+deepseek.api-key=${DEEPSEEK_API_KEY:}
+deepseek.timeout=30000

+ 0 - 60
backend/ai-service/src/main/resources/application.yml

@@ -1,60 +0,0 @@
-server:
-  port: 8004
-
-spring:
-  application:
-    name: ai-service
-  
-  # 数据库配置(Druid)
-  datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    druid:
-      driver-class-name: org.postgresql.Driver
-      url: jdbc:postgresql://localhost:5432/lingyue_zhibao
-      username: ${DB_USERNAME:postgres}
-      password: ${DB_PASSWORD:postgres}
-      initial-size: 5
-      min-idle: 5
-      max-active: 20
-      max-wait: 60000
-      time-between-eviction-runs-millis: 60000
-      min-evictable-idle-time-millis: 300000
-      validation-query: SELECT 1
-      test-while-idle: true
-      test-on-borrow: false
-      test-on-return: false
-      pool-prepared-statements: true
-      max-pool-prepared-statement-per-connection-size: 20
-      filters: stat,wall,slf4j
-  
-  # MyBatis Plus配置
-  mybatis-plus:
-    mapper-locations: classpath*:mapper/**/*Mapper.xml
-    type-aliases-package: com.lingyue.ai.entity
-    configuration:
-      map-underscore-to-camel-case: true
-      log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
-    global-config:
-      db-config:
-        id-type: assign_uuid
-  
-  # Nacos配置
-  cloud:
-    nacos:
-      discovery:
-        server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
-        namespace: public
-        group: DEFAULT_GROUP
-
-# DeepSeek API配置
-deepseek:
-  api-url: ${DEEPSEEK_API_URL:https://api.deepseek.com}
-  api-key: ${DEEPSEEK_API_KEY:}
-  timeout: 30000
-
-# 日志配置
-logging:
-  level:
-    root: INFO
-    com.lingyue: DEBUG
-

+ 8 - 1
backend/auth-service/pom.xml

@@ -30,6 +30,12 @@
             <artifactId>mybatis-plus-boot-starter</artifactId>
         </dependency>
         
+        <!-- MyBatis Plus Extension (for Pagination) -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-extension</artifactId>
+        </dependency>
+        
         <!-- Spring Boot Security -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -54,10 +60,11 @@
             <artifactId>postgresql</artifactId>
         </dependency>
         
-        <!-- Nacos Service Discovery -->
+        <!-- Nacos Service Discovery (单体应用设为 optional) -->
         <dependency>
             <groupId>com.alibaba.cloud</groupId>
             <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+            <optional>true</optional>
         </dependency>
         
         <!-- Common Module -->

+ 0 - 24
backend/auth-service/src/main/resources/application-dev.yml

@@ -1,24 +0,0 @@
-spring:
-  datasource:
-    url: jdbc:postgresql://localhost:5432/lingyue_zhibao
-    username: postgres
-    password: postgres
-  
-  data:
-    redis:
-      host: localhost
-      port: 6379
-  
-  cloud:
-    nacos:
-      discovery:
-        server-addr: localhost:8848
-
-jwt:
-  secret: lingyue-zhibao-secret-key-2024-please-change-in-production
-
-logging:
-  level:
-    root: INFO
-    com.lingyue: DEBUG
-

+ 0 - 25
backend/auth-service/src/main/resources/application-prod.yml

@@ -1,25 +0,0 @@
-spring:
-  datasource:
-    url: jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5432}/${DB_NAME:lingyue_zhibao}
-    username: ${DB_USERNAME:postgres}
-    password: ${DB_PASSWORD:postgres}
-  
-  data:
-    redis:
-      host: ${REDIS_HOST:localhost}
-      port: ${REDIS_PORT:6379}
-      password: ${REDIS_PASSWORD:}
-  
-  cloud:
-    nacos:
-      discovery:
-        server-addr: ${NACOS_SERVER_ADDR:nacos-server:8848}
-
-jwt:
-  secret: ${JWT_SECRET:lingyue-zhibao-secret-key-2024-please-change-in-production}
-
-logging:
-  level:
-    root: WARN
-    com.lingyue: INFO
-

+ 23 - 0
backend/auth-service/src/main/resources/application.properties

@@ -0,0 +1,23 @@
+# ============================================
+# Auth Service 配置
+# ============================================
+
+# 引入公共配置
+spring.config.import=classpath:application-common.properties,classpath:application-infra.properties
+
+# 服务端口
+server.port=8001
+
+# 服务名称
+spring.application.name=auth-service
+
+# MyBatis Plus配置(覆盖公共配置中的type-aliases-package)
+mybatis-plus.type-aliases-package=com.lingyue.auth.entity
+mybatis-plus.global-config.db-config.logic-delete-field=delFlag
+mybatis-plus.global-config.db-config.logic-delete-value=1
+mybatis-plus.global-config.db-config.logic-not-delete-value=0
+
+# JWT配置
+jwt.secret=${JWT_SECRET:lingyue-zhibao-secret-key-2024-please-change-in-production}
+jwt.expiration=604800000
+jwt.refresh-expiration=2592000000

+ 0 - 80
backend/auth-service/src/main/resources/application.yml

@@ -1,80 +0,0 @@
-server:
-  port: 8001
-
-spring:
-  application:
-    name: auth-service
-  
-  # 数据库配置(Druid)
-  datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    druid:
-      driver-class-name: org.postgresql.Driver
-      url: jdbc:postgresql://localhost:5432/lingyue_zhibao
-      username: ${DB_USERNAME:postgres}
-      password: ${DB_PASSWORD:postgres}
-      initial-size: 5
-      min-idle: 5
-      max-active: 20
-      max-wait: 60000
-      time-between-eviction-runs-millis: 60000
-      min-evictable-idle-time-millis: 300000
-      validation-query: SELECT 1
-      test-while-idle: true
-      test-on-borrow: false
-      test-on-return: false
-      pool-prepared-statements: true
-      max-pool-prepared-statement-per-connection-size: 20
-      filters: stat,wall,slf4j
-      connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
-  
-  # MyBatis Plus配置
-  mybatis-plus:
-    mapper-locations: classpath*:mapper/**/*Mapper.xml
-    type-aliases-package: com.lingyue.auth.entity
-    configuration:
-      map-underscore-to-camel-case: true
-      log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
-    global-config:
-      db-config:
-        id-type: assign_uuid
-        logic-delete-field: delFlag
-        logic-delete-value: 1
-        logic-not-delete-value: 0
-  
-  # Redis配置
-  data:
-    redis:
-      host: ${REDIS_HOST:localhost}
-      port: ${REDIS_PORT:6379}
-      password: ${REDIS_PASSWORD:}
-      database: 0
-      timeout: 3000
-      lettuce:
-        pool:
-          max-active: 8
-          max-idle: 8
-          min-idle: 0
-  
-  # Nacos配置
-  cloud:
-    nacos:
-      discovery:
-        server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
-        namespace: public
-        group: DEFAULT_GROUP
-
-# JWT配置
-jwt:
-  secret: ${JWT_SECRET:lingyue-zhibao-secret-key-2024-please-change-in-production}
-  expiration: 604800000  # 7天,单位:毫秒
-  refresh-expiration: 2592000000  # 30天,单位:毫秒
-
-# 日志配置
-logging:
-  level:
-    root: INFO
-    com.lingyue: DEBUG
-  pattern:
-    console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
-

+ 18 - 0
backend/common/src/main/java/com/lingyue/common/domain/AjaxResult.java

@@ -206,5 +206,23 @@ public class AjaxResult<T> extends HashMap<String, Object> {
         return (T) super.get(DATA_TAG);
     }
 
+    @Schema(description = "状态码")
+    public Integer getCode() {
+        return (Integer) super.get(CODE_TAG);
+    }
+
+    public void setCode(int code) {
+        super.put(CODE_TAG, code);
+    }
+
+    @Schema(description = "返回消息")
+    public String getMsg() {
+        return (String) super.get(MSG_TAG);
+    }
+
+    public void setMsg(String msg) {
+        super.put(MSG_TAG, msg);
+    }
+
 }
 

+ 11 - 0
backend/common/src/main/java/com/lingyue/common/exception/ServiceException.java

@@ -38,6 +38,17 @@ public final class ServiceException extends RuntimeException {
         this.code = code;
     }
 
+    public ServiceException(String message, Throwable cause) {
+        super(message, cause);
+        this.message = message;
+    }
+
+    public ServiceException(String message, Integer code, Throwable cause) {
+        super(message, cause);
+        this.message = message;
+        this.code = code;
+    }
+
     public String getDetailMessage() {
         return detailMessage;
     }

+ 2 - 1
backend/document-service/pom.xml

@@ -36,10 +36,11 @@
             <artifactId>postgresql</artifactId>
         </dependency>
         
-        <!-- Nacos Service Discovery -->
+        <!-- Nacos Service Discovery (单体应用设为 optional) -->
         <dependency>
             <groupId>com.alibaba.cloud</groupId>
             <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+            <optional>true</optional>
         </dependency>
         
         <!-- Common Module -->

+ 0 - 24
backend/document-service/src/main/java/com/lingyue/document/config/MyBatisPlusConfig.java

@@ -1,24 +0,0 @@
-package com.lingyue.document.config;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
-import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * MyBatis Plus 配置
- */
-@Configuration
-@MapperScan("com.lingyue.document.repository")
-public class MyBatisPlusConfig {
-    
-    @Bean
-    public MybatisPlusInterceptor mybatisPlusInterceptor() {
-        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
-        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL));
-        return interceptor;
-    }
-}
-

+ 16 - 0
backend/document-service/src/main/resources/application.properties

@@ -0,0 +1,16 @@
+# ============================================
+# Document Service 配置
+# ============================================
+
+# 引入公共配置
+spring.config.import=classpath:application-common.properties,classpath:application-infra.properties
+
+# 服务端口
+server.port=8002
+
+# 服务名称
+spring.application.name=document-service
+
+# MyBatis Plus配置(覆盖公共配置中的type-aliases-package)
+mybatis-plus.type-aliases-package=com.lingyue.document.entity
+mybatis-plus.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

+ 0 - 57
backend/document-service/src/main/resources/application.yml

@@ -1,57 +0,0 @@
-server:
-  port: 8002
-
-spring:
-  application:
-    name: document-service
-  
-  # 数据库配置(Druid)
-  datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    druid:
-      driver-class-name: org.postgresql.Driver
-      url: jdbc:postgresql://localhost:5432/lingyue_zhibao
-      username: ${DB_USERNAME:postgres}
-      password: ${DB_PASSWORD:postgres}
-      initial-size: 5
-      min-idle: 5
-      max-active: 20
-      max-wait: 60000
-      time-between-eviction-runs-millis: 60000
-      min-evictable-idle-time-millis: 300000
-      validation-query: SELECT 1
-      test-while-idle: true
-      test-on-borrow: false
-      test-on-return: false
-      pool-prepared-statements: true
-      max-pool-prepared-statement-per-connection-size: 20
-      filters: stat,wall,slf4j
-  
-  # MyBatis Plus配置
-  mybatis-plus:
-    mapper-locations: classpath*:mapper/**/*Mapper.xml
-    type-aliases-package: com.lingyue.document.entity
-    configuration:
-      map-underscore-to-camel-case: true
-      log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
-    global-config:
-      db-config:
-        id-type: assign_uuid
-    properties:
-      hibernate:
-        dialect: org.hibernate.dialect.PostgreSQLDialect
-  
-  # Nacos配置
-  cloud:
-    nacos:
-      discovery:
-        server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
-        namespace: public
-        group: DEFAULT_GROUP
-
-# 日志配置
-logging:
-  level:
-    root: INFO
-    com.lingyue: DEBUG
-

+ 0 - 11
backend/gateway-service/src/main/resources/application-dev.yml

@@ -1,11 +0,0 @@
-spring:
-  cloud:
-    nacos:
-      discovery:
-        server-addr: localhost:8848
-
-logging:
-  level:
-    root: INFO
-    com.lingyue: DEBUG
-

+ 0 - 14
backend/gateway-service/src/main/resources/application-prod.yml

@@ -1,14 +0,0 @@
-spring:
-  cloud:
-    nacos:
-      discovery:
-        server-addr: ${NACOS_SERVER_ADDR:nacos-server:8848}
-
-jwt:
-  secret: ${JWT_SECRET:lingyue-zhibao-secret-key-2024-please-change-in-production}
-
-logging:
-  level:
-    root: WARN
-    com.lingyue: INFO
-

+ 0 - 88
backend/gateway-service/src/main/resources/application.yml

@@ -1,88 +0,0 @@
-server:
-  port: 8080
-
-spring:
-  application:
-    name: gateway-service
-  
-  cloud:
-    gateway:
-      routes:
-        # 用户认证服务
-        - id: auth-service
-          uri: lb://auth-service
-          predicates:
-            - Path=/api/v1/auth/**
-          filters:
-            - StripPrefix=1
-        
-        # 文档管理服务
-        - id: document-service
-          uri: lb://document-service
-          predicates:
-            - Path=/api/v1/documents/**
-          filters:
-            - StripPrefix=1
-        
-        # 解析服务
-        - id: parse-service
-          uri: lb://parse-service
-          predicates:
-            - Path=/api/v1/parse/**
-          filters:
-            - StripPrefix=1
-        
-        # AI处理服务
-        - id: ai-service
-          uri: lb://ai-service
-          predicates:
-            - Path=/api/v1/ai/**
-          filters:
-            - StripPrefix=1
-        
-        # 关系网络服务
-        - id: graph-service
-          uri: lb://graph-service
-          predicates:
-            - Path=/api/v1/graphs/**
-          filters:
-            - StripPrefix=1
-        
-        # WebSocket服务(通过通知服务)
-        - id: notification-service
-          uri: lb://notification-service
-          predicates:
-            - Path=/ws/**
-          filters:
-            - StripPrefix=0
-      
-      # 全局CORS配置
-      globalcors:
-        cors-configurations:
-          '[/**]':
-            allowedOriginPatterns: "*"
-            allowedMethods: "*"
-            allowedHeaders: "*"
-            allowCredentials: true
-            maxAge: 3600
-  
-  # Nacos配置
-  cloud:
-    nacos:
-      discovery:
-        server-addr: localhost:8848
-        namespace: public
-        group: DEFAULT_GROUP
-
-# JWT配置
-jwt:
-  secret: lingyue-zhibao-secret-key-2024-please-change-in-production
-
-# 日志配置
-logging:
-  level:
-    root: INFO
-    com.lingyue: DEBUG
-  pattern:
-    console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
-

+ 0 - 24
backend/graph-service/src/main/java/com/lingyue/graph/config/MyBatisPlusConfig.java

@@ -1,24 +0,0 @@
-package com.lingyue.graph.config;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
-import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * MyBatis Plus 配置
- */
-@Configuration
-@MapperScan("com.lingyue.graph.repository")
-public class MyBatisPlusConfig {
-    
-    @Bean
-    public MybatisPlusInterceptor mybatisPlusInterceptor() {
-        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
-        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL));
-        return interceptor;
-    }
-}
-

+ 4 - 4
backend/graph-service/src/main/java/com/lingyue/graph/controller/TextStorageController.java

@@ -43,11 +43,11 @@ public class TextStorageController {
         String filePath = (String) request.get("filePath");
         
         if (documentId == null || documentId.isEmpty()) {
-            return AjaxResult.error("文档ID不能为空");
+            return AjaxResult.error("文档ID不能为空", null);
         }
         
         if (filePath == null || filePath.isEmpty()) {
-            return AjaxResult.error("文件路径不能为空");
+            return AjaxResult.error("文件路径不能为空", null);
         }
         
         try {
@@ -55,7 +55,7 @@ public class TextStorageController {
             return AjaxResult.success(textStorage);
         } catch (Exception e) {
             log.error("保存文本存储记录失败: documentId={}, filePath={}", documentId, filePath, e);
-            return AjaxResult.error("保存文本存储记录失败: " + e.getMessage());
+            return AjaxResult.error("保存文本存储记录失败: " + e.getMessage(), null);
         }
     }
     
@@ -73,7 +73,7 @@ public class TextStorageController {
         
         TextStorage textStorage = textStorageService.getByDocumentId(documentId);
         if (textStorage == null) {
-            return AjaxResult.error("文本存储记录不存在");
+            return AjaxResult.error("文本存储记录不存在", null);
         }
         
         return AjaxResult.success(textStorage);

+ 15 - 0
backend/graph-service/src/main/resources/application.properties

@@ -0,0 +1,15 @@
+# ============================================
+# Graph Service 配置
+# ============================================
+
+# 引入公共配置
+spring.config.import=classpath:application-common.properties,classpath:application-infra.properties
+
+# 服务端口
+server.port=8005
+
+# 服务名称
+spring.application.name=graph-service
+
+# MyBatis Plus配置(覆盖公共配置中的type-aliases-package)
+mybatis-plus.type-aliases-package=com.lingyue.graph.entity

+ 0 - 54
backend/graph-service/src/main/resources/application.yml

@@ -1,54 +0,0 @@
-server:
-  port: 8005
-
-spring:
-  application:
-    name: graph-service
-  
-  # 数据库配置(Druid)
-  datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    druid:
-      driver-class-name: org.postgresql.Driver
-      url: jdbc:postgresql://localhost:5432/lingyue_zhibao
-      username: ${DB_USERNAME:postgres}
-      password: ${DB_PASSWORD:postgres}
-      initial-size: 5
-      min-idle: 5
-      max-active: 20
-      max-wait: 60000
-      time-between-eviction-runs-millis: 60000
-      min-evictable-idle-time-millis: 300000
-      validation-query: SELECT 1
-      test-while-idle: true
-      test-on-borrow: false
-      test-on-return: false
-      pool-prepared-statements: true
-      max-pool-prepared-statement-per-connection-size: 20
-      filters: stat,wall,slf4j
-  
-  # MyBatis Plus配置
-  mybatis-plus:
-    mapper-locations: classpath*:mapper/**/*Mapper.xml
-    type-aliases-package: com.lingyue.graph.entity
-    configuration:
-      map-underscore-to-camel-case: true
-      log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
-    global-config:
-      db-config:
-        id-type: assign_uuid
-  
-  # Nacos配置
-  cloud:
-    nacos:
-      discovery:
-        server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
-        namespace: public
-        group: DEFAULT_GROUP
-
-# 日志配置
-logging:
-  level:
-    root: INFO
-    com.lingyue: DEBUG
-

+ 15 - 1
backend/lingyue-starter/pom.xml

@@ -23,11 +23,18 @@
     </properties>
 
     <dependencies>
-        <!-- SpringDoc OpenAPI 文档 -->
+        <!-- SpringDoc OpenAPI 文档 - 暂时排除以避免启动问题 -->
+        <!--
         <dependency>
             <groupId>org.springdoc</groupId>
             <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
         </dependency>
+        
+        <dependency>
+            <groupId>org.webjars</groupId>
+            <artifactId>webjars-locator-core</artifactId>
+        </dependency>
+        -->
 
         <!-- spring-boot-devtools -->
         <dependency>
@@ -85,6 +92,13 @@
             <artifactId>spring-boot-starter-aop</artifactId>
         </dependency>
 
+        <!-- Lombok -->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+
         <!-- 测试所需 -->
         <dependency>
             <groupId>org.springframework.boot</groupId>

+ 4 - 5
backend/lingyue-starter/src/main/java/com/lingyue/LingyueApplication.java

@@ -2,9 +2,6 @@ package com.lingyue;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
@@ -12,14 +9,16 @@ import org.springframework.scheduling.annotation.EnableScheduling;
  * 启动程序
  * 
  * 单体应用启动器,整合所有微服务模块
+ * 
+ * 注意:
+ * 1. 单体应用不使用服务发现和 Feign Client,服务间直接调用
+ * 2. 已禁用 @EnableDiscoveryClient 和 @EnableFeignClients
  *
  * @author lingyue
  */
 @SpringBootApplication(scanBasePackages = "com.lingyue")
 @EnableScheduling
 @EnableAsync
-@EnableDiscoveryClient
-@EnableFeignClients(basePackages = "com.lingyue")
 public class LingyueApplication {
 
     public static void main(String[] args) {

+ 15 - 4
backend/auth-service/src/main/java/com/lingyue/auth/config/MyBatisPlusConfig.java → backend/lingyue-starter/src/main/java/com/lingyue/config/MyBatisPlusConfig.java

@@ -1,4 +1,4 @@
-package com.lingyue.auth.config;
+package com.lingyue.config;
 
 import com.baomidou.mybatisplus.annotation.DbType;
 import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
@@ -8,10 +8,21 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
 /**
- * MyBatis Plus 配置
+ * MyBatis Plus 统一配置
+ * 单体应用使用,扫描所有服务的 Mapper
+ * 
+ * @author lingyue
+ * @since 2.0.0
  */
 @Configuration
-@MapperScan("com.lingyue.auth.repository")
+@MapperScan({
+    "com.lingyue.auth.repository",
+    "com.lingyue.document.repository",
+    "com.lingyue.parse.repository",
+    "com.lingyue.ai.repository",
+    "com.lingyue.graph.repository",
+    "com.lingyue.notification.repository"
+})
 public class MyBatisPlusConfig {
     
     /**
@@ -20,8 +31,8 @@ public class MyBatisPlusConfig {
     @Bean
     public MybatisPlusInterceptor mybatisPlusInterceptor() {
         MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
+        // PostgreSQL 分页插件
         interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL));
         return interceptor;
     }
 }
-

+ 0 - 109
backend/lingyue-starter/src/main/java/com/lingyue/config/SpringDocConfig.java

@@ -1,109 +0,0 @@
-package com.lingyue.config;
-
-import io.swagger.v3.oas.models.OpenAPI;
-import io.swagger.v3.oas.models.info.Contact;
-import io.swagger.v3.oas.models.info.Info;
-import org.springdoc.core.models.GroupedOpenApi;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Profile;
-
-/**
- * SpringDoc OpenAPI 配置
- * ⚠️ 仅在 dev 环境启用(双重保障机制)
- *
- * @author lingyue
- */
-@Configuration
-@Profile("dev")  // 第一层保障:只在 dev profile 时加载
-@ConditionalOnProperty(
-        name = "springdoc.api-docs.enabled",
-        havingValue = "true",
-        matchIfMissing = false  // 第二层保障:必须明确启用
-)
-public class SpringDocConfig {
-
-    @Autowired
-    private AppConfig appConfig;
-
-    /**
-     * 自定义 OpenAPI 信息
-     */
-    @Bean
-    public OpenAPI customOpenAPI() {
-        return new OpenAPI()
-                .info(new Info()
-                        .title("灵越智报 API 文档")
-                        .description("灵越智报 v2.0 - 智能文档处理平台 API 接口文档<br/>" +
-                                "版本: " + appConfig.getVersion() + "<br/>" +
-                                "版权所有 © " + appConfig.getCopyrightYear())
-                        .version(appConfig.getVersion())
-                        .contact(new Contact()
-                                .name(appConfig.getName())
-                                .email("")))
-                ;
-    }
-
-    /**
-     * 认证服务 API 分组
-     */
-    @Bean
-    public GroupedOpenApi authApi() {
-        return GroupedOpenApi.builder()
-                .group("auth-api")
-                .displayName("认证服务 API")
-                .pathsToMatch("/auth/**")
-                .build();
-    }
-
-    /**
-     * 文档管理 API 分组
-     */
-    @Bean
-    public GroupedOpenApi documentApi() {
-        return GroupedOpenApi.builder()
-                .group("document-api")
-                .displayName("文档管理 API")
-                .pathsToMatch("/documents/**")
-                .build();
-    }
-
-    /**
-     * 解析服务 API 分组
-     */
-    @Bean
-    public GroupedOpenApi parseApi() {
-        return GroupedOpenApi.builder()
-                .group("parse-api")
-                .displayName("解析服务 API")
-                .pathsToMatch("/parse/**")
-                .build();
-    }
-
-    /**
-     * AI处理服务 API 分组
-     */
-    @Bean
-    public GroupedOpenApi aiApi() {
-        return GroupedOpenApi.builder()
-                .group("ai-api")
-                .displayName("AI处理服务 API")
-                .pathsToMatch("/ai/**")
-                .build();
-    }
-
-    /**
-     * 关系网络服务 API 分组
-     */
-    @Bean
-    public GroupedOpenApi graphApi() {
-        return GroupedOpenApi.builder()
-                .group("graph-api")
-                .displayName("关系网络服务 API")
-                .pathsToMatch("/graphs/**")
-                .build();
-    }
-}
-

+ 0 - 32
backend/lingyue-starter/src/main/resources/application-dev.yml

@@ -1,32 +0,0 @@
-# 开发环境配置
-spring:
-  datasource:
-    druid:
-      url: jdbc:postgresql://localhost:5432/lingyue_zhibao
-      username: postgres
-      password: postgres
-  
-  data:
-    redis:
-      host: localhost
-      port: 6379
-  
-  rabbitmq:
-    host: localhost
-    port: 5672
-    username: guest
-    password: guest
-
-jwt:
-  secret: lingyue-zhibao-secret-key-2024-please-change-in-production
-
-logging:
-  level:
-    root: INFO
-    com.lingyue: DEBUG
-
-# SpringDoc 开发环境启用
-springdoc:
-  api-docs:
-    enabled: true
-

+ 0 - 33
backend/lingyue-starter/src/main/resources/application-prod.yml

@@ -1,33 +0,0 @@
-# 生产环境配置
-spring:
-  datasource:
-    druid:
-      url: jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5432}/${DB_NAME:lingyue_zhibao}
-      username: ${DB_USERNAME:postgres}
-      password: ${DB_PASSWORD:postgres}
-  
-  data:
-    redis:
-      host: ${REDIS_HOST:localhost}
-      port: ${REDIS_PORT:6379}
-      password: ${REDIS_PASSWORD:}
-  
-  rabbitmq:
-    host: ${RABBITMQ_HOST:localhost}
-    port: ${RABBITMQ_PORT:5672}
-    username: ${RABBITMQ_USERNAME:guest}
-    password: ${RABBITMQ_PASSWORD:guest}
-
-jwt:
-  secret: ${JWT_SECRET:lingyue-zhibao-secret-key-2024-please-change-in-production}
-
-logging:
-  level:
-    root: WARN
-    com.lingyue: INFO
-
-# SpringDoc 生产环境禁用
-springdoc:
-  api-docs:
-    enabled: false
-

+ 0 - 193
backend/lingyue-starter/src/main/resources/application.yml

@@ -1,193 +0,0 @@
-# 项目相关配置
-app:
-  # 名称
-  name: 灵越智报
-  # 版本
-  version: 2.0.0
-  # 版权年份
-  copyrightYear: 2024
-  # 文件路径 示例( Windows配置 D:/lingyue/uploadPath,Linux配置 /home/lingyue/uploadPath)
-  uploadBaseDir: /tmp/lingyue-zhibao
-  # 获取ip地址开关
-  addressEnabled: false
-  # 验证码类型 math 数字计算 char 字符验证
-  captchaType: math
-
-# 开发环境配置
-server:
-  # 服务器的HTTP端口
-  port: 8000
-  servlet:
-    # 应用的访问路径
-    context-path: /
-  tomcat:
-    # tomcat的URI编码
-    uri-encoding: UTF-8
-    # 连接数满后的排队数
-    accept-count: 1000
-    threads:
-      # tomcat最大线程数
-      max: 800
-      # Tomcat启动初始化的线程数
-      min-spare: 10
-
-# 日志配置
-logging:
-  level:
-    com.lingyue: info
-    org.springframework: warn
-    org.springframework.web: info
-
-# 用户配置
-user:
-  password:
-    # 密码最大错误次数
-    maxRetryCount: 5
-    # 密码锁定时间(默认10分钟)
-    lockTime: 10
-
-spring:
-  profiles:
-    active: dev
-  # 资源信息
-  messages:
-    # 国际化资源文件路径
-    basename: i18n/messages
-  # 文件上传
-  servlet:
-    multipart:
-      # 单个文件大小
-      max-file-size: 20MB
-      # 设置总上传的文件大小
-      max-request-size: 100MB
-  mvc:
-    pathmatch:
-      matching-strategy: ant-path-matcher
-  # 服务模块
-  devtools:
-    restart:
-      # 热部署开关
-      enabled: true
-  # 数据库配置(Druid)
-  datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    druid:
-      driver-class-name: org.postgresql.Driver
-      url: jdbc:postgresql://localhost:5432/lingyue_zhibao
-      username: ${DB_USERNAME:postgres}
-      password: ${DB_PASSWORD:postgres}
-      initial-size: 5
-      min-idle: 5
-      max-active: 20
-      max-wait: 60000
-      time-between-eviction-runs-millis: 60000
-      min-evictable-idle-time-millis: 300000
-      validation-query: SELECT 1
-      test-while-idle: true
-      test-on-borrow: false
-      test-on-return: false
-      pool-prepared-statements: true
-      max-pool-prepared-statement-per-connection-size: 20
-      filters: stat,wall,slf4j
-      connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
-      # Druid监控配置
-      stat-view-servlet:
-        enabled: true
-        url-pattern: /druid/*
-        login-username: admin
-        login-password: admin123
-      web-stat-filter:
-        enabled: true
-        url-pattern: /*
-  # Redis配置
-  data:
-    redis:
-      host: ${REDIS_HOST:localhost}
-      port: ${REDIS_PORT:6379}
-      password: ${REDIS_PASSWORD:}
-      database: 0
-      timeout: 3000
-      lettuce:
-        pool:
-          max-active: 8
-          max-idle: 8
-          min-idle: 0
-  # RabbitMQ配置
-  rabbitmq:
-    host: ${RABBITMQ_HOST:localhost}
-    port: ${RABBITMQ_PORT:5672}
-    username: ${RABBITMQ_USERNAME:guest}
-    password: ${RABBITMQ_PASSWORD:guest}
-  # Nacos配置(单体应用可选)
-  cloud:
-    nacos:
-      discovery:
-        server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
-        namespace: public
-        group: DEFAULT_GROUP
-        enabled: false  # 单体应用默认禁用服务发现
-
-# JWT配置
-jwt:
-  secret: ${JWT_SECRET:lingyue-zhibao-secret-key-2024-please-change-in-production}
-  expiration: 604800000  # 7天,单位:毫秒
-  refresh-expiration: 2592000000  # 30天,单位:毫秒
-
-# Token配置
-token:
-  # 令牌自定义标识
-  header: Authorization
-  # 令牌密钥
-  secret: ${JWT_SECRET:lingyue-zhibao-secret-key-2024-please-change-in-production}
-  # 令牌有效期(默认7天,单位:秒)
-  expireTime: 604800
-
-# MyBatis Plus 配置
-mybatis-plus:
-  # 搜索指定包别名
-  type-aliases-package: com.lingyue.**.entity
-  # 配置mapper的扫描,找到所有的mapper.xml映射文件
-  mapper-locations: classpath*:mapper/**/*Mapper.xml
-  # 加载全局的配置文件
-  config-location: classpath:mybatis/mybatis-config.xml
-  configuration:
-    map-underscore-to-camel-case: true
-    log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
-  global-config:
-    db-config:
-      id-type: assign_uuid
-
-# SpringDoc OpenAPI 配置
-springdoc:
-  api-docs:
-    enabled: true
-    path: /api-docs
-  swagger-ui:
-    enabled: true
-    path: /swagger-ui.html
-
-# WebSocket配置
-websocket:
-  enabled: true
-  path: /ws
-  allowedOrigins: "*"
-
-# PaddleOCR配置
-paddleocr:
-  server-url: ${PADDLEOCR_SERVER_URL:http://localhost:8866}
-  timeout: 30000
-
-# DeepSeek API配置
-deepseek:
-  api-url: ${DEEPSEEK_API_URL:https://api.deepseek.com}
-  api-key: ${DEEPSEEK_API_KEY:}
-  timeout: 30000
-
-# 防止XSS攻击
-xss:
-  # 过滤开关
-  enabled: true
-  # 排除链接(多个用逗号分隔)
-  excludes: /auth/register,/auth/login
-  # 匹配链接
-  urlPatterns: /documents/*,/parse/*,/ai/*,/graphs/*

+ 2 - 1
backend/notification-service/pom.xml

@@ -30,10 +30,11 @@
             <artifactId>spring-boot-starter-websocket</artifactId>
         </dependency>
         
-        <!-- Nacos Service Discovery -->
+        <!-- Nacos Service Discovery (单体应用设为 optional) -->
         <dependency>
             <groupId>com.alibaba.cloud</groupId>
             <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+            <optional>true</optional>
         </dependency>
         
         <!-- Common Module -->

+ 12 - 0
backend/notification-service/src/main/resources/application.properties

@@ -0,0 +1,12 @@
+# ============================================
+# Notification Service 配置
+# ============================================
+
+# 引入公共配置
+spring.config.import=classpath:application-common.properties,classpath:application-infra.properties
+
+# 服务端口
+server.port=8006
+
+# 服务名称
+spring.application.name=notification-service

+ 0 - 21
backend/notification-service/src/main/resources/application.yml

@@ -1,21 +0,0 @@
-server:
-  port: 8006
-
-spring:
-  application:
-    name: notification-service
-  
-  # Nacos配置
-  cloud:
-    nacos:
-      discovery:
-        server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
-        namespace: public
-        group: DEFAULT_GROUP
-
-# 日志配置
-logging:
-  level:
-    root: INFO
-    com.lingyue: DEBUG
-

+ 11 - 3
backend/parse-service/pom.xml

@@ -42,17 +42,17 @@
             <artifactId>postgresql</artifactId>
         </dependency>
         
-        <!-- Nacos Service Discovery -->
+        <!-- 
+        单体应用不需要 Nacos 和 OpenFeign
         <dependency>
             <groupId>com.alibaba.cloud</groupId>
             <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
         </dependency>
-        
-        <!-- OpenFeign -->
         <dependency>
             <groupId>org.springframework.cloud</groupId>
             <artifactId>spring-cloud-starter-openfeign</artifactId>
         </dependency>
+        -->
         
         <!-- Common Module -->
         <dependency>
@@ -60,6 +60,14 @@
             <artifactId>common</artifactId>
         </dependency>
         
+        <!-- Graph Service (单体应用模式直接依赖) -->
+        <dependency>
+            <groupId>com.lingyue</groupId>
+            <artifactId>graph-service</artifactId>
+            <version>${project.version}</version>
+            <optional>true</optional>
+        </dependency>
+        
         <!-- Lombok -->
         <dependency>
             <groupId>org.projectlombok</groupId>

+ 2 - 4
backend/parse-service/src/main/java/com/lingyue/parse/ParseServiceApplication.java

@@ -2,15 +2,13 @@ package com.lingyue.parse;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.cloud.openfeign.EnableFeignClients;
 
 /**
  * 解析服务启动类
+ * 
+ * 注意:单体应用模式下不使用 @EnableDiscoveryClient 和 @EnableFeignClients
  */
 @SpringBootApplication
-@EnableDiscoveryClient
-@EnableFeignClients(basePackages = "com.lingyue.parse.client")
 public class ParseServiceApplication {
     
     public static void main(String[] args) {

+ 0 - 28
backend/parse-service/src/main/java/com/lingyue/parse/client/GraphServiceClient.java

@@ -1,28 +0,0 @@
-package com.lingyue.parse.client;
-
-import com.lingyue.common.domain.AjaxResult;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-
-import java.util.Map;
-
-/**
- * Graph Service Feign Client
- * 用于调用graph-service的接口
- * 
- * @author lingyue
- * @since 2026-01-14
- */
-@FeignClient(name = "graph-service", path = "/api/v1/graph")
-public interface GraphServiceClient {
-    
-    /**
-     * 记录文本存储路径
-     * 
-     * @param request 文本存储信息
-     * @return 操作结果
-     */
-    @PostMapping("/text-storage")
-    AjaxResult<?> saveTextStorage(@RequestBody Map<String, Object> request);
-}

+ 0 - 24
backend/parse-service/src/main/java/com/lingyue/parse/config/MyBatisPlusConfig.java

@@ -1,24 +0,0 @@
-package com.lingyue.parse.config;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
-import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * MyBatis Plus 配置
- */
-@Configuration
-@MapperScan("com.lingyue.parse.repository")
-public class MyBatisPlusConfig {
-    
-    @Bean
-    public MybatisPlusInterceptor mybatisPlusInterceptor() {
-        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
-        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL));
-        return interceptor;
-    }
-}
-

+ 1 - 1
backend/parse-service/src/main/java/com/lingyue/parse/controller/FileUploadController.java

@@ -62,6 +62,6 @@ public class FileUploadController {
             @RequestParam("filePath") String filePath) {
         
         fileUploadService.deleteFile(filePath);
-        return AjaxResult.success();
+        return AjaxResult.success("删除成功", null);
     }
 }

+ 2 - 2
backend/parse-service/src/main/java/com/lingyue/parse/service/PdfTextExtractionService.java

@@ -54,7 +54,7 @@ public class PdfTextExtractionService {
         
         List<PageTextResult> pageResults = new ArrayList<>();
         
-        try (PDDocument document = PDDocument.load(pdfFile)) {
+        try (PDDocument document = org.apache.pdfbox.Loader.loadPDF(pdfFile)) {
             int totalPages = document.getNumberOfPages();
             log.info("开始处理PDF文件: {}, 总页数: {}", pdfFilePath, totalPages);
             
@@ -134,7 +134,7 @@ public class PdfTextExtractionService {
         File pdfFile = new File(pdfFilePath);
         File tempImageFile = null;
         
-        try (PDDocument document = PDDocument.load(pdfFile)) {
+        try (PDDocument document = org.apache.pdfbox.Loader.loadPDF(pdfFile)) {
             // 1. 将PDF页面转换为图片
             PDFRenderer pdfRenderer = new PDFRenderer(document);
             BufferedImage image = pdfRenderer.renderImageWithDPI(pageNum - 1, 300); // 300 DPI

+ 43 - 0
backend/parse-service/src/main/resources/application.properties

@@ -0,0 +1,43 @@
+# ============================================
+# Parse Service 配置
+# ============================================
+
+# 引入公共配置
+spring.config.import=classpath:application-common.properties,classpath:application-infra.properties
+
+# 服务端口
+server.port=8003
+
+# 服务名称
+spring.application.name=parse-service
+
+# 文件上传配置
+spring.servlet.multipart.enabled=true
+spring.servlet.multipart.max-file-size=500MB
+spring.servlet.multipart.max-request-size=500MB
+spring.servlet.multipart.file-size-threshold=2KB
+
+# MyBatis Plus配置(覆盖公共配置中的type-aliases-package)
+mybatis-plus.type-aliases-package=com.lingyue.parse.entity
+
+# 文件存储配置
+file.storage.base-path=${FILE_STORAGE_BASE_PATH:/data/lingyue/files}
+file.storage.text-path=${FILE_STORAGE_TEXT_PATH:/data/lingyue/texts}
+file.storage.allowed-extensions=pdf,doc,docx,xls,xlsx,jpg,jpeg,png,gif
+
+# AI服务配置
+ai.service.url=${AI_SERVICE_URL:http://localhost:8007}
+ai.service.timeout=300000
+
+# PaddleOCR配置
+paddleocr.server-url=${PADDLEOCR_SERVER_URL:http://localhost:8866}
+paddleocr.timeout=30000
+
+# 解析任务配置
+parse.task.use-mq=${PARSE_TASK_USE_MQ:false}
+parse.task.max-retries=${PARSE_TASK_MAX_RETRIES:3}
+parse.task.retry-initial-delay=${PARSE_TASK_RETRY_INITIAL_DELAY:1000}
+
+# 性能优化配置
+performance.large-file-threshold=${LARGE_FILE_THRESHOLD:52428800}
+performance.chunk-size=${FILE_CHUNK_SIZE:10485760}

+ 0 - 104
backend/parse-service/src/main/resources/application.yml

@@ -1,104 +0,0 @@
-server:
-  port: 8003
-
-spring:
-  application:
-    name: parse-service
-  
-  # 文件上传配置
-  servlet:
-    multipart:
-      enabled: true
-      max-file-size: 500MB
-      max-request-size: 500MB
-      file-size-threshold: 2KB
-  
-  # 数据库配置(Druid)
-  datasource:
-    type: com.alibaba.druid.pool.DruidDataSource
-    druid:
-      driver-class-name: org.postgresql.Driver
-      url: jdbc:postgresql://localhost:5432/lingyue_zhibao
-      username: ${DB_USERNAME:postgres}
-      password: ${DB_PASSWORD:postgres}
-      initial-size: 5
-      min-idle: 5
-      max-active: 20
-      max-wait: 60000
-      time-between-eviction-runs-millis: 60000
-      min-evictable-idle-time-millis: 300000
-      validation-query: SELECT 1
-      test-while-idle: true
-      test-on-borrow: false
-      test-on-return: false
-      pool-prepared-statements: true
-      max-pool-prepared-statement-per-connection-size: 20
-      filters: stat,wall,slf4j
-  
-  # MyBatis Plus配置
-  mybatis-plus:
-    mapper-locations: classpath*:mapper/**/*Mapper.xml
-    type-aliases-package: com.lingyue.parse.entity
-    configuration:
-      map-underscore-to-camel-case: true
-      log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
-    global-config:
-      db-config:
-        id-type: assign_uuid
-  
-  # RabbitMQ配置
-  rabbitmq:
-    host: ${RABBITMQ_HOST:localhost}
-    port: ${RABBITMQ_PORT:5672}
-    username: ${RABBITMQ_USERNAME:guest}
-    password: ${RABBITMQ_PASSWORD:guest}
-  
-  # Nacos配置
-  cloud:
-    nacos:
-      discovery:
-        server-addr: ${NACOS_SERVER_ADDR:localhost:8848}
-        namespace: public
-        group: DEFAULT_GROUP
-
-# 文件存储配置
-file:
-  storage:
-    base-path: ${FILE_STORAGE_BASE_PATH:/data/lingyue/files}
-    text-path: ${FILE_STORAGE_TEXT_PATH:/data/lingyue/texts}
-    allowed-extensions: pdf,doc,docx,xls,xlsx,jpg,jpeg,png,gif
-
-# AI服务配置
-ai:
-  service:
-    url: ${AI_SERVICE_URL:http://localhost:8007}
-    timeout: 300000
-
-# PaddleOCR配置
-paddleocr:
-  server-url: ${PADDLEOCR_SERVER_URL:http://localhost:8866}
-  timeout: 30000
-
-# 解析任务配置
-parse:
-  task:
-    # 是否使用RabbitMQ消息队列(默认false,使用线程池)
-    use-mq: ${PARSE_TASK_USE_MQ:false}
-    # 最大重试次数
-    max-retries: ${PARSE_TASK_MAX_RETRIES:3}
-    # 重试初始延迟(毫秒)
-    retry-initial-delay: ${PARSE_TASK_RETRY_INITIAL_DELAY:1000}
-
-# 性能优化配置
-performance:
-  # 大文件阈值(字节),超过此大小使用分块处理
-  large-file-threshold: ${LARGE_FILE_THRESHOLD:52428800}  # 50MB
-  # 文件块大小(字节)
-  chunk-size: ${FILE_CHUNK_SIZE:10485760}  # 10MB
-
-# 日志配置
-logging:
-  level:
-    root: INFO
-    com.lingyue: DEBUG
-

+ 22 - 6
backend/pom.xml

@@ -33,14 +33,14 @@
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
         
         <!-- Spring Boot & Cloud Versions -->
-        <spring-boot.version>3.2.0</spring-boot.version>
+        <spring-boot.version>3.1.5</spring-boot.version>
         <spring-cloud.version>2022.0.4</spring-cloud.version>
         <spring-cloud-alibaba.version>2022.0.0.0</spring-cloud-alibaba.version>
         
         <!-- Database -->
         <postgresql.version>42.7.1</postgresql.version>
         <druid.version>1.2.23</druid.version>
-        <mybatis-plus.version>3.5.11</mybatis-plus.version>
+        <mybatis-plus.version>3.5.8</mybatis-plus.version>
         
         <!-- JWT -->
         <jjwt.version>0.11.5</jjwt.version>
@@ -50,7 +50,8 @@
         <mapstruct.version>1.5.5.Final</mapstruct.version>
         <hutool.version>5.8.35</hutool.version>
         <fastjson.version>2.0.53</fastjson.version>
-        <springdoc.version>2.7.0</springdoc.version>
+        <springdoc.version>2.3.0</springdoc.version>
+        <webjars-locator.version>0.52</webjars-locator.version>
         <pdfbox.version>3.0.1</pdfbox.version>
         <poi.version>5.2.5</poi.version>
     </properties>
@@ -101,10 +102,18 @@
             <!-- MyBatis Plus -->
             <dependency>
                 <groupId>com.baomidou</groupId>
-                <artifactId>mybatis-plus-bom</artifactId>
+                <artifactId>mybatis-plus-boot-starter</artifactId>
+                <version>${mybatis-plus.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.baomidou</groupId>
+                <artifactId>mybatis-plus-extension</artifactId>
+                <version>${mybatis-plus.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.baomidou</groupId>
+                <artifactId>mybatis-plus-core</artifactId>
                 <version>${mybatis-plus.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
             </dependency>
             
             <!-- JWT -->
@@ -165,6 +174,13 @@
                 <version>${springdoc.version}</version>
             </dependency>
             
+            <!-- WebJars Locator -->
+            <dependency>
+                <groupId>org.webjars</groupId>
+                <artifactId>webjars-locator-core</artifactId>
+                <version>${webjars-locator.version}</version>
+            </dependency>
+            
             <!-- Common Module -->
             <dependency>
                 <groupId>com.lingyue</groupId>

+ 48 - 0
进度报告.md

@@ -0,0 +1,48 @@
+# 📊 灵越智报 2.0 - 当前进度总结
+
+**整体进度:45%**  |  **报告日期:2026-01-16**
+
+---
+
+## ✅ 已完成(45%)
+
+### 基础设施
+- Spring Boot 3.1.5 单体应用已启动成功
+- 数据库、缓存、消息队列配置完成
+- 6大服务模块框架搭建完成
+
+### 核心模块现状
+- 📁 文档管理、解析、认证 → 框架完成
+- 🤖 AI服务、图谱服务 → 数据层完成,RAG 功能已实现
+- 🔍 **RAG 向量化存储** → ✅ 已完成
+
+### 新增功能(2026-01-16)
+- ✅ pgvector 向量数据库集成(text_chunks, vector_embeddings 表)
+- ✅ 文本分块服务(智能句子边界切分,500字符/块,50字符重叠)
+- ✅ Ollama Embedding 向量化服务(nomic-embed-text 模型)
+- ✅ pgvector 向量相似度检索(HNSW 索引,余弦距离)
+- ✅ DeepSeek API 客户端(Chat Completion)
+- ✅ RAG 核心服务(索引、检索、问答)
+- ✅ RAG API Controller(/api/rag/*)
+- ✅ 自动索引集成(解析完成后自动建立向量索引)
+
+---
+
+## ⚠️ 关键缺失(对照技术预研表)
+
+| 预研项 | 进度 | 表格要求 | 已完成 ✅ | 待实现 ❌ |
+|--------|------|----------|-----------|-----------|
+| **1️⃣ 规则"智能体"设计** | 35% | 报告生成逻辑规则多样(字符逻辑、语义理解、实体关系多层计算) | Graph Service 架构(7个Repository)<br>规则、模板数据模型<br>数据访问层<br>**RAG 问答服务** | 规则DSL定义与解析<br>规则执行引擎<br>多层计算算法 |
+| **2️⃣ 产品定位与功能逻辑** | 40% | 产品交互界面、智能体集群、规则逻辑校验 | 6大后端服务框架<br>Flutter 项目结构<br>路由、主题、基础组件 | 所有前端页面UI<br>智能体集群架构<br>规则校验功能<br>前后端API对接 |
+| **3️⃣ 规则智能体模拟** | 40% | 单规则逻辑树构建、规则测试、API记忆化(知识图谱) | TextStorage(文本存储)<br>GraphNode、GraphRelation<br>ParseTask(任务管理)<br>**文本分块、向量存储**<br>**向量相似度检索** | 规则逻辑树算法<br>单规则校验引擎<br>知识图谱构建算法<br>图谱查询与推理 |
+| **4️⃣ AI模态体型/OCR** | 60% | AI模态体型、OCR、文本分析代码,NSDK集成 | PaddleOCR Client 接口<br>PDF/Word 文本提取<br>AI Service 框架<br>Element、Annotation 实体<br>**DeepSeek API 客户端**<br>**Ollama Embedding 服务** | AI模态体模型接入<br>NSDK集成<br>NLP文本分析算法<br>OCR后处理优化 |
+| **5️⃣ 前端交互设计** | 15% | AI产品"交互应简单"体验、核心交互功能规划 | Flutter 项目结构<br>路由、主题配置<br>基础组件、业务组件 | 所有7个核心页面UI<br>页面交互逻辑<br>与后端API对接<br>WebSocket实时通信 |
+
+---
+
+## 🎯 下一步(按优先级)
+
+1. **规则引擎** - 报告生成的核心逻辑
+2. **知识图谱算法** - 实体关系提取与图谱构建
+3. **前端核心页面** - 上传、解析、RAG问答界面
+4. **NLP文本分析** - 基于 RAG 的文本理解增强