Commit cf95830f authored by 张辰's avatar 张辰
parents e3081be2 dfa3d640
package com.tanpu.community.api.beans.qo; package com.tanpu.community.api.beans.qo;
import com.tanpu.community.api.beans.vo.feign.FundInfoBaseResp; import com.tanpu.community.api.beans.vo.feign.product.FundInfoBaseResp;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp; import com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.ZhiboListResp; import com.tanpu.community.api.beans.vo.feign.zhibo.ZhiboListResp;
import com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp; import com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.api.beans.qo; package com.tanpu.community.api.beans.qo;
import com.tanpu.community.api.beans.ImagesDTO; import com.tanpu.community.api.beans.vo.ImagesDTO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
......
package com.tanpu.community.api.beans.qo; package com.tanpu.community.api.beans.qo;
import com.tanpu.community.api.beans.ImagesDTO; import com.tanpu.community.api.beans.vo.ImagesDTO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
......
...@@ -5,22 +5,16 @@ import io.swagger.annotations.ApiModel; ...@@ -5,22 +5,16 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@Data @Data
@ApiModel(value = "查询关注/粉丝列表") @ApiModel(value = "查询关注/粉丝列表")
public class QueryFollowReq { public class QueryFollowReq {
@NotEmpty(message = "userId不能为空")
@ApiModelProperty(value = "用户Id") @ApiModelProperty(value = "用户Id")
private String userId; private String userId;
@NotEmpty(message = "queryType不能为空")
@ApiModelProperty(value = "查询类型,1:粉丝 2:关注") @ApiModelProperty(value = "查询类型,1:粉丝 2:关注")
private Integer queryType; private Integer queryType;
@NotNull(message = "page不能为空")
@ApiModelProperty(value = "分页") @ApiModelProperty(value = "分页")
private Pageable page; private Pageable page;
} }
package com.tanpu.community.api.beans.req.page; package com.tanpu.community.api.beans.req.page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@Data @Data
@Builder
public class Page<T> { public class Page<T> {
private Integer pageNum; private Integer pageNum;
...@@ -90,6 +92,13 @@ public class Page<T> { ...@@ -90,6 +92,13 @@ public class Page<T> {
} }
} }
public Page(Integer pageNum, Integer pageSize, Long totalSize, Integer totalPages, List<T> content) {
this.pageNum = pageNum;
this.pageSize = pageSize;
this.totalSize = totalSize;
this.totalPages = totalPages;
this.content = content;
}
public Page() { public Page() {
} }
......
package com.tanpu.community.api.beans.req.page; package com.tanpu.community.api.beans.req.page;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Builder;
import lombok.Data; import lombok.Data;
@Data @Data
@Builder
@ApiModel(value = "分页") @ApiModel(value = "分页")
public class Pageable { public class Pageable {
......
package com.tanpu.community.api.beans.req.theme; package com.tanpu.community.api.beans.req.theme;
import com.tanpu.community.api.beans.ImagesDTO; import com.tanpu.community.api.beans.vo.ImagesDTO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
......
package com.tanpu.community.api.beans.vo;
public class CourseVo {
}
package com.tanpu.community.api.beans; package com.tanpu.community.api.beans.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.api.beans; package com.tanpu.community.api.beans.vo;
import lombok.Data; import lombok.Data;
......
package com.tanpu.community.api.beans.vo;
public class ProductVo {
}
package com.tanpu.community.api.beans.vo;
public class ShortVideoVo {
}
package com.tanpu.community.api.beans; package com.tanpu.community.api.beans.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.api.beans; package com.tanpu.community.api.beans.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.api.beans.vo;
public class ZhiboVo {
}
package com.tanpu.community.api.beans.vo.feign; package com.tanpu.community.api.beans.vo.feign.course;
import com.tanpu.community.api.beans.vo.feign.Type;
import com.tanpu.community.api.beans.vo.feign.pay.Price; import com.tanpu.community.api.beans.vo.feign.pay.Price;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.api.beans.vo.feign; package com.tanpu.community.api.beans.vo.feign.course;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.api.beans.vo.feign.course; package com.tanpu.community.api.beans.vo.feign.course;
import com.tanpu.community.api.beans.vo.feign.Progression; import com.tanpu.community.api.beans.vo.feign.product.Progression;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
......
package com.tanpu.community.api.beans.vo.feign.course; package com.tanpu.community.api.beans.vo.feign.course;
import com.tanpu.community.api.beans.vo.feign.FileMetadata; import com.tanpu.community.api.beans.vo.feign.user.FileMetadata;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
......
package com.tanpu.community.api.beans.vo.feign.course; package com.tanpu.community.api.beans.vo.feign.course;
import com.tanpu.community.api.beans.vo.feign.BaseCoursePackage;
import com.tanpu.community.api.beans.vo.feign.LikeCourse;
import com.tanpu.community.api.beans.vo.feign.pay.GroupBuyConfig; import com.tanpu.community.api.beans.vo.feign.pay.GroupBuyConfig;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.api.beans.vo.feign; package com.tanpu.community.api.beans.vo.feign.course;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
......
package com.tanpu.community.api.beans.vo.feign; package com.tanpu.community.api.beans.vo.feign.course;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.api.beans.vo.feign; package com.tanpu.community.api.beans.vo.feign.product;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
......
package com.tanpu.community.api.beans.vo.feign; package com.tanpu.community.api.beans.vo.feign.product;
import com.tanpu.community.api.beans.vo.feign.course.ColumnVO;
import com.tanpu.community.api.beans.vo.feign.Net;
import com.tanpu.community.api.beans.vo.feign.Type;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
......
package com.tanpu.community.api.beans.vo.feign; package com.tanpu.community.api.beans.vo.feign.product;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
......
package com.tanpu.community.api.beans.vo.feign; package com.tanpu.community.api.beans.vo.feign.product;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.api.beans.vo.feign; package com.tanpu.community.api.beans.vo.feign.user;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.api.beans.vo.feign; package com.tanpu.community.api.beans.vo.feign.user;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.api.beans.vo.feign; package com.tanpu.community.api.beans.vo.feign.user;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
......
package com.tanpu.community.api.beans.vo.feign; package com.tanpu.community.api.beans.vo.feign.zhibo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
......
package com.tanpu.community.api.beans.vo.feign; package com.tanpu.community.api.beans.vo.feign.zhibo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
......
...@@ -2,7 +2,8 @@ package com.tanpu.community.api.enums; ...@@ -2,7 +2,8 @@ package com.tanpu.community.api.enums;
public enum QueryFollowTypeEnum { public enum QueryFollowTypeEnum {
QUERY_FANS(1,"查询粉丝"),QUERY_IDOLS(2,"查询关注"); QUERY_FANS(1,"查询粉丝"),
QUERY_IDOLS(2,"查询关注");
private Integer code; private Integer code;
private String type; private String type;
......
...@@ -48,7 +48,7 @@ public class HomePageController { ...@@ -48,7 +48,7 @@ public class HomePageController {
@ApiOperation("查询关注/粉丝列表") @ApiOperation("查询关注/粉丝列表")
@ResponseBody @ResponseBody
@AuthLogin @AuthLogin
public CommonResp<Page<FollowQo>> queryMyFans(@RequestBody QueryFollowReq req) { public CommonResp<Page<FollowQo>> queryFollowList(@RequestBody QueryFollowReq req) {
String userId = userHolder.getUserId(); String userId = userHolder.getUserId();
return CommonResp.success(homePageManager.queryFollow(req,userId)); return CommonResp.success(homePageManager.queryFollow(req,userId));
} }
......
package com.tanpu.community.feign.fatools; package com.tanpu.community.feign.fatools;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.FileQueryResp; import com.tanpu.community.api.beans.vo.feign.user.FileQueryResp;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp; import com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.UserInfoVo; import com.tanpu.community.api.beans.vo.feign.user.UserInfoVo;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
......
package com.tanpu.community.feign.fatools; package com.tanpu.community.feign.fatools;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.FileQueryResp; import com.tanpu.community.api.beans.vo.feign.user.FileQueryResp;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp; import com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.UserInfoVo; import com.tanpu.community.api.beans.vo.feign.user.UserInfoVo;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
......
package com.tanpu.community.feign.product; package com.tanpu.community.feign.product;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO; import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
......
package com.tanpu.community.feign.product; package com.tanpu.community.feign.product;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO; import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
......
package com.tanpu.community.feign.product; package com.tanpu.community.feign.product;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO; import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
......
package com.tanpu.community.feign.product; package com.tanpu.community.feign.product;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO; import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
......
package com.tanpu.community.feign.product; package com.tanpu.community.feign.product;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO; import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
......
package com.tanpu.community.feign.product; package com.tanpu.community.feign.product;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO; import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
......
...@@ -3,7 +3,7 @@ package com.tanpu.community.feign.tanpuroom; ...@@ -3,7 +3,7 @@ package com.tanpu.community.feign.tanpuroom;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.course.CurriCulumInfoDetailDto; import com.tanpu.community.api.beans.vo.feign.course.CurriCulumInfoDetailDto;
import com.tanpu.community.api.beans.vo.feign.course.CurriculumDetailVo; import com.tanpu.community.api.beans.vo.feign.course.CurriculumDetailVo;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp; import com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
......
...@@ -3,7 +3,7 @@ package com.tanpu.community.feign.tanpuroom; ...@@ -3,7 +3,7 @@ package com.tanpu.community.feign.tanpuroom;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.course.CurriCulumInfoDetailDto; import com.tanpu.community.api.beans.vo.feign.course.CurriCulumInfoDetailDto;
import com.tanpu.community.api.beans.vo.feign.course.CurriculumDetailVo; import com.tanpu.community.api.beans.vo.feign.course.CurriculumDetailVo;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp; import com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
......
package com.tanpu.community.feign.zhibo; package com.tanpu.community.feign.zhibo;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.ZhiboDetailVO; import com.tanpu.community.api.beans.vo.feign.zhibo.ZhiboDetailVO;
import com.tanpu.community.api.beans.vo.feign.ZhiboListResp; import com.tanpu.community.api.beans.vo.feign.zhibo.ZhiboListResp;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
......
package com.tanpu.community.feign.zhibo; package com.tanpu.community.feign.zhibo;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.ZhiboDetailVO; import com.tanpu.community.api.beans.vo.feign.zhibo.ZhiboDetailVO;
import com.tanpu.community.api.beans.vo.feign.ZhiboListResp; import com.tanpu.community.api.beans.vo.feign.zhibo.ZhiboListResp;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
......
...@@ -63,8 +63,8 @@ public class CommentManager { ...@@ -63,8 +63,8 @@ public class CommentManager {
String authorId = commentQo.getAuthorId(); String authorId = commentQo.getAuthorId();
UserInfoEntity userInfo = userInfoService.queryUserById(authorId); UserInfoEntity userInfo = userInfoService.queryUserById(authorId);
if (userInfo != null) { if (userInfo != null) {
commentQo.setUserImg(userInfo.getUiHeadimg()); commentQo.setUserImg(userInfo.getUiHeadimgMp());
commentQo.setNickName(userInfo.getUiNickname()); commentQo.setNickName(userInfo.getUiUsernameMp());
} }
//是否点赞及点赞数 //是否点赞及点赞数
String commentId = commentQo.getCommentId(); String commentId = commentQo.getCommentId();
......
...@@ -11,12 +11,11 @@ import com.tanpu.community.service.FollowRelService; ...@@ -11,12 +11,11 @@ import com.tanpu.community.service.FollowRelService;
import com.tanpu.community.service.UserInfoService; import com.tanpu.community.service.UserInfoService;
import com.tanpu.community.util.ConvertUtil; import com.tanpu.community.util.ConvertUtil;
import com.tanpu.community.util.PageUtils; import com.tanpu.community.util.PageUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashSet; import java.util.*;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -34,12 +33,18 @@ public class HomePageManager { ...@@ -34,12 +33,18 @@ public class HomePageManager {
public Page<FollowQo> queryFollow(QueryFollowReq req, String userId) { public Page<FollowQo> queryFollow(QueryFollowReq req, String userId) {
List<String> userIds = QueryFollowTypeEnum.QUERY_FANS.getCode().equals(req.getQueryType()) ? List<String> userIds = QueryFollowTypeEnum.QUERY_FANS.getCode().equals(req.getQueryType()) ?
followRelService.queryFansByIdolId(req.getUserId()) : followRelService.queryFansByFollowerId(req.getUserId()); followRelService.queryFansByIdolId(req.getUserId()) : followRelService.queryFansByFollowerId(req.getUserId());
List<UserInfoEntity> userInfos = userInfoService.queryUserByIds(userIds); List<FollowQo> followQos = new ArrayList<>();
List<FollowQo> collect = userInfos.stream().map(ConvertUtil::homePageEntity2FollowQo).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(userIds)) {
List<FollowQo> followQos = judgeFollowed(collect, userId); List<UserInfoEntity> userInfos = userInfoService.queryUserByIds(userIds);
List<FollowQo> collect = userInfos.stream().map(ConvertUtil::homePageEntity2FollowQo).collect(Collectors.toList());
followQos = judgeFollowed(collect, userId);
}
//分页
return PageUtils.page(req.getPage(), followQos); return PageUtils.page(req.getPage(), followQos);
} }
//判断返回列表中的用户是否被当前用户关注 //判断返回列表中的用户是否被当前用户关注
public List<FollowQo> judgeFollowed(List<FollowQo> followQos, String followerId) { public List<FollowQo> judgeFollowed(List<FollowQo> followQos, String followerId) {
Set<String> idolSet = new HashSet<>(followRelService.queryFansByFollowerId(followerId)); Set<String> idolSet = new HashSet<>(followRelService.queryFansByFollowerId(followerId));
......
package com.tanpu.community.manager; package com.tanpu.community.manager;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.tanpu.community.api.beans.KafkaDurationUptMsg; import com.tanpu.community.api.beans.vo.KafkaDurationUptMsg;
import com.tanpu.community.service.VisitSummaryService; import com.tanpu.community.service.VisitSummaryService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
......
...@@ -132,7 +132,8 @@ public class ThemeManager { ...@@ -132,7 +132,8 @@ public class ThemeManager {
} }
themeEntities = themeService.queryByThemeIds(new ArrayList<>(replyThemeIds)); themeEntities = themeService.queryByThemeIds(new ArrayList<>(replyThemeIds));
List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId); List<ThemeQo> themeQos = convertEntityToQo(themeEntities, userId);
productService.transferAttachments(themeQos); //组装附件
productService.getAttachDetailByBatch(themeQos);
//主题列表 //主题列表
Map<String, ThemeQo> themeMap = themeQos.stream() Map<String, ThemeQo> themeMap = themeQos.stream()
.collect(Collectors.toMap(ThemeQo::getThemeId, o -> o)); .collect(Collectors.toMap(ThemeQo::getThemeId, o -> o));
...@@ -149,8 +150,8 @@ public class ThemeManager { ...@@ -149,8 +150,8 @@ public class ThemeManager {
FormerThemeQo f = ConvertUtil.themeQo2FormerThemeQo(themeQo); FormerThemeQo f = ConvertUtil.themeQo2FormerThemeQo(themeQo);
//ThemeContentQo和原主题包装到FormerThemeQo中包装到ThemeQo中 //ThemeContentQo和原主题包装到FormerThemeQo中包装到ThemeQo中
ThemeQo commentThemeQo = ThemeQo.builder() ThemeQo commentThemeQo = ThemeQo.builder()
.nickName(userInfoEntity.getUiNickname()) .nickName(userInfoEntity.getUiUsernameMp())
.userImg(userInfoEntity.getUiHeadimg()) .userImg(userInfoEntity.getUiHeadimgMp())
.content(Arrays.asList(commentContent)) .content(Arrays.asList(commentContent))
.formerTheme(f) .formerTheme(f)
.commentId(commentEntity.getCommentId()) .commentId(commentEntity.getCommentId())
...@@ -181,7 +182,8 @@ public class ThemeManager { ...@@ -181,7 +182,8 @@ public class ThemeManager {
throw new BizException("找不到帖子id:" + themeId); throw new BizException("找不到帖子id:" + themeId);
} }
ThemeQo themeQo = ConvertUtil.themeEntityToQo(themeEntity); ThemeQo themeQo = ConvertUtil.themeEntityToQo(themeEntity);
buildMainTestExtraInfo(themeQo, userId); productService.getAttachDetail(themeQo);
buildThemeQoExtraInfo(userId, themeQo);
return themeQo; return themeQo;
} }
...@@ -258,7 +260,7 @@ public class ThemeManager { ...@@ -258,7 +260,7 @@ public class ThemeManager {
//Entity转Qo //Entity转Qo
List<ThemeQo> themeQos = ConvertUtil.themeEntitiesToDTOs(themeEntities); List<ThemeQo> themeQos = ConvertUtil.themeEntitiesToDTOs(themeEntities);
//批量查询附件detail //批量查询附件detail
productService.transferAttachments(themeQos); productService.getAttachDetailByBatch(themeQos);
//其他信息 //其他信息
for (ThemeQo themeQO : themeQos) { for (ThemeQo themeQO : themeQos) {
buildThemeQoExtraInfo(userId, themeQO); buildThemeQoExtraInfo(userId, themeQO);
...@@ -268,9 +270,12 @@ public class ThemeManager { ...@@ -268,9 +270,12 @@ public class ThemeManager {
} }
//组装主题列表 //组装主题详情
private void buildThemeQoExtraInfo(String userId, ThemeQo themeQo) { private void buildThemeQoExtraInfo(String userId, ThemeQo themeQo) {
//封装转发对象
buildFormerTheme(themeQo);
String themeId = themeQo.getThemeId(); String themeId = themeQo.getThemeId();
//是否关注作者 //是否关注作者
...@@ -283,9 +288,8 @@ public class ThemeManager { ...@@ -283,9 +288,8 @@ public class ThemeManager {
//是否转发 //是否转发
Integer forwardCountByUser = themeService.getForwardCountByUser(themeId, userId); Integer forwardCountByUser = themeService.getForwardCountByUser(themeId, userId);
themeQo.setHasForward(forwardCountByUser > 0); themeQo.setHasForward(forwardCountByUser > 0);
//转发原文
buildFormerTheme(themeQo); //点赞,收藏,转发
//热点数据:点赞,收藏,转发
Integer likeCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME); Integer likeCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME);
Integer bookCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.COLLECT_THEME); Integer bookCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.COLLECT_THEME);
Integer forwardCount = themeService.getForwardCountById(themeId); Integer forwardCount = themeService.getForwardCountById(themeId);
...@@ -294,14 +298,6 @@ public class ThemeManager { ...@@ -294,14 +298,6 @@ public class ThemeManager {
themeQo.setForwardCount(forwardCount); themeQo.setForwardCount(forwardCount);
} }
//组装正文详情
private void buildMainTestExtraInfo(ThemeQo themeQo, String userId) {
//附件列表
productService.transferAttachement(themeQo);
//转发原文
buildFormerTheme(themeQo);
return;
}
//组装被转发主题 //组装被转发主题
private void buildFormerTheme(ThemeQo themeQo) { private void buildFormerTheme(ThemeQo themeQo) {
...@@ -311,7 +307,9 @@ public class ThemeManager { ...@@ -311,7 +307,9 @@ public class ThemeManager {
if (formerTheme == null) { if (formerTheme == null) {
throw new BizException("转发主题Id错误,id:" + formerThemeId); throw new BizException("转发主题Id错误,id:" + formerThemeId);
} }
productService.transferAttachement(formerTheme); //单个查询详情
// productService.getAttachDetail(formerTheme);
FormerThemeQo f = ConvertUtil.themeQo2FormerThemeQo(formerTheme); FormerThemeQo f = ConvertUtil.themeQo2FormerThemeQo(formerTheme);
themeQo.setFormerTheme(f); themeQo.setFormerTheme(f);
} }
......
package com.tanpu.community.manager; package com.tanpu.community.manager;
import com.tanpu.common.exception.BizException; import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.TopicDO; import com.tanpu.community.api.beans.vo.TopicDO;
import com.tanpu.community.api.beans.TopicDataAnalysDTO; import com.tanpu.community.api.beans.vo.TopicDataAnalysDTO;
import com.tanpu.community.api.beans.qo.TopicDetailQo; import com.tanpu.community.api.beans.qo.TopicDetailQo;
import com.tanpu.community.api.beans.qo.TopicHotQo; import com.tanpu.community.api.beans.qo.TopicHotQo;
import com.tanpu.community.api.beans.qo.TopicTitileQo; import com.tanpu.community.api.beans.qo.TopicTitileQo;
......
...@@ -5,14 +5,14 @@ import com.google.common.collect.Sets; ...@@ -5,14 +5,14 @@ import com.google.common.collect.Sets;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.common.enums.fund.ProductTypeEnum; import com.tanpu.common.enums.fund.ProductTypeEnum;
import com.tanpu.common.util.JsonUtil; import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.beans.ImagesDTO; import com.tanpu.community.api.beans.vo.ImagesDTO;
import com.tanpu.community.api.beans.qo.AttachmentDetailVo; import com.tanpu.community.api.beans.qo.AttachmentDetailVo;
import com.tanpu.community.api.beans.qo.ThemeContentQo; import com.tanpu.community.api.beans.qo.ThemeContentQo;
import com.tanpu.community.api.beans.qo.ThemeQo; import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.vo.feign.FundInfoBaseResp; import com.tanpu.community.api.beans.vo.feign.product.FundInfoBaseResp;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO; import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp; import com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.ZhiboListResp; import com.tanpu.community.api.beans.vo.feign.zhibo.ZhiboListResp;
import com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp; import com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp;
import com.tanpu.community.api.enums.RelTypeEnum; import com.tanpu.community.api.enums.RelTypeEnum;
import com.tanpu.community.dao.entity.community.FileRecordEntity; import com.tanpu.community.dao.entity.community.FileRecordEntity;
...@@ -70,14 +70,14 @@ public class ProductService { ...@@ -70,14 +70,14 @@ public class ProductService {
private UserInfoService userInfoService; private UserInfoService userInfoService;
public void transferAttachement(ThemeQo themeQo) { public void getAttachDetail(ThemeQo themeQo) {
ArrayList<ThemeQo> themeQos = new ArrayList<>(); ArrayList<ThemeQo> themeQos = new ArrayList<>();
themeQos.add(themeQo); themeQos.add(themeQo);
transferAttachments(themeQos); getAttachDetailByBatch(themeQos);
} }
public void transferAttachments(List<ThemeQo> themeQos) { public void getAttachDetailByBatch(List<ThemeQo> themeQos) {
// 短视频信息 // 短视频信息
Map<String, ShortVideoBaseInfoResp> shortVideoMap = Maps.newHashMap(); Map<String, ShortVideoBaseInfoResp> shortVideoMap = Maps.newHashMap();
// 课程信息 // 课程信息
...@@ -180,7 +180,6 @@ public class ProductService { ...@@ -180,7 +180,6 @@ public class ProductService {
courseIds.add(c.getValue()); courseIds.add(c.getValue());
} }
}) })
); );
} }
...@@ -376,8 +375,8 @@ public class ProductService { ...@@ -376,8 +375,8 @@ public class ProductService {
themeQo.setTopicTitle(topicMap.get(themeQo.getTopicId())); themeQo.setTopicTitle(topicMap.get(themeQo.getTopicId()));
} }
if (!StringUtils.isEmpty(themeQo.getAuthorId()) && userMap.containsKey(themeQo.getAuthorId())) { if (!StringUtils.isEmpty(themeQo.getAuthorId()) && userMap.containsKey(themeQo.getAuthorId())) {
themeQo.setNickName(userMap.get(themeQo.getAuthorId()).getUiNickname()); themeQo.setNickName(userMap.get(themeQo.getAuthorId()).getUiUsernameMp());
themeQo.setUserImg(userMap.get(themeQo.getAuthorId()).getUiHeadimg()); themeQo.setUserImg(userMap.get(themeQo.getAuthorId()).getUiHeadimgMp());
} }
if (themeQo.getContent() == null) { if (themeQo.getContent() == null) {
continue; continue;
...@@ -416,6 +415,7 @@ public class ProductService { ...@@ -416,6 +415,7 @@ public class ProductService {
.product(product).build()); .product(product).build());
} }
} else if (themeContent.getType().equals(RelTypeEnum.SINGLE_IMG.type)) { } else if (themeContent.getType().equals(RelTypeEnum.SINGLE_IMG.type)) {
//
if (imgUrlMap.containsKey(themeContent.getValue())) { if (imgUrlMap.containsKey(themeContent.getValue())) {
FileRecordEntity imgEntity = imgUrlMap.get(themeContent.getValue()); FileRecordEntity imgEntity = imgUrlMap.get(themeContent.getValue());
String extInfo = imgEntity.getExtInfo(); String extInfo = imgEntity.getExtInfo();
...@@ -428,12 +428,36 @@ public class ProductService { ...@@ -428,12 +428,36 @@ public class ProductService {
.build(); .build();
themeContent.setImgList(Collections.singletonList(imagesDTO)); themeContent.setImgList(Collections.singletonList(imagesDTO));
} }
} }
}else if (themeContent.getType().equals(RelTypeEnum.MULTIPLE_IMAGE.type)) {
//多图写入图片宽高
List<ImagesDTO> imgList = themeContent.getImgList();
for (ImagesDTO imagesDTO : imgList) {
if (imgUrlMap.containsKey(imagesDTO.getRelId())) {
FileRecordEntity imgEntity = imgUrlMap.get(themeContent.getValue());
String extInfo = imgEntity.getExtInfo();
if (!StringUtils.isEmpty(extInfo)) {
Map<String, Object> extMap = JsonUtil.toMap(extInfo);
imagesDTO.setImgHeight((Integer) extMap.get("height"));
imagesDTO.setImgWidth((Integer) extMap.get("width"));
}
}
}
} }
} }
// String formerThemeId = themeQo.getFormerThemeId();
// if (!StringUtils.isEmpty(formerThemeId)) {
// FormerThemeQo formerTheme = themeQo.getFormerTheme();
//
// //单个查询详情
//// productService.getAttachDetail(formerTheme);
//
// FormerThemeQo f = ConvertUtil.themeQo2FormerThemeQo(formerTheme);
// themeQo.setFormerTheme(f);
// }
} }
} }
private List<String> setToList(Set<String> set) { private List<String> setToList(Set<String> set) {
...@@ -442,4 +466,9 @@ public class ProductService { ...@@ -442,4 +466,9 @@ public class ProductService {
return l; return l;
} }
//组装被转发主题
private void buildFormerTheme(ThemeQo themeQo) {
}
} }
...@@ -67,7 +67,7 @@ public class ThemeService { ...@@ -67,7 +67,7 @@ public class ThemeService {
return themeMapper.selectList(queryWrapper); return themeMapper.selectList(queryWrapper);
} }
//根据ids返回主题详情 //根据ids返回主题详情,带分页
public List<ThemeEntity> queryByThemeIds(List<String> themeIds, String lastId,Integer pageSize) { public List<ThemeEntity> queryByThemeIds(List<String> themeIds, String lastId,Integer pageSize) {
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>() LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>()
.in(ThemeEntity::getThemeId, themeIds) .in(ThemeEntity::getThemeId, themeIds)
...@@ -112,7 +112,7 @@ public class ThemeService { ...@@ -112,7 +112,7 @@ public class ThemeService {
/** /**
* 根据条件查询主题 * 根据条件查询最新主题
* @param topidId 话题Id * @param topidId 话题Id
* @param lastId 查询此主题Id之前的主题 * @param lastId 查询此主题Id之前的主题
* @param pageSize 查询数量 * @param pageSize 查询数量
......
...@@ -2,8 +2,8 @@ package com.tanpu.community.util; ...@@ -2,8 +2,8 @@ package com.tanpu.community.util;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.tanpu.common.util.JsonUtil; import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.beans.ImagesDTO; import com.tanpu.community.api.beans.vo.ImagesDTO;
import com.tanpu.community.api.beans.TopicDO; import com.tanpu.community.api.beans.vo.TopicDO;
import com.tanpu.community.api.beans.qo.*; import com.tanpu.community.api.beans.qo.*;
import com.tanpu.community.api.beans.req.theme.CreateThemeReq; import com.tanpu.community.api.beans.req.theme.CreateThemeReq;
import com.tanpu.community.api.beans.req.theme.ThemeContentReq; import com.tanpu.community.api.beans.req.theme.ThemeContentReq;
...@@ -180,8 +180,8 @@ public class ConvertUtil { ...@@ -180,8 +180,8 @@ public class ConvertUtil {
return null; return null;
} }
return FollowQo.builder().userId(entity.getId()) return FollowQo.builder().userId(entity.getId())
.nickName(entity.getUiNickname()) .nickName(entity.getUiUsernameMp())
.headImg(entity.getUiHeadimg()) .headImg(entity.getUiHeadimgMp())
.introduction(entity.getUiIntroduction()) .introduction(entity.getUiIntroduction())
.build(); .build();
} }
......
...@@ -14,8 +14,14 @@ import java.util.List; ...@@ -14,8 +14,14 @@ import java.util.List;
public class PageUtils { public class PageUtils {
public static <T> Page<T> page(Pageable pageable, List<T> list) { public static <T> Page<T> page(Pageable pageable, List<T> list) {
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
if(pageable==null){
return new Page<T>(1,0, (long)list.size(),1, list);
}
return new Page<>(pageable, 0L, new ArrayList<>()); return new Page<>(pageable, 0L, new ArrayList<>());
} else { } else {
if(pageable==null){
return new Page<T>(1,list.size(), (long)list.size(),1, list);
}
// 记录总数 // 记录总数
Integer count = list.size(); Integer count = list.size();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment