| | |
| | | */ |
| | | VideoAccountVO getAuthorInfo(@Param("authorId") String authorId, @Param("currentUserId") String currentUserId); |
| | | |
| | | VideoAccountVO getAuthorInfoAdmin(@Param("authorId") String authorId, @Param("currentUserId") String currentUserId); |
| | | |
| | | /** |
| | | * 获取作者的所有视频id |
| | | * |
| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | |
| | | @Override |
| | | public List<SimpleMyCollectVO> getCollectsByVideoIds(List<String> videoIds) { |
| | | if (videoIds == null || videoIds.isEmpty()) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return baseMapper.getCollectsByVideoIds(videoIds, UserContext.getCurrentUserId()); |
| | | } |
| | | |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.util.Assert; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<SimpleMyThumbsUpVO> getThumbssByVideoIds(List<String> videoIds) { |
| | | if (videoIds == null || videoIds.isEmpty()) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return baseMapper.getThumbssByVideoIds(videoIds, UserContext.getCurrentUserId()); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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.保存视频 |
| | |
| | | // 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())); |
| | |
| | | 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())); |
| | |
| | | |
| | | @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); |
| | |
| | | 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; |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | @Override |
| | | public List<SimpleVideoTagVO> getTagsByVideoIds(List<String> videoIds) { |
| | | if (videoIds == null || videoIds.isEmpty()) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return baseMapper.getTagsByVideoIds(videoIds); |
| | | } |
| | | } |
| | |
| | | <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, |
| | |
| | | LV.goods_view_num, |
| | | LV.goods_order_num, |
| | | LV.recommend, |
| | | LV.status, |
| | | LV.STATUS, |
| | | LV.play_num, |
| | | LV.comment_num, |
| | | LV.collect_num, |
| | |
| | | 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 |
| | |
| | | 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' |