From a04571795ddf3d3fcd1b71b5b09e2e831c90aa8f Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 27 Dec 2022 10:45:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=83=BD=E5=8A=9B=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E5=87=BA=E6=B5=AA=E6=BD=AE=E4=BA=91=E8=B5=84=E6=BA=90=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/CensusController.java | 2 +- .../resource/service/ResourceService.java | 7 +++++ .../service/impl/ResourceServiceImpl.java | 31 +++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java index 2f6a5072..e80b30c9 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/CensusController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/CensusController.java @@ -593,7 +593,7 @@ public class CensusController { params.put("region", sysDeptDTO.getDistrict()); // 管理员只出本部门区域 } - ArrayList resultList = (ArrayList) resourceDao.selectCensusApplyTable(params); + ArrayList resultList = (ArrayList) resourceService.selectCensusApplyTableNotPaging(params); List> date = resultList.stream().map(index -> { List data = new ArrayList<>(); data.add(index.getOrDefault("deptName", "") == null ? "" : index.getOrDefault("deptName", "").toString()); diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java b/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java index 90b9cec5..c0ef5566 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java @@ -150,6 +150,13 @@ public interface ResourceService extends CrudService resultList; + if (params.containsKey("type") && (null == params.get("type") || org.apache.commons.lang3.StringUtils.isBlank(params.get("type").toString()))) { //查所有 + resultList = resourceDao.selectCensusApplyTable(params); + List lcApplyDtoList = lcSelectCensusApplyTable(params); + resultList.addAll(lcApplyDtoList); + resultList = resultList.stream() + .sorted(Comparator.comparing(x -> { + Map map = (Map) x; + return DateUtils.parse(map.get("createDate").toString(), DateUtils.DATE_TIME_PATTERN); + }).reversed()).collect(Collectors.toList()); + } else if ("云资源".equals(params.get("type").toString()) || "云视频".equals(params.get("type").toString())) { // 浪潮云资源 + resultList = lcSelectCensusApplyTable(params); + resultList = resultList.stream() + .sorted(Comparator.comparing(x -> { + Map map = (Map) x; + return DateUtils.parse(map.get("createDate").toString(), DateUtils.DATE_TIME_PATTERN); + }).reversed()).collect(Collectors.toList()); + } else { // ucs 特殊 + resultList = resourceDao.selectCensusApplyTable(params); + } + return resultList; + } + private List lcSelectCensusApplyTable(Map params) { From 898e499720a76b085d525c5caa9d44a5c963138b Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 27 Dec 2022 10:49:17 +0800 Subject: [PATCH 2/2] ... --- .../service/impl/ResourceServiceImpl.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) 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 ea2afa62..463344e4 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 @@ -2910,23 +2910,31 @@ public class ResourceServiceImpl extends CrudServiceImpl resultList; + List resultList = new ArrayList<>(); if (params.containsKey("type") && (null == params.get("type") || org.apache.commons.lang3.StringUtils.isBlank(params.get("type").toString()))) { //查所有 resultList = resourceDao.selectCensusApplyTable(params); - List lcApplyDtoList = lcSelectCensusApplyTable(params); - resultList.addAll(lcApplyDtoList); + try { + List lcApplyDtoList = lcSelectCensusApplyTable(params); + resultList.addAll(lcApplyDtoList); + } catch (Exception exception) { + logger.error("查询浪潮云资源失败", exception); + } resultList = resultList.stream() .sorted(Comparator.comparing(x -> { Map map = (Map) x; return DateUtils.parse(map.get("createDate").toString(), DateUtils.DATE_TIME_PATTERN); }).reversed()).collect(Collectors.toList()); } else if ("云资源".equals(params.get("type").toString()) || "云视频".equals(params.get("type").toString())) { // 浪潮云资源 - resultList = lcSelectCensusApplyTable(params); - resultList = resultList.stream() - .sorted(Comparator.comparing(x -> { - Map map = (Map) x; - return DateUtils.parse(map.get("createDate").toString(), DateUtils.DATE_TIME_PATTERN); - }).reversed()).collect(Collectors.toList()); + try { + resultList = lcSelectCensusApplyTable(params); + resultList = resultList.stream() + .sorted(Comparator.comparing(x -> { + Map map = (Map) x; + return DateUtils.parse(map.get("createDate").toString(), DateUtils.DATE_TIME_PATTERN); + }).reversed()).collect(Collectors.toList()); + } catch (Exception exception) { + logger.error("查询浪潮云资源失败", exception); + } } else { // ucs 特殊 resultList = resourceDao.selectCensusApplyTable(params); }