From a8cd7f8436a7e7b5a6926012c60459e872f879db Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 15 Aug 2022 16:34:11 +0800 Subject: [PATCH] =?UTF-8?q?stream=20=E7=9A=84=E6=8E=92=E5=BA=8F=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resource/service/impl/ResourceServiceImpl.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 978c4cdc..e8cfbd77 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -525,16 +525,17 @@ public class ResourceServiceImpl extends CrudServiceImpl { ResourceDTO index = (ResourceDTO) x; return index.getPinTop() == null ? 0 : index.getPinTop(); - }, Comparator.reverseOrder()) + }).reversed() .thenComparing(x -> { ResourceDTO index = (ResourceDTO) x; int pinTop = index.getPinTop() == null ? 0 : index.getPinTop(); if (pinTop > 0) { - return index.getPinTopTime() == null ? new Date(0).getTime() : index.getPinTopTime().getTime(); + return index.getPinTopTime() == null ? new Date(0).getTime() + pinTop : index.getPinTopTime().getTime() + pinTop; } else { - return new Date(0).getTime(); + return new Date(0).getTime() + pinTop; } - }, Comparator.reverseOrder()).thenComparing(x -> { + }).reversed() + .thenComparing(x -> { ResourceDTO index = (ResourceDTO) x; return index.getTotal() == null ? 0L : index.getTotal(); }, Comparator.reverseOrder()) @@ -543,7 +544,8 @@ public class ResourceServiceImpl extends CrudServiceImpl { ResourceDTO index = (ResourceDTO) x; return index.getPinTop() == null ? 0 : index.getPinTop(); - }, Comparator.reverseOrder()).thenComparing(x -> { + }).reversed() + .thenComparing(x -> { ResourceDTO index = (ResourceDTO) x; int pinTop = index.getPinTop() == null ? 0 : index.getPinTop(); if (pinTop > 0) { @@ -551,7 +553,7 @@ public class ResourceServiceImpl extends CrudServiceImpl { ResourceDTO index = (ResourceDTO) x; return index.getTotal() == null ? 0L : index.getTotal();