jeecgboot/JeecgBoot · error · JeecgBootException
当前用户不存在,请核对手机号
Error message
当前用户不存在,请核对手机号
What it means
Thrown by SysTenantServiceImpl.invitationUserJoin in the phone branch: userService.getUserByPhone(phone) returns null, meaning no system account is registered with that phone number. invitationUserJoin invites an existing platform user into one or more tenants, so a non-existent user cannot be invited.
Source
Thrown at jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysTenantServiceImpl.java:117
@Override
public boolean removeTenantById(String id) {
// 查找出已被关联的用户数量
return super.removeById(Integer.parseInt(id));
}
@Override
@CacheEvict(value={CacheConstant.SYS_USERS_CACHE}, allEntries=true)
public void invitationUserJoin(String ids, String phone,String username) {
String[] idArray = ids.split(SymbolConstant.COMMA);
String userId = null;
SysUser userByPhone = null;
// 代码逻辑说明: 【QQYUN-4605】后台的邀请谁加入租户,没办法选不是租户下的用户,通过手机号邀请------------
if(oConvertUtils.isNotEmpty(phone)){
userByPhone = userService.getUserByPhone(phone);
//说明用户不存在
if(null == userByPhone){
throw new JeecgBootException("当前用户不存在,请核对手机号");
}
userId = userByPhone.getId();
}else{
userByPhone = userService.getUserByName(username);
//说明用户不存在
if(null == userByPhone){
throw new JeecgBootException("当前用户不存在,请核对手机号");
}
userId = userByPhone.getId();
}
//循环租户id
for (String id:idArray) {
//获取被邀请人是否已存在
SysUserTenant userTenant = userTenantMapper.getUserTenantByTenantId(userId, Integer.valueOf(id));
if(null == userTenant){
SysUserTenant relation = new SysUserTenant();
relation.setUserId(userId);View on GitHub (pinned to 96fb33f5ec)
Solutions
- Verify the phone number digit-for-digit against the user's profile; correct typos and re-submit.
- Confirm the user has not been logically deleted (check sys_user delete_flag).
- Normalize phone format (strip spaces, country code, dashes) before lookup to match stored format.
- If the user genuinely doesn't exist, create the account first, then invite.
Example fix
// before
tenantService.invitationUserJoin(tenantIds, phone, "");
// after
SysUser found = userService.getUserByPhone(normalizePhone(phone));
if (found == null) {
return Result.error("未找到该手机号对应的用户,请确认号码或先注册账号");
}
tenantService.invitationUserJoin(tenantIds, phone, ""); Defensive patterns
Strategy: validation
Validate before calling
SysUser found = userService.getUserByPhone(normalizePhone(phone));
if (found == null) {
return Result.error("未找到该手机号用户,请确认或先注册");
} Prevention
- Normalize phone format (strip +86, spaces, dashes) before lookup.
- Verify the number with the invitee out-of-band before submitting.
- Confirm the user isn't soft-deleted (delete_flag).
When it happens
Trigger: Calling the invitation endpoint with a phone number that has no matching SysUser record (oConvertUtils.isNotEmpty(phone) is true, so the phone branch is taken). The ids param is a comma-joined list of tenant IDs to invite the user into.
Common situations: Typo in the phone number; the invitee registered with a different phone; the user was soft-deleted; phone stored with a country code or formatting mismatch (e.g. +86 prefix vs bare digits); testing with a fabricated number.
Related errors
- 手机号用户:{phone} 昵称:{realname},{tenantErrorInfo}
- 你不是当前租户的组织账户管理员或超级管理员,无法进行此操作!
- 管理员已拒绝您加入租户,请联系租户管理员
- 您已是该租户成员{msg}
- assignedOwen
AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14).
Data as JSON: /api/errors/134db8fc019176cf.
Report an issue: GitHub.