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 e8cfbd77..32edef91 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 @@ -472,11 +472,6 @@ public class ResourceServiceImpl extends CrudServiceImpl { List temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast) .sorted(Comparator.comparing(x -> { - Map index = (Map) x; - int pingTOp = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString()); - return pingTOp; - }, Comparator.reverseOrder()) - .thenComparing(x -> { Map index = (Map) x; int pingTOp_ = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString()); if (pingTOp_ <= 0) { @@ -484,7 +479,7 @@ public class ResourceServiceImpl extends CrudServiceImpl { Map index = (Map) x; String string = (index.get("total") == null) ? "0" : index.get("total").toString(); @@ -498,11 +493,6 @@ public class ResourceServiceImpl extends CrudServiceImpl { List temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast) .sorted(Comparator.comparing(x -> { - Map index = (Map) x; - int pingTOp = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString()); - return pingTOp; - }, Comparator.reverseOrder()) - .thenComparing(x -> { Map index = (Map) x; int pingTOp_ = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString()); if (pingTOp_ <= 0) { @@ -510,7 +500,7 @@ public class ResourceServiceImpl extends CrudServiceImpl { Map index = (Map) x; String string = (index.get("total") == null) ? "0" : index.get("total").toString(); @@ -524,8 +514,8 @@ public class ResourceServiceImpl extends CrudServiceImpl { ResourceDTO index = (ResourceDTO) x; - return index.getPinTop() == null ? 0 : index.getPinTop(); - }).reversed() + return index.getTotal() == null ? 0L : index.getTotal(); + }, Comparator.reverseOrder()) .thenComparing(x -> { ResourceDTO index = (ResourceDTO) x; int pinTop = index.getPinTop() == null ? 0 : index.getPinTop(); @@ -535,29 +525,22 @@ public class ResourceServiceImpl extends CrudServiceImpl { - ResourceDTO index = (ResourceDTO) x; - return index.getTotal() == null ? 0L : index.getTotal(); - }, Comparator.reverseOrder()) ).collect(Collectors.toList())); } else { resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> { - ResourceDTO index = (ResourceDTO) x; - return index.getPinTop() == null ? 0 : index.getPinTop(); - }).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(); - } else { - return new Date(0).getTime(); - } - }).reversed() - .thenComparing(x -> { - ResourceDTO index = (ResourceDTO) x; - return index.getTotal() == null ? 0L : index.getTotal(); - })).collect(Collectors.toList())); + ResourceDTO index = (ResourceDTO) x; + return index.getTotal() == null ? 0L : index.getTotal(); + }, Comparator.reverseOrder()) + .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() + pinTop : index.getPinTopTime().getTime() + pinTop; + } else { + return new Date(0).getTime() + pinTop; + } + }, Comparator.reverseOrder()) + ).collect(Collectors.toList())); } customThreadPool.shutdown(); } else { // 非总体评价排序时