|  | @@ -24,11 +24,9 @@ import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import java.util.List;
 | 
	
		
			
				|  |  | -import java.util.Map;
 | 
	
		
			
				|  |  | -import java.util.Objects;
 | 
	
		
			
				|  |  | -import java.util.Optional;
 | 
	
		
			
				|  |  | +import java.util.*;
 | 
	
		
			
				|  |  |  import java.util.function.BiConsumer;
 | 
	
		
			
				|  |  | +import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
		
			
				|  |  |   * 代理商分润表(TenantProxyDividend)表服务实现类
 | 
	
	
		
			
				|  | @@ -61,8 +59,31 @@ public class TenantProxyDividendServiceImpl extends ServiceImpl<TenantProxyDivid
 | 
	
		
			
				|  |  |          ProxyDividendVo result = new ProxyDividendVo();
 | 
	
		
			
				|  |  |          result.setPreTenant(0);
 | 
	
		
			
				|  |  |          result.setTenantAgency(0);
 | 
	
		
			
				|  |  | -        //查询入驻信息
 | 
	
		
			
				|  |  | -        List<TenantPreJoin> preJoinsList = tenantPreJoinService.list();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        List<TenantPreJoin> preJoinsList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        Map<String, Object> param = new HashMap<>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        SysUser user = getUser();
 | 
	
		
			
				|  |  | +        //当前登录人是代理商账号类型,需要做数据隔离
 | 
	
		
			
				|  |  | +        if (user.getUserType().equalsIgnoreCase("PROXY")) {
 | 
	
		
			
				|  |  | +            //查询代理商
 | 
	
		
			
				|  |  | +            TenantProxyUserRelation proxyUserRelation = tenantProxyUserRelationService.getOne(Wrappers.<TenantProxyUserRelation>lambdaQuery()
 | 
	
		
			
				|  |  | +                    .eq(TenantProxyUserRelation::getUserId, user.getId()));
 | 
	
		
			
				|  |  | +            if (Objects.nonNull(proxyUserRelation)) {
 | 
	
		
			
				|  |  | +                param.put("proxyId", proxyUserRelation.getProxyId());
 | 
	
		
			
				|  |  | +                //查询该代理商下所有代理人
 | 
	
		
			
				|  |  | +                List<TenantProxyUserRelation> relationList = tenantProxyUserRelationService.list(Wrappers.<TenantProxyUserRelation>lambdaQuery()
 | 
	
		
			
				|  |  | +                        .eq(TenantProxyUserRelation::getProxyId, proxyUserRelation.getProxyId()));
 | 
	
		
			
				|  |  | +                List<Integer> userList = relationList.stream().map(TenantProxyUserRelation::getUserId).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +                //查询当前代理商入驻信息
 | 
	
		
			
				|  |  | +                preJoinsList = tenantPreJoinService.list(Wrappers.<TenantPreJoin>lambdaQuery()
 | 
	
		
			
				|  |  | +                        .in(TenantPreJoin::getRecommender, userList));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            //查询入驻信息
 | 
	
		
			
				|  |  | +            preJoinsList = tenantPreJoinService.list();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          if (CollectionUtils.isNotEmpty(preJoinsList)) {
 | 
	
		
			
				|  |  |              result.setTenantAgency(preJoinsList.size());
 | 
	
		
			
				|  |  |              long count = preJoinsList.stream()
 | 
	
	
		
			
				|  | @@ -72,7 +93,7 @@ public class TenantProxyDividendServiceImpl extends ServiceImpl<TenantProxyDivid
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //团练宝销售数
 | 
	
		
			
				|  |  | -        int count = baseMapper.queryProxyDividendCount();
 | 
	
		
			
				|  |  | +        int count = baseMapper.queryProxyDividendCount(param);
 | 
	
		
			
				|  |  |          result.setMemberCount(count);
 | 
	
		
			
				|  |  |          return result;
 | 
	
		
			
				|  |  |      }
 |