Commit 073385d6 authored by 刘基明's avatar 刘基明

添加话题不存在异常

parent 2abb920c
......@@ -31,7 +31,7 @@ public class TopicController {
@PostMapping(value = "/list")
@ApiOperation("APP全部话题页面,可搜索")
@ResponseBody
public CommonResp<Page<TopicRankQo>> getTopicBriefInfoList(@RequestBody TopicSearchReq req){
public CommonResp<Page<TopicRankQo>> getTopicList(@RequestBody TopicSearchReq req){
return CommonResp.success(topicManager.getAllTopicBriefInfo(req));
}
......@@ -39,7 +39,7 @@ public class TopicController {
@GetMapping(value = "/detailPage")
@ApiOperation("话题详情页顶部")
@ResponseBody
public CommonResp<TopicRankQo> gethotThemes(@RequestParam String topicId){
public CommonResp<TopicRankQo> getDetail(@RequestParam String topicId){
return CommonResp.success(topicManager.getDetail(topicId));
}
......@@ -47,7 +47,7 @@ public class TopicController {
@GetMapping(value = "/titleList")
@ApiOperation("首页顶部话题标题列")
@ResponseBody
public CommonResp<List<TopicRankQo>> getTitleList(){
public CommonResp<List<TopicRankQo>> getTop4Topic(){
return CommonResp.success(topicManager.getTop4TopicTitles());
}
......
package com.tanpu.community.manager;
import com.tanpu.common.auth.UserHolder;
import com.tanpu.common.constant.ErrorCodeConstant;
import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.qo.TopicRankQo;
import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.beans.req.topic.TopicSearchReq;
import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.service.RankService;
import com.tanpu.community.service.TopicService;
import com.tanpu.community.service.VisitLogService;
import com.tanpu.community.util.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import static com.tanpu.biz.common.enums.clue.PageEnum.COMM_VISIT_TOPIC_DETAIL;
@Service
public class TopicManager {
@Autowired
private VisitLogService visitLogService;
private TopicService topicService;
@Autowired
private RankService rankService;
@Resource
private UserHolder userHolder;
// 首页-话题标签
......@@ -43,10 +39,11 @@ public class TopicManager {
}
// 话题详情页
public TopicRankQo getDetail(String topicId) {
//TODO 临时埋点,接入新埋点后删除
visitLogService.addPageView(userHolder.getUserId(), topicId, COMM_VISIT_TOPIC_DETAIL);
TopicEntity topicEntity = topicService.queryById(topicId);
if (topicEntity==null){
throw new BizException(ErrorCodeConstant.TOPIC_NOT_FOUND);
}
return rankService.getTopicDetail(topicId);
}
......
......@@ -75,7 +75,10 @@ public class TopicService {
}
public TopicEntity queryById(String topicId) {
return topicMapper.selectOne(new LambdaQueryWrapper<TopicEntity>().eq(TopicEntity::getTopicId, topicId));
return topicMapper.selectOne(new LambdaQueryWrapper<TopicEntity>()
.eq(TopicEntity::getTopicId, topicId)
.eq(TopicEntity::getIsConceal, StatusEnum.FALSE)
.eq(TopicEntity::getDeleteTag, StatusEnum.FALSE));
}
public List<TopicEntity> queryByIds(List<String> topicIds) {
......
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