|
|
|
@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
|
|
import com.ruoyi.common.config.RuoYiConfig;
|
|
|
|
|
import com.ruoyi.common.constant.UserConstants;
|
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
|
@ -19,6 +20,7 @@ import com.ruoyi.common.core.domain.model.LoginUser;
|
|
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
|
|
import com.ruoyi.common.utils.ServletUtils;
|
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
|
|
|
|
import com.ruoyi.framework.web.service.TokenService;
|
|
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
|
@ -59,6 +61,16 @@ public class SysProfileController extends BaseController
|
|
|
|
|
@PutMapping
|
|
|
|
|
public AjaxResult updateProfile(@RequestBody SysUser user)
|
|
|
|
|
{
|
|
|
|
|
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
|
|
|
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
|
|
|
|
{
|
|
|
|
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(user.getEmail())
|
|
|
|
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
|
|
|
|
{
|
|
|
|
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
|
|
|
|
}
|
|
|
|
|
if (userService.updateUserProfile(user) > 0)
|
|
|
|
|
{
|
|
|
|
|
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
|
|