Commit 3d62a020 authored by 刘基明's avatar 刘基明

接口调整

parent c4ed5301
...@@ -9,7 +9,7 @@ import java.time.LocalDateTime; ...@@ -9,7 +9,7 @@ import java.time.LocalDateTime;
@Data @Data
@ApiModel(value="TopicDTO对象", description="话题") @ApiModel(value="TopicDTO对象", description="话题")
public class TopicDTO implements Serializable { public class TopicDO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -2,8 +2,6 @@ package com.tanpu.community.api.beans.qo; ...@@ -2,8 +2,6 @@ package com.tanpu.community.api.beans.qo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.util.List;
public class TopicDetailQo { public class TopicDetailQo {
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
...@@ -18,5 +16,4 @@ public class TopicDetailQo { ...@@ -18,5 +16,4 @@ public class TopicDetailQo {
@ApiModelProperty(value = "讨论量") @ApiModelProperty(value = "讨论量")
private Integer disscussCount; private Integer disscussCount;
private List<ThemeQo> themes;
} }
package com.tanpu.community.api.beans.req.theme;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ThemeListByTopicReq {
@ApiModelProperty(value = "当前浏览的最后一个themeId")
private String lastId;
@ApiModelProperty(value = "页面大小")
private Integer PageSize;
@ApiModelProperty(value = "类型,1:最热 2:最新")
private Integer type;
@ApiModelProperty(value = "话题Id")
private String topicId;
}
...@@ -10,6 +10,8 @@ public class ThemeListReq { ...@@ -10,6 +10,8 @@ public class ThemeListReq {
private String lastId; private String lastId;
@ApiModelProperty(value = "页面大小") @ApiModelProperty(value = "页面大小")
private Integer PageSize; private Integer PageSize;
@ApiModelProperty(value = "类型,1:推荐 2:关注")
private Integer type;
} }
...@@ -2,7 +2,7 @@ package com.tanpu.community.controller; ...@@ -2,7 +2,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.TopicDTO; import com.tanpu.community.api.beans.TopicDO;
import com.tanpu.community.api.beans.TopicDataAnalysDTO; import com.tanpu.community.api.beans.TopicDataAnalysDTO;
import com.tanpu.community.api.beans.req.topic.TopicConcealReq; import com.tanpu.community.api.beans.req.topic.TopicConcealReq;
import com.tanpu.community.api.beans.req.topic.TopicModifyMountReq; import com.tanpu.community.api.beans.req.topic.TopicModifyMountReq;
...@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*;
@RestController @RestController
@Slf4j @Slf4j
@RequestMapping(value = "/api/admin") @RequestMapping(value = "/api/admin/topic")
public class AdminController { public class AdminController {
...@@ -27,7 +27,7 @@ public class AdminController { ...@@ -27,7 +27,7 @@ public class AdminController {
@Autowired @Autowired
private UserHolder userHolder; private UserHolder userHolder;
@GetMapping(value="/insertTopic") @GetMapping(value="/add")
@ApiOperation("新增话题") @ApiOperation("新增话题")
@ResponseBody @ResponseBody
public CommonResp<Void> addTopic(@RequestParam String topicTitle){ public CommonResp<Void> addTopic(@RequestParam String topicTitle){
...@@ -37,17 +37,17 @@ public class AdminController { ...@@ -37,17 +37,17 @@ public class AdminController {
} }
@ApiOperation("单个话题详细数据") @ApiOperation("单个话题详细数据")
@PostMapping("/topic/detailData") @PostMapping("/detailData")
@ResponseBody @ResponseBody
public CommonResp<TopicDTO> selectOne(@RequestParam String topicId) throws MissingServletRequestParameterException { public CommonResp<TopicDO> selectOne(@RequestParam String topicId) throws MissingServletRequestParameterException {
if (StringUtils.isEmpty(topicId)){ if (StringUtils.isEmpty(topicId)){
throw new MissingServletRequestParameterException("topicId","String"); throw new MissingServletRequestParameterException("topicId","String");
} }
TopicDTO topicDTO=topicManager.getDetail(topicId); TopicDO topicDO =topicManager.getDetail(topicId);
return CommonResp.success(topicDTO); return CommonResp.success(topicDO);
} }
@PostMapping(value = "/topic/setTop") @PostMapping(value = "/setTop")
@ApiOperation("顶置/取消顶置话题") @ApiOperation("顶置/取消顶置话题")
@ResponseBody @ResponseBody
public CommonResp<Void> setTopTopic(@RequestBody TopicTopReq req) throws MissingServletRequestParameterException { public CommonResp<Void> setTopTopic(@RequestBody TopicTopReq req) throws MissingServletRequestParameterException {
...@@ -55,7 +55,7 @@ public class AdminController { ...@@ -55,7 +55,7 @@ public class AdminController {
return CommonResp.success(); return CommonResp.success();
} }
@PostMapping(value = "/topic/setConceal") @PostMapping(value = "/setConceal")
@ApiOperation("隐藏/显示话题") @ApiOperation("隐藏/显示话题")
@ResponseBody @ResponseBody
public CommonResp<Void> setConceal(@RequestBody TopicConcealReq req) throws MissingServletRequestParameterException { public CommonResp<Void> setConceal(@RequestBody TopicConcealReq req) throws MissingServletRequestParameterException {
...@@ -63,7 +63,7 @@ public class AdminController { ...@@ -63,7 +63,7 @@ public class AdminController {
return CommonResp.success(); return CommonResp.success();
} }
@PostMapping(value = "/topic/modifyViewNum") @PostMapping(value = "/modifyViewNum")
@ApiOperation("话题浏览数调整(后台管理)") @ApiOperation("话题浏览数调整(后台管理)")
@ResponseBody @ResponseBody
public CommonResp<Void> modifyViewNum(@RequestBody TopicModifyMountReq req) throws MissingServletRequestParameterException { public CommonResp<Void> modifyViewNum(@RequestBody TopicModifyMountReq req) throws MissingServletRequestParameterException {
...@@ -71,7 +71,7 @@ public class AdminController { ...@@ -71,7 +71,7 @@ public class AdminController {
return CommonResp.success(); return CommonResp.success();
} }
@PostMapping(value = "/topic/dataAnalyse") @PostMapping(value = "/dataAnalyse")
@ApiOperation("话题数据分析") @ApiOperation("话题数据分析")
@ResponseBody @ResponseBody
public CommonResp<TopicDataAnalysDTO> dataAnalyse(@RequestParam String topicId) throws MissingServletRequestParameterException { public CommonResp<TopicDataAnalysDTO> dataAnalyse(@RequestParam String topicId) throws MissingServletRequestParameterException {
......
...@@ -42,7 +42,7 @@ public class CommentController { ...@@ -42,7 +42,7 @@ public class CommentController {
@ApiOperation("点赞评论") @ApiOperation("点赞评论")
@PostMapping(value = "/likeComment") @PostMapping(value = "/likeComment")
@ResponseBody @ResponseBody
public CommonResp likeComment(@RequestParam String themeId){ public CommonResp<Void> likeComment(@RequestParam String commentId){
//todo //todo
String userId = "liujm"; String userId = "liujm";
return CommonResp.success(); return CommonResp.success();
...@@ -51,7 +51,7 @@ public class CommentController { ...@@ -51,7 +51,7 @@ public class CommentController {
@ApiOperation("举报评论") @ApiOperation("举报评论")
@PostMapping(value = "/reportComment") @PostMapping(value = "/reportComment")
@ResponseBody @ResponseBody
public CommonResp reportComment(@RequestParam String themeId){ public CommonResp<Void> reportComment(@RequestParam String commentId){
//todo //todo
String userId = "liujm"; String userId = "liujm";
return CommonResp.success(); return CommonResp.success();
......
...@@ -6,6 +6,7 @@ import com.tanpu.community.api.beans.ForwardThemeReq; ...@@ -6,6 +6,7 @@ import com.tanpu.community.api.beans.ForwardThemeReq;
import com.tanpu.community.api.beans.qo.MainTextQo; import com.tanpu.community.api.beans.qo.MainTextQo;
import com.tanpu.community.api.beans.qo.ThemeQo; import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.CreateThemeReq; import com.tanpu.community.api.beans.req.CreateThemeReq;
import com.tanpu.community.api.beans.req.theme.ThemeListByTopicReq;
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 com.tanpu.community.service.FollowRelService; import com.tanpu.community.service.FollowRelService;
...@@ -37,20 +38,28 @@ public class ThemeController { ...@@ -37,20 +38,28 @@ public class ThemeController {
return CommonResp.success(); return CommonResp.success();
} }
@ApiOperation("圈子首页-推荐")
@GetMapping (value = "/recommendList")
@ApiOperation("圈子首页-推荐/关注")
@GetMapping(value = "/list")
@ResponseBody @ResponseBody
public List<ThemeQo> selectHotList(ThemeListReq req) { public List<ThemeQo> selectInterestList(@RequestBody ThemeListReq req) {
String userId = "liujm"; String userId = "liujm";
if (req.getType()==1){
return themeManager.selectHotThemes(req,userId); return themeManager.selectHotThemes(req,userId);
}else {
return themeManager.selectInterestThemes(req,userId);
}
} }
@ApiOperation("圈子首页-关注")
@GetMapping(value = "/followList") @ApiOperation("话题详情页-最新/最热")
@GetMapping(value = "/listByTopic")
@ResponseBody @ResponseBody
public List<ThemeQo> selectInterestList(ThemeListReq req) { public CommonResp<List<ThemeQo>> getThemeMainText(@RequestBody ThemeListByTopicReq req) {
String userId = "liujm012"; String userId = "liujm";
return themeManager.selectInterestThemes(req,userId); List<ThemeQo> result= themeManager.queryByTopic(req,userId);
return CommonResp.success(result);
} }
......
...@@ -2,18 +2,16 @@ package com.tanpu.community.controller; ...@@ -2,18 +2,16 @@ 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.ThemeQo; import com.tanpu.community.api.beans.qo.TopicDetailQo;
import com.tanpu.community.api.beans.qo.TopicTitileQo; import com.tanpu.community.api.beans.qo.TopicTitileQo;
import com.tanpu.community.api.beans.req.topic.TopicSearchReq;
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.manager.TopicManager; import com.tanpu.community.manager.TopicManager;
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;
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")
...@@ -34,23 +32,15 @@ public class TopicController { ...@@ -34,23 +32,15 @@ public class TopicController {
return CommonResp.success(allTopic); return CommonResp.success(allTopic);
} }
@GetMapping(value = "/hotThemes") @GetMapping(value = "/detailPage")
@ApiOperation("话题详情页") @ApiOperation("话题详情页顶部")
@ResponseBody @ResponseBody
public CommonResp<List<ThemeQo>> gethotThemes(@RequestParam String topicId){ public CommonResp<TopicDetailQo> gethotThemes(@RequestParam String topicId){
//todo //todo
return CommonResp.success(); return CommonResp.success();
} }
@GetMapping(value = "/latestThemes")
@ApiOperation("话题详情页")
@ResponseBody
public CommonResp<List<ThemeQo>> getlatestThemes(@RequestParam String topicId){
//todo
return CommonResp.success();
}
......
...@@ -7,6 +7,7 @@ import com.tanpu.community.api.beans.qo.AttachmentQo; ...@@ -7,6 +7,7 @@ import com.tanpu.community.api.beans.qo.AttachmentQo;
import com.tanpu.community.api.beans.qo.MainTextQo; import com.tanpu.community.api.beans.qo.MainTextQo;
import com.tanpu.community.api.beans.qo.ThemeQo; import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.CreateThemeReq; import com.tanpu.community.api.beans.req.CreateThemeReq;
import com.tanpu.community.api.beans.req.theme.ThemeListByTopicReq;
import com.tanpu.community.api.beans.req.theme.ThemeListReq; import com.tanpu.community.api.beans.req.theme.ThemeListReq;
import com.tanpu.community.api.enums.BlockTypeEnum; import com.tanpu.community.api.enums.BlockTypeEnum;
import com.tanpu.community.api.enums.CollectionTypeEnum; import com.tanpu.community.api.enums.CollectionTypeEnum;
...@@ -322,4 +323,8 @@ public class ThemeManager { ...@@ -322,4 +323,8 @@ public class ThemeManager {
return start.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); return start.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
} }
public List<ThemeQo> queryByTopic(ThemeListByTopicReq req, String userId) {
//TODO
return null;
}
} }
package com.tanpu.community.manager; package com.tanpu.community.manager;
import com.tanpu.common.exception.BizException; import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.TopicDTO; import com.tanpu.community.api.beans.TopicDO;
import com.tanpu.community.api.beans.TopicDataAnalysDTO; import com.tanpu.community.api.beans.TopicDataAnalysDTO;
import com.tanpu.community.api.beans.qo.TopicTitileQo; import com.tanpu.community.api.beans.qo.TopicTitileQo;
import com.tanpu.community.api.beans.req.topic.TopicSearchReq; import com.tanpu.community.api.beans.req.topic.TopicSearchReq;
...@@ -49,7 +49,7 @@ public class TopicManager { ...@@ -49,7 +49,7 @@ public class TopicManager {
} }
//话题详情列表 //话题详情列表
public List<TopicDTO> getAllTopicDetail() { public List<TopicDO> getAllTopicDetail() {
return ConvertUtil.topicEntitiesToDTOs(topicService.queryAll()); return ConvertUtil.topicEntitiesToDTOs(topicService.queryAll());
} }
...@@ -93,16 +93,16 @@ public class TopicManager { ...@@ -93,16 +93,16 @@ public class TopicManager {
} }
} }
public TopicDTO getDetail(String topicId) { public TopicDO getDetail(String topicId) {
TopicEntity topicEntity = topicService.queryById(topicId); TopicEntity topicEntity = topicService.queryById(topicId);
if (topicEntity == null) { if (topicEntity == null) {
throw new BizException("找不到话题,id:" + topicId); throw new BizException("找不到话题,id:" + topicId);
} }
TopicDTO topicDTO = ConvertUtil.topicEntityToDTO(topicEntity); TopicDO topicDO = ConvertUtil.topicEntityToDTO(topicEntity);
topicDTO.setViewCount(redisService.getInteger(RedisKeyConstant.TOPIC_TOTAL_VIEW_COUNT_ + topicId)); topicDO.setViewCount(redisService.getInteger(RedisKeyConstant.TOPIC_TOTAL_VIEW_COUNT_ + topicId));
topicDTO.setLikeCount(redisService.getInteger(RedisKeyConstant.TOPIC_LIKE_COUNT_ + topicId)); topicDO.setLikeCount(redisService.getInteger(RedisKeyConstant.TOPIC_LIKE_COUNT_ + topicId));
topicDTO.setUserCount(redisService.getInteger(RedisKeyConstant.TOPIC_USER_COUNT_ + topicId)); topicDO.setUserCount(redisService.getInteger(RedisKeyConstant.TOPIC_USER_COUNT_ + topicId));
return topicDTO; return topicDO;
} }
public void modifyViewCount(String topicId, Long modifyMount) { public void modifyViewCount(String topicId, Long modifyMount) {
......
package com.tanpu.community.util; package com.tanpu.community.util;
import com.tanpu.community.api.beans.qo.TopicTitileQo; import com.tanpu.community.api.beans.qo.TopicTitileQo;
import com.tanpu.community.api.beans.TopicDTO; import com.tanpu.community.api.beans.TopicDO;
import com.tanpu.community.api.beans.qo.CommentLv2Qo; import com.tanpu.community.api.beans.qo.CommentLv2Qo;
import com.tanpu.community.api.beans.qo.CommentQo; import com.tanpu.community.api.beans.qo.CommentQo;
import com.tanpu.community.api.beans.qo.FollowQo; import com.tanpu.community.api.beans.qo.FollowQo;
...@@ -41,10 +41,10 @@ public class ConvertUtil { ...@@ -41,10 +41,10 @@ public class ConvertUtil {
} }
public static TopicDTO topicEntityToDTO(TopicEntity topicEntity) { public static TopicDO topicEntityToDTO(TopicEntity topicEntity) {
TopicDTO topicDTO = new TopicDTO(); TopicDO topicDO = new TopicDO();
BeanUtils.copyProperties(topicEntity, topicDTO); BeanUtils.copyProperties(topicEntity, topicDO);
return topicDTO; return topicDO;
} }
public static TopicTitileQo topicToBriefInfoDTO(TopicEntity topicEntity) { public static TopicTitileQo topicToBriefInfoDTO(TopicEntity topicEntity) {
...@@ -72,7 +72,7 @@ public class ConvertUtil { ...@@ -72,7 +72,7 @@ public class ConvertUtil {
return entities.stream().map(ConvertUtil::commentLv2Entity2Qo).collect(Collectors.toList()); return entities.stream().map(ConvertUtil::commentLv2Entity2Qo).collect(Collectors.toList());
} }
public static List<TopicDTO> topicEntitiesToDTOs(List<TopicEntity> topicEntities) { public static List<TopicDO> topicEntitiesToDTOs(List<TopicEntity> topicEntities) {
return topicEntities.stream().map(ConvertUtil::topicEntityToDTO).collect(Collectors.toList()); return topicEntities.stream().map(ConvertUtil::topicEntityToDTO).collect(Collectors.toList());
} }
......
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