部门复制
parent
3d9a027c8f
commit
5252770a61
@ -0,0 +1,26 @@
|
||||
package com.engine.organization.entity.department.param;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/06/01
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DeptCopyParam {
|
||||
private String ids;
|
||||
|
||||
private String company;
|
||||
/**
|
||||
* 是否复制岗位
|
||||
*/
|
||||
private String copyJob;
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package com.engine.organization.webservice;
|
||||
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
@WebService
|
||||
public interface CustomBrowserService {
|
||||
|
||||
|
||||
/**
|
||||
* 公司/分部 树形列表
|
||||
* 只获取未删除且启用的数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@WebMethod(
|
||||
operationName = "getCompTreeList",
|
||||
action = "com.engine.organization.webservice.CustomBrowserService.getCompTreeList"
|
||||
)
|
||||
List<CompPO> getCompTreeList();
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package com.engine.organization.webservice;
|
||||
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @description: TODO
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/05/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class CustomBrowserServiceImpl implements CustomBrowserService {
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompPO> getCompTreeList() {
|
||||
// 获取所有启用数据
|
||||
List<CompPO> allList = getCompMapper().list().stream().filter(item -> 0 == item.getForbiddenTag()).collect(Collectors.toList());
|
||||
|
||||
List<CompPO> parentList = allList.stream().filter(item -> (null == item.getParentCompany() || 0 == item.getParentCompany())).collect(Collectors.toList());
|
||||
Map<Long, List<CompPO>> compMap = allList.stream().filter(item -> (null != item.getParentCompany() && 0 != item.getParentCompany())).collect(Collectors.groupingBy(CompPO::getParentCompany));
|
||||
List<CompPO> returnList = new ArrayList<>();
|
||||
dealChildren(parentList, returnList, compMap);
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理分部子节点
|
||||
*
|
||||
* @param parentList
|
||||
* @param returnList
|
||||
* @param compMap
|
||||
*/
|
||||
private void dealChildren(List<CompPO> parentList, List<CompPO> returnList, Map<Long, List<CompPO>> compMap) {
|
||||
if (CollectionUtils.isEmpty(parentList)) {
|
||||
return;
|
||||
}
|
||||
for (CompPO compPO : parentList) {
|
||||
returnList.add(compPO);
|
||||
dealChildren(compMap.get(compPO.getId()), returnList, compMap);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue