|
|
@@ -13,15 +13,9 @@ import cn.reghao.tnb.content.api.constant.VideoStatus;
|
|
|
import cn.reghao.tnb.content.api.dto.UserVideoPost;
|
|
|
import cn.reghao.tnb.content.api.dto.VideoCard;
|
|
|
import cn.reghao.tnb.content.api.dto.VideoPostCard;
|
|
|
-import cn.reghao.tnb.content.app.vod.db.mapper.VideoCategoryPostMapper;
|
|
|
-import cn.reghao.tnb.content.app.vod.db.mapper.VideoPostMapper;
|
|
|
-import cn.reghao.tnb.content.app.vod.db.mapper.VideoStatisticMapper;
|
|
|
-import cn.reghao.tnb.content.app.vod.db.mapper.VideoTagMapper;
|
|
|
+import cn.reghao.tnb.content.app.vod.db.mapper.*;
|
|
|
import cn.reghao.tnb.content.app.vod.db.repository.VideoRepository;
|
|
|
-import cn.reghao.tnb.content.app.vod.model.po.VideoCategory;
|
|
|
-import cn.reghao.tnb.content.app.vod.model.po.VideoPost;
|
|
|
-import cn.reghao.tnb.content.app.vod.model.po.VideoCategoryPost;
|
|
|
-import cn.reghao.tnb.content.app.vod.model.po.VideoStatistic;
|
|
|
+import cn.reghao.tnb.content.app.vod.model.po.*;
|
|
|
import cn.reghao.tnb.content.api.dto.BannerVideo;
|
|
|
import cn.reghao.tnb.content.app.vod.model.vo.VideoDetail;
|
|
|
import cn.reghao.tnb.content.app.vod.model.query.VideoQuery;
|
|
|
@@ -57,15 +51,17 @@ public class VideoPostQueryImpl implements VideoPostQuery {
|
|
|
private final VideoStatisticMapper videoStatisticMapper;
|
|
|
private final VideoCategoryPostMapper videoCategoryPostMapper;
|
|
|
private final VideoTagMapper videoTagMapper;
|
|
|
+ private final VideoPostTagMapper videoPostTagMapper;
|
|
|
private final ContentPermission contentPermission;
|
|
|
private final CategoryService categoryService;
|
|
|
private final VideoRepository videoRepository;
|
|
|
private final Random random = new SecureRandom();
|
|
|
- private IDObfuscation userIdObfuscation;
|
|
|
+ private final IDObfuscation userIdObfuscation;
|
|
|
|
|
|
public VideoPostQueryImpl(VideoPostMapper videoPostMapper, VideoTagMapper videoTagMapper,
|
|
|
VideoStatisticMapper videoStatisticMapper, VideoCategoryPostMapper videoCategoryPostMapper,
|
|
|
- ContentPermission contentPermission, CategoryService categoryService, VideoRepository videoRepository) {
|
|
|
+ ContentPermission contentPermission, CategoryService categoryService,
|
|
|
+ VideoRepository videoRepository, VideoPostTagMapper videoPostTagMapper) {
|
|
|
this.videoPostMapper = videoPostMapper;
|
|
|
this.videoTagMapper = videoTagMapper;
|
|
|
this.videoStatisticMapper = videoStatisticMapper;
|
|
|
@@ -74,6 +70,7 @@ public class VideoPostQueryImpl implements VideoPostQuery {
|
|
|
this.categoryService = categoryService;
|
|
|
this.videoRepository = videoRepository;
|
|
|
this.userIdObfuscation = new IDObfuscation(0x12345);
|
|
|
+ this.videoPostTagMapper = videoPostTagMapper;
|
|
|
}
|
|
|
|
|
|
public List<VideoCard> getVideoCards(List<String> videoIds) {
|
|
|
@@ -166,6 +163,25 @@ public class VideoPostQueryImpl implements VideoPostQuery {
|
|
|
return PageList.pageList(pageNumber, pageSize, total, list1);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public PageList<VideoCard> getTagVideos(String tag, int pn) {
|
|
|
+ VideoTag videoTag = videoTagMapper.findByName(tag);
|
|
|
+ if (videoTag == null) {
|
|
|
+ return PageList.empty();
|
|
|
+ }
|
|
|
+
|
|
|
+ String tagId = videoTag.getTagId();
|
|
|
+ int total = videoPostTagMapper.countVideosByTag(tagId);
|
|
|
+ Page page = new Page(pn, pageSize);
|
|
|
+ List<String> videoIds = videoPostTagMapper.findVideosByPage(page, tagId);
|
|
|
+ List<VideoPostCard> list = videoPostMapper.findVideoCardByVideoIds(videoIds);
|
|
|
+ List<VideoCard> list1 = list.stream()
|
|
|
+ .map(videoPostCard -> getVideoCard(videoPostCard, true))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return PageList.pageList(pn, pageSize, total, list1);
|
|
|
+ }
|
|
|
+
|
|
|
public PageList<VideoCard> getUserVideos(long userId, int page) {
|
|
|
VideoQuery videoQuery;
|
|
|
long loginUser = UserContext.getUser();
|