1.云资源和云视频申请查询接口

2.ucs与浪潮部门对应表
This commit is contained in:
dinggang 2022-12-10 16:10:20 +08:00
parent aa31a7bd43
commit a52ecdaeca
9 changed files with 363 additions and 66 deletions

View File

@ -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部门IDsys_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;

View File

@ -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;
}
}

View File

@ -4,6 +4,7 @@ import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.common.annotation.LogOperation; import io.renren.common.annotation.LogOperation;
import io.renren.common.config.JdbcTemplateFactory;
import io.renren.common.constant.Constant; import io.renren.common.constant.Constant;
import io.renren.common.exception.ErrorCode; import io.renren.common.exception.ErrorCode;
import io.renren.common.page.PageData; import io.renren.common.page.PageData;
@ -11,7 +12,6 @@ import io.renren.common.utils.Result;
import io.renren.modules.activiti.dto.BatchCompleteDTO; import io.renren.modules.activiti.dto.BatchCompleteDTO;
import io.renren.modules.activiti.dto.TaskDTO; import io.renren.modules.activiti.dto.TaskDTO;
import io.renren.modules.activiti.service.ActTaskService; import io.renren.modules.activiti.service.ActTaskService;
import io.renren.modules.device.dto.TbDeviceApplyDTO;
import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.security.user.UserDetail; import io.renren.modules.security.user.UserDetail;
import io.renren.modules.sys.dto.SysUserDTO; import io.renren.modules.sys.dto.SysUserDTO;
@ -26,7 +26,6 @@ import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.repository.ProcessDefinitionQuery; import org.activiti.engine.repository.ProcessDefinitionQuery;
import org.activiti.engine.task.TaskQuery; import org.activiti.engine.task.TaskQuery;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -36,7 +35,6 @@ import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.logging.Logger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -58,12 +56,17 @@ public class ActTaskController {
private SysUserService sysUserService; private SysUserService sysUserService;
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired @Autowired
protected RepositoryService repositoryService; protected RepositoryService repositoryService;
@Autowired @Autowired
protected TaskService taskService; protected TaskService taskService;
private JdbcTemplate lcJdbcTemplate;
public void setLcJdbcTemplate(JdbcTemplate lcJdbcTemplate) {
this.lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate();
}
/** /**
* 获取用户任务列表 * 获取用户任务列表
* 根据用户ID或角色组获取任务信息 * 根据用户ID或角色组获取任务信息
@ -441,22 +444,21 @@ public class ActTaskController {
}) })
public Result getZwyBusinessList(String name, String applyType, String status, int pageNum, int pageSize) { public Result getZwyBusinessList(String name, String applyType, String status, int pageNum, int pageSize) {
UserDetail user = SecurityUser.getUser(); 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 " + 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)) { if (!StringUtils.isEmpty(name)) {
sql.append(" AND BUSINESS_NAME LIKE CONCAT('%', ").append(name).append(", '%') "); sql.append(" AND BUSINESS_NAME LIKE CONCAT('%', ").append(name).append(", '%') ");
} }
if (!StringUtils.isEmpty(applyType)) { if (!StringUtils.isEmpty(applyType)) {
sql.append(" AND APPLYTYPE = ").append(applyType); sql.append(" AND APPLYTYPE = '").append(applyType).append("'");
} }
if (!StringUtils.isEmpty(status)) { if (!StringUtils.isEmpty(status)) {
sql.append(" AND STATUS = ").append(status); sql.append(" AND STATUS = '").append(status).append("'");
} }
sql.append("ORDER BY CREATE_TIME DESC"); sql.append("ORDER BY CREATE_TIME DESC");
try { try {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString()); List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
resultMap.put("total", list.size()); resultMap.put("total", list.size());
List<Map<String, Object>> result = list.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); List<Map<String, Object>> result = list.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
resultMap.put("list", result); resultMap.put("list", result);
@ -479,19 +481,18 @@ public class ActTaskController {
}) })
public Result getZwyVideoList(String name, String status, int pageNum, int pageSize) { public Result getZwyVideoList(String name, String status, int pageNum, int pageSize) {
UserDetail user = SecurityUser.getUser(); 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 " + 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)) { if (!StringUtils.isEmpty(name)) {
sql.append(" AND BUSINESS_NAME LIKE CONCAT('%', ").append(name).append(", '%') "); sql.append(" AND BUSINESS_NAME LIKE CONCAT('%', ").append(name).append(", '%') ");
} }
if (!StringUtils.isEmpty(status)) { if (!StringUtils.isEmpty(status)) {
sql.append(" AND STATUS = ").append(status); sql.append(" AND STATUS = '").append(status).append("'");
} }
sql.append("ORDER BY CREATE_TIME DESC"); sql.append("ORDER BY CREATE_TIME DESC");
try { try {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString()); List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
resultMap.put("total", list.size()); resultMap.put("total", list.size());
List<Map<String, Object>> result = list.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList()); List<Map<String, Object>> result = list.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
resultMap.put("list", result); resultMap.put("list", result);
@ -510,8 +511,6 @@ public class ActTaskController {
@ApiImplicitParam(name = "id", value = "业务ID", paramType = "query",required = true, dataType = "String") @ApiImplicitParam(name = "id", value = "业务ID", paramType = "query",required = true, dataType = "String")
}) })
public Result getZwyBusinessInfoById(String id) { public Result getZwyBusinessInfoById(String id) {
JdbcTemplate jdbcTemplate = getJDBCTemplate();
try { try {
ArrayList<Map> arrayList = new ArrayList<>(); ArrayList<Map> arrayList = new ArrayList<>();
@ -519,10 +518,9 @@ public class ActTaskController {
CompletableFuture<Void> yzj = CompletableFuture.runAsync(() -> { CompletableFuture<Void> yzj = CompletableFuture.runAsync(() -> {
StringBuilder sql = new StringBuilder("SELECT BSNUM, '云主机' AS \"SOURCE_TYPE\", NAME, DISPOSE AS \"INFO\" " + StringBuilder sql = new StringBuilder("SELECT BSNUM, '云主机' AS \"SOURCE_TYPE\", NAME, DISPOSE AS \"INFO\" " +
" FROM VIEW_CLOUD_HOST_INFO WHERE 1 = 1 AND BSNUM = "); " FROM VIEW_CLOUD_HOST_INFO WHERE 1 = 1 AND BSNUM = '");
sql.append(id); sql.append(id).append("'");
List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString());
arrayList.addAll(list); arrayList.addAll(list);
}, executor); }, executor);
@ -531,10 +529,9 @@ public class ActTaskController {
CompletableFuture<Void> ysjk = CompletableFuture.runAsync(() -> { CompletableFuture<Void> ysjk = CompletableFuture.runAsync(() -> {
StringBuilder sql = new StringBuilder("SELECT BSNUM, '云数据库' AS \"SOURCE_TYPE\", NAME, (TYPE || '/' || STORAGE_SPACE || 'GB') AS \"INFO\" " + 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 = "); " FROM VIEW_CLOUD_DATABASE_INFO WHERE 1 = 1 AND BSNUM = '");
sql.append(id); sql.append(id).append("'");
List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString());
arrayList.addAll(list); arrayList.addAll(list);
}, executor); }, executor);
@ -543,28 +540,23 @@ public class ActTaskController {
CompletableFuture<Void> dxcc = CompletableFuture.runAsync(() -> { CompletableFuture<Void> dxcc = CompletableFuture.runAsync(() -> {
StringBuilder sql = new StringBuilder("SELECT BSNUM, '对象存储' AS \"SOURCE_TYPE\", NAME, (DATA_DISK || 'GB') AS \"INFO\" " + 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 = "); " FROM VIEW_CLOUD_OBJECTSTORAGE_INFO WHERE 1 = 1 AND BSNUM = '");
sql.append(id); sql.append(id).append("'");
List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString());
arrayList.addAll(list); arrayList.addAll(list);
}, executor); }, executor);
//托管服务 //托管服务
CompletableFuture<Void> tgfw = CompletableFuture.runAsync(() -> { CompletableFuture<Void> tgfw = CompletableFuture.runAsync(() -> {
StringBuilder sql = new StringBuilder("SELECT BSNUM, '托管服务' AS \"SOURCE_TYPE\", NAME, (U_NUM || 'U') AS \"INFO\" " +
StringBuilder sql = new StringBuilder("SELECT BSNUM, '托管服务' AS \"SOURCE_TYPE\", NAME, U_NUM AS \"INFO\" " + " FROM VIEW_TRUSTEESHIPSERVICE_INFO WHERE 1 = 1 AND BSNUM = '");
" FROM VIEW_CLOUD_HOST_INFO WHERE 1 = 1 AND BSNUM = "); sql.append(id).append("'");
sql.append(id); List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString());
arrayList.addAll(list); arrayList.addAll(list);
}, executor); }, executor);
CompletableFuture all = CompletableFuture.allOf(yzj, ysjk, dxcc, tgfw); CompletableFuture all = CompletableFuture.allOf(yzj, ysjk, dxcc, tgfw);
all.join(); all.join();
return new Result().ok(arrayList); return new Result().ok(arrayList);
@ -581,12 +573,12 @@ public class ActTaskController {
@ApiImplicitParam(name = "id", value = "业务ID", paramType = "query",required = true, dataType = "String") @ApiImplicitParam(name = "id", value = "业务ID", paramType = "query",required = true, dataType = "String")
}) })
public Result getZwyVideoInfoById(String id) { public Result getZwyVideoInfoById(String id) {
JdbcTemplate jdbcTemplate = getJDBCTemplate();
StringBuilder sql = new StringBuilder("SELECT BSNUM, CAMERATYPE, NAME, ORG_NAME " + StringBuilder sql = new StringBuilder("SELECT BSNUM, CAMERATYPE, NAME, ORG_NAME " +
"FROM VIEW_VIDEO_BUSINESS_RELATION WHERE 1 = 1 AND BSNUM = "); "FROM VIEW_VIDEO_BUSINESS_RELATION WHERE 1 = 1 AND BSNUM = '");
sql.append(id); sql.append(id).append("'");
try { try {
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql.toString()); List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
return new Result().ok(list); return new Result().ok(list);
} catch (Exception e) { } catch (Exception e) {
return new Result().error("数据查询异常,请联系云资源数据库管理人员!"); return new Result().error("数据查询异常,请联系云资源数据库管理人员!");
@ -594,16 +586,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") @PostMapping("batchBackToFirst")
@ApiOperation("驳回,回退至第一个用户任务(重新录入表单)") @ApiOperation("驳回,回退至第一个用户任务(重新录入表单)")
@LogOperation("驳回,回退至第一个用户任务(重新录入表单)") @LogOperation("驳回,回退至第一个用户任务(重新录入表单)")

View File

@ -247,7 +247,7 @@ public class ActTaskService extends BaseServiceImpl {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
List<String> resourcesName = resourceDao.selectResourcesTypeByIds(resourceIds); List<String> resourcesName = resourceDao.selectResourcesTypeByIds(resourceIds);
resourcesName.forEach(x -> stringBuilder.append(x).append(",")); 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); dto.setResourceType(string);
}, executor); }, executor);
@ -256,7 +256,7 @@ public class ActTaskService extends BaseServiceImpl {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
List<String> proviDeptsName = resourceDao.selectProvideDeptNameByIds(resourceIds); List<String> proviDeptsName = resourceDao.selectProvideDeptNameByIds(resourceIds);
proviDeptsName.forEach(x -> stringBuilder.append(x).append(",")); 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); dto.setProvideDept(string);
}, executor); }, executor);

View File

@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import io.renren.common.config.JdbcTemplateFactory;
import io.renren.common.constant.Constant; import io.renren.common.constant.Constant;
import io.renren.common.domain.Tsingtao_xhaProperties; import io.renren.common.domain.Tsingtao_xhaProperties;
import io.renren.common.page.PageData; import io.renren.common.page.PageData;
@ -250,6 +251,35 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Autowired @Autowired
private TDemandDataDao tDemandDataDao; private TDemandDataDao tDemandDataDao;
private JdbcTemplate lcJdbcTemplate;
public void setLcJdbcTemplate(JdbcTemplate lcJdbcTemplate) {
this.lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate();
}
private static final String getAllsql = "SELECT\n" +
"\tCOUNT( BSNUM ) AS \"count\",\n" +
"\t'yzy' AS \"type\",\n" +
"\tORG_NAME AS \"deptName\" \n" +
"FROM\n" +
"\tVIEW_CLOUD_BUSINESS_INDEX \n" +
"WHERE\n" +
"\t1 = 1 \n" +
"\tAND APPLYTYPE = '01'\n" +
"\tAND STATUS NOT IN ('00', '07', '99')\n" +
"GROUP BY\n" +
"\tORG_NAME UNION ALL\n" +
"SELECT\n" +
"\tCOUNT( BSNUM ) AS \"count\",\n" +
"\t'ysp' AS \"type\",\n" +
"\tORG_NAME AS \"deptName\" \n" +
"FROM\n" +
"\tVIEW_VIDEO_BUSINESS_INDEX \n" +
"WHERE\n" +
"\t1 = 1 \n" +
"\tAND STATUS != '00'\n" +
"GROUP BY\n" +
"\tORG_NAME";
@Override @Override
public QueryWrapper<ResourceEntity> getWrapper(Map<String, Object> params) { public QueryWrapper<ResourceEntity> getWrapper(Map<String, Object> params) {
@ -2201,8 +2231,43 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域 params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域
logger.error("区域管理员只出本部门区域:{}", sysDeptDTO.getDistrict()); logger.error("区域管理员只出本部门区域:{}", sysDeptDTO.getDistrict());
} }
if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) {// 部门精准查 if (params.containsKey("deptId") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("deptId").toString())) {// 部门精准查
List<Map<String, Object>> zwyCountListByapplyDept = new ArrayList<>();
Map<String, Object> 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<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
if (!typeCountListByApplyDept.isEmpty() && !zwyCountListByapplyDept.isEmpty()) {
typeCountListByApplyDept.get(0).putAll(zwyCountListByapplyDept.get(0));
}
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString())); Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>(); ArrayList<Map> resultList = new ArrayList<>();
Map<String, Integer> countMap = new HashMap<>(); Map<String, Integer> countMap = new HashMap<>();
@ -2231,7 +2296,24 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resultList.add(count); resultList.add(count);
return resultList; return resultList;
} else if (params.containsKey("region") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("region").toString())) { // 查区域 } else if (params.containsKey("region") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("region").toString())) { // 查区域
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
if ("250000".equals(params.get("region").toString())) {
List<Map<String, Object>> zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql);
zwyCountListByApplyDept.forEach(x -> {
Map<String, Object> 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<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString())); Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>(); ArrayList<Map> resultList = new ArrayList<>();
Map<String, Integer> countMap = new HashMap<>(); Map<String, Integer> countMap = new HashMap<>();
@ -2260,7 +2342,20 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resultList.add(count); resultList.add(count);
return resultList; return resultList;
} else { } else {
List<Map<String, Object>> zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql);
zwyCountListByApplyDept.forEach(x -> {
Map<String, Object> 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<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params); List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
typeCountListByApplyDept.addAll(zwyCountListByApplyDept);
List<HashMap<String, Object>> resultList = new ArrayList<>(); List<HashMap<String, Object>> resultList = new ArrayList<>();
resultList.addAll(getDeptTemp2()); resultList.addAll(getDeptTemp2());
resultList.addAll(getDeptTemp1()); resultList.addAll(getDeptTemp1());
@ -2283,6 +2378,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} }
return index; return index;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
Map<String, List<Map<String, Object>>> typeCountListMap1 = // 区级部门 Map<String, List<Map<String, Object>>> typeCountListMap1 = // 区级部门
typeCountListByApplyDept.stream().filter(index -> index.get("deptType").toString().equals("3")) typeCountListByApplyDept.stream().filter(index -> index.get("deptType").toString().equals("3"))
.collect(Collectors.groupingBy(m -> m.get("district").toString())); .collect(Collectors.groupingBy(m -> m.get("district").toString()));
@ -2358,6 +2454,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
map.put("jcss", "0"); map.put("jcss", "0");
map.put("zsk", "0"); map.put("zsk", "0");
map.put("sjzy", "0"); map.put("sjzy", "0");
map.put("yzy", "0");
map.put("ysp", "0");
return map; return map;
}).collect(Collectors.toList()); // 会客厅的 }).collect(Collectors.toList()); // 会客厅的
resultList.addAll(temp); resultList.addAll(temp);
@ -2534,6 +2632,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
map.put("jcss", "0"); map.put("jcss", "0");
map.put("zsk", "0"); map.put("zsk", "0");
map.put("sjzy", "0"); map.put("sjzy", "0");
map.put("yzy", "0");
map.put("ysp", "0");
return map; return map;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return resultList; return resultList;
@ -2560,6 +2660,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
map.put("jcss", "0"); map.put("jcss", "0");
map.put("zsk", "0"); map.put("zsk", "0");
map.put("sjzy", "0"); map.put("sjzy", "0");
map.put("yzy", "0");
map.put("ysp", "0");
return map; return map;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return resultList; return resultList;
@ -2584,6 +2686,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
map.put("jcss", "0"); map.put("jcss", "0");
map.put("zsk", "0"); map.put("zsk", "0");
map.put("sjzy", "0"); map.put("sjzy", "0");
map.put("yzy", "0");
map.put("ysp", "0");
return map; return map;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return resultList; return resultList;
@ -2614,11 +2718,124 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if (params.containsKey("page") && org.apache.commons.lang3.StringUtils.isNotBlank(params.get("page").toString())) { if (params.containsKey("page") && org.apache.commons.lang3.StringUtils.isNotBlank(params.get("page").toString())) {
curPage = Integer.parseInt(params.get("page").toString()); curPage = Integer.parseInt(params.get("page").toString());
} }
List<Map> dtoList = resourceDao.selectCensusApplyTable(params);
List result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()); List result = new ArrayList();
return new PageData(result, dtoList.size());
if (null == params.get("resourceType")) {
AtomicInteger total = new AtomicInteger();
//本地ucs系统申请记录
CompletableFuture<Void> ucs = CompletableFuture.runAsync(() -> {
List<Map> ucsApplyDtoList = resourceDao.selectCensusApplyTable(params);
result.addAll(ucsApplyDtoList);
total.addAndGet(ucsApplyDtoList.size());
}, executor);
//浪潮政务云和云视频申请记录
CompletableFuture<Void> lc = CompletableFuture.runAsync(() -> {
List<Map> 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<Map> lcApplyDtoList = lcSelectCensusApplyTable(params);
result.addAll(lcApplyDtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList()));
return new PageData(result, lcApplyDtoList.size());
} else {
List<Map> 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<Map> 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<String, Object> 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<String> 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<Map<String, Object>> list = jdbcTemplate.queryForList(sb.toString());
return new ArrayList<>(list);
}
@Override @Override
public Object getPraiseList() { public Object getPraiseList() {
return resourceDao.getPraiseList(); return resourceDao.getPraiseList();
@ -2842,4 +3059,5 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return body; return body;
} }
} }

View File

@ -3,6 +3,7 @@ package io.renren.modules.sys.dao;
import io.renren.common.dao.BaseDao; import io.renren.common.dao.BaseDao;
import io.renren.modules.sys.entity.SysDeptEntity; import io.renren.modules.sys.entity.SysDeptEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -37,4 +38,10 @@ public interface SysDeptDao extends BaseDao<SysDeptEntity> {
*/ */
SysDeptEntity getByName(String name); SysDeptEntity getByName(String name);
Map<String, Object> selectLCDeptByUcsDeptName(@Param("provideDept") String provideDept);
List<String> selectLCDeptByRegion(@Param("region") Long region);
Map<String, Object> selectUCSDeptByLCDeptName(@Param("deptName") String deptName);
} }

View File

@ -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部门IDsys_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;

View File

@ -1882,13 +1882,11 @@
FROM FROM
(SELECT IF(d.type='组件服务', A.attr_value, d.type) AS type, d.id, d.del_flag, d.dept_id, d.create_date 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 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 sys_dept sd
WHERE WHERE
1 = 1 1 = 1
AND tdr.dept_id = sd.id AND tdr.dept_id = sd.id
AND (tdr.type = '应用资源' OR tdr.type = '智能算法' OR tdr.type = '图层服务' OR tdr.type = '开发组件' OR
tdr.type = '业务组件')
<choose> <choose>
<when test="approveStatus != null and approveStatus == '通过'"> <when test="approveStatus != null and approveStatus == '通过'">
AND tdr.del_flag=0 AND tdr.del_flag=0
@ -2001,7 +1999,8 @@
AND a.attr_type = '组件类型' AND a.attr_type = '组件类型'
AND a.del_flag = 0 AND a.del_flag = 0
WHERE WHERE
d.type NOT IN ( '知识库', '基础设施', '数据资源' ) d.type IN ( '应用资源', '组件服务' )
AND d.del_flag = 0
) tdr, ) tdr,
sys_dept sd, sys_dept sd,
sys_user su, sys_user su,
@ -2018,7 +2017,7 @@
AND taa.approve_status = #{approveStatus} AND taa.approve_status = #{approveStatus}
</if> </if>
<if test="deptId != null and deptId != ''"> <if test="deptId != null and deptId != ''">
AND sd.id = #{deptId} AND sd.name LIKE CONCAT('%', #{deptId} , '%')
</if> </if>
<if test="type != null and type != ''"> <if test="type != null and type != ''">
AND tdr.type = #{type} AND tdr.type = #{type}
@ -2030,15 +2029,15 @@
AND tdr.name LIKE CONCAT( '%', #{resourceName}, '%' ) AND tdr.name LIKE CONCAT( '%', #{resourceName}, '%' )
</if> </if>
<if test="provideDept != null and provideDept != ''"> <if test="provideDept != null and provideDept != ''">
AND dept.`name` LIKE CONCAT( '%', #{provideDept}, '%' ) AND dept.id = #{provideDept}
</if> </if>
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''"> <if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate} AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
</if> </if>
<if test="type == null or type == '' or type == '会客厅'"> <if test="type == null or type == '' or type == '会客厅'">
UNION ALL
UNION ALL
SELECT SELECT
tmb.dept AS 'deptName', tmb.dept AS 'deptName',
tm.`name` AS 'resourceName', tm.`name` AS 'resourceName',
@ -2050,9 +2049,13 @@
'' AS 'applyNumber' '' AS 'applyNumber'
FROM FROM
t_meetingroom_book tmb, t_meetingroom_book tmb,
t_meetingroom tm t_meetingroom tm,
sys_dept sd,
sys_region sr
WHERE WHERE
tmb.room_id = tm.id tmb.room_id = tm.id
AND tmb.dept = sd.name
AND sd.district = sr.id
<choose> <choose>
<when test="approveStatus != null and approveStatus == '通过'"> <when test="approveStatus != null and approveStatus == '通过'">
AND tmb.state=2 AND tmb.state=2
@ -2065,10 +2068,13 @@
</when> </when>
</choose> </choose>
<if test="deptId != null and deptId != ''"> <if test="deptId != null and deptId != ''">
AND tmb.dept = #{deptId} AND tmb.dept LIKE CONCAT( '%', #{deptId}, '%' )
</if> </if>
<if test="provideDept != null and provideDept != ''"> <if test="provideDept != null and provideDept != ''">
AND '青岛市大数据发展管理局' LIKE CONCAT( '%', #{provideDept}, '%' ) AND #{provideDept} = 1067246875800000066
</if>
<if test="region != null and region != ''">
AND sr.id = #{region}
</if> </if>
<if test="resourceName != null and resourceName != ''"> <if test="resourceName != null and resourceName != ''">
AND tm.name LIKE CONCAT( '%', #{resourceName}, '%' ) AND tm.name LIKE CONCAT( '%', #{resourceName}, '%' )

View File

@ -36,4 +36,15 @@
where t1.name = #{name} LIMIT 1 where t1.name = #{name} LIMIT 1
</select> </select>
<select id="selectLCDeptByUcsDeptName" resultType="java.util.Map">
SELECT * FROM t_ucs_lc_dept_rel WHERE ucs_name = #{provideDept}
</select>
<select id="selectLCDeptByRegion" resultType="java.lang.String">
SELECT lc_name FROM t_ucs_lc_dept_rel WHERE district = #{region}
</select>
<select id="selectUCSDeptByLCDeptName" resultType="java.util.Map">
SELECT * FROM t_ucs_lc_dept_rel WHERE lc_name = #{deptName}
</select>
</mapper> </mapper>