xiangpei
2025-07-01 54c9594e75f551702a6734c47c3d190e195564cd
视频主页-点赞视频
6个文件已修改
177 ■■■■■ 已修改文件
buyer-api/src/main/java/cn/lili/controller/lmk/VideoController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/domain/query/VideoQuery.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java 117 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/resources/mapper/lmk/VideoMapper.xml 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
buyer-api/src/main/java/cn/lili/controller/lmk/VideoController.java
@@ -119,6 +119,12 @@
        return videoService.getAuthorCollectVideoPage(query);
    }
    @GetMapping("/author-like-video-page")
    @ApiOperation(value = "获取视频主页作者点赞的视频分页", notes = "获取视频主页作者点赞的视频分页")
    public Result getAuthorLikeVideoPage(AuthorVideoQuery query) {
        return videoService.getAuthorLikeVideoPage(query);
    }
    @PostMapping("/home-page-info-edit")
    @ApiOperation(value = "保存视频主页的个人信息修改", notes = "保存视频主页的个人信息修改")
    public Result homePageInfoEdit(@RequestBody @Validated VideoHomePageInfoForm form) {
framework/src/main/java/cn/lili/modules/lmk/domain/query/VideoQuery.java
@@ -24,7 +24,7 @@
    @ApiModelProperty("作者id")
    private String authorId;
    @ApiModelProperty("视频来源:recommend推荐、author某作者的视频、collect某作者收藏的视频")
    @ApiModelProperty("视频来源:recommend推荐、author某作者的视频、collect某作者收藏的视频、like某作者点赞的视频")
    private String videoFrom;
    /**
framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java
@@ -114,6 +114,14 @@
    IPage getAuthorCollectVideoPage(IPage page, @Param("query") AuthorVideoQuery query);
    /**
     * 获取视频主页作者点赞的视频分页
     *
     * @param page
     * @param query
     */
    IPage getAuthorLikeVideoPage(IPage page, @Param("query") AuthorVideoQuery query);
    /**
     * 小程序-视频详情
     *
     * @param id
framework/src/main/java/cn/lili/modules/lmk/service/VideoService.java
@@ -165,6 +165,14 @@
    Result getAuthorCollectVideoPage(AuthorVideoQuery query);
    /**
     * 获取视频主页作者点赞视频分页
     *
     * @param query
     * @return
     */
    Result getAuthorLikeVideoPage(AuthorVideoQuery query);
    /**
     * 保存视频主页的个人信息修改
     *
     * @param form
@@ -281,4 +289,5 @@
     * @param numList
     */
    void updateThumbsUpNumBatch(List<CollectTypeNumVO> numList);
}
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
@@ -464,6 +464,10 @@
                query2.setAuthorId(query.getAuthorId());
                baseMapper.getAuthorCollectVideoPage(page, query2);
                break;
            case "like":
                AuthorVideoQuery query3 = new AuthorVideoQuery();
                query3.setAuthorId(query.getAuthorId());
                baseMapper.getAuthorLikeVideoPage(page, query3);
            default:
                break;
        }
@@ -651,16 +655,39 @@
        IPage<WxVideoVO> page = PageUtil.getPage(query, WxVideoVO.class);
        query.setAuthorSelf(UserContext.getCurrentUserId().equals(query.getAuthorId()));
        baseMapper.getAuthorVideoPage(page, query);
        for (WxVideoVO vo : page.getRecords()) {
            if (VideoContentTypeEnum.VIDEO.getValue().equals(vo.getVideoContentType())) {
                vo.setVideoUrl(cosUtil.getPreviewUrl(vo.getVideoFileKey()));
                vo.setCoverUrl(cosUtil.getPreviewUrl(vo.getCoverFileKey()));
            } else if (VideoContentTypeEnum.IMG.getValue().equals(vo.getVideoContentType()) && StringUtils.isNotBlank(vo.getVideoImgs())) {
                vo.setImgs(JSON.parseArray(vo.getVideoImgs(), String.class).stream().map(fileKey -> cosUtil.getPreviewUrl(fileKey)).collect(Collectors.toList()));
        List<String> videoIds = page.getRecords().stream().map(WxVideoVO::getId).collect(Collectors.toList());
        Map<String, List<SimpleVideoTagVO>> tagMap = videoTagRefService.getTagsByVideoIds(videoIds)
                .stream()
                .collect(Collectors.groupingBy(SimpleVideoTagVO::getVideoId));
        Map<String, List<SimpleMyCollectVO>> collectMap = myCollectService.getCollectsByVideoIds(videoIds)
                .stream()
                .collect(Collectors.groupingBy(SimpleMyCollectVO::getRefId));
        Map<String, List<SimpleMyThumbsUpVO>> thumbsUpMap = thumbsUpRecordService.getThumbssByVideoIds(videoIds)
                .stream()
                .collect(Collectors.groupingBy(SimpleMyThumbsUpVO::getRefId));
        List<String> subscribes = mySubscribeService.getSubscribesByUserId(UserContext.getCurrentUserId());
        if (CollectionUtils.isNotEmpty(page.getRecords())) {
            for (WxVideoVO v : page.getRecords()) {
                v.setTagList(tagMap.get(v.getId()));
                v.setCollected(CollectionUtils.isNotEmpty(collectMap.get(v.getId())));
                v.setThumbsUp(CollectionUtils.isNotEmpty(thumbsUpMap.get(v.getId())));
                v.setCommentNum(this.getCommentNum(v.getId(), v.getCommentNum()));
                v.setCollectNum(this.getCollectNum(v.getId(), v.getCollectNum()));
                v.setThumbsUpNum(this.getThumbsUpNum(v.getId(), v.getThumbsUpNum()));
                if (VideoContentTypeEnum.VIDEO.getValue().equals(v.getVideoContentType())) {
                    v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey()));
                    v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverFileKey()));
                } else if (VideoContentTypeEnum.IMG.getValue().equals(v.getVideoContentType()) && StringUtils.isNotBlank(v.getVideoImgs())) {
                    v.setImgs(JSON.parseArray(v.getVideoImgs(), String.class).stream().map(fileKey -> cosUtil.getPreviewUrl(fileKey)).collect(Collectors.toList()));
                }
                v.setOptions(VideoSupportOpEnum.getVideoOpByStatus(v.getStatus()));
                if (CollectionUtils.isNotEmpty(v.getGoodsList())) {
                    v.getGoodsList().stream().forEach(goods -> {
                        goods.setThumbnail(cosUtil.getPreviewUrl(goods.getThumbnail()));
                    });
                }
                v.setSubscribeThisAuthor(subscribes.contains(v.getAuthorId()));
            }
            vo.setOptions(VideoSupportOpEnum.getVideoOpByStatus(vo.getStatus()));
        }
        return Result.ok().data(page.getRecords()).total(page.getTotal());
    }
@@ -669,14 +696,72 @@
    public Result getAuthorCollectVideoPage(AuthorVideoQuery query) {
        IPage<WxVideoVO> page = PageUtil.getPage(query, WxVideoVO.class);
        baseMapper.getAuthorCollectVideoPage(page, query);
        for (WxVideoVO vo : page.getRecords()) {
            if (VideoContentTypeEnum.VIDEO.getValue().equals(vo.getVideoContentType())) {
                vo.setVideoUrl(cosUtil.getPreviewUrl(vo.getVideoFileKey()));
                vo.setCoverUrl(cosUtil.getPreviewUrl(vo.getCoverFileKey()));
            } else if (VideoContentTypeEnum.IMG.getValue().equals(vo.getVideoContentType()) && StringUtils.isNotBlank(vo.getVideoImgs())) {
                vo.setImgs(JSON.parseArray(vo.getVideoImgs(), String.class).stream().map(fileKey -> cosUtil.getPreviewUrl(fileKey)).collect(Collectors.toList()));
        if (CollectionUtils.isNotEmpty(page.getRecords())) {
            List<String> videoIds = page.getRecords().stream().map(WxVideoVO::getId).collect(Collectors.toList());
            Map<String, List<SimpleVideoTagVO>> tagMap = videoTagRefService.getTagsByVideoIds(videoIds)
                    .stream()
                    .collect(Collectors.groupingBy(SimpleVideoTagVO::getVideoId));
            Map<String, List<SimpleMyThumbsUpVO>> thumbsUpMap = thumbsUpRecordService.getThumbssByVideoIds(videoIds)
                    .stream()
                    .collect(Collectors.groupingBy(SimpleMyThumbsUpVO::getRefId));
            List<String> subscribes = mySubscribeService.getSubscribesByUserId(UserContext.getCurrentUserId());
            for (WxVideoVO v : page.getRecords()) {
                v.setTagList(tagMap.get(v.getId()));
                v.setCollected(Boolean.TRUE);
                v.setThumbsUp(CollectionUtils.isNotEmpty(thumbsUpMap.get(v.getId())));
                v.setCommentNum(this.getCommentNum(v.getId(), v.getCommentNum()));
                v.setCollectNum(this.getCollectNum(v.getId(), v.getCollectNum()));
                v.setThumbsUpNum(this.getThumbsUpNum(v.getId(), v.getThumbsUpNum()));
                if (VideoContentTypeEnum.VIDEO.getValue().equals(v.getVideoContentType())) {
                    v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey()));
                    v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverFileKey()));
                } else if (VideoContentTypeEnum.IMG.getValue().equals(v.getVideoContentType()) && StringUtils.isNotBlank(v.getVideoImgs())) {
                    v.setImgs(JSON.parseArray(v.getVideoImgs(), String.class).stream().map(fileKey -> cosUtil.getPreviewUrl(fileKey)).collect(Collectors.toList()));
                }
                if (CollectionUtils.isNotEmpty(v.getGoodsList())) {
                    v.getGoodsList().stream().forEach(goods -> {
                        goods.setThumbnail(cosUtil.getPreviewUrl(goods.getThumbnail()));
                    });
                }
                v.setSubscribeThisAuthor(subscribes.contains(v.getAuthorId()));
            }
            vo.setCollected(Boolean.TRUE);
        }
        return Result.ok().data(page.getRecords()).total(page.getTotal());
    }
    @Override
    public Result getAuthorLikeVideoPage(AuthorVideoQuery query) {
        IPage<WxVideoVO> page = PageUtil.getPage(query, WxVideoVO.class);
        baseMapper.getAuthorLikeVideoPage(page, query);
        if (CollectionUtils.isNotEmpty(page.getRecords())) {
            List<String> videoIds = page.getRecords().stream().map(WxVideoVO::getId).collect(Collectors.toList());
            Map<String, List<SimpleVideoTagVO>> tagMap = videoTagRefService.getTagsByVideoIds(videoIds)
                    .stream()
                    .collect(Collectors.groupingBy(SimpleVideoTagVO::getVideoId));
            Map<String, List<SimpleMyCollectVO>> collectMap = myCollectService.getCollectsByVideoIds(videoIds)
                    .stream()
                    .collect(Collectors.groupingBy(SimpleMyCollectVO::getRefId));
            List<String> subscribes = mySubscribeService.getSubscribesByUserId(UserContext.getCurrentUserId());
            for (WxVideoVO v : page.getRecords()) {
                v.setTagList(tagMap.get(v.getId()));
                v.setCollected(CollectionUtils.isNotEmpty(collectMap.get(v.getId())));
                v.setThumbsUp(Boolean.TRUE);
                v.setCommentNum(this.getCommentNum(v.getId(), v.getCommentNum()));
                v.setCollectNum(this.getCollectNum(v.getId(), v.getCollectNum()));
                v.setThumbsUpNum(this.getThumbsUpNum(v.getId(), v.getThumbsUpNum()));
                if (VideoContentTypeEnum.VIDEO.getValue().equals(v.getVideoContentType())) {
                    v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey()));
                    v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverFileKey()));
                } else if (VideoContentTypeEnum.IMG.getValue().equals(v.getVideoContentType()) && StringUtils.isNotBlank(v.getVideoImgs())) {
                    v.setImgs(JSON.parseArray(v.getVideoImgs(), String.class).stream().map(fileKey -> cosUtil.getPreviewUrl(fileKey)).collect(Collectors.toList()));
                }
                if (CollectionUtils.isNotEmpty(v.getGoodsList())) {
                    v.getGoodsList().stream().forEach(goods -> {
                        goods.setThumbnail(cosUtil.getPreviewUrl(goods.getThumbnail()));
                    });
                }
                v.setSubscribeThisAuthor(subscribes.contains(v.getAuthorId()));
            }
        }
        return Result.ok().data(page.getRecords()).total(page.getTotal());
    }
framework/src/main/resources/mapper/lmk/VideoMapper.xml
@@ -460,6 +460,41 @@
            LMC.create_time DESC
    </select>
    <select id="getAuthorLikeVideoPage" resultMap="WxResultMap">
        SELECT
            LV.author_id,
            LV.cover_url,
            LV.video_fit,
            LV.video_duration,
            LV.video_file_key,
            LV.title,
            LV.goods_view_num,
            LV.goods_order_num,
            LV.recommend,
            LV.status,
            LV.play_num,
            LV.comment_num,
            LV.collect_num,
            LV.thumbs_up_num,
            LV.weight,
            LV.audit_pass_time,
            LV.update_time,
            LV.video_content_type,
            LV.video_type,
            LV.video_imgs,
            LV.id,
            LM.nick_name as authorName,
            LM.face as authorAvatar
        FROM
            lmk_thumbs_up_record LMC
                INNER JOIN lmk_video LV ON LMC.ref_id = LV.id AND LV.delete_flag = 0 AND LV.status = '1'
                LEFT JOIN li_member LM ON LV.author_id = LM.id
        WHERE
            LMC.delete_flag = 0 AND LMC.user_id = #{query.authorId} AND LMC.thumbs_up_type = 'video' AND LV.video_type = #{query.videoType}
        ORDER BY
            LMC.create_time DESC
    </select>
    <!-- 微信视频编辑详情 -->
    <resultMap id="WxEditResultMap" type="cn.lili.modules.lmk.domain.vo.WxEditVideoVO">