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

bugfix

parent a17858d2
......@@ -7,6 +7,7 @@ import com.tanpu.community.api.enums.TopicStatusEnum;
import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.util.ConvertUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -66,6 +67,11 @@ public class RankService {
}
for (TopicHotQo topic : topicHotQos) {
List<String> themeIds = themeService.queryThemeIdsByTopic(topic.getTopicId());
if (CollectionUtils.isEmpty(themeIds)){
topic.setViewCount(0);
topic.setDisscussCount(0);
continue;
}
//浏览量
Integer topicPV = visitSummaryService.queryTopicDetailVisit(topic.getTopicId());
Integer themePV = visitSummaryService.queryThemeVisit(themeIds);
......
......@@ -46,6 +46,9 @@ public class VisitSummaryService {
// 查询主题 浏览量
public Integer queryThemeVisit(List<String> themes) {
if (CollectionUtils.isEmpty(themes)){
return 0;
}
return visitSummaryMapper.selectCount(new LambdaQueryWrapper<VisitSummaryEntity>()
.in(VisitSummaryEntity::getRefId, themes)
.eq(VisitSummaryEntity::getRefType, VisitTypeEnum.TOPIC_PAGE_VIEW.getCode()));
......
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