diff --git a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java index 67df43b3..f579c2f0 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java @@ -257,6 +257,8 @@ public class ResourceController { if ("f".equals(source)) { dto.setDelFlag(2); // 来自前端页面 走审批流程 } + dto.setPinTop(0); + dto.setPinTopTime(new Date(0)); logger.info(dto.toString()); resourceService.insertWithAttrs(dto); diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 8182c540..f7d1e322 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -471,17 +471,54 @@ public class ResourceServiceImpl extends CrudServiceImpl { List temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> { - Map index = (Map) x; - String string = (index.get("total") == null) ? "0" : index.get("total").toString(); - return Long.valueOf(string); - }).reversed()).skip((long) (pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList()); +// Map index = (Map) x; +// String string = (index.get("total") == null) ? "0" : index.get("total").toString(); +// return Long.valueOf(string); + Map index = (Map) x; + int pingTOp = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString()); + return pingTOp; + }, Comparator.reverseOrder()) + .thenComparing(x -> { +// Map index = (Map) x; +// int pingTOp = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString()); +// return pingTOp; + Map index = (Map) x; + long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString()); + return pingTOp; + }, Comparator.reverseOrder()).thenComparing(x -> { +// Map index = (Map) x; +// long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString()); +// return pingTOp; + Map index = (Map) x; + String string = (index.get("total") == null) ? "0" : index.get("total").toString(); + return Long.valueOf(string); + }, Comparator.reverseOrder()) + ).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 temp = selectDTOPageSpecilTotal.parallelStream().map(Map.class::cast).sorted(Comparator.comparing(x -> { - String string = (x.get("total") == null) ? "0" : x.get("total").toString(); +// Map index = (Map) x; +// String string = (index.get("total") == null) ? "0" : index.get("total").toString(); +// return Long.valueOf(string); + Map index = (Map) x; + int pingTOp = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString()); + return pingTOp; + }, Comparator.reverseOrder()).thenComparing(x -> { +// Map index = (Map) x; +// int pingTOp = (index.get("pin_top") == null) ? 0 : Integer.parseInt(index.get("pin_top").toString()); +// return pingTOp; + Map index = (Map) x; + long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString()); + return pingTOp; + }, Comparator.reverseOrder()).thenComparing(x -> { +// Map index = (Map) x; +// long pingTOp = (index.get("pin_top_time") == null) ? 0 : Long.parseLong(index.get("pin_top_time").toString()); +// return pingTOp; + Map index = (Map) x; + String string = (index.get("total") == null) ? "0" : index.get("total").toString(); return Long.valueOf(string); })).skip((pageNum - 1) * pageSize).limit(pageSize).map(x -> Long.valueOf(x.get("id").toString())).limit(pageSize).collect(Collectors.toList()); return temp; @@ -491,14 +528,29 @@ public class ResourceServiceImpl extends CrudServiceImpl { - ResourceDTO index = (ResourceDTO) x; - return index.getTotal() == null ? 0L : index.getTotal(); - }).reversed()).collect(Collectors.toList())); + ResourceDTO index = (ResourceDTO) x; + return index.getTotal() == null ? 0L : index.getTotal(); + }, Comparator.reverseOrder()) + .thenComparing(x -> { + ResourceDTO index = (ResourceDTO) x; + return index.getPinTop() == null ? 0 : index.getPinTop(); + }, Comparator.reverseOrder()).thenComparing(x -> { + ResourceDTO index = (ResourceDTO) x; + return index.getPinTopTime() == null ? new Date(0) : index.getPinTopTime(); + }, Comparator.reverseOrder()) + ).collect(Collectors.toList())); } else { resultPage.setRecords(resourceDTOS.stream().sorted(Comparator.comparing(x -> { - ResourceDTO index = x; - return index.getTotal() == null ? 0L : index.getTotal(); - })).collect(Collectors.toList())); + ResourceDTO index = (ResourceDTO) x; + return index.getTotal() == null ? 0L : index.getTotal(); + }).thenComparing(x -> { + ResourceDTO index = (ResourceDTO) x; + return index.getPinTop() == null ? 0 : index.getPinTop(); + }, Comparator.reverseOrder()) + .thenComparing(x -> { + ResourceDTO index = (ResourceDTO) x; + return index.getPinTopTime() == null ? new Date(0) : index.getPinTopTime(); + }, Comparator.reverseOrder())).collect(Collectors.toList())); } customThreadPool.shutdown(); } else { // 非总体评价排序时 @@ -1924,7 +1976,7 @@ public class ResourceServiceImpl extends CrudServiceImpl dataResourceCount = CompletableFuture.runAsync(() -> { //数据资源 //青岛市局数据资源 @@ -1941,7 +1993,7 @@ public class ResourceServiceImpl extends CrudServiceImpl infrastructureCount = CompletableFuture.runAsync(() -> { //基础设施 HashMap queryMap = new HashMap<>(); - queryMap.put("cameraName",keyWorld); + queryMap.put("cameraName", keyWorld); Integer countNew = cameraChannelMapper.selectByParentIdCountNew(queryMap, null, ""); resultList.add(new HashMap() { { diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 0f9950b7..aa0e3acb 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -132,7 +132,8 @@ AND user_id = #{dto.creator} GROUP BY id) taa2 ON tdr.id = taa2.resource_id LEFT JOIN ( SELECT resource_id, COUNT( approve_status ) approve_status FROM t_ability_application WHERE 1 = 1 - AND del_flag = 0 AND user_id = #{dto.creator} AND approve_status = '通过' GROUP BY resource_id ) taa3 ON tdr.id = + AND del_flag = 0 AND user_id = #{dto.creator} AND approve_status = '通过' GROUP BY resource_id ) taa3 ON tdr.id + = taa3.resource_id LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id WHERE 1 = 1 @@ -414,7 +415,8 @@ AND user_id = #{dto.creator} GROUP BY id) taa2 ON tdr.id = taa2.resource_id LEFT JOIN ( SELECT resource_id, COUNT( approve_status ) approve_status FROM t_ability_application WHERE 1 = 1 - AND del_flag = 0 AND user_id = #{dto.creator} AND approve_status = '通过' GROUP BY resource_id ) taa3 ON tdr.id = + AND del_flag = 0 AND user_id = #{dto.creator} AND approve_status = '通过' GROUP BY resource_id ) taa3 ON tdr.id + = taa3.resource_id LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id WHERE 1 = 1 @@ -475,7 +477,9 @@ 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 + FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id WHERE a.type = #{resourceType} AND a.del_flag = 0 AND (b.ID = #{id} OR INSTR(b.pids,#{id})) @@ -1506,34 +1513,34 @@