|
@@ -17,7 +17,6 @@ class AccountReport:
|
|
self.conn = TidbConn.get_connection()
|
|
self.conn = TidbConn.get_connection()
|
|
|
|
|
|
def daily_report(self, account_id, start_date, end_date):
|
|
def daily_report(self, account_id, start_date, end_date):
|
|
- ReplaceAccountInfo.handler()
|
|
|
|
try:
|
|
try:
|
|
sql = """
|
|
sql = """
|
|
replace into application.kuaishou_account_report_daily_dw
|
|
replace into application.kuaishou_account_report_daily_dw
|
|
@@ -413,7 +412,31 @@ class AccountReport:
|
|
|
|
|
|
from media_api.kuaishou_account_report_daily report
|
|
from media_api.kuaishou_account_report_daily report
|
|
left join
|
|
left join
|
|
- `jeecg-boot`.ctop_account_attribution_info sys
|
|
|
|
|
|
+ (SELECT
|
|
|
|
+cua.account_id id,
|
|
|
|
+cua.account_id account_id,
|
|
|
|
+cp.id project_id,
|
|
|
|
+product.id product_id,
|
|
|
|
+ca.id advertiser_id,
|
|
|
|
+uc.company_id company_id,
|
|
|
|
+cua.auth_name account_name,
|
|
|
|
+cp.project_name project_name,
|
|
|
|
+ca.`name` advertiser_name,
|
|
|
|
+uc.company_name company_name,
|
|
|
|
+cp.sale_id sale_id,
|
|
|
|
+su.id user_id,
|
|
|
|
+su.leader_id,
|
|
|
|
+su.org_code org_code
|
|
|
|
+FROM
|
|
|
|
+`jeecg-boot`.ctop_user_allocation cua
|
|
|
|
+LEFT JOIN `jeecg-boot`.ctop_project cp ON cua.project_id = cp.id
|
|
|
|
+LEFT JOIN `jeecg-boot`.ctop_advertiser ca ON ca.id = cua.advertiser_id
|
|
|
|
+LEFT JOIN `jeecg-boot`.sys_user su ON su.id = cua.user_id
|
|
|
|
+LEFT JOIN `jeecg-boot`.user_company uc ON uc.user_id = cua.user_id
|
|
|
|
+LEFT JOIN `jeecg-boot`.ctop_product product ON product.id = cp.product_id
|
|
|
|
+WHERE
|
|
|
|
+cua.account_id IS NOT NULL
|
|
|
|
+ ) sys
|
|
on report.advertiser_id = sys.account_id
|
|
on report.advertiser_id = sys.account_id
|
|
where report.stat_date between {start_date} and {end_date}
|
|
where report.stat_date between {start_date} and {end_date}
|
|
and report.advertiser_id={account_id}
|
|
and report.advertiser_id={account_id}
|
|
@@ -821,7 +844,31 @@ class AccountReport:
|
|
|
|
|
|
from media_api.kuaishou_account_report_hourly report
|
|
from media_api.kuaishou_account_report_hourly report
|
|
left join
|
|
left join
|
|
- `jeecg-boot`.ctop_account_attribution_info sys
|
|
|
|
|
|
+ (SELECT
|
|
|
|
+cua.account_id id,
|
|
|
|
+cua.account_id account_id,
|
|
|
|
+cp.id project_id,
|
|
|
|
+product.id product_id,
|
|
|
|
+ca.id advertiser_id,
|
|
|
|
+uc.company_id company_id,
|
|
|
|
+cua.auth_name account_name,
|
|
|
|
+cp.project_name project_name,
|
|
|
|
+ca.`name` advertiser_name,
|
|
|
|
+uc.company_name company_name,
|
|
|
|
+cp.sale_id sale_id,
|
|
|
|
+su.id user_id,
|
|
|
|
+su.leader_id,
|
|
|
|
+su.org_code org_code
|
|
|
|
+FROM
|
|
|
|
+`jeecg-boot`.ctop_user_allocation cua
|
|
|
|
+LEFT JOIN `jeecg-boot`.ctop_project cp ON cua.project_id = cp.id
|
|
|
|
+LEFT JOIN `jeecg-boot`.ctop_advertiser ca ON ca.id = cua.advertiser_id
|
|
|
|
+LEFT JOIN `jeecg-boot`.sys_user su ON su.id = cua.user_id
|
|
|
|
+LEFT JOIN `jeecg-boot`.user_company uc ON uc.user_id = cua.user_id
|
|
|
|
+LEFT JOIN `jeecg-boot`.ctop_product product ON product.id = cp.product_id
|
|
|
|
+WHERE
|
|
|
|
+cua.account_id IS NOT NULL
|
|
|
|
+ ) sys
|
|
on report.advertiser_id = sys.account_id
|
|
on report.advertiser_id = sys.account_id
|
|
where report.stat_date between {start_date} and {end_date}
|
|
where report.stat_date between {start_date} and {end_date}
|
|
and report.advertiser_id={account_id}
|
|
and report.advertiser_id={account_id}
|