From c63361132a0945e2300e4e24a0515a942afe9b45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Mon, 17 Apr 2023 15:28:13 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=B8=93=E5=AE=B6=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=86=85=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DingOrganizationController.java | 4 ++-- .../organization/manage/OrganizationManage.java | 23 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java index 5d7bc7c..038877d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/controller/DingOrganizationController.java @@ -45,8 +45,8 @@ public class DingOrganizationController { @PostMapping("/get-child-list") @ApiOperation("获取组织架构的树状结构(单位筛选列表)") - public List getChildOrganizationList(@RequestParam(value = "parentCode", required = false) String parentCode,@RequestParam(value = "orgName", required = false) String orgName) { - return organizationManage.getChildOrganizationList(parentCode,orgName,false); + public List getChildOrganizationList(@RequestParam(value = "parentCode", required = false) String parentCode, @RequestParam(value = "orgName", required = false) String orgName) { + return organizationManage.getChildOrganizationList(parentCode, orgName, false); } @ApiOperation("组织树状列表筛选(前端定制化接口不可复用)") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java index 5f7e37d..eb5a8ce 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java @@ -180,9 +180,15 @@ public class OrganizationManage { } public List treeEmployeeQuery(String employeeName, String organizationCode) { - List organizationCodeList = CollUtil.toList(organizationCode).stream() + List parentCodeList = CollUtil.toList(organizationCode).stream() .filter(StringUtils::isNotBlank) .collect(Collectors.toList()); + + // 获取所有的组织列表 + List organizationCodeList = new ArrayList<>(); + getChildList(organizationCodeList, parentCodeList); + organizationCodeList = organizationCodeList.stream().distinct().collect(Collectors.toList()); + List dingEmployeeInfoList = iDingEmployeeInfoService .list(Wrappers.lambdaQuery(DingEmployeeInfo.class) .like(DingEmployeeInfo::getEmployeeName, employeeName) @@ -213,6 +219,21 @@ public class OrganizationManage { return orgKeyTreeVOList; } + private void getChildList(List orgCodeList, List parentCodeList) { + if (CollUtil.isEmpty(parentCodeList)) { + return; + } + orgCodeList.addAll(parentCodeList); +// orgCodeList = orgCodeList.stream().distinct().collect(Collectors.toList()); + + for (String parentCode : parentCodeList) { + List childOrgList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getParentCode, parentCode)); + List newParentCodeList = childOrgList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList()); + getChildList(orgCodeList, newParentCodeList); + } + } + private void employeeNameSearcheTreeVOList(List basicOrgKeyTreeVOList, List allDingEmployeeInfoList) { Map> orgCodeEmployeeMap = allDingEmployeeInfoList.stream() .filter(r -> StringUtils.isNotBlank(r.getOrganizationCode()))