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<>();
CompletableFuture<Void> allAmount = null;
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: { // 包头
allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目
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;
}
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, null, null, null, null, ids);
resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> {
ResourceDTO index = (ResourceDTO) x;
return index.getTotal() == null ? 0L : index.getTotal();
}).reversed()).collect(Collectors.toList()));
} else {
resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType, null);
}
resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> {
ResourceDTO index = (ResourceDTO) x;
return index.getTotal() == null ? 0L : index.getTotal();
}).reversed()).collect(Collectors.toList()));
resultPage.setRecords(resourceDTOS);
resultPage.setTotal(resourceDao.selectDTOPageCount(resourceDTO));
} else {
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType);
@ -557,7 +558,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
.ne("gps_y", "")
.isNotNull("gps_x")
.isNotNull("gps_y");
put("count", cameraChannelMapper.selectCount(queryWrapper) + "");
put("count", cameraChannelMapper.selectCount(queryWrapper) + "");
put("type", "基础设施");
}
});
@ -1495,8 +1496,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public List<Map<String, Object>> assemblerCarDetail(Map<String, Object> params) {
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())};
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);
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);
return result;
}
@ -1512,8 +1513,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
limit = Integer.parseInt((String) params.get(Constant.LIMIT));
}
Long deptId = SecurityUser.getUser().getDeptId();
List<Long> deptList=null;
if(deptId != null){
List<Long> deptList = null;
if (deptId != null) {
deptList = deptService.getSubDeptIdList(deptId);
}
boolean isAsc = false;
@ -1523,7 +1524,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
String orderColumn = params.get(Constant.ORDER_FIELD) == null ? "create_date" : (String) params.get(Constant.ORDER_FIELD);
IPage<ResourceEntity> page = new Page<>(curPage, limit);
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
if(deptList != null){
if (deptList != null) {
queryWrapper.in("dept_id", deptList);
}
queryWrapper.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderBy(true, isAsc, orderColumn);
@ -1534,8 +1535,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public Object selectTotalByDept() {
HashMap<String, Object> resultMap = new HashMap<>();
Long deptId = SecurityUser.getUser().getDeptId();
List<Long> deptList=null;
if(deptId != null){
List<Long> deptList = null;
if (deptId != null) {
deptList = deptService.getSubDeptIdList(deptId);
}
resultMap.put("total", resourceDao.selectCountByDepts(deptList));
@ -1569,9 +1570,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
IPage<ResourceEntity> page = new Page<>(curPage, limit);
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id", resourceIds).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderBy(true, isAsc, orderColumn);
List<ResourceDTO> dtoList=ConvertUtils.sourceToTarget(resourceDao.selectPage(page, queryWrapper).getRecords(), ResourceDTO.class);
dtoList.forEach(temp->{
Map p=new HashMap();
List<ResourceDTO> dtoList = ConvertUtils.sourceToTarget(resourceDao.selectPage(page, queryWrapper).getRecords(), ResourceDTO.class);
dtoList.forEach(temp -> {
Map p = new HashMap();
p.put("resource_id", temp.getId());
temp.setApplyCount(String.valueOf(tAbilityApplicationService.list(p).size()));
});
@ -1604,12 +1605,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if (params.get(Constant.LIMIT) != null) {
limit = Integer.parseInt((String) params.get(Constant.LIMIT));
}
Long deptId=SecurityUser.getUser().getDeptId();
List<Long> deptList=null;
if(deptId != null){
deptList=deptService.getSubDeptIdList(deptId);
Long deptId = SecurityUser.getUser().getDeptId();
List<Long> deptList = null;
if (deptId != null) {
deptList = deptService.getSubDeptIdList(deptId);
}
List<Map> result=resourceDao.selectDeptResourceByApplyNum(deptList);
List<Map> result = resourceDao.selectDeptResourceByApplyNum(deptList);
Page<Map> page = new Page(curPage, limit);
int j = Math.min(curPage * limit, result.size());
if (result.isEmpty()) {
@ -1628,12 +1629,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public Object trafficDeptResource(String startDate, String endDate) {
Map params=new HashMap();
Map params = new HashMap();
params.put("startDate", startDate);
params.put("endDate", endDate);
Long deptId = SecurityUser.getUser().getDeptId();
List<Long> deptList=null;
if(deptId != null){
List<Long> deptList = null;
if (deptId != null) {
deptList = deptService.getSubDeptIdList(deptId);
}
params.put("deptIds", deptList);
@ -1677,7 +1678,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return new HashMap<String, Object>() {{
Map map = (Map) selectTotal();
List<Map<String, Object>> list = (List<Map<String, Object>>) map.get("total");
list.forEach(index ->{
list.forEach(index -> {
if ("基础设施".equals(index.get("type").toString())) {
put("视频资源", Integer.parseInt(index.get("count").toString()));
}

View File

@ -90,12 +90,38 @@
res.del_flag AS "delFlag",
car.note1,
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
tb_resource_car car,
tb_data_resource res
WHERE 1 = 1
WHERE
1 = 1
AND car.resource_id = res.id
AND car.resource_id = 8888888880000000001
AND car.user_id = #{userId}
AND res.dept_id = #{deptId}
AND car.del_flag = 0