fix(service): 修复系统管理员只能查看1级代理提现申请的逻辑
This commit is contained in:
@@ -90,19 +90,32 @@ public class KeyboardTenantWithdrawOrderServiceImpl implements KeyboardTenantWit
|
||||
Long currentTenantId = TenantContextHolder.getTenantId();
|
||||
if (currentTenantId != null) {
|
||||
TenantDO currentTenant = tenantMapper.selectById(currentTenantId);
|
||||
if (currentTenant != null && currentTenant.getTenantLevel() != null
|
||||
&& currentTenant.getTenantLevel() != 0) {
|
||||
// 非系统管理员:只能查看直属下级租户的提现申请
|
||||
List<TenantDO> subordinateTenants = tenantMapper.selectList(
|
||||
new LambdaQueryWrapper<TenantDO>().eq(TenantDO::getParentId, currentTenantId));
|
||||
List<Long> subordinateTenantIds = subordinateTenants.stream()
|
||||
.map(TenantDO::getId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(subordinateTenantIds)) {
|
||||
// 没有下级租户,返回空结果
|
||||
return PageResult.empty(0L);
|
||||
if (currentTenant != null && currentTenant.getTenantLevel() != null) {
|
||||
if (currentTenant.getTenantLevel() == 0) {
|
||||
// 系统管理员:只能查看1级代理的提现申请
|
||||
List<TenantDO> firstLevelAgents = tenantMapper.selectList(
|
||||
new LambdaQueryWrapper<TenantDO>().eq(TenantDO::getTenantLevel, 1));
|
||||
List<Long> firstLevelAgentIds = firstLevelAgents.stream()
|
||||
.map(TenantDO::getId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(firstLevelAgentIds)) {
|
||||
// 没有1级代理,返回空结果
|
||||
return PageResult.empty(0L);
|
||||
}
|
||||
pageReqVO.setTenantIds(firstLevelAgentIds);
|
||||
} else {
|
||||
// 非系统管理员:只能查看直属下级租户的提现申请
|
||||
List<TenantDO> subordinateTenants = tenantMapper.selectList(
|
||||
new LambdaQueryWrapper<TenantDO>().eq(TenantDO::getParentId, currentTenantId));
|
||||
List<Long> subordinateTenantIds = subordinateTenants.stream()
|
||||
.map(TenantDO::getId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(subordinateTenantIds)) {
|
||||
// 没有下级租户,返回空结果
|
||||
return PageResult.empty(0L);
|
||||
}
|
||||
pageReqVO.setTenantIds(subordinateTenantIds);
|
||||
}
|
||||
pageReqVO.setTenantIds(subordinateTenantIds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user