2025-01-xx
原有接口 /alienStore/ali/getIdInfo 在 alien-store 服务中业务逻辑有修改,需要同步更新到 alien-store-platform 服务中的 /merchantAuth/verifyIdInfo 接口。
// 简单查询 life_user 表
size = lifeUserMapper.selectCount(
new LambdaQueryWrapper<LifeUser>()
.eq(LifeUser::getIdCard, idCard)
.eq(LifeUser::getRealName, name)
);
// 简单查询 store_user 表
size = storeUserMapper.selectCount(
new LambdaQueryWrapper<StoreUser>()
.eq(StoreUser::getIdCard, idCard)
.eq(StoreUser::getName, name)
);
// 查询未注销的用户(增加 logout_flag=0 条件)
size = lifeUserMapper.selectCount(
new LambdaQueryWrapper<LifeUser>()
.eq(LifeUser::getIdCard, idCard)
.eq(LifeUser::getRealName, name)
.eq(LifeUser::getLogoutFlag, 0) // 新增:只查询未注销的用户
);
变更说明:
logout_flag = 0 条件// 查询已入住或审核中的商家(多步骤查询)
// 1. 根据身份证和姓名查询商户用户
List<StoreUser> storeUserList = storeUserMapper.selectList(
new LambdaQueryWrapper<StoreUser>()
.eq(StoreUser::getIdCard, idCard)
.eq(StoreUser::getName, name)
);
// 2. 获取这些商户用户绑定的店铺ID
List<Integer> storeIds = storeUserList.stream()
.map(StoreUser::getStoreId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
// 3. 查询非审核失败状态的店铺
if (!storeIds.isEmpty()) {
size = storeInfoMapper.selectCount(
new LambdaQueryWrapper<StoreInfo>()
.in(StoreInfo::getId, storeIds)
.notIn(StoreInfo::getStoreApplicationStatus, 2) // 排除审核失败的店铺
);
}
变更说明:
store_user 表记录数storeApplicationStatus != 2)| 状态值 | 状态名称 | 说明 | 是否允许重复使用身份证 |
|---|---|---|---|
| 0 | 待审核 | 店铺申请已提交,等待审核 | ❌ 不允许 |
| 1 | 审核通过 | 店铺申请审核通过,正常营业 | ❌ 不允许 |
| 2 | 审核失败 | 店铺申请被拒绝 | ✅ 允许 |
原逻辑问题:
新逻辑解决:
logout_flag=0)logout_flag=1)不会被统计原逻辑问题:
新逻辑解决:
storeApplicationStatus=2)业务规则:
alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/MerchantAuthServiceImpl.java
import shop.alien.entity.store.StoreInfo;
import shop.alien.mapper.StoreInfoMapper;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
// 旧代码
userWrapper.eq(LifeUser::getIdCard, idCard)
.eq(LifeUser::getRealName, name);
// 新代码
userWrapper.eq(LifeUser::getIdCard, idCard)
.eq(LifeUser::getRealName, name)
.eq(LifeUser::getLogoutFlag, 0); // 新增
// 旧代码(直接查询)
LambdaQueryWrapper<StoreUser> storeWrapper = new LambdaQueryWrapper<>();
storeWrapper.eq(StoreUser::getIdCard, idCard)
.eq(StoreUser::getName, name);
size = storeUserMapper.selectCount(storeWrapper);
// 新代码(多表联查)
// 第一步:查询商户用户
List<StoreUser> storeUserList = storeUserMapper.selectList(storeUserWrapper);
// 第二步:提取店铺ID
List<Integer> storeIds = storeUserList.stream()
.map(StoreUser::getStoreId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
// 第三步:查询有效店铺
if (!storeIds.isEmpty()) {
size = storeInfoMapper.selectCount(
new LambdaQueryWrapper<StoreInfo>()
.in(StoreInfo::getId, storeIds)
.notIn(StoreInfo::getStoreApplicationStatus, 2)
);
}
# 场景:用户已注册且未注销
# 期望:返回"该身份证已实名认证过"
curl -X GET "http://localhost:8080/merchantAuth/verifyIdInfo?name=张三&idCard=110101199001011234&appType=0"
# 场景:用户已注销(logout_flag=1)
# 期望:可以重新注册,返回"身份验证成功"
curl -X GET "http://localhost:8080/merchantAuth/verifyIdInfo?name=李四&idCard=110101199001011235&appType=0"
# 场景:商家有审核通过的店铺(status=1)
# 期望:返回"该身份证已实名认证过"
curl -X GET "http://localhost:8080/merchantAuth/verifyIdInfo?name=王五&idCard=110101199001011236&appType=1"
# 场景:商家只有审核失败的店铺(status=2)
# 期望:可以重新申请,返回"身份验证成功"
curl -X GET "http://localhost:8080/merchantAuth/verifyIdInfo?name=赵六&idCard=110101199001011237&appType=1"
# 场景:商家有待审核的店铺(status=0)
# 期望:返回"该身份证已实名认证过"
curl -X GET "http://localhost:8080/merchantAuth/verifyIdInfo?name=孙七&idCard=110101199001011238&appType=1"
-- logout_flag 字段
logout_flag TINYINT DEFAULT 0 COMMENT '注销标记(0:未注销, 1:已注销)'
-- store_application_status 字段
store_application_status TINYINT DEFAULT 0 COMMENT '店铺申请审核状态(0:待审核, 1:审核通过, 2:审核失败)'
数据库检查
life_user 表有 logout_flag 字段store_info 表有 store_application_status 字段代码部署
测试验证
| 版本 | 日期 | 说明 |
|---|---|---|
| v1.0.0 | 2025-01-xx | 初始版本 |
| v1.1.0 | 2025-01-xx | 同步 alien-store 最新业务逻辑 |
变更人员: AI Assistant
审核状态: 待审核
测试状态: 待测试