paascloud/paascloud-master · error · UacBizException

UAC10015004

UAC10015004

Error message

找不到组织信息,groupId=%s

What it means

UAC10015004 ("找不到组织信息,groupId=%s") is thrown by deleteUacGroupById when the group id to delete does not exist in uac_group. The preconditions (non-null id, not the super-manager group) pass, but selectByPrimaryKey(id) returns empty so the delete aborts.

Solutions

  1. Check existence with SELECT * FROM uac_group WHERE id = <id> before deleting
  2. Handle UacBizException UAC10015004 idempotently — treat 'already deleted' as success in the UI flow
  3. Refresh the client's group tree after each delete to avoid stale ids

Example fix

// before
uacGroupService.deleteUacGroupById(groupId);
// after
try {
    uacGroupService.deleteUacGroupById(groupId);
} catch (UacBizException e) {
    if (ErrorCodeEnum.UAC10015004.getCode().equals(e.getCode())) {
        return; // already deleted; idempotent success
    }
    throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

UacGroup g = uacGroupMapper.selectByPrimaryKey(id);
if (g == null) { return; /* already deleted — idempotent */ }

Type guard

if (id == null || Objects.equals(id, GlobalConstant.Sys.SUPER_MANAGER_GROUP_ID)) { return; }

Try / catch

try {
    uacGroupService.deleteUacGroupById(id);
} catch (UacBizException e) {
    if (ErrorCodeEnum.UAC10015004.getCode().equals(e.getCode())) { /* treat as already-deleted success */ }
    else throw e;
}

Prevention

When it happens

Trigger: Calling deleteUacGroupById(id) with a non-existent id, an id already deleted in a concurrent request, or an id from another environment/datasource.

Common situations: Double-click delete causing the second request to hit an already-removed row; stale client tree after another admin deleted the group; hardcoded/seed ids not present in the target database.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10). Data as JSON: /api/errors/5de0af3eb5175ecc. Report an issue: GitHub.

Appendix: source

Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/service/impl/UacGroupServiceImpl.java:154

				result = uacGroupMapper.updateByPrimaryKeySelective(childGroup);
				if (result < 1) {
					throw new UacBizException(ErrorCodeEnum.UAC10015006, uacGroup1.getId());
				}
			}
		}
		return result;
	}

	@Override
	public int deleteUacGroupById(Long id) {

		Preconditions.checkArgument(id != null, "组织id为空");
		Preconditions.checkArgument(!Objects.equals(id, GlobalConstant.Sys.SUPER_MANAGER_GROUP_ID), "该组织不能删除");

		// 根据前台传入的组织参数校验该组织是否存在
		UacGroup uacGroup = uacGroupMapper.selectByPrimaryKey(id);
		if (PublicUtil.isEmpty(uacGroup)) {
			throw new UacBizException(ErrorCodeEnum.UAC10015004, id);
		}
		//判断该组织下是否存在子节点
		UacGroup childGroup = new UacGroup();
		childGroup.setPid(id);
		List<UacGroup> childGroupList = uacGroupMapper.select(childGroup);
		if (PublicUtil.isNotEmpty(childGroupList)) {
			throw new UacBizException(ErrorCodeEnum.UAC10015007, id);
		}
		//判断该组织下是否存在用户
		UacGroupUser uacGroupUser = new UacGroupUser();
		uacGroupUser.setGroupId(id);
		List<UacGroupUser> uacGroupUserList = uacGroupUserMapper.select(uacGroupUser);
		if (PublicUtil.isNotEmpty(uacGroupUserList)) {
			throw new UacBizException(ErrorCodeEnum.UAC10015008, id);
		}

		return mapper.deleteByPrimaryKey(id);
	}

View on GitHub (pinned to 781281a950)