fix(wx用户): 添加检查防止重复绑定汇邦云用户
在绑定汇邦云用户时,增加检查逻辑防止多个微信用户绑定同一个汇邦云账号
This commit is contained in:
parent
60f3595d0d
commit
51830d153d
|
|
@ -291,11 +291,18 @@ public class WxUserApplicationService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 查询汇邦云用户(通过身份证)
|
// 查询汇邦云用户(通过身份证)
|
||||||
Ab98UserEntity ab98UserEntity = ab98UserService.getByIdnum(command.getIdNum());
|
Ab98UserEntity ab98UserEntity = ab98UserService.getByIdnum(command.getIdNum());
|
||||||
|
|
||||||
// 如果汇邦云用户存在且姓名匹配,则直接绑定
|
// 如果汇邦云用户存在且姓名匹配,则直接绑定
|
||||||
if (ab98UserEntity != null && StringUtils.equals(ab98UserEntity.getName(), command.getName())) {
|
if (ab98UserEntity != null && StringUtils.equals(ab98UserEntity.getName(), command.getName())) {
|
||||||
|
// 检查是否有其他微信用户已经绑定了该ab98UserId
|
||||||
|
WxUserEntity existingWxUser = userService.getByAb98UserId(ab98UserEntity.getAb98UserId());
|
||||||
|
if (existingWxUser != null) {
|
||||||
|
// 有其他微信用户已经绑定了该ab98UserId,直接抛出异常
|
||||||
|
throw new IllegalArgumentException("该汇邦云用户已被其他微信用户绑定");
|
||||||
|
}
|
||||||
// 更新微信用户表的ab98UserId
|
// 更新微信用户表的ab98UserId
|
||||||
WxUserEntity wxUserEntity = userService.getByOpenid(openid);
|
WxUserEntity wxUserEntity = userService.getByOpenid(openid);
|
||||||
if (wxUserEntity != null) {
|
if (wxUserEntity != null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue