|
@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; |
|
|
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; |
|
|
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; |
|
|
import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO; |
|
|
import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO; |
|
|
import com.ningdatech.pmapi.organization.model.po.ReqSynthesizePO; |
|
|
import com.ningdatech.pmapi.organization.model.po.ReqSynthesizePO; |
|
|
|
|
|
import com.ningdatech.pmapi.organization.model.vo.KeyTreeVO; |
|
|
import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO; |
|
|
import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO; |
|
|
import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO.OrganizationMemberInfo; |
|
|
import com.ningdatech.pmapi.organization.model.vo.OrganizationSynthesizeTreeVO.OrganizationMemberInfo; |
|
|
import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO; |
|
|
import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO; |
|
@@ -150,4 +151,47 @@ public class OrganizationManage { |
|
|
|
|
|
|
|
|
return organizationSynthesizeTreeVOList; |
|
|
return organizationSynthesizeTreeVOList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<KeyTreeVO> treeVOList(ReqSynthesizePO request) { |
|
|
|
|
|
String parentCode = request.getParentCode(); |
|
|
|
|
|
Boolean needMember = request.getNeedMember(); |
|
|
|
|
|
|
|
|
|
|
|
List<OrganizationTreeVO> childOrganizationList = getChildOrganizationList(parentCode); |
|
|
|
|
|
|
|
|
|
|
|
List<KeyTreeVO> orgKeyTreeVOList = childOrganizationList.stream().map(r -> { |
|
|
|
|
|
KeyTreeVO keyTreeVO = new KeyTreeVO(); |
|
|
|
|
|
keyTreeVO.setTitle(r.getName()); |
|
|
|
|
|
keyTreeVO.setKey(r.getOrganizationCode()); |
|
|
|
|
|
keyTreeVO.setType("ORGANIZATION"); |
|
|
|
|
|
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)); |
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
} |
|
|
} |
|
|
} |