瀏覽代碼

收藏列表增加状态

wangyunpeng 1 周之前
父節點
當前提交
d85fa523c0

+ 4 - 1
api-module/src/main/java/com/tzld/piaoquan/api/model/vo/contentplatform/CollectVideoContentItemVO.java

@@ -35,6 +35,9 @@ public class CollectVideoContentItemVO {
     @ApiModelProperty(value = "标签")
     private List<Integer> tags;
 
-    @ApiModelProperty(value = "收藏视频状态 0-已删除,1-正常")
+    @ApiModelProperty(value = "收藏视频状态 0-未收藏,1-已收藏")
+    private Integer collect = 0;
+
+    @ApiModelProperty(value = "收藏视频状态 0-已下架,1-正常")
     private Integer status = 1;
 }

+ 6 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/vo/contentplatform/VideoContentItemVO.java

@@ -34,4 +34,10 @@ public class VideoContentItemVO {
 
     @ApiModelProperty(value = "标签")
     private List<Integer> tags;
+
+    @ApiModelProperty(value = "收藏视频状态 0-未收藏,1-已收藏")
+    private Integer collect = 0;
+
+    @ApiModelProperty(value = "收藏视频状态 0-已下架,1-正常")
+    private Integer status = 1;
 }

+ 5 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformCollectContentService.java

@@ -2,9 +2,12 @@ package com.tzld.piaoquan.api.service.contentplatform;
 
 import com.tzld.piaoquan.api.model.param.contentplatform.CollectContentListParam;
 import com.tzld.piaoquan.api.model.param.contentplatform.CollectContentSaveParam;
+import com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformVideoCollect;
 import com.tzld.piaoquan.api.model.vo.contentplatform.CollectVideoContentItemVO;
 import com.tzld.piaoquan.growth.common.utils.page.Page;
 
+import java.util.List;
+
 public interface ContentPlatformCollectContentService {
 
     void collectContent(CollectContentSaveParam param);
@@ -12,4 +15,6 @@ public interface ContentPlatformCollectContentService {
     Page<CollectVideoContentItemVO> collectContentList(CollectContentListParam param);
 
     void clearInvalid();
+
+    List<ContentPlatformVideoCollect> getCollectVideoList(Long id, List<Long> videoIds);
 }

+ 8 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformCollectContentServiceImpl.java

@@ -155,6 +155,7 @@ public class ContentPlatformCollectContentServiceImpl implements ContentPlatform
             CollectVideoContentItemVO item = new CollectVideoContentItemVO();
             result.add(item);
             item.setVideoId(videoId);
+            item.setCollect(1);
             ContentPlatformVideoAgg video = videoAggMap.get(videoId);
             if (Objects.isNull(video)) {
                 item.setStatus(0);
@@ -199,4 +200,11 @@ public class ContentPlatformCollectContentServiceImpl implements ContentPlatform
         }
     }
 
+    @Override
+    public List<ContentPlatformVideoCollect> getCollectVideoList(Long id, List<Long> videoIds) {
+        ContentPlatformVideoCollectExample example = new ContentPlatformVideoCollectExample();
+        example.createCriteria().andCreateAccountIdEqualTo(id).andVideoIdIn(videoIds);
+        return videoCollectMapper.selectByExample(example);
+    }
+
 }

+ 10 - 0
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java

@@ -93,6 +93,8 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
     private CgiReplyService cgiReplyService;
     @Autowired
     private TouLiuHttpClient touLiuHttpClient;
+    @Autowired
+    ContentPlatformCollectContentService collectService;
 
 
     @Value("${vlog.share.appType:11}")
@@ -636,6 +638,10 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         List<ContentPlatformVideoTag> videoTagList = planMapperExt.getVideoTagList(dt, videoIds, user.getId(), type, userChannel);
         Map<Long, List<ContentPlatformVideoTag>> videoTagMap = videoTagList.stream()
                 .collect(Collectors.groupingBy(ContentPlatformVideoTag::getVideoId));
+        // collect
+        List<ContentPlatformVideoCollect> collectVideoList = collectService.getCollectVideoList(user.getId(), videoIds);
+        Map<Long, ContentPlatformVideoCollect> collectVideoMap = collectVideoList.stream()
+                .collect(Collectors.toMap(ContentPlatformVideoCollect::getVideoId, o -> o));
         List<VideoContentItemVO> result = new ArrayList<>();
         for (ContentPlatformVideo video : videoList) {
             VideoContentItemVO item = new VideoContentItemVO();
@@ -664,6 +670,10 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
                 }
                 item.setTags(tags);
             }
+            if (collectVideoMap.containsKey(video.getVideoId())) {
+                item.setCollect(1);
+            }
+            item.setStatus(1);
             result.add(item);
         }
         return result;