From 9b61af88ff92b6f8e95d380da348783813fbcb1f Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 10 Jan 2023 14:00:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E9=BB=98=E8=AE=A4=E6=95=B0?= =?UTF-8?q?=E9=87=8F0=20=E5=92=8C=20=E8=A1=A5=E5=85=85=E6=94=BF=E5=8A=A1?= =?UTF-8?q?=E4=BA=91=E8=B5=84=E6=BA=90=E9=83=A8=E9=97=A8=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResourceServiceImpl.java | 8 ++++ .../sys/controller/SysDeptController.java | 42 ++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) 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 00c79b22..8103d495 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 @@ -2438,6 +2438,14 @@ public class ResourceServiceImpl extends CrudServiceImpl map = new HashMap<>(); map.put("count", v.stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum()); map.put("name", k); + map.put("yyzy", "0"); + map.put("znsf", "0"); + map.put("tcfw", "0"); + map.put("kfzj", "0"); + map.put("ywzj", "0"); + map.put("jcss", "0"); + map.put("zsk", "0"); + map.put("sjzy", "0"); v.forEach(item -> { map.put(item.get("type").toString(), item.get("count")); if (countMap.containsKey(item.get("type"))) { diff --git a/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java b/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java index b8d4d34e..351df329 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/controller/SysDeptController.java @@ -1,6 +1,7 @@ package io.renren.modules.sys.controller; import io.renren.common.annotation.LogOperation; +import io.renren.common.config.JdbcTemplateFactory; import io.renren.common.constant.Constant; import io.renren.common.page.PageData; import io.renren.common.utils.Result; @@ -22,6 +23,7 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; @@ -44,6 +46,35 @@ public class SysDeptController { @Autowired private SysUserService sysUserService; + @Value("#{new Boolean(${cloud.enable})}") + private Boolean cloud; // 是否进行云资源统计 + + private JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate(); + + + /** + * 获取云资源申请 + */ + private static final String getAllsql = "SELECT " + + " ORG_NAME AS \"deptName\" " + + "FROM " + + " VIEW_CLOUD_BUSINESS_INDEX " + + "WHERE " + + " 1 = 1 " + + " AND APPLYTYPE = '01' " + + " AND STATUS NOT IN ( '00', '07', '99' ) " + + "GROUP BY " + + " ORG_NAME UNION ALL " + + "SELECT " + + " ORG_NAME AS \"deptName\" " + + "FROM " + + " VIEW_VIDEO_BUSINESS_INDEX " + + "WHERE " + + " 1 = 1 " + + " AND STATUS != '00' " + + "GROUP BY " + + " ORG_NAME"; + @GetMapping("list") @ApiOperation("查询部门列表") @LogOperation("查询部门列表") @@ -110,13 +141,22 @@ public class SysDeptController { } } List> list_metting = jdbcTemplate.queryForList("SELECT DISTINCT dept from t_meetingroom_book WHERE dept IS NOT NULL;"); - List temp = list.stream().map(index -> index.get("name")).filter(index -> index != null).map(index -> index.toString()).collect(Collectors.toList()); + List temp = list.stream().map(index -> index.get("name")).filter(index -> index != null).map(index -> index.toString()).distinct().collect(Collectors.toList()); List> list_ = list_metting.stream().map(index -> index.get("dept")).filter(index -> index != null).collect(Collectors.toList()) .stream().filter(index -> !temp.contains(index.toString())).map(index -> new HashMap() {{ put("id", null); put("name", index.toString()); }}).collect(Collectors.toList()); list.addAll(list_); // 获取会客厅申请部门 + if (cloud) { + List> list_zwy = lcJdbcTemplate.queryForList(getAllsql); + List> list_1 = list_zwy.stream().map(index -> index.get("deptName")).filter(index -> index != null).distinct().collect(Collectors.toList()) + .stream().filter(index -> !temp.contains(index.toString())).map(index -> new HashMap() {{ + put("id", null); + put("name", index.toString()); + }}).collect(Collectors.toList()); + list.addAll(list_1); // 获取政务云申请部门 + } return new Result>>().ok(list); }