替换使用 CopyOnWriteArrayList
This commit is contained in:
parent
e090c4fd8a
commit
5b66808e7c
|
@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
@ -55,7 +56,7 @@ public class CensusControllerV2 {
|
|||
@GetMapping(value = "/whole_amount")
|
||||
@ApiOperation("平台概览")
|
||||
public Result<List<Map<String, Object>>> wholeAmount() {
|
||||
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
|
||||
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
|
||||
|
||||
CompletableFuture<Void> userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数
|
||||
return sysUserService.countAllUser();
|
||||
|
@ -102,7 +103,7 @@ public class CensusControllerV2 {
|
|||
@ApiOperation("应用资源数量统计")
|
||||
@LogOperation("应用资源数量统计")
|
||||
public Result<List<Map<String, Object>>> applicationNum() {
|
||||
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
|
||||
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
|
||||
|
||||
CompletableFuture<Void> allApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总应用数目
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='应用资源';", Long.class);
|
||||
|
@ -156,7 +157,7 @@ public class CensusControllerV2 {
|
|||
}
|
||||
|
||||
private List<Map<String, Object>> resourceRank(Integer type) {
|
||||
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
|
||||
List<Map<String, Object>> result;
|
||||
List<Map<String, Object>> district = jdbcTemplate.queryForList("SELECT * FROM sys_dept WHERE type = " + type);
|
||||
List<Map<String, Long>> listMap =
|
||||
district.stream().map(index -> {
|
||||
|
@ -203,7 +204,7 @@ public class CensusControllerV2 {
|
|||
@ApiOperation("组件服务简况")
|
||||
@LogOperation("组件服务简况")
|
||||
public Result<List<Map<String, Object>>> assemblerInfo() {
|
||||
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
|
||||
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
|
||||
CompletableFuture<Void> allAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总组件服务数目
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='组件服务' AND del_flag = 0;", Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
|
@ -263,7 +264,7 @@ public class CensusControllerV2 {
|
|||
@ApiOperation("知识库简况")
|
||||
@LogOperation("知识库简况")
|
||||
public Result<List<Map<String, Object>>> knowledgeInfo() {
|
||||
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
|
||||
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
|
||||
CompletableFuture<Void> allKnowledgeAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总知识库数目
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
|
|
Loading…
Reference in New Issue