Commit 58b1d7c6 authored by 刘基明's avatar 刘基明

主题接口修改

parent 753eaead
......@@ -49,9 +49,9 @@ public class ThemeController {
@ApiOperation("主题正文")
@GetMapping(value = "/detail")
@ResponseBody
public CommonResp<ThemeQo> getThemeMainText(@RequestParam String topicId) {
public CommonResp<ThemeQo> getThemeMainText(@RequestParam String themeId) {
String userId = "liujm";
ThemeQo themeQo = themeManager.getDetail(topicId,userId);
ThemeQo themeQo = themeManager.getDetail(themeId,userId);
return CommonResp.success(themeQo);
}
......
......@@ -106,21 +106,21 @@ public class ThemeManager {
// 返回推荐主题文章
public List<ThemeQo> queryThemes(ThemeListReq req, String userId) {
List<ThemeEntity> themeEntities=new ArrayList<>();
List<ThemeEntity> themeEntities = new ArrayList<>();
if (ThemeListTypeEnum.RECOMMEND.getCode().equals(req.getType())) {
// TODO:推荐
themeEntities = themeService.selectAll(req.getLastId(), req.getPageSize());
} else if (ThemeListTypeEnum.FOLLOW.getCode().equals(req.getType())){
} else if (ThemeListTypeEnum.FOLLOW.getCode().equals(req.getType())) {
//根据关注列表查询
List<String> fansList = followRelService.queryFansByFollowerId(userId);
themeEntities = themeService.queryByFans(fansList, req.getLastId(), req.getPageSize());
}else if (ThemeListTypeEnum.TOPIC_HOT.getCode().equals(req.getType())){
} else if (ThemeListTypeEnum.TOPIC_HOT.getCode().equals(req.getType())) {
//TODO 根据话题查询热门
if (StringUtils.isEmpty(req.getTopicId())) throw new BizException("TopicId为空");
themeEntities = themeService.queryByTopic(req.getTopicId(), req.getLastId(), req.getPageSize());
}else if (ThemeListTypeEnum.TOPIC_LATEST.getCode().equals(req.getType())){
} else if (ThemeListTypeEnum.TOPIC_LATEST.getCode().equals(req.getType())) {
//TODO 根据话题查询最新
if (StringUtils.isEmpty(req.getTopicId())) throw new BizException("TopicId为空");
themeEntities = themeService.queryByTopic(req.getTopicId(), req.getLastId(), req.getPageSize());
......@@ -129,7 +129,7 @@ public class ThemeManager {
}
// 返回用户发布、回复、收藏的主题列表
public List<ThemeQo> queryThemesByUser(QueryRecordThemeReq req,String userId) {
public List<ThemeQo> queryThemesByUser(QueryRecordThemeReq req, String userId) {
// List<ThemeEntity> themeEntities = themeService.queryByUser(req.getUserId(), req.getPageSize(),req.getLastId());
List<ThemeEntity> themeEntities = themeService.selectAll(req.getLastId(), req.getPageSize());
......@@ -231,12 +231,12 @@ public class ThemeManager {
String themeId = themeQO.getThemeId();
List<ThemeContentQo> content = themeQO.getContent();
if (content!=null && content.size()>2){
themeQO.setContent(content.subList(0,2));
if (content != null && content.size() > 2) {
themeQO.setContent(content.subList(0, 2));
}
content = themeQO.getContent();
for (ThemeContentQo themeContentQo : content) {
transferAttachment(themeContentQo,userId);
transferAttachment(themeContentQo, userId);
}
//迄今时间
......@@ -264,7 +264,7 @@ public class ThemeManager {
String themeId = themeQo.getThemeId();
List<ThemeContentQo> content = themeQo.getContent();
for (ThemeContentQo themeContentQo : content) {
transferAttachment(themeContentQo,userId);
transferAttachment(themeContentQo, userId);
}
//迄今时间
themeQo.setUpToNowTime(calUpToNowTime(themeQo.getCreateTime()));
......@@ -279,19 +279,19 @@ public class ThemeManager {
public void transferAttachment(ThemeContentQo themeContentQo, String userId) {
String type = themeContentQo.getType();
if (RelTypeEnum.FUND.type.equals(type)){
if (RelTypeEnum.FUND.type.equals(type)) {
//产品
String productId = themeContentQo.getValue();
CommonResp<ProductInfoVO> productDetailInfo = feignClientForProducts.getProductDetailInfo(productId);
themeContentQo.setDetail(AttachmentDetailVo.builder().productInfoVO(productDetailInfo.getData()).build());
}else if (RelTypeEnum.LIVE.type.equals(type)){
} else if (RelTypeEnum.LIVE.type.equals(type)) {
//直播
String zhiboId = themeContentQo.getValue();
CommonResp<ZhiboDetailVO> zhiboDetailVOCommonResp = feignClientForZhibo.queryZhiboDetail(zhiboId);
themeContentQo.setDetail(AttachmentDetailVo.builder().zhiboDetailVO(zhiboDetailVOCommonResp.getData()).build());
}else if (RelTypeEnum.SHORT_VIDEO.type.equals(type)){
} else if (RelTypeEnum.SHORT_VIDEO.type.equals(type)) {
//短视频
String videoId = themeContentQo.getValue();
String[] attachmentIds = new String[]{videoId};
......@@ -299,23 +299,23 @@ public class ThemeManager {
feignClientForTanpuroom.getShortVideoBaseInfo(Arrays.asList(attachmentIds));
themeContentQo.setDetail(AttachmentDetailVo.builder().shortVideoBaseInfoResp(shortVideoBaseInfo.getData().get(0)).build());
}else if (RelTypeEnum.PACKAGE.type.equals(type)){
} else if (RelTypeEnum.PACKAGE.type.equals(type)) {
//课程
String packageId = themeContentQo.getValue();
CommonResp<CoursePackageDetail> courseIdDetailInfo = feignClientForCourse.getCoursePackageDetailInfo(packageId);
themeContentQo.setDetail(AttachmentDetailVo.builder().coursePackageDetail(courseIdDetailInfo.getData()).build());
}else if (RelTypeEnum.SINGLE_IMG.type.equals(type)) {
} else if (RelTypeEnum.SINGLE_IMG.type.equals(type)) {
//单图,根据id传入url
String imgId = themeContentQo.getValue();
FileRecordEntity fileEntity = ossFileService.queryById(imgId);
if (fileEntity==null) {
throw new BizException("图片未找到,id:"+imgId);
if (fileEntity == null) {
throw new BizException("图片未找到,id:" + imgId);
}
themeContentQo.setValue(CommunityConstant.OSS_PREFIX_URL+fileEntity.getFileOssKey());
themeContentQo.setValue(CommunityConstant.OSS_PREFIX_URL + fileEntity.getFileOssKey());
}
}
}
//计算迄今时间
......@@ -335,5 +335,4 @@ public class ThemeManager {
}
}
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