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 754b2bc8..48673351 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 @@ -183,6 +183,9 @@ public class ResourceServiceImpl extends CrudServiceImpl{}", sb); logger.error("查询浪潮数据库异常", e); @@ -2418,7 +2423,9 @@ public class ResourceServiceImpl extends CrudServiceImpl> zwyCountListByApplyDept = new ArrayList<>(); try { - zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql); + if (cloud) { + zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql); + } } catch (Exception e) { logger.error(getAllsql, e); } @@ -2478,7 +2485,9 @@ public class ResourceServiceImpl extends CrudServiceImpl> zwyCountListByApplyDept = new ArrayList<>(); try { - zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql); + if (cloud) { + zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql); + } } catch (Exception e) { logger.info(getAllsql, e); } @@ -2513,7 +2522,7 @@ public class ResourceServiceImpl extends CrudServiceImpl { if (typeCountListMap.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息 - + index.put("level", "municipal"); // 市级别 index.put("count", typeCountListMap.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum()); typeCountListMap.get(index.get("dept_id").toString()).stream().forEach(count -> { @@ -2533,6 +2542,7 @@ public class ResourceServiceImpl extends CrudServiceImpl index.get("deptType").toString().equals("3")) .collect(Collectors.groupingBy(m -> m.get("district").toString())); resultList = resultList.stream().map(index -> { + index.put("level", "county"); // 区县级别 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()); typeCountListMap1.get(index.get("dept_id").toString()).stream().forEach(count -> { @@ -2553,6 +2563,7 @@ public class ResourceServiceImpl extends CrudServiceImpl index.get("deptType").toString().equals("4")) .collect(Collectors.groupingBy(m -> m.get("dept_id").toString())); resultList = resultList.stream().map(index -> { + index.put("level", "other"); // 企业级别 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()); typeCountListMap2.get(index.get("dept_id").toString()).stream().forEach(count -> { @@ -2711,6 +2722,7 @@ public class ResourceServiceImpl extends CrudServiceImpl countMap = new HashMap<>(); resultList = resultList.stream().map(index -> { + index.put("level", "municipal"); // 市级别 if (typeCountListMap.keySet().contains(index.get("dept_id").toString())) { // 该部门存在上架信息 index.put("count", typeCountListMap.get(index.get("dept_id").toString()).stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum()); typeCountListMap.get(index.get("dept_id").toString()).stream().forEach(count -> { @@ -2728,6 +2740,7 @@ public class ResourceServiceImpl extends CrudServiceImpl index.get("deptType").toString().equals("3")) .collect(Collectors.groupingBy(m -> m.get("district").toString())); resultList = resultList.stream().map(index -> { + index.put("level", "county"); // 区县级别 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()); typeCountListMap1.get(index.get("dept_id").toString()).stream().forEach(count -> { @@ -2745,6 +2758,7 @@ public class ResourceServiceImpl extends CrudServiceImpl index.get("deptType").toString().equals("4")) .collect(Collectors.groupingBy(m -> m.get("dept_id").toString())); resultList = resultList.stream().map(index -> { + index.put("level", "other"); // 企业级别 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()); typeCountListMap2.get(index.get("dept_id").toString()).stream().forEach(count -> { @@ -3035,7 +3049,9 @@ public class ResourceServiceImpl extends CrudServiceImpl> list = new ArrayList<>(); try { - list = lcJdbcTemplate.queryForList(sb.toString()); + if (cloud) { + list = lcJdbcTemplate.queryForList(sb.toString()); + } list = list.stream().map(index -> { logger.info("云资源使用信息信息:" + JSON.toJSONString(index)); switch (index.get("type").toString()) { // 根据类型填充其审核状态 diff --git a/renren-admin/src/main/resources/application.yml b/renren-admin/src/main/resources/application.yml index afad6a31..68c2e9ca 100644 --- a/renren-admin/src/main/resources/application.yml +++ b/renren-admin/src/main/resources/application.yml @@ -185,4 +185,7 @@ enke: # 开启审核组成员支持 auditteam: enable: true +# 是否统计云资源 +cloud: + enable: false