bug修复:

1.能力统计-基础设施来源修改
2.申购车查询逻辑修改
3.排序失效修复
This commit is contained in:
dinggang 2022-07-01 18:27:31 +08:00
parent 4f2ba4d710
commit 52edb4edcd
3 changed files with 68 additions and 27 deletions

View File

@ -322,7 +322,21 @@ public class CensusControllerV2 {
List<Map<String, Object>> result = new CopyOnWriteArrayList<>(); List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
CompletableFuture<Void> allAmount = null; CompletableFuture<Void> allAmount = null;
switch (Constant.ProjectPlace.getByFlag(projectPlace)) { switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
case TSINGTAO: // 青岛市局 case TSINGTAO: { // 青岛市局
allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
Map map = (Map) resourceService.selectTotal();
List<Map<String, Object>> dbAmount = (List<Map<String, Object>>) map.get("total");
return dbAmount.stream().mapToLong(index -> Long.parseLong(index.get("count").toString())).sum();
}).thenAccept(sum -> {
result.add(new HashMap<String, Object>() {
{
put("amount", sum);
put("type", "视频资源数量");
}
});
});
}
break;
case BAOTOU: { // 包头 case BAOTOU: { // 包头
allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目 allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type = '基础设施' AND del_flag = 0", Long.class); return jdbcTemplate.queryForObject("SELECT COUNT(id) FROM tb_data_resource WHERE type = '基础设施' AND del_flag = 0", Long.class);

View File

@ -316,13 +316,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
break; break;
} }
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, null, null, null, null, ids); resourceDTOS = resourceDao.selectDTOPage(resourceDTO, null, null, null, null, ids);
} else {
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType, null);
}
resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> { resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> {
ResourceDTO index = (ResourceDTO) x; ResourceDTO index = (ResourceDTO) x;
return index.getTotal() == null ? 0L : index.getTotal(); return index.getTotal() == null ? 0L : index.getTotal();
}).reversed()).collect(Collectors.toList())); }).reversed()).collect(Collectors.toList()));
} else {
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType, null);
}
resultPage.setRecords(resourceDTOS);
resultPage.setTotal(resourceDao.selectDTOPageCount(resourceDTO)); resultPage.setTotal(resourceDao.selectDTOPageCount(resourceDTO));
} else { } else {
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType); List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType);
@ -1495,8 +1496,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public List<Map<String, Object>> assemblerCarDetail(Map<String, Object> params) { public List<Map<String, Object>> assemblerCarDetail(Map<String, Object> params) {
List<Map<String, Object>> result = new ArrayList<>(); List<Map<String, Object>> result = new ArrayList<>();
Object[] ps = {params.get("resourceType"), params.get("id"), params.get("id"), (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()), Integer.parseInt(params.get("limit").toString())}; Object[] ps = {params.get("resourceType"), params.get("id"), params.get("id"), (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()), Integer.parseInt(params.get("limit").toString())};
result = jdbcTemplate.queryForList("SELECT a.* FROM tb_resource_car a INNER JOIN sys_user b ON a.creator = b.id INNER JOIN sys_dept c ON b.dept_id = c.id INNER JOIN tb_data_resource d on a.resource_id = d.id WHERE a.del_flag = 0 " + result = jdbcTemplate.queryForList("SELECT a.* FROM tb_resource_car a INNER JOIN sys_user b ON a.creator = b.id INNER JOIN sys_dept c ON b.dept_id = c.id INNER JOIN tb_data_resource d ON a.resource_id = d.id WHERE a.del_flag = 0 " +
"AND d.type = ? AND (c.id = ? or INSTR(c.pids,?)) order by a.create_date DESC LIMIT ?,?", ps); "AND d.type = ? AND (c.id = ? OR INSTR(c.pids,?)) ORDER BY a.create_date DESC LIMIT ?,?", ps);
return result; return result;
} }

View File

@ -90,12 +90,38 @@
res.del_flag AS "delFlag", res.del_flag AS "delFlag",
car.note1, car.note1,
car.create_date AS "time", car.create_date AS "time",
res.del_flag AS "delFlag" tda.attr_value AS "componentType"
FROM
tb_resource_car car,
tb_data_resource res,
tb_data_attr tda
WHERE 1 = 1
AND car.resource_id = res.id
AND res.id = tda.data_resource_id
AND car.resource_id != 8888888880000000001
AND tda.attr_type = '组件类型'
AND tda.del_flag = 0
AND car.user_id = #{userId}
AND res.dept_id = #{deptId}
AND car.del_flag = 0
UNION
SELECT
car.id AS "id",
res.id AS "resourceId",
'申请摄像头列表' AS "resourceName",
res.description,
res.type,
0 AS "delFlag",
car.note1,
car.create_date AS "time",
"" AS "componentType"
FROM FROM
tb_resource_car car, tb_resource_car car,
tb_data_resource res tb_data_resource res
WHERE 1 = 1 WHERE
1 = 1
AND car.resource_id = res.id AND car.resource_id = res.id
AND car.resource_id = 8888888880000000001
AND car.user_id = #{userId} AND car.user_id = #{userId}
AND res.dept_id = #{deptId} AND res.dept_id = #{deptId}
AND car.del_flag = 0 AND car.del_flag = 0