|
|
@@ -13,8 +13,6 @@ import com.ningdatech.pmapi.organization.model.entity.DingOrganization; |
|
|
|
import com.ningdatech.pmapi.organization.model.po.ReqOrganizationListPO; |
|
|
|
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.OrganizationMemberInfo; |
|
|
|
import com.ningdatech.pmapi.organization.model.vo.OrganizationTreeVO; |
|
|
|
import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO; |
|
|
|
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; |
|
|
@@ -26,7 +24,6 @@ import org.springframework.stereotype.Component; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@@ -110,88 +107,63 @@ public class OrganizationManage { |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
public List<OrganizationSynthesizeTreeVO> organizationSynthesizeList(ReqSynthesizePO request) { |
|
|
|
String parentCode = request.getParentCode(); |
|
|
|
Boolean needMember = request.getNeedMember(); |
|
|
|
public List<KeyTreeVO> treeRubbishVOList(ReqSynthesizePO request) { |
|
|
|
String organizationCode = request.getOrganizationCode(); |
|
|
|
|
|
|
|
List<OrganizationTreeVO> childOrganizationList = getChildOrganizationList(parentCode); |
|
|
|
|
|
|
|
List<OrganizationSynthesizeTreeVO> organizationSynthesizeTreeVOList = childOrganizationList.stream().map(r -> { |
|
|
|
OrganizationSynthesizeTreeVO organizationSynthesizeTreeVO = new OrganizationSynthesizeTreeVO(); |
|
|
|
organizationSynthesizeTreeVO.setName(r.getName()); |
|
|
|
organizationSynthesizeTreeVO.setOrganizationCode(r.getOrganizationCode()); |
|
|
|
organizationSynthesizeTreeVO.setParentCode(r.getParentCode()); |
|
|
|
return organizationSynthesizeTreeVO; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if (needMember && organizationSynthesizeTreeVOList.size() > 0) { |
|
|
|
List<String> organizationCodeList = organizationSynthesizeTreeVOList.stream() |
|
|
|
.map(OrganizationSynthesizeTreeVO::getOrganizationCode).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 (OrganizationSynthesizeTreeVO organizationSynthesizeTreeVO : organizationSynthesizeTreeVOList) { |
|
|
|
String organizationCode = organizationSynthesizeTreeVO.getOrganizationCode(); |
|
|
|
List<DingEmployeeInfo> dingEmployeeInfoGroupList = organizationCodeGroupMap.get(organizationCode); |
|
|
|
if (CollUtil.isNotEmpty(dingEmployeeInfoGroupList)) { |
|
|
|
List<OrganizationMemberInfo> organizationMemberInfoList = dingEmployeeInfoGroupList.stream().map(r -> { |
|
|
|
OrganizationMemberInfo organizationMemberInfo = new OrganizationMemberInfo(); |
|
|
|
organizationMemberInfo.setEmployeeCode(r.getEmployeeCode()); |
|
|
|
organizationMemberInfo.setName(r.getEmployeeName()); |
|
|
|
return organizationMemberInfo; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
organizationSynthesizeTreeVO.setMemberList(organizationMemberInfoList); |
|
|
|
} |
|
|
|
} |
|
|
|
List<DingOrganization> dingOrganizationList = new ArrayList<>(); |
|
|
|
List<String> organizationCodeList = new ArrayList<>(); |
|
|
|
if (StrUtils.isBlank(organizationCode)) { |
|
|
|
organizationCodeList = dingOrganizationProperties.getDeptVisibleScopes(); |
|
|
|
} else { |
|
|
|
organizationCodeList = CollectionUtil.toList(organizationCode); |
|
|
|
} |
|
|
|
dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) |
|
|
|
.in(DingOrganization::getOrganizationCode, organizationCodeList)); |
|
|
|
|
|
|
|
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 -> { |
|
|
|
List<KeyTreeVO> orgKeyTreeVOList = dingOrganizationList.stream().map(r -> { |
|
|
|
KeyTreeVO keyTreeVO = new KeyTreeVO(); |
|
|
|
keyTreeVO.setTitle(r.getName()); |
|
|
|
keyTreeVO.setTitle(r.getOrganizationName()); |
|
|
|
keyTreeVO.setKey(r.getOrganizationCode()); |
|
|
|
keyTreeVO.setType("ORGANIZATION"); |
|
|
|
return keyTreeVO; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
treeVOList(request.getNeedMember(), orgKeyTreeVOList); |
|
|
|
return orgKeyTreeVOList; |
|
|
|
} |
|
|
|
|
|
|
|
public void treeVOList(Boolean needMember, List<KeyTreeVO> basicOrgKeyTreeVOList) { |
|
|
|
for (KeyTreeVO basicOrgKeyTreeVO : basicOrgKeyTreeVOList) { |
|
|
|
String parentCode = basicOrgKeyTreeVO.getKey(); |
|
|
|
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); |
|
|
|
if (StringUtils.isNotBlank(parentCode) && needMember) { |
|
|
|
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()); |
|
|
|
|
|
|
|
if (CollUtil.isNotEmpty(memberChildren)) { |
|
|
|
orgKeyTreeVOList.addAll(memberChildren); |
|
|
|
} |
|
|
|
} |
|
|
|
basicOrgKeyTreeVO.setChildren(orgKeyTreeVOList); |
|
|
|
} |
|
|
|
|
|
|
|
return orgKeyTreeVOList; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |