feat(user): 添加用户审核状态和店名字段支持

- 在数据库用户表中新增 audit_status 和 shop_name 字段
- 在用户实体类中添加 shopName 属性
- 登录参数类中新增 auditStatus 字段,支持前端传值控制审核流程
- 主控制器中增加对注册人姓名和店名的非空校验逻辑
- 注册用户时默认审核通过,支持 auditStatus=0 时进入审核流程
- 查询用户信息接口返回包含审核状态、驳回原因及地址完整性判断信息
- 用户服务实现中根据传入参数设置用户审核状态
This commit is contained in:
2026-07-11 19:30:39 +08:00
parent 54ee652584
commit c0c140fcdf
5 changed files with 22 additions and 4 deletions

View File

@@ -361,12 +361,17 @@ public class MainController extends BaseController {
if (userId == null) {
return fail("用户未登录", null);
}
if (StrUtil.hasBlank(param.getProvince(), param.getCity(), param.getRegion(), param.getAddress())) {
return fail("请填写完整的地址信息", null);
if (StrUtil.hasBlank(param.getRealName(), param.getShopName())) {
return fail("请填写注册人和店名", null);
}
if (StrUtil.hasBlank(param.getProvince(), param.getCity(), param.getRegion())) {
return fail("请选择所在地区", null);
}
User update = new User();
update.setUserId(userId);
update.setCountry("中国");
update.setRealName(param.getRealName());
update.setShopName(param.getShopName());
update.setProvince(param.getProvince());
update.setCity(param.getCity());
update.setRegion(param.getRegion());
@@ -390,7 +395,9 @@ public class MainController extends BaseController {
java.util.Map<String, Object> result = new java.util.HashMap<>();
result.put("auditStatus", user.getAuditStatus());
result.put("rejectReason", user.getRejectReason());
result.put("hasAddress", StrUtil.isNotBlank(user.getProvince()) && StrUtil.isNotBlank(user.getAddress()));
result.put("hasAddress", StrUtil.isNotBlank(user.getRealName())
&& StrUtil.isNotBlank(user.getShopName())
&& StrUtil.isNotBlank(user.getProvince()));
return success(result);
}
@@ -725,6 +732,8 @@ public class MainController extends BaseController {
final UserParam userParam = new UserParam();
userParam.setPhone(phone);
userParam.setTenantId(tenantId);
// 前端传 auditStatus=0 时走审核流程(新用户待审核)
userParam.setAuditStatus(param.getAuditStatus());
user = userService.addUser(userParam);
}
if (!user.getStatus().equals(0)) {

View File

@@ -114,6 +114,9 @@ public class User implements UserDetails {
@Schema(description = "街道地址")
private String address;
@Schema(description = "店名")
private String shopName;
@Schema(description = "行业类型(父级)")
private String industryParent;

View File

@@ -55,4 +55,7 @@ public class LoginParam implements Serializable {
@Schema(description = "租户id")
private Integer tenantId;
@Schema(description = "审核状态: 0待审核, 1已通过, 2已拒绝前端传值决定注册是否走审核流程")
private Integer auditStatus;
}

View File

@@ -277,6 +277,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
User addUser = new User();
// 注册用户
addUser.setStatus(0);
// 默认审核通过;前端传 auditStatus=0 时走审核流程
addUser.setAuditStatus(userParam.getAuditStatus() != null ? userParam.getAuditStatus() : 1);
if(userParam.getUsername() != null){
addUser.setUsername(userParam.getUsername());
}