Pārlūkot izejas kodu

头条-图片类型

yangzian 3 gadi atpakaļ
vecāks
revīzija
7c045ee3c1

+ 3 - 1
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceMaterialsLoadJob.java

@@ -52,13 +52,15 @@ public class BytedanceMaterialsLoadJob {
                 }
             });
         });
+        //修改图片类型
+        imageInfoService.updateType(null);
         try {
             countDownLatch.await();
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
         //修改图片类型
-        imageInfoService.updateType();
+        //imageInfoService.updateType();
         XxlJobHelper.log("物料数据同步完成");
     }
 }

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

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

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

@@ -49,7 +49,11 @@
             ctop_bytedance_image_info
         set type = 3
         where width &lt; height and type is null or type = 2
-            and width = 1080 and height = 1920
+        and width = 1080 and height = 1920
+        <if test="projectId !=null and projectId != ''">
+            and account_id = #{accountId}
+        </if>
+
     </update>
     <!-- 大图竖图 -->
     <update id="updateImageVerticalType">
@@ -57,7 +61,10 @@
             ctop_bytedance_image_info
         set type = 2
         where height &gt; width and type is null
-        and (height between 1280 and 2560)  and (width between 720 and 1440);
+        and (height between 1280 and 2560)  and (width between 720 and 1440)
+        <if test="projectId !=null and projectId != ''">
+            and account_id = #{accountId}
+        </if>
     </update>
     <!-- 大图横图 -->
     <update id="updateImageHorizonType">
@@ -65,5 +72,8 @@
             set type = 1
         where height &lt; width and type is null
         and (width between 1280 and 2560)  and (height between 720 and 1440)
+        <if test="projectId !=null and projectId != ''">
+            and account_id = #{accountId}
+        </if>
     </update>
 </mapper>

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

@@ -17,5 +17,5 @@ public interface IBytedanceImageInfoService extends IService<BytedanceImageInfo>
     /**
      * 清洗图片素材类型
      */
-    void updateType();
+    void updateType(Long accountId);
 }

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

@@ -4,6 +4,7 @@ import cn.com.ctop.toutiao.modules.material.entity.BytedanceImageInfo;
 import cn.com.ctop.toutiao.modules.material.mapper.BytedanceImageInfoMapper;
 import cn.com.ctop.toutiao.modules.material.service.IBytedanceImageInfoService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -17,6 +18,7 @@ import java.util.List;
  * @version V1.0
  */
 @Service
+@Slf4j
 public class BytedanceImageInfoServiceImpl extends ServiceImpl<BytedanceImageInfoMapper, BytedanceImageInfo> implements IBytedanceImageInfoService {
     @Resource
     private BytedanceImageInfoMapper imageInfoMapper;
@@ -26,13 +28,14 @@ public class BytedanceImageInfoServiceImpl extends ServiceImpl<BytedanceImageInf
     }
 
     @Override
-    public void updateType() {
+    public void updateType(Long accountId) {
         //大图竖图 -2
-        imageInfoMapper.updateImageVerticalType();
+        imageInfoMapper.updateImageVerticalType(accountId);
         //大图横图 -1
-        imageInfoMapper.updateImageHorizonType();
+        imageInfoMapper.updateImageHorizonType(accountId);
         //开屏-3
-        imageInfoMapper.updateImageUnionType();
+        imageInfoMapper.updateImageUnionType(accountId);
+        log.info("清洗图片类型成功=====>>>>>accountId:{}",accountId);
         //开屏 或者 竖图 -4
         //imageInfoMapper.updateImageUnionIOrVerticalType();
     }