Merge remote-tracking branch 'origin/main'

This commit is contained in:
jiang 2024-11-05 14:44:58 +08:00
commit 52b76ca87e
30 changed files with 75 additions and 55 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-api</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -87,7 +87,7 @@
<dependency>
<groupId>com.bonus</groupId>
<artifactId>bonus-common-config</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-common</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-common</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-common</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-common</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-common</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-common</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-common</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-common</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -1,6 +1,7 @@
package com.bonus.common.security.config;
//import com.bonus.common.security.interceptor.ParamSecureHandler;
import com.bonus.common.security.interceptor.ParamSecureHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ -23,11 +24,12 @@ public class WebMvcConfig implements WebMvcConfigurer
.addPathPatterns("/**")
.excludePathPatterns(EXCLUDEURLS)
.order(-10);
// //自定义拦截器
// registry.addInterceptor(getParamSecureInterceptor())
// .addPathPatterns("/**")
// .excludePathPatterns(EXCLUDEURLS)
// .order(-10);
//自定义拦截器
registry.addInterceptor(getParamSecureInterceptor())
.addPathPatterns("/**")
.excludePathPatterns(EXCLUDEURLS)
.order(-10);
}
/**
@ -42,9 +44,9 @@ public class WebMvcConfig implements WebMvcConfigurer
/**
* 自定义参数拦截器
*/
// public ParamSecureHandler getParamSecureInterceptor()
// {
// return new ParamSecureHandler();
// }
public ParamSecureHandler getParamSecureInterceptor()
{
return new ParamSecureHandler();
}
}

View File

