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

话题列表fix

parent acb44665
......@@ -5,13 +5,12 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
@ApiModel
@Data
public class CreateCommentReq {
@NotEmpty(message = "主题id不能为空")
@NotBlank(message = "主题id不能为空")
@ApiModelProperty(value = "主题Id")
private String themeId;
......
......@@ -4,10 +4,13 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "点赞/取消点赞评论")
import javax.validation.constraints.NotBlank;
@Data
@ApiModel(value = "点赞/取消点赞评论")
public class LikeCommentReq {
@NotBlank
@ApiModelProperty(value = "评论Id")
private String commentId;
......
......@@ -4,19 +4,19 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ApiModel(value = "转发主题")
public class ForwardThemeReq {
@NotEmpty(message = "转发对象id不能为空")
@NotBlank(message = "转发对象id不能为空")
@ApiModelProperty(value = "转发的主题Id")
private String formerThemeId;
@NotNull(message = "内容不能为空")
@NotEmpty(message = "内容不能为空")
@ApiModelProperty(value = "转发的讨论内容")
private List<ThemeContentReq> content;
......
......@@ -14,6 +14,7 @@ import com.tanpu.community.util.PageUtils;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -34,7 +35,7 @@ public class CommentController {
@AuthLogin
@PostMapping(value = "/publishComment")
@ResponseBody
public CommonResp<Void> publishCommet(@RequestBody CreateCommentReq req) {
public CommonResp<Void> publishCommet(@Validated @RequestBody CreateCommentReq req) {
String userId = userHolder.getUserId();
commentManager.comment(req, userId);
return CommonResp.success();
......@@ -44,7 +45,7 @@ public class CommentController {
@AuthLogin
@PostMapping(value = "/queryComment")
@ResponseBody
public CommonResp<Page<CommentQo>> queryComment(@RequestBody QueryCommentReq req) {
public CommonResp<Page<CommentQo>> queryComment(@Validated @RequestBody QueryCommentReq req) {
String userId = userHolder.getUserId();
List<CommentQo> result = commentManager.queryComments(req.getThemeId(), userId);
return CommonResp.success(PageUtils.page(req.getPage(), result));
......@@ -54,7 +55,7 @@ public class CommentController {
@PostMapping(value = "/likeComment")
@AuthLogin
@ResponseBody
public CommonResp<Void> likeComment(@RequestBody LikeCommentReq req) {
public CommonResp<Void> likeComment(@Validated @RequestBody LikeCommentReq req) {
String userId = userHolder.getUserId();
commentManager.likeComment(req, userId);
return CommonResp.success();
......
......@@ -64,4 +64,13 @@ public class HomePageController {
return CommonResp.success(themeManager.queryThemesByUser(req,userId));
}
@PostMapping(value = "/commentThemeList")
@ApiOperation("用户评论过的帖子列表")
@ResponseBody
public CommonResp<List<ThemeQo>> commentThemeList(@RequestBody QueryRecordThemeReq req){
String userId="123";
return CommonResp.success(themeManager.queryThemesByUser(req,userId));
}
}
......@@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
......@@ -56,6 +57,7 @@ public class ThemeManager {
private OSSFileService ossFileService;
@Transactional
public void publishTheme(CreateThemeReq req, String userId) {
//TODO 敏感词过滤
......@@ -176,7 +178,7 @@ public class ThemeManager {
.themeType(ThemeTypeEnum.FORWARD.getCode())
.build();
if (StringUtils.isEmpty(req.getEditThemeId())){
if (StringUtils.isEmpty(req.getEditThemeId()) || req.getEditThemeId()== req.getFormerThemeId()){
//新建
themeService.insertTheme(newTheme);
}else {
......@@ -262,8 +264,6 @@ public class ThemeManager {
//组装正文详情
private void buildMainTestExtraInfo(ThemeQo themeQo, String userId) {
//附件列表
String themeId = themeQo.getThemeId();
productService.transferAttachement(themeQo);
//转发原文
buildFormerTheme(themeQo);
......
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