|
@@ -7,7 +7,6 @@ import cn.newfeifan.mall.module.distri.service.duser.DuserService;
|
|
|
import cn.newfeifan.mall.module.distri.service.ordercalc.OrderCalcService;
|
|
|
import cn.newfeifan.mall.module.member.dal.dataobject.user.MemberUserDO;
|
|
|
import cn.newfeifan.mall.module.member.service.user.MemberUserService;
|
|
|
-import com.aliyuncs.utils.StringUtils;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -171,18 +170,13 @@ public class SharePathServiceImpl implements SharePathService {
|
|
|
List<TreeNode> deep = sharePathDO2TreeNode(sharePathDOS);
|
|
|
if (maxDepth > 1) {
|
|
|
List<Long> descs = sharePathDOS.stream().filter(k -> k.getDepth() > 1).map(SharePathDO::getDescendant).collect(Collectors.toList());
|
|
|
-
|
|
|
- if (!descs.isEmpty()) {
|
|
|
+ if (descs.size()>0){
|
|
|
// 获取大于1层级的数据
|
|
|
- List<SharePathDO> descList = sharePathMapper.selectList(new LambdaQueryWrapperX<SharePathDO>()
|
|
|
- .in(SharePathDO::getDescendant, descs)
|
|
|
- .ne(SharePathDO::getAncestor, 1)
|
|
|
- );
|
|
|
+ List<SharePathDO> descList = sharePathMapper.selectList(new LambdaQueryWrapperX<SharePathDO>().ne(SharePathDO::getAncestor, 1).in(SharePathDO::getDescendant, descs));
|
|
|
List<TreeNode> treeNodes1 = sharePathDO2TreeNode(descList);
|
|
|
deep = deep.stream().filter(k -> k.getDeep() == 1).collect(Collectors.toList());
|
|
|
deep.addAll(treeNodes1);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
// 整合结构
|
|
|
List<TreeNode> treeNodes = listWithTree(deep, userId);
|
|
@@ -197,31 +191,8 @@ public class SharePathServiceImpl implements SharePathService {
|
|
|
|
|
|
@Override
|
|
|
public TreeNode getTreeByNameOrMobile(SharePathTreeReqVO sharePathTreeReqVO) {
|
|
|
- //拿到当前用户ID
|
|
|
- Long userId = getUserIdByNameOrMobile(sharePathTreeReqVO.getNickName(), sharePathTreeReqVO.getMobile());
|
|
|
-
|
|
|
- //拿到推荐人ID
|
|
|
- Long ancestor = sharePathMapper.selectAncestorByDescendant(userId);
|
|
|
- return getTree(ancestor, sharePathTreeReqVO.getMaxDepth());
|
|
|
- }
|
|
|
-
|
|
|
- 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) {
|
|
|
- throw exception(DUSER_NAME_IS_NOT_ONLY_ONE);
|
|
|
- }
|
|
|
-
|
|
|
- return duserDOS.get(0).getUserId();
|
|
|
- } else {
|
|
|
- DuserDO duserDO = duserService.getDuserByMobile(mobile);
|
|
|
- if (duserDO == null) {
|
|
|
- throw exception(DUSER_MOBILE_NOT_EXISTS);
|
|
|
- }
|
|
|
- return duserDO.getUserId();
|
|
|
- }
|
|
|
+// duserService.getDuserByName(sharePathTreeReqVO.getName());
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -356,9 +327,16 @@ public class SharePathServiceImpl implements SharePathService {
|
|
|
return Stream.concat(orderUserId.stream(), userId.stream()).distinct().collect(Collectors.toList());
|
|
|
|
|
|
}
|
|
|
-
|
|
|
@Override
|
|
|
public PageResult<SharePathRespVO> getDescendants(SharePathPageReqVO pageReqVO) {
|
|
|
+ LambdaQueryWrapperX<SharePathDO> wrapper = new LambdaQueryWrapperX<SharePathDO>()
|
|
|
+ .eq(SharePathDO::getAncestor, pageReqVO.getAncestor());
|
|
|
+ if(pageReqVO.getDepth() != null){
|
|
|
+ wrapper.eq(SharePathDO::getDepth, 1);
|
|
|
+ }else {
|
|
|
+ wrapper.ne(SharePathDO::getDepth, 1);
|
|
|
+ }
|
|
|
+
|
|
|
PageResult<SharePathDO> sharePathDOPageResult = sharePathMapper.selectDescendantsPage(pageReqVO);
|
|
|
PageResult<SharePathRespVO> result = BeanUtils.toBean(sharePathDOPageResult, SharePathRespVO.class);
|
|
|
List<SharePathRespVO> list = result.getList();
|
|
@@ -369,4 +347,6 @@ public class SharePathServiceImpl implements SharePathService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|