From ab99a72b65184035f48ccd0bb4f5465a0cd6b1ae Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 14 Aug 2023 19:11:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/SysProfileController.java | 19 +++++++------------ .../interceptor/RepeatSubmitInterceptor.java | 5 +++-- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java index 0ffb7e8f..ed2952f4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -60,27 +60,22 @@ public class SysProfileController extends BaseController public AjaxResult updateProfile(@RequestBody SysUser user) { LoginUser loginUser = getLoginUser(); - SysUser sysUser = loginUser.getUser(); - user.setUserName(sysUser.getUserName()); - if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) + SysUser currentUser = loginUser.getUser(); + currentUser.setNickName(user.getNickName()); + currentUser.setEmail(user.getEmail()); + currentUser.setPhonenumber(user.getPhonenumber()); + currentUser.setSex(user.getSex()); + if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) { return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); } - if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) + if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) { return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); } - user.setUserId(sysUser.getUserId()); - user.setPassword(null); - user.setAvatar(null); - user.setDeptId(null); if (userService.updateUserProfile(user) > 0) { // 更新缓存用户信息 - sysUser.setNickName(user.getNickName()); - sysUser.setPhonenumber(user.getPhonenumber()); - sysUser.setEmail(user.getEmail()); - sysUser.setSex(user.getSex()); tokenService.setLoginUser(loginUser); return success(); } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java index 05fff7bd..e41968a5 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java @@ -47,8 +47,9 @@ public abstract class RepeatSubmitInterceptor implements HandlerInterceptor /** * 验证是否重复提交由子类实现具体的防重复提交的规则 * - * @param request - * @return + * @param request 请求信息 + * @param annotation 防重复注解参数 + * @return 结果 * @throws Exception */ public abstract boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation);