From c64c3b4278ac7cb3aab468aa0c1a15a3bd94ba3c Mon Sep 17 00:00:00 2001 From: lizhicheng Date: Fri, 23 Sep 2022 17:42:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=8A=A5=E8=A1=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/HibrianApiGateway.java | 2 +- .../service/impl/ResourceServiceImpl.java | 40 ++++++++++++++++++- .../resources/mapper/resource/ResourceDao.xml | 2 + 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/HibrianApiGateway.java b/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/HibrianApiGateway.java index d5a85ed8..19cf62da 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/HibrianApiGateway.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/HibrianApiGateway.java @@ -121,7 +121,7 @@ public class HibrianApiGateway implements ApiGateway { //建路由(接口url) HashMap routeEntity = new HashMap(); routeEntity.put("name", "api:1:" + resourceDTO.getName()); - routeEntity.put("service_id", id); + routeEntity.put("serviceId", id); routeEntity.put("methods", methods); routeEntity.put("uris", apiPrefix + uris); routeEntity.put("enableMetric", true); 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 d5c7edf0..404500b5 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 @@ -2018,12 +2018,30 @@ public class ResourceServiceImpl extends CrudServiceImpl> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); Map>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString())); ArrayList resultList = new ArrayList<>(); + Map countMap = new HashMap<>(); typeCountListMap.forEach((k, v) -> { HashMap map = new HashMap<>(); + map.put("count", v.stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum()); map.put("name", k); - v.forEach(item -> map.put(item.get("type").toString(), item.get("count"))); + v.forEach(item -> { + map.put(item.get("type").toString(), item.get("count")); + if (countMap.containsKey(item.get("type"))) { + countMap.replace(item.get("type").toString(), Integer.parseInt(item.get("count").toString()) + countMap.get(item.get("type"))); + } else { + countMap.put(item.get("type").toString(), Integer.parseInt(item.get("count").toString())); + } + }); resultList.add(map); }); + Integer total=0; + for(Integer count : countMap.values()){ + total+=count; + } + countMap.put("count", total); + HashMap count = new HashMap<>(); + count.put("name", "总计"); + count.putAll(countMap); + resultList.add(count); return resultList; } @@ -2032,12 +2050,30 @@ public class ResourceServiceImpl extends CrudServiceImpl> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params); Map>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString())); ArrayList resultList = new ArrayList<>(); + Map countMap = new HashMap<>(); typeCountListMap.forEach((k, v) -> { HashMap map = new HashMap<>(); + map.put("count", v.stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum()); map.put("name", k); - v.forEach(item -> map.put(item.get("type").toString(), item.get("count"))); + v.forEach(item -> { + map.put(item.get("type").toString(), item.get("count")); + if (countMap.containsKey(item.get("type"))) { + countMap.replace(item.get("type").toString(), Integer.parseInt(item.get("count").toString()) + countMap.get(item.get("type"))); + } else { + countMap.put(item.get("type").toString(), Integer.parseInt(item.get("count").toString())); + } + }); resultList.add(map); }); + Integer total=0; + for(Integer count : countMap.values()){ + total+=count; + } + countMap.put("count", total); + HashMap count = new HashMap<>(); + count.put("name", "总计"); + count.putAll(countMap); + resultList.add(count); return resultList; } diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 717016d2..a5cfd97c 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -1715,6 +1715,7 @@ AND taa.user_id = su.id AND su.dept_id = sd.id AND taa.resource_id = tdr.id + AND (tdr.type = '应用资源' OR tdr.type = '智能算法' OR tdr.type = '图层服务' OR tdr.type = '开发组件' OR tdr.type = '业务组件') AND taa.approve_status = #{approveStatus} @@ -1754,6 +1755,7 @@ WHERE 1 = 1 AND tdr.dept_id = sd.id + AND (tdr.type = '应用资源' OR tdr.type = '智能算法' OR tdr.type = '图层服务' OR tdr.type = '开发组件' OR tdr.type = '业务组件') AND tdr.del_flag = 0