renyupeng 2 år sedan
förälder
incheckning
af3886e5ff

+ 25 - 2
Apietl/kwai_etl/report/AccountDailyReport.py

@@ -23,7 +23,6 @@ class AccountDailyReport:
         self.end_time = self.parm[1]
 
     def daily_report(self):
-        ReplaceAccountInfo.handler()
         try:
             sql = """
             replace into application.kuaishou_account_report_daily_dw
@@ -319,7 +318,31 @@ class AccountDailyReport:
                
         from media_api.kuaishou_account_report_daily report
                  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
         where report.stat_date between {start_time} and {end_time}
         """.format(start_time=self.start_time, end_time=self.end_time)

+ 25 - 2
Apietl/kwai_etl/report/AccountHourlyReport.py

@@ -23,7 +23,6 @@ class AccountHourlyReport:
         self.end_time = self.parm[1]
 
     def daily_report(self):
-        ReplaceAccountInfo.handler()
         try:
             sql = """select advertiser_id from media_api.kuaishou_account_report_hourly where 
             stat_date between {start_time} and {end_time}
@@ -426,7 +425,31 @@ class AccountHourlyReport:
 ,ad_app_download_half_impression
         from media_api.kuaishou_account_report_hourly report
                  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
         where report.stat_date between {start_time} and {end_time}
     and  report.advertiser_id = {account_id}

+ 50 - 3
Apietl/kwai_etl/report/AccountReport.py

@@ -17,7 +17,6 @@ class AccountReport:
         self.conn = TidbConn.get_connection()
 
     def daily_report(self, account_id, start_date, end_date):
-        ReplaceAccountInfo.handler()
         try:
             sql = """
             replace into application.kuaishou_account_report_daily_dw
@@ -413,7 +412,31 @@ class AccountReport:
 
         from media_api.kuaishou_account_report_daily report
                  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
         where report.stat_date between {start_date} and {end_date}
         and report.advertiser_id={account_id}
@@ -821,7 +844,31 @@ class AccountReport:
 
         from media_api.kuaishou_account_report_hourly report
                  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
         where report.stat_date between {start_date} and {end_date}
         and  report.advertiser_id={account_id}

+ 25 - 2
Apietl/kwai_etl/report/CampaignDailyReport.py

@@ -23,7 +23,6 @@ class CampaignDailyReport:
         self.end_time = self.parm[1]
 
     def daily_report(self):
-        ReplaceAccountInfo.handler()
         try:
             sql = """select count(1) from media_api.kuaishou_campaign_report_daily where 
             stat_date between {start_time} and {end_time}""".format(
@@ -207,7 +206,31 @@ class CampaignDailyReport:
                report.event_ad_watch_times
         from media_api.kuaishou_campaign_report_daily report
                  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
         where report.stat_date between {start_time} and {end_time} order by campaign_id,stat_date limit {num},20000""". \
                     format(start_time=self.start_time, end_time=self.end_time, num=i * 20000)

+ 25 - 2
Apietl/kwai_etl/report/CampaignHourlyReport.py

@@ -23,7 +23,6 @@ class CampaignHourlyReport:
         self.end_time = self.parm[1]
 
     def hourly_report(self):
-        ReplaceAccountInfo.handler()
         try:
             sql = """select advertiser_id from media_api.kuaishou_campaign_report_hourly where 
             stat_date between {start_time} and {end_time} group by advertiser_id""".format(
@@ -205,7 +204,31 @@ class CampaignHourlyReport:
                report.event_ad_watch_times
         from media_api.kuaishou_campaign_report_hourly report
                  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
         where report.stat_date between {start_time} and {end_time} and report.advertiser_id = {account_id}""". \
                     format(start_time=self.start_time, end_time=self.end_time, account_id=account_id[0])

+ 25 - 2
Apietl/kwai_etl/report/UnitDailyReport.py

@@ -23,7 +23,6 @@ class UnitDailyReport:
         self.end_time = self.parm[1]
 
     def daily_report(self):
-        ReplaceAccountInfo.handler()
         try:
             sql = """
             select advertiser_id from media_api.kuaishou_unit_report_daily where 
@@ -208,7 +207,31 @@ class UnitDailyReport:
                report.event_ad_watch_times
         from media_api.kuaishou_unit_report_daily report
                  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
         where report.stat_date between {start_time} and {end_time}
         and report.advertiser_id={account_id}""".format(start_time=self.start_time, end_time=self.end_time, account_id=account_id[0])

+ 25 - 2
Apietl/kwai_etl/report/UnitHourlyReport.py

@@ -22,7 +22,6 @@ class UnitHourlyReport:
         self.end_time = self.parm[1]
 
     def hourly_report(self):
-        ReplaceAccountInfo.handler()
         try:
             sql = """select advertiser_id from media_api.kuaishou_unit_report_hourly where 
             stat_date between {start_time} and {end_time} group by advertiser_id""".format(
@@ -206,7 +205,31 @@ class UnitHourlyReport:
                report.event_ad_watch_times
         from media_api.kuaishou_unit_report_hourly report
                  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
         where report.stat_date between {start_time} and {end_time} and report.advertiser_id={account_id}""". \
                     format(start_time=self.start_time, end_time=self.end_time, account_id=account_id[0])