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
2c139d2d
Commit
2c139d2d
authored
Jul 21, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
topic返回对象优化
parent
7754ef0c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
12 deletions
+44
-12
ThemeAnalysDO.java
.../java/com/tanpu/community/api/beans/qo/ThemeAnalysDO.java
+6
-5
ThemeQo.java
...c/main/java/com/tanpu/community/api/beans/qo/ThemeQo.java
+11
-1
CommentService.java
...main/java/com/tanpu/community/service/CommentService.java
+6
-5
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+3
-1
create.sql
docs/create.sql
+18
-0
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/qo/ThemeAnalysDO.java
View file @
2c139d2d
...
...
@@ -46,11 +46,12 @@ public class ThemeAnalysDO {
@ApiModelProperty
(
value
=
"距今时间"
)
private
Long
minuteTillNow
;
public
Double
getRank
(){
double
p
=
(
double
)
(
viewCount
+
forwardCount
+
commentCount
+
likeCount
+
collectCount
);
double
t
=
Double
.
valueOf
(
minuteTillNow
);
double
g
=
1.8
;
double
rank
=(
p
)/
Math
.
pow
(
t
+
2
,
g
);
public
Double
getScore
()
{
double
w
=
(
double
)
(
viewCount
+
forwardCount
+
commentCount
+
likeCount
+
collectCount
);
double
i
=
10
;
//初试权重
double
t
=
Double
.
valueOf
(
minuteTillNow
)
/
60
;
double
g
=
1.2
;
//时间系数
double
rank
=
(
w
+
i
)
/
Math
.
pow
(
t
+
2
,
g
);
return
rank
;
}
...
...
community-api/src/main/java/com/tanpu/community/api/beans/qo/ThemeQo.java
View file @
2c139d2d
...
...
@@ -56,7 +56,7 @@ public class ThemeQo implements Serializable {
@ApiModelProperty
(
value
=
"当前用户是否关注该作者"
)
public
boolean
follow
;
//认证标签相关
@ApiModelProperty
(
"认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾"
)
private
Integer
levelGrade
;
@ApiModelProperty
(
"认证标签用-当levelGrade=10有值 1投资萌新 2投资达人"
)
...
...
@@ -68,6 +68,7 @@ public class ThemeQo implements Serializable {
@ApiModelProperty
(
"认证标签用-所属机构名"
)
private
String
belongUserOrgName
;
@ApiModelProperty
(
value
=
"认证机构"
)
private
String
authOrg
;
...
...
@@ -105,4 +106,13 @@ public class ThemeQo implements Serializable {
public
Long
updateTime
;
//工作室相关
@ApiModelProperty
(
"工作室展示状态 1不展示 2展示(未认证) 3展示(已认证)"
)
private
Integer
workshopStatus
=
1
;
//工作室展示状态
@ApiModelProperty
(
"工作室名"
)
private
String
workshopName
;
//工作室名
@ApiModelProperty
(
"工作室简介"
)
private
String
workshopIntroduction
;
//工作室简介
}
community-service/src/main/java/com/tanpu/community/service/CommentService.java
View file @
2c139d2d
...
...
@@ -68,11 +68,12 @@ public class CommentService {
.
eq
(
CommentEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
())
.
eq
(
CommentEntity:
:
getIsBlock
,
StatusEnum
.
FALSE
.
getCode
())
.
orderByDesc
(
CommentEntity:
:
getCreateTime
);
if
(
parentId
==
null
)
{
queryWrapper
.
isNull
(
CommentEntity:
:
getParentId
);
}
else
{
queryWrapper
.
eq
(
CommentEntity:
:
getParentId
,
parentId
);
}
//二级评论,暂未开放,注意“”与null的区别
// if (parentId == null) {
// queryWrapper.isNull(CommentEntity::getParentId);
// } else {
// queryWrapper.eq(CommentEntity::getParentId, parentId);
// }
return
commentMapper
.
selectList
(
queryWrapper
);
}
...
...
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
2c139d2d
...
...
@@ -53,7 +53,9 @@ public class RankService {
theme
.
setCollectCount
(
bookCount
);
theme
.
setViewCount
(
viewCount
);
}
Map
<
ThemeAnalysDO
,
Double
>
map
=
themeAnalysDOS
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
,
ThemeAnalysDO:
:
getRank
));
//打分
Map
<
ThemeAnalysDO
,
Double
>
map
=
themeAnalysDOS
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
,
ThemeAnalysDO:
:
getScore
));
//排序
rankThemeList
=
map
.
entrySet
().
stream
().
sorted
(
Map
.
Entry
.
comparingByValue
(
Comparator
.
reverseOrder
())).
map
(
e
->
e
.
getKey
().
getThemeId
()).
collect
(
Collectors
.
toList
());
}
...
...
docs/create.sql
View file @
2c139d2d
...
...
@@ -168,3 +168,21 @@ CREATE TABLE `visit_summary` (
INDEX
`idx_visitor`
(
`visitor_id`
),
INDEX
`idx_author`
(
`author_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'浏览记录'
;
CREATE
TABLE
`report_log`
(
`id`
int
(
32
)
auto_increment
PRIMARY
KEY
COMMENT
'id'
,
`user_id`
varchar
(
64
)
NOT
NULL
COMMENT
'举报发起人'
,
`report_type`
int
(
4
)
NOT
NULL
COMMENT
'举报类型,1:主题,2:评论 3、用户'
,
`target_id`
varchar
(
64
)
NOT
NULL
COMMENT
'举报对象id'
,
`target_user_id`
varchar
(
64
)
NOT
NULL
COMMENT
'举报对象作者id'
,
`report_time`
datetime
NOT
NULL
COMMENT
'上报时间'
,
`deal_result`
int
(
4
)
COMMENT
'处理结果 0:无操作 1:屏蔽 2:删除 '
,
`deal_user_id`
int
(
4
)
COMMENT
'处理管理员'
,
`deal_time`
datetime
COMMENT
'处理时间'
,
`create_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
,
`update_time`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
,
`delete_tag`
int
(
3
)
NOT
NULL
DEFAULT
'0'
,
INDEX
`uk_user`
(
`user_id`
),
INDEX
`uk_report_target_id`
(
`target_id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COMMENT
=
'举报记录'
;
\ No newline at end of file
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