From f4d0001b855ac1837421c888c0507355987814cc Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Fri, 24 Jun 2022 19:54:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=B5=84=E6=BA=90=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/CensusControllerV2.java | 2 +- .../service/impl/ResourceServiceImpl.java | 123 ++++++++++++------ 2 files changed, 82 insertions(+), 43 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java index d8a7e283..d5b6ea1c 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusControllerV2.java @@ -388,7 +388,7 @@ public class CensusControllerV2 { }); result.add(new HashMap() { { - put("amount", 0l); + put("amount", 0L); put("type", "总申请次数"); } }); diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index d1a0347a..a13ad935 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -15,6 +15,8 @@ import io.renren.common.domain.Tsingtao_xhaProperties; import io.renren.common.service.impl.CrudServiceImpl; import io.renren.modules.resource.dao.AttrDao; import io.renren.modules.resource.dao.ResourceDao; +import io.renren.modules.resource.dataResource.domain.TsingtaoDataResourceService; +import io.renren.modules.resource.dto.GetDataResourceListDto; import io.renren.modules.resource.dto.ResourceDTO; import io.renren.modules.resource.entity.AttrEntity; import io.renren.modules.resource.entity.ResourceEntity; @@ -377,7 +379,8 @@ public class ResourceServiceImpl extends CrudServiceImpl index != null).findAny().orElse(0l); }).thenAccept(sum -> { re.add(new HashMap() { @@ -387,8 +390,44 @@ public class ResourceServiceImpl extends CrudServiceImpl() { + { + put("amount", finalTotal); + put("type", "数据资源"); + } + }); + } + } else { + logger.error("青岛西海岸获取失败"); + } + } catch (Exception exception) { + logger.error("青岛西海岸失败", exception); + } allAmount.join(); } + break; + case TSINGTAO: { + //青岛市局数据资源 + TsingtaoDataResourceService tsingtaoDataResourceService = new TsingtaoDataResourceService(); + GetDataResourceListDto getDataResourceListDto = new GetDataResourceListDto().setPageNum(1).setPageSize(5); + HashMap dataResource = (HashMap) tsingtaoDataResourceService.getDataResource(getDataResourceListDto); + re.add(new HashMap() { + { + put("count", dataResource.get("rows") + ""); + put("type", "数据资源"); + } + }); + } + break; } resultMap.put("total", re); return resultMap; @@ -860,8 +899,8 @@ public class ResourceServiceImpl extends CrudServiceImpl> resourceBusinessDetails(Map params){ - List> result = new CopyOnWriteArrayList<>(); + public List> resourceBusinessDetails(Map params) { + List> result = new CopyOnWriteArrayList<>(); List deptList = new ArrayList<>();//保存部门 发布总数 访问量 params.put("pageNum", (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString())); @@ -871,23 +910,23 @@ public class ResourceServiceImpl extends CrudServiceImpl> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) as resourceNum,a.dept_id AS deptId,b.name AS deptName,\n" + + List> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName,\n" + "SUM(a.visits) AS resourceVisits \n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '组件服务' AND a.del_flag = 0\n" + - "AND (b.ID = ? OR b.pids like CONCAT(CONCAT('%',?),'%'))\n" + + "AND (b.ID = ? OR b.pids LIKE CONCAT(CONCAT('%',?),'%'))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n" + - "LIMIT ?,?",pas); + "LIMIT ?,?", pas); result.addAll(result2); ConcurrentHashMap hashMap = new ConcurrentHashMap(); hashMap.putAll(params); - CompletableFuture voidCompletableFuture01 = CompletableFuture.runAsync(() -> { // 获取被申请数量 + CompletableFuture voidCompletableFuture01 = CompletableFuture.runAsync(() -> { // 获取被申请数量 result.forEach(dept -> { String id = dept.get("deptId").toString();//部门id hashMap.put("id", id); @@ -937,27 +976,27 @@ public class ResourceServiceImpl extends CrudServiceImpl all = CompletableFuture.allOf(voidCompletableFuture01, voidCompletableFuture02, voidCompletableFuture03,voidCompletableFuture04,voidCompletableFuture05); + CompletableFuture all = CompletableFuture.allOf(voidCompletableFuture01, voidCompletableFuture02, voidCompletableFuture03, voidCompletableFuture04, voidCompletableFuture05); all.join(); return result; } @Override - public List> resourceApplicationDetails(Map params){ + public List> resourceApplicationDetails(Map params) { List> result = new CopyOnWriteArrayList<>(); Integer page = Integer.parseInt(params.get("page").toString()) - 1; Integer pageSize = Integer.parseInt(params.get("limit").toString()); - Object[] pas = {params.get("id"),params.get("id"),page,pageSize}; + Object[] pas = {params.get("id"), params.get("id"), page, pageSize}; - List> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) as resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + + List> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '应用资源' AND a.del_flag = 0\n" + - "AND (b.ID = ? OR b.pids like CONCAT(CONCAT('%',?),'%'))\n" + + "AND (b.ID = ? OR b.pids LIKE CONCAT(CONCAT('%',?),'%'))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n" + - "LIMIT ?,?",pas); + "LIMIT ?,?", pas); result.addAll(result2); CompletableFuture voidCompletableFuture01 = CompletableFuture.runAsync(() -> { //应用浏览数量 result.forEach(r -> { @@ -982,20 +1021,20 @@ public class ResourceServiceImpl extends CrudServiceImpl> resourceInfrastructureDetails(Map params){ + public List> resourceInfrastructureDetails(Map params) { List> result = new CopyOnWriteArrayList<>(); Integer page = Integer.parseInt(params.get("page").toString()) - 1; Integer pageSize = Integer.parseInt(params.get("limit").toString()); - Object[] pas = {params.get("id"),params.get("id"),page,pageSize}; + Object[] pas = {params.get("id"), params.get("id"), page, pageSize}; - List> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) as resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + + List> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '基础设施' AND a.del_flag = 0\n" + - "AND (b.ID = ? OR b.pids like CONCAT(CONCAT('%',?),'%'))\n" + + "AND (b.ID = ? OR b.pids LIKE CONCAT(CONCAT('%',?),'%'))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n" + - "LIMIT ?,?",pas); + "LIMIT ?,?", pas); result.addAll(result2); CompletableFuture resourceCollectionNum01 = CompletableFuture.runAsync(() -> {//被申请数量 resourceCarNum @@ -1026,20 +1065,20 @@ public class ResourceServiceImpl extends CrudServiceImpl> resourceDatasDetails(Map params){ + public List> resourceDatasDetails(Map params) { List> result = new CopyOnWriteArrayList<>(); Integer page = Integer.parseInt(params.get("page").toString()) - 1; Integer pageSize = Integer.parseInt(params.get("limit").toString()); - Object[] pas = {params.get("id"),params.get("id"),page,pageSize}; + Object[] pas = {params.get("id"), params.get("id"), page, pageSize}; - List> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) as resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + + List> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '数据资源' AND a.del_flag = 0\n" + - "AND (b.ID = ? OR b.pids like CONCAT(CONCAT('%',?),'%'))\n" + + "AND (b.ID = ? OR b.pids LIKE CONCAT(CONCAT('%',?),'%'))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n" + - "LIMIT ?,?",pas); + "LIMIT ?,?", pas); result.addAll(result2); CompletableFuture resourceCarNum = CompletableFuture.runAsync(() -> { //被申请数量 @@ -1070,26 +1109,26 @@ public class ResourceServiceImpl extends CrudServiceImpl> resourceKnowledgeDetails(Map params){ + public List> resourceKnowledgeDetails(Map params) { List> result = new CopyOnWriteArrayList<>(); Integer page = Integer.parseInt(params.get("page").toString()) - 1; Integer pageSize = Integer.parseInt(params.get("limit").toString()); - Object[] pas = {params.get("id"),params.get("id"),page,pageSize}; + Object[] pas = {params.get("id"), params.get("id"), page, pageSize}; - List> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) as resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + + List> result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '知识库' AND a.del_flag = 0\n" + - "AND (b.ID = ? OR b.pids like CONCAT(CONCAT('%',?),'%'))\n" + + "AND (b.ID = ? OR b.pids LIKE CONCAT(CONCAT('%',?),'%'))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n" + - "LIMIT ?,?",pas); + "LIMIT ?,?", pas); result.addAll(result2); return result; } -// @Override + // @Override // public List> selectDeptList(Map params){ // List> list = new ArrayList<>(); // Map map = new HashMap(); @@ -1112,8 +1151,8 @@ public class ResourceServiceImpl extends CrudServiceImpl> resourceBusinessUseDetails(Map params){ - List> result = new CopyOnWriteArrayList<>(); + public List> resourceBusinessUseDetails(Map params) { + List> result = new CopyOnWriteArrayList<>(); params.put("pageNum", (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString())); params.put("pageSize", params.get("limit")); result = baseDao.selectResurceCarDetails(params); @@ -1125,8 +1164,8 @@ public class ResourceServiceImpl extends CrudServiceImpl> resourceDatasUseDetails(Map params){ - List> result = new CopyOnWriteArrayList<>(); + public List> resourceDatasUseDetails(Map params) { + List> result = new CopyOnWriteArrayList<>(); params.put("pageNum", (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString())); params.put("pageSize", params.get("limit")); result = baseDao.selectResurceCarDetails(params); @@ -1134,15 +1173,15 @@ public class ResourceServiceImpl extends CrudServiceImpl> assemblerCarDetail(Map params){ - List> result = new ArrayList<>(); - Object[] ps = {params.get("id"),params.get("resourceType"),(Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()),Integer.parseInt(params.get("limit").toString())}; + public List> assemblerCarDetail(Map params) { + List> result = new ArrayList<>(); + Object[] ps = {params.get("id"), params.get("resourceType"), (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()), Integer.parseInt(params.get("limit").toString())}; result = jdbcTemplate.queryForList("\n" + - "SELECT a.*,b.username,c.name as resourcename from tb_resource_car a inner join sys_user b on a.user_id = b.id \n" + - "inner join tb_data_resource c on a.resource_id = c.id \n" + - "where b.dept_id = ? and c.type = ?\n" + - "order by a.create_date desc \n" + - "limit ?,?\n",ps); + "SELECT a.*,b.username,c.name AS resourcename FROM tb_resource_car a INNER JOIN sys_user b ON a.user_id = b.id \n" + + "INNER JOIN tb_data_resource c ON a.resource_id = c.id \n" + + "WHERE b.dept_id = ? AND c.type = ?\n" + + "ORDER BY a.create_date DESC \n" + + "LIMIT ?,?\n", ps); return result; }