Просмотр исходного кода

添加快手素材所属公司数据清洗定时任务

songyh 4 лет назад
Родитель
Сommit
0fd21381c4

+ 5 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouEtlVideoJob.java

@@ -66,4 +66,9 @@ public class KuaishouEtlVideoJob {
         Date date = DateUtils.addDay(new Date(),-1);
         materialReportDailyService.etlKuaishouReportCompanyInfo(DateUtils.formatDate(date));
     }
+
+    @XxlJob("etlKuaishouVideoReportStateDate")
+    public void etlKuaishouVideoReportStateDate(){
+        materialReportDailyService.etlKuaishouVideoReportStateDate();
+    }
 }

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaishouAccountMaterialReportDailyMapper.java

@@ -23,4 +23,6 @@ public interface EtlKuaishouAccountMaterialReportDailyMapper extends BaseMapper<
     void replace(@Param(value = "report")EtlKuaishouAccountMaterialReportDaily report);
 
     void etlKuaishouReportCompanyInfo(@Param(value = "date") String formatDate);
+
+    void etlKuaishouVideoReportStateDate();
 }

+ 10 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouAccountMaterialReportDailyMapper.xml

@@ -216,6 +216,14 @@
           and uc.company_name is not null
           and a.stat_date = :date
     </update>
+    <update id="etlKuaishouVideoReportStateDate">
+        UPDATE ctop_etl_kuaishou_video_info info
+            LEFT JOIN ( SELECT min( stat_date ) AS minDate, signature FROM ctop_kuaishou_report_daily_material GROUP BY signature ) a ON a.signature = info.video_code
+            SET info.state_date = a.minDate
+        WHERE
+            a.minDate IS NOT NULL
+          AND info.state_date IS NULL
+    </update>
     <select id="etlKuaishouAccountMaterialReportDailyList"
             resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouAccountMaterialReportDaily">
     select
@@ -224,7 +232,7 @@
     u.project_id ,
     p.project_name,
     m.account_id,
-    m.signature,
+    video.signature,
     sum(m.charge)as charge ,
     sum(m.photo_show)as photo_show ,
     sum(m.aclick)as aclick ,
@@ -250,6 +258,7 @@
     sum(m.form_count)as form_count,
      round(sum(m.play_3s_ratio*m.photo_show))as play_3s_count
     from ctop_kuaishou_report_daily_material m left join ctop_user_allocation u on u.account_id = m.account_id
+    left  join ctop_kuaishou_video_get video on video.account_id = m.account_id and m.photo_id = video.photo_id
 left join ctop_project p on p.id = u.project_id
 left join user_company c on c.user_id = u.account_id
 where 1=1

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaishouAccountMaterialReportDailyService.java

@@ -16,4 +16,6 @@ public interface IEtlKuaishouAccountMaterialReportDailyService extends IService<
     void etlKuaishouAccountMaterialReportInfo(String formatDate);
 
     void etlKuaishouReportCompanyInfo(String formatDate);
+
+    void etlKuaishouVideoReportStateDate();
 }

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouAccountMaterialReportDailyServiceImpl.java

@@ -81,4 +81,9 @@ public class EtlKuaishouAccountMaterialReportDailyServiceImpl extends ServiceImp
     public void etlKuaishouReportCompanyInfo(String formatDate) {
         etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouReportCompanyInfo(formatDate);
     }
+
+    @Override
+    public void etlKuaishouVideoReportStateDate() {
+        etlKuaishouAccountMaterialReportDailyMapper.etlKuaishouVideoReportStateDate();
+    }
 }