|
@@ -172,7 +172,10 @@ public class SharePathServiceImpl implements SharePathService {
|
|
|
if (maxDepth > 1) {
|
|
|
List<Long> descs = sharePathDOS.stream().filter(k -> k.getDepth() > 1).map(SharePathDO::getDescendant).collect(Collectors.toList());
|
|
|
// 获取大于1层级的数据
|
|
|
- List<SharePathDO> descList = sharePathMapper.selectList(new LambdaQueryWrapperX<SharePathDO>().ne(SharePathDO::getAncestor, 1).in(SharePathDO::getDescendant, descs));
|
|
|
+ List<SharePathDO> descList = sharePathMapper.selectList(new LambdaQueryWrapperX<SharePathDO>()
|
|
|
+ .inIfPresent(SharePathDO::getDescendant, descs)
|
|
|
+ .ne(SharePathDO::getAncestor, 1)
|
|
|
+ );
|
|
|
List<TreeNode> treeNodes1 = sharePathDO2TreeNode(descList);
|
|
|
deep = deep.stream().filter(k -> k.getDeep() == 1).collect(Collectors.toList());
|
|
|
deep.addAll(treeNodes1);
|
|
@@ -191,16 +194,16 @@ public class SharePathServiceImpl implements SharePathService {
|
|
|
@Override
|
|
|
public TreeNode getTreeByNameOrMobile(SharePathTreeReqVO sharePathTreeReqVO) {
|
|
|
//拿到当前用户ID
|
|
|
- Long userId = getUserIdByNameOrMobile(sharePathTreeReqVO.getName(), sharePathTreeReqVO.getMobile());
|
|
|
+ Long userId = getUserIdByNameOrMobile(sharePathTreeReqVO.getNickName(), sharePathTreeReqVO.getMobile());
|
|
|
|
|
|
//拿到推荐人ID
|
|
|
Long ancestor = sharePathMapper.selectAncestorByDescendant(userId);
|
|
|
return getTree(ancestor, sharePathTreeReqVO.getMaxDepth());
|
|
|
}
|
|
|
|
|
|
- private Long getUserIdByNameOrMobile(String name, String mobile) {
|
|
|
- if(!StringUtils.isEmpty(name)){
|
|
|
- List<DuserDO> duserDOS = duserService.getDuserByName(name);
|
|
|
+ private Long getUserIdByNameOrMobile(String nickName, String mobile) {
|
|
|
+ if (!StringUtils.isEmpty(nickName)) {
|
|
|
+ List<DuserDO> duserDOS = duserService.getDuserByName(nickName);
|
|
|
if (duserDOS.isEmpty()) {
|
|
|
throw exception(DUSER_NAME_NOT_EXISTS);
|
|
|
} else if (duserDOS.size() > 1) {
|
|
@@ -208,7 +211,7 @@ public class SharePathServiceImpl implements SharePathService {
|
|
|
}
|
|
|
|
|
|
return duserDOS.get(0).getUserId();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
DuserDO duserDO = duserService.getDuserByMobile(mobile);
|
|
|
if (duserDO == null) {
|
|
|
throw exception(DUSER_MOBILE_NOT_EXISTS);
|