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