|
|
@ -183,16 +183,11 @@ public class AdminService { |
|
|
|
} |
|
|
|
return incomeOverviewByAppIds(Collections.singletonList(app.getId())); |
|
|
|
} |
|
|
|
MatrixAdmin admin = adminMapper.selectById(adminId); |
|
|
|
if (admin.getRole() == SUPER_ADMIN) { |
|
|
|
List<Integer> appIds = appMapper.selectList(null).stream().map(MatrixApp::getId).toList(); |
|
|
|
return incomeOverviewByAppIds(appIds); |
|
|
|
} |
|
|
|
if (StringUtils.hasText(admin.getAppIds())) { |
|
|
|
List<Integer> appIds = Arrays.stream(admin.getAppIds().split(",")).map(Integer::parseInt).toList(); |
|
|
|
return incomeOverviewByAppIds(appIds); |
|
|
|
List<Integer> appIds = getAdminAppIds(adminId); |
|
|
|
if (CollectionUtils.isEmpty(appIds)) { |
|
|
|
return new OverviewBo(); |
|
|
|
} |
|
|
|
return new OverviewBo(); |
|
|
|
return incomeOverviewByAppIds(appIds); |
|
|
|
} |
|
|
|
|
|
|
|
private OverviewBo incomeOverviewByAppIds(List<Integer> appIds) { |
|
|
@ -213,6 +208,17 @@ public class AdminService { |
|
|
|
return bo; |
|
|
|
} |
|
|
|
|
|
|
|
private List<Integer> getAdminAppIds(int adminId) { |
|
|
|
MatrixAdmin admin = adminMapper.selectById(adminId); |
|
|
|
if (admin.getRole() == SUPER_ADMIN) { |
|
|
|
return appMapper.selectList(null).stream().map(MatrixApp::getId).toList(); |
|
|
|
} |
|
|
|
if (StringUtils.hasText(admin.getAppIds())) { |
|
|
|
return Arrays.stream(admin.getAppIds().split(",")).map(Integer::parseInt).toList(); |
|
|
|
} |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
public List<DateIncome> incomeDaily(IncomeQuery query, int adminId) { |
|
|
|
LambdaQueryWrapper<MatrixAdvAggregation> wrapper = new QueryWrapper<MatrixAdvAggregation>() |
|
|
|
.select("date, sum(income) as income") |
|
|
@ -223,6 +229,12 @@ public class AdminService { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
wrapper.eq(MatrixAdvAggregation::getAppId, app.getId()); |
|
|
|
} else { |
|
|
|
List<Integer> appIds = getAdminAppIds(adminId); |
|
|
|
if (CollectionUtils.isEmpty(appIds)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
wrapper.in(MatrixAdvAggregation::getAppId, appIds); |
|
|
|
} |
|
|
|
if (query.platform != null) { |
|
|
|
wrapper.eq(MatrixAdvAggregation::getPlatform, query.platform); |
|
|
|