fix(wx用户): 添加检查防止重复绑定汇邦云用户

在绑定汇邦云用户时,增加检查逻辑防止多个微信用户绑定同一个汇邦云账号
This commit is contained in:
dzq 2025-12-09 10:31:44 +08:00
parent 60f3595d0d
commit 51830d153d
1 changed files with 7 additions and 0 deletions

View File

@ -291,11 +291,18 @@ public class WxUserApplicationService {
return false;
}
// 查询汇邦云用户通过身份证
Ab98UserEntity ab98UserEntity = ab98UserService.getByIdnum(command.getIdNum());
// 如果汇邦云用户存在且姓名匹配则直接绑定
if (ab98UserEntity != null && StringUtils.equals(ab98UserEntity.getName(), command.getName())) {
// 检查是否有其他微信用户已经绑定了该ab98UserId
WxUserEntity existingWxUser = userService.getByAb98UserId(ab98UserEntity.getAb98UserId());
if (existingWxUser != null) {
// 有其他微信用户已经绑定了该ab98UserId直接抛出异常
throw new IllegalArgumentException("该汇邦云用户已被其他微信用户绑定");
}
// 更新微信用户表的ab98UserId
WxUserEntity wxUserEntity = userService.getByOpenid(openid);
if (wxUserEntity != null) {