From 79e991f240d21cae34284d2a3ea49f448c6f5e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Thu, 30 Mar 2023 09:12:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E5=AE=9A=E5=88=B6?= =?UTF-8?q?=E5=8C=96=E9=80=BB=E8=BE=91=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/manage/OrganizationManage.java | 63 ++++++++++++++-------- 1 file changed, 40 insertions(+), 23 deletions(-) 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 cdd3bb1..214615d 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 @@ -166,32 +166,49 @@ public class OrganizationManage { return keyTreeVO; }).collect(Collectors.toList()); - if (needMember && orgKeyTreeVOList.size() > 0) { - List organizationCodeList = orgKeyTreeVOList.stream() - .map(KeyTreeVO::getKey).collect(Collectors.toList()); - List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getMainJob, "true") - .in(DingEmployeeInfo::getOrganizationCode, organizationCodeList)); - - Map> organizationCodeGroupMap = dingEmployeeInfoList.stream() - .collect(Collectors.groupingBy(DingEmployeeInfo::getOrganizationCode)); + List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getMainJob, "true") + .eq(DingEmployeeInfo::getOrganizationCode, parentCode)); + + List memberChildren = dingEmployeeInfoList.stream().map(r -> { + KeyTreeVO child = new KeyTreeVO(); + child.setKey(r.getEmployeeCode()); + child.setTitle(r.getEmployeeName()); + child.setType("MEMBER"); + return child; + }).collect(Collectors.toList()); - for (KeyTreeVO keyTreeVO : orgKeyTreeVOList) { - String organizationCode = keyTreeVO.getKey(); - List dingEmployeeInfoGroupList = organizationCodeGroupMap.get(organizationCode); - if (CollUtil.isNotEmpty(dingEmployeeInfoGroupList)) { - List memberChildren = dingEmployeeInfoGroupList.stream().map(r -> { - KeyTreeVO child = new KeyTreeVO(); - child.setKey(r.getEmployeeCode()); - child.setTitle(r.getEmployeeName()); - child.setType("MEMBER"); - return child; - }).collect(Collectors.toList()); - keyTreeVO.setChildren(memberChildren); - } - } + if (CollUtil.isNotEmpty(memberChildren)) { + orgKeyTreeVOList.addAll(memberChildren); } + +// if (needMember && orgKeyTreeVOList.size() > 0) { +// List organizationCodeList = orgKeyTreeVOList.stream() +// .map(KeyTreeVO::getKey).collect(Collectors.toList()); +// List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) +// .eq(DingEmployeeInfo::getMainJob, "true") +// .in(DingEmployeeInfo::getOrganizationCode, organizationCodeList)); +// +// Map> organizationCodeGroupMap = dingEmployeeInfoList.stream() +// .collect(Collectors.groupingBy(DingEmployeeInfo::getOrganizationCode)); +// +// for (KeyTreeVO keyTreeVO : orgKeyTreeVOList) { +// String organizationCode = keyTreeVO.getKey(); +// List dingEmployeeInfoGroupList = organizationCodeGroupMap.get(organizationCode); +// if (CollUtil.isNotEmpty(dingEmployeeInfoGroupList)) { +// List memberChildren = dingEmployeeInfoGroupList.stream().map(r -> { +// KeyTreeVO child = new KeyTreeVO(); +// child.setKey(r.getEmployeeCode()); +// child.setTitle(r.getEmployeeName()); +// child.setType("MEMBER"); +// return child; +// }).collect(Collectors.toList()); +// keyTreeVO.setChildren(memberChildren); +// } +// } +// } + return orgKeyTreeVOList; } } From b96bf71ff49f3d426d64666696c364bbe3cdd104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Thu, 30 Mar 2023 09:19:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E5=AE=9A=E5=88=B6?= =?UTF-8?q?=E5=8C=96=E9=80=BB=E8=BE=91=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/manage/OrganizationManage.java | 29 +++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) 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 214615d..27842f6 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 @@ -166,23 +166,24 @@ public class OrganizationManage { return keyTreeVO; }).collect(Collectors.toList()); - List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) - .eq(DingEmployeeInfo::getMainJob, "true") - .eq(DingEmployeeInfo::getOrganizationCode, parentCode)); - - List memberChildren = dingEmployeeInfoList.stream().map(r -> { - KeyTreeVO child = new KeyTreeVO(); - child.setKey(r.getEmployeeCode()); - child.setTitle(r.getEmployeeName()); - child.setType("MEMBER"); - return child; - }).collect(Collectors.toList()); + if (StringUtils.isNotBlank(parentCode) && !needMember){ + List dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getMainJob, "true") + .eq(DingEmployeeInfo::getOrganizationCode, parentCode)); + + List memberChildren = dingEmployeeInfoList.stream().map(r -> { + KeyTreeVO child = new KeyTreeVO(); + child.setKey(r.getEmployeeCode()); + child.setTitle(r.getEmployeeName()); + child.setType("MEMBER"); + return child; + }).collect(Collectors.toList()); - if (CollUtil.isNotEmpty(memberChildren)) { - orgKeyTreeVOList.addAll(memberChildren); + if (CollUtil.isNotEmpty(memberChildren)) { + orgKeyTreeVOList.addAll(memberChildren); + } } - // if (needMember && orgKeyTreeVOList.size() > 0) { // List organizationCodeList = orgKeyTreeVOList.stream() // .map(KeyTreeVO::getKey).collect(Collectors.toList());