Compare commits

..

2 Commits

Author SHA1 Message Date
dinggang 1c143be715 Merge branch 'dev' of http://192.168.124.50:3000/wangliwen/share-platform into dev
# Conflicts:
#	renren-admin/src/main/java/io/renren/modules/activiti/controller/ActTaskController.java
2022-12-13 03:13:45 +08:00
dinggang aa6f1f55d5 .. 2022-12-13 03:07:40 +08:00
15 changed files with 276 additions and 252 deletions

View File

@ -0,0 +1 @@
ALTER TABLE tb_fuse ADD COLUMN `district` int(2) DEFAULT 0 COMMENT '赋能场景类型0市级、1基层场景';

View File

@ -380,7 +380,7 @@ public class CensusController {
@ApiImplicitParams({
@ApiImplicitParam(name = "startDate", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "结束时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "deptId", value = "申请部门", paramType = "query", dataType = "long"),
@ApiImplicitParam(name = "approveStatus", value = "审核状态,可选值(通过、审核中)", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "region", value = "所属区域id", paramType = "query", dataType = "String"),
})

View File

@ -29,6 +29,7 @@ import org.activiti.engine.task.TaskQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.StringUtils;
@ -72,6 +73,7 @@ public class ActTaskController {
@Value("#{new Boolean(${auditteam.enable})}")
private Boolean auditteam; // 是否进行审核组
private JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate();
/**
* 获取用户任务列表
@ -477,13 +479,13 @@ public class ActTaskController {
@ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "分页大小", paramType = "query", required = true, dataType = "Integer")
})
public Result getZwyBusinessList(String name, String status, int pageNum, int pageSize) {
UserDetail user = SecurityUser.getUser();
JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.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 APPLYTYPE = '01' AND STATUS != '00' AND ACCOUNT = '" + user.getUsername() + "'");
StringBuilder sql = new StringBuilder("SELECT BSNUM, BUSINESS_NAME, to_char(CREATE_TIME,'yyyy-mm-dd hh24:mi:ss') AS \"CREATE_TIME\", " +
"(CASE WHEN STATUS = '04' THEN '不通过' WHEN STATUS IN ('01', '03') THEN '审核中' ELSE '通过' END) AS \"STATUS\"" +
"FROM VIEW_CLOUD_BUSINESS_INDEX WHERE 1 = 1 AND APPLYTYPE = '01' AND STATUS NOT IN ('00', '07', '99') AND ACCOUNT = '" + user.getUsername() + "'");
if (!StringUtils.isEmpty(name)) {
sql.append(" AND BUSINESS_NAME LIKE ('%' || '").append(name).append("' || '%') ");
}
@ -491,7 +493,6 @@ public class ActTaskController {
sql.append(" AND STATUS = '").append(status).append("'");
}
sql.append(" ORDER BY CREATE_TIME DESC");
logger.error("--->查询语句{}", sql);
try {
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
@ -500,8 +501,8 @@ public class ActTaskController {
resultMap.put("list", list);
return new Result().ok(resultMap);
} catch (Exception e) {
logger.error("查询浪潮数据库申SQL语句--->{}", sql);
logger.error("浪潮数据查询异常", e);
return new Result().error("数据查询异常,请联系云资源数据库管理人员!");
}
@ -518,9 +519,9 @@ public class ActTaskController {
})
public Result getZwyVideoList(String name, String status, int pageNum, int pageSize) {
JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate();
UserDetail user = SecurityUser.getUser();
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\", " +
"(CASE WHEN STATUS = '04' THEN '不通过' WHEN STATUS IN ('05', '06') THEN '通过' ELSE '审核中' END) AS \"STATUS\"" +
"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(", '%') ");
@ -529,7 +530,6 @@ public class ActTaskController {
sql.append(" AND STATUS = '").append(status).append("'");
}
sql.append(" ORDER BY CREATE_TIME DESC");
logger.error("--->查询语句{}", sql);
try {
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
@ -538,6 +538,7 @@ public class ActTaskController {
resultMap.put("list", list);
return new Result().ok(resultMap);
} catch (Exception e) {
logger.error("查询浪潮数据库申SQL语句--->{}", sql);
logger.error("浪潮数据查询异常", e);
return new Result().error("数据查询异常,请联系云资源数据库管理人员!");
}
@ -552,8 +553,8 @@ public class ActTaskController {
@ApiImplicitParam(name = "id", value = "业务ID", paramType = "query", required = true, dataType = "String")
})
public Result getZwyBusinessInfoById(String id) {
JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate();
try {
ArrayList<Map> arrayList = new ArrayList<>();
//云主机
@ -562,10 +563,14 @@ public class ActTaskController {
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).append("'");
logger.error("--->查询语句{}", sql);
List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
arrayList.addAll(list);
List<Map<String, Object>> list = null;
try {
list = lcJdbcTemplate.queryForList(sql.toString());
} catch (DataAccessException e) {
logger.error("查询浪潮数据库云主机数据异常SQL语句--->{}", sql);
}
arrayList.addAll(list);
}, executor);
//云数据库
@ -574,10 +579,13 @@ public class ActTaskController {
StringBuilder sql = new StringBuilder("SELECT BSNUM, '云数据库' AS \"SOURCE_TYPE\", NAME, (TYPE || '/' || STORAGE_SPACE || 'GB') AS \"INFO\" " +
" FROM VIEW_CLOUD_DATABASE_INFO WHERE 1 = 1 AND BSNUM = '");
sql.append(id).append("'");
logger.error("--->查询语句{}", sql);
List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
List<Map<String, Object>> list = null;
try {
list = lcJdbcTemplate.queryForList(sql.toString());
} catch (DataAccessException e) {
logger.error("查询浪潮数据库云数据库数据异常SQL语句--->{}", sql);
}
arrayList.addAll(list);
}, executor);
//对象存储
@ -586,10 +594,13 @@ public class ActTaskController {
StringBuilder sql = new StringBuilder("SELECT BSNUM, '对象存储' AS \"SOURCE_TYPE\", NAME, (DATA_DISK || 'GB') AS \"INFO\" " +
" FROM VIEW_CLOUD_OBJECTSTORAGE_INFO WHERE 1 = 1 AND BSNUM = '");
sql.append(id).append("'");
logger.error("--->查询语句{}", sql);
List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
List<Map<String, Object>> list = null;
try {
list = lcJdbcTemplate.queryForList(sql.toString());
} catch (DataAccessException e) {
logger.error("查询浪潮数据库对象存储数据异常SQL语句--->{}", sql);
}
arrayList.addAll(list);
}, executor);
//托管服务
@ -597,21 +608,18 @@ public class ActTaskController {
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("'");
logger.error("--->查询语句{}", sql);
List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
List<Map<String, Object>> list = null;
try {
list = lcJdbcTemplate.queryForList(sql.toString());
} catch (DataAccessException e) {
logger.error("查询浪潮数据库托管服务数据异常SQL语句--->{}", sql);
}
arrayList.addAll(list);
}, executor);
CompletableFuture all = CompletableFuture.allOf(yzj, ysjk, dxcc, tgfw);
all.join();
return new Result().ok(arrayList);
} catch (Exception e) {
logger.error("浪潮数据查询异常", e);
return new Result().error("数据查询异常,请联系云资源数据库管理人员!");
}
}
@GetMapping("/getZwyVideoInfoById")
@ -621,17 +629,15 @@ public class ActTaskController {
@ApiImplicitParam(name = "id", value = "业务ID", paramType = "query", required = true, dataType = "String")
})
public Result getZwyVideoInfoById(String id) {
JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate();
StringBuilder sql = new StringBuilder("SELECT BSNUM, CAMERATYPE, NAME, ORG_NAME " +
"FROM VIEW_VIDEO_BUSINESS_RELATION WHERE 1 = 1 AND BSNUM = '");
sql.append(id).append("'");
logger.error("--->查询语句{}", sql);
try {
List<Map<String, Object>> list = lcJdbcTemplate.queryForList(sql.toString());
return new Result().ok(list);
} catch (Exception e) {
logger.error("浪潮数据查询异常", e);
logger.error("查询浪潮数据库申SQL语句--->{}", sql);
return new Result().error("数据查询异常,请联系云资源数据库管理人员!");
}
@ -647,9 +653,7 @@ public class ActTaskController {
public Result batchBackToFirst(@RequestBody BatchCompleteDTO batchCompleteDTO) {
batchCompleteDTO.getTaskIds().stream()
.filter(index -> org.apache.commons.lang3.StringUtils.isNotEmpty(index))
.forEach(taskId -> {
actTaskService.backToFirst(taskId, batchCompleteDTO.getComment());
});
.forEach(taskId -> actTaskService.backToFirst(taskId, batchCompleteDTO.getComment()));
return new Result().ok("批量驳回成功");
}

View File

@ -47,7 +47,8 @@ public class FuseController {
@ApiImplicitParam(name = "description", value = "融合服务描述", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "type", value = "融合服务类型", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "applicationArea", value = "应用领域", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "int")
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "int"),
@ApiImplicitParam(name = "district", value = "赋能场景类型", paramType = "query", dataType = "int")
})
public Result<PageData<TbFuseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<TbFuseDTO> page = tbFuseService.page(params);

View File

@ -58,6 +58,8 @@ public class TbFuseDTO {
private Integer dataSourceCount;
@ApiModelProperty(value = "组件服务数量")
private Integer componentCount;
@ApiModelProperty(value = "组件服务数量")
private Integer district;
}

View File

@ -79,4 +79,6 @@ public class TbFuseEntity extends BaseEntity {
private Integer infrastructureCount;
private Integer dataSourceCount;
private Integer componentCount;
private Integer district;
}

View File

@ -77,11 +77,13 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Lazy;
import org.springframework.dao.DataAccessException;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
@ -251,29 +253,31 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Autowired
private TDemandDataDao tDemandDataDao;
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 JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate();
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) {
@ -2163,20 +2167,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
});
}, executor);
//2022-11-1 去除摄像头查询
//CompletableFuture<Void> infrastructureCount = CompletableFuture.runAsync(() -> { //基础设施
// HashMap<Object, Object> queryMap = new HashMap<>();
// queryMap.put("cameraName", keyWorld);
// Integer countNew = cameraChannelMapper.selectByParentIdCountNew(queryMap, null, "");
// resultList.add(new HashMap<String, Object>() {
// {
// put("count", countNew + "");
// put("type", "基础设施");
// }
// });
//
//}, executor);
//统计增加会客厅搜索结果
CompletableFuture<Void> meetingRoomCount = CompletableFuture.runAsync(() -> meetCountNew[0] = tMeetingroomMapper.selectByName(keyWorld).size(), executor);
@ -2217,7 +2207,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public Object selectApplyDeptDetailTypeCountList(Map params) {
JdbcTemplate lcJdbcTemplate = JdbcTemplateFactory.getJdbcTemplate();
UserDetail user = SecurityUser.getUser();
SysDeptDTO sysDeptDTO = deptService.get(user.getDeptId());
if (user.getSuperAdmin() == SuperAdminEnum.YES.value() || bigDataDeptName.equals(sysDeptDTO.getName())) {
@ -2230,9 +2219,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
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());
List<Map<String, Object>> lcDept = sysDeptDao.selectLCDeptByUcsDeptName(params.get("deptId").toString());
if (lcDept.isEmpty()) {
logger.error("未查询到{}对应的浪潮系统部门", params.get("deptId").toString());
return new ArrayList<>();
} else {
StringBuilder sb = new StringBuilder("SELECT " +
@ -2242,9 +2231,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
" VIEW_CLOUD_BUSINESS_INDEX " +
"WHERE " +
" 1 = 1 " +
" AND ORG_NAME = '");
sb.append(lcDept.get("lc_name").toString())
.append("' UNION ALL " +
" AND ORG_NAME IN (");
lcDept.forEach(x -> sb.append("'").append(x.get("lc_name").toString()).append("', "));
sb.deleteCharAt(sb.length() - 2);
sb.append(") UNION ALL " +
"SELECT " +
" COUNT( BSNUM ) AS \"count\", " +
" 'ysp' AS \"type\" " +
@ -2252,20 +2242,30 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
" VIEW_VIDEO_BUSINESS_INDEX " +
"WHERE " +
" 1 = 1 " +
" AND ORG_NAME = '")
.append(lcDept.get("lc_name").toString())
.append("'");
" AND ORG_NAME IN (");
lcDept.forEach(x -> sb.append("'").append(x.get("lc_name").toString()).append("', "));
sb.deleteCharAt(sb.length() - 2);
sb.append(")");
try {
zwyCountListByapplyDept.addAll(lcJdbcTemplate.queryForList(sb.toString()));
} catch (Exception e) {
logger.error(sb.toString(), e);
logger.error("查询浪潮数据库申SQL语句--->{}", sb);
logger.error("查询浪潮数据库异常", e);
}
}
Map<String, List<Map<String, Object>>> zwyCountListMap = zwyCountListByapplyDept.stream().collect(Collectors.groupingBy(m -> m.get("type").toString()));
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
if (!typeCountListByApplyDept.isEmpty() && !zwyCountListByapplyDept.isEmpty()) {
typeCountListByApplyDept.get(0).putAll(zwyCountListByapplyDept.get(0));
zwyCountListMap.forEach((k, v) -> {
Map<String, Object> zwyCountMap = new HashMap<>();
zwyCountMap.put("count", v.stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
zwyCountMap.put("type", k);
zwyCountMap.put("deptName", params.get("deptId").toString());
zwyCountMap.put("district", 250000);
zwyCountMap.put("deptType", 2);
typeCountListByApplyDept.add(zwyCountMap);
}
);
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>();
@ -2307,17 +2307,23 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
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());
if (ucsDept != null && !ucsDept.isEmpty()) {
logger.error("浪潮{}单位对应ucs单位为{}", x.get("deptName").toString(), ucsDept.get("ucs_name"));
x.put("dept_id", ucsDept.get("ucs_id"));
x.put("deptType", ucsDept.get("type"));
x.put("district", ucsDept.get("district"));
x.replace("deptName", ucsDept.get("ucs_name"));
} {
logger.error("未在ucs系统中找到浪潮{}单位对应部门", x.get("deptName").toString());
x.put("dept_id", "");
x.put("deptType", 2);
x.put("district", 250000);
x.replace("deptName", "其他单位");
}
});
typeCountListByApplyDept.addAll(zwyCountListByApplyDept);
}
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByApplyDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>();
Map<String, Integer> countMap = new HashMap<>();
@ -2326,7 +2332,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
map.put("count", v.stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
map.put("name", k);
v.forEach(item -> {
if (map.containsKey(item.get("type").toString())) {
map.replace(item.get("type").toString(), Integer.parseInt(item.get("count").toString()) + (Integer) map.get(item.get("type")));
} else {
map.put(item.get("type").toString(), item.get("count"));
}
if (countMap.containsKey(item.get("type"))) {
countMap.replace(item.get("type").toString(), Integer.parseInt(item.get("count").toString()) + countMap.get(item.get("type")));
} else {
@ -2355,10 +2366,18 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
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());
if (null != ucsDept && !ucsDept.isEmpty()) {
x.put("dept_id", ucsDept.get("ucs_id"));
x.put("deptName", ucsDept.get("ucs_name"));
x.put("deptType", ucsDept.get("type"));
x.put("district", ucsDept.get("district"));
} else {
x.put("dept_id", "");
x.put("deptType", 2);
x.put("district", 250000);
logger.error("未在ucs系统中找到浪潮{}单位对应部门", x.get("deptName").toString());
x.put("deptName", "其他单位");
}
});
List<Map<String, Object>> typeCountListByApplyDept = resourceDao.selectApplyDeptDetailTypeCountList(params);
@ -2372,11 +2391,15 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
Map<String, List<Map<String, Object>>> typeCountListMap = // 市级部门
typeCountListByApplyDept.stream().filter(index -> index.get("deptType").toString().equals("2")).collect(Collectors.groupingBy(m -> m.get("dept_id").toString()));
resultList = resultList.stream().map(index -> {
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 -> {
index.put(count.get("type").toString(), count.get("count"));
index.replace(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + Integer.parseInt(index.get(count.get("type").toString()).toString()));
if (countMap.containsKey(count.get("type"))) {
countMap.replace(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + countMap.get(count.get("type")));
} else {
@ -2394,7 +2417,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
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 -> {
index.put(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + Integer.parseInt(index.getOrDefault(count.get("type").toString(), "0").toString()));
if (countMap.containsKey(count.get("type"))) {
countMap.replace(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + countMap.get(count.get("type")));
} else {
@ -2441,6 +2466,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return index;
}).collect(Collectors.toList());
if (!typeCountListMap3.isEmpty()) { // 仍然有会客厅信息
List<HashMap<String, Object>> temp = typeCountListMap3.keySet().stream().map(index_ -> {
HashMap<String, Object> map = new HashMap<>();
@ -2492,7 +2518,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
params.put("region", 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())
|| params.containsKey("region") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("region").toString())
) {
List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params);
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>();
@ -2521,36 +2549,40 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
count.putAll(countMap);
resultList.add(count);
return resultList;
} else if (params.containsKey("region") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("region").toString())) { // 按区域出数据
List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params);
Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
ArrayList<Map> resultList = new ArrayList<>();
Map<String, Integer> countMap = new HashMap<>();
typeCountListMap.forEach((k, v) -> {
HashMap<Object, Object> map = new HashMap<>();
map.put("count", v.stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
map.put("name", k);
v.forEach(item -> {
map.put(item.get("type").toString(), item.get("count"));
if (countMap.containsKey(item.get("type"))) {
countMap.replace(item.get("type").toString(), Integer.parseInt(item.get("count").toString()) + countMap.get(item.get("type")));
} else {
countMap.put(item.get("type").toString(), Integer.parseInt(item.get("count").toString()));
}
});
resultList.add(map);
});
Integer total = 0;
for (Integer count : countMap.values()) {
total += count;
}
countMap.put("count", total);
HashMap<String, Object> count = new HashMap<>();
count.put("name", "总计");
count.putAll(countMap);
resultList.add(count);
return resultList;
} else { // 全部部门
//else if (params.containsKey("region") && org.apache.commons.lang3.StringUtils.isNotEmpty(params.get("region").toString())) { // 按区域出数据
// List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params);
// Map<String, List<Map<String, Object>>> typeCountListMap = typeCountListByDept.stream().collect(Collectors.groupingBy(m -> m.get("deptName").toString()));
// ArrayList<Map> resultList = new ArrayList<>();
// Map<String, Integer> countMap = new HashMap<>();
// typeCountListMap.forEach((k, v) -> {
// HashMap<Object, Object> map = new HashMap<>();
// map.put("count", v.stream().mapToInt(it -> Integer.parseInt(it.get("count").toString())).sum());
// map.put("name", k);
// v.forEach(item -> {
// map.put(item.get("type").toString(), item.get("count"));
// if (countMap.containsKey(item.get("type"))) {
// countMap.replace(item.get("type").toString(), Integer.parseInt(item.get("count").toString()) + countMap.get(item.get("type")));
// } else {
// countMap.put(item.get("type").toString(), Integer.parseInt(item.get("count").toString()));
// }
// });
// resultList.add(map);
// });
// Integer total = 0;
// for (Integer count : countMap.values()) {
// total += count;
// }
// countMap.put("count", total);
// HashMap<String, Object> count = new HashMap<>();
// count.put("name", "总计");
// count.putAll(countMap);
// resultList.add(count);
// return resultList;
//}
else { // 全部部门
List<Map<String, Object>> typeCountListByDept = resourceDao.selectDeptDetailTypeCountList(params);
Map<String, List<Map<String, Object>>> typeCountListMap = // 市级部门
typeCountListByDept.stream().filter(index -> index.get("deptType").toString().equals("2")).collect(Collectors.groupingBy(m -> m.get("dept_id").toString()));
@ -2729,31 +2761,26 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List result = new ArrayList();
if (null == params.get("resourceType")) {
AtomicInteger total = new AtomicInteger();
//本地ucs系统申请记录
CompletableFuture<Void> ucs = CompletableFuture.runAsync(() -> {
if (params.containsKey("type") && (null == params.get("type") || org.apache.commons.lang3.StringUtils.isBlank(params.get("type").toString()))) { //查所有
int total = 0;
List<Map> ucsApplyDtoList = resourceDao.selectCensusApplyTable(params);
result.addAll(ucsApplyDtoList);
total.addAndGet(ucsApplyDtoList.size());
}, executor);
total += ucsApplyDtoList.size();
//浪潮政务云和云视频申请记录
CompletableFuture<Void> lc = CompletableFuture.runAsync(() -> {
List<Map> lcApplyDtoList = lcSelectCensusApplyTable(params);
result.add(lcApplyDtoList);
total.addAndGet(lcApplyDtoList.size());
}, executor);
CompletableFuture.allOf(ucs, lc).join();
result.addAll(lcApplyDtoList);
total += lcApplyDtoList.size();
//根据时间重新排序再分页
result.stream()
List newResult = (List) 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())) {
return new PageData(newResult, total);
} else if ("云资源".equals(params.get("type").toString()) || "云视频".equals(params.get("type").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());
@ -2767,6 +2794,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
private List<Map> lcSelectCensusApplyTable(Map params) {
if (params.get("region") != null && !"250000".equals(params.get("region").toString())) {
logger.error("非市级单位无法查浪潮数据");
return new ArrayList<>();
}
StringBuilder sb = new StringBuilder("SELECT * FROM ( " +
"SELECT " +
" vcbi.ORG_NAME AS \"deptName\", bsrel.name AS \"resourceName\", '青岛市大数据发展管理局' AS \"resourceDeptName\", " +
@ -2785,7 +2817,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
" 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' ) " +
" AND vcbi.status IN ( '01', '03', '04', '05', '06' ) " +
" 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\", " +
@ -2800,54 +2832,50 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
" WHERE 1 = 1 " +
" ");
if (params.get("provideDept") != null) {
Map<String, Object> lcDept = sysDeptDao.selectLCDeptByUcsDeptName(params.get("provideDept").toString());
if (params.get("provideDept") != null && org.apache.commons.lang3.StringUtils.isNotBlank(params.get("provideDept").toString())) {
List<Map<String, Object>> lcDept = sysDeptDao.selectLCDeptByUcsDeptName(params.get("provideDept").toString());
try {
if (lcDept.isEmpty()
|| lcDept.get("lc_name") == null
|| (lcDept.get("lc_name") != null && org.apache.commons.lang3.StringUtils.isBlank(lcDept.get("lc_name").toString()))
) {
if (CollectionUtils.isEmpty(lcDept)) {
logger.error("未查询到{}对应的浪潮系统部门", params.get("provideDept").toString());
return new ArrayList<>();
}
sb.append(" AND apply.\"resourceDeptName\" = ").append(lcDept.get("lc_name").toString());
} catch (Exception e) {
logger.error("", e);
return new ArrayList<>();
}
}
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(" AND apply.\"resourceDeptName\" IN (");
lcDept.forEach(x -> sb.append("'").append(x.get("lc_name").toString()).append("', "));
sb.deleteCharAt(sb.length() - 2);
sb.append(")");
}
if (params.get("type") != null) {
if (params.get("type") != null && org.apache.commons.lang3.StringUtils.isNotBlank(params.get("type").toString())) {
if ("云视频".equals(params.get("type").toString())) {
sb.append(" AND apply.type = '云视频' ");
sb.append(" AND apply.\"type\" = '云视频' ");
} else {
sb.append(" AND apply.type != '云视频' ");
sb.append(" AND apply.\"type\" != '云视频' ");
}
}
if (params.get("startDate") != null && params.get("endDate") != null) {
if (params.get("startDate") != null && params.get("endDate") != null && org.apache.commons.lang3.StringUtils.isNotBlank(params.get("startDate").toString())) {
sb.append(" AND apply.\"createDate\" BETWEEN '").append(params.get("startDate").toString())
.append("' AND '").append(params.get("endDate").toString()).append("'");
}
if (params.get("approveStatus") != null) {
if (params.get("approveStatus") != null && org.apache.commons.lang3.StringUtils.isNotBlank(params.get("approveStatus").toString())) {
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("deptId") != null && org.apache.commons.lang3.StringUtils.isNotBlank(params.get("deptId").toString())) {
List<Map<String, Object>> deptIds = sysDeptDao.selectLCDeptByUcsDeptName(params.get("deptId").toString());
sb.append(" AND apply.\"deptName\" IN (");
deptIds.forEach(x -> sb.append("'").append(x.get("lc_name").toString()).append("', "));
sb.deleteCharAt(sb.length() - 2);
sb.append(")");
}
if (params.get("resourceName") != null) {
if (params.get("resourceName") != null && org.apache.commons.lang3.StringUtils.isNotBlank(params.get("resourceName").toString())) {
sb.append(" AND apply.\"resourceName\" LIKE '%" + params.get("resourceName").toString() + "%'");
}
sb.append(" ORDER BY apply.\"createDate\" DESC");
List<Map<String, Object>> list = null;
try {
list = lcJdbcTemplate.queryForList(sb.toString());
} catch (DataAccessException e) {
logger.error("查询浪潮数据库--按资源查询申请记录SQL{}", sb);
List<Map<String, Object>> list = jdbcTemplate.queryForList(sb.toString());
}
return new ArrayList<>(list);
}

View File

@ -61,7 +61,6 @@ public class ResourceBrowseController {
@ApiImplicitParam(name = "name", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "type", value = "查询类型(组件服务 应用资源 知识库)", paramType = "query", dataType = "String"),
})
//@RequiresPermissions("resourceBrowse:resourcebrowse:page")
public Result<PageData<ResourceBrowseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
UserDetail user = SecurityUser.getUser();
if (user == null) {
@ -70,9 +69,9 @@ public class ResourceBrowseController {
Long id = user.getId();
params.put("userId", id);
}
Integer page = Integer.parseInt(params.get("page").toString()) - 1;
Integer pageSize = Integer.parseInt(params.get("limit").toString());
params.put("pageNum", page);
Integer page = params.get("page") != null ? Integer.parseInt(params.get("page").toString()) - 1 : 0;
Integer pageSize = params.get("limit")!= null ? Integer.parseInt(params.get("limit").toString()) : 5;
params.put("pageNum", page * pageSize);
params.put("pageSize", pageSize);
//PageData<ResourceBrowseDTO> page = resourceBrowseService.page(params);

View File

@ -25,6 +25,4 @@ public interface ResourceBrowseDao extends BaseDao<ResourceBrowseEntity> {
List<Map> selectDayList(@Param("startDate") String startDate, @Param("endDate") String endDate);
List<ResourceBrowseDTO> selectResourceBrowseByTypeAndUser(@Param("params") Map<String, Object> params);
Integer resourceBrowseDTOCount(@Param("params") Map<String, Object> params);
}

View File

@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* 浏览记录
@ -79,9 +80,12 @@ public class ResourceBrowseServiceImpl extends CrudServiceImpl<ResourceBrowseDao
@Override
public PageData<ResourceBrowseDTO> selectResourceBrowseByTypeAndUser(Map<String, Object> map) {
Integer total = resourceBrowseDao.resourceBrowseDTOCount(map);
List<ResourceBrowseDTO> list = resourceBrowseDao.selectResourceBrowseByTypeAndUser(map);
PageData<ResourceBrowseDTO> pageData = new PageData<ResourceBrowseDTO>(list, total);
list = list.stream()
.skip(Long.valueOf(map.get("pageNum").toString()))
.limit(Long.valueOf(map.get("pageSize").toString()))
.collect(Collectors.toList());
PageData<ResourceBrowseDTO> pageData = new PageData<ResourceBrowseDTO>(list, list.size());
return pageData;
}
}

View File

@ -38,7 +38,7 @@ public interface SysDeptDao extends BaseDao<SysDeptEntity> {
*/
SysDeptEntity getByName(String name);
Map<String, Object> selectLCDeptByUcsDeptName(@Param("provideDept") String provideDept);
List<Map<String, Object>> selectLCDeptByUcsDeptName(@Param("provideDept") String provideDept);
List<String> selectLCDeptByRegion(@Param("region") Long region);

View File

@ -0,0 +1 @@
ALTER TABLE tb_fuse ADD COLUMN `district` int(2) DEFAULT 0 COMMENT '赋能场景类型0市级、1基层场景';

View File

@ -19,6 +19,7 @@
<result property="infrastructureCount" column="infrastructure_count"/>
<result property="dataSourceCount" column="data_source_count"/>
<result property="componentCount" column="component_count"/>
<result property="district" column="district"/>
</resultMap>
<select id="getFuseDTOList" resultMap="fuseDTO">
@ -44,6 +45,9 @@
<if test="deptUser != null and deptUser != ''">
and dept_user like concat('%', #{deptUser}, '%')
</if>
<if test="district != null and district != ''">
and district = #{district}
</if>
<if test="mobile != null and mobile != ''">
and mobile like concat('%', #{mobile}, '%')
</if>

View File

@ -1515,8 +1515,10 @@
</select>
<select id="selectUsersApplyAndCount" resultMap="resourceDTO">
SELECT tdr.*, count(taa.id) as applyCount
FROM tb_data_resource tdr left join t_ability_application taa on tdr.id=taa.resource_id
SELECT tdr.*, sd.name AS "deptName", count(taa.id) as applyCount
FROM tb_data_resource tdr
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
LEFT JOIN t_ability_application taa on tdr.id=taa.resource_id
WHERE
1 = 1
AND tdr.del_flag = 0
@ -1813,7 +1815,7 @@
AND taa.approve_status = #{approveStatus}
</if>
<if test="deptId != null and deptId != ''">
AND sd.id = #{deptId}
AND sd.name = #{deptId}
</if>
<if test="type != null and type != ''">
AND tdr.type = #{type}
@ -1902,7 +1904,7 @@
</otherwise>
</choose>
<if test="deptId != null and deptId != ''">
AND sd.id = #{deptId}
AND sd.name = #{deptId}
</if>
<if test="region != null and region != ''">
AND sd.district = #{region}
@ -1957,7 +1959,7 @@
</otherwise>
</choose>
<if test="deptId != null and deptId != ''">
AND sd.id = #{deptId}
AND sd.name = #{deptId}
</if>
<if test="type != null and type != ''">
AND tdr.type = #{type}
@ -2029,7 +2031,7 @@
AND tdr.name LIKE CONCAT( '%', #{resourceName}, '%' )
</if>
<if test="provideDept != null and provideDept != ''">
AND dept.id = #{provideDept}
AND dept.name = #{provideDept}
</if>
<if test="startDate != null and startDate != '' and endDate != null and endDate != ''">
AND SUBSTR(taa.create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
@ -2068,10 +2070,10 @@
</when>
</choose>
<if test="deptId != null and deptId != ''">
AND tmb.dept LIKE CONCAT( '%', #{deptId}, '%' )
AND tmb.dept = #{deptId}
</if>
<if test="provideDept != null and provideDept != ''">
AND #{provideDept} = 1067246875800000066
AND #{provideDept} = '青岛市大数据发展管理局'
</if>
<if test="region != null and region != ''">
AND sr.id = #{region}

View File

@ -75,28 +75,6 @@
LIKE(CONCAT('%',CONCAT(trim(#{params.name}),'%'))))
</if>
AND b.del_flag = 0
<choose>
<when test="params.orderField != null and params.orderField != null and params.order != null and params.order != ''">
ORDER BY ${params.orderField} ${params.order}
</when>
<otherwise>
ORDER BY create_date desc
</otherwise>
</choose>
LIMIT ${params.pageNum}, ${params.pageSize}
</select>
<select id="resourceBrowseDTOCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(a.id) AS total FROM tb_resource_browse a INNER JOIN tb_data_resource b ON a.resource_id = b.id
WHERE a.state = 0
<if test="params.type != null and params.type != ''">
AND b.type = #{params.type}
</if>
<if test="params.name != null and params.name != ''">
AND (b.name LIKE(CONCAT('%',CONCAT(trim(#{params.name}),'%'))) OR b.type
LIKE(CONCAT('%',CONCAT(trim(#{params.name}),'%'))) OR b.description
LIKE(CONCAT('%',CONCAT(trim(#{params.name}),'%'))))
</if>
AND b.del_flag = 0
</select>
</mapper>