排序优化
This commit is contained in:
parent
db8319022e
commit
2a6e4959b3
|
@ -211,16 +211,15 @@ public class CensusController {
|
|||
}).collect(Collectors.toList());
|
||||
CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[completableFutures.size()])).join();
|
||||
result.sort(Comparator.comparing(x -> {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
Map m = mapper.readValue(mapper.writeValueAsString(x), Map.class);
|
||||
return ObjectUtil.length(m.get("provide"));
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
).reversed()
|
||||
);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
Map m = mapper.readValue(mapper.writeValueAsString(x), Map.class);
|
||||
return ObjectUtil.length(m.get("provide"));
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
).reversed().thenComparing(i -> i.toString()));
|
||||
return new Result<List<Map<String, Object>>>().ok(result);
|
||||
}
|
||||
|
||||
|
@ -288,7 +287,7 @@ public class CensusController {
|
|||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).reversed()
|
||||
}).reversed().thenComparing(i -> i.toString())
|
||||
);
|
||||
return new Result<List<Map<String, Object>>>().ok(result);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue