Commit 82501221 authored by 刘基明's avatar 刘基明

接口调整

parent a01256f6
package com.tanpu.community.api.beans.qo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("热门话题")
public class HotTopic {
@ApiModelProperty(value = "话题ID")
private String topicId;
@ApiModelProperty(value = "话题名称")
private String topicTitle;
@ApiModelProperty(value = "类型 1:热 2:新")
private Integer type;
}
package com.tanpu.community.api.beans.qo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "主题内容")
public class ThemeContentQo {
@ApiModelProperty(value = "类型,0:文本,1:产品 2:直播 3:短视频 4:课程,5:图片 6:图片列表(讨论)")
private Integer type;
@ApiModelProperty(value = "文本的值是内容,附件的值为id")
private String value;
@ApiModelProperty(value = "类型为6时,传入图片列表")
private String[] imgList;
@ApiModelProperty(value = "对象详情")
private Object detail;
}
......@@ -19,11 +19,14 @@ public class ThemeQo {
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题")
@ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发")
private Integer themeType;
@ApiModelProperty(value = "文本内容")
private String content;
@ApiModelProperty(value = "内容")
private ThemeContentQo content;
@ApiModelProperty(value = "转发内容")
private ThemeContentQo forwardContent;
@ApiModelProperty(value = "作者id")
private String authorId;
......@@ -58,9 +61,6 @@ public class ThemeQo {
@ApiModelProperty(value = "点赞量")
private Integer likeCount;
@ApiModelProperty("附件")
private AttachmentQo attachmentQo;
private LocalDateTime createTime;
......
......@@ -20,4 +20,6 @@ public class TopicDetailQo {
@ApiModelProperty(value = "讨论量")
private Integer disscussCount;
@ApiModelProperty(value = "类型 1:热 2:新")
private Integer type;
}
package com.tanpu.community.api.beans.qo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("热点话题对象")
public class TopicHotQo {
@ApiModelProperty(value = "话题ID")
private String topicId;
@ApiModelProperty(value = "话题名称")
private String topicTitle;
@ApiModelProperty(value = "类型 1:热 2:新")
private Integer type;
}
......@@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* APP端话题列表页
* 话题列表页
*/
@Data
@ApiModel("话题列表对象")
......
package com.tanpu.community.api.beans.req;
package com.tanpu.community.api.beans.req.theme;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -20,5 +20,8 @@ public class CreateCommentReq {
private String replyId;
@NotEmpty(message = "评论内容不能为空")
private String comment;
private ThemeContentReq comment;
@ApiModelProperty(value = "是否同步到专栏")
private boolean copyToNewsFeed;
}
package com.tanpu.community.api.beans.req.theme;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "主题内容")
public class ThemeContentReq {
@ApiModelProperty(value = "类型,0:文本,1:产品 2:直播 3:短视频 4:课程,5:图片 6:图片列表(讨论)")
private Integer type;
@ApiModelProperty(value = "文本的值是内容,附件的值为id")
private String value;
@ApiModelProperty(value = "类型为6时,传入图片列表")
private String[] imgList;
}
......@@ -3,7 +3,7 @@ package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.qo.CommentQo;
import com.tanpu.community.api.beans.req.CreateCommentReq;
import com.tanpu.community.api.beans.req.theme.CreateCommentReq;
import com.tanpu.community.manager.CommentManager;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......
......@@ -3,6 +3,7 @@ package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.auth.UserHolder;
import com.tanpu.community.api.beans.qo.TopicDetailQo;
import com.tanpu.community.api.beans.qo.TopicHotQo;
import com.tanpu.community.api.beans.qo.TopicTitileQo;
import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.beans.req.topic.TopicSearchReq;
......@@ -12,6 +13,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@Slf4j
@RequestMapping(value = "/api/topic")
......@@ -42,6 +45,13 @@ public class TopicController {
}
@GetMapping(value = "/titleList")
@ApiOperation("首页顶部话题列表")
@ResponseBody
public CommonResp<List<TopicHotQo>> getHomePage(@RequestParam String topicId){
//todo
return CommonResp.success();
}
}
package com.tanpu.community.manager;
import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.beans.qo.CommentQo;
import com.tanpu.community.api.beans.req.CreateCommentReq;
import com.tanpu.community.api.beans.req.theme.CreateCommentReq;
import com.tanpu.community.api.enums.CollectionTypeEnum;
import com.tanpu.community.api.enums.CommentTypeEnum;
import com.tanpu.community.dao.entity.community.CommentEntity;
......@@ -35,7 +36,7 @@ public class CommentManager {
.parentId(req.getParentId())
.replyId(req.getReplyId())
.authorId(userId)
.content(req.getComment())
.content(JsonUtil.toJson(req.getComment()))
.commentType(CommentTypeEnum.THEME.getCode())
.build();
......
......@@ -217,7 +217,7 @@ public class ThemeManager {
if (!CollectionUtils.isEmpty(attachments)) {
ThemeAttachmentEntity attachmentEntity = attachments.get(0);
AttachmentQo attachmentQo = AttachmentQo.builder().type(attachmentEntity.getAttachType()).attachment(transferAttachment(attachmentEntity, userId)).build();
themeQO.setAttachmentQo(attachmentQo);
//TODO CONTENT添加附件detail
}
//迄今时间
themeQO.setUpToNowTime(calUpToNowTime(themeQO.getCreateTime()));
......@@ -241,7 +241,7 @@ public class ThemeManager {
//组装正文详情
private void buildMainTestExtraInfo(MainTextQo maintTextQo, String userId) {
//附件列表
List<ThemeAttachmentEntity> attachments = themeAttachmentService.selectByThemeId(maintTextQo.getId());
List<ThemeAttachmentEntity> attachments = themeAttachmentService.selectByThemeId(maintTextQo.getThemeId());
if (!CollectionUtils.isEmpty(attachments)) {
List<AttachmentQo> attachmentQos = new ArrayList<>();
attachments.forEach(o -> attachmentQos.add(AttachmentQo.builder()
......
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