Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
f243eba3
Commit
f243eba3
authored
Jul 19, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
是否收藏
parent
6f87a779
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
2 deletions
+32
-2
ThemeContentQo.java
...java/com/tanpu/community/api/beans/qo/ThemeContentQo.java
+1
-1
ThemeQo.java
...c/main/java/com/tanpu/community/api/beans/qo/ThemeQo.java
+4
-1
TopicHotQo.java
...ain/java/com/tanpu/community/api/beans/qo/TopicHotQo.java
+14
-0
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+13
-0
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/qo/ThemeContentQo.java
View file @
f243eba3
...
...
@@ -17,7 +17,7 @@ import java.util.List;
@NoArgsConstructor
public
class
ThemeContentQo
{
@ApiModelProperty
(
value
=
"RelTypeEnum类型,
8:文本,88:产品 3:直播 6:短视频 2:课程,9:图片
10:多图(讨论)"
)
@ApiModelProperty
(
value
=
"RelTypeEnum类型,
108:文本,88:产品 3:直播 6:短视频 303:新版课程-视频,新版课程-音频,109:单图(长文) 1
10:多图(讨论)"
)
private
String
type
;
@ApiModelProperty
(
value
=
"文本的值是内容,附件的值为id"
)
...
...
community-api/src/main/java/com/tanpu/community/api/beans/qo/ThemeQo.java
View file @
f243eba3
...
...
@@ -58,7 +58,10 @@ public class ThemeQo implements Serializable {
private
boolean
follow
;
@ApiModelProperty
(
value
=
"作者认证"
)
private
String
authLabel
;
private
Integer
authLabel
;
@ApiModelProperty
(
value
=
"认证机构"
)
private
String
authOrg
;
@ApiModelProperty
(
value
=
"发表时间"
)
private
String
upToNowTime
;
...
...
community-api/src/main/java/com/tanpu/community/api/beans/qo/TopicHotQo.java
View file @
f243eba3
...
...
@@ -16,4 +16,18 @@ public class TopicHotQo {
@ApiModelProperty
(
value
=
"类型 1:热 2:新"
)
private
Integer
type
;
@ApiModelProperty
(
value
=
"阅读量"
)
private
Integer
viewCount
;
@ApiModelProperty
(
value
=
"讨论量"
)
private
Integer
disscussCount
;
/**
* TODO 热度计算算法
* @return
*/
public
Integer
getRank
(){
return
this
.
viewCount
+
this
.
disscussCount
*
5
;
}
}
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
f243eba3
...
...
@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
@Service
public
class
TopicManager
{
...
...
@@ -107,6 +108,18 @@ public class TopicManager {
public
List
<
TopicHotQo
>
getHotTopicTitles
()
{
List
<
TopicEntity
>
topicEntities
=
topicService
.
queryAll
();
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 添加类型:热 新 顶
topicHotQos
.
get
(
0
).
setType
(
1
);
topicHotQos
.
get
(
2
).
setType
(
2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment