Merge branch 'dev'

This commit is contained in:
wangliwen 2022-11-01 17:55:04 +08:00
commit 82386ab653
2 changed files with 39 additions and 43 deletions

View File

@ -1917,11 +1917,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
CompletableFuture<Void> all = CompletableFuture.allOf(jcss, hkt, sphy); CompletableFuture<Void> all = CompletableFuture.allOf(jcss, hkt, sphy);
all.join(); all.join();
return new LinkedHashMap() {{ return resultMap;
put("视频资源", resultMap.get("视频资源"));
put("会客厅", resultMap.get("会客厅"));
put("视频会议", resultMap.get("视频会议"));
}};
} }
@Override @Override
@ -1935,7 +1931,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override @Override
public Object selectCollectResourceList() { public Object selectCollectResourceList() {
List<Map> resourceCountList = baseDao.selectCollectResourceList(); List<Map> resourceCountList = baseDao.selectCollectResourceList();
Map result = new LinkedHashMap(); Map result = new HashMap();
resourceCountList.stream().filter(it -> it.get("type") != null && !it.get("type").equals("")).forEach(it -> result.put(it.get("type"), it.get("count"))); resourceCountList.stream().filter(it -> it.get("type") != null && !it.get("type").equals("")).forEach(it -> result.put(it.get("type"), it.get("count")));
return result; return result;
} }
@ -2030,30 +2026,28 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
{ {
put("count", null == dataResource ? "0" : dataResource.get("rows") + ""); put("count", null == dataResource ? "0" : dataResource.get("rows") + "");
put("type", "数据资源"); put("type", "数据资源");
put("type_index", 4);
} }
}); });
}, executor); }, executor);
CompletableFuture<Void> infrastructureCount = CompletableFuture.runAsync(() -> { //基础设施 //2022-11-1 去除摄像头查询
HashMap<Object, Object> queryMap = new HashMap<>(); //CompletableFuture<Void> infrastructureCount = CompletableFuture.runAsync(() -> { //基础设施
queryMap.put("cameraName", keyWorld); // HashMap<Object, Object> queryMap = new HashMap<>();
Integer countNew = cameraChannelMapper.selectByParentIdCountNew(queryMap, null, ""); // queryMap.put("cameraName", keyWorld);
resultList.add(new HashMap<String, Object>() { // Integer countNew = cameraChannelMapper.selectByParentIdCountNew(queryMap, null, "");
{ // resultList.add(new HashMap<String, Object>() {
put("count", countNew + ""); // {
put("type", "基础设施"); // put("count", countNew + "");
put("type_index", 3); // put("type", "基础设施");
} // }
}); // });
//
//}, executor);
}, executor);
//统计增加会议室搜索结果 //统计增加会议室搜索结果
CompletableFuture<Void> meetingRoomCount = CompletableFuture.runAsync(() -> { //会议室 CompletableFuture<Void> meetingRoomCount = CompletableFuture.runAsync(() -> meetCountNew[0] = tMeetingroomMapper.selectByName(keyWorld).size(), executor);
meetCountNew[0] = tMeetingroomMapper.selectByName(keyWorld).size();
}, executor);
CompletableFuture<Void> all = CompletableFuture.allOf(DBresourceCount, dataResourceCount, infrastructureCount, meetingRoomCount); CompletableFuture<Void> all = CompletableFuture.allOf(DBresourceCount, dataResourceCount, meetingRoomCount);
all.join(); all.join();
} }
@ -2061,6 +2055,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
default: default:
break; break;
} }
//未查到的类型返回数量0 //未查到的类型返回数量0
List<String> temp = new ArrayList<>(); List<String> temp = new ArrayList<>();
resultList.forEach(map -> { resultList.forEach(map -> {
@ -2071,28 +2066,15 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
}); });
Arrays.stream(censusTypes).filter(index -> !temp.contains(index)).forEach(index -> { Arrays.stream(censusTypes).filter(index -> !temp.contains(index)).forEach(index -> {
int index_ = 0;
for (int i = 0; i < censusTypes.length; i++) {
if (censusTypes[i].equals(index)) {
index_ = i + 1;
break;
}
}
int finalIndex_ = index_;
Map<String, Object> nullMap = new HashMap<String, Object>() { Map<String, Object> nullMap = new HashMap<String, Object>() {
{ {
put("count", "0"); put("count", "0");
put("type", index); put("type", index);
put("type_index", finalIndex_);
} }
}; };
resultList.add(nullMap); resultList.add(nullMap);
}); });
return resultList.stream().sorted(Comparator.comparing(x -> { return resultList;
Map index = (Map) x;
int type_index = index.containsKey("type_index") ? (int) index.get("type_index") : Integer.MAX_VALUE;
return type_index;
})).collect(Collectors.toList());
} }
@Override @Override
@ -2187,7 +2169,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return index; return index;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
Map<String, List<Map<String, Object>>> typeCountListMap1 = // 区级部门 Map<String, List<Map<String, Object>>> typeCountListMap1 = // 区级部门
typeCountListByApplyDept.stream().filter(index -> index.get("deptType").toString().equals("3")).collect(Collectors.groupingBy(m -> m.get("district").toString())); typeCountListByApplyDept.stream().filter(index -> index.get("deptType").toString().equals("3"))
.collect(Collectors.groupingBy(m -> m.get("district").toString()));
resultList = resultList.stream().map(index -> { resultList = resultList.stream().map(index -> {
if (typeCountListMap1.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息 if (typeCountListMap1.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息
index.put("count", typeCountListMap1.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum()); index.put("count", typeCountListMap1.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
@ -2204,7 +2187,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}).collect(Collectors.toList()); }).collect(Collectors.toList());
Map<String, List<Map<String, Object>>> typeCountListMap2 = // 企业部门 Map<String, List<Map<String, Object>>> typeCountListMap2 = // 企业部门
typeCountListByApplyDept.stream().filter(index -> index.get("deptType").toString().equals("4")).collect(Collectors.groupingBy(m -> m.get("dept_id").toString())); typeCountListByApplyDept.stream().filter(index -> index.get("deptType").toString().equals("4"))
.collect(Collectors.groupingBy(m -> m.get("dept_id").toString()));
resultList = resultList.stream().map(index -> { resultList = resultList.stream().map(index -> {
if (typeCountListMap2.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息 if (typeCountListMap2.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息
index.put("count", typeCountListMap2.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum()); index.put("count", typeCountListMap2.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
@ -2368,7 +2352,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return index; return index;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
Map<String, List<Map<String, Object>>> typeCountListMap1 = // 区级部门 Map<String, List<Map<String, Object>>> typeCountListMap1 = // 区级部门
typeCountListByDept.stream().filter(index -> index.get("deptType").toString().equals("3")).collect(Collectors.groupingBy(m -> m.get("district").toString())); typeCountListByDept.stream().filter(index -> index.get("deptType").toString().equals("3"))
.collect(Collectors.groupingBy(m -> m.get("district").toString()));
resultList = resultList.stream().map(index -> { resultList = resultList.stream().map(index -> {
if (typeCountListMap1.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息 if (typeCountListMap1.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息
index.put("count", typeCountListMap1.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum()); index.put("count", typeCountListMap1.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
@ -2384,7 +2369,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return index; return index;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
Map<String, List<Map<String, Object>>> typeCountListMap2 = // 企业部门 Map<String, List<Map<String, Object>>> typeCountListMap2 = // 企业部门
typeCountListByDept.stream().filter(index -> index.get("deptType").toString().equals("4")).collect(Collectors.groupingBy(m -> m.get("dept_id").toString())); typeCountListByDept.stream().filter(index -> index.get("deptType").toString().equals("4"))
.collect(Collectors.groupingBy(m -> m.get("dept_id").toString()));
resultList = resultList.stream().map(index -> { resultList = resultList.stream().map(index -> {
if (typeCountListMap2.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息 if (typeCountListMap2.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息
index.put("count", typeCountListMap2.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum()); index.put("count", typeCountListMap2.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());

View File

@ -54,10 +54,20 @@
<select id="selectResourceBrowseByTypeAndUser" parameterType="java.util.Map" <select id="selectResourceBrowseByTypeAndUser" parameterType="java.util.Map"
resultType="io.renren.modules.resourceBrowse.dto.ResourceBrowseDTO"> resultType="io.renren.modules.resourceBrowse.dto.ResourceBrowseDTO">
SELECT a.* FROM tb_resource_browse a INNER JOIN tb_data_resource b ON a.resource_id = b.id SELECT a.*, c.attr_value FROM tb_resource_browse a INNER JOIN tb_data_resource b ON a.resource_id = b.id
LEFT JOIN tb_data_attr c ON b.id = c.data_resource_id
WHERE a.state = 0 WHERE a.state = 0
AND c.del_flag = 0
AND c.attr_type = '组件类型'
<if test="params.type != null and params.type != ''"> <if test="params.type != null and params.type != ''">
AND b.type = #{params.type} <choose>
<when test="params.type == '应用资源' or params.type == '知识库'">
AND b.type = #{params.type}
</when>
<otherwise>
AND c.attr_value = #{params.type}
</otherwise>
</choose>
</if> </if>
<if test="params.name != null and params.name != ''"> <if test="params.name != null and params.name != ''">
AND (b.name LIKE(CONCAT('%',CONCAT(trim(#{params.name}),'%'))) OR b.type AND (b.name LIKE(CONCAT('%',CONCAT(trim(#{params.name}),'%'))) OR b.type