Browse Source

前端定制化逻辑接口

master
niohe·erbao 1 year ago
parent
commit
79e991f240
1 changed files with 40 additions and 23 deletions
  1. +40
    -23
      pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java

+ 40
- 23
pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java View File

@@ -166,32 +166,49 @@ public class OrganizationManage {
return keyTreeVO;
}).collect(Collectors.toList());

if (needMember && orgKeyTreeVOList.size() > 0) {
List<String> organizationCodeList = orgKeyTreeVOList.stream()
.map(KeyTreeVO::getKey).collect(Collectors.toList());
List<DingEmployeeInfo> dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getMainJob, "true")
.in(DingEmployeeInfo::getOrganizationCode, organizationCodeList));

Map<String, List<DingEmployeeInfo>> organizationCodeGroupMap = dingEmployeeInfoList.stream()
.collect(Collectors.groupingBy(DingEmployeeInfo::getOrganizationCode));
List<DingEmployeeInfo> dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getMainJob, "true")
.eq(DingEmployeeInfo::getOrganizationCode, 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());

for (KeyTreeVO keyTreeVO : orgKeyTreeVOList) {
String organizationCode = keyTreeVO.getKey();
List<DingEmployeeInfo> dingEmployeeInfoGroupList = organizationCodeGroupMap.get(organizationCode);
if (CollUtil.isNotEmpty(dingEmployeeInfoGroupList)) {
List<KeyTreeVO> 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<String> organizationCodeList = orgKeyTreeVOList.stream()
// .map(KeyTreeVO::getKey).collect(Collectors.toList());
// List<DingEmployeeInfo> dingEmployeeInfoList = iDingEmployeeInfoService.list(Wrappers.lambdaQuery(DingEmployeeInfo.class)
// .eq(DingEmployeeInfo::getMainJob, "true")
// .in(DingEmployeeInfo::getOrganizationCode, organizationCodeList));
//
// Map<String, List<DingEmployeeInfo>> organizationCodeGroupMap = dingEmployeeInfoList.stream()
// .collect(Collectors.groupingBy(DingEmployeeInfo::getOrganizationCode));
//
// for (KeyTreeVO keyTreeVO : orgKeyTreeVOList) {
// String organizationCode = keyTreeVO.getKey();
// List<DingEmployeeInfo> dingEmployeeInfoGroupList = organizationCodeGroupMap.get(organizationCode);
// if (CollUtil.isNotEmpty(dingEmployeeInfoGroupList)) {
// List<KeyTreeVO> 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;
}
}

Loading…
Cancel
Save