From 95f8eda23ff06243e68d33769c5e68f6f6de2c4b Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 03 六月 2025 16:40:57 +0800
Subject: [PATCH] 视频主页部分接口
---
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 50 insertions(+), 1 deletions(-)
diff --git a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
index 8834a3f..e712108 100644
--- a/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
+++ b/framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
@@ -6,6 +6,7 @@
import cn.lili.modules.lmk.domain.entity.VideoTag;
import cn.lili.modules.lmk.domain.entity.VideoTagRef;
import cn.lili.modules.lmk.domain.form.*;
+import cn.lili.modules.lmk.domain.query.AuthorVideoQuery;
import cn.lili.modules.lmk.domain.query.ManagerVideoQuery;
import cn.lili.modules.lmk.domain.vo.*;
import cn.lili.modules.lmk.enums.general.TagCreateTypeEnum;
@@ -153,6 +154,7 @@
Video video = VideoForm.getEntityByForm(form, null);
video.setAuthorId(UserContext.getCurrentUserId());
video.setStatus(VideoStatusEnum.AUDITING.getValue());
+ video.setCoverUrl(form.getCover());
baseMapper.insert(video);
// 2.澶勭悊鏍囩
List<VideoTagRef> videoTagRefs = form.getTags().stream().map(tag -> {
@@ -196,7 +198,7 @@
// 3. 鑾峰彇瑙嗛涓存椂璁块棶鍦板潃銆佽缃棰戞爣绛�
page.getRecords().forEach(v -> {
v.setTagList(tagMap.get(v.getId()));
-// v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey()));
+ v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverUrl()));
});
}
return Result.ok().data(page.getRecords()).total(page.getTotal());
@@ -295,6 +297,16 @@
}
@Override
+ @Transactional(rollbackFor = Exception.class)
+ public void updateCommentNumBatch(List<CollectTypeNumVO> numList) {
+ // 鎸�500鏉℃暟鎹繘琛屾媶鍒�
+ List<List<CollectTypeNumVO>> chunks = ListUtils.partition(numList, 500);
+ for (List<CollectTypeNumVO> chunk : chunks) {
+ baseMapper.updateCommentNumBatch(chunk);
+ }
+ }
+
+ @Override
public Result saveViewRecord(VideoFootPrintForm form) {
FootPrint footPrint = new FootPrint();
footPrint.setViewType(ViewTypeEnum.VIDEO.getValue());
@@ -305,4 +317,41 @@
footprintService.saveFootprint(footPrint);
return Result.ok();
}
+
+ @Override
+ public Result getAuthorInfo(String authorId) {
+ VideoAccountVO vo = baseMapper.getAuthorInfo(authorId, UserContext.getCurrentUserId());
+ vo.setSelf(authorId.equals(UserContext.getCurrentUserId()));
+ // 鏌ヨ鑾疯禐鏁�
+ List<String> videoIds = baseMapper.getVideoIdsByAuthor(authorId);
+ if (CollectionUtils.isNotEmpty(videoIds)) {
+ vo.setLikeNum(baseMapper.countAuthorVideoCollectNum(videoIds));
+ } else {
+ vo.setLikeNum(0L);
+ }
+ return Result.ok().data(vo);
+ }
+
+ @Override
+ public Result getAuthorVideoPage(AuthorVideoQuery query) {
+ IPage<WxVideoVO> page = PageUtil.getPage(query, WxVideoVO.class);
+ baseMapper.getAuthorVideoPage(page, query);
+ for (WxVideoVO vo : page.getRecords()) {
+ vo.setCoverUrl(cosUtil.getPreviewUrl(vo.getCoverUrl()));
+ vo.setVideoUrl(cosUtil.getPreviewUrl(vo.getVideoUrl()));
+ }
+ return Result.ok().data(page.getRecords()).total(page.getTotal());
+ }
+
+ @Override
+ public Result getAuthorCollectVideoPage(AuthorVideoQuery query) {
+ IPage<WxVideoVO> page = PageUtil.getPage(query, WxVideoVO.class);
+ baseMapper.getAuthorCollectVideoPage(page, query);
+ for (WxVideoVO vo : page.getRecords()) {
+ vo.setCoverUrl(cosUtil.getPreviewUrl(vo.getCoverUrl()));
+ vo.setVideoUrl(cosUtil.getPreviewUrl(vo.getVideoUrl()));
+ vo.setCollected(Boolean.TRUE);
+ }
+ return Result.ok().data(page.getRecords()).total(page.getTotal());
+ }
}
--
Gitblit v1.8.0