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

是否收藏

parent 6f87a779
...@@ -17,7 +17,7 @@ import java.util.List; ...@@ -17,7 +17,7 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
public class ThemeContentQo { public class ThemeContentQo {
@ApiModelProperty(value = "RelTypeEnum类型,8:文本,88:产品 3:直播 6:短视频 2:课程,9:图片 10:多图(讨论)") @ApiModelProperty(value = "RelTypeEnum类型,108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,新版课程-音频,109:单图(长文) 110:多图(讨论)")
private String type; private String type;
@ApiModelProperty(value = "文本的值是内容,附件的值为id") @ApiModelProperty(value = "文本的值是内容,附件的值为id")
......
...@@ -58,7 +58,10 @@ public class ThemeQo implements Serializable { ...@@ -58,7 +58,10 @@ public class ThemeQo implements Serializable {
private boolean follow; private boolean follow;
@ApiModelProperty(value = "作者认证") @ApiModelProperty(value = "作者认证")
private String authLabel; private Integer authLabel;
@ApiModelProperty(value = "认证机构")
private String authOrg;
@ApiModelProperty(value = "发表时间") @ApiModelProperty(value = "发表时间")
private String upToNowTime; private String upToNowTime;
......
...@@ -16,4 +16,18 @@ public class TopicHotQo { ...@@ -16,4 +16,18 @@ public class TopicHotQo {
@ApiModelProperty(value = "类型 1:热 2:新") @ApiModelProperty(value = "类型 1:热 2:新")
private Integer type; private Integer type;
@ApiModelProperty(value = "阅读量")
private Integer viewCount;
@ApiModelProperty(value = "讨论量")
private Integer disscussCount;
/**
* TODO 热度计算算法
* @return
*/
public Integer getRank(){
return this.viewCount+this.disscussCount*5;
}
} }
...@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service; ...@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
@Service @Service
public class TopicManager { public class TopicManager {
...@@ -107,6 +108,18 @@ public class TopicManager { ...@@ -107,6 +108,18 @@ public class TopicManager {
public List<TopicHotQo> getHotTopicTitles() { public List<TopicHotQo> getHotTopicTitles() {
List<TopicEntity> topicEntities = topicService.queryAll(); List<TopicEntity> topicEntities = topicService.queryAll();
List<TopicHotQo> topicHotQos = ConvertUtil.topicEntityToHotQos(topicEntities); List<TopicHotQo> topicHotQos = ConvertUtil.topicEntityToHotQos(topicEntities);
for (TopicHotQo topic : topicHotQos) {
List<String> themeIds = themeService.queryThemeIdsByTopic(topic.getTopicId());
//浏览量
Integer topicPV = visitSummaryService.queryTopicDetailVisit(topic.getTopicId());
Integer themePV = visitSummaryService.queryThemeVisit(themeIds);
topic.setViewCount(topicPV + themePV);
//讨论数=发布主题贴数+回复总数
Integer commentCount = commentService.getCommentCountByThemeIds(themeIds);
topic.setDisscussCount(themeIds.size() + commentCount);
}
topicHotQos.stream().collect(Collectors.toMap(TopicHotQo::getRank, o->o));
//TODO 添加类型:热 新 顶 //TODO 添加类型:热 新 顶
topicHotQos.get(0).setType(1); topicHotQos.get(0).setType(1);
topicHotQos.get(2).setType(2); topicHotQos.get(2).setType(2);
......
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