Commit 64f31adc authored by 刘基明's avatar 刘基明

接口调整

parent 4cc68f4d
......@@ -16,4 +16,10 @@ public class ImagesDTO {
private Integer relType;
private String remark;
@ApiModelProperty("图片宽度")
private Integer imgHeight;
@ApiModelProperty("图片宽度")
private Integer imgWidth;
}
package com.tanpu.community.api.beans.qo;
import com.tanpu.community.api.beans.vo.feign.CourseDetailExt;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.ZhiboDetailVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "附件对象")
public class AttachmentDetailVo {
@ApiModelProperty(value = "产品")
private ProductInfoVO productInfoVO;
@ApiModelProperty(value = "直播")
private ZhiboDetailVO zhiboDetailVO;
@ApiModelProperty(value = "短视频")
private ShortVideoBaseInfoResp shortVideoBaseInfoResp;
@ApiModelProperty(value = "课程")
private CourseDetailExt courseDetailExt;
}
......@@ -18,6 +18,6 @@ public class ThemeContentQo {
private String[] imgList;
@ApiModelProperty(value = "对象详情")
private Object detail;
private AttachmentDetailVo detail;
}
......@@ -24,5 +24,5 @@ public class ThemeFormerQo {
private List<ThemeContentQo> forwardContent;
@ApiModelProperty(value = "转发的图片九宫格")
private List<ImagesDTO> imgList;
private List<ImagesDTO> imageList;
}
......@@ -25,7 +25,7 @@ public class ThemeQo {
private Integer themeType;
@ApiModelProperty(value = "内容")
private ThemeContentQo content;
private List<ThemeContentQo> content;
......
package com.tanpu.community.api.beans.req.homepage;
import com.tanpu.community.api.beans.req.page.Pageable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
@Data
@ApiModel(value = "查询关注/粉丝列表")
public class QueryFollowReq {
@NotEmpty(message = "userId不能为空")
@ApiModelProperty(value = "用户Id")
private String userId;
@NotEmpty(message = "queryType不能为空")
@ApiModelProperty(value = "查询类型,1:粉丝 2:关注")
private Integer queryType;
@NotEmpty(message = "page不能为空")
@ApiModelProperty(value = "分页")
private Pageable page;
}
package com.tanpu.community.api.beans.req.homepage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "查询历史操作主题列表")
public class QueryRecordThemeReq {
@ApiModelProperty("用户Id")
private String userId;
@ApiModelProperty(value = "操作类型 1:发布 2:回复 3:点赞 4:收藏")
private Integer recordType;
}
......@@ -14,7 +14,7 @@ public class ThemeContentReq {
@ApiModelProperty(value = "文本的值是内容,附件的值为id")
private String value;
@ApiModelProperty(value = "产品类型")
@ApiModelProperty(value = "产品类型,0 公募,1 私募,2 白名单,3 私有")
private Integer productType;
@ApiModelProperty(value = "产品推荐语")
......
package com.tanpu.community.feign.course.vo;
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.feign.course.vo;
package com.tanpu.community.api.beans.vo.feign;
import lombok.Data;
import lombok.EqualsAndHashCode;
......
package com.tanpu.community.feign.course.vo;
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......
package com.tanpu.community.api.beans.vo.feign; import io.swagger.annotations.ApiModelProperty;import lombok.Data;import lombok.EqualsAndHashCode; /** * @author: zyh * @date: 2021-04-13 3:20 下午 * @description: */@EqualsAndHashCode(callSuper = true)@Datapublic class CourseExt extends Course { @ApiModelProperty("章节-小节ID") private String coursePackageId; @Deprecated @ApiModelProperty("相关性知识课程小节类型 - 1:音频 2:视频") private Integer relType; @ApiModelProperty("相关性知识课程小节类型 扩展") private Integer relTypeExt; @Deprecated @ApiModelProperty("章节-小节 音/视频类型 1:音频 2:视频") private Integer type; @ApiModelProperty("章节-小节 音/视频类型 扩展") private Integer typeExt; @ApiModelProperty("章节-小节 音/视频地址") private String url; @ApiModelProperty("相关性知识地址") private String relUrl; @ApiModelProperty("相关性知识 - 课程包ID") private String relPackageId; @ApiModelProperty("相关性知识音/视频时长") private Integer relLengthTime; @ApiModelProperty("多少人已学习") private Integer readNum; @ApiModelProperty("课程时长 单位s") private Integer lengthTime; @ApiModelProperty("讲师信息") private LecturerResp lecturer;}
\ No newline at end of file
package com.tanpu.community.feign.course.vo;
package com.tanpu.community.api.beans.vo.feign;
import lombok.AllArgsConstructor;
import lombok.Builder;
......
package com.tanpu.community.feign.tanpuroom.vo;
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.feign.tanpuroom.vo;
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.feign.course.vo;
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.feign.course.vo;
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.feign.vo;
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.feign.vo;
package com.tanpu.community.api.beans.vo.feign;
import com.tanpu.community.feign.course.vo.ColumnVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......
package com.tanpu.community.feign.vo;
package com.tanpu.community.api.beans.vo.feign;
import lombok.AllArgsConstructor;
import lombok.Builder;
......
package com.tanpu.community.feign.course.vo;
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.feign.vo;
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.feign.vo;
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.tanpu.community.feign.zhibo.vo;
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModel;
......
package com.tanpu.community.api.enums;
public enum QueryFollowTypeEnum {
QUERY_FANS(1,"查询粉丝"),QUERY_IDOLS(2,"查询关注");
private Integer code;
private String type;
QueryFollowTypeEnum(Integer code, String type) {
this.code = code;
this.type = type;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
package com.tanpu.community.api.enums;
public enum QueryRecordTypeEnum {
QUERY_PUBLISH(1,"发布"),
QUERY_COMMENT(2,"评论"),
QUERY_LIKE(3,"点赞"),
QUERY_COLLECT(4,"收藏");
private Integer code;
private String type;
QueryRecordTypeEnum(Integer code, String type) {
this.code = code;
this.type = type;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
......@@ -5,6 +5,9 @@ import com.tanpu.community.api.beans.qo.FollowQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.HomePageReq;
import com.tanpu.community.api.beans.req.homepage.AddIdolReq;
import com.tanpu.community.api.beans.req.homepage.QueryFollowReq;
import com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq;
import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.manager.HomePageManager;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -17,11 +20,8 @@ import java.util.List;
@RestController
@Slf4j
@RequestMapping(value = "/api/homepage")
public class HomePageController {
@Autowired
private HomePageManager homePageManager;
......@@ -35,44 +35,11 @@ public class HomePageController {
}
@GetMapping(value = "/queryMyFans")
@ApiOperation("查询自己的粉丝列表")
@ResponseBody
public CommonResp<List<FollowQo>> queryMyFans() {
String userId = "123";
List<FollowQo> data = homePageManager.queryFansByIdolId(userId);
homePageManager.judgeFollowed(data,userId);
return CommonResp.success(data);
}
@GetMapping(value = "/queryFansByUserId")
@ApiOperation("查询他人的粉丝列表")
@ResponseBody
public CommonResp<List<FollowQo>> queryFans(@RequestParam String targetUser) {
String userId="123";
List<FollowQo> data = homePageManager.queryFansByIdolId(targetUser);
homePageManager.judgeFollowed(data,userId);
return CommonResp.success(data);
}
@GetMapping(value = "/queryMyIdols")
@ApiOperation("获取自己的关注列表")
@ApiOperation("查询关注/粉丝列表")
@ResponseBody
public CommonResp<List<FollowQo>> queryMyIdols() {
public CommonResp<Page<FollowQo>> queryMyFans(@RequestBody QueryFollowReq req) {
String userId = "123";
List<FollowQo> data = homePageManager.queryIdolsByFollowerId(userId);
homePageManager.judgeFollowed(data,userId);
return CommonResp.success(data);
}
@GetMapping(value = "/queryIdolsByUserId")
@ApiOperation("获取他人的关注列表")
@ResponseBody
public CommonResp<List<FollowQo>> queryIdols(@RequestParam String targetUser) {
String userId="123";
List<FollowQo> data = homePageManager.queryIdolsByFollowerId(targetUser);
homePageManager.judgeFollowed(data,userId);
return CommonResp.success(data);
return CommonResp.success(homePageManager.queryFollow(req));
}
@PostMapping(value = "/addIdol")
......@@ -84,10 +51,10 @@ public class HomePageController {
return CommonResp.success();
}
@PostMapping(value = "/queryMyLike")
@PostMapping(value = "/queryList")
@ApiOperation("我的点赞帖子列表")
@ResponseBody
public CommonResp<List<ThemeQo>> likeList(){
public CommonResp<List<ThemeQo>> likeList(@RequestBody QueryRecordThemeReq req){
String userId="123";
return CommonResp.success();
}
......
package com.tanpu.community.feign.course;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.feign.course.vo.CourseDetailExt;
import com.tanpu.community.api.beans.vo.feign.CourseDetailExt;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
......
package com.tanpu.community.feign.course;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.feign.course.vo.CourseDetailExt;
import com.tanpu.community.api.beans.vo.feign.CourseDetailExt;
import com.tanpu.community.feign.product.FeignBackClientForProducts;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......
package com.tanpu.community.feign.course.vo; import io.swagger.annotations.ApiModelProperty;import lombok.Data;import lombok.EqualsAndHashCode; /** * @author: zyh * @date: 2021-04-13 3:20 下午 * @description: */@EqualsAndHashCode(callSuper = true)@Datapublic class CourseExt extends Course { @ApiModelProperty("章节-小节ID") private String coursePackageId; @Deprecated @ApiModelProperty("相关性知识课程小节类型 - 1:音频 2:视频") private Integer relType; @ApiModelProperty("相关性知识课程小节类型 扩展") private Integer relTypeExt; @Deprecated @ApiModelProperty("章节-小节 音/视频类型 1:音频 2:视频") private Integer type; @ApiModelProperty("章节-小节 音/视频类型 扩展") private Integer typeExt; @ApiModelProperty("章节-小节 音/视频地址") private String url; @ApiModelProperty("相关性知识地址") private String relUrl; @ApiModelProperty("相关性知识 - 课程包ID") private String relPackageId; @ApiModelProperty("相关性知识音/视频时长") private Integer relLengthTime; @ApiModelProperty("多少人已学习") private Integer readNum; @ApiModelProperty("课程时长 单位s") private Integer lengthTime; @ApiModelProperty("讲师信息") private LecturerResp lecturer;}
\ No newline at end of file
package com.tanpu.community.feign.product;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.feign.vo.ProductInfoVO;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
......
package com.tanpu.community.feign.product;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.feign.vo.ProductInfoVO;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
......
package com.tanpu.community.feign.tanpuroom;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.feign.tanpuroom.vo.CurriCulumInfoDetailDto;
import com.tanpu.community.feign.tanpuroom.vo.CurriculumDetailVo;
import com.tanpu.community.feign.vo.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.CurriCulumInfoDetailDto;
import com.tanpu.community.api.beans.vo.feign.CurriculumDetailVo;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
......
package com.tanpu.community.feign.tanpuroom;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.feign.tanpuroom.vo.CurriCulumInfoDetailDto;
import com.tanpu.community.feign.tanpuroom.vo.CurriculumDetailVo;
import com.tanpu.community.feign.vo.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.CurriCulumInfoDetailDto;
import com.tanpu.community.api.beans.vo.feign.CurriculumDetailVo;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
......
package com.tanpu.community.feign.zhibo;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.feign.zhibo.vo.ZhiboDetailVO;
import com.tanpu.community.api.beans.vo.feign.ZhiboDetailVO;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
......
package com.tanpu.community.feign.zhibo;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.feign.zhibo.vo.ZhiboDetailVO;
import com.tanpu.community.api.beans.vo.feign.ZhiboDetailVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
......
......@@ -2,14 +2,19 @@ package com.tanpu.community.manager;
import com.tanpu.community.api.beans.qo.FollowQo;
import com.tanpu.community.api.beans.req.HomePageReq;
import com.tanpu.community.api.beans.req.homepage.QueryFollowReq;
import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.enums.QueryFollowTypeEnum;
import com.tanpu.community.dao.entity.community.HomePageEntity;
import com.tanpu.community.service.FollowRelService;
import com.tanpu.community.service.HomePageService;
import com.tanpu.community.util.ConvertUtil;
import com.tanpu.community.util.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
......@@ -37,27 +42,23 @@ public class HomePageManager {
}else {
homePageService.update(entity);
}
return;
}
//获取用户的关注列表
public List<FollowQo> queryIdolsByFollowerId(String followerId) {
List<String> idolIds = followRelService.queryFansByFollowerId(followerId);
List<HomePageEntity> list = homePageService.selectListByUserIds(idolIds);
return list.stream().map(ConvertUtil::homePageEntity2FollowQo).collect(Collectors.toList());
}
//获取用户的粉丝列表
public List<FollowQo> queryFansByIdolId(String idolId) {
List<String> fanIds = followRelService.queryFansByIdolId(idolId);
List<HomePageEntity> list = homePageService.selectListByUserIds(fanIds);
return list.stream().map(ConvertUtil::homePageEntity2FollowQo).collect(Collectors.toList());
//获取用户关注、粉丝列表
public Page<FollowQo> queryFollow(QueryFollowReq req) {
List<String> userIds = QueryFollowTypeEnum.QUERY_FANS.getCode().equals(req.getQueryType())?
followRelService.queryFansByIdolId(req.getUserId()):followRelService.queryFansByFollowerId(req.getUserId());
List<HomePageEntity> list = homePageService.selectListByUserIds(userIds);
List<FollowQo> collect = list.stream().map(ConvertUtil::homePageEntity2FollowQo).collect(Collectors.toList());
List<FollowQo> followQos = judgeFollowed(collect, req.getUserId());
return PageUtils.page(req.getPage(),followQos);
}
//判断返回列表中的用户是否被当前用户关注
public List<FollowQo> judgeFollowed(List<FollowQo> followQos,String followerId){
Set<String> idolSet = followRelService.queryFansByFollowerId(followerId).stream().collect(Collectors.toSet());
Set<String> idolSet = new HashSet<>(followRelService.queryFansByFollowerId(followerId));
return followQos.stream().map(o->{
if (idolSet.contains(o.getUserId())){
o.setFollowed(true);
......
......@@ -17,13 +17,13 @@ import com.tanpu.community.dao.entity.community.HomePageEntity;
import com.tanpu.community.dao.entity.community.ThemeAttachmentEntity;
import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.feign.course.FeignClientForCourse;
import com.tanpu.community.feign.course.vo.CourseDetailExt;
import com.tanpu.community.api.beans.vo.feign.CourseDetailExt;
import com.tanpu.community.feign.product.FeignClientForProducts;
import com.tanpu.community.feign.tanpuroom.FeignClientForTanpuroom;
import com.tanpu.community.feign.vo.ProductInfoVO;
import com.tanpu.community.feign.vo.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp;
import com.tanpu.community.feign.zhibo.FeignClientForZhibo;
import com.tanpu.community.feign.zhibo.vo.ZhiboDetailVO;
import com.tanpu.community.api.beans.vo.feign.ZhiboDetailVO;
import com.tanpu.community.service.*;
import com.tanpu.community.service.other.*;
import com.tanpu.community.util.ConvertUtil;
......
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