| 
					
				 | 
			
			
				@@ -434,6 +434,21 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     group by user_id) a 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 WHERE a.repeatNum > 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 """); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Sql roleUserNum = Sqls.fetchLong(""" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	count(DISTINCT role_user_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                from 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	dw_create_role_detail 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                where 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    source_system = @sourceSystem 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and user_agent_id = @agentId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and user_account_id = @accountId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and DATE(role_create_time) >= @rechargeBeginDay 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and DATE(role_create_time) <= @rechargeEndDay 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and user_dt >= @costBeginDay 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and user_dt <= @costEndDay 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                """); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //循环总数据的每条数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<GamePromoteTotalVO> hasRechargeDayList = list.stream().map(item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             showSql.setParam("sourceSystem", item.getSourceSystem()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -472,6 +487,12 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<String> dayNList = sqlDayN.getList(String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             DayN dayN = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //ads_dayn_amount存在充值数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            newUserNumMap.put("accountId", item.getAccountId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            newUserNumMap.put("agentId", item.getAgentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            newUserNumMap.put("sourceSystem", item.getSourceSystem()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            roleUserNum.setParams(newUserNumMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dao.execute(roleUserNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Long roleUserNumLong = roleUserNum.getLong(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!CollectionUtils.isEmpty(dayNList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Gson gson = new Gson(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 List<Map<String, String>> jsonList = gson.fromJson(dayNList.toString(), ArrayList.class); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -496,9 +517,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                newUserNumMap.put("accountId", item.getAccountId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                newUserNumMap.put("agentId", item.getAgentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                newUserNumMap.put("sourceSystem", item.getSourceSystem()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 newUserNum.setParams(newUserNumMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 dao.execute(newUserNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Long newUserNumLong = newUserNum.getLong(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -516,6 +535,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             .build(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            item.setRoleNum(roleUserNumLong); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //充值时间范围内存在充值数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (null != dayN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 item.setUserRechargeMoney(dayN.getRechargeMoney()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -816,7 +836,23 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     group by user_id) a 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 WHERE a.repeatNum > 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 """); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Sql roleUserNum = Sqls.fetchLong(""" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	count(DISTINCT role_user_id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                from 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	dw_create_role_detail 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                where 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    source_system = @sourceSystem 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and user_agent_id = @agentId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and user_account_id = @accountId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and DATE(role_create_time) >= @rechargeBeginDay 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and DATE(role_create_time) <= @rechargeEndDay 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and user_dt >= @costBeginDay 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    and user_dt <= @costEndDay 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                """); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         AtomicReference<Long> showRechargeUserNum = new AtomicReference<>(0L); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AtomicReference<Long> roleUserNumLong = new AtomicReference<>(0L); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         DayN dayNTotal = agentAccountList.stream().map(item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             showRechargeUserSql.setParam("sourceSystem", item.getSourceSystem()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             showRechargeUserSql.setParam("agentId", item.getAgentId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -831,6 +867,14 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             dao.execute(sqlDayN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<String> dayNList = sqlDayN.getList(String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             DayN dayN = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            newUserNumMap.put("accountId", item.getAccountId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            newUserNumMap.put("agentId", item.getAgentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            newUserNumMap.put("sourceSystem", item.getSourceSystem()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            roleUserNum.setParams(newUserNumMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dao.execute(roleUserNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            roleUserNumLong.set(roleUserNumLong.get() + roleUserNum.getLong()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //ads_dayn_amount存在充值数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (!CollectionUtils.isEmpty(dayNList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Gson gson = new Gson(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -856,9 +900,6 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (!resultMap.isEmpty() && !resultMap.get("dayN").isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    newUserNumMap.put("accountId", item.getAccountId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    newUserNumMap.put("agentId", item.getAgentId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    newUserNumMap.put("sourceSystem", item.getSourceSystem()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     newUserNum.setParams(newUserNumMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     dao.execute(newUserNum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     Long newUserNumLong = newUserNum.getLong(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -885,6 +926,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return accumulator; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }).orElse(new DayN()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gamePromoteTotalSumVO.setRoleNum(roleUserNumLong.get()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         gamePromoteTotalSumVO.setShowRechargeUser(showRechargeUserNum.get()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         gamePromoteTotalSumVO.setShowRechargeArpu(gamePromoteTotalSumVO.getShowRechargeUser() == 0 ? BigDecimal.ZERO : 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 gamePromoteTotalSumVO.getShowRechargeMoney().divide(new BigDecimal(gamePromoteTotalSumVO.getShowRechargeUser()), 4, RoundingMode.DOWN)); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1182,7 +1224,10 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 	round(if(amount_count > 0, cost / amount_count, 0), 4) as show_recharge_count_cost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 	round(if(new_user_total_amount_count > 0, cost / new_user_total_amount_count, 0), 4) as new_user_recharge_count_cost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 	hundred_user_num, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                	hundred_user_num_cost 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	hundred_user_num_cost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	first_role_num, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	new_user_total_role_num, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	role_num 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 from 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 	ads_account_agent_day 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 """; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1284,9 +1329,12 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     round(if(sum(amount_count) > 0, sum(cost) / sum(amount_count), 0), 4) as show_recharge_count_cost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     round(if(sum(new_user_total_amount_count) > 0, sum(cost) / sum(new_user_total_amount_count), 0), 4) as new_user_recharge_count_cost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     sum(hundred_user_num) as hundred_user_num, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    round(if(sum(hundred_user_num) > 0, sum(cost) / sum(hundred_user_num), 0), 4) as hundred_user_num_cost 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        from 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        	ads_account_agent_day 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    round(if(sum(hundred_user_num) > 0, sum(cost) / sum(hundred_user_num), 0), 4) as hundred_user_num_cost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    sum(first_role_num) as first_role_num, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    sum(new_user_total_role_num) as new_user_total_role_num, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    sum(role_num) as role_num 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    from 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ads_account_agent_day 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         """; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1407,7 +1455,9 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 	round(if(sum(first_new_user_amount_count) > 0, sum(cost) / sum(first_new_user_amount_count), 0), 4) as first_recharge_count_cost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 	round(if(sum(new_user_total_amount_count) > 0, sum(cost) / sum(new_user_total_amount_count), 0), 4) as new_user_recharge_count_cost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 	sum(a.hundred_user_num) as hundred_user_num, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                	round(if(sum(a.hundred_user_num) > 0, sum(a.cost) / sum(a.hundred_user_num), 0), 4) as hundred_user_num_cost 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	round(if(sum(a.hundred_user_num) > 0, sum(a.cost) / sum(a.hundred_user_num), 0), 4) as hundred_user_num_cost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	sum(first_role_num) as first_role_num, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    sum(new_user_total_role_num) as new_user_total_role_num 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 from 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 	ads_account_agent_day a 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 """; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1499,7 +1549,9 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 	round(if(sum(first_new_user_amount_count) > 0, sum(cost) / sum(first_new_user_amount_count), 0), 4) as first_recharge_count_cost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 	round(if(sum(new_user_total_amount_count) > 0, sum(cost) / sum(new_user_total_amount_count), 0), 4) as new_user_recharge_count_cost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 	sum(a.hundred_user_num) as hundred_user_num, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                	round(if(sum(a.hundred_user_num) > 0, sum(a.cost) / sum(a.hundred_user_num), 0), 4) as hundred_user_num_cost 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	round(if(sum(a.hundred_user_num) > 0, sum(a.cost) / sum(a.hundred_user_num), 0), 4) as hundred_user_num_cost, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                	sum(first_role_num) as first_role_num, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    sum(new_user_total_role_num) as new_user_total_role_num 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 from 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 	ads_account_agent_day a 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 """; 
			 |