|
|
@ -163,14 +163,14 @@ public class AdminDeviceService { |
|
|
|
} |
|
|
|
MatrixAdmin admin = adminMapper.selectById(adminId); |
|
|
|
LambdaQueryWrapper<MatrixAdvRecord> advQuery = new QueryWrapper<MatrixAdvRecord>() |
|
|
|
.select("sum(ecpm) as ecpm").lambda(); |
|
|
|
.select("sum(ecpm_admin) as ecpm_admin").lambda(); |
|
|
|
advQuery.in(MatrixAdvRecord::getAppId, appIds); |
|
|
|
advQuery.gt(MatrixAdvRecord::getCreatedAt, new Timestamp(DateUtil.getDayBeginTimestamp(System.currentTimeMillis()))); |
|
|
|
advQuery.eq(MatrixAdvRecord::getAdminId, adminId); |
|
|
|
advQuery.eq(MatrixAdvRecord::getAdvType, 3);//只展示激励视频
|
|
|
|
MatrixAdvRecord record = advRecordMapper.selectOne(advQuery); |
|
|
|
OverviewBo bo = new OverviewBo(); |
|
|
|
bo.todayIncome = record == null ? 0 : (record.getEcpm() * admin.getIncomeRate()) / 100; |
|
|
|
bo.todayIncome = record == null ? 0 : record.getEcpmAdmin(); |
|
|
|
|
|
|
|
int today = DateUtil.currentDate(); |
|
|
|
int yesterday = DateUtil.datePlus(today, -1); |
|
|
@ -256,7 +256,7 @@ public class AdminDeviceService { |
|
|
|
long dateEnd = dateBegin + 86400_000 - 1; |
|
|
|
|
|
|
|
LambdaQueryWrapper<MatrixAdvRecord> query = new QueryWrapper<MatrixAdvRecord>() |
|
|
|
.select("admin_id, app_id, platform, sum(ecpm) as ecpm") |
|
|
|
.select("admin_id, app_id, platform, sum(ecpm) as ecpm, sum(ecpm_admin) as ecpm_admin") |
|
|
|
.lambda(); |
|
|
|
query.between(MatrixAdvRecord::getCreatedAt, new Timestamp(dateBegin), new Timestamp(dateEnd)); |
|
|
|
query.eq(MatrixAdvRecord::getAdvType, 3);//设备主只算激励视频
|
|
|
@ -265,7 +265,7 @@ public class AdminDeviceService { |
|
|
|
List<MatrixAdvRecord> records = advRecordMapper.selectList(query); |
|
|
|
List<MatrixAdvAggregationSub> aggregations = new ArrayList<>(); |
|
|
|
List<MatrixAdmin> adminList = adminMapper.selectList(null); |
|
|
|
Map<Integer, MatrixAdmin> adminMap = adminList.stream().collect(Collectors.toMap(x -> x.getId(), x -> x)); |
|
|
|
Map<Integer, MatrixAdmin> adminMap = adminList.stream().collect(Collectors.toMap(MatrixAdmin::getId, x -> x)); |
|
|
|
for (MatrixAdvRecord r : records) { |
|
|
|
MatrixAdvAggregationSub aggregation = new MatrixAdvAggregationSub(); |
|
|
|
aggregation.setAdminId(r.getAdminId()); |
|
|
@ -275,7 +275,7 @@ public class AdminDeviceService { |
|
|
|
aggregation.setIncome(r.getEcpm()); |
|
|
|
aggregations.add(aggregation); |
|
|
|
aggregation.setIncomeRate(adminMap.get(r.getAdminId()).getIncomeRate()); |
|
|
|
aggregation.setIncomeReal(aggregation.getIncomeRate() * r.getEcpm() / 100); |
|
|
|
aggregation.setIncomeReal(r.getEcpmReal()); |
|
|
|
} |
|
|
|
if (CollectionUtils.isEmpty(aggregations)) { |
|
|
|
return; |
|
|
|