|
@@ -133,6 +133,12 @@ public class OrganizationManage { |
|
|
public List<KeyTreeVO> treeRubbishVOList(ReqSynthesizePO request) { |
|
|
public List<KeyTreeVO> treeRubbishVOList(ReqSynthesizePO request) { |
|
|
String organizationCode = request.getOrganizationCode(); |
|
|
String organizationCode = request.getOrganizationCode(); |
|
|
String organizationName = request.getOrganizationName(); |
|
|
String organizationName = request.getOrganizationName(); |
|
|
|
|
|
String employeeName = request.getEmployeeName(); |
|
|
|
|
|
|
|
|
|
|
|
// 用户搜索为特殊逻辑 |
|
|
|
|
|
if (StringUtils.isNotBlank(employeeName)) { |
|
|
|
|
|
return treeEmployeeQuery(employeeName, organizationCode); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
List<DingOrganization> dingOrganizationList = new ArrayList<>(); |
|
|
List<DingOrganization> dingOrganizationList = new ArrayList<>(); |
|
|
List<String> organizationCodeList = new ArrayList<>(); |
|
|
List<String> organizationCodeList = new ArrayList<>(); |
|
@@ -164,6 +170,61 @@ public class OrganizationManage { |
|
|
return orgKeyTreeVOList; |
|
|
return orgKeyTreeVOList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<KeyTreeVO> treeEmployeeQuery(String employeeName, String organizationCode) { |
|
|
|
|
|
List<String> organizationCodeList = CollUtil.toList(organizationCode).stream() |
|
|
|
|
|
.filter(StringUtils::isNotBlank) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
List<DingEmployeeInfo> dingEmployeeInfoList = iDingEmployeeInfoService |
|
|
|
|
|
.list(Wrappers.lambdaQuery(DingEmployeeInfo.class) |
|
|
|
|
|
.like(DingEmployeeInfo::getEmployeeName, employeeName) |
|
|
|
|
|
.eq(DingEmployeeInfo::getMainJob, "true") |
|
|
|
|
|
.in(CollUtil.isNotEmpty(organizationCodeList), DingEmployeeInfo::getOrganizationCode, organizationCodeList) |
|
|
|
|
|
); |
|
|
|
|
|
List<String> resultOrganizationCodeList = dingEmployeeInfoList.stream() |
|
|
|
|
|
.filter(r -> StringUtils.isNotBlank(r.getOrganizationCode())) |
|
|
|
|
|
.map(DingEmployeeInfo::getOrganizationCode) |
|
|
|
|
|
.distinct().collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(resultOrganizationCodeList)) { |
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<DingOrganization> dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) |
|
|
|
|
|
.in(DingOrganization::getOrganizationCode, resultOrganizationCodeList)); |
|
|
|
|
|
|
|
|
|
|
|
List<KeyTreeVO> orgKeyTreeVOList = dingOrganizationList.stream().map(r -> { |
|
|
|
|
|
KeyTreeVO keyTreeVO = new KeyTreeVO(); |
|
|
|
|
|
keyTreeVO.setTitle(r.getOrganizationName()); |
|
|
|
|
|
keyTreeVO.setKey(r.getOrganizationCode()); |
|
|
|
|
|
keyTreeVO.setType("ORGANIZATION"); |
|
|
|
|
|
return keyTreeVO; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
employeeNameSearcheTreeVOList(orgKeyTreeVOList, dingEmployeeInfoList); |
|
|
|
|
|
return orgKeyTreeVOList; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void employeeNameSearcheTreeVOList(List<KeyTreeVO> basicOrgKeyTreeVOList, List<DingEmployeeInfo> allDingEmployeeInfoList) { |
|
|
|
|
|
Map<String, List<DingEmployeeInfo>> orgCodeEmployeeMap = allDingEmployeeInfoList.stream() |
|
|
|
|
|
.filter(r -> StringUtils.isNotBlank(r.getOrganizationCode())) |
|
|
|
|
|
.collect(Collectors.groupingBy(DingEmployeeInfo::getOrganizationCode)); |
|
|
|
|
|
|
|
|
|
|
|
for (KeyTreeVO basicOrgKeyTreeVO : basicOrgKeyTreeVOList) { |
|
|
|
|
|
String parentCode = basicOrgKeyTreeVO.getKey(); |
|
|
|
|
|
|
|
|
|
|
|
List<DingEmployeeInfo> dingEmployeeInfoList = orgCodeEmployeeMap.get(parentCode); |
|
|
|
|
|
List<KeyTreeVO> 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()); |
|
|
|
|
|
basicOrgKeyTreeVO.setChildren(memberChildren); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void treeVOList(Boolean needMember, List<KeyTreeVO> basicOrgKeyTreeVOList) { |
|
|
public void treeVOList(Boolean needMember, List<KeyTreeVO> basicOrgKeyTreeVOList) { |
|
|
for (KeyTreeVO basicOrgKeyTreeVO : basicOrgKeyTreeVOList) { |
|
|
for (KeyTreeVO basicOrgKeyTreeVO : basicOrgKeyTreeVOList) { |
|
|
String parentCode = basicOrgKeyTreeVO.getKey(); |
|
|
String parentCode = basicOrgKeyTreeVO.getKey(); |
|
|