!10 sync 同步ruoyi-vue-plus更新
update sa-token 1.28.0 => 1.29.0 修复Xss注解字段值为空时的异常问题 删除方法无返回值时,方法注释上的@HTTP4O4 update 使用 satoken 自带的 BCrypt 工具 替换 Security 加密工具 减少依赖 优化流程任务方法,统一响应格式 fix 修复 R 参数位置错误 fix 修复 验证码 强制校验问题 update 返回体 统一 修复自定义组件file-upload无法显示第一个文件,列表显示的文件比实际文件少一个的问题 update 修改验证码校验 增加 uuid 空判断 update 优化代码生成 fix 修复因升级 sa-token 导致 doLogin 无法获取 token 问题 update 更新 swagger 配置类错误注释 update 优化 TreeBuildUtils 工具 使用反射自动获取顶级父id fix 回滚代码生成部分优化 修复优化导致的问题 update 使用 hutool Dict 优化 JsonUtils 防止类型解析异常 update 优化代码生成 使用新 JsonUtils.parseMap 方法
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.listener;
|
||||
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
@@ -9,7 +10,6 @@ import com.ruoyi.common.excel.ExcelListener;
|
||||
import com.ruoyi.common.excel.ExcelResult;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.ValidatorUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.system.domain.vo.SysUserImportVo;
|
||||
@@ -43,7 +43,7 @@ public class SysUserImportListener extends AnalysisEventListener<SysUserImportVo
|
||||
public SysUserImportListener(Boolean isUpdateSupport) {
|
||||
String initPassword = SpringUtils.getBean(ISysConfigService.class).selectConfigByKey("sys.user.initPassword");
|
||||
this.userService = SpringUtils.getBean(ISysUserService.class);
|
||||
this.password = SecurityUtils.encryptPassword(initPassword);
|
||||
this.password = BCrypt.hashpw(initPassword);
|
||||
this.isUpdateSupport = isUpdateSupport;
|
||||
this.operName = LoginHelper.getUsername();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public interface SysUserMapper extends BaseMapperPlus<SysUserMapper, SysUser, Sy
|
||||
List<SysUser> selectUserList(SysUser sysUser);
|
||||
|
||||
/**
|
||||
* 根据条件分页查询未已配用户角色列表
|
||||
* 根据条件分页查询已配用户角色列表
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
|
||||
@@ -67,7 +67,6 @@ public interface ISysConfigService {
|
||||
* 批量删除参数信息
|
||||
*
|
||||
* @param configIds 需要删除的参数ID
|
||||
* @return 结果
|
||||
*/
|
||||
void deleteConfigByIds(Long[] configIds);
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ public interface ISysDictDataService {
|
||||
* 批量删除字典数据信息
|
||||
*
|
||||
* @param dictCodes 需要删除的字典数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
void deleteDictDataByIds(Long[] dictCodes);
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@ public interface ISysDictTypeService {
|
||||
* 批量删除字典信息
|
||||
*
|
||||
* @param dictIds 需要删除的字典ID
|
||||
* @return 结果
|
||||
*/
|
||||
void deleteDictTypeByIds(Long[] dictIds);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public interface ISysLogininforService {
|
||||
* 批量删除系统登录日志
|
||||
*
|
||||
* @param infoIds 需要删除的登录日志ID
|
||||
* @return
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteLogininforByIds(Long[] infoIds);
|
||||
|
||||
|
||||
@@ -84,7 +84,6 @@ public interface ISysPostService {
|
||||
*
|
||||
* @param postIds 需要删除的岗位ID
|
||||
* @return 结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
int deletePostByIds(Long[] postIds);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -16,8 +17,8 @@ import com.ruoyi.common.exception.user.UserException;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.redis.RedisUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -68,7 +69,7 @@ public class SysLoginService {
|
||||
|
||||
SysUser user = loadUserByUsername(username);
|
||||
|
||||
if (!SecurityUtils.matchesPassword(password, user.getPassword())) {
|
||||
if (!BCrypt.checkpw(password, user.getPassword())) {
|
||||
// 是否第一次
|
||||
errorNumber = ObjectUtil.isNull(errorNumber) ? 1 : errorNumber + 1;
|
||||
// 达到规定错误次数 则锁定登录
|
||||
@@ -104,7 +105,7 @@ public class SysLoginService {
|
||||
* @param uuid 唯一标识
|
||||
*/
|
||||
public void validateCaptcha(String username, String code, String uuid, HttpServletRequest request) {
|
||||
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
|
||||
String verifyKey = Constants.CAPTCHA_CODE_KEY + StringUtils.defaultString(uuid, "");
|
||||
String captcha = RedisUtils.getCacheObject(verifyKey);
|
||||
RedisUtils.deleteObject(verifyKey);
|
||||
if (captcha == null) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
@@ -10,8 +11,8 @@ import com.ruoyi.common.exception.user.CaptchaException;
|
||||
import com.ruoyi.common.exception.user.CaptchaExpireException;
|
||||
import com.ruoyi.common.exception.user.UserException;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.redis.RedisUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -53,7 +54,7 @@ public class SysRegisterService {
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserName(username);
|
||||
sysUser.setNickName(username);
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||
sysUser.setPassword(BCrypt.hashpw(password));
|
||||
sysUser.setUserType(userType);
|
||||
boolean regFlag = userService.registerUser(sysUser);
|
||||
if (!regFlag) {
|
||||
@@ -71,7 +72,7 @@ public class SysRegisterService {
|
||||
* @return 结果
|
||||
*/
|
||||
public void validateCaptcha(String username, String code, String uuid, HttpServletRequest request) {
|
||||
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
|
||||
String verifyKey = Constants.CAPTCHA_CODE_KEY + StringUtils.defaultString(uuid, "");
|
||||
String captcha = RedisUtils.getCacheObject(verifyKey);
|
||||
RedisUtils.deleteObject(verifyKey);
|
||||
if (captcha == null) {
|
||||
|
||||
@@ -153,7 +153,6 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
||||
* 批量删除参数信息
|
||||
*
|
||||
* @param configIds 需要删除的参数ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void deleteConfigByIds(Long[] configIds) {
|
||||
|
||||
@@ -60,8 +60,7 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
if (CollUtil.isEmpty(depts)) {
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
Long parentId = depts.get(0).getParentId();
|
||||
return TreeBuildUtils.build(depts, parentId, (dept, tree) ->
|
||||
return TreeBuildUtils.build(depts, (dept, tree) ->
|
||||
tree.setId(dept.getDeptId())
|
||||
.setParentId(dept.getParentId())
|
||||
.setName(dept.getDeptName())
|
||||
|
||||
@@ -83,7 +83,6 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||
* 批量删除字典数据信息
|
||||
*
|
||||
* @param dictCodes 需要删除的字典数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void deleteDictDataByIds(Long[] dictCodes) {
|
||||
|
||||
@@ -123,7 +123,6 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||
* 批量删除字典类型信息
|
||||
*
|
||||
* @param dictIds 需要删除的字典ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void deleteDictTypeByIds(Long[] dictIds) {
|
||||
|
||||
@@ -140,7 +140,7 @@ public class SysLogininforServiceImpl implements ISysLogininforService, Logininf
|
||||
* 批量删除系统登录日志
|
||||
*
|
||||
* @param infoIds 需要删除的登录日志ID
|
||||
* @return
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteLogininforByIds(Long[] infoIds) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.TreeBuildUtils;
|
||||
import com.ruoyi.system.domain.SysRoleMenu;
|
||||
@@ -99,7 +99,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
@Override
|
||||
public List<SysMenu> selectMenuTreeByUserId(Long userId) {
|
||||
List<SysMenu> menus = null;
|
||||
if (SecurityUtils.isAdmin(userId)) {
|
||||
if (LoginHelper.isAdmin(userId)) {
|
||||
menus = baseMapper.selectMenuTreeAll();
|
||||
} else {
|
||||
menus = baseMapper.selectMenuTreeByUserId(userId);
|
||||
@@ -181,8 +181,7 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
if (CollUtil.isEmpty(menus)) {
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
Long parentId = menus.get(0).getParentId();
|
||||
return TreeBuildUtils.build(menus, parentId, (menu, tree) ->
|
||||
return TreeBuildUtils.build(menus, (menu, tree) ->
|
||||
tree.setId(menu.getMenuId())
|
||||
.setParentId(menu.getParentId())
|
||||
.setName(menu.getMenuName())
|
||||
|
||||
@@ -148,7 +148,6 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
*
|
||||
* @param postIds 需要删除的岗位ID
|
||||
* @return 结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
@Override
|
||||
public int deletePostByIds(Long[] postIds) {
|
||||
|
||||
@@ -374,7 +374,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
* 批量选择授权用户角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要删除的用户数据ID
|
||||
* @param userIds 需要授权的用户数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.service.SensitiveService;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@@ -21,7 +20,7 @@ public class SysSensitiveServiceImpl implements SensitiveService {
|
||||
*/
|
||||
@Override
|
||||
public boolean isSensitive() {
|
||||
return SecurityUtils.isAdmin(LoginHelper.getUserId());
|
||||
return LoginHelper.isAdmin();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user