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

头条素材数据获取-图片新增类型 开屏 以及 满足大图竖图且满足开屏

yangzian 4 роки тому
батько
коміт
14e3f9b745

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

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

+ 6 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/BytedanceImageInfoMapper.java

@@ -16,7 +16,12 @@ public interface BytedanceImageInfoMapper extends BaseMapper<BytedanceImageInfo>
 
     void replaceBatch(@Param(value = "imageInfos")List<BytedanceImageInfo> imageInfos);
 
+    //大图竖图
     void updateImageVerticalType();
-
+    //大图横图
     void updateImageHorizonType();
+    //开屏
+    void updateImageUnionType();
+    //开屏 或者 竖图
+    void updateImageUnionIOrVerticalType();
 }

+ 18 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/mapper/xml/BytedanceImageInfoMapper.xml

@@ -35,6 +35,23 @@
         </foreach>
     </insert>
 
+    <!-- 开屏 或者 竖图 -->
+    <update id="updateImageUnionIOrVerticalType">
+        update
+            ctop_bytedance_image_info
+        set type = 4
+        where width &lt; height and (type is null or type = 3)
+          and (width between 1080 and 1440)  and (height between 1920 and 2560)
+    </update>
+    <!-- 开屏 -->
+    <update id="updateImageUnionType">
+        update
+            ctop_bytedance_image_info
+        set type = 3
+        where width &lt; height and type is null
+          and (width between 1080 and 2160)  and (height between 1920 and 3840)
+    </update>
+    <!-- 大图竖图 -->
     <update id="updateImageVerticalType">
         update
             ctop_bytedance_image_info
@@ -42,6 +59,7 @@
         where height &gt; width and type is null
         and (height between 1280 and 2560)  and (width between 720 and 1440);
     </update>
+    <!-- 大图横图 -->
     <update id="updateImageHorizonType">
         update ctop_bytedance_image_info
             set type = 1

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

@@ -14,5 +14,8 @@ import java.util.List;
 public interface IBytedanceImageInfoService extends IService<BytedanceImageInfo> {
     void replaceBatch(List<BytedanceImageInfo> videoInfoList);
 
+    /**
+     * 清洗图片素材类型
+     */
     void updateType();
 }

+ 6 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceImageInfoServiceImpl.java

@@ -27,7 +27,13 @@ public class BytedanceImageInfoServiceImpl extends ServiceImpl<BytedanceImageInf
 
     @Override
     public void updateType() {
+        //大图竖图 -2
         imageInfoMapper.updateImageVerticalType();
+        //大图横图 -1
         imageInfoMapper.updateImageHorizonType();
+        //开屏-3
+        imageInfoMapper.updateImageUnionType();
+        //开屏 或者 竖图 -4
+        imageInfoMapper.updateImageUnionIOrVerticalType();
     }
 }