|
@@ -3,10 +3,12 @@ package org.dromara.system.controller.system;
|
|
|
import cn.dev33.satoken.secure.BCrypt;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
import org.dromara.common.core.domain.R;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.core.utils.file.MimeTypeUtils;
|
|
|
import org.dromara.common.encrypt.annotation.ApiEncrypt;
|
|
|
+import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
|
|
import org.dromara.common.log.annotation.Log;
|
|
|
import org.dromara.common.log.enums.BusinessType;
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
@@ -19,9 +21,7 @@ import org.dromara.system.domain.vo.ProfileVo;
|
|
|
import org.dromara.system.domain.vo.SysOssVo;
|
|
|
import org.dromara.system.domain.vo.SysUserVo;
|
|
|
import org.dromara.system.service.ISysOssService;
|
|
|
-import org.dromara.system.service.ISysRoleService;
|
|
|
import org.dromara.system.service.ISysUserService;
|
|
|
-import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -57,12 +57,14 @@ public class SysProfileController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 修改用户
|
|
|
+ * 修改用户信息
|
|
|
*/
|
|
|
+ @RepeatSubmit
|
|
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
public R<Void> updateProfile(@RequestBody SysUserProfileBo profile) {
|
|
|
SysUserBo user = BeanUtil.toBean(profile, SysUserBo.class);
|
|
|
+ user.setUserId(LoginHelper.getUserId());
|
|
|
String username = LoginHelper.getUsername();
|
|
|
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
|
|
return R.fail("修改用户'" + username + "'失败,手机号码已存在");
|
|
@@ -70,7 +72,6 @@ public class SysProfileController extends BaseController {
|
|
|
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
|
|
return R.fail("修改用户'" + username + "'失败,邮箱账号已存在");
|
|
|
}
|
|
|
- user.setUserId(LoginHelper.getUserId());
|
|
|
if (userService.updateUserProfile(user) > 0) {
|
|
|
return R.ok();
|
|
|
}
|
|
@@ -82,6 +83,7 @@ public class SysProfileController extends BaseController {
|
|
|
*
|
|
|
* @param bo 新旧密码
|
|
|
*/
|
|
|
+ @RepeatSubmit
|
|
|
@ApiEncrypt
|
|
|
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping("/updatePwd")
|
|
@@ -106,6 +108,7 @@ public class SysProfileController extends BaseController {
|
|
|
*
|
|
|
* @param avatarfile 用户头像
|
|
|
*/
|
|
|
+ @RepeatSubmit
|
|
|
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping(value = "/avatar", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
|
|
public R<AvatarVo> avatar(@RequestPart("avatarfile") MultipartFile avatarfile) {
|