feat(用户管理): 新增用户详情功能并隐藏身份证号码中间8位
新增用户详情接口,用于获取用户详细信息。同时,在用户DTO中处理身份证号码,隐藏中间8位以保护用户隐私。
This commit is contained in:
parent
4b2eaf7532
commit
30dbf9d2f9
|
@ -5,6 +5,7 @@ import com.agileboot.common.core.base.BaseController;
|
||||||
import com.agileboot.common.core.dto.ResponseDTO;
|
import com.agileboot.common.core.dto.ResponseDTO;
|
||||||
import com.agileboot.common.core.page.PageDTO;
|
import com.agileboot.common.core.page.PageDTO;
|
||||||
import com.agileboot.common.enums.common.BusinessTypeEnum;
|
import com.agileboot.common.enums.common.BusinessTypeEnum;
|
||||||
|
import com.agileboot.domain.ab98.user.dto.Ab98UserDetailDTO;
|
||||||
import com.agileboot.domain.common.command.BulkOperationCommand;
|
import com.agileboot.domain.common.command.BulkOperationCommand;
|
||||||
import com.agileboot.domain.ab98.user.Ab98UserApplicationService;
|
import com.agileboot.domain.ab98.user.Ab98UserApplicationService;
|
||||||
import com.agileboot.domain.ab98.user.command.AddAb98UserCommand;
|
import com.agileboot.domain.ab98.user.command.AddAb98UserCommand;
|
||||||
|
@ -41,6 +42,13 @@ public class Ab98UserController extends BaseController {
|
||||||
return ResponseDTO.ok(page);
|
return ResponseDTO.ok(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "用户详情")
|
||||||
|
@GetMapping("/detail/{id}")
|
||||||
|
public ResponseDTO<Ab98UserDetailDTO> detail(@PathVariable Long id) {
|
||||||
|
Ab98UserDetailDTO ab98UserDetail = userApplicationService.getAb98UserDetail(id);
|
||||||
|
return ResponseDTO.ok(ab98UserDetail);
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "新增用户")
|
@Operation(summary = "新增用户")
|
||||||
@AccessLog(title = "用户管理", businessType = BusinessTypeEnum.ADD)
|
@AccessLog(title = "用户管理", businessType = BusinessTypeEnum.ADD)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
|
|
@ -20,9 +20,9 @@ public class MqttController {
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/opencell")
|
@GetMapping("/opencell")
|
||||||
public String opencell(@RequestParam String data, @RequestParam Long cabinetId) {
|
public String opencell(@RequestParam String data, @RequestParam Long mqttServerId) {
|
||||||
try {
|
try {
|
||||||
mqttService.publish(data, cabinetId);
|
mqttService.publish(data, mqttServerId);
|
||||||
return "success";
|
return "success";
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("getPermanentCode error", e);
|
log.error("getPermanentCode error", e);
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.agileboot.domain.ab98.user;
|
||||||
import com.agileboot.common.core.page.PageDTO;
|
import com.agileboot.common.core.page.PageDTO;
|
||||||
import com.agileboot.domain.ab98.api.Ab98ApiUtil;
|
import com.agileboot.domain.ab98.api.Ab98ApiUtil;
|
||||||
import com.agileboot.domain.ab98.api.SsoLoginUserinfo;
|
import com.agileboot.domain.ab98.api.SsoLoginUserinfo;
|
||||||
|
import com.agileboot.domain.ab98.user.dto.Ab98UserDetailDTO;
|
||||||
import com.agileboot.domain.common.command.BulkOperationCommand;
|
import com.agileboot.domain.common.command.BulkOperationCommand;
|
||||||
import com.agileboot.domain.ab98.user.command.AddAb98UserCommand;
|
import com.agileboot.domain.ab98.user.command.AddAb98UserCommand;
|
||||||
import com.agileboot.domain.ab98.user.command.UpdateAb98UserCommand;
|
import com.agileboot.domain.ab98.user.command.UpdateAb98UserCommand;
|
||||||
|
@ -54,6 +55,10 @@ public class Ab98UserApplicationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Ab98UserEntity getByAb98UserId(Long ab98UserId) {
|
||||||
|
return userService.getById(ab98UserId);
|
||||||
|
}
|
||||||
|
|
||||||
public Ab98UserEntity getByUserId(String userId) {
|
public Ab98UserEntity getByUserId(String userId) {
|
||||||
return userService.getByUserid(userId);
|
return userService.getByUserid(userId);
|
||||||
}
|
}
|
||||||
|
@ -62,6 +67,13 @@ public class Ab98UserApplicationService {
|
||||||
return userService.getByOpenid(openid);
|
return userService.getByOpenid(openid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Ab98UserDetailDTO getAb98UserDetail(Long ab98UserId) {
|
||||||
|
Ab98UserEntity ab98UserEntity = userService.getById(ab98UserId);
|
||||||
|
return new Ab98UserDetailDTO(ab98UserEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void saveAb98User(String openid, Ab98ApiUtil.LoginData loginData) {
|
public void saveAb98User(String openid, Ab98ApiUtil.LoginData loginData) {
|
||||||
Ab98UserEntity ab98UserEntity = getByUserId(loginData.getUserid());
|
Ab98UserEntity ab98UserEntity = getByUserId(loginData.getUserid());
|
||||||
if (ab98UserEntity != null &&
|
if (ab98UserEntity != null &&
|
||||||
|
|
|
@ -17,6 +17,11 @@ public class Ab98UserDTO {
|
||||||
BeanUtil.copyProperties(entity, this);
|
BeanUtil.copyProperties(entity, this);
|
||||||
|
|
||||||
this.registeredStatus = entity.getRegistered() ? "已注册" : "未注册";
|
this.registeredStatus = entity.getRegistered() ? "已注册" : "未注册";
|
||||||
|
|
||||||
|
// 处理身份证号码,隐藏中间8位
|
||||||
|
if (this.idnum != null && this.idnum.length() >= 10) {
|
||||||
|
this.idnum = this.idnum.substring(0, 6) + "********" + this.idnum.substring(this.idnum.length() - 4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.agileboot.domain.ab98.user.dto;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.agileboot.common.annotation.ExcelColumn;
|
||||||
|
import com.agileboot.common.annotation.ExcelSheet;
|
||||||
|
import com.agileboot.common.core.base.BaseEntity;
|
||||||
|
import com.agileboot.domain.ab98.user.db.Ab98UserEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ExcelSheet(name = "汇邦云用户详情")
|
||||||
|
@Data
|
||||||
|
public class Ab98UserDetailDTO extends BaseEntity<Ab98UserDetailDTO> {
|
||||||
|
|
||||||
|
public Ab98UserDetailDTO(Ab98UserEntity entity) {
|
||||||
|
if (entity != null) {
|
||||||
|
BeanUtil.copyProperties(entity, this);
|
||||||
|
|
||||||
|
this.registeredStatus = entity.getRegistered() ? "已注册" : "未注册";
|
||||||
|
|
||||||
|
// 处理身份证号码,隐藏中间8位
|
||||||
|
if (this.idnum != null && this.idnum.length() >= 10) {
|
||||||
|
this.idnum = this.idnum.substring(0, 6) + "********" + this.idnum.substring(this.idnum.length() - 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExcelColumn(name = "主键ID")
|
||||||
|
private Long ab98UserId;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "openid")
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "用户唯一ID")
|
||||||
|
private String userid;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "真实姓名")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "手机号码")
|
||||||
|
private String tel;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "身份证号码")
|
||||||
|
private String idnum;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "性别")
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "人脸照片地址")
|
||||||
|
private String faceImg;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "身份证正面地址")
|
||||||
|
private String idcardFront;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "身份证背面地址")
|
||||||
|
private String idcardBack;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "身份证登记地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "注册状态")
|
||||||
|
private String registeredStatus;
|
||||||
|
}
|
Loading…
Reference in New Issue