Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-07-05 17:33:28 +08:00
commit a5418338a2
4 changed files with 36 additions and 27 deletions

View File

@ -33,8 +33,6 @@ import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -45,8 +43,7 @@ import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/census/center/v2") @RequestMapping("/census/center/v2")
public class CensusControllerV2 { public class CensusControllerV2 {
private static final Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm * 2);
@Value("${project.place}") @Value("${project.place}")
private Integer projectPlace; private Integer projectPlace;
@Value("${project.higher}") @Value("${project.higher}")
@ -81,7 +78,7 @@ public class CensusControllerV2 {
CompletableFuture<Void> userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数 CompletableFuture<Void> userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数
return sysUserService.countAllUser(); return sysUserService.countAllUser();
}, executor).thenAccept(sum -> { }).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -92,7 +89,7 @@ public class CensusControllerV2 {
CompletableFuture<Void> pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量 CompletableFuture<Void> pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量
return resourceService.countAllVisits(); return resourceService.countAllVisits();
}, executor).thenAccept(sum -> { }).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -128,7 +125,7 @@ public class CensusControllerV2 {
CompletableFuture<Void> allApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总应用数目 CompletableFuture<Void> allApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总应用数目
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='应用资源' AND del_flag = 0;", Long.class); return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='应用资源' AND del_flag = 0;", Long.class);
}, executor).thenAccept(sum -> { }).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -138,7 +135,7 @@ public class CensusControllerV2 {
}); });
CompletableFuture<Void> buildingApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台建设中数目 CompletableFuture<Void> buildingApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台建设中数目
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT data_resource_id) FROM tb_data_attr WHERE attr_type = '应用状态' AND attr_value = '建设中';", Long.class); return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT data_resource_id) FROM tb_data_attr WHERE attr_type = '应用状态' AND attr_value = '建设中';", Long.class);
}, executor).thenAccept(sum -> { }).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -148,7 +145,7 @@ public class CensusControllerV2 {
}); });
CompletableFuture<Void> endApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台建设中数目 CompletableFuture<Void> endApplicationAmount = CompletableFuture.supplyAsync(() -> { // 获取平台建设中数目
return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT data_resource_id) FROM tb_data_attr WHERE attr_type = '应用状态' AND attr_value = '停用';", Long.class); return jdbcTemplate.queryForObject("SELECT COUNT(DISTINCT data_resource_id) FROM tb_data_attr WHERE attr_type = '应用状态' AND attr_value = '停用';", Long.class);
}, executor).thenAccept(sum -> { }).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -186,7 +183,7 @@ public class CensusControllerV2 {
String sql = String.format("SELECT COUNT(id) FROM tb_data_resource WHERE dept_id = %s AND type = '应用资源' AND del_flag = 0;", index.get("id").toString()); String sql = String.format("SELECT COUNT(id) FROM tb_data_resource WHERE dept_id = %s AND type = '应用资源' AND del_flag = 0;", index.get("id").toString());
logger.info(sql); logger.info(sql);
Long count = jdbcTemplate.queryForObject(sql, Long.class); Long count = jdbcTemplate.queryForObject(sql, Long.class);
if (!"0".equals(index.get("pid").toString()) && higher) { // 有上级部门 配置资源归属上级 if (!"0" .equals(index.get("pid").toString()) && higher) { // 有上级部门 配置资源归属上级
Optional<SysDeptDTO> sysDeptDTO = Optional<SysDeptDTO> sysDeptDTO =
Optional.ofNullable(sysDeptService.get(Long.valueOf(index.get("pid").toString()))); Optional.ofNullable(sysDeptService.get(Long.valueOf(index.get("pid").toString())));
if (sysDeptDTO.isPresent() && sysDeptDTO.get().getType() != null && sysDeptDTO.get().getType() >= 2) { if (sysDeptDTO.isPresent() && sysDeptDTO.get().getType() != null && sysDeptDTO.get().getType() >= 2) {
@ -228,7 +225,7 @@ public class CensusControllerV2 {
List<Map<String, Object>> result = new CopyOnWriteArrayList<>(); List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
CompletableFuture<Void> allAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总组件服务数目 CompletableFuture<Void> allAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总组件服务数目
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='组件服务' AND del_flag = 0;", Long.class); return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='组件服务' AND del_flag = 0;", Long.class);
}, executor).thenAccept(sum -> { }).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -236,9 +233,15 @@ public class CensusControllerV2 {
} }
}); });
}); });
String sqlFormat = "SELECT COUNT( tda.data_resource_id ) FROM tb_data_attr tda JOIN tb_data_resource tdr ON\n" +
"tda.data_resource_id = tdr.id AND tda.attr_value = '%s' AND tda.attr_type = '组件类型' AND tda.del_flag = 0 AND tdr.del_flag = 0;";
CompletableFuture<Void> aiAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台智能算法组件服务数目 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); // 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);
}, executor).thenAccept(sum -> { return jdbcTemplate.queryForObject(String.format(sqlFormat, "智能算法"), Long.class);
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -247,8 +250,9 @@ public class CensusControllerV2 {
}); });
}); });
CompletableFuture<Void> gisAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台图层服务组件服务数目 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); // 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);
}, executor).thenAccept(sum -> { return jdbcTemplate.queryForObject(String.format(sqlFormat, "图层服务"), Long.class);
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -257,8 +261,9 @@ public class CensusControllerV2 {
}); });
}); });
CompletableFuture<Void> busAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目 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); // 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);
}, executor).thenAccept(sum -> { return jdbcTemplate.queryForObject(String.format(sqlFormat, "业务组件"), Long.class);
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -267,8 +272,9 @@ public class CensusControllerV2 {
}); });
}); });
CompletableFuture<Void> devAssemblyAmount = CompletableFuture.supplyAsync(() -> { // 获取平台业务组件组件服务数目 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); // 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);
}, executor).thenAccept(sum -> { return jdbcTemplate.queryForObject(String.format(sqlFormat, "开发组件"), Long.class);
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -288,7 +294,7 @@ public class CensusControllerV2 {
List<Map<String, Object>> result = new CopyOnWriteArrayList<>(); List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
CompletableFuture<Void> allKnowledgeAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总知识库数目 CompletableFuture<Void> allKnowledgeAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总知识库数目
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class); return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class);
}, executor).thenAccept(sum -> { }).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -298,7 +304,7 @@ public class CensusControllerV2 {
}); });
CompletableFuture<Void> allKnowledgeVisitsAmount = CompletableFuture.supplyAsync(() -> { // 获取平台知识库浏览量 CompletableFuture<Void> allKnowledgeVisitsAmount = CompletableFuture.supplyAsync(() -> { // 获取平台知识库浏览量
return jdbcTemplate.queryForObject("SELECT IFNULL(SUM(visits),0) visits FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class); return jdbcTemplate.queryForObject("SELECT IFNULL(SUM(visits),0) visits FROM tb_data_resource WHERE type ='知识库' AND del_flag = 0;", Long.class);
}, executor).thenAccept(sum -> { }).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum == null ? 0L : sum); put("amount", sum == null ? 0L : sum);
@ -332,7 +338,7 @@ public class CensusControllerV2 {
return dbAmount.stream().filter(index -> "基础设施".equals(index.get("type").toString())) return dbAmount.stream().filter(index -> "基础设施".equals(index.get("type").toString()))
.mapToLong(index -> Long.parseLong(index.get("count").toString())).sum(); .mapToLong(index -> Long.parseLong(index.get("count").toString())).sum();
}, executor).thenAccept(sum -> { }).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -345,7 +351,7 @@ public class CensusControllerV2 {
case BAOTOU: { // 包头 case BAOTOU: { // 包头
allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目 allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type = '基础设施' AND del_flag = 0", Long.class); return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type = '基础设施' AND del_flag = 0", Long.class);
}, executor).thenAccept(sum -> { }).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);
@ -375,7 +381,7 @@ public class CensusControllerV2 {
logger.error("青岛西海岸失败", exception); logger.error("青岛西海岸失败", exception);
} }
return result_.stream().filter(index -> index != null).findAny().orElse(0l); return result_.stream().filter(index -> index != null).findAny().orElse(0l);
}, executor).thenAccept(sum -> { }).thenAccept(sum -> {
result.add(new HashMap<String, Object>() { result.add(new HashMap<String, Object>() {
{ {
put("amount", sum); put("amount", sum);

View File

@ -337,7 +337,7 @@ public class ActHistoryService {
if (dto.isEnded()) { // 已结束 if (dto.isEnded()) { // 已结束
continue; continue;
} }
List<Task> listTask = taskService.createTaskQuery().processInstanceId(dto.getProcessInstanceId()).includeProcessVariables().list(); List<Task> listTask = taskService.createTaskQuery().processInstanceId(dto.getProcessInstanceId()).includeProcessVariables().includeTaskLocalVariables().list();
List<TaskDTO> taskDTOList = new ArrayList<>(); List<TaskDTO> taskDTOList = new ArrayList<>();
for (Task task : listTask) { for (Task task : listTask) {
TaskDTO taskDTO = new TaskDTO(); TaskDTO taskDTO = new TaskDTO();

View File

@ -544,6 +544,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public Object selectTotal() { public Object selectTotal() {
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
List<Map> re = resourceDao.selectTypeCount(null); List<Map> re = resourceDao.selectTypeCount(null);
//2022-07-05,ytl修改 start
re.removeIf(r->{return org.apache.commons.lang3.StringUtils.equals(r.get("type").toString(),"基础设施");});
//2022-07-05,ytl修改 end
switch (Constant.ProjectPlace.getByFlag(projectPlace)) { switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
case TSINGTAO_XHA: { // 青岛西海岸 case TSINGTAO_XHA: { // 青岛西海岸
CompletableFuture allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目 CompletableFuture allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目

View File

@ -105,7 +105,7 @@
AND car.user_id = #{userId} AND car.user_id = #{userId}
AND res.dept_id = #{deptId} AND res.dept_id = #{deptId}
AND car.del_flag = 0 AND car.del_flag = 0
AND EXISTS (SELECT 1 FROM tb_data_resource WHERE tb_data_resource.id = tb_resource_car.resource_id) AND EXISTS (SELECT 1 FROM tb_data_resource WHERE tb_data_resource.id = car.resource_id)
UNION ( UNION (
SELECT SELECT
car.id AS "id", car.id AS "id",
@ -144,7 +144,7 @@
1 = 1 1 = 1
AND trc.user_id = #{userId} AND trc.user_id = #{userId}
AND trc.del_flag = 0 AND trc.del_flag = 0
AND EXISTS (SELECT 1 FROM tb_data_resource WHERE tb_data_resource.id = tb_resource_car.resource_id) AND EXISTS (SELECT 1 FROM tb_data_resource WHERE tb_data_resource.id = trc.resource_id)
<if test="name != null and name != ''"> <if test="name != null and name != ''">
AND tdr.name LIKE CONCAT('%',#{name},'%') AND tdr.name LIKE CONCAT('%',#{name},'%')
</if> </if>