فهرست منبع

添加唤起数

zhaoxian 3 سال پیش
والد
کامیت
5f0415abed

+ 39 - 36
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml

@@ -13,8 +13,11 @@
         IFNULL(t1.photo_url,'-') as url ,
         IFNULL(t1.channel_name,'-') AS channel,
         DATE_FORMAT(stat_date,'%Y-%m-%d') as createTime,
-        key_action as 'keyAction',
-        key_action_cost as 'keyActionCost',
+        sum(key_action) as 'keyAction',
+        IFNULL(round(SUM(charge)/sum(key_action),3),0) as 'keyActionCost',
+        sum(event_app_invoked) as 'eventAppInvoked',
+        IFNULL(round(SUM(charge)/sum(event_app_invoked),3),0) as 'eventAppInvokedCost',
+        concat(CAST(IFNULL(round(sum(t1.event_app_invoked) / sum(t1.bclick)*100,2),0.0) AS CHAR) ,'%') as 'eventAppInvokedRatio',
         ${filed}
         FROM
         application.kuaishou_material_video_report_daily_dw t1
@@ -58,43 +61,43 @@
     <select id="getTotalByMap" resultType="java.lang.Long">
         SELECT IFNULL(sum(1),0)
         FROM (
-            SELECT
+        SELECT
         signature
         FROM
         application.kuaishou_material_video_report_daily_dw t1
-            where 1=1
-            <if test="accountIds !=null and accountIds != ''">
-                and t1.account_id in
-                <foreach item="item" index="index" collection="accountIds"
-                         open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
-            <if test="startDate !=null and startDate != ''">
-                AND t1.stat_date &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
-            </if>
-            <if test="endDate !=null and endDate != ''">
-                AND t1.stat_date &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
-            </if>
-            <if test="leaderId !=null and leaderId != ''">
-                AND t1.leader_id = #{leaderId}
-            </if>
-            <if test="channelType != null">
-                AND t1.channel_type = #{channelType}
-            </if>
-            <if test="clipId !=null and clipId != ''">
-                AND t1.clip_id = #{clipId}
-            </if>
-            <if test="planId !=null and planId != ''">
-                AND t1.plan_id = #{planId}
-            </if>
-            <if test="shotId !=null and shotId != ''">
-                AND t1.shot_id = #{shotId}
-            </if>
-            <if test="companyId !=null and companyId != ''">
-                AND t1.company_id = #{companyId}
-            </if>
-            group by signature
+        where 1=1
+        <if test="accountIds !=null and accountIds != ''">
+            and t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="startDate !=null and startDate != ''">
+            AND t1.stat_date &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
+        </if>
+        <if test="endDate !=null and endDate != ''">
+            AND t1.stat_date &lt;= DATE_FORMAT(#{endDate},'%Y%m%d')
+        </if>
+        <if test="leaderId !=null and leaderId != ''">
+            AND t1.leader_id = #{leaderId}
+        </if>
+        <if test="channelType != null">
+            AND t1.channel_type = #{channelType}
+        </if>
+        <if test="clipId !=null and clipId != ''">
+            AND t1.clip_id = #{clipId}
+        </if>
+        <if test="planId !=null and planId != ''">
+            AND t1.plan_id = #{planId}
+        </if>
+        <if test="shotId !=null and shotId != ''">
+            AND t1.shot_id = #{shotId}
+        </if>
+        <if test="companyId !=null and companyId != ''">
+            AND t1.company_id = #{companyId}
+        </if>
+        group by signature
         ) t
     </select>
 

+ 13 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

@@ -561,6 +561,18 @@ public class AccountReportConstants {
             "    \"filed\": \"CASE WHEN sum(t1.charge) / sum(t1.key_action) IS NULL THEN 0 ELSE round(sum(t1.charge)/sum(t1.key_action),3) end as keyActionCost \",\n" +
             "    \"comment\": \"关键行为成本\"\n" +
             "  },\n" +
+            "  \"eventAppInvoked\": {\n" +
+            "    \"filed\": \"IFNULL(sum(t1.event_app_invoked),0) as eventAppInvoked \",\n" +
+            "    \"comment\": \"唤醒应用数\"\n" +
+            "  },\n" +
+            "  \"eventAppInvokedCost\": {\n" +
+            "    \"filed\": \"CASE WHEN SUM(charge)/sum(event_app_invoked) IS NULL THEN 0 ELSE round(SUM(charge)/sum(event_app_invoked),3) end as eventAppInvokedCost \",\n" +
+            "    \"comment\": \"唤醒应用成本\"\n" +
+            "  },\n" +
+            "  \"eventAppInvokedRatio\": {\n" +
+            "    \"filed\": \"CASE WHEN  sum(t1.bclick) != 0 THEN concat(CAST(round(sum(t1.event_app_invoked) / sum(t1.bclick)*100,2) AS CHAR) ,'%') else '0.00%' end as eventAppInvokedRatio \",\n" +
+            "    \"comment\": \"唤醒应用成本率\"\n" +
+            "  },\n" +
             "  \"activeRate\": {\n" +
             "    \"filed\": \"CASE WHEN  sum(t1.download_completed) != 0 THEN concat(CAST(round(sum(t1.activation) / sum(t1.download_completed)*100,2) AS CHAR) ,'%') else '0.00%' end as activeRate \",\n" +
             "    \"comment\": \"下载完成激活率\"\n" +
@@ -1352,7 +1364,7 @@ public class AccountReportConstants {
             "    \"filed\": \"IFNULL(sum(t1.share_material),0) as shareMaterial \",\n" +
             "    \"comment\": \"分享数\"\n" +
             "  },\n" +
-             "  \"showMaterial\": {\n" +
+            "  \"showMaterial\": {\n" +
             "    \"filed\": \"IFNULL(t1.material_show, 0 ) AS material_show \",\n" +
             "    \"comment\": \"展示数\"\n" +
             "  }\n" +