fix
This commit is contained in:
63
agileboot-common/wol-common-core/src/main/resources/base.yml
Normal file
63
agileboot-common/wol-common-core/src/main/resources/base.yml
Normal file
@@ -0,0 +1,63 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: agileboot
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
dynamic:
|
||||
primary: master
|
||||
strict: false
|
||||
druid:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://121.41.64.98:3306/agileboot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&sslMode=REQUIRED
|
||||
username: agileboot
|
||||
password: 123456
|
||||
data:
|
||||
redis:
|
||||
database: 3
|
||||
host: 121.41.64.98
|
||||
port: 6379
|
||||
password: 'Wyy123123'
|
||||
jasypt:
|
||||
encryptor:
|
||||
password: ${JASYPT_ENCRYPTOR_PASSWORD:}
|
||||
@@ -1,16 +1,13 @@
|
||||
package com.agileboot.common.satoken.config;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.filter.SaServletFilter;
|
||||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||
import cn.dev33.satoken.router.SaRouter;
|
||||
import cn.dev33.satoken.same.SaSameUtil;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
import com.agileboot.common.core.constant.HttpStatus;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@@ -21,6 +18,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
* @author Lion Li
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
|
||||
public class SaTokenMvcConfiguration implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
@@ -36,7 +34,6 @@ public class SaTokenMvcConfiguration implements WebMvcConfigurer {
|
||||
* 注册 [Sa-Token全局过滤器]
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingClass("cn.dev33.satoken.reactor.spring.SaTokenContextRegister")
|
||||
public SaServletFilter getGlobleSaServletFilter() {
|
||||
return new SaServletFilter()
|
||||
.addInclude("/**").addExclude("/favicon.ico")
|
||||
@@ -47,36 +44,4 @@ public class SaTokenMvcConfiguration implements WebMvcConfigurer {
|
||||
.setError(e -> SaResult.error("认证失败,无法访问系统资源").setCode(HttpStatus.UNAUTHORIZED));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否从网关转发
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(SaServletFilter.class)
|
||||
public SaServletFilter getSaServletFilter() {
|
||||
return new SaServletFilter()
|
||||
.addInclude("/**")
|
||||
.addExclude("/actuator", "/actuator/**")
|
||||
.setAuth(obj -> {
|
||||
if (SaManager.getConfig().getCheckSameToken()) {
|
||||
SaSameUtil.checkCurrentRequestToken();
|
||||
}
|
||||
})
|
||||
.setError(e -> SaResult.error("认证失败,无法访问系统资源").setCode(HttpStatus.UNAUTHORIZED));
|
||||
}
|
||||
|
||||
/**
|
||||
* 对 actuator 健康检查接口 做账号密码鉴权
|
||||
*/
|
||||
// @Bean
|
||||
// public SaServletFilter actuatorFilter() {
|
||||
// String username = SpringUtil.getProperty("spring.cloud.nacos.discovery.metadata.username");
|
||||
// String password = SpringUtil.getProperty("spring.cloud.nacos.discovery.metadata.userpassword");
|
||||
// return new SaServletFilter()
|
||||
// .addInclude("/actuator", "/actuator/**")
|
||||
// .setAuth(obj -> {
|
||||
// SaHttpBasicUtil.check(username + ":" + password);
|
||||
// })
|
||||
// .setError(e -> SaResult.error(e.getMessage()).setCode(HttpStatus.UNAUTHORIZED));
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
<module>wol-auth</module>
|
||||
<module>agileboot-system-base</module>
|
||||
<module>wol-gateway</module>
|
||||
<module>wol-codegenerator</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
<artifactId>wol-auth</artifactId>
|
||||
|
||||
<properties>
|
||||
<application.name>wol-auth</application.name>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.agileboot</groupId>
|
||||
|
||||
@@ -1,67 +1,3 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: agileboot
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
dynamic:
|
||||
primary: master
|
||||
strict: false
|
||||
druid:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://121.41.64.98:3306/agileboot?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&sslMode=REQUIRED
|
||||
username: agileboot
|
||||
password: 123456
|
||||
data:
|
||||
redis:
|
||||
database: 3
|
||||
host: 121.41.64.98
|
||||
port: 6379
|
||||
password: 'Wyy123123'
|
||||
jasypt:
|
||||
encryptor:
|
||||
password: ${JASYPT_ENCRYPTOR_PASSWORD:}
|
||||
|
||||
# redisson 配置
|
||||
#redisson:
|
||||
# # redis key前缀
|
||||
|
||||
@@ -4,6 +4,8 @@ server:
|
||||
context-path: /
|
||||
spring:
|
||||
application:
|
||||
name: agileboot-system
|
||||
name: @application.name@
|
||||
config:
|
||||
import: classpath:base.yml
|
||||
profiles:
|
||||
active: dev
|
||||
active: dev
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
|
||||
<artifactId>wol-gateway</artifactId>
|
||||
|
||||
<properties>
|
||||
<application.name>wol-gateway</application.name>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.agileboot</groupId>
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.springframework.boot.context.metrics.buffering.BufferingApplicationSt
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@SpringBootApplication(scanBasePackages = "com.agileboot.gateway")
|
||||
public class WolGatewayApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication application = new SpringApplication(WolGatewayApplication.class);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.agileboot.gateway.filter;
|
||||
package com.agileboot.gateway.config;
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.reactor.context.SaReactorSyncHolder;
|
||||
@@ -19,7 +19,7 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Configuration
|
||||
public class AuthFilter {
|
||||
public class SaTokenConfig {
|
||||
|
||||
/**
|
||||
* 注册 Sa-Token 全局过滤器
|
||||
@@ -29,7 +29,7 @@ public class AuthFilter {
|
||||
return new SaReactorFilter()
|
||||
// 拦截地址
|
||||
.addInclude("/**")
|
||||
.addExclude("/favicon.ico", "/actuator", "/actuator/**", "/resource/sse")
|
||||
.addExclude("/favicon.ico", "/actuator", "/actuator/**")
|
||||
// 鉴权方法:每次访问进入
|
||||
.setAuth(obj -> {
|
||||
// 登录校验 -- 拦截所有路由
|
||||
@@ -1,9 +1,11 @@
|
||||
# Tomcat
|
||||
server:
|
||||
port: 8080
|
||||
port: 18080
|
||||
servlet:
|
||||
context-path: /
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: wol-gateway
|
||||
name: @application.name@
|
||||
config:
|
||||
import: classpath:base.yml
|
||||
|
||||
13
pom.xml
13
pom.xml
@@ -30,7 +30,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>17</java.version>
|
||||
<spring.boot.version>3.5.4</spring.boot.version>
|
||||
<spring.boot.version>3.4.7</spring.boot.version>
|
||||
<spring-cloud.version>2024.0.0</spring-cloud.version>
|
||||
<mybatis.version>3.5.16</mybatis.version>
|
||||
<mybatis-plus.version>3.5.12</mybatis-plus.version>
|
||||
@@ -319,6 +319,17 @@
|
||||
|
||||
<build>
|
||||
|
||||
<!-- 用 @application.name@ 让 Maven 替换变量,确保 pom.xml 开启 资源过滤 -->
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>*/**</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<pluginManagement>
|
||||
|
||||
<plugins>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>wol-module-codegen</module>
|
||||
<module>wol-module-ai</module>
|
||||
</modules>
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.agileboot</groupId>
|
||||
<artifactId>agileboot-system</artifactId>
|
||||
<artifactId>wol-modules</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>wol-codegenerator</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>wol-module-codegen</artifactId>
|
||||
<!-- <packaging>jar</packaging>-->
|
||||
|
||||
<name>wol-codegenerator</name>
|
||||
<name>wol-module-codegen</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
@@ -7,7 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
* @Author cuiJiaWang
|
||||
* @Create 2025-08-12 18:07
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = "com.agileboot.*")
|
||||
@SpringBootApplication(scanBasePackages = "com.agileboot.codegen")
|
||||
public class CodeGenApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
@@ -37,7 +37,7 @@ public class GeneratorServiceImpl implements IGeneratorService {
|
||||
public String getTemplateConfig() {
|
||||
String templateConfig = "";
|
||||
try {
|
||||
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("template.json");
|
||||
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("wol-module-codegen/src/main/resources/template.json");
|
||||
if (inputStream != null) {
|
||||
templateConfig = new BufferedReader(new InputStreamReader(inputStream)).lines().collect(Collectors.joining(System.lineSeparator()));
|
||||
inputStream.close();
|
||||
@@ -127,7 +127,7 @@ public class GeneratorServiceImpl implements IGeneratorService {
|
||||
for (Object groupObj : templateGroups) {
|
||||
JSONObject group = (JSONObject) groupObj;
|
||||
String groupName = group.getString("group");
|
||||
JSONArray templates = group.getJSONArray("templates");
|
||||
JSONArray templates = group.getJSONArray("wol-module-codegen/src/main/resources/templates");
|
||||
|
||||
for (Object templateObj : templates) {
|
||||
JSONObject template = (JSONObject) templateObj;
|
||||
@@ -213,14 +213,14 @@ public class GeneratorServiceImpl implements IGeneratorService {
|
||||
for (Object groupObj : allTemplates) {
|
||||
JSONObject group = (JSONObject) groupObj;
|
||||
String groupName = group.getString("group");
|
||||
JSONArray templates = group.getJSONArray("templates");
|
||||
|
||||
JSONArray templates = group.getJSONArray("wol-module-codegen/src/main/resources/templates");
|
||||
|
||||
for (Object templateObj : templates) {
|
||||
JSONObject template = (JSONObject) templateObj;
|
||||
if (templateId.equals(template.getString("id"))) {
|
||||
String templateName = template.getString("name");
|
||||
String templatePath = groupName + "/" + templateName + ".ftl";
|
||||
|
||||
|
||||
// 读取模板文件内容
|
||||
return FreemarkerUtil.getTemplateContent(templatePath);
|
||||
}
|
||||
@@ -343,7 +343,7 @@ public class GeneratorServiceImpl implements IGeneratorService {
|
||||
for (Object groupObj : templateGroups) {
|
||||
JSONObject group = (JSONObject) groupObj;
|
||||
String groupName = group.getString("group");
|
||||
JSONArray templates = group.getJSONArray("templates");
|
||||
JSONArray templates = group.getJSONArray("wol-module-codegen/src/main/resources/templates");
|
||||
|
||||
for (Object templateObj : templates) {
|
||||
JSONObject template = (JSONObject) templateObj;
|
||||
@@ -149,7 +149,7 @@ public class TemplateRepositoryServiceImpl implements ITemplateRepositoryService
|
||||
for (Object groupObj : systemTemplates) {
|
||||
JSONObject group = (JSONObject) groupObj;
|
||||
String groupName = group.getString("group");
|
||||
JSONArray templates = group.getJSONArray("templates");
|
||||
JSONArray templates = group.getJSONArray("wol-module-codegen/src/main/resources/templates");
|
||||
|
||||
for (Object templateObj : templates) {
|
||||
JSONObject template = (JSONObject) templateObj;
|
||||
@@ -239,7 +239,7 @@ public class TemplateRepositoryServiceImpl implements ITemplateRepositoryService
|
||||
for (Object groupObj : systemTemplates) {
|
||||
JSONObject group = (JSONObject) groupObj;
|
||||
String groupName = group.getString("group");
|
||||
JSONArray templates = group.getJSONArray("templates");
|
||||
JSONArray templates = group.getJSONArray("wol-module-codegen/src/main/resources/templates");
|
||||
|
||||
for (Object templateObj : templates) {
|
||||
JSONObject template = (JSONObject) templateObj;
|
||||
@@ -325,7 +325,7 @@ public class TemplateRepositoryServiceImpl implements ITemplateRepositoryService
|
||||
for (Object groupObj : systemTemplates) {
|
||||
JSONObject group = (JSONObject) groupObj;
|
||||
String groupName = group.getString("group");
|
||||
JSONArray templates = group.getJSONArray("templates");
|
||||
JSONArray templates = group.getJSONArray("wol-module-codegen/src/main/resources/templates");
|
||||
|
||||
for (Object templateObj : templates) {
|
||||
JSONObject template = (JSONObject) templateObj;
|
||||
@@ -20,7 +20,7 @@ public class FreemarkerUtil {
|
||||
|
||||
static {
|
||||
configuration = new Configuration(Configuration.VERSION_2_3_31);
|
||||
configuration.setClassForTemplateLoading(FreemarkerUtil.class, "/templates/code-generator");
|
||||
configuration.setClassForTemplateLoading(FreemarkerUtil.class, "/wol-module-codegen/src/main/resources/templates/code-generator");
|
||||
configuration.setDefaultEncoding("UTF-8");
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class FreemarkerUtil {
|
||||
// 创建一个临时的Configuration用于处理字符串模板
|
||||
Configuration tempConfig = new Configuration(Configuration.VERSION_2_3_31);
|
||||
tempConfig.setDefaultEncoding("UTF-8");
|
||||
|
||||
|
||||
// 从字符串创建模板
|
||||
Template template = new Template("userTemplate", new StringReader(templateContent), tempConfig);
|
||||
StringWriter writer = new StringWriter();
|
||||
Reference in New Issue
Block a user