mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-05 20:08:05 +00:00
update 同步 ruoyi
* update element-ui 2.15.10 => 2.15.12 * update 优化 tagsView右选框,首页不应该存在关闭左侧选项 * update copyright 2023 * update 优化 日志注解支持排除指定的请求参数 * update 优化 业务校验优化代码 * fix 修复 优化文件下载出现的异常 * fix 修复 修改密码日志存储明文问题
This commit is contained in:
@@ -111,13 +111,6 @@ public interface UserConstants {
|
||||
*/
|
||||
String INNER_LINK = "InnerLink";
|
||||
|
||||
/**
|
||||
* 校验返回结果码
|
||||
*/
|
||||
String UNIQUE = "0";
|
||||
|
||||
String NOT_UNIQUE = "1";
|
||||
|
||||
/**
|
||||
* 用户名长度限制
|
||||
*/
|
||||
|
@@ -38,4 +38,10 @@ public @interface Log {
|
||||
* 是否保存响应的参数
|
||||
*/
|
||||
boolean isSaveResponseData() default true;
|
||||
|
||||
/**
|
||||
* 排除指定的请求参数
|
||||
*/
|
||||
String[] excludeParamNames() default {};
|
||||
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ import java.util.Map;
|
||||
/**
|
||||
* 操作日志记录处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Slf4j
|
||||
@Aspect
|
||||
@@ -68,12 +68,10 @@ public class LogAspect {
|
||||
OperLogEvent operLog = new OperLogEvent();
|
||||
operLog.setStatus(BusinessStatus.SUCCESS.ordinal());
|
||||
// 请求的地址
|
||||
operLog.setOperIp(ServletUtils.getClientIP());
|
||||
String ip = ServletUtils.getClientIP();
|
||||
operLog.setOperIp(ip);
|
||||
operLog.setOperUrl(StringUtils.substring(ServletUtils.getRequest().getRequestURI(), 0, 255));
|
||||
String username = LoginHelper.getUsername();
|
||||
if (StringUtils.isNotBlank(username)) {
|
||||
operLog.setOperName(username);
|
||||
}
|
||||
operLog.setOperName(LoginHelper.getUsername());
|
||||
|
||||
if (e != null) {
|
||||
operLog.setStatus(BusinessStatus.FAIL.ordinal());
|
||||
@@ -113,7 +111,7 @@ public class LogAspect {
|
||||
// 是否需要保存request,参数和值
|
||||
if (log.isSaveRequestData()) {
|
||||
// 获取参数的信息,传入到数据库中。
|
||||
setRequestValue(joinPoint, operLog);
|
||||
setRequestValue(joinPoint, operLog, log.excludeParamNames());
|
||||
}
|
||||
// 是否需要保存response,参数和值
|
||||
if (log.isSaveResponseData() && ObjectUtil.isNotNull(jsonResult)) {
|
||||
@@ -127,14 +125,16 @@ public class LogAspect {
|
||||
* @param operLog 操作日志
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
private void setRequestValue(JoinPoint joinPoint, OperLogEvent operLog) throws Exception {
|
||||
private void setRequestValue(JoinPoint joinPoint, OperLogEvent operLog, String[] excludeParamNames) throws Exception {
|
||||
Map<String, String> paramsMap = ServletUtils.getParamMap(ServletUtils.getRequest());
|
||||
String requestMethod = operLog.getRequestMethod();
|
||||
if (HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod)) {
|
||||
String params = argsArrayToString(joinPoint.getArgs());
|
||||
if (MapUtil.isEmpty(paramsMap)
|
||||
&& HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod)) {
|
||||
String params = argsArrayToString(joinPoint.getArgs(), excludeParamNames);
|
||||
operLog.setOperParam(StringUtils.substring(params, 0, 2000));
|
||||
} else {
|
||||
Map<String, String> paramsMap = ServletUtils.getParamMap(ServletUtils.getRequest());
|
||||
MapUtil.removeAny(paramsMap, EXCLUDE_PROPERTIES);
|
||||
MapUtil.removeAny(paramsMap, excludeParamNames);
|
||||
operLog.setOperParam(StringUtils.substring(JsonUtils.toJsonString(paramsMap), 0, 2000));
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class LogAspect {
|
||||
/**
|
||||
* 参数拼装
|
||||
*/
|
||||
private String argsArrayToString(Object[] paramsArray) {
|
||||
private String argsArrayToString(Object[] paramsArray, String[] excludeParamNames) {
|
||||
StringBuilder params = new StringBuilder();
|
||||
if (paramsArray != null && paramsArray.length > 0) {
|
||||
for (Object o : paramsArray) {
|
||||
@@ -152,6 +152,7 @@ public class LogAspect {
|
||||
Dict dict = JsonUtils.parseMap(str);
|
||||
if (MapUtil.isNotEmpty(dict)) {
|
||||
MapUtil.removeAny(dict, EXCLUDE_PROPERTIES);
|
||||
MapUtil.removeAny(dict, excludeParamNames);
|
||||
str = JsonUtils.toJsonString(dict);
|
||||
}
|
||||
params.append(str).append(" ");
|
||||
@@ -188,6 +189,6 @@ public class LogAspect {
|
||||
}
|
||||
}
|
||||
return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse
|
||||
|| o instanceof BindingResult;
|
||||
|| o instanceof BindingResult;
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.constant.CacheNames;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.utils.JsonUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
@@ -113,8 +112,7 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SysOssConfig entity) {
|
||||
if (StringUtils.isNotEmpty(entity.getConfigKey())
|
||||
&& UserConstants.NOT_UNIQUE.equals(checkConfigKeyUnique(entity))) {
|
||||
if (StringUtils.isNotEmpty(entity.getConfigKey()) && !checkConfigKeyUnique(entity)) {
|
||||
throw new ServiceException("操作配置'" + entity.getConfigKey() + "'失败, 配置key已存在!");
|
||||
}
|
||||
}
|
||||
@@ -142,15 +140,15 @@ public class SysOssConfigServiceImpl implements ISysOssConfigService {
|
||||
/**
|
||||
* 判断configKey是否唯一
|
||||
*/
|
||||
private String checkConfigKeyUnique(SysOssConfig sysOssConfig) {
|
||||
private boolean checkConfigKeyUnique(SysOssConfig sysOssConfig) {
|
||||
long ossConfigId = ObjectUtil.isNull(sysOssConfig.getOssConfigId()) ? -1L : sysOssConfig.getOssConfigId();
|
||||
SysOssConfig info = baseMapper.selectOne(new LambdaQueryWrapper<SysOssConfig>()
|
||||
.select(SysOssConfig::getOssConfigId, SysOssConfig::getConfigKey)
|
||||
.eq(SysOssConfig::getConfigKey, sysOssConfig.getConfigKey()));
|
||||
if (ObjectUtil.isNotNull(info) && info.getOssConfigId() != ossConfigId) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
return false;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.excel.utils.ExcelUtil;
|
||||
@@ -78,7 +77,7 @@ public class SysConfigController extends BaseController {
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody SysConfig config) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
||||
if (!configService.checkConfigKeyUnique(config)) {
|
||||
return R.fail("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
configService.insertConfig(config);
|
||||
@@ -92,7 +91,7 @@ public class SysConfigController extends BaseController {
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody SysConfig config) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
|
||||
if (!configService.checkConfigKeyUnique(config)) {
|
||||
return R.fail("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
configService.updateConfig(config);
|
||||
|
@@ -72,7 +72,7 @@ public class SysDeptController extends BaseController {
|
||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody SysDept dept) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
||||
if (!deptService.checkDeptNameUnique(dept)) {
|
||||
return R.fail("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
return toAjax(deptService.insertDept(dept));
|
||||
@@ -87,7 +87,7 @@ public class SysDeptController extends BaseController {
|
||||
public R<Void> edit(@Validated @RequestBody SysDept dept) {
|
||||
Long deptId = dept.getDeptId();
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
||||
if (!deptService.checkDeptNameUnique(dept)) {
|
||||
return R.fail("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
} else if (dept.getParentId().equals(deptId)) {
|
||||
return R.fail("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||
|
@@ -69,7 +69,7 @@ public class SysDictTypeController extends BaseController {
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody SysDictType dict) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
|
||||
if (!dictTypeService.checkDictTypeUnique(dict)) {
|
||||
return R.fail("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dictTypeService.insertDictType(dict);
|
||||
@@ -83,7 +83,7 @@ public class SysDictTypeController extends BaseController {
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody SysDictType dict) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
|
||||
if (!dictTypeService.checkDictTypeUnique(dict)) {
|
||||
return R.fail("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dictTypeService.updateDictType(dict);
|
||||
|
@@ -87,7 +87,7 @@ public class SysMenuController extends BaseController {
|
||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody SysMenu menu) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
|
||||
if (!menuService.checkMenuNameUnique(menu)) {
|
||||
return R.fail("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
|
||||
return R.fail("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
@@ -102,7 +102,7 @@ public class SysMenuController extends BaseController {
|
||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody SysMenu menu) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
|
||||
if (!menuService.checkMenuNameUnique(menu)) {
|
||||
return R.fail("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) {
|
||||
return R.fail("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.excel.utils.ExcelUtil;
|
||||
@@ -66,9 +65,9 @@ public class SysPostController extends BaseController {
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody SysPost post) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
|
||||
if (!postService.checkPostNameUnique(post)) {
|
||||
return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
} else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
|
||||
} else if (!postService.checkPostCodeUnique(post)) {
|
||||
return R.fail("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
return toAjax(postService.insertPost(post));
|
||||
@@ -81,9 +80,9 @@ public class SysPostController extends BaseController {
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated @RequestBody SysPost post) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
|
||||
if (!postService.checkPostNameUnique(post)) {
|
||||
return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
} else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
|
||||
} else if (!postService.checkPostCodeUnique(post)) {
|
||||
return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
return toAjax(postService.updatePost(post));
|
||||
|
@@ -64,11 +64,9 @@ public class SysProfileController extends BaseController {
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Void> updateProfile(@RequestBody SysUser user) {
|
||||
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||
return R.fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||
return R.fail("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUserId(LoginHelper.getUserId());
|
||||
|
@@ -5,7 +5,6 @@ import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.common.core.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.excel.utils.ExcelUtil;
|
||||
@@ -87,9 +86,9 @@ public class SysRoleController extends BaseController {
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody SysRole role) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
||||
if (!roleService.checkRoleNameUnique(role)) {
|
||||
return R.fail("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
} else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
|
||||
} else if (!roleService.checkRoleKeyUnique(role)) {
|
||||
return R.fail("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
return toAjax(roleService.insertRole(role));
|
||||
@@ -105,9 +104,9 @@ public class SysRoleController extends BaseController {
|
||||
public R<Void> edit(@Validated @RequestBody SysRole role) {
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
|
||||
if (!roleService.checkRoleNameUnique(role)) {
|
||||
return R.fail("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
} else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
|
||||
} else if (!roleService.checkRoleKeyUnique(role)) {
|
||||
return R.fail("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
if (roleService.updateRole(role) > 0) {
|
||||
|
@@ -5,7 +5,6 @@ import cn.dev33.satoken.secure.BCrypt;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.utils.StreamUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
@@ -34,7 +33,10 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
@@ -149,13 +151,13 @@ public class SysUserController extends BaseController {
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated @RequestBody SysUser user) {
|
||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user))) {
|
||||
if (!userService.checkUserNameUnique(user)) {
|
||||
return R.fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||
&& !userService.checkPhoneUnique(user)) {
|
||||
return R.fail("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||
&& !userService.checkEmailUnique(user)) {
|
||||
return R.fail("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setPassword(BCrypt.hashpw(user.getPassword()));
|
||||
@@ -171,13 +173,13 @@ public class SysUserController extends BaseController {
|
||||
public R<Void> edit(@Validated @RequestBody SysUser user) {
|
||||
userService.checkUserAllowed(user);
|
||||
userService.checkUserDataScope(user.getUserId());
|
||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user))) {
|
||||
if (!userService.checkUserNameUnique(user)) {
|
||||
return R.fail("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
|
||||
&& !userService.checkPhoneUnique(user)) {
|
||||
return R.fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail())
|
||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
|
||||
&& !userService.checkEmailUnique(user)) {
|
||||
return R.fail("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
return toAjax(userService.updateUser(user));
|
||||
|
@@ -3,7 +3,6 @@ package com.ruoyi.system.dubbo;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.enums.UserStatus;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.exception.user.UserException;
|
||||
@@ -92,7 +91,7 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
||||
throw new ServiceException("当前系统没有开启注册功能");
|
||||
}
|
||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(sysUser))) {
|
||||
if (!userService.checkUserNameUnique(sysUser)) {
|
||||
throw new UserException("user.register.save.error", username);
|
||||
}
|
||||
return userService.registerUser(sysUser);
|
||||
|
@@ -83,5 +83,5 @@ public interface ISysConfigService {
|
||||
* @param config 参数信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkConfigKeyUnique(SysConfig config);
|
||||
boolean checkConfigKeyUnique(SysConfig config);
|
||||
}
|
||||
|
@@ -89,7 +89,7 @@ public interface ISysDeptService {
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkDeptNameUnique(SysDept dept);
|
||||
boolean checkDeptNameUnique(SysDept dept);
|
||||
|
||||
/**
|
||||
* 校验部门是否有数据权限
|
||||
|
@@ -99,5 +99,5 @@ public interface ISysDictTypeService {
|
||||
* @param dictType 字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
String checkDictTypeUnique(SysDictType dictType);
|
||||
boolean checkDictTypeUnique(SysDictType dictType);
|
||||
}
|
||||
|
@@ -132,5 +132,5 @@ public interface ISysMenuService {
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkMenuNameUnique(SysMenu menu);
|
||||
boolean checkMenuNameUnique(SysMenu menu);
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ public interface ISysPostService {
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkPostNameUnique(SysPost post);
|
||||
boolean checkPostNameUnique(SysPost post);
|
||||
|
||||
/**
|
||||
* 校验岗位编码
|
||||
@@ -60,7 +60,7 @@ public interface ISysPostService {
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkPostCodeUnique(SysPost post);
|
||||
boolean checkPostCodeUnique(SysPost post);
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位使用数量
|
||||
|
@@ -69,7 +69,7 @@ public interface ISysRoleService {
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkRoleNameUnique(SysRole role);
|
||||
boolean checkRoleNameUnique(SysRole role);
|
||||
|
||||
/**
|
||||
* 校验角色权限是否唯一
|
||||
@@ -77,7 +77,7 @@ public interface ISysRoleService {
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkRoleKeyUnique(SysRole role);
|
||||
boolean checkRoleKeyUnique(SysRole role);
|
||||
|
||||
/**
|
||||
* 校验角色是否允许操作
|
||||
|
@@ -84,7 +84,7 @@ public interface ISysUserService {
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkUserNameUnique(SysUser user);
|
||||
boolean checkUserNameUnique(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
@@ -92,7 +92,7 @@ public interface ISysUserService {
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkPhoneUnique(SysUser user);
|
||||
boolean checkPhoneUnique(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
@@ -100,7 +100,7 @@ public interface ISysUserService {
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
String checkEmailUnique(SysUser user);
|
||||
boolean checkEmailUnique(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验用户是否允许操作
|
||||
|
@@ -185,13 +185,13 @@ public class SysConfigServiceImpl implements ISysConfigService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkConfigKeyUnique(SysConfig config) {
|
||||
public boolean checkConfigKeyUnique(SysConfig config) {
|
||||
Long configId = ObjectUtil.isNull(config.getConfigId()) ? -1L : config.getConfigId();
|
||||
SysConfig info = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>().eq(SysConfig::getConfigKey, config.getConfigKey()));
|
||||
if (ObjectUtil.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
return false;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -186,15 +186,12 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkDeptNameUnique(SysDept dept) {
|
||||
public boolean checkDeptNameUnique(SysDept dept) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysDept>()
|
||||
.eq(SysDept::getDeptName, dept.getDeptName())
|
||||
.eq(SysDept::getParentId, dept.getParentId())
|
||||
.ne(ObjectUtil.isNotNull(dept.getDeptId()), SysDept::getDeptId, dept.getDeptId()));
|
||||
if (exist) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
return !exist;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -211,13 +211,10 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkDictTypeUnique(SysDictType dict) {
|
||||
public boolean checkDictTypeUnique(SysDictType dict) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysDictType>()
|
||||
.eq(SysDictType::getDictType, dict.getDictType())
|
||||
.ne(ObjectUtil.isNotNull(dict.getDictId()), SysDictType::getDictId, dict.getDictId()));
|
||||
if (exist) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
return !exist;
|
||||
}
|
||||
}
|
||||
|
@@ -288,15 +288,12 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkMenuNameUnique(SysMenu menu) {
|
||||
public boolean checkMenuNameUnique(SysMenu menu) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysMenu>()
|
||||
.eq(SysMenu::getMenuName, menu.getMenuName())
|
||||
.eq(SysMenu::getParentId, menu.getParentId())
|
||||
.ne(ObjectUtil.isNotNull(menu.getMenuId()), SysMenu::getMenuId, menu.getMenuId()));
|
||||
if (exist) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
return !exist;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,7 +3,6 @@ package com.ruoyi.system.service.impl;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.mybatis.core.page.PageQuery;
|
||||
@@ -94,14 +93,11 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkPostNameUnique(SysPost post) {
|
||||
public boolean checkPostNameUnique(SysPost post) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysPost>()
|
||||
.eq(SysPost::getPostName, post.getPostName())
|
||||
.ne(ObjectUtil.isNotNull(post.getPostId()), SysPost::getPostId, post.getPostId()));
|
||||
if (exist) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
return !exist;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,14 +107,11 @@ public class SysPostServiceImpl implements ISysPostService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkPostCodeUnique(SysPost post) {
|
||||
public boolean checkPostCodeUnique(SysPost post) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysPost>()
|
||||
.eq(SysPost::getPostCode, post.getPostCode())
|
||||
.ne(ObjectUtil.isNotNull(post.getPostId()), SysPost::getPostId, post.getPostId()));
|
||||
if (exist) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
return !exist;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -151,14 +151,11 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkRoleNameUnique(SysRole role) {
|
||||
public boolean checkRoleNameUnique(SysRole role) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysRole>()
|
||||
.eq(SysRole::getRoleName, role.getRoleName())
|
||||
.ne(ObjectUtil.isNotNull(role.getRoleId()), SysRole::getRoleId, role.getRoleId()));
|
||||
if (exist) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
return !exist;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,14 +165,11 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkRoleKeyUnique(SysRole role) {
|
||||
public boolean checkRoleKeyUnique(SysRole role) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysRole>()
|
||||
.eq(SysRole::getRoleKey, role.getRoleKey())
|
||||
.ne(ObjectUtil.isNotNull(role.getRoleId()), SysRole::getRoleId, role.getRoleId()));
|
||||
if (exist) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
return !exist;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -200,14 +200,11 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkUserNameUnique(SysUser user) {
|
||||
public boolean checkUserNameUnique(SysUser user) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
||||
.eq(SysUser::getUserName, user.getUserName())
|
||||
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
||||
if (exist) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
return !exist;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,14 +214,11 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String checkPhoneUnique(SysUser user) {
|
||||
public boolean checkPhoneUnique(SysUser user) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
||||
.eq(SysUser::getPhonenumber, user.getPhonenumber())
|
||||
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
||||
if (exist) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
return !exist;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,14 +228,11 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String checkEmailUnique(SysUser user) {
|
||||
public boolean checkEmailUnique(SysUser user) {
|
||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
||||
.eq(SysUser::getEmail, user.getEmail())
|
||||
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
||||
if (exist) {
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
return !exist;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -40,7 +40,7 @@
|
||||
"clipboard": "2.0.8",
|
||||
"core-js": "3.25.3",
|
||||
"echarts": "5.4.0",
|
||||
"element-ui": "2.15.10",
|
||||
"element-ui": "2.15.12",
|
||||
"file-saver": "2.0.5",
|
||||
"fuse.js": "6.4.3",
|
||||
"highlight.js": "9.18.5",
|
||||
|
@@ -87,7 +87,7 @@ export default {
|
||||
},
|
||||
isFirstView() {
|
||||
try {
|
||||
return this.selectedTag.fullPath === this.visitedViews[1].fullPath || this.selectedTag.fullPath === '/index'
|
||||
return this.selectedTag.fullPath === '/index' || this.selectedTag.fullPath === this.visitedViews[1].fullPath
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ import { isRelogin } from '@/utils/request'
|
||||
|
||||
NProgress.configure({ showSpinner: false })
|
||||
|
||||
const whiteList = ['/login', '/auth-redirect', '/bind', '/register']
|
||||
const whiteList = ['/login', '/register']
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start()
|
||||
|
@@ -17,9 +17,9 @@ export default {
|
||||
url: url,
|
||||
responseType: 'blob',
|
||||
headers: { 'Authorization': 'Bearer ' + getToken() }
|
||||
}).then(async (res) => {
|
||||
const isLogin = await blobValidate(res.data);
|
||||
if (isLogin) {
|
||||
}).then((res) => {
|
||||
const isBlob = blobValidate(res.data);
|
||||
if (isBlob) {
|
||||
const blob = new Blob([res.data], { type: 'application/octet-stream' })
|
||||
this.saveAs(blob, decodeURI(res.headers['download-filename']))
|
||||
} else {
|
||||
@@ -42,9 +42,9 @@ export default {
|
||||
'Authorization': 'Bearer ' + getToken(),
|
||||
'datasource': localStorage.getItem("dataName")
|
||||
}
|
||||
}).then(async (res) => {
|
||||
const isLogin = await blobValidate(res.data);
|
||||
if (isLogin) {
|
||||
}).then((res) => {
|
||||
const isBlob = blobValidate(res.data);
|
||||
if (isBlob) {
|
||||
const blob = new Blob([res.data], { type: 'application/zip' })
|
||||
this.saveAs(blob, name)
|
||||
} else {
|
||||
|
@@ -74,7 +74,7 @@ service.interceptors.response.use(res => {
|
||||
// 获取错误信息
|
||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||
// 二进制数据则直接返回
|
||||
if(res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer'){
|
||||
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
|
||||
return res.data
|
||||
}
|
||||
if (code === 401) {
|
||||
@@ -127,8 +127,8 @@ export function download(url, params, filename, config) {
|
||||
responseType: 'blob',
|
||||
...config
|
||||
}).then(async (data) => {
|
||||
const isLogin = await blobValidate(data);
|
||||
if (isLogin) {
|
||||
const isBlob = blobValidate(data);
|
||||
if (isBlob) {
|
||||
const blob = new Blob([data])
|
||||
saveAs(blob, filename)
|
||||
} else {
|
||||
|
@@ -228,12 +228,6 @@ export function tansParams(params) {
|
||||
}
|
||||
|
||||
// 验证是否为blob格式
|
||||
export async function blobValidate(data) {
|
||||
try {
|
||||
const text = await data.text();
|
||||
JSON.parse(text);
|
||||
return false;
|
||||
} catch (error) {
|
||||
return true;
|
||||
}
|
||||
export function blobValidate(data) {
|
||||
return data.type !== 'application/json'
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@
|
||||
</el-form>
|
||||
<!-- 底部 -->
|
||||
<div class="el-login-footer">
|
||||
<span>Copyright © 2018-2022 ruoyi.vip All Rights Reserved.</span>
|
||||
<span>Copyright © 2018-2023 ruoyi.vip All Rights Reserved.</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@@ -61,7 +61,7 @@
|
||||
</el-form>
|
||||
<!-- 底部 -->
|
||||
<div class="el-register-footer">
|
||||
<span>Copyright © 2018-2022 ruoyi.vip All Rights Reserved.</span>
|
||||
<span>Copyright © 2018-2023 ruoyi.vip All Rights Reserved.</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@@ -107,7 +107,7 @@
|
||||
<el-table-column label="参数主键" align="center" prop="configId" />
|
||||
<el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="参数键值" align="center" prop="configValue" />
|
||||
<el-table-column label="参数键值" align="center" prop="configValue" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="系统内置" align="center" prop="configType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType"/>
|
||||
|
Reference in New Issue
Block a user