mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 10:57:13 +08:00 
			
		
		
		
	refactor: 适配 ContiNew Starter 脱敏模块(安全模块)
This commit is contained in:
		| @@ -16,11 +16,12 @@ | ||||
|  | ||||
| package top.charles7c.continew.admin.auth.model.resp; | ||||
|  | ||||
| import cn.hutool.core.util.DesensitizedUtil; | ||||
| import com.fasterxml.jackson.annotation.JsonIgnore; | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
| import lombok.Data; | ||||
| import top.charles7c.continew.admin.common.enums.GenderEnum; | ||||
| import top.charles7c.continew.starter.security.mask.annotation.JsonMask; | ||||
| import top.charles7c.continew.starter.security.mask.enums.MaskType; | ||||
|  | ||||
| import java.io.Serial; | ||||
| import java.io.Serializable; | ||||
| @@ -68,13 +69,15 @@ public class UserInfoResp implements Serializable { | ||||
|     /** | ||||
|      * 邮箱 | ||||
|      */ | ||||
|     @Schema(description = "邮箱", example = "123456789@qq.com") | ||||
|     @Schema(description = "邮箱", example = "c*******@126.com") | ||||
|     @JsonMask(MaskType.EMAIL) | ||||
|     private String email; | ||||
|  | ||||
|     /** | ||||
|      * 手机号码 | ||||
|      */ | ||||
|     @Schema(description = "手机号码", example = "13811111111") | ||||
|     @Schema(description = "手机号码", example = "188****8888") | ||||
|     @JsonMask(MaskType.MOBILE_PHONE) | ||||
|     private String phone; | ||||
|  | ||||
|     /** | ||||
| @@ -131,14 +134,6 @@ public class UserInfoResp implements Serializable { | ||||
|     @Schema(description = "角色编码集合", example = "[\"test\"]") | ||||
|     private Set<String> roles; | ||||
|  | ||||
|     public String getEmail() { | ||||
|         return DesensitizedUtil.email(email); | ||||
|     } | ||||
|  | ||||
|     public String getPhone() { | ||||
|         return DesensitizedUtil.mobilePhone(phone); | ||||
|     } | ||||
|  | ||||
|     public LocalDate getRegistrationDate() { | ||||
|         return createTime.toLocalDate(); | ||||
|     } | ||||
|   | ||||
| @@ -16,19 +16,17 @@ | ||||
|  | ||||
| package top.charles7c.continew.admin.system.model.resp; | ||||
|  | ||||
| import java.io.Serial; | ||||
| import java.util.Objects; | ||||
|  | ||||
| import lombok.Data; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
|  | ||||
| import cn.hutool.core.util.DesensitizedUtil; | ||||
|  | ||||
| import lombok.Data; | ||||
| import top.charles7c.continew.admin.common.enums.DisEnableStatusEnum; | ||||
| import top.charles7c.continew.admin.common.enums.GenderEnum; | ||||
| import top.charles7c.continew.admin.common.util.helper.LoginHelper; | ||||
| import top.charles7c.continew.starter.extension.crud.model.resp.BaseResp; | ||||
| import top.charles7c.continew.starter.security.mask.annotation.JsonMask; | ||||
| import top.charles7c.continew.starter.security.mask.enums.MaskType; | ||||
|  | ||||
| import java.io.Serial; | ||||
| import java.util.Objects; | ||||
|  | ||||
| /** | ||||
|  * 用户信息 | ||||
| @@ -70,13 +68,15 @@ public class UserResp extends BaseResp { | ||||
|     /** | ||||
|      * 邮箱 | ||||
|      */ | ||||
|     @Schema(description = "邮箱", example = "123456789@qq.com") | ||||
|     @Schema(description = "邮箱", example = "c*******@126.com") | ||||
|     @JsonMask(MaskType.EMAIL) | ||||
|     private String email; | ||||
|  | ||||
|     /** | ||||
|      * 手机号码 | ||||
|      */ | ||||
|     @Schema(description = "手机号码", example = "13811111111") | ||||
|     @Schema(description = "手机号码", example = "188****8888") | ||||
|     @JsonMask(MaskType.MOBILE_PHONE) | ||||
|     private String phone; | ||||
|  | ||||
|     /** | ||||
| @@ -97,14 +97,6 @@ public class UserResp extends BaseResp { | ||||
|     @Schema(description = "描述", example = "张三描述信息") | ||||
|     private String description; | ||||
|  | ||||
|     public String getEmail() { | ||||
|         return DesensitizedUtil.email(email); | ||||
|     } | ||||
|  | ||||
|     public String getPhone() { | ||||
|         return DesensitizedUtil.mobilePhone(phone); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public Boolean getDisabled() { | ||||
|         return this.getIsSystem() || Objects.equals(this.getId(), LoginHelper.getUserId()); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user