|
@@ -104,24 +104,12 @@ public class CommonPushTaskServiceImpl extends ServiceImpl<CommonPushTaskMapper,
|
|
|
log.info("CommonPushTaskServiceImpl.funnel, pushTaskId={}, startTime={}, endTime={}", pushTaskId, startTime, endTime);
|
|
log.info("CommonPushTaskServiceImpl.funnel, pushTaskId={}, startTime={}, endTime={}", pushTaskId, startTime, endTime);
|
|
|
CommonPushTaskStatsDto stats = baseMapper.selectUserStats(pushTaskId, startTime, endTime);
|
|
CommonPushTaskStatsDto stats = baseMapper.selectUserStats(pushTaskId, startTime, endTime);
|
|
|
if (stats == null) {
|
|
if (stats == null) {
|
|
|
- stats = new CommonPushTaskStatsDto();
|
|
|
|
|
- stats.setSentCount(0L);
|
|
|
|
|
- stats.setDeliveredCount(0L);
|
|
|
|
|
- stats.setShowCount(0L);
|
|
|
|
|
- stats.setClickCount(0L);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- Long plannedCount = null;
|
|
|
|
|
- if (pushTaskId != null) {
|
|
|
|
|
- CommonPushTask task = this.getById(pushTaskId);
|
|
|
|
|
- if (task != null) {
|
|
|
|
|
- plannedCount = task.getEstimatedCount() != null ? task.getEstimatedCount().longValue() : null;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ stats = emptyUserStats();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
CommonPushFunnelVo funnelVo = new CommonPushFunnelVo();
|
|
CommonPushFunnelVo funnelVo = new CommonPushFunnelVo();
|
|
|
funnelVo.setPushTaskId(pushTaskId);
|
|
funnelVo.setPushTaskId(pushTaskId);
|
|
|
- funnelVo.setSteps(buildFunnelSteps(plannedCount, stats));
|
|
|
|
|
|
|
+ funnelVo.setSteps(buildFunnelSteps(stats));
|
|
|
return R.data(funnelVo);
|
|
return R.data(funnelVo);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -208,7 +196,7 @@ public class CommonPushTaskServiceImpl extends ServiceImpl<CommonPushTaskMapper,
|
|
|
return summary;
|
|
return summary;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private List<CommonPushFunnelStepVo> buildFunnelSteps(Long plannedCount, CommonPushTaskStatsDto stats) {
|
|
|
|
|
|
|
+ private List<CommonPushFunnelStepVo> buildFunnelSteps(CommonPushTaskStatsDto stats) {
|
|
|
long actualSend = defaultCount(stats.getSentCount());
|
|
long actualSend = defaultCount(stats.getSentCount());
|
|
|
long arrived = defaultCount(stats.getDeliveredCount());
|
|
long arrived = defaultCount(stats.getDeliveredCount());
|
|
|
long show = defaultCount(stats.getShowCount());
|
|
long show = defaultCount(stats.getShowCount());
|
|
@@ -216,18 +204,11 @@ public class CommonPushTaskServiceImpl extends ServiceImpl<CommonPushTaskMapper,
|
|
|
|
|
|
|
|
List<CommonPushFunnelStepVo> steps = new ArrayList<>();
|
|
List<CommonPushFunnelStepVo> steps = new ArrayList<>();
|
|
|
|
|
|
|
|
- CommonPushFunnelStepVo planned = new CommonPushFunnelStepVo();
|
|
|
|
|
- planned.setStepCode("planned");
|
|
|
|
|
- planned.setStepName("计划发送");
|
|
|
|
|
- planned.setCount(plannedCount);
|
|
|
|
|
- planned.setConversionRate(plannedCount != null && plannedCount > 0 ? BigDecimal.valueOf(100) : null);
|
|
|
|
|
- steps.add(planned);
|
|
|
|
|
-
|
|
|
|
|
CommonPushFunnelStepVo actual = new CommonPushFunnelStepVo();
|
|
CommonPushFunnelStepVo actual = new CommonPushFunnelStepVo();
|
|
|
actual.setStepCode("actual");
|
|
actual.setStepCode("actual");
|
|
|
actual.setStepName("实际发送");
|
|
actual.setStepName("实际发送");
|
|
|
actual.setCount(actualSend);
|
|
actual.setCount(actualSend);
|
|
|
- actual.setConversionRate(calcRate(actualSend, plannedCount != null ? plannedCount : 0L));
|
|
|
|
|
|
|
+ actual.setConversionRate(BigDecimal.valueOf(100));
|
|
|
steps.add(actual);
|
|
steps.add(actual);
|
|
|
|
|
|
|
|
CommonPushFunnelStepVo arrivedStep = new CommonPushFunnelStepVo();
|
|
CommonPushFunnelStepVo arrivedStep = new CommonPushFunnelStepVo();
|
|
@@ -248,12 +229,21 @@ public class CommonPushTaskServiceImpl extends ServiceImpl<CommonPushTaskMapper,
|
|
|
clickStep.setStepCode("click");
|
|
clickStep.setStepCode("click");
|
|
|
clickStep.setStepName("用户点击");
|
|
clickStep.setStepName("用户点击");
|
|
|
clickStep.setCount(click);
|
|
clickStep.setCount(click);
|
|
|
- clickStep.setConversionRate(calcRate(click, show));
|
|
|
|
|
|
|
+ clickStep.setConversionRate(calcRate(click, arrived));
|
|
|
steps.add(clickStep);
|
|
steps.add(clickStep);
|
|
|
|
|
|
|
|
return steps;
|
|
return steps;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private CommonPushTaskStatsDto emptyUserStats() {
|
|
|
|
|
+ CommonPushTaskStatsDto stats = new CommonPushTaskStatsDto();
|
|
|
|
|
+ stats.setSentCount(0L);
|
|
|
|
|
+ stats.setDeliveredCount(0L);
|
|
|
|
|
+ stats.setShowCount(0L);
|
|
|
|
|
+ stats.setClickCount(0L);
|
|
|
|
|
+ return stats;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private List<CommonPushReportTopItemVo> buildTopList(Date startTime, Date endTime) {
|
|
private List<CommonPushReportTopItemVo> buildTopList(Date startTime, Date endTime) {
|
|
|
List<CommonPushTaskStatsDto> topStats = baseMapper.selectTopByClickRate(startTime, endTime, 5);
|
|
List<CommonPushTaskStatsDto> topStats = baseMapper.selectTopByClickRate(startTime, endTime, 5);
|
|
|
List<CommonPushReportTopItemVo> topList = new ArrayList<>();
|
|
List<CommonPushReportTopItemVo> topList = new ArrayList<>();
|