全局搜索统计各类型能力数量
This commit is contained in:
parent
e602317a7a
commit
2241e2808d
|
@ -604,5 +604,12 @@ public class ResourceController {
|
||||||
return new Result<>().ok(resourceService.selectAppList(params));
|
return new Result<>().ok(resourceService.selectAppList(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getCountByFuzzyQuery")
|
||||||
|
@ApiOperation("获取各类资源模糊查询总数")
|
||||||
|
@LogOperation("获取各类资源模糊查询总数")
|
||||||
|
public Result getCountByFuzzyQuery(@RequestParam String keyWorld) {
|
||||||
|
return new Result<>().ok(resourceService.getCountByFuzzyQuery(keyWorld));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -174,4 +174,6 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
||||||
List<Map> selectAppList(@Param("pageNum") int pageNum, @Param("type") Integer type);
|
List<Map> selectAppList(@Param("pageNum") int pageNum, @Param("type") Integer type);
|
||||||
|
|
||||||
String selectPicByResId(@Param("id") String id);
|
String selectPicByResId(@Param("id") String id);
|
||||||
|
|
||||||
|
List<Map> selectTypeCountByName(@Param("keyWorld") String keyWorld);
|
||||||
}
|
}
|
|
@ -136,4 +136,6 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
|
||||||
PageData<Map<String,Object>> resourceInstallationOrDataResourceDetails(Map<String, Object> params);
|
PageData<Map<String,Object>> resourceInstallationOrDataResourceDetails(Map<String, Object> params);
|
||||||
|
|
||||||
Object selectAppList(Map params);
|
Object selectAppList(Map params);
|
||||||
|
|
||||||
|
Object getCountByFuzzyQuery(String keyWorld);
|
||||||
}
|
}
|
|
@ -1996,7 +1996,64 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getCountByFuzzyQuery(String keyWorld) {
|
||||||
|
ArrayList<Map> resultList = new ArrayList<>();
|
||||||
|
CompletableFuture<Void> DBresourceCount = CompletableFuture.runAsync(() -> resultList.addAll(resourceDao.selectTypeCountByName(keyWorld)));
|
||||||
|
|
||||||
|
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
|
||||||
|
case TSINGTAO_XHA:
|
||||||
|
break;
|
||||||
|
case TSINGTAO: {
|
||||||
|
CompletableFuture<Void> dataResourceCount = CompletableFuture.runAsync(() -> { //数据资源
|
||||||
|
//青岛市局数据资源
|
||||||
|
TsingtaoDataResourceService tsingtaoDataResourceService = new TsingtaoDataResourceService();
|
||||||
|
GetDataResourceListDto getDataResourceListDto = new GetDataResourceListDto().setPageNum(1).setPageSize(5).setServiceName(keyWorld);
|
||||||
|
HashMap dataResource = (HashMap) tsingtaoDataResourceService.getDataResource(getDataResourceListDto);
|
||||||
|
resultList.add(new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("count", null == dataResource ? "0" : dataResource.get("rows") + "");
|
||||||
|
put("type", "数据资源");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, executor);
|
||||||
|
|
||||||
|
CompletableFuture<Void> infrastructureCount = CompletableFuture.runAsync(() -> { //基础设施
|
||||||
|
HashMap<Object, Object> queryMap = new HashMap<>();
|
||||||
|
queryMap.put("cameraName",keyWorld);
|
||||||
|
Integer countNew = cameraChannelMapper.selectByParentIdCountNew(queryMap, null, "");
|
||||||
|
resultList.add(new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("count", countNew + "");
|
||||||
|
put("type", "基础设施");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}, executor);
|
||||||
|
|
||||||
|
CompletableFuture<Void> all = CompletableFuture.allOf(DBresourceCount, dataResourceCount, infrastructureCount);
|
||||||
|
all.join();
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//未查到的类型返回数量0
|
||||||
|
List<String> temp = new ArrayList<>();
|
||||||
|
resultList.forEach(map -> temp.add(map.get("type").toString()));
|
||||||
|
Arrays.stream(censusTypes).filter(index -> !temp.contains(index)).forEach(index -> {
|
||||||
|
Map<String, Object> nullMap = new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("count", "0");
|
||||||
|
put("type", index);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
resultList.add(nullMap);
|
||||||
|
});
|
||||||
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -605,7 +605,7 @@
|
||||||
</if>
|
</if>
|
||||||
GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
|
GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
|
||||||
LEFT JOIN sys_region sr ON sd.district = sr.id
|
LEFT JOIN sys_region sr ON sd.district = sr.id
|
||||||
ORDER BY sd.type, sr.sort
|
ORDER BY sd.type, sr.sort, sd.sort
|
||||||
) temp1
|
) temp1
|
||||||
WHERE
|
WHERE
|
||||||
1 = 1
|
1 = 1
|
||||||
|
@ -1531,4 +1531,18 @@
|
||||||
AND tdr.id = #{id}
|
AND tdr.id = #{id}
|
||||||
AND tda.del_flag = 0
|
AND tda.del_flag = 0
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectTypeCountByName" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
type,
|
||||||
|
count(id) AS "count"
|
||||||
|
FROM tb_data_resource
|
||||||
|
WHERE 1 = 1
|
||||||
|
AND del_flag = 0
|
||||||
|
<if test="keyWorld != null and keyWorld != ''">
|
||||||
|
AND MATCH (name) AGAINST ( #{keyWorld} IN BOOLEAN MODE)
|
||||||
|
</if>
|
||||||
|
AND type != '赋能案例'
|
||||||
|
GROUP BY type
|
||||||
|
ORDER BY type
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue