topN按数目逆序
This commit is contained in:
parent
b1e9fd607e
commit
61ec67c9a1
|
@ -2,6 +2,8 @@ package io.renren.common.controller;
|
|||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.renren.common.annotation.LogOperation;
|
||||
import io.renren.common.utils.Result;
|
||||
import io.renren.modules.processForm.service.TAbilityApplicationService;
|
||||
|
@ -208,12 +210,20 @@ public class CensusController {
|
|||
return task;
|
||||
}).collect(Collectors.toList());
|
||||
CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[completableFutures.size()])).join();
|
||||
result.sort(Comparator.comparing(x ->
|
||||
ObjectUtil.length(x.get("provide"))
|
||||
)
|
||||
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()
|
||||
);
|
||||
return new Result<List<Map<String, Object>>>().ok(result);
|
||||
}
|
||||
|
||||
@GetMapping("/capabilityShareCapabilitySet")
|
||||
@ApiOperation("资源图谱-能力共享方-能力集")
|
||||
@LogOperation("资源图谱-能力共享方-能力集")
|
||||
|
@ -270,11 +280,19 @@ public class CensusController {
|
|||
}).collect(Collectors.toList());
|
||||
CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[completableFutures.size()])).join();
|
||||
result.sort(Comparator.comparing(x ->
|
||||
ObjectUtil.length(x.get("provide"))
|
||||
)
|
||||
{
|
||||
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()
|
||||
);
|
||||
return new Result<List<Map<String, Object>>>().ok(result);
|
||||
}
|
||||
|
||||
@GetMapping("/capabilitySharingPartyCapabilityType")
|
||||
@ApiOperation("资源图谱-能力共享方-能力类型")
|
||||
@LogOperation("资源图谱-能力共享方-能力类型")
|
||||
|
|
Loading…
Reference in New Issue