Browse Source

更改团队展示逻辑以及团队分红

dos 1 month ago
parent
commit
dcb8768904

+ 53 - 27
game-business/src/main/java/com/game/business/controller/AppAgentController.java

@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -66,6 +67,7 @@ public class AppAgentController extends BaseController {
     @ApiOperation(value = "用户代理统计", notes = "用户代理统计")
     public HttpRet<AppUserAgentJournalIndexVO> index(@RequestBody AgentIndexDTO agentIndexDto)
     {
+        Date now = DateUtil.date();
         Long userId = SecurityUtils.getUserId();
         if(null != agentIndexDto.getUserId()){
             userId = agentIndexDto.getUserId();
@@ -76,55 +78,72 @@ public class AppAgentController extends BaseController {
             topUserId = appUserAgent.getTopId();
         }
         AppUserAgentJournalIndexVO vo = new AppUserAgentJournalIndexVO();
-        Date nowDate = DateUtil.date();
+        Date curDate = DateUtil.date();
         if(agentIndexDto.getType() == 1){
-            nowDate = DateUtil.offsetMonth(nowDate,-1); //上个月
+            curDate = DateUtil.offsetMonth(curDate,-1); //上个月
         }
         String formatP = "yyyy-MM-dd";
-        Date beginDate = DateUtil.beginOfMonth(nowDate);
-        Date endDate = DateUtil.endOfMonth(nowDate);
-
-        List<AppUserCount> appUserCountList = appUserCountService.getAppUserCountNew(userId,DateUtil.format(beginDate,formatP),DateUtil.format(endDate,formatP));
-
+        Date beginDate = DateUtil.beginOfMonth(curDate);
+        Date endDate = DateUtil.endOfMonth(curDate);
+        Date weekBegin = DateUtil.beginOfWeek(now);
+        Date weekend = DateUtil.endOfWeek(now);
+        List<AppUserCount> appUserCountList = appUserCountService.getAppUserCountNew(userId,DateUtil.format(weekBegin,formatP),DateUtil.format(weekend,formatP));
+        AppUserAgent queryAppUserAgent = new AppUserAgent();
+        queryAppUserAgent.setPid(userId);
+        //查询用户下级代理
+        List<AppUserAgent> appUserAgentList = appUserAgentService.selectAllAgentList(userId,null,null,null);
         if(null == appUserCountList){
             appUserCountList = new ArrayList<>();
         }
         //佣金
         double money = 0;
-        if(null != redisCache.getCacheMapValue(CacheConstants.USER_AGENT_TEAM_PHASE,String.valueOf(topUserId))){
-            money = redisCache.getCacheMapValue(CacheConstants.USER_AGENT_TEAM_PHASE,String.valueOf(topUserId));
+        if(null != appUserCountList && appUserCountList.size() > 0 && appUserAgentList != null && appUserAgentList.size()>0){
+            List<AppUserCount> finalAppUserCountList = appUserCountList;
+            money = appUserAgentList.stream().mapToDouble(appUserAgent1 -> {
+                return finalAppUserCountList.stream().mapToDouble(e->{
+                    return (e.getGameLoseAmount() - e.getGameWinAmount() - e.getGameCommission() - e.getRechargeGive()) * appUserAgent1.getDividendGuaranteeRate()/100;
+                }).sum();
+            }).sum();
         }
-        if(null != appUserAgent.getDividendGuaranteeRate()){
+        /*if(null != appUserAgent.getDividendGuaranteeRate()){
             money = money * appUserAgent.getDividendGuaranteeRate() / 100 ;
-        }
+        }else{
+            money = 0;
+        }*/
         //预计分红
         vo.setMyCommission(BigDecimal.valueOf(money>0?money:0).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
-        vo.setLiveCommission(appUserCountList.stream().mapToDouble(e->e.getLiveCommission()).sum());
-        vo.setGameCommission(appUserCountList.stream().mapToDouble(e->e.getGameCommission()).sum());
+        vo.setLiveCommission(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(e->e.getLiveCommission()).sum()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
+        vo.setGameCommission(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(e->e.getGameCommission()).sum()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
         //团队人数
-        vo.setTeamUser(appUserCountList.stream().map(AppUserCount::getUserId).distinct().collect(Collectors.toList()).size());
+        vo.setTeamUser(appUserAgentList.stream().filter(e->
+                compareTime(e.getCreateTime(),beginDate,endDate)
+        ).collect(Collectors.toList()).size());
         //团队充值
-        vo.setTeamRecharge(appUserCountList.stream().mapToDouble(e->e.getRechargeAmount()).sum());
+        vo.setTeamRecharge(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(e->{
+            return (e.getRechargeAmount() - e.getRechargeGive()) + e.getRechargeCommission();
+        }).sum()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
         //团队充值赠送金额
-        vo.setRechargeGive(appUserCountList.stream().mapToDouble(e->e.getRechargeGive()).sum());
+        vo.setRechargeGive(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(e->e.getRechargeGive()).sum()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
         //团队充值手续费
-        vo.setRechargeCommission(appUserCountList.stream().mapToDouble(e->e.getRechargeCommission()).sum());
+        vo.setRechargeCommission(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(e->e.getRechargeCommission()).sum()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
         //团队投注
-        vo.setTeamBetting(appUserCountList.stream().mapToDouble(e->e.getGameBetting()).sum());
+        vo.setTeamBetting(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(e->e.getGameBetting()).sum()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
         //团队直播消费
-        vo.setTeamLive(appUserCountList.stream().mapToDouble(e->e.getLiveUseAmount()).sum());
+        vo.setTeamLive(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(e->e.getLiveUseAmount()).sum()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
         //团队投注赢
-        vo.setTeamWin(appUserCountList.stream().mapToDouble(e->e.getGameWinAmount()).sum());
+        vo.setTeamWin(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(e->e.getGameWinAmount()).sum()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
         //团队投注输
-        vo.setTeamLose(appUserCountList.stream().mapToDouble(e->e.getGameLoseAmount()).sum());
+        vo.setTeamLose(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(e->e.getGameLoseAmount()).sum()).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
         //活跃人数
         vo.setActiveUser(appUserCountList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(()-> new TreeSet<>(Comparator.comparing(f->f.getUserId()))), ArrayList::new)).size());
         //昨日新增
         Date yesterDay = DateUtil.offsetDay(DateUtil.date(),-1);
-        vo.setYesterdayUser(appUserAgentService.countAgent(topUserId,DateUtil.format(yesterDay,"yyyy-MM-dd").concat(" 00:00:00")
-                ,DateUtil.format(yesterDay,"yyyy-MM-dd").concat(" 23:59:59")));
-        vo.setMonthUser(appUserAgentService.countAgent(topUserId,DateUtil.format(beginDate,"yyyy-MM-dd").concat(" 00:00:00")
-                ,DateUtil.format(endDate,"yyyy-MM-dd").concat(" 23:59:59")));
+        vo.setYesterdayUser(appUserAgentList.stream().filter(e->
+                compareTime(e.getCreateTime(),yesterDay,yesterDay)
+        ).collect(Collectors.toList()).size());
+        vo.setMonthUser(appUserAgentList.stream().filter(e->
+                compareTime(e.getCreateTime(),beginDate,endDate)
+        ).collect(Collectors.toList()).size());
 
         return HttpRet.success(MessageUtils.message("11022"),vo);
     }
@@ -146,7 +165,8 @@ public class AppAgentController extends BaseController {
     @ApiOperation(value = "团队列表", notes = "团队列表")
     public HttpRetPageArr<AppAgentTeamVo> teamList(@RequestBody AppAgentTeamDto teamDto)
     {
-        startPage();
+
+        startPageBySize(10);//每页最多10条
         List<AppAgentTeamVo> list = appUserAgentService.teamList(teamDto);
         return HttpRetPageArr.success(MessageUtils.message("11022"),getDataTable(list));
     }
@@ -168,7 +188,7 @@ public class AppAgentController extends BaseController {
            return HttpRet.fail("转账失败,受益人不是代理");
        }
        if(appUserAgent.getPid().longValue() == 0 || isTwoLevel(appUserAgent.getPid())){
-           List<AppUserAgent> appUserAgentList = appUserAgentService.selectAllAgentList(userId,transerDto.getToUserId());
+           List<AppUserAgent> appUserAgentList = appUserAgentService.selectAllAgentList(userId,transerDto.getToUserId(),null,null);
            if(null == appUserAgentList || appUserAgentList.size() < 1){
                return HttpRet.fail("转账失败,只能给团队成员转账");
            }
@@ -266,4 +286,10 @@ public class AppAgentController extends BaseController {
         return false;
     }
 
+    private boolean compareTime(Date curTime,Date beginTime,Date endTime){
+        beginTime = DateUtil.parse(DateUtil.format(beginTime,"yyyy-MM-dd").concat(" 00:00:00"));
+        endTime = DateUtil.parse(DateUtil.format(endTime,"yyyy-MM-dd").concat(" 23:59:59"));
+        return curTime.getTime() >= beginTime.getTime() && curTime.getTime() <= endTime.getTime();
+    }
+
 }

+ 1 - 1
game-business/src/main/java/com/game/business/mapper/AppUserAgentMapper.java

@@ -84,5 +84,5 @@ public interface AppUserAgentMapper extends BaseMapper<AppUserAgent> {
      * 查询所有下级团队列表(递归)
      *
      */
-    public List<AppUserAgent> selectAllAgentList(@Param("pid") Long pid, @Param("userId") Long userId);
+    public List<AppUserAgent> selectAllAgentList(@Param("pid") Long pid, @Param("userId") Long userId,@Param("beginTime") String beginTime, @Param("endTime") String endTime);
 }

+ 1 - 1
game-business/src/main/java/com/game/business/service/IAppUserAgentService.java

@@ -94,7 +94,7 @@ public interface IAppUserAgentService extends IService<AppUserAgent> {
     /**
      * 递归查询所有下级代理
      * */
-    public List<AppUserAgent> selectAllAgentList(Long pid,Long userId);
+    public List<AppUserAgent> selectAllAgentList(Long pid,Long userId,String beginTime,String endTime);
 
     public AppUserAgent selectInfo(Long userId);
 }

+ 58 - 7
game-business/src/main/java/com/game/business/service/impl/AppUserAgentServiceImpl.java

@@ -1,9 +1,14 @@
 package com.game.business.service.impl;
 
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.rmi.ServerException;
+import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -14,9 +19,7 @@ import com.game.business.domain.*;
 import com.game.business.dto.AppAgentEditDto;
 import com.game.business.dto.AppAgentTeamDto;
 import com.game.business.dto.AppUserTeamTranserDto;
-import com.game.business.service.IAppGameCommissionService;
-import com.game.business.service.IAppGameService;
-import com.game.business.service.IAppUserService;
+import com.game.business.service.*;
 import com.game.business.vo.AppAgentTeamVo;
 import com.game.common.constant.AppSceneType;
 import com.game.common.constant.finance.FinTranAddedInfo;
@@ -34,7 +37,6 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.game.business.mapper.AppUserAgentMapper;
-import com.game.business.service.IAppUserAgentService;
 import com.game.common.annotation.DataSource;
 import com.game.common.enums.DataSourceType;
 
@@ -59,6 +61,9 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
     @Autowired
     private IAppGameService appGameService;
 
+    @Autowired
+    private IAppUserCountService appUserCountService;
+
     /**
      * 查询用户代理表
      *
@@ -133,7 +138,7 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
     @Override
     public int countAgent(Long userId, String beginTime, String endTime) {
         LambdaQueryWrapper<AppUserAgent> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(AppUserAgent::getTopId,userId);
+        queryWrapper.eq(AppUserAgent::getPid,userId);
         if(StringUtils.isNotBlank(beginTime)){
             queryWrapper.ge(AppUserAgent::getCreateTime,beginTime);
         }
@@ -192,6 +197,10 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
         if(null == teamDto.getPid()) {
             teamDto.setPid(SecurityUtils.getUserId());
         }
+        if(StringUtils.isBlank(teamDto.getBeginTime()) || StringUtils.isBlank(teamDto.getEndTime())){
+            teamDto.setBeginTime(DateUtil.format(DateUtil.beginOfMonth(DateUtils.getNowDate()), "yyyy-MM-dd"));
+            teamDto.setEndTime(DateUtil.format(DateUtil.endOfMonth(DateUtils.getNowDate()), "yyyy-MM-dd"));
+        }
         List<AppAgentTeamVo> list = appUserAgentMapper.teamListNew(teamDto);
         if(null != list && list.size() > 0){
             List<Long> ids = list.stream().map(e->{return e.getUserId();}).collect(Collectors.toList());
@@ -215,6 +224,44 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
                             return gameCommission;
                         }).collect(Collectors.toList()));
                     }
+                    //统计整条线用户数据
+                    List<AppUserCount> appUserCountList = appUserCountService.getAppUserCountNew(e.getUserId(), teamDto.getBeginTime(),teamDto.getEndTime());
+                    if(null != appUserCountList && appUserCountList.size() > 0) {
+                        DecimalFormat df = new DecimalFormat("#.##");
+                        //下注金额
+                        e.setBettingAmount(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(AppUserCount::getGameBetting).sum()).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                        //直播返点
+                        e.setLiveCommission(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(AppUserCount::getLiveCommission).sum()).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                        //游戏返点
+                        e.setGameCommission(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(AppUserCount::getGameCommission).sum()).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                        //盈亏
+                        e.setGameAmount(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(userCount->{
+                            return (userCount.getGameWinAmount() - userCount.getGameLoseAmount()) + userCount.getGameCommission() + userCount.getRechargeGive();
+                        }).sum()).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                        //充值金额(由于统计的金额是扣除了手续费并且加上赠送金额的值 故这么计算出原始充值金额)
+                        e.setRechargeAmount(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(userCount->{
+                            return userCount.getRechargeAmount() - userCount.getRechargeGive() + userCount.getRechargeCommission();
+                        }).sum()).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                        //充值手续费
+                        e.setRechargeCommission(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(AppUserCount::getRechargeCommission).sum()).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                        //充值赠送金额
+                        e.setRechargeGive(BigDecimal.valueOf(appUserCountList.stream().mapToDouble(AppUserCount::getRechargeGive).sum()).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                    }else{
+                        //下注金额
+                        e.setBettingAmount(0.00);
+                        //直播返点
+                        e.setLiveCommission(0.00);
+                        //游戏返点
+                        e.setGameCommission(0.00);
+                        //盈亏
+                        e.setGameAmount(0.00);
+                        //充值金额(由于统计的金额是扣除了手续费并且加上赠送金额的值 故这么计算出原始充值金额)
+                        e.setRechargeAmount(0.00);
+                        //充值手续费
+                        e.setRechargeCommission(0.00);
+                        //充值赠送金额
+                        e.setRechargeGive(0.00);
+                    }
                 });
             }
         }
@@ -244,8 +291,12 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
     }
 
     @Override
-    public List<AppUserAgent> selectAllAgentList(Long pid, Long userId) {
-        return appUserAgentMapper.selectAllAgentList(pid,userId);
+    public List<AppUserAgent> selectAllAgentList(Long pid, Long userId,String beginTime,String endTime) {
+        List<AppUserAgent> list = appUserAgentMapper.selectAllAgentList(pid,userId,beginTime,endTime);
+        if(null == list){
+            list = new ArrayList<>();
+        }
+        return list;
     }
 
     @Override

+ 3 - 2
game-business/src/main/java/com/game/business/service/impl/AppUserCountDividendServiceImpl.java

@@ -223,7 +223,8 @@ public class AppUserCountDividendServiceImpl extends ServiceImpl<AppUserCountDiv
 
     @Override
     public void reloadCache(String dateTime, List<Long> userIds) {
-        Date uDate = new Date();
+        //废弃
+        /*Date uDate = new Date();
         if (StringUtils.isNotBlank(dateTime)) {
             uDate = DateUtil.parse(dateTime, "yyyy-MM-dd");
         }
@@ -248,7 +249,7 @@ public class AppUserCountDividendServiceImpl extends ServiceImpl<AppUserCountDiv
                     log.info("用户非代理停止计算周盈亏缓存");
                 }
             });
-        }
+        }*/
     }
 
     private double calculation(Long userId,String beginTime,String endTime){

+ 15 - 17
game-business/src/main/java/com/game/business/task/AppUserCountTask.java

@@ -16,6 +16,7 @@ import lombok.extern.log4j.Log4j2;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -258,20 +259,20 @@ public class AppUserCountTask {
             Date beginTime = DateUtil.beginOfWeek(curDate);
             Date endTime = DateUtil.endOfWeek(curDate);
             //查询所有总代理用户
-            /*AppUser queryUser = new AppUser();
+            AppUser queryUser = new AppUser();
             queryUser.setAgentFlag(1);
-            List<AppUser> list = appUserService.selectAppUserList(queryUser);*/
-            List<AppUser> list = appUserService.selectTeamUserList();
+            List<AppUser> list = appUserService.selectAppUserList(queryUser);
+//            List<AppUser> list = appUserService.selectTeamUserList();
             if (null != list && list.size() > 0) {
                 list.forEach(appUser -> {
+                    String beginTimeStr = DateUtil.format(beginTime,"yyyy-MM-dd");
+                    String endTimeStr = DateUtil.format(endTime,"yyyy-MM-dd");
                     //查询用户所有下级本周盈亏
                     /*LambdaQueryWrapper<AppUserCount> queryWrapper = new LambdaQueryWrapper<>();
-                    queryWrapper.ge(AppUserCount::getStrDate, beginTime);
-                    queryWrapper.le(AppUserCount::getStrDate, endTime);
+                    queryWrapper.ge(AppUserCount::getStrDate, beginTimeStr);
+                    queryWrapper.le(AppUserCount::getStrDate, endTimeStr);
                     queryWrapper.eq(AppUserCount::getAgentUserId, appUser.getUserid());
                     List<AppUserCount> appUserCountList = appUserCountService.list(queryWrapper);*/
-                    String beginTimeStr = DateUtil.format(beginTime,"yyyy-MM-dd");
-                    String endTimeStr = DateUtil.format(endTime,"yyyy-MM-dd");
                     List<AppUserCount> appUserCountList = appUserCountService.getAppUserCountNew(appUser.getUserid(),beginTimeStr,endTimeStr);
                     if (null != appUserCountList && appUserCountList.size() > 0) {
                         //游戏输钱
@@ -292,21 +293,18 @@ public class AppUserCountTask {
                         double money = (loseAmount - winAmount)  - gameCommission - rechargeGive;
                         if (money > 0) {
                             //金额大于0 满足分红
-
-                            if (null != appUserCountList && appUserCountList.size() > 0) {
-                                appUserCountList.forEach(userCount -> {
-                                    //查询用户代理信息
-                                    AppUserAgent userAgent = appUserAgentService.selectInfo(userCount.getUserId());
-                                    if(null == userAgent) {
-                                        log.info("用户{},不是代理或者代理信息为空,停止分红",userCount.getUserId());
-                                        return;
-                                    }
+                            //查询当前用户所有下级
+                            AppUserAgent queryAppUserAgent = new AppUserAgent();
+                            queryAppUserAgent.setPid(appUser.getUserid());
+                            List<AppUserAgent> appUserAgentList = appUserAgentService.selectAppUserAgentList(queryAppUserAgent);
+                            if (null != appUserAgentList && appUserAgentList.size() > 0) {
+                                appUserAgentList.forEach(userAgent -> {
                                     if (userAgent.getDividendGuaranteeRate() <= 0.00) {
                                         log.info("用户{},团队亏损{},或未设置分红比例,停止分红", userAgent.getUserId(), money);
                                         return;
                                     }
                                     double rate = userAgent.getDividendGuaranteeRate();
-                                    double dividends = money * rate/100;
+                                    double dividends = BigDecimal.valueOf(money * rate/100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
                                     AppUserCountDividend appUserCountDividend = new AppUserCountDividend();
                                     appUserCountDividend.setUserId(userAgent.getUserId());
                                     appUserCountDividend.setDateNo(DateUtil.format(endTime, "yyyy-MM-dd"));

+ 12 - 1
game-business/src/main/resources/mapper/business/AppUserAgentMapper.xml

@@ -221,12 +221,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
            SELECT *
            FROM app_user_agent
            WHERE pid = #{pid}
-
+          <if test="beginTime != null and beginTime != ''">
+             and <![CDATA[create_time >= #{beginTime} ]]>
+          </if>
+          <if test="endTime != null and endTime != ''">
+                and <![CDATA[create_time <= #{endTime} ]]>
+          </if>
            UNION ALL
 
            SELECT o.*
            FROM app_user_agent o
                     JOIN useragent s ON o.pid = s.user_id
+            <if test="beginTime != null and beginTime != ''">
+                and <![CDATA[o.create_time >= #{beginTime} ]]>
+            </if>
+            <if test="endTime != null and endTime != ''">
+                and <![CDATA[o.create_time <= #{endTime} ]]>
+            </if>
        )
         SELECT * FROM useragent where 1=1
         <if test="userId != null">

+ 8 - 0
game-common/src/main/java/com/game/common/core/controller/BaseController.java

@@ -55,6 +55,14 @@ public class BaseController
         PageUtils.startPage();
     }
 
+    /**
+     * 设置请求分页数据(限制每页最大条数)
+     */
+    protected void startPageBySize(Integer size)
+    {
+        PageUtils.startPageBySize(size);
+    }
+
     /**
      * 设置请求排序数据
      */

+ 15 - 0
game-common/src/main/java/com/game/common/utils/PageUtils.java

@@ -24,6 +24,21 @@ public class PageUtils extends PageHelper
 //        Boolean reasonable = pageDomain.getReasonable();
         PageHelper.startPage(pageNum, pageSize, orderBy);
     }
+    /**
+     * 设置请求分页数据(传最大条数)
+     */
+    public static void startPageBySize(Integer size)
+    {
+        PageDomain pageDomain = TableSupport.buildPageRequest();
+        Integer pageNum = pageDomain.getPageNum();
+        Integer pageSize = pageDomain.getPageSize();
+        if(null != size && pageSize > size) {
+            pageSize = size;
+        }
+        String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
+//        Boolean reasonable = pageDomain.getReasonable();
+        PageHelper.startPage(pageNum, pageSize, orderBy);
+    }
 
     /**
      * 清理分页的线程变量