فهرست منبع

视频库-更新视频关联创意数 添加channel_type字段

zhaoxian 4 سال پیش
والد
کامیت
65c443e36d

+ 3 - 3
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouVideoRelateCreativesJob.java

@@ -82,16 +82,16 @@ public class KuaishouVideoRelateCreativesJob {
         if (!Check.isNull(KuaiShouVideoGets)) {
             JSONArray dateList = new JSONArray();
             JSONArray photoIds = new JSONArray();
-            Map<String, Object> statdateMap = new HashMap<>();
+            Map<String, KuaiShouVideoGet> statdateMap = new HashMap<>();
             int count = 0;
             for (KuaiShouVideoGet video : KuaiShouVideoGets) {
                 count++;
                 if (count < 20) {
                     photoIds.add(video.getPhotoId());
-                    statdateMap.put(video.getPhotoId(), video.getStatDate());
+                    statdateMap.put(video.getPhotoId(), video);
                 } else {
                     photoIds.add(video.getPhotoId());
-                    statdateMap.put(video.getPhotoId(), video.getStatDate());
+                    statdateMap.put(video.getPhotoId(), video);
                     dateList.add(photoIds);
                     photoIds = new JSONArray();
                     count = 0;

+ 3 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouVideoRelateCreatives.java

@@ -46,6 +46,9 @@ public class KuaishouVideoRelateCreatives {
     @Excel(name = "视频id", width = 15)
     @ApiModelProperty(value = "视频id")
     private Long photoId;
+
+    private Integer channelType;
+
     private Date statDate;
     /**
      * 与此视频id关联的创意总数

+ 4 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouVideoRelateCreativesMapper.xml

@@ -7,7 +7,8 @@
         account_id,
         photo_id,
         creative_count,
-        stat_date
+        stat_date,
+        channel_type
         )
         values
         <foreach collection="videolist" item="video" separator=",">
@@ -15,7 +16,8 @@
             #{video.accountId},
             #{video.photoId},
             #{video.creativeCount},
-            #{video.statDate}
+            #{video.statDate},
+            #{video.channelType}
             )
         </foreach>
     </insert>

+ 2 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouVideoRelateCreativesService.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouVideoRelateCreatives;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -19,7 +20,7 @@ public interface IKuaishouVideoRelateCreativesService extends IService<KuaishouV
 
     Result pushVideo(JSONObject data);
 
-    void videoRelateCreatives(Long accountId, JSONArray photoIds, Map<String, Object> statdateMap);
+    void videoRelateCreatives(Long accountId, JSONArray photoIds, Map<String, KuaiShouVideoGet> statdateMap);
 
     List<JSONObject> getVideoListByMap(Map<String, Object> requestMap);
 

+ 5 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouVideoRelateCreativesServiceImpl.java

@@ -6,6 +6,7 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouVideoRelateCreatives;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouVideoRelateCreativesMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouVideoRelateCreativesService;
@@ -102,7 +103,7 @@ public class KuaishouVideoRelateCreativesServiceImpl extends ServiceImpl<Kuaisho
      * @author ZHAOXA
      */
     @Override
-    public void videoRelateCreatives(Long accountId, JSONArray photoIds, Map<String, Object> statdateMap) {
+    public void videoRelateCreatives(Long accountId, JSONArray photoIds, Map<String, KuaiShouVideoGet> statdateMap) {
         try {
             CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
             for (int i = 0; i < photoIds.size(); i++) {
@@ -128,7 +129,9 @@ public class KuaishouVideoRelateCreativesServiceImpl extends ServiceImpl<Kuaisho
                                 k.setAccountId(accountId);
                                 k.setPhotoId(object.getLong("photo_id"));
                                 k.setCreativeCount(object.getInteger("creative_count"));
-                                k.setStatDate((Date) statdateMap.get(object.getString("photo_id")));
+                                KuaiShouVideoGet shouVideoGet = statdateMap.get(object.getString("photo_id"));
+                                k.setStatDate(shouVideoGet.getStatDate());
+                                k.setChannelType(shouVideoGet.getChannelType());
                                 videolist.add(k);
                             }
                             kuaishouVideoRelateCreativesMapper.insertBatch(videolist);