jeecgboot/JeecgBoot · error · JeecgBootException

该敲敲云账号已被其它第三方账号绑定,请解绑或绑定其它敲敲云账号

Error message

该敲敲云账号已被其它第三方账号绑定,请解绑或绑定其它敲敲云账号

What it means

Thrown by SysThirdAccountServiceImpl when binding a third-party account. It looks up the existing third-account row by thirdUserUuid+thirdType; if that row already has a non-empty sysUserId that does not equal the current login user's id, the binding is rejected because the third-party identity is already claimed by another system user.

Source

Thrown at jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysThirdAccountServiceImpl.java:214

        super.save(user);
        return user;
    }

    @Override
    public SysThirdAccount bindThirdAppAccountByUserId(SysThirdAccount sysThirdAccount) {
        String thirdUserUuid = sysThirdAccount.getThirdUserUuid();
        String thirdType = sysThirdAccount.getThirdType();
        //获取当前登录用户
        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        //当前第三方用户已被其他用户所绑定
        SysThirdAccount oneByThirdUserId = this.getOneByUuidAndThirdType(thirdUserUuid, thirdType,CommonConstant.TENANT_ID_DEFAULT_VALUE, null);
        if(null != oneByThirdUserId){
            //如果不为空,并且第三方表和当前登录的用户一致,直接返回
            if(oConvertUtils.isNotEmpty(oneByThirdUserId.getSysUserId()) && oneByThirdUserId.getSysUserId().equals(sysUser.getId())){
                return oneByThirdUserId;
            }else if(oConvertUtils.isNotEmpty(oneByThirdUserId.getSysUserId())){
                //如果第三方表的用户id不为空,那就说明已经绑定过了
                throw new JeecgBootException("该敲敲云账号已被其它第三方账号绑定,请解绑或绑定其它敲敲云账号");
            }else{
                //更新第三方表信息用户id
                oneByThirdUserId.setSysUserId(sysUser.getId());
                oneByThirdUserId.setThirdType(thirdType);
                sysThirdAccountMapper.updateById(oneByThirdUserId);
                return oneByThirdUserId;
            }
        }else{
            throw new JeecgBootException("账号绑定失败,请稍后重试");
        }
    }

    @Override
    public SysThirdAccount getOneByUuidAndThirdType(String unionid, String thirdType,Integer tenantId,String thirdUserId) {
        LambdaQueryWrapper<SysThirdAccount> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysThirdAccount::getThirdType, thirdType);
        // 代码逻辑说明: 如果第三方用户id为空那么就不走第三方用户查询逻辑,因为扫码登录third_user_id是唯一的,没有重复的情况---
        if(oConvertUtils.isNotEmpty(thirdUserId)){

View on GitHub (pinned to 96fb33f5ec)

Solutions

  1. Have the original account unbind the third-party identity first, then retry.
  2. If the binding is erroneous (stale data), clear sysUserId on the sys_third_account row for this thirdUserUuid+thirdType.
  3. Verify the correct thirdType and thirdUserUuid are being passed so the lookup matches the intended row.
  4. Bind a different QQYun account instead, as the message suggests.

Example fix

// before
thirdAccountService.bindThirdAccount(sysThirdAccount); // throws - already bound

// after: unbind first, then bind
sysThirdAccountMapper.clearSysUserId(thirdUserUuid, thirdType);
thirdAccountService.bindThirdAccount(sysThirdAccount);
Defensive patterns

Strategy: validation

Validate before calling

SysThirdAccount row = thirdAccountService.getOneByUuidAndThirdType(
    uuid, thirdType, CommonConstant.TENANT_ID_DEFAULT_VALUE, null);
if (row != null && oConvertUtils.isNotEmpty(row.getSysUserId())
    && !row.getSysUserId().equals(currentUser.getId())) {
    return Result.error("该第三方账号已被绑定,请先解绑");
}

Type guard

boolean isFreeToBind(SysThirdAccount row, LoginUser me) {
  return row != null && (oConvertUtils.isEmpty(row.getSysUserId())
      || row.getSysUserId().equals(me.getId()));
}

Try / catch

try { thirdAccountService.bindThirdAccount(acct); }
catch (JeecgBootException e) {
  if (e.getMessage().contains("已被其它")) return Result.error("请先解绑原账号");
  throw e;
}

Prevention

When it happens

Trigger: A user attempts to bind a third-party identity (WeChat/QQ/etc.) whose sys_third_account row already has a sysUserId belonging to a different QQYun user.

Common situations: User previously bound the same WeChat unionid under a different account and tries to rebind without unbinding; the third-user-uuid collided due to provider data issue; a prior bind left a stale sysUserId. Also multi-tenant default-tenant lookup returns a row bound in another context, or tenant filter is null so the wrong row is matched.

Related errors


AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14). Data as JSON: /api/errors/51c360f866c839dc. Report an issue: GitHub.