浏览代码

解决ROI问题

zhaoxian 2 年之前
父节点
当前提交
2a0a7d6fe6

+ 1 - 1
ruixuan-live/src/main/java/com/ruixuan/report/utils/AccountReportConstants.java

@@ -167,7 +167,7 @@ public class AccountReportConstants {
             "    \"comment\": \"30日累计GMV\"\n" +
             "  },\n" +
             "  \"roi\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.conversion_num) != 0 THEN ROUND((sum(t1.cost_total) / sum(t1.conversion_num)),2) ELSE '0.00' END AS roi \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost_total) != 0 THEN ROUND((sum(t1.gmv) / sum(t1.cost_total)),2) ELSE '0.00' END AS roi \",\n" +
             "    \"comment\": \"ROI\"\n" +
             "  },\n" +
             "  \"paiedOrder\": {\n" +

+ 12 - 12
ruixuan-live/src/main/resources/mapper/report/KuaishouLiveAccountReportMapper.xml

@@ -73,7 +73,7 @@
         t2.operator_id as 'operatorId',
         t2.operator_name as 'operatorName',
         SUM(cost_total) as 'costTotal',
-        IFNULL(ROUND(SUM(t1.t0_gmv) / SUM(cost_total), 2), 0) as 'roi'
+        IFNULL(ROUND(SUM(t1.gmv) / SUM(cost_total), 2), 0) as 'roi'
         FROM kuaishou_live_account_report_hourly_dw t1
         LEFT JOIN `kuaishou_project` t2 ON t1.project_id = t2.id
         WHERE report_date = #{today}
@@ -92,7 +92,7 @@
         SELECT
         t1.project_id as 'projectId',
         SUM(cost_total) as 'costTotal',
-        IFNULL(ROUND(SUM(t1.t0_gmv) / SUM(cost_total), 2), 0) as 'roi'
+        IFNULL(ROUND(SUM(t1.gmv) / SUM(cost_total), 2), 0) as 'roi'
         FROM kuaishou_live_account_report_hourly_dw t1
         WHERE report_date = #{yesterday}
         AND hour <= #{hour}
@@ -119,7 +119,7 @@
         t2.operator_id as 'operatorId',
         t2.operator_name as 'operatorName',
         SUM(cost_total) as 'costTotal',
-        IFNULL(ROUND(SUM(t1.t0_gmv) / SUM(cost_total), 2), 0) as 'roi'
+        IFNULL(ROUND(SUM(t1.gmv) / SUM(cost_total), 2), 0) as 'roi'
         FROM kuaishou_live_account_report_daily_dw t1
         LEFT JOIN `kuaishou_project` t2 ON t1.project_id = t2.id
         WHERE report_date >= #{startDate}
@@ -138,7 +138,7 @@
         SELECT
         project_id as 'projectId',
         SUM(cost_total) as 'costTotal',
-        IFNULL(ROUND(SUM(t0_gmv) / SUM(cost_total), 2), 0) as 'roi'
+        IFNULL(ROUND(SUM(gmv) / SUM(cost_total), 2), 0) as 'roi'
         FROM kuaishou_live_account_report_daily_dw
         WHERE report_date >=#{lastStart}
         AND report_date <=#{lastEnd}
@@ -468,8 +468,8 @@
         (
         SELECT
         IFNULL(SUM(cost_total),0)AS'costTotal',
-        IFNULL(SUM(t0_gmv),0)AS't0Gmv',
-        IFNULL(SUM(t0_gmv)/SUM(cost_total),0)AS't0Roi',
+        IFNULL(SUM(gmv),0)AS't0Gmv',
+        IFNULL(SUM(gmv)/SUM(cost_total),0)AS't0Roi',
         IFNULL(SUM(cost_total)/SUM(standard_live_played_started),0)AS'viewCost',
         IFNULL(SUM(merchant_reco_fans),0)AS'upFans',
         IFNULL(SUM(cost_total)/SUM(t0_order_cnt),0)AS'orderCost'
@@ -489,8 +489,8 @@
         (
         SELECT
         IFNULL(SUM(cost_total),0)AS'costTotal',
-        IFNULL(SUM(t0_gmv),0)AS't0Gmv',
-        IFNULL(SUM(t0_gmv)/SUM(cost_total),0)AS't0Roi',
+        IFNULL(SUM(gmv),0)AS't0Gmv',
+        IFNULL(SUM(gmv)/SUM(cost_total),0)AS't0Roi',
         IFNULL(SUM(cost_total)/SUM(standard_live_played_started),0)AS'viewCost',
         IFNULL(SUM(merchant_reco_fans),0)AS'upFans',
         IFNULL(SUM(cost_total)/SUM(t0_order_cnt),0)AS'orderCost'
@@ -525,8 +525,8 @@
         (
         SELECT
         IFNULL(SUM(cost_total),0)AS'costTotal',
-        IFNULL(SUM(t0_gmv),0)AS't0Gmv',
-        IFNULL(SUM(t0_gmv)/SUM(cost_total),0)AS't0Roi',
+        IFNULL(SUM(gmv),0)AS't0Gmv',
+        IFNULL(SUM(gmv)/SUM(cost_total),0)AS't0Roi',
         IFNULL(SUM(cost_total)/SUM(standard_live_played_started),0)AS'viewCost',
         IFNULL(SUM(merchant_reco_fans),0)AS'upFans',
         IFNULL(SUM(cost_total)/SUM(t0_order_cnt),0)AS'orderCost'
@@ -546,8 +546,8 @@
         (
         SELECT
         IFNULL(SUM(cost_total),0)AS'costTotal',
-        IFNULL(SUM(t0_gmv),0)AS't0Gmv',
-        IFNULL(SUM(t0_gmv)/SUM(cost_total),0)AS't0Roi',
+        IFNULL(SUM(gmv),0)AS't0Gmv',
+        IFNULL(SUM(gmv)/SUM(cost_total),0)AS't0Roi',
         IFNULL(SUM(cost_total)/SUM(standard_live_played_started),0)AS'viewCost',
         IFNULL(SUM(merchant_reco_fans),0)AS'upFans',
         IFNULL(SUM(cost_total)/SUM(t0_order_cnt),0)AS'orderCost'