{"record":{"id":"563b6d0767a85cb5","repo":"jeecgboot/JeecgBoot","slug":"error-563b6d","errorCode":null,"errorMessage":"账号绑定失败,请稍后重试","messagePattern":"账号绑定失败,请稍后重试","errorType":"exception","errorClass":"JeecgBootException","httpStatus":null,"severity":"error","filePath":"jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysThirdAccountServiceImpl.java","lineNumber":223,"sourceCode":"        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();\n        //当前第三方用户已被其他用户所绑定\n        SysThirdAccount oneByThirdUserId = this.getOneByUuidAndThirdType(thirdUserUuid, thirdType,CommonConstant.TENANT_ID_DEFAULT_VALUE, null);\n        if(null != oneByThirdUserId){\n            //如果不为空，并且第三方表和当前登录的用户一致，直接返回\n            if(oConvertUtils.isNotEmpty(oneByThirdUserId.getSysUserId()) && oneByThirdUserId.getSysUserId().equals(sysUser.getId())){\n                return oneByThirdUserId;\n            }else if(oConvertUtils.isNotEmpty(oneByThirdUserId.getSysUserId())){\n                //如果第三方表的用户id不为空，那就说明已经绑定过了\n                throw new JeecgBootException(\"该敲敲云账号已被其它第三方账号绑定,请解绑或绑定其它敲敲云账号\");\n            }else{\n                //更新第三方表信息用户id\n                oneByThirdUserId.setSysUserId(sysUser.getId());\n                oneByThirdUserId.setThirdType(thirdType);\n                sysThirdAccountMapper.updateById(oneByThirdUserId);\n                return oneByThirdUserId;\n            }\n        }else{\n            throw new JeecgBootException(\"账号绑定失败,请稍后重试\");\n        }\n    }\n\n    @Override\n    public SysThirdAccount getOneByUuidAndThirdType(String unionid, String thirdType,Integer tenantId,String thirdUserId) {\n        LambdaQueryWrapper<SysThirdAccount> queryWrapper = new LambdaQueryWrapper<>();\n        queryWrapper.eq(SysThirdAccount::getThirdType, thirdType);\n        // 代码逻辑说明: 如果第三方用户id为空那么就不走第三方用户查询逻辑，因为扫码登录third_user_id是唯一的，没有重复的情况---\n        if(oConvertUtils.isNotEmpty(thirdUserId)){\n            queryWrapper.and((wrapper) ->wrapper.eq(SysThirdAccount::getThirdUserUuid,unionid).or().eq(SysThirdAccount::getThirdUserId,thirdUserId));\n        }else{\n            queryWrapper.eq(SysThirdAccount::getThirdUserUuid, unionid);\n        }\n        queryWrapper.eq(SysThirdAccount::getTenantId, tenantId);\n        return super.getOne(queryWrapper);\n    }\n\n}","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/jeecgboot/JeecgBoot/blob/96fb33f5ec68516da0b0147da06b2eb0419e063a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysThirdAccountServiceImpl.java#L205-L241","documentation":"Thrown by SysThirdAccountServiceImpl in the else branch when getOneByUuidAndThirdType returns null - i.e. no sys_third_account row exists for the given thirdUserUuid+thirdType under the default tenant. The bind flow expects a pre-existing row to attach the sysUserId to.","triggerScenarios":"Calling the bind path before the third-party login/create flow has inserted a sys_third_account row for this thirdUserUuid. The lookup uses CommonConstant.TENANT_ID_DEFAULT_VALUE and null thirdUserId.","commonSituations":"The third-party login flow that seeds sys_third_account was skipped or failed; the row was deleted; thirdType or thirdUserUuid from the request does not match what was stored during initial third-party login; tenant context causes the default-tenant lookup to miss.","solutions":["Ensure the third-party login/create flow has run and inserted the sys_third_account row before calling bind.","Check the thirdUserUuid and thirdType values match exactly what was stored (case/whitespace).","If the row legitimately does not exist, create it first or use the registration path rather than the bind path.","Retry shortly after - the message itself says '请稍后重试', implying a transient seeding race."],"exampleFix":"// before: bind called before row exists\nbindThirdAccount(sysThirdAccount); // null lookup -> throws\n\n// after: ensure row exists, then bind\nSysThirdAccount row = thirdAccountService.getOneByUuidAndThirdType(uuid, type, TENANT_ID_DEFAULT_VALUE, null);\nif (row == null) { /* run third-party create/login flow first */ return; }\nbindThirdAccount(sysThirdAccount);","handlingStrategy":"retry","validationCode":"SysThirdAccount row = thirdAccountService.getOneByUuidAndThirdType(\n    uuid, thirdType, CommonConstant.TENANT_ID_DEFAULT_VALUE, null);\nif (row == null) {\n    // seed the row via the third-party login/create flow first\n    return Result.error(\"账号未初始化，请重新走第三方登录\");\n}","typeGuard":"boolean rowExists(String uuid, String type) {\n  return thirdAccountService.getOneByUuidAndThirdType(\n      uuid, type, CommonConstant.TENANT_ID_DEFAULT_VALUE, null) != null;\n}","tryCatchPattern":"try { bindThirdAccount(acct); }\ncatch (JeecgBootException e) {\n  if (e.getMessage().contains(\"绑定失败\")) { return Result.error(\"请重新登录后重试\"); }\n  throw e;\n}","preventionTips":["Ensure the third-party login flow seeds sys_third_account before bind.","Match thirdType and thirdUserUuid exactly to stored values.","Retry after re-login if the row is missing."],"tags":["authentication","third-party-binding","data-integrity"],"backgroundTag":null,"analyzedSha":"96fb33f5ec68516da0b0147da06b2eb0419e063a","analyzedAt":"2026-08-14T00:04:16.786Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}