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