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
36c3d6f5
Commit
36c3d6f5
authored
Jul 20, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
评论排序
parent
969228b0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
CommentManager.java
...main/java/com/tanpu/community/manager/CommentManager.java
+7
-7
No files found.
community-service/src/main/java/com/tanpu/community/manager/CommentManager.java
View file @
36c3d6f5
...
@@ -17,8 +17,10 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -17,8 +17,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.Comparator
;
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
CommentManager
{
public
class
CommentManager
{
...
@@ -68,11 +70,7 @@ public class CommentManager {
...
@@ -68,11 +70,7 @@ public class CommentManager {
}
}
//是否点赞及点赞数
//是否点赞及点赞数
String
commentId
=
commentQo
.
getCommentId
();
String
commentId
=
commentQo
.
getCommentId
();
if
(
likeCommentList
.
contains
(
commentId
))
{
commentQo
.
setHasLiked
(
likeCommentList
.
contains
(
commentId
));
commentQo
.
setHasLiked
(
true
);
}
else
{
commentQo
.
setHasLiked
(
false
);
}
Integer
countByTypeAndId
=
collectionService
.
getCountByTypeAndId
(
commentId
,
CollectionTypeEnum
.
LIKE_COMMENT
);
Integer
countByTypeAndId
=
collectionService
.
getCountByTypeAndId
(
commentId
,
CollectionTypeEnum
.
LIKE_COMMENT
);
commentQo
.
setLikeCount
(
countByTypeAndId
);
commentQo
.
setLikeCount
(
countByTypeAndId
);
...
@@ -81,8 +79,10 @@ public class CommentManager {
...
@@ -81,8 +79,10 @@ public class CommentManager {
// List<CommentLv2Qo> commentLv2Qos = ConvertUtil.commentLv2Entity2Qos(CommentLv2Entities);
// List<CommentLv2Qo> commentLv2Qos = ConvertUtil.commentLv2Entity2Qos(CommentLv2Entities);
// commentQo.setCommentLv2Qos(commentLv2Qos);
// commentQo.setCommentLv2Qos(commentLv2Qos);
}
}
//排序
return
commentQos
;
return
commentQos
.
stream
().
sorted
(
Comparator
.
comparing
(
CommentQo:
:
getLikeCount
,
Comparator
.
reverseOrder
()).
thenComparing
(
CommentQo:
:
getUpdateTime
,
Comparator
.
reverseOrder
()))
.
collect
(
Collectors
.
toList
());
}
}
//点赞评论/取消点赞
//点赞评论/取消点赞
...
...
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