ソースを参照

fix: 数据库与其他配置文件修改

zhangying 1 週間 前
コミット
e319a3dde6

+ 56 - 8
zjrs-service-backend/pom.xml

@@ -177,10 +177,26 @@
         </dependency>
 
         <!-- MyBatis Plus 依赖 -->
+<!--        <dependency>-->
+<!--            <groupId>com.baomidou</groupId>-->
+<!--            <artifactId>mybatis-plus-boot-starter</artifactId>-->
+<!--            <version>3.5.1</version>-->
+<!--        </dependency>-->
         <dependency>
             <groupId>com.baomidou</groupId>
-            <artifactId>mybatis-plus-boot-starter</artifactId>
-            <version>3.5.1</version>
+            <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
+            <version>3.5.9</version>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-extension</artifactId>
+            <version>3.5.9</version>
+        </dependency>
+        <!-- 分页配置 -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-jsqlparser</artifactId>
+            <version>3.5.9</version>
         </dependency>
 
         <!-- Google Kaptcha 依赖 -->
@@ -337,17 +353,49 @@
             <version>1.9.4</version>
         </dependency>
 
-        <dependency>
-            <groupId>com.baomidou</groupId>
-            <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
-            <version>3.5.10.1</version>
-        </dependency>
-
         <dependency>
             <groupId>org.codehaus.jackson</groupId>
             <artifactId>jackson-mapper-asl</artifactId>
             <version>1.9.13</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.springframework.security</groupId>
+            <artifactId>spring-security-jwt</artifactId>
+            <version>1.1.1.RELEASE</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.security.oauth</groupId>
+            <artifactId>spring-security-oauth2</artifactId>
+            <version>2.5.2.RELEASE</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context-support</artifactId>
+            <version>5.3.39</version>
+        </dependency>
+
+        <dependency>
+            <groupId>net.sf.ehcache</groupId>
+            <artifactId>ehcache</artifactId>
+            <version>2.10.9.2</version>
+        </dependency>
+
+        <!-- 连接池 -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-3-starter</artifactId>
+            <version>1.2.23</version>
+        </dependency>
+
+        <!-- Oracle 驱动 -->
+        <dependency>
+            <groupId>com.oracle.database.jdbc</groupId>
+            <artifactId>ojdbc11</artifactId>
+            <version>23.2.0.0</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 20 - 1
zjrs-service-backend/src/main/java/com/zjrs/ZjrsServiceBackendApplication.java

@@ -2,8 +2,27 @@ package com.zjrs;
 
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.FilterType;
 
-@SpringBootApplication(scanBasePackages = {"com.zjrs", "org.mohrss"})
+@SpringBootApplication
+@ComponentScan(
+        basePackages = {"com.zjrs", "org.mohrss"},
+        excludeFilters = {
+                // 彻底屏蔽整个 feign.filter 包,防止它里面的任何类被加载
+                @ComponentScan.Filter(
+                        type = FilterType.REGEX,
+                        pattern = "org\\.mohrss\\.leaf\\.ext\\.feign\\.filter\\..*"
+                ),
+                // 如果之前那个 ContextInterceptor 也报错,一并屏蔽
+                @ComponentScan.Filter(
+                        type = FilterType.ASSIGNABLE_TYPE,
+                        classes = {
+                                org.mohrss.leaf.ext.feign.filter.LeafFilterAutoConfiguration.class
+                        }
+                )
+        }
+)
 public class ZjrsServiceBackendApplication {
 
     public static void main(String[] args) {

+ 9 - 3
zjrs-service-backend/src/main/java/com/zjrs/config/FeignConfig.java

@@ -1,4 +1,5 @@
 package com.zjrs.config;
+
 import feign.RequestInterceptor;
 import feign.RequestTemplate;
 import jakarta.servlet.http.HttpServletRequest;
@@ -11,8 +12,13 @@ import org.springframework.web.context.request.ServletRequestAttributes;
 public class FeignConfig implements RequestInterceptor {
     @Override
     public void apply(RequestTemplate template) {
-        ServletRequestAttributes attributes=(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
-        HttpServletRequest request=attributes.getRequest();
-        template.header(HttpHeaders.AUTHORIZATION, request.getHeader(HttpHeaders.AUTHORIZATION));
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        if (attributes != null) {
+            HttpServletRequest request = attributes.getRequest();
+            String authHeader = request.getHeader(HttpHeaders.AUTHORIZATION);
+            if (authHeader != null) {
+                template.header(HttpHeaders.AUTHORIZATION, authHeader);
+            }
+        }
     }
 }

+ 5 - 11
zjrs-service-backend/src/main/java/com/zjrs/config/MybatisPlusConfig.java

@@ -10,26 +10,20 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
 
 @EnableTransactionManagement
 @Configuration
-// 注意:MapperScan 通常建议扫描 Mapper 接口所在的包,而不是 entity 实体类包
+// 保持你之前的包名和 Bean 命名生成器
 @MapperScan(
         basePackages = {"com.zjrs.zwnw.**.entity", "com.zjrs.ggfw.**.entity"},
-        nameGenerator = FullBeanNameGenerator.class // 指定命名生成器
+        nameGenerator = FullBeanNameGenerator.class
 )
 public class MybatisPlusConfig {
 
-    /**
-     * 新版分页插件配置
-     */
     @Bean
     public MybatisPlusInterceptor mybatisPlusInterceptor() {
         MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
 
-        // 1. 添加分页内部拦截器
-        // 建议明确指定 DbType (如 MYSQL, ORACLE, POSTGRE_SQL),这能显著提高插件解析 SQL 的效率
-        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL);
-
-        // 2. 设置单页分页限制 (可选,默认无限制)
-        // paginationInnerInterceptor.setMaxLimit(500L);
+        // 🚨 关键修复:把 MYSQL 改成 ORACLE
+        // 如果你的 Oracle 版本较新(12c+),也可以用 DbType.ORACLE_12C
+        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.ORACLE);
 
         interceptor.addInnerInterceptor(paginationInnerInterceptor);
         return interceptor;

+ 115 - 2
zjrs-service-backend/src/main/resources/application.yaml

@@ -1,3 +1,116 @@
+server:
+  # 既然合并了,必须选一个端口,或者通过命令行参数指定
+  port: 8080
+
 spring:
-  application:
-    name: zjrs-service-backend
+  # 核心:通用基础设施配置
+  jpa:
+    database-platform: org.hibernate.dialect.Oracle10gDialect
+  ehcache:
+    # 直接写相对 resources 的路径
+    config: config/cache/ehcache.xml
+
+  redis:
+    host: 192.168.0.56
+    port: 6379
+    password: Bowin123456
+    selfdefine:
+      map:
+        jwtToken: { expireTime: 14400, cacheNullValues: false, keyPrefix: jwt, usePrefix: true }
+        userinfo: { expireTime: 60, cacheNullValues: false, keyPrefix: userinfo, usePrefix: true }
+        clientinfo: { expireTime: 60, cacheNullValues: false, keyPrefix: clientinfo, usePrefix: true }
+        authoritiesinfo: { expireTime: 14400, cacheNullValues: false, keyPrefix: authorities, usePrefix: true }
+        authenticationcode: { expireTime: 600, cacheNullValues: false, keyPrefix: authenticationcode, usePrefix: true }
+        leafcache_security: { expireTime: 1800, cacheNullValues: false, keyPrefix: leafcache_security, usePrefix: true }
+
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    driver-class-name: oracle.jdbc.OracleDriver
+    url: jdbc:oracle:thin:@//192.168.0.56:1521/FREEPDB1
+    username: ZJRS_YWXT
+    password: Bowin123456
+    druid:
+      initial-size: 10
+      max-active: 100
+      min-idle: 10
+      max-wait: 60000
+      test-while-idle: true
+      validation-query: SELECT 1 FROM DUAL
+      filter:
+        wall:
+          config:
+            multi-statement-allow: true
+      web-stat-filter:
+        enabled: true
+        url-pattern: "/*"
+        exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
+
+  # MyBatis-Plus 合并配置
+  mybatis-plus:
+    configuration:
+      jdbc-type-for-null: 'null' # 保留 zwnw 的配置
+      # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 调试时开启
+
+  jackson:
+    default-property-inclusion: non_null
+
+  servlet:
+    multipart:
+      max-file-size: 10MB
+
+# Leaf 框架合并配置
+leaf:
+  no-repeat-submit:
+    enabled: false
+  auth:
+    client:
+      client-authorization: { enabled: false }
+      resource-id: res-server
+      jwt:
+        public-key-location: pub.pem
+        sign-algorithm: SM2
+        service-authentication-enabled: false
+        gateway-server: false
+      url:
+        # 合并两个模块的白名单列表
+        whitelist:
+          - /captcha/**
+          - /api/captcha/**
+          - /index/queryRootMenuStore
+          - /api/**
+          - /**.js
+          - /druid/**
+          - /error
+          - /webjars/**
+          - /swagger-ui.html
+          - /swagger-resources/**
+          - /swagger-ui/**
+          - /v3/api-docs
+          - /v2/api-docs
+          - /actuator
+          - /actuator/**
+          - /poster/**
+          - /leaf6-uni-cloud-uc-service/** # zwnw 特有
+
+# 业务特有配置(yjt, real_name_auth 等保持不变)
+yjt:
+  xfmxURL: http://218.14.255.250:2080/api
+  version: 1.0
+  userid: "00000002"
+  privateKey: ... # 略
+  publicKey: ... # 略
+
+real_name_auth:
+  secretId: AKIDKVSAex3vZyFH5ecMwIPIxNZaP0N4f6KM
+  secretKey: sXyFI9oESVN5f2CFD2e5JL9jDXgfSHwO
+  callbackURL: https://rsj.zhanjiang.gov.cn/wx/
+
+# 监控与管理
+management:
+  endpoints:
+    web:
+      exposure:
+        include: '*'
+  endpoint:
+    health:
+      show-details: ALWAYS