|
@@ -8,10 +8,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
import com.ningdatech.pmapi.common.config.DingOrganizationProperties; |
|
|
import com.ningdatech.pmapi.common.config.DingOrganizationProperties; |
|
|
import com.ningdatech.pmapi.common.util.StrUtils; |
|
|
import com.ningdatech.pmapi.common.util.StrUtils; |
|
|
|
|
|
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.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.OrganizationTreeVO; |
|
|
import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO; |
|
|
import com.ningdatech.pmapi.organization.model.vo.ResOrganizationListVO; |
|
|
|
|
|
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; |
|
|
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; |
|
|
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
@@ -20,6 +25,7 @@ import org.springframework.stereotype.Component; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.Comparator; |
|
|
import java.util.Comparator; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@@ -34,6 +40,8 @@ public class OrganizationManage { |
|
|
|
|
|
|
|
|
private final DingOrganizationProperties dingOrganizationProperties; |
|
|
private final DingOrganizationProperties dingOrganizationProperties; |
|
|
|
|
|
|
|
|
|
|
|
private final IDingEmployeeInfoService iDingEmployeeInfoService; |
|
|
|
|
|
|
|
|
public PageVo<ResOrganizationListVO> organizationList(ReqOrganizationListPO reqOrganizationListPO) { |
|
|
public PageVo<ResOrganizationListVO> organizationList(ReqOrganizationListPO reqOrganizationListPO) { |
|
|
String orgName = reqOrganizationListPO.getOrgName(); |
|
|
String orgName = reqOrganizationListPO.getOrgName(); |
|
|
|
|
|
|
|
@@ -101,4 +109,45 @@ public class OrganizationManage { |
|
|
}).collect(Collectors.toList()); |
|
|
}).collect(Collectors.toList()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<OrganizationSynthesizeTreeVO> organizationSynthesizeList(ReqSynthesizePO request) { |
|
|
|
|
|
String parentCode = request.getParentCode(); |
|
|
|
|
|
Boolean needMember = request.getNeedMember(); |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return organizationSynthesizeTreeVOList; |
|
|
|
|
|
} |
|
|
} |
|
|
} |