@ -19,14 +19,13 @@ import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
/**
* @author bonus
* @data 2023/2/6 17:22
* @description 安全参数验证暂时弃用
* @description 安全参数验证
*/
@Slf4j
public class ParamSecureHandler implements AsyncHandlerInterceptor {
private static String OPERLOG_URL = "/operlog/addLogs";
private static final String REGISTER = "/user/register";
private static final String RECOGNITION = "/ocr/recognition";
private static final String [] WHITE_URL = {
"/login", "/isAdmin", "/isLogin", "/register","/operlog/addLogs"};
private String rnd = null;
public static String ur = "/";
@ -55,13 +54,7 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor {
XssRequestWrapper requestWrapper = new XssRequestWrapper(request);
String requestUrl = requestWrapper.getRequestURI();
if (OPERLOG_URL.equals(requestUrl)) {
return true;
}
if (REGISTER.equals(requestUrl)) {
return true;
}
if (RECOGNITION.equals(requestUrl)) {
if (isWhiteUrl(requestUrl)){
return true;
}
/**
@ -87,7 +80,7 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor {
*/
String readerParam = requestWrapper.getReaderParam();
// 判断是否是文件上传是不对流参数进行验证
String uplFile = "uploadFile", upImage = "uploadImage";
String uplFile = "/upload", upImage = "/uploadFiles";
if (!requestUrl.contains(uplFile) && !requestUrl.contains(upImage)) {
boolean checkReader = checkReader(readerParam, requestUrl);
if (!checkReader) {
@ -233,4 +226,8 @@ public class ParamSecureHandler implements AsyncHandlerInterceptor {
throws Exception {
SecurityContextHolder.remove();
}
private boolean isWhiteUrl(String requestUrl) {
return Arrays.asList(WHITE_URL).contains(requestUrl);
}
}

View File

@ -1,4 +1,4 @@
#com.bonus.common.security.config.MyFilter
com.bonus.common.security.config.MyFilter
com.bonus.common.security.config.WebMvcConfig
com.bonus.common.security.config.VerificationCodeConfig
com.bonus.common.security.service.TokenService

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-common</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-common</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -29,15 +29,15 @@ public class CaptchaConfig
// 验证码图片高度 默认为50
properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60");
// 验证码文本字符大小 默认为40
properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "38");
properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "40");
// KAPTCHA_SESSION_KEY
properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCode");
// 验证码文本字符长度 默认为5
properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "4");
properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "6");
// 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize)
properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier");
// 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy
properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy");
// properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy");
Config config = new Config(properties);
defaultKaptcha.setConfig(config);
return defaultKaptcha;

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-modules</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-modules</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-modules</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-modules</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -3,6 +3,7 @@ package com.bonus.system.service.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import com.bonus.common.core.web.domain.BaseEntity;
@ -86,9 +87,23 @@ public class SysDeptServiceImpl implements ISysDeptService
public List<TreeSelect> selectDeptUserTree(SysUser sysUser)
{
List<SysDept> depts = deptMapper.selectDeptUserList(sysUser.getRoleIds());
for (int i = 0; i < 5; i++) {
depts = getFilterDepts(depts);
}
return buildDeptTreeSelect(depts);
}
private static List<SysDept> getFilterDepts(List<SysDept> depts) {
List<SysDept> newDepts = new ArrayList<>();
Set<Long> pids = depts.stream().map(SysDept::getParentId).collect(Collectors.toSet());
for (SysDept sysDept : depts) {
if (sysDept.getLevel().equals(99) || pids.contains(sysDept.getDeptId())) {
newDepts.add(sysDept);
}
}
return newDepts;
}
/**
* 构建前端所需要树结构
*

View File

@ -182,7 +182,7 @@
SELECT
round(((data_length + index_length) / 1024 / 1024), 2) AS 'Size in MB'
FROM information_schema.TABLES
WHERE table_schema = 'jj_zhgd' AND table_name = 'sys_logs'
WHERE table_schema = 'bns-cloud' AND table_name = 'sys_logs'
</select>
<select id="getAllLogs" resultType="com.bonus.system.api.domain.SysLogsVo">

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus-visual</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.bonus</groupId>
<artifactId>bonus</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,14 +6,14 @@
<groupId>com.bonus</groupId>
<artifactId>bonus</artifactId>
<version>24.10.0-SNAPSHOT</version>
<version>24.11.0-SNAPSHOT</version>
<name>bonus</name>
<url>http://www.ahbonus.cn</url>
<description>博诺思微服务系统</description>
<properties>
<bonus.version>24.10.0-SNAPSHOT</bonus.version>
<bonus.version>24.11.0-SNAPSHOT</bonus.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>

View File

@ -63,14 +63,16 @@ create table sys_user (
remark varchar(500) default null comment '备注',
login_type varchar(100) default null comment '登录类型',
approval_status char(1) default '1' comment '审批状态0未审批1已审批',
is_permanent char(1) default '1' comment '长期和临时用户标识0临时用户1长期用户',
is_built_in char(1) default '0' comment '是否内置用户0非内置用户1内置用户',
primary key (user_id)
) engine=innodb auto_increment=100 comment = '用户信息表';
-- ----------------------------
-- 初始化-用户信息表数据
-- ----------------------------
insert into sys_user values(1, 103, 'admin', '博诺思', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$5azz92OgGRyRUETz/ZJeZu1exkggPYUDRssvreywTjKk.0Pmn2Q16', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '管理员','0','1');
insert into sys_user values(2, 105, 'bonus', '博诺思', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$5azz92OgGRyRUETz/ZJeZu1exkggPYUDRssvreywTjKk.0Pmn2Q16', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '测试','0','1');
insert into sys_user values(1, 103, 'bonus', '博诺思', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$5azz92OgGRyRUETz/ZJeZu1exkggPYUDRssvreywTjKk.0Pmn2Q16', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null,sysdate(), '系统管理员','0','1','1');
insert into sys_user values(2, 103, 'audit', '博诺思', '00', 'ry@163.com', '15888888889', '1', '', '$2a$10$5azz92OgGRyRUETz/ZJeZu1exkggPYUDRssvreywTjKk.0Pmn2Q16', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null,sysdate(),'审计管理','0','1','1');
-- ----------------------------
@ -120,14 +122,17 @@ create table sys_role (
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
remark varchar(500) default null comment '备注',
is_built_in char(1) default '0' comment '是否内置0非内置1内置',
primary key (role_id)
) engine=innodb auto_increment=100 comment = '角色信息表';
-- ----------------------------
-- 初始化-角色信息表数据
-- ----------------------------
insert into sys_role values('1', '超级管理员', 'admin', 1, 1, 1, 1, '0', '0', 'admin', sysdate(), '', null, '超级管理员');
insert into sys_role values('2', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', sysdate(), '', null, '普通角色');
insert into sys_role values('1', '超级管理员', 'admin', 1, 1, 1, 1, '0', '0', 'admin', sysdate(), '', null, '超级管理员','1');
insert into sys_role values('2', '审计管理员', 'audit', 1, 1, 1, 1, '0', '0', 'admin', sysdate(), '', null, '审计管理员','1');
insert into sys_role values('3', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', sysdate(), '', null, '普通角色');
-- ----------------------------
@ -755,3 +760,4 @@ create table sys_logs_set (
) engine = innodb comment = '数据库日志容量设置表';
insert into sys_logs_set values ('2048');