Jelajahi Sumber

推送漏斗修改

qinxuyang 2 jam lalu
induk
melakukan
be0a0de4ef

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/store/CommonPushTaskUser.java

@@ -41,7 +41,7 @@ public class CommonPushTaskUser implements Serializable {
     @TableField("rel_type")
     private Integer relType;
 
-    @ApiModelProperty("发送状态:0-已发送 1-已送达")
+    @ApiModelProperty("发送状态:2-已发送 3-已抵达设备")
     @TableField("status")
     private Integer status;
 

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/store/vo/CommonPushFunnelStepVo.java

@@ -18,7 +18,7 @@ public class CommonPushFunnelStepVo implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    @ApiModelProperty("步骤编码:planned/actual/arrived/show/click")
+    @ApiModelProperty("步骤编码:actual/arrived/show/click")
     private String stepCode;
 
     @ApiModelProperty("步骤名称")

+ 14 - 24
alien-store/src/main/java/shop/alien/store/service/impl/CommonPushTaskServiceImpl.java

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