Преглед изворни кода

盯盘2.0功能 ,账户添加状态筛选

zhaoxian пре 4 година
родитељ
комит
6e15a575eb

+ 12 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountDailyMapper.xml

@@ -393,6 +393,7 @@
         where stat_date >= #{startTime}
         AND stat_date <= #{endTime}
         AND t6.state = 1
+        and t2.account_status = 0
         <if test="userIds != null">
             AND t2.user_id IN
             <foreach item="id" index="index" collection="userIds"
@@ -418,6 +419,7 @@
         LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
         where stat_date &gt;= #{startTime}
         AND stat_date &lt;= #{endTime}
+        and t2.account_status = 0
         <if test="userIds != null">
             AND t2.user_id IN
             <foreach item="id" index="index" collection="userIds"
@@ -477,12 +479,7 @@
         t2.project_id 'projectId',
         t3.project_name as 'projectName',
         IFNULL(ROUND(SUM(play_3s_count) / SUM(aclick) * 100, 2), 0) as 'play3sRatio',
-        (
-        SELECT count(1) FROM ctop_etl_kuaishou_report_account_daily i1
-        LEFT JOIN ctop_user_allocation i2 ON i1.account_id = i2.account_id
-        where project_id = t3.id and account_status = 0
-        AND i1.stat_date &gt;= #{startTime}
-        AND i1.stat_date &lt;= #{endTime}) as 'accountCount',
+        t7.accountCount as 'accountCount',
         IFNULL(t4.userCount,0) as 'userCount'
         FROM ctop_etl_kuaishou_report_account_daily t1
         LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
@@ -508,6 +505,15 @@
         </foreach>
         GROUP BY i1.account_id
         ) t6 ON t2.account_id = t6.account_id
+        LEFT JOIN (
+        SELECT project_id ,count(1) as 'accountCount' FROM (
+        SELECT i2.project_id,i2.account_id FROM ctop_etl_kuaishou_report_account_daily i1
+        LEFT JOIN ctop_user_allocation i2 ON i1.account_id = i2.account_id
+        where account_status = 0
+        AND i1.stat_date &gt;= #{startTime}
+        AND i1.stat_date &lt;= #{endTime}
+        GROUP BY project_id,i1.account_id ) t GROUP BY t.project_id
+        ) t7 on t2.project_id = t7.project_id
         where t1.stat_date &gt;= #{startTime}
         AND t1.stat_date &lt;= #{endTime}
         AND t2.user_id in

+ 5 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountHourlyMapper.xml

@@ -287,6 +287,7 @@
         FROM ctop_etl_kuaishou_report_account_hourly t1
         LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
         where stat_date = #{startTime}
+        and t2.account_status = 0
         <if test="userIds != null">
             AND t2.user_id IN
             <foreach item="id" index="index" collection="userIds"
@@ -366,6 +367,7 @@
         LEFT JOIN ctop_kuaishou_account_balance_budget t6 ON t6.account_id = t2.account_id
         where stat_date = #{startTime}
         AND t6.state = 1
+        and t2.account_status = 0
         <if test="userIds != null">
             AND t2.user_id IN
             <foreach item="id" index="index" collection="userIds"
@@ -406,6 +408,7 @@
         FROM ctop_etl_kuaishou_report_account_hourly t1
         LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
         WHERE stat_date = #{today}
+        AND t2.account_status = 0
         AND t2.user_id IN
         <foreach item="id" index="index" collection="userIds"
                  open="(" separator="," close=")">
@@ -526,8 +529,8 @@
             #{id}
         </foreach>
         ) t9 ON t2.user_id = t9.id
-        WHERE
-        t1.stat_date = #{today}
+        WHERE t1.stat_date = #{today}
+        AND t2.account_status = 0
         AND t2.user_id IN
         <foreach item="id" index="index" collection="userIds"
                  open="(" separator="," close=")">