|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
package com.engine.organization.entity.comp.bo;
|
|
|
|
|
package com.engine.organization.entity.company.bo;
|
|
|
|
|
|
|
|
|
|
import com.api.hrm.bean.TreeNode;
|
|
|
|
|
import com.engine.organization.entity.comp.dto.CompListDTO;
|
|
|
|
|
import com.engine.organization.entity.comp.param.CompSearchParam;
|
|
|
|
|
import com.engine.organization.entity.comp.po.CompPO;
|
|
|
|
|
import com.engine.organization.entity.company.dto.CompListDTO;
|
|
|
|
|
import com.engine.organization.entity.company.param.CompSearchParam;
|
|
|
|
|
import com.engine.organization.entity.company.po.CompPO;
|
|
|
|
|
import com.engine.organization.entity.searchtree.SearchTree;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
import weaver.crm.Maint.SectorInfoComInfo;
|
|
|
|
@ -21,9 +21,9 @@ import java.util.stream.Collectors;
|
|
|
|
|
*/
|
|
|
|
|
public class CompBO {
|
|
|
|
|
|
|
|
|
|
public static List<CompListDTO> buildCompDTOList(Collection<CompPO> list) {
|
|
|
|
|
public static List<CompListDTO> buildCompDTOList(Collection<com.engine.organization.entity.company.po.CompPO> list) {
|
|
|
|
|
|
|
|
|
|
Map<Long, CompPO> poMaps = list.stream().collect(Collectors.toMap(item -> item.getId(), item -> item));
|
|
|
|
|
Map<Long, com.engine.organization.entity.company.po.CompPO> poMaps = list.stream().collect(Collectors.toMap(item -> item.getId(), item -> item));
|
|
|
|
|
|
|
|
|
|
List<CompListDTO> dtoList = list.stream().map(e -> CompListDTO.builder().id(e.getId()).compNo(e.getCompNo()).compName(e.getCompName()).compNameShort(e.getCompNameShort()).parentCompany(e.getParentCompany()).parentCompName(null == poMaps.get(e.getParentCompany()) ? "" : poMaps.get(e.getParentCompany()).getCompName()).orgCode(e.getOrgCode()).industry(new SectorInfoComInfo().getSectorInfoname(e.getIndustry() + "")).compPrincipal(getUserNameById(e.getCompPrincipal() + "")).forbiddenTag(e.getForbiddenTag()).build()).collect(Collectors.toList());
|
|
|
|
|
Map<Long, List<CompListDTO>> collects = dtoList.stream().filter(item -> null != item.getParentCompany() && 0 != item.getParentCompany()).collect(Collectors.groupingBy(CompListDTO::getParentCompany));
|
|
|
|
@ -33,15 +33,15 @@ public class CompBO {
|
|
|
|
|
}).filter(item -> null == item.getParentCompany() || 0 == item.getParentCompany()).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static List<CompListDTO> buildCompDTOList(Collection<CompPO> list, List<CompPO> filterList) {
|
|
|
|
|
public static List<CompListDTO> buildCompDTOList(Collection<com.engine.organization.entity.company.po.CompPO> list, List<com.engine.organization.entity.company.po.CompPO> filterList) {
|
|
|
|
|
// 搜索结果为空,直接返回空
|
|
|
|
|
if (CollectionUtils.isEmpty(filterList)) {
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
}
|
|
|
|
|
// 递归添加父级数据
|
|
|
|
|
Map<Long, CompPO> poMaps = list.stream().collect(Collectors.toMap(item -> item.getId(), item -> item));
|
|
|
|
|
List<CompPO> addedList = new ArrayList<>();
|
|
|
|
|
for (CompPO po : filterList) {
|
|
|
|
|
Map<Long, com.engine.organization.entity.company.po.CompPO> poMaps = list.stream().collect(Collectors.toMap(item -> item.getId(), item -> item));
|
|
|
|
|
List<com.engine.organization.entity.company.po.CompPO> addedList = new ArrayList<>();
|
|
|
|
|
for (com.engine.organization.entity.company.po.CompPO po : filterList) {
|
|
|
|
|
dealParentData(addedList, po, poMaps);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -53,15 +53,15 @@ public class CompBO {
|
|
|
|
|
}).filter(item -> null == item.getParentCompany() || 0 == item.getParentCompany()).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static CompPO convertParamToPO(CompSearchParam param, Long employeeId) {
|
|
|
|
|
public static com.engine.organization.entity.company.po.CompPO convertParamToPO(CompSearchParam param, Long employeeId) {
|
|
|
|
|
if (null == param) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return CompPO.builder().id(param.getId() == null ? 0 : param.getId()).compNo(param.getCompNo()).compName(param.getCompName()).compNameShort(param.getCompNameShort()).parentCompany(param.getParentCompany()).orgCode(param.getOrgCode()).industry(param.getIndustry()).compPrincipal(param.getCompPrincipal()).description(param.getDescription()).forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1).deleteType(0).createTime(new Date()).updateTime(new Date()).creator(employeeId).build();
|
|
|
|
|
return com.engine.organization.entity.company.po.CompPO.builder().id(param.getId() == null ? 0 : param.getId()).compNo(param.getCompNo()).compName(param.getCompName()).compNameShort(param.getCompNameShort()).parentCompany(param.getParentCompany()).orgCode(param.getOrgCode()).industry(param.getIndustry()).compPrincipal(param.getCompPrincipal()).description(param.getDescription()).forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1).deleteType(0).createTime(new Date()).updateTime(new Date()).creator(employeeId).build();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static List<TreeNode> buildSetToSearchTree(Set<CompPO> comps) {
|
|
|
|
|
public static List<TreeNode> buildSetToSearchTree(Set<com.engine.organization.entity.company.po.CompPO> comps) {
|
|
|
|
|
return comps.stream().map(item -> {
|
|
|
|
|
SearchTree tree = new SearchTree();
|
|
|
|
|
tree.setCanClick(true);
|
|
|
|
@ -85,7 +85,7 @@ public class CompBO {
|
|
|
|
|
* @param po
|
|
|
|
|
* @param poMaps
|
|
|
|
|
*/
|
|
|
|
|
private static void dealParentData(List<CompPO> addedList, CompPO po, Map<Long, CompPO> poMaps) {
|
|
|
|
|
private static void dealParentData(List<com.engine.organization.entity.company.po.CompPO> addedList, com.engine.organization.entity.company.po.CompPO po, Map<Long, com.engine.organization.entity.company.po.CompPO> poMaps) {
|
|
|
|
|
if (!addedList.contains(po)) {
|
|
|
|
|
addedList.add(po);
|
|
|
|
|
}
|