Merge branch 'dev'

This commit is contained in:
wangliwen 2022-12-10 19:59:16 +08:00
commit c43b7d9225
1 changed files with 105 additions and 92 deletions

View File

@ -257,29 +257,29 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
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";
private static final String getAllsql = "SELECT " +
" COUNT( BSNUM ) AS \"count\", " +
" 'yzy' AS \"type\", " +
" 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 " +
" COUNT( BSNUM ) AS \"count\", " +
" 'ysp' AS \"type\", " +
" ORG_NAME AS \"deptName\" " +
"FROM " +
" VIEW_VIDEO_BUSINESS_INDEX " +
"WHERE " +
" 1 = 1 " +
" AND STATUS != '00' " +
"GROUP BY " +
" ORG_NAME";
@Override
public QueryWrapper<ResourceEntity> getWrapper(Map<String, Object> params) {
@ -761,7 +761,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
CompletableFuture jcss = CompletableFuture.runAsync(() -> {
HashMap<String, Object> map = (HashMap<String, Object>) this.selectInfrastructureList();
final Long[] total = {0L};
map.forEach((k,v) -> {
map.forEach((k, v) -> {
total[0] = total[0] + (Integer) v;
});
re.add(new HashMap<String, Object>() {
@ -1444,9 +1444,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<Map<String, Object>> result2;
if (Long.parseLong(params.get("id").toString()) == 0) {
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName,\n" + "SUM(a.visits) AS resourceVisits \n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '组件服务' AND a.del_flag = 0\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n");
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName, " + "SUM(a.visits) AS resourceVisits " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '组件服务' AND a.del_flag = 0 " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name ");
} else {
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName,\n" + "SUM(a.visits) AS resourceVisits \n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '组件服务' AND a.del_flag = 0\n" + "AND (b.ID = ? OR INSTR(b.pids,?))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n", pas);
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName, " + "SUM(a.visits) AS resourceVisits " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '组件服务' AND a.del_flag = 0 " + "AND (b.ID = ? OR INSTR(b.pids,?)) " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name ", pas);
}
if (!result2.isEmpty()) {
@ -1524,9 +1524,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<Map<String, Object>> result2;
if (Long.parseLong(params.get("id").toString()) == 0) {
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '应用资源' AND a.del_flag = 0\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n");
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '应用资源' AND a.del_flag = 0 " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name ");
} else {
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '应用资源' AND a.del_flag = 0\n" + "AND (b.ID = ? OR b.pids LIKE CONCAT(CONCAT('%',?),'%'))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n", pas);
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '应用资源' AND a.del_flag = 0 " + "AND (b.ID = ? OR b.pids LIKE CONCAT(CONCAT('%',?),'%')) " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name ", pas);
}
if (!result2.isEmpty()) {
@ -1621,9 +1621,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<Map<String, Object>> result2;
if (Long.parseLong(params.get("id").toString()) == 0) {
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '基础设施' AND a.del_flag = 0\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n");
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '基础设施' AND a.del_flag = 0 " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name ");
} else {
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '基础设施' AND a.del_flag = 0\n" + "AND (b.ID = ? OR INSTR(b.pids,?))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n", pas);
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '基础设施' AND a.del_flag = 0 " + "AND (b.ID = ? OR INSTR(b.pids,?)) " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name ", pas);
}
if (!result2.isEmpty()) {
@ -1669,9 +1669,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<Map<String, Object>> result2;
if (Long.parseLong(params.get("id").toString()) == 0) {
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '数据资源' AND a.del_flag = 0\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n");
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '数据资源' AND a.del_flag = 0 " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name ");
} else {
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '数据资源' AND a.del_flag = 0\n" + "AND (b.ID = ? OR INSTR(b.pids,?))\n" + "GROUP BY a.dept_id,b.name\n" + "ORDER BY a.dept_id,b.name\n", pas);
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '数据资源' AND a.del_flag = 0 " + "AND (b.ID = ? OR INSTR(b.pids,?)) " + "GROUP BY a.dept_id,b.name " + "ORDER BY a.dept_id,b.name ", pas);
}
@ -1717,9 +1717,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
Object[] pas = {params.get("id"), params.get("id")};
if (Long.parseLong(params.get("id").toString()) == 0) {
result = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '知识库' AND a.del_flag = 0\n" + "GROUP BY b.name\n" + "ORDER BY b.name ");
result = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '知识库' AND a.del_flag = 0 " + "GROUP BY b.name " + "ORDER BY b.name ");
} else {
result = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,b.name AS deptName\n" + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" + "WHERE a.type = '知识库' AND a.del_flag = 0\n" + "AND (b.ID = ? OR INSTR(b.pids,?))\n" + "GROUP BY b.name\n" + "ORDER BY b.name ", pas);
result = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,b.name AS deptName " + "FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id " + "WHERE a.type = '知识库' AND a.del_flag = 0 " + "AND (b.ID = ? OR INSTR(b.pids,?)) " + "GROUP BY b.name " + "ORDER BY b.name ", pas);
}
List<List<Map<String, Object>>> partition = Lists.partition(result, pageSize);
@ -2240,27 +2240,31 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
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 = '");
StringBuilder sb = new StringBuilder("SELECT " +
" COUNT( BSNUM ) AS \"count\", " +
" 'yzy' AS \"type\" " +
"FROM " +
" VIEW_CLOUD_BUSINESS_INDEX " +
"WHERE " +
" 1 = 1 " +
" AND 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("' UNION ALL " +
"SELECT " +
" COUNT( BSNUM ) AS \"count\", " +
" 'ysp' AS \"type\" " +
"FROM " +
" VIEW_VIDEO_BUSINESS_INDEX " +
"WHERE " +
" 1 = 1 " +
" AND ORG_NAME = '")
.append(lcDept.get("lc_name").toString())
.append("'");
try {
zwyCountListByapplyDept.addAll(lcJdbcTemplate.queryForList(sb.toString()));
} catch (Exception e) {
logger.error(sb.toString(), e);
}
}
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
@ -2299,7 +2303,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
if ("250000".equals(params.get("region").toString())) {
List<Map<String, Object>> zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql);
List<Map<String, Object>> zwyCountListByApplyDept = new ArrayList<>();
try {
zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql);
} catch (Exception e) {
logger.error(getAllsql, e);
}
zwyCountListByApplyDept.forEach(x -> {
Map<String, Object> ucsDept = sysDeptDao.selectUCSDeptByLCDeptName(x.get("deptName").toString());
@ -2342,8 +2351,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resultList.add(count);
return resultList;
} else {
List<Map<String, Object>> zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql);
List<Map<String, Object>> zwyCountListByApplyDept = new ArrayList<>();
try {
zwyCountListByApplyDept = lcJdbcTemplate.queryForList(getAllsql);
} catch (Exception e) {
logger.info(getAllsql, e);
}
zwyCountListByApplyDept.forEach(x -> {
Map<String, Object> ucsDept = sysDeptDao.selectUCSDeptByLCDeptName(x.get("deptName").toString());
@ -2745,7 +2758,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}).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())){
} 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());
@ -2759,38 +2772,38 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
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");
StringBuilder sb = new StringBuilder("SELECT * FROM ( " +
"SELECT " +
" vcbi.ORG_NAME AS \"deptName\", bsrel.name AS \"resourceName\", '青岛市大数据发展管理局' AS \"resourceDeptName\", " +
" bsrel.SOURCE_TYPE AS \"type\", to_char( vcbi.CREATE_TIME, 'yyyy-mm-dd HH24:MI:SS' ) AS \"createDate\", " +
" vcbi.status AS \"approveStatus\", bsrel.BSNUM AS \"applyNumber\" " +
"FROM " +
" ( " +
" SELECT BSNUM, '云主机' AS \"SOURCE_TYPE\", NAME, DISPOSE AS \"INFO\" FROM VIEW_CLOUD_HOST_INFO " +
" UNION ALL " +
" SELECT BSNUM, '云数据库' AS \"SOURCE_TYPE\", NAME, (TYPE || '/' || STORAGE_SPACE || 'GB') AS \"INFO\" FROM VIEW_CLOUD_DATABASE_INFO " +
" UNION ALL " +
" SELECT BSNUM, '对象存储' AS \"SOURCE_TYPE\", NAME, ( DATA_DISK || 'GB' ) AS \"INFO\" FROM VIEW_CLOUD_OBJECTSTORAGE_INFO " +
" UNION ALL " +
" SELECT BSNUM, '托管服务' AS \"SOURCE_TYPE\", NAME, U_NUM AS \"INFO\" FROM VIEW_TRUSTEESHIPSERVICE_INFO " +
" ) bsrel " +
" LEFT JOIN VIEW_CLOUD_BUSINESS_INDEX vcbi ON bsrel.BSNUM = vcbi.BSNUM " +
"WHERE " +
" vcbi.APPLYTYPE = '01' " +
" AND vcbi.status IN ( '01', '03', '04', '05', '06', '99' ) " +
" UNION ALL " +
" SELECT vvbi.ORG_NAME AS \"deptName\", vvbr.name AS \"resourceName\", vvbr.ORG_NAME AS \"resourceDeptName\", " +
" '云视频' AS \"type\", to_char( vvbi.CREATE_TIME, 'yyyy-mm-dd HH24:MI:SS' ) AS \"createDate\", vvbi.status AS \"approveStatus\", " +
" vvbr.BSNUM AS \"applyNumber\" " +
"FROM " +
" VIEW_VIDEO_BUSINESS_RELATION vvbr " +
" LEFT JOIN VIEW_VIDEO_BUSINESS_INDEX vvbi ON vvbr.BSNUM = vvbi.BSNUM " +
"WHERE " +
" vvbi.STATUS != '00' " +
" AND vvbr.ORG_NAME IS NOT NULL " +
" ) apply " +
" WHERE 1 = 1 " +
" ");
if (params.get("provideDept") != null) {
Map<String, Object> lcDept = sysDeptDao.selectLCDeptByUcsDeptName(params.get("provideDept").toString());
@ -2802,7 +2815,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
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"));
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("', "));