|  | @@ -3,28 +3,27 @@ package cn.newfeifan.mall.module.distri.service.duser;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.distri.controller.admin.integral.vo.IntegralSaveReqVO;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.distri.controller.admin.sharepath.vo.SharePathSaveReqVO;
 | 
	
		
			
				|  |  | -import cn.newfeifan.mall.module.distri.controller.admin.socialstatus.vo.SocialStatusSaveReqVO;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.distri.dal.dataobject.integral.IntegralDO;
 | 
	
		
			
				|  |  | -import cn.newfeifan.mall.module.distri.dal.dataobject.socialstatus.SocialStatusDO;
 | 
	
		
			
				|  |  | +import cn.newfeifan.mall.module.distri.dal.dataobject.sharepath.SharePathDO;
 | 
	
		
			
				|  |  | +import cn.newfeifan.mall.module.distri.dal.mysql.sharepath.SharePathMapper;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.distri.service.integral.IntegralService;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.distri.service.socialstatus.SocialStatusService;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.member.dal.dataobject.user.MemberUserDO;
 | 
	
		
			
				|  |  | +import cn.newfeifan.mall.module.member.dal.mysql.user.MemberUserMapper;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.member.service.user.MemberUserService;
 | 
	
		
			
				|  |  | -import cn.newfeifan.mall.module.system.service.member.MemberService;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import javax.annotation.Resource;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import org.springframework.validation.annotation.Validated;
 | 
	
		
			
				|  |  | -import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.util.*;
 | 
	
		
			
				|  |  | +import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.distri.controller.admin.duser.vo.*;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.distri.dal.dataobject.duser.DuserDO;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.framework.common.pojo.PageResult;
 | 
	
		
			
				|  |  | -import cn.newfeifan.mall.framework.common.pojo.PageParam;
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import cn.newfeifan.mall.module.distri.dal.mysql.duser.DuserMapper;
 | 
	
	
		
			
				|  | @@ -47,6 +46,12 @@ public class DuserServiceImpl implements DuserService {
 | 
	
		
			
				|  |  |      @Resource
 | 
	
		
			
				|  |  |      private MemberUserService memberUserService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  | +    private SharePathMapper sharePathMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Resource
 | 
	
		
			
				|  |  | +    private MemberUserMapper memberUserMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public Long createDuser(DuserSaveReqVO createReqVO) {
 | 
	
	
		
			
				|  | @@ -153,4 +158,38 @@ public class DuserServiceImpl implements DuserService {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void getSharePathCount(PageResult<DuserRespVO> result) {
 | 
	
		
			
				|  |  | +        List<DuserRespVO> list = result.getList();
 | 
	
		
			
				|  |  | +        for (DuserRespVO duserRespVO : list) {
 | 
	
		
			
				|  |  | +            duserRespVO.setDescendantCount(sharePathMapper.selectCount(new LambdaQueryWrapperX<SharePathDO>()
 | 
	
		
			
				|  |  | +                    .eq(SharePathDO::getAncestor, duserRespVO.getUserId())
 | 
	
		
			
				|  |  | +                    .eq(SharePathDO::getDepth,1)
 | 
	
		
			
				|  |  | +            ));
 | 
	
		
			
				|  |  | +            duserRespVO.setChildrenCount(sharePathMapper.selectCount(new LambdaQueryWrapperX<SharePathDO>()
 | 
	
		
			
				|  |  | +                    .eq(SharePathDO::getAncestor, duserRespVO.getUserId())
 | 
	
		
			
				|  |  | +                    .ne(SharePathDO::getDepth,1)
 | 
	
		
			
				|  |  | +            ));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public List<MemberUserDO> getDescendants(Long userId, Long depth) {
 | 
	
		
			
				|  |  | +        LambdaQueryWrapperX<SharePathDO> wrapper = new LambdaQueryWrapperX<SharePathDO>()
 | 
	
		
			
				|  |  | +                .eq(SharePathDO::getAncestor, userId);
 | 
	
		
			
				|  |  | +        if(depth != null){
 | 
	
		
			
				|  |  | +            wrapper.eq(SharePathDO::getDepth, 1);
 | 
	
		
			
				|  |  | +        }else {
 | 
	
		
			
				|  |  | +            wrapper.ne(SharePathDO::getDepth, 1);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        List<SharePathDO> sharePathDOS = sharePathMapper.selectList(wrapper);
 | 
	
		
			
				|  |  | +        List<Long> userIds = sharePathDOS.stream().map(SharePathDO::getDescendant).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return memberUserMapper.selectList(new LambdaQueryWrapper<MemberUserDO>()
 | 
	
		
			
				|  |  | +                .in(MemberUserDO::getId, userIds)
 | 
	
		
			
				|  |  | +        );
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  }
 |