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 { ...@@ -19,11 +19,14 @@ public class ThemeQo {
@ApiModelProperty(value = "标题") @ApiModelProperty(value = "标题")
private String title; private String title;
@ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题") @ApiModelProperty(value = "类型 1:讨论无标题 2:长文有标题 3:转发")
private Integer themeType; private Integer themeType;
@ApiModelProperty(value = "文本内容") @ApiModelProperty(value = "内容")
private String content; private ThemeContentQo content;
@ApiModelProperty(value = "转发内容")
private ThemeContentQo forwardContent;
@ApiModelProperty(value = "作者id") @ApiModelProperty(value = "作者id")
private String authorId; private String authorId;
...@@ -58,9 +61,6 @@ public class ThemeQo { ...@@ -58,9 +61,6 @@ public class ThemeQo {
@ApiModelProperty(value = "点赞量") @ApiModelProperty(value = "点赞量")
private Integer likeCount; private Integer likeCount;
@ApiModelProperty("附件")
private AttachmentQo attachmentQo;
private LocalDateTime createTime; private LocalDateTime createTime;
......
...@@ -20,4 +20,6 @@ public class TopicDetailQo { ...@@ -20,4 +20,6 @@ public class TopicDetailQo {
@ApiModelProperty(value = "讨论量") @ApiModelProperty(value = "讨论量")
private Integer disscussCount; 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; ...@@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/** /**
* APP端话题列表页 * 话题列表页
*/ */
@Data @Data
@ApiModel("话题列表对象") @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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -20,5 +20,8 @@ public class CreateCommentReq { ...@@ -20,5 +20,8 @@ public class CreateCommentReq {
private String replyId; private String replyId;
@NotEmpty(message = "评论内容不能为空") @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; ...@@ -3,7 +3,7 @@ package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.qo.CommentQo; 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 com.tanpu.community.manager.CommentManager;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
......
...@@ -3,6 +3,7 @@ package com.tanpu.community.controller; ...@@ -3,6 +3,7 @@ package com.tanpu.community.controller;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.common.auth.UserHolder; import com.tanpu.common.auth.UserHolder;
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.TopicTitileQo; import com.tanpu.community.api.beans.qo.TopicTitileQo;
import com.tanpu.community.api.beans.req.page.Page; import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.beans.req.topic.TopicSearchReq; import com.tanpu.community.api.beans.req.topic.TopicSearchReq;
...@@ -12,6 +13,8 @@ import lombok.extern.slf4j.Slf4j; ...@@ -12,6 +13,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController @RestController
@Slf4j @Slf4j
@RequestMapping(value = "/api/topic") @RequestMapping(value = "/api/topic")
...@@ -42,6 +45,13 @@ public class TopicController { ...@@ -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; 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.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.CollectionTypeEnum;
import com.tanpu.community.api.enums.CommentTypeEnum; import com.tanpu.community.api.enums.CommentTypeEnum;
import com.tanpu.community.dao.entity.community.CommentEntity; import com.tanpu.community.dao.entity.community.CommentEntity;
...@@ -35,7 +36,7 @@ public class CommentManager { ...@@ -35,7 +36,7 @@ public class CommentManager {
.parentId(req.getParentId()) .parentId(req.getParentId())
.replyId(req.getReplyId()) .replyId(req.getReplyId())
.authorId(userId) .authorId(userId)
.content(req.getComment()) .content(JsonUtil.toJson(req.getComment()))
.commentType(CommentTypeEnum.THEME.getCode()) .commentType(CommentTypeEnum.THEME.getCode())
.build(); .build();
......
...@@ -217,7 +217,7 @@ public class ThemeManager { ...@@ -217,7 +217,7 @@ public class ThemeManager {
if (!CollectionUtils.isEmpty(attachments)) { if (!CollectionUtils.isEmpty(attachments)) {
ThemeAttachmentEntity attachmentEntity = attachments.get(0); ThemeAttachmentEntity attachmentEntity = attachments.get(0);
AttachmentQo attachmentQo = AttachmentQo.builder().type(attachmentEntity.getAttachType()).attachment(transferAttachment(attachmentEntity, userId)).build(); AttachmentQo attachmentQo = AttachmentQo.builder().type(attachmentEntity.getAttachType()).attachment(transferAttachment(attachmentEntity, userId)).build();
themeQO.setAttachmentQo(attachmentQo); //TODO CONTENT添加附件detail
} }
//迄今时间 //迄今时间
themeQO.setUpToNowTime(calUpToNowTime(themeQO.getCreateTime())); themeQO.setUpToNowTime(calUpToNowTime(themeQO.getCreateTime()));
...@@ -241,7 +241,7 @@ public class ThemeManager { ...@@ -241,7 +241,7 @@ public class ThemeManager {
//组装正文详情 //组装正文详情
private void buildMainTestExtraInfo(MainTextQo maintTextQo, String userId) { 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)) { if (!CollectionUtils.isEmpty(attachments)) {
List<AttachmentQo> attachmentQos = new ArrayList<>(); List<AttachmentQo> attachmentQos = new ArrayList<>();
attachments.forEach(o -> attachmentQos.add(AttachmentQo.builder() 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