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

添加话题不存在异常

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