| | |
| | | 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())); |
| | |
| | | * @param mysqlNum |
| | | * @return |
| | | */ |
| | | private Integer getCommentNum(String videoId, Integer mysqlNum) { |
| | | public Integer getCommentNum(String videoId, Integer mysqlNum) { |
| | | Object redisNum = cache.get(CachePrefix.VIDEO_COMMENT_NUM.getPrefixWithId(videoId)); |
| | | if (Objects.isNull(redisNum)) { |
| | | // redis中没有就把数据库的写到redis中 |
| | |
| | | * @param mysqlNum |
| | | * @return |
| | | */ |
| | | private Integer getCollectNum(String videoId, Integer mysqlNum) { |
| | | public Integer getCollectNum(String videoId, Integer mysqlNum) { |
| | | Object redisNum = cache.get(CachePrefix.VIDEO_COLLECT_NUM.getPrefixWithId(videoId)); |
| | | if (Objects.isNull(redisNum)) { |
| | | // redis中没有就把数据库的写到redis中 |
| | |
| | | * @param mysqlNum |
| | | * @return |
| | | */ |
| | | private Integer getThumbsUpNum(String videoId, Integer mysqlNum) { |
| | | public Integer getThumbsUpNum(String videoId, Integer mysqlNum) { |
| | | Object redisNum = cache.get(CachePrefix.VIDEO_THUMBS_UP_NUM.getPrefixWithId(videoId)); |
| | | if (Objects.isNull(redisNum)) { |
| | | // redis中没有就把数据库的写到redis中 |
| | |
| | | |
| | | @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); |