fix: issue of abnormal sorting in the aggregation query interface (#2623)

#### What type of PR is this?

/kind bug
/milestone 2.0

#### What this PR does / why we need it:

修复文章、自定义页面、评论聚合查询接口排序不固定的问题。

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/2622

#### Special notes for your reviewer:

测试方式:检查 Console 端的文章、自定义页面、评论、回复的排序是否正常,需要多次刷新检查。

```release-note
修复文章、自定义页面、评论聚合查询接口排序不固定的问题。
```
pull/2626/head
Ryan Wang 2022-10-25 14:24:11 +08:00 committed by GitHub
parent d2aa707071
commit 95f0809042
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 6 deletions

View File

@ -52,7 +52,7 @@ public class CommentServiceImpl implements CommentService {
commentQuery.getPage(), commentQuery.getSize())
.flatMap(comments -> Flux.fromStream(comments.get()
.map(this::toListedComment))
.flatMap(Function.identity())
.concatMap(Function.identity())
.collectList()
.map(list -> new ListResult<>(comments.getPage(), comments.getSize(),
comments.getTotal(), list)

View File

@ -99,7 +99,7 @@ public class ReplyServiceImpl implements ReplyService {
query.getPage(), query.getSize())
.flatMap(list -> Flux.fromStream(list.get()
.map(this::toListedReply))
.flatMap(Function.identity())
.concatMap(Function.identity())
.collectList()
.map(listedReplies -> new ListResult<>(list.getPage(), list.getSize(),
list.getTotal(), listedReplies))

View File

@ -69,7 +69,7 @@ public class PostServiceImpl implements PostService {
.flatMap(listResult -> Flux.fromStream(
listResult.get().map(this::getListedPost)
)
.flatMap(Function.identity())
.concatMap(Function.identity())
.collectList()
.map(listedPosts -> new ListResult<>(listResult.getPage(), listResult.getSize(),
listResult.getTotal(), listedPosts)

View File

@ -70,7 +70,7 @@ public class SinglePageServiceImpl implements SinglePageService {
.flatMap(listResult -> Flux.fromStream(
listResult.get().map(this::getListedSinglePage)
)
.flatMap(Function.identity())
.concatMap(Function.identity())
.collectList()
.map(listedSinglePages -> new ListResult<>(listResult.getPage(),
listResult.getSize(),

View File

@ -49,7 +49,7 @@ public class CommentFinderImpl implements CommentFinder {
defaultComparator(),
pageNullSafe(page), sizeNullSafe(size))
.flatMap(list -> Flux.fromStream(list.get().map(this::toCommentVo))
.flatMap(Function.identity())
.concatMap(Function.identity())
.collectList()
.map(commentVos -> new ListResult<>(list.getPage(), list.getSize(), list.getTotal(),
commentVos)
@ -68,7 +68,7 @@ public class CommentFinderImpl implements CommentFinder {
&& Objects.equals(true, reply.getSpec().getApproved()),
comparator.reversed(), pageNullSafe(page), sizeNullSafe(size))
.flatMap(list -> Flux.fromStream(list.get().map(this::toReplyVo))
.flatMap(Function.identity())
.concatMap(Function.identity())
.collectList()
.map(replyVos -> new ListResult<>(list.getPage(), list.getSize(), list.getTotal(),
replyVos))