feat(personal-center): 实现个人信息功能
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
package com.njcn.rdms.module.system.controller.admin.oauth2.vo.user;
|
package com.njcn.rdms.module.system.controller.admin.oauth2.vo.user;
|
||||||
|
|
||||||
|
import com.njcn.rdms.framework.common.validation.Mobile;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.Email;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.hibernate.validator.constraints.Length;
|
import org.hibernate.validator.constraints.URL;
|
||||||
|
|
||||||
import jakarta.validation.constraints.Email;
|
|
||||||
import jakarta.validation.constraints.Size;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - OAuth2 更新用户基本信息 Request VO")
|
@Schema(description = "管理后台 - OAuth2 更新用户基本信息 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@@ -25,10 +25,14 @@ public class OAuth2UserUpdateReqVO {
|
|||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@Schema(description = "手机号码", example = "15601691300")
|
@Schema(description = "手机号码", example = "15601691300")
|
||||||
@Length(min = 11, max = 11, message = "手机号长度必须 11 位")
|
@Mobile
|
||||||
private String mobile;
|
private String mobile;
|
||||||
|
|
||||||
@Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1")
|
@Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1")
|
||||||
private Integer sex;
|
private Integer sex;
|
||||||
|
|
||||||
|
@Schema(description = "用户头像", example = "https://www.iocoder.cn/xxx.png")
|
||||||
|
@URL(message = "头像地址格式不正确")
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
package com.njcn.rdms.module.system.controller.admin.user.vo.profile;
|
package com.njcn.rdms.module.system.controller.admin.user.vo.profile;
|
||||||
|
|
||||||
|
import com.njcn.rdms.framework.common.validation.Mobile;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.Email;
|
import jakarta.validation.constraints.Email;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.Data;
|
||||||
import org.hibernate.validator.constraints.URL;
|
import org.hibernate.validator.constraints.URL;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 用户个人信息更新 Request VO")
|
@Schema(description = "管理后台 - 用户个人信息更新 Request VO")
|
||||||
@Data
|
@Data
|
||||||
public class UserProfileUpdateReqVO {
|
public class UserProfileUpdateReqVO {
|
||||||
@@ -23,7 +21,7 @@ public class UserProfileUpdateReqVO {
|
|||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@Schema(description = "手机号码", example = "15601691300")
|
@Schema(description = "手机号码", example = "15601691300")
|
||||||
@Length(min = 11, max = 11, message = "手机号长度必须 11 位")
|
@Mobile
|
||||||
private String mobile;
|
private String mobile;
|
||||||
|
|
||||||
@Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1")
|
@Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1")
|
||||||
|
|||||||
@@ -152,10 +152,10 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
public void updateUserPassword(Long id, UserProfileUpdatePasswordReqVO reqVO) {
|
public void updateUserPassword(Long id, UserProfileUpdatePasswordReqVO reqVO) {
|
||||||
// 校验旧密码
|
// 校验旧密码
|
||||||
validateOldPassword(id, reqVO.getOldPassword());
|
validateOldPassword(id, reqVO.getOldPassword());
|
||||||
// 执行更新
|
// 复用已有的密码更新逻辑,保留审计日志
|
||||||
AdminUserDO updateObj = new AdminUserDO().setId(id);
|
updateUserPassword(id, reqVO.getNewPassword());
|
||||||
updateObj.setPassword(encodePassword(reqVO.getNewPassword())); // 加密密码
|
// 密码变更后强制使原有令牌失效
|
||||||
userMapper.updateById(updateObj);
|
oauth2TokenService.removeAccessToken(id, UserTypeEnum.ADMIN.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user