From 4014ec29a982e32af168945d1d70fbcd86c6b4cc Mon Sep 17 00:00:00 2001 From: WendyYang Date: Wed, 20 Mar 2024 11:05:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B7=A5=E4=BD=9C=E5=8F=B0?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=A0=91=E4=B8=8B=E6=8B=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hz/pm/api/user/controller/MhUnitController.java | 6 ++++++ .../main/java/com/hz/pm/api/user/manage/MhUnitManage.java | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java index 502a009..d6cf0ba 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/controller/MhUnitController.java @@ -45,6 +45,12 @@ public class MhUnitController { return mhUnitManage.getMhUnitStripTree(); } + @GetMapping("/dashboard/option") + @ApiOperation("工作台单位下拉") + public List dashboardUnitOption() { + return mhUnitManage.getMhUnitDashboardOption(); + } + @GetMapping("/page") @ApiOperation("单位列表") public PageVo page(MhUnitListReq req) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java index 4cfad8f..319fe96 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/manage/MhUnitManage.java @@ -89,6 +89,20 @@ public class MhUnitManage { return nodes; } + public List getMhUnitDashboardOption() { + List allUnits = mhUnitCache.all(); + List nodes = allUnits.stream() + .filter(w -> MhUnitTypeEnum.SASAC.equals(w.getType()) || + ((MhUnitTypeEnum.REGION.equals(w.getType()) || MhUnitTypeEnum.NODE.equals(w.getType())) + && (w.getName().endsWith("信创办") || "市级部门".equals(w.getName()) || "杭州市".equals(w.getName())))) + .map(w -> BeanUtil.copyProperties(w, MhUnitTreeDTO.class)) + .collect(Collectors.toList()); + Function function = w -> w.getType().getStrip().getCode(); + nodes.sort(Comparator.comparing(MhUnitTreeDTO::getName) + .thenComparing(function, Comparator.reverseOrder())); + return nodes; + } + public PageVo page(MhUnitListReq req) { LambdaQueryWrapper query = Wrappers.lambdaQuery(MhUnit.class); if (StrUtils.isNotBlank(req.getName())) {