yumeng vor 3 Jahren
Ursprung
Commit
16982e3348

+ 6 - 1
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceEtlVideoJob.java

@@ -80,7 +80,9 @@ public class BytedanceEtlVideoJob {
      */
     @XxlJob("etlBytedanceVideoClipInfoJob")
     public void etlBytedanceVideoClipInfoJob() throws Exception {
-        etlReportBytedanceVideoService.etlBytedanceVideoClipIdJob();
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String date = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -2);
+        etlReportBytedanceVideoService.etlBytedanceVideoClipIdJob(date);
     }
 
     /**
@@ -89,9 +91,12 @@ public class BytedanceEtlVideoJob {
      */
     @XxlJob("etlBytedanceVideoPlanInfoJob")
     public void etlBytedanceVideoPlanInfoJob() throws Exception {
+
         etlReportBytedanceVideoService.etlBytedanceVideoPlanInfoJob();
     }
 
+
+
     /**
      * 清洗头条拍摄
      * @throws Exception

+ 3 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/mapper/ETLReportBytedanceVideoMapper.java

@@ -35,7 +35,7 @@ public interface ETLReportBytedanceVideoMapper extends BaseMapper<ETLReportByted
 
     void deleteDuplicateVideoInfo(@Param("video")ETLReportBytedanceVideo video);
 
-    List<ETLReportBytedanceVideo> getBytedanceVideoClipInfo();
+    List<ETLReportBytedanceVideo> getBytedanceVideoClipInfo(@Param("date") String date);
     List<ETLReportBytedanceVideo> getBytedanceVideoShotInfo();
     List<ETLReportBytedanceVideo> getBytedanceVideoPlanInfo();
 
@@ -43,6 +43,6 @@ public interface ETLReportBytedanceVideoMapper extends BaseMapper<ETLReportByted
     void updateShotInfo(@Param("shotId")String shotId, @Param("shotName")String shotName, @Param("md5")String md5);
     void updatePlanInfo(@Param("planId")String planId, @Param("planName")String planName, @Param("md5")String md5);
 
-    void updateTeamLeader();
-    void updateDesignTeamLeader();
+    void updateTeamLeader(@Param("date") String date);
+    void updateDesignTeamLeader(@Param("date") String date);
 }

+ 24 - 16
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/mapper/xml/ETLReportBytedanceVideoMapper.xml

@@ -211,17 +211,24 @@
         update etl_report_bytedance_video set plan_id=#{planId},plan_name=#{planName} where md5=#{md5}
     </update>
     <update id="updateDesignTeamLeader">
-        update etl_report_bytedance_video video left join ctop_material_ascription su on video.clip_id = su.clip_id
-            set video.team_leader = su.leader_name
-        where video.clip_id is not null
-            and video.team_leader is null
-            and su.leader_name is not null
-            and su.leader_name != ''
+ UPDATE etl_report_bytedance_video t1
+SET t1.team_leader = (
+	SELECT
+		leader_name
+	FROM
+		ctop_material_ascription
+	WHERE
+		material_id = t1.md5
+limit 1
+) WHERE t1.stat_datetime &gt;= #{date}
+AND t1.team_leader is  not NULL
+AND t1.team_leader != '';
     </update>
     <update id="updateTeamLeader">
         update etl_report_bytedance_video video left join sys_user su on video.clip_id = su.id
             set video.team_leader = su.leader_name
-        where video.clip_id is not null
+        where video.stat_datetime &gt;= #{date}
+            and video.clip_id is not null
             and su.leader_name is not null
             and video.team_leader is null
             and su.leader_name != ''
@@ -234,7 +241,7 @@
           and stat_datetime = #{video.statDatetime}
           and account_id = #{video.accountId} and id!=#{video.id};
     </delete>
-    <select id="queryVideoInfoByMaterialId"  resultType="com.alibaba.fastjson.JSONObject">
+    <select id="queryVideoInfoByMaterialId" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
             signature AS md5,
             video_url AS url
@@ -244,7 +251,7 @@
             material_id = #{materialId}
         limit 1
     </select>
-    <select id="queryMaterialVideoByMd5"  resultType="com.alibaba.fastjson.JSONObject">
+    <select id="queryMaterialVideoByMd5" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
             `name`  as materialName,
             url,
@@ -256,7 +263,7 @@
             md5 = #{md5}
         LIMIT 1
     </select>
-    <select id="queryMaterialVideoByMd5Old"  resultType="com.alibaba.fastjson.JSONObject">
+    <select id="queryMaterialVideoByMd5Old" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
             material_name as materialName,
             url,
@@ -268,7 +275,7 @@
             code = #{md5}
         LIMIT 1
     </select>
-    <select id="queryRelatePersonByMd5"  resultType="com.alibaba.fastjson.JSONObject">
+    <select id="queryRelatePersonByMd5" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
             clip_id clipId,
             clip_name clipaname,
@@ -282,7 +289,7 @@
             video_md5 = #{md5}
         LIMIT 1
     </select>
-    <select id="queryRelatePersonByMd5Old"  resultType="com.alibaba.fastjson.JSONObject">
+    <select id="queryRelatePersonByMd5Old" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
             clip_id clipId,
             (select realname from sys_user where id=clip_id) as clipName,
@@ -296,7 +303,7 @@
             code = #{md5}
         LIMIT 1
     </select>
-    <select id="queryAccountDetailByAccountId"  resultType="com.alibaba.fastjson.JSONObject">
+    <select id="queryAccountDetailByAccountId" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
             t1.advertiser_id as advertiserId,
             (SELECT `name` from ctop_advertiser where id=t1.advertiser_id limit 1) as advertiserName,
@@ -310,7 +317,7 @@
         LIMIT 1
     </select>
 
-    <select id="queryETLData"  resultType="cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo">
+    <select id="queryETLData" resultType="cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo">
         SELECT
             t1.*,
             t3.clip_id clipId,
@@ -355,10 +362,11 @@
             etl_report_bytedance_video video
                 LEFT JOIN ctop_material_ascription cmi ON video.md5 = cmi.
                 CODE LEFT JOIN sys_user u ON u.id = cmi.clip_id
-        WHERE
-            cmi.clip_id IS NOT NULL
+        WHERE video.stat_datetime &gt;= #{date}
+           and cmi.clip_id IS NOT NULL
           AND video.clip_id = ''
           AND u.realname IS NOT NULL
+
     </select>
     <select id="getBytedanceVideoShotInfo"
             resultType="cn.com.ctop.toutiao.modules.link.entity.ETLReportBytedanceVideo">

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/service/IETLReportBytedanceVideoService.java

@@ -17,7 +17,7 @@ public interface IETLReportBytedanceVideoService extends IService<ETLReportByted
 
     void cleanData(String data);
 
-    void etlBytedanceVideoClipIdJob();
+    void etlBytedanceVideoClipIdJob(String date);
 
     void etlBytedanceVideoPlanInfoJob();
 

+ 4 - 4
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/link/service/impl/ETLReportBytedanceVideoServiceImpl.java

@@ -62,15 +62,15 @@ public class ETLReportBytedanceVideoServiceImpl extends ServiceImpl<ETLReportByt
     }
 
     @Override
-    public void etlBytedanceVideoClipIdJob() {
-        List <ETLReportBytedanceVideo> clipInfos = etlReportBytedanceVideoMapper.getBytedanceVideoClipInfo();
+    public void etlBytedanceVideoClipIdJob(String date) {
+        List <ETLReportBytedanceVideo> clipInfos = etlReportBytedanceVideoMapper.getBytedanceVideoClipInfo(date);
         if(null!=clipInfos&&!clipInfos.isEmpty()){
             clipInfos.forEach(clipInfo->{
                 etlReportBytedanceVideoMapper.updateClipInfo(clipInfo.getClipId(),clipInfo.getClipName(),clipInfo.getMd5());
             });
         }
-        etlReportBytedanceVideoMapper.updateDesignTeamLeader();
-        etlReportBytedanceVideoMapper.updateTeamLeader();
+        etlReportBytedanceVideoMapper.updateDesignTeamLeader(date);
+        etlReportBytedanceVideoMapper.updateTeamLeader(date);
     }
 
     @Override