Переглянути джерело

修改头条的素材类型清洗任务

songyh 3 роки тому
батько
коміт
c920dfa5a7

+ 0 - 2
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceMaterialsLoadJob.java

@@ -57,8 +57,6 @@ public class BytedanceMaterialsLoadJob {
         } catch (InterruptedException e) {
         } catch (InterruptedException e) {
             e.printStackTrace();
             e.printStackTrace();
         }
         }
-        //修改视频类型
-        videoInfoService.updateMaterialType();
         //修改图片类型
         //修改图片类型
         imageInfoService.updateType();
         imageInfoService.updateType();
         XxlJobHelper.log("物料数据同步完成");
         XxlJobHelper.log("物料数据同步完成");

+ 7 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceVideoInfo.java

@@ -111,6 +111,13 @@ public class ByteDanceVideoInfo {
         this.updateTime = now;
         this.updateTime = now;
         this.materialUploadTime = data.getDate("create_time");
         this.materialUploadTime = data.getDate("create_time");
         this.filename = data.getString("filename");
         this.filename = data.getString("filename");
+        if(this.height>this.width && this.height>=1280 &&this.height<=2560 &&this.width>=720&&this.width<=1440){
+            this.type = 2;
+        }else if(this.height<this.width && this.width>=1280 &&this.width<=2560 &&this.height>=720&&this.height<=1440){
+            this.type = 1;
+        }else {
+            this.type = 0;
+        }
     }
     }
 
 
     public ByteDanceVideoInfo() {
     public ByteDanceVideoInfo() {

+ 0 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/ByteDanceVideoInfoMapper.java

@@ -15,7 +15,4 @@ import java.util.List;
 public interface ByteDanceVideoInfoMapper extends BaseMapper<ByteDanceVideoInfo> {
 public interface ByteDanceVideoInfoMapper extends BaseMapper<ByteDanceVideoInfo> {
 
 
     void replaceBatch(@Param(value = "videoList") List<ByteDanceVideoInfo> videoInfoList);
     void replaceBatch(@Param(value = "videoList") List<ByteDanceVideoInfo> videoInfoList);
-
-    void updateVideoVerticalType();
-    void updateVideoHorizonType();
 }
 }

+ 4 - 15
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/ByteDanceVideoInfoMapper.xml

@@ -24,7 +24,8 @@
         status,
         status,
         create_time,
         create_time,
         update_time,
         update_time,
-        signature)
+        signature,
+        type )
         values
         values
         <foreach collection="videoList" item="video" separator=",">
         <foreach collection="videoList" item="video" separator=",">
             (
             (
@@ -49,21 +50,9 @@
             #{video.status},
             #{video.status},
             #{video.createTime},
             #{video.createTime},
             #{video.updateTime},
             #{video.updateTime},
-            #{video.signature}
+            #{video.signature},
+            #{video.type}
             )
             )
         </foreach>
         </foreach>
     </insert>
     </insert>
-    <update id="updateVideoVerticalType">
-        update
-            ctop_bytedance_video_info
-        set type = 2
-        where height &gt; width
-        and (height between 1280 and 2560)  and (width between 720 and 1440)
-    </update>
-    <update id="updateVideoHorizonType">
-        update ctop_bytedance_video_info
-            set type = 1
-        where height &lt; width
-        and (width between 1280 and 2560)  and (height between 720 and 1440)
-    </update>
 </mapper>
 </mapper>

+ 0 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IByteDanceVideoInfoService.java

@@ -16,6 +16,4 @@ public interface IByteDanceVideoInfoService extends IService<ByteDanceVideoInfo>
     void replaceBatch(List<ByteDanceVideoInfo> videoInfoList);
     void replaceBatch(List<ByteDanceVideoInfo> videoInfoList);
 
 
     ByteDanceVideoInfo getOneByParams(Long materialId);
     ByteDanceVideoInfo getOneByParams(Long materialId);
-
-    void updateMaterialType();
 }
 }

+ 2 - 8
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceVideoInfoServiceImpl.java

@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Primary;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import javax.annotation.Resource;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -18,9 +19,8 @@ import java.util.List;
  * @Version: V1.0
  * @Version: V1.0
  */
  */
 @Service
 @Service
-@Primary
 public class ByteDanceVideoInfoServiceImpl extends ServiceImpl<ByteDanceVideoInfoMapper, ByteDanceVideoInfo> implements IByteDanceVideoInfoService {
 public class ByteDanceVideoInfoServiceImpl extends ServiceImpl<ByteDanceVideoInfoMapper, ByteDanceVideoInfo> implements IByteDanceVideoInfoService {
-    @Autowired
+    @Resource
     private ByteDanceVideoInfoMapper videoInfoMapper;
     private ByteDanceVideoInfoMapper videoInfoMapper;
 
 
     @Override
     @Override
@@ -35,10 +35,4 @@ public class ByteDanceVideoInfoServiceImpl extends ServiceImpl<ByteDanceVideoInf
         queryWrapper.last("limit 1");
         queryWrapper.last("limit 1");
         return this.getOne(queryWrapper);
         return this.getOne(queryWrapper);
     }
     }
-
-    @Override
-    public void updateMaterialType() {
-        videoInfoMapper.updateVideoVerticalType();
-        videoInfoMapper.updateVideoHorizonType();
-    }
 }
 }