组件服务、知识库 统计接口
This commit is contained in:
parent
04a4be0294
commit
633a131619
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE `share_platform`.`tb_data_attr`
|
||||
ADD INDEX `resource_id`(`data_resource_id`),
|
||||
ADD FULLTEXT INDEX `attr_value`(`attr_type`, `attr_value`);
|
|
@ -198,4 +198,95 @@ public class CensusControllerV2 {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/assemblerInfo")
|
||||
@ApiOperation("组件服务简况")
|
||||
@LogOperation("组件服务简况")
|
||||
public Result<List<Map<String, Object>>> assemblerInfo() {
|
||||
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
|
||||
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 -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "上架总数");
|
||||
}
|
||||
});
|
||||
});
|
||||
CompletableFuture<Void> aiAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台智能算法组件服务数目
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT tb_data_resource.id) FROM tb_data_resource WHERE tb_data_resource.del_flag = 0 AND EXISTS(SELECT tb_data_attr.id FROM tb_data_attr WHERE tb_data_attr.data_resource_id = tb_data_resource.id AND tb_data_attr.attr_value = '智能算法' AND attr_type = '组件类型')", Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "智能算法");
|
||||
}
|
||||
});
|
||||
});
|
||||
CompletableFuture<Void> gisAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台图层服务组件服务数目
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT tb_data_resource.id) FROM tb_data_resource WHERE tb_data_resource.del_flag = 0 AND EXISTS(SELECT tb_data_attr.id FROM tb_data_attr WHERE tb_data_attr.data_resource_id = tb_data_resource.id AND tb_data_attr.attr_value = '图层服务' AND attr_type = '组件类型')", Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "图层服务");
|
||||
}
|
||||
});
|
||||
});
|
||||
CompletableFuture<Void> busAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT tb_data_resource.id) FROM tb_data_resource WHERE tb_data_resource.del_flag = 0 AND EXISTS(SELECT tb_data_attr.id FROM tb_data_attr WHERE tb_data_attr.data_resource_id = tb_data_resource.id AND tb_data_attr.attr_value = '业务组件' AND attr_type = '组件类型')", Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "业务组件");
|
||||
}
|
||||
});
|
||||
});
|
||||
CompletableFuture<Void> devAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目
|
||||
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT tb_data_resource.id) FROM tb_data_resource WHERE tb_data_resource.del_flag = 0 AND EXISTS(SELECT tb_data_attr.id FROM tb_data_attr WHERE tb_data_attr.data_resource_id = tb_data_resource.id AND tb_data_attr.attr_value = '开发组件' AND attr_type = '组件类型')", Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "开发组件");
|
||||
}
|
||||
});
|
||||
});
|
||||
CompletableFuture<Void> all = CompletableFuture.allOf(allAssemblyAmount, aiAssemblyAmount, gisAssemblyAmount, busAssemblyAmount, devAssemblyAmount);
|
||||
all.join();
|
||||
return new Result().ok(result);
|
||||
}
|
||||
|
||||
@GetMapping("/knowledgeInfo")
|
||||
@ApiOperation("知识库简况")
|
||||
@LogOperation("知识库简况")
|
||||
public Result<List<Map<String, Object>>> knowledgeInfo() {
|
||||
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
|
||||
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 -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "知识库上架总量");
|
||||
}
|
||||
});
|
||||
});
|
||||
CompletableFuture<Void> allKnowledgeVisitsAmount = CompletableFuture.supplyAsync(() -> { // 获取平台知识库浏览量
|
||||
return jdbcTemplate.queryForObject("SELECT SUM(visits)visits FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class);
|
||||
}).thenAccept(sum -> {
|
||||
result.add(new HashMap<String, Object>() {
|
||||
{
|
||||
put("amount", sum);
|
||||
put("type", "知识库总浏览量");
|
||||
}
|
||||
});
|
||||
});
|
||||
CompletableFuture<Void> all = CompletableFuture.allOf(allKnowledgeAmount, allKnowledgeVisitsAmount);
|
||||
all.join();
|
||||
return new Result().ok(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE `share_platform`.`tb_data_attr`
|
||||
ADD INDEX `resource_id`(`data_resource_id`),
|
||||
ADD FULLTEXT INDEX `attr_value`(`attr_type`, `attr_value`);
|
Loading…
Reference in New Issue