HIQDUCS-100 的处理
This commit is contained in:
parent
b1376f4646
commit
ce11e658ff
|
@ -478,34 +478,31 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
switch (orderType.toUpperCase()) {
|
||||
case "DESC": // total 倒序
|
||||
ids = customThreadPool.submit(() -> {
|
||||
List<Long> temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast)
|
||||
.sorted(Comparator.comparing(x -> {
|
||||
Map index = (Map) x;
|
||||
int pingTOp_ = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString());
|
||||
String total = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||
if (pingTOp_ <= 0) {
|
||||
return 0l + Long.valueOf(total) == 0 ? -1 : Long.valueOf(total);
|
||||
}
|
||||
long pingTOp = (index.get("pin_top_time") == null) ? 0 + (Long.valueOf(total) == 0 ? -1 : Long.valueOf(total)) : Long.parseLong(index.get("pin_top_time").toString()) + Long.valueOf(total);
|
||||
return (pingTOp % 1000) == 0 ? -1 : pingTOp % 1000;
|
||||
}).reversed()
|
||||
).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList());
|
||||
List<Long> temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
||||
Map index = (Map) x;
|
||||
int pingTOp_ = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString());
|
||||
String total = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||
if (pingTOp_ <= 0) {
|
||||
return 0l + Long.valueOf(total) == 0 ? -1 : Long.valueOf(total);
|
||||
}
|
||||
long pingTOp = (index.get("pin_top_time") == null) ? 0 + (Long.valueOf(total) == 0 ? -1 : Long.valueOf(total)) : Long.parseLong(index.get("pin_top_time").toString()) + Long.valueOf(total);
|
||||
return (pingTOp % 1000) == 0 ? -1 : pingTOp % 1000;
|
||||
}).reversed()).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList());
|
||||
return temp;
|
||||
}).get();
|
||||
break;
|
||||
case "ASC": // total 升序
|
||||
ids = customThreadPool.submit(() -> {
|
||||
List<Long> temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast)
|
||||
.sorted(Comparator.comparing(x -> {
|
||||
Map index = (Map) x;
|
||||
int pingTOp_ = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString());
|
||||
String total = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||
if (pingTOp_ <= 0) {
|
||||
return 0l + Long.valueOf(total) == 0 ? -1 : Long.valueOf(total);
|
||||
}
|
||||
long pingTOp = (index.get("pin_top_time") == null) ? 0 + (Long.valueOf(total) == 0 ? -1 : Long.valueOf(total)) : Long.parseLong(index.get("pin_top_time").toString()) + Long.valueOf(total);
|
||||
return (pingTOp % 1000) == 0 ? -1 : pingTOp % 1000;
|
||||
})).skip((pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList());
|
||||
List<Long> temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> {
|
||||
Map index = (Map) x;
|
||||
int pingTOp_ = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString());
|
||||
String total = (index.get("total") == null) ? "0" : index.get("total").toString();
|
||||
if (pingTOp_ <= 0) {
|
||||
return 0l + Long.valueOf(total) == 0 ? -1 : Long.valueOf(total);
|
||||
}
|
||||
long pingTOp = (index.get("pin_top_time") == null) ? 0 + (Long.valueOf(total) == 0 ? -1 : Long.valueOf(total)) : Long.parseLong(index.get("pin_top_time").toString()) + Long.valueOf(total);
|
||||
return (pingTOp % 1000) == 0 ? -1 : pingTOp % 1000;
|
||||
})).skip((pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList());
|
||||
return temp;
|
||||
}).get();
|
||||
break;
|
||||
|
@ -513,32 +510,30 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, null, null, null, null, ids);
|
||||
if ("DESC".equals(orderType)) {
|
||||
resourceDTOS = resourceDTOS.stream().sorted(Comparator.comparing(x -> {
|
||||
ResourceDTO index = (ResourceDTO) x;
|
||||
int pinTop = index.getPinTop() == null ? 0 : index.getPinTop();
|
||||
long index_;
|
||||
if (pinTop > 0) {
|
||||
index_ = index.getPinTopTime() == null ? new Date(0).getTime() + (index.getTotal() == null ? -1L : index.getTotal()) : index.getPinTopTime().getTime() + (index.getTotal() == null ? -1L : index.getTotal());
|
||||
index_ = index_ % 1000;
|
||||
} else {
|
||||
index_ = (index.getTotal() == null ? -1L : (index.getTotal() == 0 ? -1 : index.getTotal()));
|
||||
}
|
||||
return index_ == 0 ? -1 : index_;
|
||||
}).reversed()
|
||||
).collect(Collectors.toList());
|
||||
ResourceDTO index = (ResourceDTO) x;
|
||||
int pinTop = index.getPinTop() == null ? 0 : index.getPinTop();
|
||||
long index_;
|
||||
if (pinTop > 0) {
|
||||
index_ = index.getPinTopTime() == null ? new Date(0).getTime() + (index.getTotal() == null ? -1L : index.getTotal()) : index.getPinTopTime().getTime() + (index.getTotal() == null ? -1L : index.getTotal());
|
||||
index_ = index_ % 1000;
|
||||
} else {
|
||||
index_ = (index.getTotal() == null ? -1L : (index.getTotal() == 0 ? -1 : index.getTotal()));
|
||||
}
|
||||
return index_ == 0 ? -1 : index_;
|
||||
}).reversed()).collect(Collectors.toList());
|
||||
} else {
|
||||
resourceDTOS = resourceDTOS.stream().sorted(Comparator.comparing(x -> {
|
||||
ResourceDTO index = x;
|
||||
int pinTop = index.getPinTop() == null ? 0 : index.getPinTop();
|
||||
long index_;
|
||||
if (pinTop > 0) {
|
||||
index_ = index.getPinTopTime() == null ? new Date(0).getTime() + (index.getTotal() == null ? -1L : index.getTotal()) : index.getPinTopTime().getTime() + (index.getTotal() == null ? -1L : index.getTotal());
|
||||
index_ = index_ % 1000;
|
||||
} else {
|
||||
index_ = (index.getTotal() == null ? -1L : (index.getTotal() == 0 ? -1 : index.getTotal()));
|
||||
}
|
||||
return index_ == 0 ? -1 : index_;
|
||||
})
|
||||
).collect(Collectors.toList());
|
||||
ResourceDTO index = x;
|
||||
int pinTop = index.getPinTop() == null ? 0 : index.getPinTop();
|
||||
long index_;
|
||||
if (pinTop > 0) {
|
||||
index_ = index.getPinTopTime() == null ? new Date(0).getTime() + (index.getTotal() == null ? -1L : index.getTotal()) : index.getPinTopTime().getTime() + (index.getTotal() == null ? -1L : index.getTotal());
|
||||
index_ = index_ % 1000;
|
||||
} else {
|
||||
index_ = (index.getTotal() == null ? -1L : (index.getTotal() == 0 ? -1 : index.getTotal()));
|
||||
}
|
||||
return index_ == 0 ? -1 : index_;
|
||||
})).collect(Collectors.toList());
|
||||
}
|
||||
customThreadPool.shutdown();
|
||||
} else { // 非总体评价排序时
|
||||
|
@ -693,11 +688,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
public Object selectNewest(JSONObject jsonObject) {
|
||||
IPage<ResourceEntity> page = new Page<>(jsonObject.getIntValue("pageNum"), jsonObject.getIntValue("pageSize"));
|
||||
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"))
|
||||
.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag())
|
||||
.ne("type", "知识库")
|
||||
.ne("type", "赋能案例")
|
||||
.orderByDesc("create_date");
|
||||
queryWrapper.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type")).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).ne("type", "知识库").ne("type", "赋能案例").orderByDesc("create_date");
|
||||
IPage<ResourceEntity> resourceEntityIPage = resourceDao.selectPage(page, queryWrapper);
|
||||
IPage<ResourceDTO> resourceDTOIPage = new Page<>();
|
||||
resourceDTOIPage.setPages(resourceEntityIPage.getPages());
|
||||
|
@ -819,24 +810,23 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
Map<String, List<Map<String, Object>>> listMap = typeMapList.stream().collect(Collectors.groupingBy(m -> m.get("type").toString()));
|
||||
//区级要根据行政区划多加一层结构
|
||||
List<CompletableFuture> tasks =
|
||||
listMap.entrySet().stream().filter(index -> !"区级".equals(index.getKey())).map(item -> {
|
||||
CompletableFuture task = CompletableFuture.runAsync(() -> {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("type", item.getKey());
|
||||
Integer integer = resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type"));
|
||||
map.put("total", integer);
|
||||
item.getValue().forEach(item1 -> {
|
||||
item1.remove("type");
|
||||
item1.remove("regionSort");
|
||||
});
|
||||
map.put("dataList", item.getValue());
|
||||
if (integer != 0) {
|
||||
resultList.add(map);
|
||||
}
|
||||
}, executor);
|
||||
return task;
|
||||
}).collect(Collectors.toList());
|
||||
List<CompletableFuture> tasks = listMap.entrySet().stream().filter(index -> !"区级".equals(index.getKey())).map(item -> {
|
||||
CompletableFuture task = CompletableFuture.runAsync(() -> {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("type", item.getKey());
|
||||
Integer integer = resourceDao.selectTypeCountByDept(item.getKey(), jsonObject.getString("type"));
|
||||
map.put("total", integer);
|
||||
item.getValue().forEach(item1 -> {
|
||||
item1.remove("type");
|
||||
item1.remove("regionSort");
|
||||
});
|
||||
map.put("dataList", item.getValue());
|
||||
if (integer != 0) {
|
||||
resultList.add(map);
|
||||
}
|
||||
}, executor);
|
||||
return task;
|
||||
}).collect(Collectors.toList());
|
||||
CompletableFuture.allOf(tasks.toArray(new CompletableFuture[tasks.size()])).join();
|
||||
|
||||
Optional<List<Map<String, Object>>> areaList = Optional.ofNullable(listMap.get("区级"));
|
||||
|
@ -1115,8 +1105,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
@Override
|
||||
public Object getApplyCameraList(Long instanceId) {
|
||||
QueryWrapper<TAbilityApplicationEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("instance_id", instanceId)
|
||||
.eq("approve_status", "通过");
|
||||
queryWrapper.eq("instance_id", instanceId).eq("approve_status", "通过");
|
||||
List<TAbilityApplicationEntity> applicationEntities = tAbilityApplicationDao.selectList(queryWrapper);
|
||||
ArrayList cameraList = new ArrayList();
|
||||
applicationEntities.forEach(index -> {
|
||||
|
@ -1919,8 +1908,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
resourceIds.add(Long.parseLong(abilityApplicationDTO1.getResourceId()));
|
||||
} else {
|
||||
TResourceMountApplyDTO resourceMountApplyDTO = tResourceMountApplyService.get(Long.valueOf(his.getBusinessKey()));
|
||||
if (resourceMountApplyDTO != null && resourceMountApplyDTO.getResourceDTO() != null
|
||||
&& resourceMountApplyDTO.getResourceDTO().getId() != null) {
|
||||
if (resourceMountApplyDTO != null && resourceMountApplyDTO.getResourceDTO() != null && resourceMountApplyDTO.getResourceDTO().getId() != null) {
|
||||
resourceIds.add(resourceMountApplyDTO.getResourceDTO().getId());
|
||||
if (resourceMountApplyDTO.getResourceId() != null) {
|
||||
ResourceDTO resourceDTO = get(resourceMountApplyDTO.getResourceId());
|
||||
|
@ -2069,23 +2057,56 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
@Override
|
||||
public Object selectDeptDetailTypeCountList(Map params) {
|
||||
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, List<Map<String, Object>>> typeCountListMap = // 市级部门
|
||||
typeCountListByDept.stream().filter(index -> index.get("deptType").toString().equals("2")).collect(Collectors.groupingBy(m -> m.get("dept_id").toString()));
|
||||
List<HashMap<String, Object>> resultList = getDeptTemp1();
|
||||
resultList.addAll(getDeptTemp2());
|
||||
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);
|
||||
});
|
||||
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"));
|
||||
if (countMap.containsKey(count.get("type"))) {
|
||||
countMap.replace(count.get("type").toString(), Integer.parseInt(count.get("count").toString()) + countMap.get(count.get("type")));
|
||||
} else {
|
||||
countMap.put(count.get("type").toString(), Integer.parseInt(count.get("count").toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
return index;
|
||||
}).collect(Collectors.toList());
|
||||
Map<String, List<Map<String, Object>>> typeCountListMap1 = // 区级部门
|
||||
typeCountListByDept.stream().filter(index -> index.get("deptType").toString().equals("3")).collect(Collectors.groupingBy(m -> m.get("district").toString()));
|
||||
resultList = resultList.stream().map(index -> {
|
||||
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 {
|
||||
countMap.put(count.get("type").toString(), Integer.parseInt(count.get("count").toString()));
|
||||
}
|
||||
});
|
||||
}
|
||||
return index;
|
||||
}).collect(Collectors.toList());
|
||||
// typeCountListMap.forEach((k, v) -> {
|
||||
// HashMap<String, 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;
|
||||
|
@ -2098,6 +2119,56 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 返回市级部门的初级构造
|
||||
*/
|
||||
private List<HashMap<String, Object>> getDeptTemp1() {
|
||||
List<HashMap<String, Object>> resultList;
|
||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT id,`name`,type,pid,district FROM sys_dept WHERE type = 2 ORDER BY sys_dept.sort;");
|
||||
resultList = maps.stream().map(index -> {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("count", 0); //
|
||||
map.put("name", index.get("name").toString());
|
||||
map.put("dept_id", index.get("id").toString());
|
||||
map.put("yyzy", "0");
|
||||
map.put("znsf", "0");
|
||||
map.put("tcfw", "0");
|
||||
map.put("kfzj", "0");
|
||||
map.put("ywzj", "0");
|
||||
map.put("jcss", "0");
|
||||
map.put("zsk", "0");
|
||||
map.put("sjzy", "0");
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取区的初级构造
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private List<HashMap<String, Object>> getDeptTemp2() {
|
||||
List<HashMap<String, Object>> resultList;
|
||||
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT id,`name` FROM sys_region WHERE tree_level = 3 AND leaf = 0 ORDER BY sort;");
|
||||
resultList = maps.stream().map(index -> {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("count", 0); //
|
||||
map.put("name", index.get("name").toString());
|
||||
map.put("dept_id", index.get("id").toString());
|
||||
map.put("yyzy", "0");
|
||||
map.put("znsf", "0");
|
||||
map.put("tcfw", "0");
|
||||
map.put("kfzj", "0");
|
||||
map.put("ywzj", "0");
|
||||
map.put("jcss", "0");
|
||||
map.put("zsk", "0");
|
||||
map.put("sjzy", "0");
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object selectCensusResourceTable(Map params) {
|
||||
return resourceDao.selectCensusResourceTable(params);
|
||||
|
|
|
@ -722,10 +722,10 @@
|
|||
</select>
|
||||
|
||||
<select id="selectDeptCount" resultType="java.lang.Integer">
|
||||
<!-- SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
( SELECT DISTINCT dept_id FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 AND dept_id IS NOT NULL ) temp -->
|
||||
<!-- SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
( SELECT DISTINCT dept_id FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 AND dept_id IS NOT NULL ) temp -->
|
||||
SELECT COUNT(id) FROM sys_dept WHERE name != '访客部门'
|
||||
</select>
|
||||
|
||||
|
@ -759,7 +759,8 @@
|
|||
(
|
||||
SELECT DISTINCT
|
||||
sd.id AS "deptId",
|
||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type"
|
||||
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS
|
||||
"type"
|
||||
FROM
|
||||
sys_dept sd
|
||||
WHERE
|
||||
|
@ -1790,6 +1791,9 @@
|
|||
SELECT
|
||||
COUNT( tdr.id ) AS "count",
|
||||
sd.NAME AS "deptName",
|
||||
sd.id AS "dept_id",
|
||||
sd.type AS "deptType",
|
||||
sd.district AS "district",
|
||||
(CASE tdr.type
|
||||
WHEN '应用资源' THEN 'yyzy'
|
||||
WHEN '智能算法' THEN 'znsf'
|
||||
|
@ -1934,7 +1938,8 @@
|
|||
'青岛市大数据发展管理局' AS 'resourceDeptName',
|
||||
'会议室' AS 'type',
|
||||
tm.create_date AS 'createDate',
|
||||
CASE tmb.state WHEN 1 THEN '申请中' WHEN 2 THEN '通过' WHEN 3 THEN '不通过' ELSE '申请中' END AS 'approveStatus',
|
||||
CASE tmb.state WHEN 1 THEN '申请中' WHEN 2 THEN '通过' WHEN 3 THEN '不通过' ELSE '申请中' END AS
|
||||
'approveStatus',
|
||||
'' AS 'applyNumber'
|
||||
FROM
|
||||
t_meetingroom_book tmb,
|
||||
|
|
Loading…
Reference in New Issue