Merge branch 'master' into docker_package
This commit is contained in:
commit
f0eb0e7740
|
@ -459,12 +459,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
List<ResourceDTO> resourceDTOS;
|
||||
if (orderField.equals("total")) { // 对总体评价特殊处理
|
||||
List<Long> ids = new ArrayList<>();
|
||||
ForkJoinPool customThreadPool = new ForkJoinPool(CPU_NUM * 2);
|
||||
switch (orderType.toUpperCase()) {
|
||||
case "DESC": // total 倒序
|
||||
try {
|
||||
ids = (List<Long>) customThreadPool.submit(() -> {
|
||||
selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
||||
ids = 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);
|
||||
|
@ -472,47 +469,17 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
).reversed()).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(x ->
|
||||
Long.valueOf(x.get("id").toString())
|
||||
).limit(pageSize).collect(Collectors.toList());
|
||||
}).get();
|
||||
} catch (InterruptedException e) {
|
||||
logger.error("InterruptedException", e);
|
||||
} catch (ExecutionException e) {
|
||||
logger.error("ExecutionException", e);
|
||||
}
|
||||
// ids = 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);
|
||||
// }
|
||||
// ).reversed()).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(x ->
|
||||
// Long.valueOf(x.get("id").toString())
|
||||
// ).limit(pageSize).collect(Collectors.toList());
|
||||
break;
|
||||
case "ASC": // total 升序
|
||||
try {
|
||||
ids = (List<Long>) customThreadPool.submit(() -> {
|
||||
selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
||||
ids = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
||||
String string = (x.get("total") == null) ? "0" : x.get("total").toString();
|
||||
return Long.valueOf(string);
|
||||
}
|
||||
)).skip((pageNum - 1) * pageSize).limit(pageSize).map(x ->
|
||||
Long.valueOf(x.get("id").toString())
|
||||
).limit(pageSize).collect(Collectors.toList());
|
||||
}).get();
|
||||
} catch (InterruptedException e) {
|
||||
logger.error("InterruptedException", e);
|
||||
} catch (ExecutionException e) {
|
||||
logger.error("ExecutionException", e);
|
||||
}
|
||||
// ids = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
||||
// String string = (x.get("total") == null) ? "0" : x.get("total").toString();
|
||||
// return Long.valueOf(string);
|
||||
// }
|
||||
// )).skip((pageNum - 1) * pageSize).limit(pageSize).map(x ->
|
||||
// Long.valueOf(x.get("id").toString())
|
||||
// ).limit(pageSize).collect(Collectors.toList());
|
||||
break;
|
||||
}
|
||||
customThreadPool.shutdown();
|
||||
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, null, null, null, null, ids);
|
||||
if ("DESC".equals(orderType)) {
|
||||
resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> {
|
||||
|
|
Loading…
Reference in New Issue