Commit 0b385b67 authored by 刘基明's avatar 刘基明

dev接口测试

parent 92f48f88
...@@ -48,7 +48,6 @@ public class ThemeQo { ...@@ -48,7 +48,6 @@ public class ThemeQo {
@ApiModelProperty(value = "发表时间") @ApiModelProperty(value = "发表时间")
private String upToNowTime; private String upToNowTime;
@ApiModelProperty(value = "转发量") @ApiModelProperty(value = "转发量")
private Integer forwardCount; private Integer forwardCount;
...@@ -58,13 +57,15 @@ public class ThemeQo { ...@@ -58,13 +57,15 @@ public class ThemeQo {
@ApiModelProperty(value = "点赞量") @ApiModelProperty(value = "点赞量")
private Integer likeCount; private Integer likeCount;
@ApiModelProperty(value = "当前用户是否点赞")
private boolean isLiked;
@ApiModelProperty(value = "图片九宫格") @ApiModelProperty(value = "图片九宫格")
private List<ImagesDTO> imgList; private List<ImagesDTO> imgList;
@ApiModelProperty(value = "转发的主题") @ApiModelProperty(value = "转发的主题")
private ThemeFormerQo formerTheme; private ThemeFormerQo formerTheme;
private LocalDateTime createTime; private LocalDateTime createTime;
private LocalDateTime updateTime; private LocalDateTime updateTime;
......
package com.tanpu.community.api.beans.req.theme; package com.tanpu.community.api.beans.req.comment;
import com.tanpu.community.api.beans.req.theme.ThemeContentReq;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
......
package com.tanpu.community.api.beans.req.comment;
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;
@ApiModel(value = "评论查询")
@Data
public class QueryCommentReq {
@NotEmpty(message = "主题id不能为空")
@ApiModelProperty(value = "主题Id")
private String themeId;
@NotEmpty(message = "page不能为空")
@ApiModelProperty(value = "分页")
private Pageable page;
}
...@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@Data @Data
@ApiModel(value = "查询关注/粉丝列表") @ApiModel(value = "查询关注/粉丝列表")
...@@ -19,7 +20,7 @@ public class QueryFollowReq { ...@@ -19,7 +20,7 @@ public class QueryFollowReq {
@ApiModelProperty(value = "查询类型,1:粉丝 2:关注") @ApiModelProperty(value = "查询类型,1:粉丝 2:关注")
private Integer queryType; private Integer queryType;
@NotEmpty(message = "page不能为空") @NotNull(message = "page不能为空")
@ApiModelProperty(value = "分页") @ApiModelProperty(value = "分页")
private Pageable page; private Pageable page;
} }
package com.tanpu.community.api.beans.req.theme;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "请求")
@Data
public class LikeThemeReq {
@ApiModelProperty(value = "主题Id")
private String themeId;
@ApiModelProperty(value = "类型,1:点赞 2:取消点赞")
private Integer type;
}
...@@ -3,8 +3,11 @@ package com.tanpu.community.controller; ...@@ -3,8 +3,11 @@ 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.theme.CreateCommentReq; import com.tanpu.community.api.beans.req.comment.CreateCommentReq;
import com.tanpu.community.api.beans.req.comment.QueryCommentReq;
import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.manager.CommentManager; import com.tanpu.community.manager.CommentManager;
import com.tanpu.community.util.PageUtils;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -30,13 +33,13 @@ public class CommentController { ...@@ -30,13 +33,13 @@ public class CommentController {
} }
@ApiOperation("查看评论") @ApiOperation("查看评论")
@GetMapping(value = "/queryComment") @PostMapping(value = "/queryComment")
@ResponseBody @ResponseBody
public CommonResp<List<CommentQo>> queryComment(@RequestParam String themeId){ public CommonResp<Page<CommentQo>> queryComment(@RequestBody QueryCommentReq req){
//todo //todo
String userId = "liujm"; String userId = "liujm";
List<CommentQo> result = commentManager.queryComments(themeId,userId); List<CommentQo> result = commentManager.queryComments(req.getThemeId(),userId);
return CommonResp.success(result); return CommonResp.success(PageUtils.page(req.getPage(), result));
} }
@ApiOperation("点赞评论") @ApiOperation("点赞评论")
......
...@@ -5,6 +5,7 @@ import com.tanpu.common.api.CommonResp; ...@@ -5,6 +5,7 @@ import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.qo.ThemeQo; import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.theme.CreateThemeReq; import com.tanpu.community.api.beans.req.theme.CreateThemeReq;
import com.tanpu.community.api.beans.req.theme.ForwardThemeReq; import com.tanpu.community.api.beans.req.theme.ForwardThemeReq;
import com.tanpu.community.api.beans.req.theme.LikeThemeReq;
import com.tanpu.community.api.beans.req.theme.ThemeListReq; import com.tanpu.community.api.beans.req.theme.ThemeListReq;
import com.tanpu.community.manager.ThemeManager; import com.tanpu.community.manager.ThemeManager;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -66,11 +67,11 @@ public class ThemeController { ...@@ -66,11 +67,11 @@ public class ThemeController {
@ApiOperation("点赞主题") @ApiOperation("点赞主题")
@GetMapping(value = "/like") @PostMapping(value = "/like")
@ResponseBody @ResponseBody
public CommonResp likeOnTheme(@RequestParam String themeId) { public CommonResp likeOnTheme(@RequestBody LikeThemeReq req) {
String user = "liujm"; String user = "liujm";
themeManager.like(themeId, user); themeManager.like(req, user);
return CommonResp.success(); return CommonResp.success();
} }
......
...@@ -23,7 +23,7 @@ public class CodeAutoGenerator { ...@@ -23,7 +23,7 @@ public class CodeAutoGenerator {
String mysqlPassword = "qimeng123"; String mysqlPassword = "qimeng123";
String jdbcUrl = "jdbc:mysql://47.101.189.151:31931/tamp_community"; String jdbcUrl = "jdbc:mysql://47.101.189.151:31931/tamp_community";
// String[] tables = new String[]{"follow_rel"}; // String[] tables = new String[]{"follow_rel"};
String[] tables = new String[]{"visit_summary", "black_list","collection","comment","follow_rel","file_record","home_page","theme","topic","theme_attachment"}; String[] tables = new String[]{"follow_rel", "black_list","collection","comment","follow_rel","file_record","home_page","theme","topic","theme_attachment"};
String basePackage = "com.tanpu.community"; String basePackage = "com.tanpu.community";
String mapperPackage = "dao.mapper.community"; String mapperPackage = "dao.mapper.community";
String entityPackage = "dao.entity.community"; String entityPackage = "dao.entity.community";
......
...@@ -2,7 +2,7 @@ package com.tanpu.community.manager; ...@@ -2,7 +2,7 @@ package com.tanpu.community.manager;
import com.tanpu.common.util.JsonUtil; 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.theme.CreateCommentReq; import com.tanpu.community.api.beans.req.comment.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;
......
...@@ -9,6 +9,7 @@ import com.tanpu.community.api.beans.qo.ThemeQo; ...@@ -9,6 +9,7 @@ import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq; import com.tanpu.community.api.beans.req.homepage.QueryRecordThemeReq;
import com.tanpu.community.api.beans.req.theme.CreateThemeReq; import com.tanpu.community.api.beans.req.theme.CreateThemeReq;
import com.tanpu.community.api.beans.req.theme.ForwardThemeReq; import com.tanpu.community.api.beans.req.theme.ForwardThemeReq;
import com.tanpu.community.api.beans.req.theme.LikeThemeReq;
import com.tanpu.community.api.beans.req.theme.ThemeListReq; import com.tanpu.community.api.beans.req.theme.ThemeListReq;
import com.tanpu.community.api.beans.vo.feign.CoursePackageDetail; import com.tanpu.community.api.beans.vo.feign.CoursePackageDetail;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO; import com.tanpu.community.api.beans.vo.feign.ProductInfoVO;
...@@ -149,9 +150,15 @@ public class ThemeManager { ...@@ -149,9 +150,15 @@ public class ThemeManager {
return themeQo; return themeQo;
} }
// 点赞 // 点赞/取消点赞
public void like(String themeId, String userId) { public void like(LikeThemeReq req, String userId) {
collectionService.addIfNotExist(themeId, userId, CollectionTypeEnum.LIKE_THEME); //todo 枚举值
if (1==req.getType()){
collectionService.addIfNotExist(req.getThemeId(), userId, CollectionTypeEnum.LIKE_THEME);
}else if (2==req.getType()) {
collectionService.delete(req.getThemeId(), userId, CollectionTypeEnum.LIKE_THEME);
}
} }
public void unlike(String themeId, String userId) { public void unlike(String themeId, String userId) {
...@@ -299,7 +306,7 @@ public class ThemeManager { ...@@ -299,7 +306,7 @@ public class ThemeManager {
feignClientForTanpuroom.getShortVideoBaseInfo(Arrays.asList(attachmentIds)); feignClientForTanpuroom.getShortVideoBaseInfo(Arrays.asList(attachmentIds));
themeContentQo.setDetail(AttachmentDetailVo.builder().shortVideoBaseInfoResp(shortVideoBaseInfo.getData().get(0)).build()); themeContentQo.setDetail(AttachmentDetailVo.builder().shortVideoBaseInfoResp(shortVideoBaseInfo.getData().get(0)).build());
} else if (RelTypeEnum.PACKAGE.type.equals(type)) { } else if (RelTypeEnum.NEW_COURSE_WARE.type.equals(type)) {
//课程 //课程
String packageId = themeContentQo.getValue(); String packageId = themeContentQo.getValue();
CommonResp<CoursePackageDetail> courseIdDetailInfo = feignClientForCourse.getCoursePackageDetailInfo(packageId); CommonResp<CoursePackageDetail> courseIdDetailInfo = feignClientForCourse.getCoursePackageDetailInfo(packageId);
......
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