This commit is contained in:
wangliwen 2022-08-15 16:50:52 +08:00
parent a8cd7f8436
commit 4b308ed69f
1 changed files with 17 additions and 34 deletions

View File

@ -472,11 +472,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
ids = customThreadPool.submit(() -> {
List<Long> 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<ResourceDao, ResourceEn
}
long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString());
return pingTOp;
}, Comparator.reverseOrder())
}).reversed()
.thenComparing(x -> {
Map index = (Map) x;
String string = (index.get("total") == null) ? "0" : index.get("total").toString();
@ -498,11 +493,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
ids = customThreadPool.submit(() -> {
List<Long> 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<ResourceDao, ResourceEn
}
long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString());
return pingTOp;
}, Comparator.reverseOrder())
}).reversed()
.thenComparing(x -> {
Map index = (Map) x;
String string = (index.get("total") == null) ? "0" : index.get("total").toString();
@ -524,8 +514,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if ("DESC".equals(orderType)) {
resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> {
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<ResourceDao, ResourceEn
return new Date(0).getTime() + pinTop;
}
}).reversed()
.thenComparing(x -> {
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 { // 非总体评价排序时