diff --git a/agileboot-domain/src/main/java/com/agileboot/domain/wx/user/WxUserApplicationService.java b/agileboot-domain/src/main/java/com/agileboot/domain/wx/user/WxUserApplicationService.java index ac922cf..89e486e 100644 --- a/agileboot-domain/src/main/java/com/agileboot/domain/wx/user/WxUserApplicationService.java +++ b/agileboot-domain/src/main/java/com/agileboot/domain/wx/user/WxUserApplicationService.java @@ -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) {