本地无法启动,更新代码
parent
9169fb53e1
commit
e89057e452
@ -0,0 +1,33 @@
|
||||
package cn.estsh.i3plus.core.api.iservice.busi;
|
||||
|
||||
import cn.estsh.i3plus.pojo.platform.bean.SysPosition;
|
||||
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserPosition;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 通用内存树查询服务
|
||||
* @Reference :
|
||||
* @Author : wei.peng
|
||||
* @Date : 2018-10-24 11:16
|
||||
* @Modify :
|
||||
**/
|
||||
public interface ICoreMemTreeService {
|
||||
|
||||
@ApiOperation(value = "分装岗位树",notes = "分装岗位树")
|
||||
List<SysPosition> packTreeSysPosition(List<SysPosition> list,Long parentId);
|
||||
|
||||
@ApiOperation(value = "分装岗位树",notes = "根据用户岗位关系分装岗位树")
|
||||
List<SysPosition> packTreeSysPositionBySysRefUserPosition(List<SysPosition> list, List<SysRefUserPosition> refList);
|
||||
|
||||
@ApiOperation(value = "分装岗位树",notes = "根据制定IDS分装岗位树")
|
||||
List<SysPosition> packTreeSysPositionByIds(List<SysPosition> list, List<Long> ids);
|
||||
|
||||
@ApiOperation(value = "分装岗位树",notes = "根据制定ID分装岗位树")
|
||||
SysPosition packTreeSysPositionById(List<SysPosition> list, Long id);
|
||||
|
||||
@ApiOperation(value = "查询岗位子节点",notes = "查询字节点岗位ID")
|
||||
List<Long> findChildSysPosition(SysPosition position);
|
||||
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.core.api.iservice.busi.ICoreMemTreeService;
|
||||
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.platform.bean.SysPosition;
|
||||
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserPosition;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description :
|
||||
* @Reference :
|
||||
* @Author : wei.peng
|
||||
* @CreateDate : 2019-07-04 下午12:46
|
||||
* @Modify:
|
||||
**/
|
||||
@Service
|
||||
public class CoreMemTreeService implements ICoreMemTreeService {
|
||||
|
||||
@Override
|
||||
public List<SysPosition> packTreeSysPosition(List<SysPosition> list, Long parentId) {
|
||||
List<SysPosition> result = new ArrayList<>();
|
||||
List<SysPosition> copyList = new ArrayList<>(list);
|
||||
|
||||
if(list != null && list.size() > 0){
|
||||
list.forEach(position -> {
|
||||
if(position.getParentId() != null && position.getParentId().equals(parentId)){
|
||||
result.add(position);
|
||||
copyList.remove(position);
|
||||
position.setChildList(packTreeSysPosition(copyList, position.getId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysPosition> packTreeSysPositionBySysRefUserPosition(List<SysPosition> list, List<SysRefUserPosition> refList) {
|
||||
List<Long> ids = new ArrayList<>(refList.size());
|
||||
|
||||
if(refList != null && refList.size() > 0){
|
||||
refList.forEach(ref ->{
|
||||
ids.add(ref.getPositionId());
|
||||
});
|
||||
}
|
||||
|
||||
return packTreeSysPositionByIds(list, ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysPosition> packTreeSysPositionByIds(List<SysPosition> list, List<Long> ids) {
|
||||
List<SysPosition> result = new ArrayList<>();
|
||||
|
||||
if(list != null && list.size() > 0){
|
||||
list.forEach(position -> {
|
||||
if(position.getChildList() == null || position.getChildList().size() <= 0){
|
||||
if(ids.contains(position.getId())){
|
||||
result.add(position);
|
||||
}
|
||||
}else{
|
||||
List<SysPosition> childList = packTreeSysPositionByIds(position.getChildList(), ids);
|
||||
if(ids.contains(position.getId()) || childList != null && childList.size() > 0){
|
||||
result.add(position);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysPosition packTreeSysPositionById(List<SysPosition> list, Long id) {
|
||||
if(list != null && list.size() > 0){
|
||||
for (SysPosition position : list) {
|
||||
if(position.getId().equals(id)){
|
||||
position.setChildList(packTreeSysPosition(list, position.getId()));
|
||||
return position;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> findChildSysPosition(SysPosition position) {
|
||||
List<Long> result = new ArrayList<>();
|
||||
|
||||
if(position != null && position.getChildList() != null && position.getChildList().size() > 0){
|
||||
for (SysPosition sp : position.getChildList()) {
|
||||
result.add(sp.getId());
|
||||
result.addAll(findChildSysPosition(sp));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue