renyupeng 2 rokov pred
rodič
commit
a97498c9ae

+ 32 - 10
OuterDataCompareInnerData/MonitorApp/MonitorAppTask.py

@@ -61,17 +61,39 @@ class MonitorAppTask:
                             feishuMsg.send_robot_msg(
                                 """{stat_date}日 {table} 数据为0""".format(stat_date=self.stat_date, table=table))
                         elif InnertotalNum != OutertotalNum:
-                            feishuMsg.send_robot_msg(
-                                """{stat_date}日 {table} 内网数量为{InnertotalNum},外网数量为{OutertotalNum} 数据不相等 datax
-                                 数据同步启动""".format(
-                                    stat_date=self.stat_date,
-                                    table=table,
-                                    InnertotalNum=InnertotalNum,
-                                    OutertotalNum=OutertotalNum))
+                            if table == 'kuaishou_material_video_report_daily_dw':
+                                sql = """select account_id,photo_id from 
+                                application.{table} where stat_date={stat_date} """.format(
+                                    table=table, stat_date=self.stat_date)
+                                InnertotalItem = TidbConn.quary(self.InnerConn, sql)
+                                OutertotalItem = TidbConn.quary(self.OuterConn, sql)
+                                set1 = set(InnertotalItem)
+                                set2 = set(OutertotalItem)
+                                diff_set = set1 - set2
+                                account_list = []
+                                for diff in diff_set:
+                                    account_id = diff[0]
+                                    account_list.append(account_id)
+                                acc_list = tuple(account_list)
+                                acclist = ','.join(str(i) for i in acc_list)
+                                datax_json = SchedulerList.SchedulerList(table)
+                                os.system(
+                                    'sh /data/datax/application/push_pro1.sh {stat_date} {table} {acclist} {datax_json}'.format(
+                                        stat_date=self.stat_date, table=table, acclist=acclist, datax_json=datax_json))
 
-                            datax_json = SchedulerList.SchedulerList(table)
-                            os.system('sh /data/datax/application/push_pro.sh {stat_date} {table} {datax_json}'.format(
-                                stat_date=self.stat_date, table=table, datax_json=datax_json))
+                            else:
+                                feishuMsg.send_robot_msg(
+                                    """{stat_date}日 {table} 内网数量为{InnertotalNum},外网数量为{OutertotalNum} 数据不相等 datax
+                                     数据同步启动""".format(
+                                        stat_date=self.stat_date,
+                                        table=table,
+                                        InnertotalNum=InnertotalNum,
+                                        OutertotalNum=OutertotalNum))
+
+                                datax_json = SchedulerList.SchedulerList(table)
+                                os.system(
+                                    'sh /data/datax/application/push_pro.sh {stat_date} {table} {datax_json}'.format(
+                                        stat_date=self.stat_date, table=table, datax_json=datax_json))
                         else:
                             feishuMsg.send_robot_msg(
                                 """{stat_date}日 {table} 内网数量为{InnertotalNum},外网数量为{OutertotalNum} 数据相等 """.format(

+ 1 - 1
OuterDataCompareInnerData/Utils/SchedulerList.py

@@ -19,7 +19,7 @@ class SchedulerList:
                                "bytedance_campaign_report_daily_dw":"bytedance_campaign",
                                "kuaishou_account_report_daily_dw": "account",
                                "kuaishou_campaign_report_daily_dw": "campaign",
-                               "kuaishou_material_video_report_daily_dw": "video",
+                               "kuaishou_material_video_report_daily_dw": "videos",
                                "kuaishou_unit_report_daily_dw": "unit"}
 
         self.Live_Scheduler_List = {