浏览代码

修改头条视频图片类别字段更新sql

syh 4 年之前
父节点
当前提交
8e5d6afd45

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

@@ -3,6 +3,8 @@ package cn.com.ctop.job.bytedance.handler;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceVideoInfoService;
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceImageInfoService;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,6 +24,10 @@ public class BytedanceMaterialsLoadJob {
     static CountDownLatch countDownLatch = null;
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
+    @Autowired
+    private IByteDanceVideoInfoService videoInfoService;
+    @Autowired
+    private IBytedanceImageInfoService imageInfoService;
 
     @XxlJob("bytedanceMaterialsLoadJob")
     public void execute() throws Exception{
@@ -47,6 +53,8 @@ public class BytedanceMaterialsLoadJob {
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
+        videoInfoService.updateMaterialType();
+        imageInfoService.updateType();
         XxlJobHelper.log("物料数据同步完成");
     }
 }

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

@@ -37,13 +37,13 @@
         update
             ctop_bytedance_image_info
         set type = 2
-        where height > width
+        where height > 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
-        where height &lt; width
+        where height &lt; width and type is null
         and (width between 1280 and 2560)  and (height between 720 and 1440)
     </update>
 </mapper>

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

@@ -639,8 +639,6 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     public void getMaterialList(CtopOauthToken token) {
         getVideoByPage(token, "", 1);
         getImageByPage(token, "", 1);
-        videoInfoService.updateMaterialType();
-        imageInfoService.updateType();
     }
 
     @Autowired