diff --git a/config/db/V8.2__add_table.sql b/config/db/V8.2__add_table.sql new file mode 100644 index 00000000..171d9fa0 --- /dev/null +++ b/config/db/V8.2__add_table.sql @@ -0,0 +1,18 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; +-- ---------------------------- +-- Table structure for t_ucs_lc_dept_rel +-- ---------------------------- +DROP TABLE IF EXISTS `t_ucs_lc_dept_rel`; +CREATE TABLE `t_ucs_lc_dept_rel` ( + `ucs_id` bigint(0) NOT NULL COMMENT 'ucs部门ID,sys_dept主键', + `ucs_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'ucs部门名称', + `district` bigint(0) NULL DEFAULT NULL COMMENT '部门所属地区', + `district_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地区名称', + `type` int(0) NULL DEFAULT NULL COMMENT '部门类型', + `lc_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '浪潮部门名称', + `lc_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '浪潮部门ID', + PRIMARY KEY (`ucs_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'ucs与浪潮部门名称对应表' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/renren-admin/src/main/java/io/renren/common/config/JdbcTemplateFactory.java b/renren-admin/src/main/java/io/renren/common/config/JdbcTemplateFactory.java new file mode 100644 index 00000000..06ce8421 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/common/config/JdbcTemplateFactory.java @@ -0,0 +1,37 @@ +package io.renren.common.config; + +import com.alibaba.druid.pool.DruidDataSource; +import io.renren.commons.dynamic.datasource.properties.DataSourceProperties; +import org.springframework.jdbc.core.JdbcTemplate; + +public class JdbcTemplateFactory { + + public static JdbcTemplate getJdbcTemplate() { + DataSourceProperties properties = new DataSourceProperties(); + JdbcTemplate jdbcTemplate = new JdbcTemplate(); + DruidDataSource druidDataSource = new DruidDataSource(); + + druidDataSource.setUrl("jdbc:oracle:thin:@15.72.183.89:1521:orcl"); + druidDataSource.setDriverClassName("oracle.jdbc.OracleDriver"); + druidDataSource.setUsername("csynuser"); + druidDataSource.setPassword("csynuser123"); + + druidDataSource.setInitialSize(properties.getInitialSize()); + druidDataSource.setMaxActive(properties.getMaxActive()); + druidDataSource.setMinIdle(properties.getMinIdle()); + druidDataSource.setMaxWait(properties.getMaxWait()); + druidDataSource.setTimeBetweenEvictionRunsMillis(properties.getTimeBetweenEvictionRunsMillis()); + druidDataSource.setMinEvictableIdleTimeMillis(properties.getMinEvictableIdleTimeMillis()); + druidDataSource.setMaxEvictableIdleTimeMillis(properties.getMaxEvictableIdleTimeMillis()); + druidDataSource.setValidationQuery(properties.getValidationQuery()); + druidDataSource.setValidationQueryTimeout(properties.getValidationQueryTimeout()); + druidDataSource.setTestOnBorrow(properties.isTestOnBorrow()); + druidDataSource.setTestOnReturn(properties.isTestOnReturn()); + druidDataSource.setPoolPreparedStatements(properties.isPoolPreparedStatements()); + druidDataSource.setMaxOpenPreparedStatements(properties.getMaxOpenPreparedStatements()); + druidDataSource.setSharePreparedStatements(properties.isSharePreparedStatements()); + jdbcTemplate.setDataSource(druidDataSource); + return jdbcTemplate; + } + +} diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java index 2fe4e76e..213151aa 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java @@ -4,6 +4,7 @@ import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.renren.common.annotation.LogOperation; +import io.renren.common.config.JdbcTemplateFactory; import io.renren.common.constant.Constant; import io.renren.common.exception.ErrorCode; import io.renren.common.page.PageData; @@ -55,12 +56,17 @@ public class ActTaskController { private SysUserService sysUserService; @Autowired private JdbcTemplate jdbcTemplate; - @Autowired protected RepositoryService repositoryService; @Autowired protected TaskService taskService; + private JdbcTemplate lcJdbcTemplate; + + public void setLcJdbcTemplate(JdbcTemplate lcJdbcTemplate) { + this.lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate(); + } + /** * 获取用户任务列表 * 根据用户ID或角色组获取任务信息 @@ -448,22 +454,21 @@ public class ActTaskController { }) public Result getZwyBusinessList(String name, String applyType, String status, int pageNum, int pageSize) { UserDetail user = SecurityUser.getUser(); - JdbcTemplate jdbcTemplate = getJDBCTemplate(); StringBuilder sql = new StringBuilder("SELECT BSNUM, BUSINESS_NAME, APPLYTYPE, to_char(CREATE_TIME,'yyyy-mm-dd hh24:mi:ss') AS \"CREATE_TIME\", STATUS " + - "FROM VIEW_CLOUD_BUSINESS_INDEX WHERE 1 = 1 AND STATUS != '00' AND ACCOUNT = " + user.getUsername()); + "FROM VIEW_CLOUD_BUSINESS_INDEX WHERE 1 = 1 AND APPLYTYPE = '01' AND STATUS != '00' AND ACCOUNT = '" + user.getUsername() + "'"); if (!StringUtils.isEmpty(name)) { sql.append(" AND BUSINESS_NAME LIKE CONCAT('%', ").append(name).append(", '%') "); } if (!StringUtils.isEmpty(applyType)) { - sql.append(" AND APPLYTYPE = ").append(applyType); + sql.append(" AND APPLYTYPE = '").append(applyType).append("'"); } if (!StringUtils.isEmpty(status)) { - sql.append(" AND STATUS = ").append(status); + sql.append(" AND STATUS = '").append(status).append("'"); } sql.append("ORDER BY CREATE_TIME DESC"); try { Map resultMap = new HashMap<>(); - List> list = jdbcTemplate.queryForList(sql.toString()); + List> list = lcJdbcTemplate.queryForList(sql.toString()); resultMap.put("total", list.size()); List> result = list.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); resultMap.put("list", result); @@ -486,19 +491,18 @@ public class ActTaskController { }) public Result getZwyVideoList(String name, String status, int pageNum, int pageSize) { UserDetail user = SecurityUser.getUser(); - JdbcTemplate jdbcTemplate = getJDBCTemplate(); StringBuilder sql = new StringBuilder("SELECT BSNUM, BUSINESS_NAME, to_char(CREATE_TIME,'yyyy-mm-dd hh24:mi:ss') AS \"CREATE_TIME\", STATUS " + - "FROM VIEW_VIDEO_BUSINESS_INDEX WHERE 1 = 1 AND STATUS != '00' AND ACCOUNT = " + user.getUsername()); + "FROM VIEW_VIDEO_BUSINESS_INDEX WHERE 1 = 1 AND STATUS != '00' AND ACCOUNT = '" + user.getUsername() + "'"); if (!StringUtils.isEmpty(name)) { sql.append(" AND BUSINESS_NAME LIKE CONCAT('%', ").append(name).append(", '%') "); } if (!StringUtils.isEmpty(status)) { - sql.append(" AND STATUS = ").append(status); + sql.append(" AND STATUS = '").append(status).append("'"); } sql.append("ORDER BY CREATE_TIME DESC"); try { Map resultMap = new HashMap<>(); - List> list = jdbcTemplate.queryForList(sql.toString()); + List> list = lcJdbcTemplate.queryForList(sql.toString()); resultMap.put("total", list.size()); List> result = list.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); resultMap.put("list", result); @@ -517,8 +521,6 @@ public class ActTaskController { @ApiImplicitParam(name = "id", value = "业务ID", paramType = "query", required = true, dataType = "String") }) public Result getZwyBusinessInfoById(String id) { - JdbcTemplate jdbcTemplate = getJDBCTemplate(); - try { ArrayList arrayList = new ArrayList<>(); @@ -526,10 +528,9 @@ public class ActTaskController { CompletableFuture yzj = CompletableFuture.runAsync(() -> { StringBuilder sql = new StringBuilder("SELECT BSNUM, '云主机' AS \"SOURCE_TYPE\", NAME, DISPOSE AS \"INFO\" " + - " FROM VIEW_CLOUD_HOST_INFO WHERE 1 = 1 AND BSNUM = "); - sql.append(id); - - List> list = jdbcTemplate.queryForList(sql.toString()); + " FROM VIEW_CLOUD_HOST_INFO WHERE 1 = 1 AND BSNUM = '"); + sql.append(id).append("'"); + List> list = lcJdbcTemplate.queryForList(sql.toString()); arrayList.addAll(list); }, executor); @@ -538,10 +539,9 @@ public class ActTaskController { CompletableFuture ysjk = CompletableFuture.runAsync(() -> { StringBuilder sql = new StringBuilder("SELECT BSNUM, '云数据库' AS \"SOURCE_TYPE\", NAME, (TYPE || '/' || STORAGE_SPACE || 'GB') AS \"INFO\" " + - " FROM VIEW_CLOUD_HOST_INFO WHERE 1 = 1 AND BSNUM = "); - sql.append(id); - - List> list = jdbcTemplate.queryForList(sql.toString()); + " FROM VIEW_CLOUD_DATABASE_INFO WHERE 1 = 1 AND BSNUM = '"); + sql.append(id).append("'"); + List> list = lcJdbcTemplate.queryForList(sql.toString()); arrayList.addAll(list); }, executor); @@ -550,28 +550,23 @@ public class ActTaskController { CompletableFuture dxcc = CompletableFuture.runAsync(() -> { StringBuilder sql = new StringBuilder("SELECT BSNUM, '对象存储' AS \"SOURCE_TYPE\", NAME, (DATA_DISK || 'GB') AS \"INFO\" " + - " FROM VIEW_CLOUD_HOST_INFO WHERE 1 = 1 AND BSNUM = "); - sql.append(id); - - List> list = jdbcTemplate.queryForList(sql.toString()); + " FROM VIEW_CLOUD_OBJECTSTORAGE_INFO WHERE 1 = 1 AND BSNUM = '"); + sql.append(id).append("'"); + List> list = lcJdbcTemplate.queryForList(sql.toString()); arrayList.addAll(list); }, executor); - //托管服务 CompletableFuture tgfw = CompletableFuture.runAsync(() -> { - - StringBuilder sql = new StringBuilder("SELECT BSNUM, '托管服务' AS \"SOURCE_TYPE\", NAME, U_NUM AS \"INFO\" " + - " FROM VIEW_CLOUD_HOST_INFO WHERE 1 = 1 AND BSNUM = "); - sql.append(id); - - List> list = jdbcTemplate.queryForList(sql.toString()); + StringBuilder sql = new StringBuilder("SELECT BSNUM, '托管服务' AS \"SOURCE_TYPE\", NAME, (U_NUM || 'U') AS \"INFO\" " + + " FROM VIEW_TRUSTEESHIPSERVICE_INFO WHERE 1 = 1 AND BSNUM = '"); + sql.append(id).append("'"); + List> list = lcJdbcTemplate.queryForList(sql.toString()); arrayList.addAll(list); }, executor); - CompletableFuture all = CompletableFuture.allOf(yzj, ysjk, dxcc, tgfw); all.join(); return new Result().ok(arrayList); @@ -588,12 +583,12 @@ public class ActTaskController { @ApiImplicitParam(name = "id", value = "业务ID", paramType = "query", required = true, dataType = "String") }) public Result getZwyVideoInfoById(String id) { - JdbcTemplate jdbcTemplate = getJDBCTemplate(); + StringBuilder sql = new StringBuilder("SELECT BSNUM, CAMERATYPE, NAME, ORG_NAME " + - "FROM VIEW_VIDEO_BUSINESS_RELATION WHERE 1 = 1 AND BSNUM = "); - sql.append(id); + "FROM VIEW_VIDEO_BUSINESS_RELATION WHERE 1 = 1 AND BSNUM = '"); + sql.append(id).append("'"); try { - List> list = jdbcTemplate.queryForList(sql.toString()); + List> list = lcJdbcTemplate.queryForList(sql.toString()); return new Result().ok(list); } catch (Exception e) { return new Result().error("数据查询异常,请联系云资源数据库管理人员!"); @@ -601,16 +596,6 @@ public class ActTaskController { } - private JdbcTemplate getJDBCTemplate() { - DruidDataSource druidDataSource = new DruidDataSource(); - druidDataSource.setUrl("jdbc:oracle:thin:@15.72.183.89:1521:orcl"); - druidDataSource.setDriverClassName("oracle.jdbc.OracleDriver"); - druidDataSource.setUsername("csynuser"); - druidDataSource.setPassword("csynuser123"); - jdbcTemplate.setDataSource(druidDataSource); - return jdbcTemplate; - } - @PostMapping("batchBackToFirst") @ApiOperation("驳回,回退至第一个用户任务(重新录入表单)") @LogOperation("驳回,回退至第一个用户任务(重新录入表单)") diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java index 024f9c06..39614862 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActTaskService.java @@ -311,7 +311,7 @@ public class ActTaskService extends BaseServiceImpl { StringBuilder stringBuilder = new StringBuilder(); List resourcesName = resourceDao.selectResourcesTypeByIds(resourceIds); resourcesName.forEach(x -> stringBuilder.append(x).append(",")); - String string = stringBuilder.substring(0, stringBuilder.length() - 2); + String string = stringBuilder.substring(0, stringBuilder.length() - 1); dto.setResourceType(string); }, executor); @@ -320,7 +320,7 @@ public class ActTaskService extends BaseServiceImpl { StringBuilder stringBuilder = new StringBuilder(); List proviDeptsName = resourceDao.selectProvideDeptNameByIds(resourceIds); proviDeptsName.forEach(x -> stringBuilder.append(x).append(",")); - String string = stringBuilder.substring(0, stringBuilder.length() - 2); + String string = stringBuilder.substring(0, stringBuilder.length() - 1); dto.setProvideDept(string); }, executor); 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 9beb9934..3d9fc8e0 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 @@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; +import io.renren.common.config.JdbcTemplateFactory; import io.renren.common.constant.Constant; import io.renren.common.domain.Tsingtao_xhaProperties; import io.renren.common.page.PageData; @@ -250,6 +251,35 @@ public class ResourceServiceImpl extends CrudServiceImpl getWrapper(Map params) { @@ -2201,8 +2231,43 @@ public class ResourceServiceImpl extends CrudServiceImpl> zwyCountListByapplyDept = new ArrayList<>(); + Map lcDept = sysDeptDao.selectLCDeptByUcsDeptName(params.get("deptId").toString()); + if (lcDept.isEmpty() || org.apache.commons.lang3.StringUtils.isBlank(lcDept.get("lc_name").toString())) { + logger.error("未查询到{}对应的浪潮系统部门", params.get("provideDept").toString()); + return new ArrayList<>(); + } else { + StringBuilder sb = new StringBuilder("SELECT\n" + + "\tCOUNT( BSNUM ) AS \"count\",\n" + + "\t'yzy' AS \"type\" \n" + + "FROM\n" + + "\tVIEW_CLOUD_BUSINESS_INDEX \n" + + "WHERE\n" + + "\t1 = 1 \n" + + "\tAND ORG_NAME = '"); + sb.append(lcDept.get("lc_name").toString()) + .append("' UNION ALL\n" + + "SELECT\n" + + "\tCOUNT( BSNUM ) AS \"count\",\n" + + "\t'ysp' AS \"type\" \n" + + "FROM\n" + + "\tVIEW_VIDEO_BUSINESS_INDEX \n" + + "WHERE\n" + + "\t1 = 1 \n" + + "\tAND ORG_NAME = '") + .append(lcDept.get("lc_name").toString()) + .append("'"); + zwyCountListByapplyDept.addAll(lcJdbcTemplate.queryForList(sb.toString())); + } + List> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); + if (!typeCountListByApplyDept.isEmpty() && !zwyCountListByapplyDept.isEmpty()) { + typeCountListByApplyDept.get(0).putAll(zwyCountListByapplyDept.get(0)); + } + Map>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString())); ArrayList resultList = new ArrayList<>(); Map countMap = new HashMap<>(); @@ -2231,7 +2296,24 @@ public class ResourceServiceImpl extends CrudServiceImpl> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); + if ("250000".equals(params.get("region").toString())) { + List> zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql); + + zwyCountListByApplyDept.forEach(x -> { + Map ucsDept = sysDeptDao.selectUCSDeptByLCDeptName(x.get("deptName").toString()); + if (!ucsDept.isEmpty()) { + x.put("dept_id", ucsDept.get("ucs_id").toString()); + x.put("deptType", ucsDept.get("type").toString()); + x.put("district", ucsDept.get("district").toString()); + x.replace("deptName", ucsDept.get("ucs_name").toString()); + } + }); + typeCountListByApplyDept.addAll(zwyCountListByApplyDept); + } + + Map>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString())); ArrayList resultList = new ArrayList<>(); Map countMap = new HashMap<>(); @@ -2260,7 +2342,20 @@ public class ResourceServiceImpl extends CrudServiceImpl> zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql); + + zwyCountListByApplyDept.forEach(x -> { + Map ucsDept = sysDeptDao.selectUCSDeptByLCDeptName(x.get("deptName").toString()); + if (!ucsDept.isEmpty()) { + x.put("dept_id", ucsDept.get("ucs_id").toString()); + x.put("deptType", ucsDept.get("type").toString()); + x.put("district", ucsDept.get("district").toString()); + } + }); List> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); + typeCountListByApplyDept.addAll(zwyCountListByApplyDept); + List> resultList = new ArrayList<>(); resultList.addAll(getDeptTemp2()); resultList.addAll(getDeptTemp1()); @@ -2283,6 +2378,7 @@ public class ResourceServiceImpl extends CrudServiceImpl>> typeCountListMap1 = // 区级部门 typeCountListByApplyDept.stream().filter(index -> index.get("deptType").toString().equals("3")) .collect(Collectors.groupingBy(m -> m.get("district").toString())); @@ -2358,6 +2454,8 @@ public class ResourceServiceImpl extends CrudServiceImpl dtoList = resourceDao.selectCensusApplyTable(params); - List result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); - return new PageData(result, dtoList.size()); + + List result = new ArrayList(); + + if (null == params.get("resourceType")) { + AtomicInteger total = new AtomicInteger(); + //本地ucs系统申请记录 + CompletableFuture ucs = CompletableFuture.runAsync(() -> { + List ucsApplyDtoList = resourceDao.selectCensusApplyTable(params); + result.addAll(ucsApplyDtoList); + total.addAndGet(ucsApplyDtoList.size()); + }, executor); + + //浪潮政务云和云视频申请记录 + CompletableFuture lc = CompletableFuture.runAsync(() -> { + List lcApplyDtoList = lcSelectCensusApplyTable(params); + result.add(lcApplyDtoList); + total.addAndGet(lcApplyDtoList.size()); + }, executor); + CompletableFuture.allOf(ucs, lc).join(); + //根据时间重新排序再分页 + result.stream() + .sorted(Comparator.comparing(x -> { + Map map = (Map) x; + return DateUtils.parse(map.get("createDate").toString(), DateUtils.DATE_TIME_PATTERN); + }).reversed()) + .skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); + return new PageData(result, total.intValue()); + } else if ("云资源".equals(params.get("resourceType").toString()) || "云视频".equals(params.get("resourceType").toString())){ + List lcApplyDtoList = lcSelectCensusApplyTable(params); + result.addAll(lcApplyDtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList())); + return new PageData(result, lcApplyDtoList.size()); + } else { + List ucsApplyDtoList = resourceDao.selectCensusApplyTable(params); + result.addAll(ucsApplyDtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList())); + return new PageData(result, ucsApplyDtoList.size()); + } + } + + private List lcSelectCensusApplyTable(Map params) { + StringBuilder sb = new StringBuilder("SELECT * FROM (\n" + + "SELECT\n" + + "\tvcbi.ORG_NAME AS \"deptName\", bsrel.name AS \"resourceName\", '青岛市大数据发展管理局' AS \"resourceDeptName\",\n" + + "\tbsrel.SOURCE_TYPE AS \"type\", to_char( vcbi.CREATE_TIME, 'yyyy-mm-dd HH24:MI:SS' ) AS \"createDate\",\n" + + "\tvcbi.status AS \"approveStatus\", bsrel.BSNUM AS \"applyNumber\" \n" + + "FROM\n" + + "\t(\n" + + "\t\tSELECT BSNUM, '云主机' AS \"SOURCE_TYPE\", NAME, DISPOSE AS \"INFO\" FROM VIEW_CLOUD_HOST_INFO \n" + + "\t\tUNION ALL\n" + + "\t\tSELECT BSNUM, '云数据库' AS \"SOURCE_TYPE\", NAME, (TYPE || '/' || STORAGE_SPACE || 'GB') AS \"INFO\" FROM VIEW_CLOUD_DATABASE_INFO \n" + + "\t\tUNION ALL\n" + + "\t\tSELECT BSNUM, '对象存储' AS \"SOURCE_TYPE\", NAME, ( DATA_DISK || 'GB' ) AS \"INFO\" FROM VIEW_CLOUD_OBJECTSTORAGE_INFO \n" + + "\t\tUNION ALL\n" + + "\t\tSELECT BSNUM, '托管服务' AS \"SOURCE_TYPE\", NAME, U_NUM AS \"INFO\" FROM VIEW_TRUSTEESHIPSERVICE_INFO\n" + + "\t) bsrel\n" + + "\tLEFT JOIN VIEW_CLOUD_BUSINESS_INDEX vcbi ON bsrel.BSNUM = vcbi.BSNUM \n" + + "WHERE\n" + + "\tvcbi.APPLYTYPE = '01' \n" + + "\tAND vcbi.status IN ( '01', '03', '04', '05', '06', '99' )\n" + + "\tUNION ALL\n" + + "\tSELECT vvbi.ORG_NAME AS \"deptName\", vvbr.name AS \"resourceName\", vvbr.ORG_NAME AS \"resourceDeptName\",\n" + + "\t'云视频' AS \"type\", to_char( vvbi.CREATE_TIME, 'yyyy-mm-dd HH24:MI:SS' ) AS \"createDate\", vvbi.status AS \"approveStatus\", \n" + + "\tvvbr.BSNUM AS \"applyNumber\" \n" + + "FROM\n" + + "\tVIEW_VIDEO_BUSINESS_RELATION vvbr\n" + + "\tLEFT JOIN VIEW_VIDEO_BUSINESS_INDEX vvbi ON vvbr.BSNUM = vvbi.BSNUM \n" + + "WHERE\n" + + "\tvvbi.STATUS != '00'\n" + + "\tAND vvbr.ORG_NAME IS NOT NULL \n" + + "\t) apply \n" + + "\tWHERE 1 = 1\n" + + "\t\n"); + + if (params.get("provideDept") != null) { + Map lcDept = sysDeptDao.selectLCDeptByUcsDeptName(params.get("provideDept").toString()); + + if (lcDept.isEmpty() || org.apache.commons.lang3.StringUtils.isBlank(lcDept.get("lc_name").toString())) { + logger.error("未查询到{}对应的浪潮系统部门", params.get("provideDept").toString()); + return new ArrayList<>(); + } + sb.append(" AND apply.\"resourceDeptName\" = ").append(lcDept.get("lc_name").toString()); + } + if (params.get("region") != null) { + List deptNames = sysDeptDao.selectLCDeptByRegion((Long)params.get("region")); + logger.error("只查询本区域部门申请,部门列表{}", deptNames); + sb.append(" AND apply.\"deptName\" IN ( "); + deptNames.forEach(name -> sb.append("'").append(name).append("', ")); + sb.deleteCharAt(sb.length() - 1); + sb.append(" ) "); + } + if (params.get("type") != null) { + if ("云视频".equals(params.get("type").toString())) { + sb.append(" AND apply.type = '云视频' "); + } else { + sb.append(" AND apply.type != '云视频' "); + } + } + if (params.get("startDate") != null && params.get("endDate") != null) { + sb.append(" AND apply.\"createDate\" BETWEEN '").append(params.get("startDate").toString()) + .append("' AND '").append(params.get("endDate").toString()).append("'"); + } + if (params.get("approveStatus") != null) { + sb.append(" AND apply.\"approveStatus\" = '").append(params.get("approveStatus").toString()).append("'"); + } + if (params.get("deptId") != null) { + sb.append(" AND apply.\"deptName\" = '").append(params.get("deptId").toString()).append("'"); + } + if (params.get("resourceName") != null) { + sb.append(" AND apply.\"resourceName\" LIKE '%" + params.get("resourceName").toString() + "%'"); + } + sb.append(" ORDER BY apply.\"createDate\" DESC"); + logger.error("查询浪潮数据库--按资源查询申请记录SQL:{}", sb); + List> list = jdbcTemplate.queryForList(sb.toString()); + return new ArrayList<>(list); + } + + @Override public Object getPraiseList() { return resourceDao.getPraiseList(); @@ -2842,4 +3059,5 @@ public class ResourceServiceImpl extends CrudServiceImpl { */ SysDeptEntity getByName(String name); + Map selectLCDeptByUcsDeptName(@Param("provideDept") String provideDept); + + List selectLCDeptByRegion(@Param("region") Long region); + + Map selectUCSDeptByLCDeptName(@Param("deptName") String deptName); + } \ No newline at end of file diff --git a/renren-admin/src/main/resources/db/V8.2__add_table.sql b/renren-admin/src/main/resources/db/V8.2__add_table.sql new file mode 100644 index 00000000..171d9fa0 --- /dev/null +++ b/renren-admin/src/main/resources/db/V8.2__add_table.sql @@ -0,0 +1,18 @@ +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; +-- ---------------------------- +-- Table structure for t_ucs_lc_dept_rel +-- ---------------------------- +DROP TABLE IF EXISTS `t_ucs_lc_dept_rel`; +CREATE TABLE `t_ucs_lc_dept_rel` ( + `ucs_id` bigint(0) NOT NULL COMMENT 'ucs部门ID,sys_dept主键', + `ucs_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'ucs部门名称', + `district` bigint(0) NULL DEFAULT NULL COMMENT '部门所属地区', + `district_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地区名称', + `type` int(0) NULL DEFAULT NULL COMMENT '部门类型', + `lc_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '浪潮部门名称', + `lc_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '浪潮部门ID', + PRIMARY KEY (`ucs_id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'ucs与浪潮部门名称对应表' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 0746ade5..ac4f65f7 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -1882,13 +1882,11 @@ FROM (SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.del_flag, d.dept_id, d.create_date FROM tb_data_resource d LEFT JOIN tb_data_attr a ON d.id=a.data_resource_id AND a.attr_type='组件类型' AND - a.del_flag=0) tdr, + a.del_flag=0 WHERE d.type IN ('应用资源', '组件服务') AND d.del_flag = 0) tdr, sys_dept sd 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 @@ -2001,7 +1999,8 @@ AND a.attr_type = '组件类型' AND a.del_flag = 0 WHERE - d.type NOT IN ( '知识库', '基础设施', '数据资源' ) + d.type IN ( '应用资源', '组件服务' ) + AND d.del_flag = 0 ) tdr, sys_dept sd, sys_user su, @@ -2018,7 +2017,7 @@ AND taa.approve_status = #{approveStatus} - AND sd.id = #{deptId} + AND sd.name LIKE CONCAT('%', #{deptId} , '%') AND tdr.type = #{type} @@ -2030,15 +2029,15 @@ AND tdr.name LIKE CONCAT( '%', #{resourceName}, '%' ) - AND dept.`name` LIKE CONCAT( '%', #{provideDept}, '%' ) + AND dept.id = #{provideDept} AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate} - UNION ALL + UNION ALL SELECT tmb.dept AS 'deptName', tm.`name` AS 'resourceName', @@ -2050,9 +2049,13 @@ '' AS 'applyNumber' FROM t_meetingroom_book tmb, - t_meetingroom tm + t_meetingroom tm, + sys_dept sd, + sys_region sr WHERE - tmb.room_id = tm.id + tmb.room_id = tm.id + AND tmb.dept = sd.name + AND sd.district = sr.id AND tmb.state=2 @@ -2065,10 +2068,13 @@ - AND tmb.dept = #{deptId} + AND tmb.dept LIKE CONCAT( '%', #{deptId}, '%' ) - AND '青岛市大数据发展管理局' LIKE CONCAT( '%', #{provideDept}, '%' ) + AND #{provideDept} = 1067246875800000066 + + + AND sr.id = #{region} AND tm.name LIKE CONCAT( '%', #{resourceName}, '%' ) diff --git a/renren-admin/src/main/resources/mapper/sys/SysDeptDao.xml b/renren-admin/src/main/resources/mapper/sys/SysDeptDao.xml index 0d4aec95..e470d778 100644 --- a/renren-admin/src/main/resources/mapper/sys/SysDeptDao.xml +++ b/renren-admin/src/main/resources/mapper/sys/SysDeptDao.xml @@ -36,4 +36,15 @@ where t1.name = #{name} LIMIT 1 + + + + + \ No newline at end of file