Explorar o código

cps IAA、IAP消耗数据清洗

ZHAOXIAN hai 1 ano
pai
achega
b86a3b0ca7

+ 16 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/CPSReportMapper.xml

@@ -40,7 +40,7 @@
         FROM thirtpart.ly_link t0
                  LEFT JOIN thirtpart.ly_pay_record t1 ON t0.id = t1.link_id
                  LEFT JOIN thirtpart.ly_official_accounts t2 ON t0.official_account_id = t2.id
-                 LEFT JOIN(
+                 LEFT JOIN (
                  SELECT
                      DATE_FORMAT(t.activation_time, '%Y%m%d') AS 'date',
                      t0.id,
@@ -90,7 +90,7 @@
             t0.responsibility_person_id,
             t2.app_id,
             t0.id,
-            t3.new_users,
+            t1.new_users,
             t3.new_pay_users,
             t3.new_pay_counts,
             t3.new_order_counts,
@@ -112,6 +112,20 @@
                 LEFT JOIN  thirtpart.ly_link t0 ON t0.id = t.link_id
                 LEFT JOIN thirtpart.ly_official_accounts t2 ON t0.official_account_id = t2.id
                 LEFT JOIN (
+                SELECT
+                    DATE_FORMAT(t.activation_time, '%Y%m%d') AS 'date',
+                        t0.id,
+                    t0.official_account_id,
+                    t0.responsibility_person_id,
+                    count(DISTINCT t.uid) AS 'new_users'
+                FROM thirtpart.ly_user_activation_info t
+                         LEFT JOIN thirtpart.ly_link t0 ON t.link_id = t0.id
+                WHERE DATE_FORMAT(t.activation_time, '%Y%m%d') = #{nowDate}
+                GROUP BY t0.id, t0.official_account_id, t0.responsibility_person_id
+            ) t1 ON t0.id = t1.id
+                AND t0.official_account_id = t1.official_account_id
+                AND t0.responsibility_person_id = t1.responsibility_person_id
+                LEFT JOIN (
                 SELECT stat_date,
                        official_account_id,
                        responsibility_person_id,