|  | @@ -10,11 +10,13 @@ import com.ym.mec.biz.dal.dao.TenantProxyDividendDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.TenantPreJoin;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.TenantProxyDividend;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.TenantProxyUserRelation;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.vo.ProxyDividendInfoVo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.vo.ProxyDividendVo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.TenantPreJoinService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.TenantProxyDividendService;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.TenantProxyUserRelationService;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.exception.BizException;
 | 
	
		
			
				|  |  | +import com.ym.mec.common.page.PageInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.page.PageUtil;
 | 
	
		
			
				|  |  |  import org.apache.commons.collections.CollectionUtils;
 | 
	
		
			
				|  |  |  import org.slf4j.Logger;
 | 
	
	
		
			
				|  | @@ -22,7 +24,10 @@ import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import java.util.*;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +import java.util.Map;
 | 
	
		
			
				|  |  | +import java.util.Objects;
 | 
	
		
			
				|  |  | +import java.util.Optional;
 | 
	
		
			
				|  |  |  import java.util.function.BiConsumer;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
	
		
			
				|  | @@ -49,6 +54,30 @@ public class TenantProxyDividendServiceImpl extends ServiceImpl<TenantProxyDivid
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | +     * 代理商分润汇总查询
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public ProxyDividendVo queryProxyDividend() {
 | 
	
		
			
				|  |  | +        ProxyDividendVo result = new ProxyDividendVo();
 | 
	
		
			
				|  |  | +        result.setPreTenant(0);
 | 
	
		
			
				|  |  | +        result.setTenantAgency(0);
 | 
	
		
			
				|  |  | +        //查询入驻信息
 | 
	
		
			
				|  |  | +        List<TenantPreJoin> preJoinsList = tenantPreJoinService.list();
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isNotEmpty(preJoinsList)) {
 | 
	
		
			
				|  |  | +            result.setTenantAgency(preJoinsList.size());
 | 
	
		
			
				|  |  | +            long count = preJoinsList.stream()
 | 
	
		
			
				|  |  | +                    .filter(a -> Objects.nonNull(a.getState()) && a.getState() == 1)
 | 
	
		
			
				|  |  | +                    .count();
 | 
	
		
			
				|  |  | +            result.setPreTenant((int) count);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        //团练宝销售数
 | 
	
		
			
				|  |  | +        int count = baseMapper.queryProxyDividendCount();
 | 
	
		
			
				|  |  | +        result.setMemberCount(count);
 | 
	
		
			
				|  |  | +        return result;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  |       * 代理商分润查询
 | 
	
		
			
				|  |  |       *
 | 
	
		
			
				|  |  |       * @param param 传入参数
 | 
	
	
		
			
				|  | @@ -61,7 +90,7 @@ public class TenantProxyDividendServiceImpl extends ServiceImpl<TenantProxyDivid
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public ProxyDividendVo queryProxyDividend(Map<String, Object> param) {
 | 
	
		
			
				|  |  | +    public PageInfo<ProxyDividendInfoVo> queryProxyDividendInfo(Map<String, Object> param) {
 | 
	
		
			
				|  |  |          Optional.ofNullable(param.get("startData")).orElseThrow(() -> new BizException("查询的开始日期不能为空!"));
 | 
	
		
			
				|  |  |          Optional.ofNullable(param.get("endData")).orElseThrow(() -> new BizException("查询的结束日期不能为空!"));
 | 
	
		
			
				|  |  |          //拼接时分秒
 | 
	
	
		
			
				|  | @@ -70,21 +99,6 @@ public class TenantProxyDividendServiceImpl extends ServiceImpl<TenantProxyDivid
 | 
	
		
			
				|  |  |          addTimeCons.accept("startData", "00:00:00");
 | 
	
		
			
				|  |  |          addTimeCons.accept("endData", "23:59:59");
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        ProxyDividendVo result = new ProxyDividendVo();
 | 
	
		
			
				|  |  | -        result.setPreTenant(0);
 | 
	
		
			
				|  |  | -        result.setTenantAgency(0);
 | 
	
		
			
				|  |  | -        //查询入驻信息
 | 
	
		
			
				|  |  | -        List<TenantPreJoin> preJoinsList = tenantPreJoinService.list(Wrappers.<TenantPreJoin>lambdaQuery()
 | 
	
		
			
				|  |  | -                .ge(TenantPreJoin::getCreatedTime, param.get("startData"))
 | 
	
		
			
				|  |  | -                .le(TenantPreJoin::getCreatedTime, param.get("endData")));
 | 
	
		
			
				|  |  | -        if (CollectionUtils.isNotEmpty(preJoinsList)) {
 | 
	
		
			
				|  |  | -            result.setTenantAgency(preJoinsList.size());
 | 
	
		
			
				|  |  | -            long count = preJoinsList.stream()
 | 
	
		
			
				|  |  | -                    .filter(a -> Objects.nonNull(a.getState()) && a.getState() == 1)
 | 
	
		
			
				|  |  | -                    .count();
 | 
	
		
			
				|  |  | -            result.setPreTenant((int) count);
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          SysUser user = getUser();
 | 
	
		
			
				|  |  |          //当前登录人是代理商账号类型,需要做数据隔离
 | 
	
		
			
				|  |  |          if (user.getUserType().equalsIgnoreCase("PROXY")) {
 | 
	
	
		
			
				|  | @@ -95,17 +109,11 @@ public class TenantProxyDividendServiceImpl extends ServiceImpl<TenantProxyDivid
 | 
	
		
			
				|  |  |                  param.put("proxyId", proxyUserRelation.getProxyId());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        //团练宝销售数
 | 
	
		
			
				|  |  | -        int count = baseMapper.queryProxyDividendCount(param);
 | 
	
		
			
				|  |  | -        result.setMemberCount(count);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          //分页查询分润记录
 | 
	
		
			
				|  |  | -        Page<ProxyDividendVo.ProxyDividendInfoVo> pageInfo = PageUtil.getPageInfo(param);
 | 
	
		
			
				|  |  | +        Page<ProxyDividendInfoVo> pageInfo = PageUtil.getPageInfo(param);
 | 
	
		
			
				|  |  |          pageInfo.setAsc("a.active_time_");
 | 
	
		
			
				|  |  | -        IPage<ProxyDividendVo.ProxyDividendInfoVo> tiPage = baseMapper.queryProxyDividendInfo(pageInfo, param);
 | 
	
		
			
				|  |  | -        result.setPageData(PageUtil.pageInfo(tiPage));
 | 
	
		
			
				|  |  | -        return result;
 | 
	
		
			
				|  |  | +        IPage<ProxyDividendInfoVo> tiPage = baseMapper.queryProxyDividendInfo(pageInfo, param);
 | 
	
		
			
				|  |  | +        return PageUtil.pageInfo(tiPage);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private SysUser getUser() {
 |