| 
					
				 | 
			
			
				@@ -2,15 +2,20 @@ package com.zanxiang.game.data.serve.service.impl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.google.common.base.CaseFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.google.gson.Gson; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.zanxiang.game.data.serve.pojo.dto.GameDataAgainDayDTO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zanxiang.game.data.serve.pojo.dto.GameDataDayDTO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zanxiang.game.data.serve.pojo.dto.GameDataTotalDTO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zanxiang.game.data.serve.pojo.dto.GameDataWaterDTO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zanxiang.game.data.serve.pojo.entity.AdsEverydayWater; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.zanxiang.game.data.serve.pojo.entity.AdsGameDayAgain; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.zanxiang.game.data.serve.pojo.entity.AdsGameDayAgainBuy; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.zanxiang.game.data.serve.pojo.entity.AdsGameDayAgainNature; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zanxiang.game.data.serve.pojo.enums.OrderByEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zanxiang.game.data.serve.pojo.vo.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zanxiang.game.data.serve.service.IGameDataService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zanxiang.game.data.serve.utils.Page; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zanxiang.module.util.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.zanxiang.module.util.exception.BaseException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.Builder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.Data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -28,6 +33,7 @@ import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.util.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.lang.reflect.Method; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigInteger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.RoundingMode; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -52,6 +58,7 @@ public class GameDataServiceImpl implements IGameDataService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 游戏每日数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param dto 前端传递查询参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return 返回给前端的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -377,6 +384,7 @@ public class GameDataServiceImpl implements IGameDataService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 游戏总数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param dto 前端传递的查询参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return 返回给前端的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -556,8 +564,420 @@ public class GameDataServiceImpl implements IGameDataService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * 游戏每日数据SQL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 每日流水贡献 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param dto 前端传递的查询参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 返回给前端的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Page<GameDataWaterVO> getGameDataWater(GameDataWaterDTO dto) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (null == dto.getRechargeDate()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dto.setRechargeDate(LocalDate.now()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isBlank(dto.getSortFiled())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dto.setSortFiled("amount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isBlank(dto.getSortType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dto.setSortType(OrderByEnum.DESC.getOrderType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Pager pager = dao.createPager(dto.getPageNum(), dto.getPageSize()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 创建一个 Criteria 接口实例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SimpleCriteria cri = Cnd.cri(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isNotBlank(dto.getGameName())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            cri.where().andLike("game_name", dto.getGameName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isNotBlank(dto.getGameClassify())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            cri.where().andEquals("game_classify", dto.getGameClassify()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        cri.where().and("dt", "=", dto.getRechargeDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        cri.groupBy("game_id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        cri.orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Sql sql = Sqls.queryEntity(waterSql() + "$condition"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sql.setPager(pager); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Entity<GameDataWaterVO> entity = dao.getEntity(GameDataWaterVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sql.setEntity(entity).setCondition(cri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dao.execute(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Sql sqlCount = Sqls.queryEntity("select count(*) from ads_everyday_water " + "$condition"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        sqlCount.setCondition(cri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pager.setRecordCount((int) Daos.queryCount(dao, sqlCount)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Long> gameIds = sql.getList(GameDataWaterVO.class).stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .map(GameDataWaterVO::getGameId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (CollectionUtils.isEmpty(gameIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return new Page<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SimpleCriteria templateCri = Cnd.cri(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        templateCri.where().and("dt", "=", dto.getRechargeDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        templateCri.where().andInList("game_id", gameIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Sql templateSql = Sqls.queryEntity(waterTemplateSql() + "$condition"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Entity<AdsEverydayWater> everydayWaterEntity = dao.getEntity(AdsEverydayWater.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        templateSql.setEntity(everydayWaterEntity).setCondition(templateCri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dao.execute(templateSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<Long, List<AdsEverydayWater>> collect = templateSql.getList(AdsEverydayWater.class).stream().collect(Collectors.groupingBy(AdsEverydayWater::getGameId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<GameDataWaterVO> result = sql.getList(GameDataWaterVO.class).stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .map(item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    List<AdsEverydayWater> adsEverydayWaters = collect.get(item.getGameId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!CollectionUtils.isEmpty(adsEverydayWaters)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<RechargeTemplateVO> rechargeTemplateVOList = new ArrayList<>(10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<PlayerTemplateVO> playerTemplateVOS = new ArrayList<>(10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        adsEverydayWaters.forEach(adsEverydayWater -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (StringUtils.isNotBlank(adsEverydayWater.getAmountOrderBy())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                rechargeTemplateVOList.add(RechargeTemplateVO.builder() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        .amountCount(adsEverydayWater.getAmountCount()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        .amountNum(adsEverydayWater.getAmountNum()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        .amountOrderBy(adsEverydayWater.getAmountOrderBy()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        .amountPost(adsEverydayWater.getAmountPost()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        .build()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (StringUtils.isNotBlank(adsEverydayWater.getUserOrderBy())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                playerTemplateVOS.add(PlayerTemplateVO.builder() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        .userId(adsEverydayWater.getUserId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        .userAmount(adsEverydayWater.getUserAmount()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        .userOrderBy(adsEverydayWater.getUserOrderBy()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        .userName(adsEverydayWater.getUserName()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        .proportion( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                item.getAmount().compareTo(BigDecimal.ZERO) == 0 ? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        BigDecimal.ZERO : 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        adsEverydayWater.getUserAmount().divide(item.getAmount(), 4, RoundingMode.DOWN) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        .build()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        item.setRechargeTemplateVOList(rechargeTemplateVOList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        item.setPlayerTemplateVOS(playerTemplateVOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return item; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return new Page<>(result, pager); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 游戏每日复充数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param dto 前端传递查询参数实体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 返回给前端的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Map<LocalDate, List<GameDataAgainDayVO>> getGameDataAgainDay(GameDataAgainDayDTO dto) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //如果查询时间不传递默认从今天开始查询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (dto.getBeginDate() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dto.setBeginDate(LocalDate.now()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //判断开始时间后的30天是否超过当前日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (dto.getBeginDate().plusDays(30).isAfter(LocalDate.now())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //只查询到当前的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dto.setEndDate(LocalDate.now()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //只考虑30天的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dto.setEndDate(dto.getBeginDate().plusDays(30)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //拼接查询条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Criteria cri = Cnd.cri(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isNotBlank(dto.getGameName())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            cri.where().andEquals("game_name", dto.getGameName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (dto.getBeginDate() != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            cri.where().andEquals("dt", dto.getBeginDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            cri.where().andBetween("ddf", dto.getBeginDate(), dto.getEndDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //按 "ddf" 升序排序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        cri.getOrderBy().asc("ddf"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取三张表的查询结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<AdsGameDayAgain> list = getListByTableType("total", cri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<AdsGameDayAgainBuy> listBuy = getListByTableType("buy", cri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<AdsGameDayAgainNature> listNature = getListByTableType("nature", cri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("list长度:" + list.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("listBuy长度:" + listBuy.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("listNature长度:" + listNature.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //创建Map记录数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<LocalDate, List<GameDataAgainDayVO>> map = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //有序存储每个list,每个list包含当天的所有充值次数的复充数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<List<GameDataAgainDayVO>> tempList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //记录查询出的记录条数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int count = list.size(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //初始化list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        initList(tempList, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //外层循环8次 表示不同复充次数的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (int i = 0; i < 8; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //用来计算Ci 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int ci = i + 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //第一天的所有充值次数都是先计算的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            GameDataAgainDayVO tempVO = tempList.get(0).get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //"原": Ci 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setOriginal(getCnByNum(list.get(0), ci)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setBuyOriginal(getCnByNum(listBuy.get(0), ci)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setNatureOriginal(getCnByNum(listNature.get(0), ci)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //"增":初始为 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setIncrease(BigInteger.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setBuyIncrease(BigInteger.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setNatureIncrease(BigInteger.ZERO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //"移":下一个充值次数的Ci 即C(i+1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setDecrease(getCnByNum(list.get(0), ci + 1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setBuyDecrease(getCnByNum(listBuy.get(0), ci + 1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setNatureDecrease(getCnByNum(listNature.get(0), ci + 1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //"现":公式计算 = 原 + 增 - 移 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setPresent( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    tempVO.getOriginal().add(tempVO.getIncrease()).subtract(tempVO.getDecrease()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setBuyPresent( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    tempVO.getBuyOriginal().add(tempVO.getBuyIncrease()).subtract(tempVO.getBuyDecrease()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setNaturePresent( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    tempVO.getNatureOriginal().add(tempVO.getNatureIncrease()).subtract(tempVO.getNatureDecrease()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //"比" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setRate(getCnByNum(list.get(0), 1).compareTo(BigInteger.ZERO) == 0 ? BigDecimal.ZERO : 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal.valueOf(tempVO.getPresent().doubleValue() / getCnByNum(list.get(0), 1).doubleValue()).setScale(4, RoundingMode.HALF_UP) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setBuyRate(getCnByNum(listBuy.get(0), 1).compareTo(BigInteger.ZERO) == 0 ? BigDecimal.ZERO : 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal.valueOf(tempVO.getBuyPresent().doubleValue() / getCnByNum(listBuy.get(0), 1).doubleValue()).setScale(4, RoundingMode.HALF_UP) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tempList.get(0).get(i).setNatureRate(getCnByNum(listNature.get(0), 1).compareTo(BigInteger.ZERO) == 0 ? BigDecimal.ZERO : 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal.valueOf(tempVO.getNaturePresent().doubleValue() / getCnByNum(listNature.get(0), 1).doubleValue()).setScale(4, RoundingMode.HALF_UP) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //计算第2-n天的数据 复充次数i的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int j = 1; j < count; j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //"原":前一天的"现" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setOriginal(tempList.get(j - 1).get(i).getPresent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setBuyOriginal(tempList.get(j - 1).get(i).getBuyPresent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setNatureOriginal(tempList.get(j - 1).get(i).getNaturePresent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //"现":当天的Ci - 当天的C(i+1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setPresent( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        getCnByNum(list.get(j), ci).subtract(getCnByNum(list.get(j), ci + 1))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setBuyPresent( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        getCnByNum(listBuy.get(j), ci).subtract(getCnByNum(listBuy.get(j), ci + 1))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setNaturePresent( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        getCnByNum(listNature.get(j), ci).subtract(getCnByNum(listNature.get(j), ci + 1))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //"增":当天的Ci - 前一天的Ci 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setIncrease( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        getCnByNum(list.get(j), ci).subtract(getCnByNum(list.get(j - 1), ci))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setBuyIncrease( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        getCnByNum(listBuy.get(j), ci).subtract(getCnByNum(listBuy.get(j - 1), ci))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setNatureIncrease( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        getCnByNum(listNature.get(j), ci).subtract(getCnByNum(listNature.get(j - 1), ci))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //"移":当天的C(i+1) - 前一天的C(i+1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setDecrease( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        getCnByNum(list.get(j), ci + 1).subtract(getCnByNum(list.get(j - 1), ci + 1))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setBuyDecrease( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        getCnByNum(listBuy.get(j), ci + 1).subtract(getCnByNum(listBuy.get(j - 1), ci + 1))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setNatureDecrease( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        getCnByNum(listNature.get(j), ci + 1).subtract(getCnByNum(listNature.get(j - 1), ci + 1))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //"比":当天的现 / 前一天的C1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setRate(getCnByNum(list.get(j - 1), 1).compareTo(BigInteger.ZERO) == 0 ? BigDecimal.ZERO : 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BigDecimal.valueOf(tempList.get(j).get(i).getPresent().doubleValue() / getCnByNum(list.get(j - 1), 1).doubleValue()).setScale(4, RoundingMode.HALF_UP)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setBuyRate(getCnByNum(listBuy.get(j - 1), 1).compareTo(BigInteger.ZERO) == 0 ? BigDecimal.ZERO : 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BigDecimal.valueOf(tempList.get(j).get(i).getBuyPresent().doubleValue() / getCnByNum(listBuy.get(j - 1), 1).doubleValue()).setScale(4, RoundingMode.HALF_UP)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tempList.get(j).get(i).setNatureRate(getCnByNum(listNature.get(j - 1), 1).compareTo(BigInteger.ZERO) == 0 ? BigDecimal.ZERO : 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BigDecimal.valueOf(tempList.get(j).get(i).getNaturePresent().doubleValue() / getCnByNum(listNature.get(j - 1), 1).doubleValue()).setScale(4, RoundingMode.HALF_UP)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //赋值时间数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (int i = 0; i < tempList.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            map.put(list.get(i).getDdf(), tempList.get(i)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //返回数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 三张表共用的方法 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param dayNMap 参数Map 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param tableName 查询的表名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return DayN数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private DayN getDayNByTableName(Map<String, Object> dayNMap, String tableName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //构架SQL语句,查询相关DayN表获取相关充值数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Sql dayNSql = Sqls.create( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    dayN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $tableName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                where 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    dt between @registerBeginDate and @registerEndDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and game_id = @gameId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //sql语句传入参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dayNSql.setParams(dayNMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //给定查询的表名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dayNSql.vars().set("tableName", tableName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //设置回传 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dayNSql.setCallback(Sqls.callback.strList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //执行sql 获取数据到list中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        dao.execute(dayNSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //将数据库中获取的所有结果封装到一个List中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> dayNList = dayNSql.getList(String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //构建一个内部类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DayN dayN = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //解析dayNList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!CollectionUtils.isEmpty(dayNList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //将dayNList中json格式数据转换为 Map 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Gson gson = new Gson(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<Map<String, String>> jsonList = gson.fromJson(dayNList.toString(), ArrayList.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //用来存储数据的map 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, String> resMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //对应的参数说明:  日期:每天充值金额-充值次数-充值人数-新用户复充人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            resMap.put("dayN", "0.00-0-0-0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (Map<String, String> jsonMap : jsonList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (Map.Entry<String, String> entry : jsonMap.entrySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //key是充值日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String key = entry.getKey(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String value = entry.getValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //将value按“-”分割 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    String[] resValues = value.split("-"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //判断充值日期 在充值日期内的数据进行计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (DateUtil.parseLocalDate(key).compareTo((LocalDate) dayNMap.get("rechargeBeginDate")) >= 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            && DateUtil.parseLocalDate(key).compareTo((LocalDate) dayNMap.get("rechargeEndDate")) <= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //获取原先的dayN的值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        String[] oldValues = resMap.get("dayN").split("-"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //充值的金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BigDecimal chargeMoney = new BigDecimal(oldValues[0]).add(new BigDecimal(resValues[0])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //充值的次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BigInteger count = new BigInteger(oldValues[1]).add(new BigInteger(resValues[1])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //充值的人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BigInteger num = new BigInteger(oldValues[2]).add(new BigInteger(resValues[2])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //新用户复充人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        BigInteger againNum = new BigInteger(oldValues[3]).add(new BigInteger(resValues[3])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        //合并成字符串 更新dayN的值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        String newValue = chargeMoney + "-" + count + "-" + num + "-" + againNum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        resMap.put("dayN", newValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //设置dayN的参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!resMap.isEmpty() && !resMap.get("dayN").isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String[] values = resMap.get("dayN").split("-"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                dayN = DayN.builder() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .rechargeMoney(new BigDecimal(values[0])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .rechargeCount(new BigInteger(values[1])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .rechargeNum(new BigInteger(values[2])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .rechargeAgainNum(new BigInteger(values[3])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .build(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return dayN; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 通过反射来获取Cn的值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param dto 数据库查询出来的原始数据对象实体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param num 1-9 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return Cn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private BigInteger getCnByNum(Object dto, int num) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Method m1 = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //不同对象获取的方法不同 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (dto instanceof AdsGameDayAgain) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                m1 = AdsGameDayAgain.class.getDeclaredMethod(String.format("getC%s", num)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if (dto instanceof AdsGameDayAgainBuy) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                m1 = AdsGameDayAgainBuy.class.getDeclaredMethod(String.format("getBuyC%s", num)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if (dto instanceof AdsGameDayAgainNature) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                m1 = AdsGameDayAgainNature.class.getDeclaredMethod(String.format("getNatureC%s", num)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //返回对应的Cn值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return (BigInteger) m1.invoke(dto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BaseException("发生错误"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 初始化List数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param list 需要初始化的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param num 多少天的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void initList(List<List<GameDataAgainDayVO>> list, Integer num) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //外层循环 num 次 表示多少天的数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (int i = 0; i < num; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            list.add(new ArrayList<>()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //内层循环8次 一共初始化8种复充次数数据对象 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (int j = 0; j < 8; j++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                list.get(i).add( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        GameDataAgainDayVO.builder() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .buyOriginal(BigInteger.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .buyPresent(BigInteger.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .buyIncrease(BigInteger.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .buyDecrease(BigInteger.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .buyRate(BigDecimal.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .natureOriginal(BigInteger.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .naturePresent(BigInteger.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .natureIncrease(BigInteger.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .natureDecrease(BigInteger.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .natureRate(BigDecimal.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .original(BigInteger.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .present(BigInteger.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .increase(BigInteger.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .decrease(BigInteger.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .rate(BigDecimal.ZERO) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .build() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 不同表获取不同的list结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param tableName 表明 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param cri 查询条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 查询结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private List getListByTableType(String tableName, Criteria cri) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //创建sql语句 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Sql againSql; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //查询的结果封装到list中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List list = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //判断具体查询哪张表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (tableName.equals("total")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            againSql = Sqls.create(adsGameDataAgainSql() + cri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //自定义回传对象 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            againSql.setCallback(Sqls.callback.entities()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            againSql.setEntity(dao.getEntity(AdsGameDayAgain.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //执行sql 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dao.execute(againSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //得到查询的原始结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            list = againSql.getList(AdsGameDayAgain.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if (tableName.equals("buy")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            againSql = Sqls.create(adsGameDataAgainBuySql() + cri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //自定义回传对象 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            againSql.setCallback(Sqls.callback.entities()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            againSql.setEntity(dao.getEntity(AdsGameDayAgainBuy.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //执行sql 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dao.execute(againSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //得到查询的原始结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            list = againSql.getList(AdsGameDayAgainBuy.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if (tableName.equals("nature")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            againSql = Sqls.create(adsGameDataAgainNatureSql() + cri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //自定义回传对象 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            againSql.setCallback(Sqls.callback.entities()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            againSql.setEntity(dao.getEntity(AdsGameDayAgainNature.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //执行sql 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dao.execute(againSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //得到查询的原始结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            list = againSql.getList(AdsGameDayAgainNature.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //返回结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 游戏每日数据SQL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return String 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private String gameDataDaySql() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -680,7 +1100,6 @@ public class GameDataServiceImpl implements IGameDataService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 游戏总数据SQL 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return String 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private String gameDataTotalSql() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -769,202 +1188,88 @@ public class GameDataServiceImpl implements IGameDataService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 """; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    /** 三张表共用的方法 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @param dayNMap 参数Map 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @param tableName 查询的表名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @return DayN数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 复充表sql(总量) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return String 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private DayN getDayNByTableName(Map<String, Object> dayNMap, String tableName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //构架SQL语句,查询相关DayN表获取相关充值数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Sql dayNSql = Sqls.create( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        dayN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        $tableName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                   where 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        dt between @registerBeginDate and @registerEndDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        and game_id = @gameId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //sql语句传入参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        dayNSql.setParams(dayNMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //给定查询的表名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        dayNSql.vars().set("tableName", tableName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //设置回传 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        dayNSql.setCallback(Sqls.callback.strList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //执行sql 获取数据到list中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        dao.execute(dayNSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //将数据库中获取的所有结果封装到一个List中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<String> dayNList = dayNSql.getList(String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //构建一个内部类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        DayN dayN = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //解析dayNList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (!CollectionUtils.isEmpty(dayNList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //将dayNList中json格式数据转换为 Map 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Gson gson = new Gson(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<Map<String, String>> jsonList = gson.fromJson(dayNList.toString(), ArrayList.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //用来存储数据的map 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Map<String, String> resMap = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //对应的参数说明:  日期:每天充值金额-充值次数-充值人数-新用户复充人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            resMap.put("dayN", "0.00-0-0-0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for (Map<String, String> jsonMap : jsonList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                for (Map.Entry<String, String> entry : jsonMap.entrySet()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //key是充值日期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    String key = entry.getKey(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    String value = entry.getValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //将value按“-”分割 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    String[] resValues = value.split("-"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //判断充值日期 在充值日期内的数据进行计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (DateUtil.parseLocalDate(key).compareTo((LocalDate) dayNMap.get("rechargeBeginDate")) >= 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            && DateUtil.parseLocalDate(key).compareTo((LocalDate) dayNMap.get("rechargeEndDate")) <= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //获取原先的dayN的值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        String[] oldValues = resMap.get("dayN").split("-"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //充值的金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        BigDecimal chargeMoney = new BigDecimal(oldValues[0]).add(new BigDecimal(resValues[0])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //充值的次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        BigInteger count = new BigInteger(oldValues[1]).add(new BigInteger(resValues[1])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //充值的人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        BigInteger num = new BigInteger(oldValues[2]).add(new BigInteger(resValues[2])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //新用户复充人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        BigInteger againNum = new BigInteger(oldValues[3]).add(new BigInteger(resValues[3])); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        //合并成字符串 更新dayN的值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        String newValue = chargeMoney + "-" + count + "-" + num + "-" + againNum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        resMap.put("dayN", newValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //设置dayN的参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (!resMap.isEmpty() && !resMap.get("dayN").isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                String[] values = resMap.get("dayN").split("-"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                dayN = DayN.builder() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        .rechargeMoney(new BigDecimal(values[0])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        .rechargeCount(new BigInteger(values[1])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        .rechargeNum(new BigInteger(values[2])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        .rechargeAgainNum(new BigInteger(values[3])) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        .build(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return dayN; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private String adsGameDataAgainSql() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                """   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    dt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ddf, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    game_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    game_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    c1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    c2, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    c3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    c4, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    c5, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    c6, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    c7, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    c8, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    c9 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ads_game_day_again 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                """; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * DayN内部类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 复充表sql(买量) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return String 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Builder 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public static class DayN { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         * 充值金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private BigDecimal rechargeMoney; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         * 充值次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private BigInteger rechargeCount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         * 充值人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private BigInteger rechargeNum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         * 新用户复充人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private BigInteger rechargeAgainNum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private String adsGameDataAgainBuySql() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                """   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    dt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ddf, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    game_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    game_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    buy_c1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    buy_c2, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    buy_c3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    buy_c4, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    buy_c5, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    buy_c6, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    buy_c7, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    buy_c8, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    buy_c9 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ads_game_day_again_buy 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                """; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public Page<GameDataWaterVO> getGameDataWater(GameDataWaterDTO dto) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (null == dto.getRechargeDate()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dto.setRechargeDate(LocalDate.now()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (StringUtils.isBlank(dto.getSortFiled())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dto.setSortFiled("amount"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (StringUtils.isBlank(dto.getSortType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            dto.setSortType(OrderByEnum.DESC.getOrderType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Pager pager = dao.createPager(dto.getPageNum(), dto.getPageSize()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 创建一个 Criteria 接口实例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SimpleCriteria cri = Cnd.cri(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (StringUtils.isNotBlank(dto.getGameName())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            cri.where().andLike("game_name", dto.getGameName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (StringUtils.isNotBlank(dto.getGameClassify())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            cri.where().andEquals("game_classify", dto.getGameClassify()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        cri.where().and("dt", "=", dto.getRechargeDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        cri.groupBy("game_id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        cri.orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Sql sql = Sqls.queryEntity(waterSql() + "$condition"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sql.setPager(pager); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Entity<GameDataWaterVO> entity = dao.getEntity(GameDataWaterVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sql.setEntity(entity).setCondition(cri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        dao.execute(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Sql sqlCount = Sqls.queryEntity("select count(*) from ads_everyday_water " + "$condition"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sqlCount.setCondition(cri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        pager.setRecordCount((int) Daos.queryCount(dao, sqlCount)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Long> gameIds = sql.getList(GameDataWaterVO.class).stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .map(GameDataWaterVO::getGameId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (CollectionUtils.isEmpty(gameIds)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return new Page<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SimpleCriteria templateCri = Cnd.cri(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        templateCri.where().and("dt", "=", dto.getRechargeDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        templateCri.where().andInList("game_id", gameIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Sql templateSql = Sqls.queryEntity(waterTemplateSql() + "$condition"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Entity<AdsEverydayWater> everydayWaterEntity = dao.getEntity(AdsEverydayWater.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        templateSql.setEntity(everydayWaterEntity).setCondition(templateCri); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        dao.execute(templateSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Long, List<AdsEverydayWater>> collect = templateSql.getList(AdsEverydayWater.class).stream().collect(Collectors.groupingBy(AdsEverydayWater::getGameId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<GameDataWaterVO> result = sql.getList(GameDataWaterVO.class).stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .map(item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    List<AdsEverydayWater> adsEverydayWaters = collect.get(item.getGameId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (!CollectionUtils.isEmpty(adsEverydayWaters)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        List<RechargeTemplateVO> rechargeTemplateVOList = new ArrayList<>(10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        List<PlayerTemplateVO> playerTemplateVOS = new ArrayList<>(10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        adsEverydayWaters.forEach(adsEverydayWater -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if (StringUtils.isNotBlank(adsEverydayWater.getAmountOrderBy())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                rechargeTemplateVOList.add(RechargeTemplateVO.builder() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        .amountCount(adsEverydayWater.getAmountCount()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        .amountNum(adsEverydayWater.getAmountNum()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        .amountOrderBy(adsEverydayWater.getAmountOrderBy()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        .amountPost(adsEverydayWater.getAmountPost()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        .build()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            if (StringUtils.isNotBlank(adsEverydayWater.getUserOrderBy())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                playerTemplateVOS.add(PlayerTemplateVO.builder() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        .userId(adsEverydayWater.getUserId()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        .userAmount(adsEverydayWater.getUserAmount()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        .userOrderBy(adsEverydayWater.getUserOrderBy()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        .userName(adsEverydayWater.getUserName()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        .proportion( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                                item.getAmount().compareTo(BigDecimal.ZERO) == 0 ? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                                        BigDecimal.ZERO : 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                                        adsEverydayWater.getUserAmount().divide(item.getAmount(), 4, RoundingMode.DOWN) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                        .build()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        item.setRechargeTemplateVOList(rechargeTemplateVOList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        item.setPlayerTemplateVOS(playerTemplateVOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return item; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return new Page<>(result, pager); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 复充表sql(自然量) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return String 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private String adsGameDataAgainNatureSql() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                """   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    dt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ddf, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    game_id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    game_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    nature_c1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    nature_c2, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    nature_c3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    nature_c4, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    nature_c5, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    nature_c6, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    nature_c7, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    nature_c8, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    nature_c9 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ads_game_day_again_nature 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                """; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 流水sql 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return String 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private String waterSql() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 select 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -979,6 +1284,10 @@ public class GameDataServiceImpl implements IGameDataService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 """; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 流水临时sql 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return String 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private String waterTemplateSql() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return """ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 select 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -994,4 +1303,32 @@ public class GameDataServiceImpl implements IGameDataService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 from ads_everyday_water 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 """; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * DayN内部类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Builder 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static class DayN { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         * 充值金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private BigDecimal rechargeMoney; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         * 充值次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private BigInteger rechargeCount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         * 充值人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private BigInteger rechargeNum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         * 新用户复充人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private BigInteger rechargeAgainNum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |