peng
2 天以前 6378b1e03b15e66ce58ebdb0f748f1330e2324d9
修改首页视频显示问题
6个文件已修改
149 ■■■■ 已修改文件
framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/impl/MyCollectServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/impl/ThumbsUpRecordServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoTagRefServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/resources/mapper/lmk/VideoMapper.xml 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/mapper/VideoMapper.java
@@ -85,6 +85,8 @@
     */
    VideoAccountVO getAuthorInfo(@Param("authorId") String authorId, @Param("currentUserId") String currentUserId);
    VideoAccountVO getAuthorInfoAdmin(@Param("authorId") String authorId, @Param("currentUserId") String currentUserId);
    /**
     * 获取作者的所有视频id
     *
framework/src/main/java/cn/lili/modules/lmk/service/impl/MyCollectServiceImpl.java
@@ -34,10 +34,7 @@
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -169,6 +166,9 @@
    @Override
    public List<SimpleMyCollectVO> getCollectsByVideoIds(List<String> videoIds) {
        if (videoIds == null || videoIds.isEmpty()) {
            return new ArrayList<>();
        }
        return baseMapper.getCollectsByVideoIds(videoIds, UserContext.getCurrentUserId());
    }
framework/src/main/java/cn/lili/modules/lmk/service/impl/ThumbsUpRecordServiceImpl.java
@@ -18,6 +18,7 @@
import org.springframework.beans.BeanUtils;
import org.springframework.util.Assert;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -104,6 +105,9 @@
    @Override
    public List<SimpleMyThumbsUpVO> getThumbssByVideoIds(List<String> videoIds) {
        if (videoIds == null || videoIds.isEmpty()) {
            return new ArrayList<>();
        }
        return baseMapper.getThumbssByVideoIds(videoIds, UserContext.getCurrentUserId());
    }
}
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoServiceImpl.java
@@ -19,6 +19,8 @@
import cn.lili.modules.member.entity.dos.Member;
import cn.lili.modules.member.service.FootprintService;
import cn.lili.modules.member.service.MemberService;
import cn.lili.modules.permission.entity.dos.AdminUser;
import cn.lili.modules.permission.service.AdminUserService;
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
import cn.lili.rocketmq.tags.CommentTagsEnum;
@@ -85,7 +87,7 @@
    private final VideoGoodsService videoGoodsService;
    private final KitchenTypeService kitchenTypeService;
    private final Cache cache;
    private final AdminUserService adminUserService;
    private final RocketmqCustomProperties rocketmqCustomProperties;
    private final RocketMQTemplate rocketMQTemplate;
    private final ThumbsUpRecordService thumbsUpRecordService;
@@ -251,7 +253,9 @@
        String destination = rocketmqCustomProperties.getVideoTopic() + ":" + VideoTagsEnum.ES_DOC_ADD_OR_UPDATE.name();
        rocketMQTemplate.asyncSend(destination, JSON.toJSONString(videoIndex), RocketmqSendCallbackBuilder.commonCallback());
        return Result.ok("发布成功,视频审核中~");
    }    @Override
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Result systemPublish(WxVideoForm form) {
        // 1.保存视频
@@ -426,7 +430,10 @@
            // 3. 获取视频临时访问地址、设置视频标签
            page.getRecords().forEach(v -> {
                v.setTagList(tagMap.get(v.getId()));
                v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverUrl()));
                String coverUrl = v.getCoverUrl();
                if (StringUtils.isNotBlank(coverUrl)&&!coverUrl.contains("http")) {
                    v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverUrl()));
                }
                v.getGoodsList().forEach(goods ->{
                    if (StringUtils.isNotBlank(goods.getThumbnail())&&!goods.getThumbnail().contains("http")) {
                        goods.setThumbnail(cosUtil.getPreviewUrl(goods.getThumbnail()));
@@ -626,7 +633,10 @@
                v.setCommentNum(this.getCommentNum(v.getId(), v.getCommentNum()));
                v.setCollectNum(this.getCollectNum(v.getId(), v.getCollectNum()));
                v.setThumbsUpNum(this.getThumbsUpNum(v.getId(), v.getThumbsUpNum()));
                v.setAuthorAvatar(cosUtil.getPreviewUrl(v.getAuthorAvatar()));
                String authorAvatar = v.getAuthorAvatar();
                if (StringUtils.isNotBlank(authorAvatar)&&!authorAvatar.contains("http")) {
                    v.setAuthorAvatar(cosUtil.getPreviewUrl(v.getAuthorAvatar()));
                }
                if (VideoContentTypeEnum.VIDEO.getValue().equals(v.getVideoContentType())) {
                    v.setVideoUrl(cosUtil.getPreviewUrl(v.getVideoFileKey()));
                    v.setCoverUrl(cosUtil.getPreviewUrl(v.getCoverFileKey()));
@@ -799,7 +809,13 @@
    @Override
    public Result getAuthorInfo(String authorId) {
        VideoAccountVO vo = baseMapper.getAuthorInfo(authorId, UserContext.getCurrentUserId());
        AdminUser adminUser = adminUserService.getById(authorId);
        VideoAccountVO vo;
        if (Objects.isNull(adminUser)) {
            vo  = baseMapper.getAuthorInfo(authorId, UserContext.getCurrentUserId());
        }else {
            vo = baseMapper.getAuthorInfoAdmin(authorId, UserContext.getCurrentUserId());
        }
        vo.setSelf(authorId.equals(UserContext.getCurrentUserId()));
        // 查询获赞数
        List<String> videoIds = baseMapper.getVideoIdsByAuthor(authorId);
framework/src/main/java/cn/lili/modules/lmk/service/impl/VideoTagRefServiceImpl.java
@@ -1,5 +1,6 @@
package cn.lili.modules.lmk.service.impl;
import cn.hutool.core.util.ArrayUtil;
import cn.lili.modules.lmk.domain.entity.VideoTagRef;
import cn.lili.modules.lmk.domain.vo.SimpleVideoTagVO;
import cn.lili.modules.lmk.mapper.VideoTagRefMapper;
@@ -8,6 +9,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -26,6 +28,9 @@
    @Override
    public List<SimpleVideoTagVO> getTagsByVideoIds(List<String> videoIds) {
        if (videoIds == null || videoIds.isEmpty()) {
            return new ArrayList<>();
        }
        return baseMapper.getTagsByVideoIds(videoIds);
    }
}
framework/src/main/resources/mapper/lmk/VideoMapper.xml
@@ -232,7 +232,41 @@
            <if test="query.status != null and query.status != ''">AND LV.status = #{query.status}</if>
    </select>
<!-- todo 备份原有的失去了文件-->
<!--    <select id="recommendVideo" 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.create_time,-->
<!--            LV.video_content_type,-->
<!--            LV.video_type,-->
<!--            LV.video_imgs,-->
<!--            LV.id,-->
<!--            LM.nick_name as authorName,-->
<!--            LM.face as authorAvatar-->
<!--        FROM-->
<!--            lmk_video LV-->
<!--            LEFT JOIN li_member LM ON LV.author_id = LM.id-->
<!--        WHERE-->
<!--            LV.delete_flag = 0 AND LV.status = '1' AND LV.video_type = #{query.videoType}-->
<!--        ORDER BY-->
<!--            LV.create_time DESC-->
<!--    </select> -->
    <select id="recommendVideo" resultMap="WxResultMap">
        SELECT
            LV.author_id,
@@ -244,7 +278,7 @@
            LV.goods_view_num,
            LV.goods_order_num,
            LV.recommend,
            LV.status,
            LV.STATUS,
            LV.play_num,
            LV.comment_num,
            LV.collect_num,
@@ -257,15 +291,52 @@
            LV.video_type,
            LV.video_imgs,
            LV.id,
            LM.nick_name as authorName,
            LM.face as authorAvatar
            LM.nick_name AS authorName,
            LM.face AS authorAvatar
        FROM
            lmk_video LV
            LEFT JOIN li_member LM ON LV.author_id = LM.id
                LEFT JOIN li_member LM ON LV.author_id = LM.id
        WHERE
            LV.delete_flag = 0 AND LV.status = '1' AND LV.video_type = #{query.videoType}
            LV.delete_flag = 0
          AND LV.STATUS = '1'
          AND LV.video_type = #{query.videoType}
          AND lm.id IS NOT NULL
        UNION ALL
        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.create_time,
            LV.video_content_type,
            LV.video_type,
            LV.video_imgs,
            LV.id,
            LM.nick_name AS authorName,
            LM.avatar AS authorAvatar
        FROM
            lmk_video LV
                LEFT JOIN li_admin_user LM ON LV.author_id = LM.id
        WHERE
            LV.delete_flag = 0
          AND LV.STATUS = '1'
          AND LV.video_type = #{query.videoType}
          AND lm.id IS NOT NULL
        ORDER BY
            LV.create_time DESC
            create_time DESC
    </select>
    <select id="recommendVideoByVideoId" resultMap="WxResultMap">
        SELECT
@@ -560,6 +631,25 @@
        WHERE
              LM.id = #{authorId} AND LM.delete_flag = 0
    </select>
    <select id="getAuthorInfoAdmin" resultType="cn.lili.modules.lmk.domain.vo.VideoAccountVO">
        SELECT
               LM.id as userId,
               LM.nick_name as nickName,
               LM.avatar as avatar,
               LVA.motto,
               (SELECT COUNT(*) FROM lmk_my_subscribe WHERE subscribe_user_id = #{authorId} AND delete_flag = 0) as fansNum,
               (SELECT COUNT(*) FROM lmk_my_subscribe WHERE user_id = #{authorId} AND delete_flag = 0) as subNum,
               (SELECT CASE
                           WHEN id IS NOT NULL THEN 1
                           ELSE 0
                           END
               FROM lmk_my_subscribe WHERE user_id = #{currentUserId} AND subscribe_user_id = #{authorId} AND delete_flag = 0) as hasSub
        FROM
            li_admin_user LM
                 LEFT JOIN lmk_video_account LVA ON LM.id = LVA.user_id
        WHERE
              LM.id = #{authorId} AND LM.delete_flag = 0
    </select>
    <select id="getVideoIdsByAuthor" parameterType="string" resultType="string">
        SELECT id FROM lmk_video WHERE author_id = #{authorId} AND delete_flag = 0 AND status = '1'