renyupeng 3 éve
szülő
commit
353af42470

+ 10 - 8
Apietl/bytedance_etl/Q4Task/AppBytedanceVideoReportBusi.py

@@ -21,10 +21,10 @@ class AppBytedanceVideoReportBusi:
 
     def taskHandler(self):
         try:
-            sql_porject = """select project_id from `jeecg-boot`.ctop_user_allocation where media_id=1
-group by project_id """
-            project_list = TidbConn.quary(self.conn,sql_porject)
-            for project_id in project_list:
+            sql_porject = """select account_id from `jeecg-boot`.ctop_user_allocation where media_id=1
+group by account_id """
+            account_list = TidbConn.quary(self.conn, sql_porject)
+            for account_id in account_list:
                 try:
                     sql = """SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
 REPLACE INTO application.app_bytedance_video_report_busi_{day_count}d
@@ -647,13 +647,14 @@ FROM (
                  date_sub({date_time}, INTERVAL ({day_count} -1 )  DAY),
                  '%Y%m%d'
              )
+             and advertiser_id={account_id}
          GROUP BY advertiser_id,
                   material_id,
                   image_mode,
                   inventory
      ) report
          LEFT JOIN (select advertiser_id, signature, material_id, filename, video_url
-                    from `media_api`.bytedance_file_video_get
+                    from `media_api`.bytedance_file_video_get and advertiser_id={account_id}
                     group by advertiser_id, signature, material_id, filename, video_url) video
                    ON report.account_id = video.advertiser_id AND report.material_id = video.material_id
          LEFT JOIN `jeecg-boot`.ctop_material_info cmi ON video.signature = cmi.code
@@ -678,9 +679,10 @@ FROM (
          LEFT JOIN `jeecg-boot`.sys_user shot ON shot.id = cma.shot_id
          LEFT JOIN `jeecg-boot`.sys_user plan ON plan.id = cma.plan_id
          LEFT JOIN `jeecg-boot`.sys_user leader ON leader.id = cma.leader_id
-         LEFT JOIN `jeecg-boot`.user_company up ON up.user_id = cma.clip_id;""".format(date_time=self.date_time,
-                                                                                       day_count=self.day_count,
-                                                                                       project_id=project_id[0])
+         LEFT JOIN `jeecg-boot`.user_company up ON up.user_id = cma.clip_id
+         where cua.account_id = {account_id};""".format(date_time=self.date_time,
+                                                        day_count=self.day_count,
+                                                        account_id=account_id[0])
                     TidbConn.upsert(conn=self.conn, sql_buff=sql)
                     self.conn.commit()
                 except Exception as e:

+ 10 - 8
Apietl/bytedance_etl/Q4Task/AppBytedanceVideoReportBusiMonth.py

@@ -21,10 +21,10 @@ class AppBytedanceVideoReportBusiMonth:
 
     def taskHandler(self):
         try:
-            sql_porject = """select project_id from `jeecg-boot`.ctop_user_allocation where media_id=1
-group by project_id """
-            project_list = TidbConn.quary(self.conn,sql_porject)
-            for project_id in project_list:
+            sql_porject = """select account_id from `jeecg-boot`.ctop_user_allocation where media_id=1
+group by account_id """
+            account_list = TidbConn.quary(self.conn, sql_porject)
+            for account_id in account_list:
                 try:
                     sql = """SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
 REPLACE INTO application.app_bytedance_video_report_busi_m
@@ -647,13 +647,14 @@ FROM (
                  date_sub({date_time}, INTERVAL {day_count}  DAY),
                  '%Y%m%d'
              )
+             and advertiser_id={account_id}
          GROUP BY advertiser_id,
                   material_id,
                   image_mode,
                   inventory
      ) report
          LEFT JOIN (select advertiser_id, signature, material_id, filename, video_url
-                    from `media_api`.bytedance_file_video_get
+                    from `media_api`.bytedance_file_video_get where advertiser_id={account_id}
                     group by advertiser_id, signature, material_id, filename, video_url) video
                    ON report.account_id = video.advertiser_id AND report.material_id = video.material_id
          LEFT JOIN `jeecg-boot`.ctop_material_info cmi ON video.signature = cmi.code
@@ -678,9 +679,10 @@ FROM (
          LEFT JOIN `jeecg-boot`.sys_user shot ON shot.id = cma.shot_id
          LEFT JOIN `jeecg-boot`.sys_user plan ON plan.id = cma.plan_id
          LEFT JOIN `jeecg-boot`.sys_user leader ON leader.id = cma.leader_id
-         LEFT JOIN `jeecg-boot`.user_company up ON up.user_id = cma.clip_id;""".format(date_time=self.date_time,
-                                                                                       day_count=self.day_count,
-                                                                                       project_id=project_id[0])
+         LEFT JOIN `jeecg-boot`.user_company up ON up.user_id = cma.clip_id
+         where cua.account_id = {account_id};""".format(date_time=self.date_time,
+                                                        day_count=self.day_count,
+                                                        account_id=account_id[0])
                     TidbConn.upsert(conn=self.conn, sql_buff=sql)
                     self.conn.commit()
                 except Exception as e: