|
|
@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import com.ruoyi.common.core.constant.UserConstants;
|
|
|
|
import com.ruoyi.common.core.domain.R;
|
|
|
|
import com.ruoyi.common.core.domain.R;
|
|
|
|
import com.ruoyi.common.core.utils.SecurityUtils;
|
|
|
|
import com.ruoyi.common.core.utils.SecurityUtils;
|
|
|
|
import com.ruoyi.common.core.utils.ServletUtils;
|
|
|
|
import com.ruoyi.common.core.utils.ServletUtils;
|
|
|
@ -64,6 +65,16 @@ public class SysProfileController extends BaseController
|
|
|
|
@PutMapping
|
|
|
|
@PutMapping
|
|
|
|
public AjaxResult updateProfile(@RequestBody SysUser user)
|
|
|
|
public AjaxResult updateProfile(@RequestBody SysUser user)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
|
|
|
|
|
|
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (StringUtils.isNotEmpty(user.getEmail())
|
|
|
|
|
|
|
|
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
|
|
|
|
|
|
|
}
|
|
|
|
if (userService.updateUserProfile(user) > 0)
|
|
|
|
if (userService.updateUserProfile(user) > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LoginUser loginUser = tokenService.getLoginUser();
|
|
|
|
LoginUser loginUser = tokenService.getLoginUser();
|
|
|
|