Browse Source

视频状态更新

wangyunpeng 2 weeks ago
parent
commit
ccbc1bc744

+ 2 - 2
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.java

@@ -63,9 +63,9 @@ public interface ContentPlatformPlanMapperExt {
 
     List<ContentPlatformGzhPlanVideo> getGzhPlanVideoListByCooperateAccountId(@Param("ghId") String ghId);
 
-    void updateVideoStatus(@Param("videoId") Long videoId, @Param("now") Long now);
+    void updateVideoStatus(@Param("videoId") Long videoId, @Param("status") Integer status, @Param("now") Long now);
 
-    void updateVideoAggStatus(@Param("videoId") Long videoId, @Param("now") Long now);
+    void updateVideoAggStatus(@Param("videoId") Long videoId, @Param("status") Integer status, @Param("now") Long now);
 
     List<ContentPlatformVideoAgg> getVideoAggList(@Param("dtList") List<String> dtList);
 

+ 8 - 6
api-module/src/main/java/com/tzld/piaoquan/api/job/ContentPlatformVideoJob.java

@@ -90,7 +90,7 @@ public class ContentPlatformVideoJob {
                         if (Objects.nonNull(detail)) {
                             String cover = detail.getCover().substring(0, detail.getCover().indexOf("/watermark"));
                             item.setCover(cover);
-                            if (detail.getAuditStatus() != 5 || detail.getRecommendStatus() != -6) {
+                            if (detail.getAuditStatus() != 5) {
                                 item.setStatus(0);
                             }
                         }
@@ -126,7 +126,7 @@ public class ContentPlatformVideoJob {
                     }
                     String cover = detail.getCover().substring(0, detail.getCover().indexOf("/watermark"));
                     item.setCover(cover);
-                    if (detail.getAuditStatus() != 5 || detail.getRecommendStatus() != -6) {
+                    if (detail.getAuditStatus() != 5) {
                         item.setStatus(0);
                     }
                     videoMapper.updateByPrimaryKeySelective(item);
@@ -188,10 +188,12 @@ public class ContentPlatformVideoJob {
             for (ContentPlatformVideoAgg video : partition) {
                 VideoDetail videoDetail = videoDetailMap.get(video.getVideoId());
                 if (videoDetail == null
-                        || videoDetail.getAuditStatus() != 5
-                        || videoDetail.getRecommendStatus() != -6) {
-                    planMapperExt.updateVideoStatus(video.getVideoId(), now);
-                    planMapperExt.updateVideoAggStatus(video.getVideoId(), now);
+                        || videoDetail.getAuditStatus() != 5) {
+                    planMapperExt.updateVideoStatus(video.getVideoId(), 0, now);
+                    planMapperExt.updateVideoAggStatus(video.getVideoId(), 0, now);
+                } else if (videoDetail.getRecommendStatus() == -6) {
+                    planMapperExt.updateVideoStatus(video.getVideoId(), 1, now);
+                    planMapperExt.updateVideoAggStatus(video.getVideoId(), 1, now);
                 }
             }
         }

+ 2 - 2
api-module/src/main/resources/mapper/contentplatform/ext/ContentPlatformPlanMapperExt.xml

@@ -239,14 +239,14 @@
 
     <update id="updateVideoStatus">
         update content_platform_video
-        set status = 0,
+        set status = #{status},
             update_timestamp = #{now}
         where video_id = #{videoId}
     </update>
 
     <update id="updateVideoAggStatus">
         update content_platform_video_agg
-        set status = 0,
+        set status = #{status},
             update_timestamp = #{now}
         where video_id = #{videoId}
     </update>

+ 14 - 0
api-module/src/test/java/com/tzld/piaoquan/api/ContentPlatformTest.java

@@ -1,6 +1,9 @@
 package com.tzld.piaoquan.api;
 
+import com.aliyun.openservices.shade.com.google.common.collect.Sets;
 import com.tzld.piaoquan.api.job.ContentPlatformDatastatJob;
+import com.tzld.piaoquan.growth.common.model.bo.VideoDetail;
+import com.tzld.piaoquan.growth.common.service.MessageAttachmentService;
 import com.tzld.piaoquan.growth.common.utils.DateUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.junit.jupiter.api.Test;
@@ -8,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 @SpringBootTest(classes = GrowthServerApplication.class)
 @Slf4j
@@ -15,6 +20,8 @@ public class ContentPlatformTest {
 
     @Autowired
     ContentPlatformDatastatJob datastatJob;
+    @Autowired
+    MessageAttachmentService messageAttachmentService;
 
     @Test
     public void testSyncContentPlatformQwDatastatReplyTotalJob() {
@@ -32,4 +39,11 @@ public class ContentPlatformTest {
         }
     }
 
+    @Test
+    public void testMessageAttachmentService() {
+        Set<Long> videoIds = Sets.newHashSet(56978204L);
+        Map<Long, VideoDetail> videoDetailMap = messageAttachmentService.getVideoDetail(videoIds);
+        log.info("videoDetailMap:{}", videoDetailMap);
+    }
+
 }