归并为一个排序
This commit is contained in:
parent
a75dc249c9
commit
d7b4075e7f
|
@ -474,17 +474,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
.sorted(Comparator.comparing(x -> {
|
||||
Map index = (Map) x;
|
||||
int pingTOp_ = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString());
|
||||
String string = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||
if (pingTOp_ <= 0) {
|
||||
return 0l;
|
||||
return 0l + Long.valueOf(string);
|
||||
}
|
||||
long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString());
|
||||
long pingTOp = (index.get("pin_top_time") == null) ? 0 + Long.valueOf(string) : Long.parseLong(index.get("pin_top_time").toString()) + Long.valueOf(string);
|
||||
return pingTOp;
|
||||
}).reversed()
|
||||
.thenComparing(x -> {
|
||||
Map index = (Map) x;
|
||||
String string = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||
return Long.valueOf(string);
|
||||
}, Comparator.reverseOrder())
|
||||
).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList());
|
||||
return temp;
|
||||
}).get();
|
||||
|
@ -493,19 +489,15 @@ 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;
|
||||
String string = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||
return Long.valueOf(string);
|
||||
})
|
||||
.thenComparing(x -> {
|
||||
Map index = (Map) x;
|
||||
int pingTOp_ = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString());
|
||||
String string = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||
if (pingTOp_ <= 0) {
|
||||
return 0l;
|
||||
return 0l + Long.valueOf(string);
|
||||
}
|
||||
long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString());
|
||||
long pingTOp = (index.get("pin_top_time") == null) ? 0 + Long.valueOf(string) : Long.parseLong(index.get("pin_top_time").toString()) + Long.valueOf(string);
|
||||
return pingTOp;
|
||||
}).reversed()).skip((pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList());
|
||||
})).skip((pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList());
|
||||
return temp;
|
||||
}).get();
|
||||
break;
|
||||
|
@ -513,33 +505,25 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, null, null, null, null, ids);
|
||||
if ("DESC".equals(orderType)) {
|
||||
resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> {
|
||||
ResourceDTO index = (ResourceDTO) x;
|
||||
return index.getTotal() == null ? 0L : index.getTotal();
|
||||
}).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() + pinTop : index.getPinTopTime().getTime() + pinTop;
|
||||
return index.getPinTopTime() == null ? new Date(0).getTime() + index.getTotal() : index.getPinTopTime().getTime() + index.getTotal();
|
||||
} else {
|
||||
return new Date(0).getTime() + pinTop;
|
||||
return new Date(0).getTime() + index.getTotal();
|
||||
}
|
||||
}).reversed()
|
||||
).collect(Collectors.toList()));
|
||||
} else {
|
||||
resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> {
|
||||
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;
|
||||
return index.getPinTopTime() == null ? new Date(0).getTime() + index.getTotal() : index.getPinTopTime().getTime() + index.getTotal();
|
||||
} else {
|
||||
return new Date(0).getTime() + pinTop;
|
||||
return new Date(0).getTime() + index.getTotal();
|
||||
}
|
||||
}, Comparator.reverseOrder())
|
||||
})
|
||||
).collect(Collectors.toList()));
|
||||
}
|
||||
customThreadPool.shutdown();
|
||||
|
|
Loading…
Reference in New Issue