|
|
@@ -1,5 +1,6 @@
|
|
|
package com.ruoyi.web.controller.system;
|
|
|
|
|
|
+import com.ruoyi.common.core.domain.entity.TUser;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
@@ -45,7 +46,7 @@ public class SysProfileController extends BaseController
|
|
|
public AjaxResult profile()
|
|
|
{
|
|
|
LoginUser loginUser = getLoginUser();
|
|
|
- SysUser user = loginUser.getUser();
|
|
|
+ TUser user = loginUser.getUser();
|
|
|
AjaxResult ajax = AjaxResult.success(user);
|
|
|
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
|
|
return ajax;
|
|
|
@@ -54,32 +55,32 @@ public class SysProfileController extends BaseController
|
|
|
/**
|
|
|
* 修改用户
|
|
|
*/
|
|
|
- @Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
|
|
- @PutMapping
|
|
|
- public AjaxResult updateProfile(@RequestBody SysUser user)
|
|
|
- {
|
|
|
- LoginUser loginUser = getLoginUser();
|
|
|
- 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("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在");
|
|
|
- }
|
|
|
- if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
|
|
|
- {
|
|
|
- return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
|
|
|
- }
|
|
|
- if (userService.updateUserProfile(currentUser) > 0)
|
|
|
- {
|
|
|
- // 更新缓存用户信息
|
|
|
- tokenService.setLoginUser(loginUser);
|
|
|
- return success();
|
|
|
- }
|
|
|
- return error("修改个人信息异常,请联系管理员");
|
|
|
- }
|
|
|
+// @Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
|
|
+// @PutMapping
|
|
|
+// public AjaxResult updateProfile(@RequestBody SysUser user)
|
|
|
+// {
|
|
|
+// LoginUser loginUser = getLoginUser();
|
|
|
+// TUser 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("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在");
|
|
|
+// }
|
|
|
+// if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser))
|
|
|
+// {
|
|
|
+// return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在");
|
|
|
+// }
|
|
|
+// if (userService.updateUserProfile(currentUser) > 0)
|
|
|
+// {
|
|
|
+// // 更新缓存用户信息
|
|
|
+// tokenService.setLoginUser(loginUser);
|
|
|
+// return success();
|
|
|
+// }
|
|
|
+// return error("修改个人信息异常,请联系管理员");
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 重置密码
|
|
|
@@ -126,7 +127,7 @@ public class SysProfileController extends BaseController
|
|
|
AjaxResult ajax = AjaxResult.success();
|
|
|
ajax.put("imgUrl", avatar);
|
|
|
// 更新缓存用户头像
|
|
|
- loginUser.getUser().setAvatar(avatar);
|
|
|
+// loginUser.getUser().setAvatar(avatar);
|
|
|
tokenService.setLoginUser(loginUser);
|
|
|
return ajax;
|
|
|
}
|