|  | @@ -104,6 +104,10 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
 | 
	
		
			
				|  |  |              //将两个对象内容合并
 | 
	
		
			
				|  |  |              copyNullProperties(tempVO, vo);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +            //总充值次数成本
 | 
	
		
			
				|  |  | +            vo.setTotalAmountCountCost(vo.getTotalAmountCount() == 0L ? BigDecimal.ZERO :
 | 
	
		
			
				|  |  | +                    vo.getPromotionTotalCost().divide(BigDecimal.valueOf(vo.getTotalAmountCount()), 2, RoundingMode.HALF_UP));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              //计算d2(次日)数据
 | 
	
		
			
				|  |  |              vo.setD2Trend(PromotionRechargeTrendVO.builder()
 | 
	
		
			
				|  |  |                      .roi(vo.getTodayCost().compareTo(BigDecimal.ZERO) == 0 ? BigDecimal.ZERO :
 | 
	
	
		
			
				|  | @@ -291,6 +295,9 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
 | 
	
		
			
				|  |  |          //总付费成本
 | 
	
		
			
				|  |  |          vo.setTotalRechargeCost(vo.getTotalAmountNum() == 0L ? BigDecimal.ZERO :
 | 
	
		
			
				|  |  |                  vo.getPromotionTotalCost().divide(BigDecimal.valueOf(vo.getTotalAmountNum()), 2, RoundingMode.HALF_UP));
 | 
	
		
			
				|  |  | +        //总充值次数成本
 | 
	
		
			
				|  |  | +        vo.setTotalAmountCountCost(vo.getTotalAmountCount() == 0L ? BigDecimal.ZERO :
 | 
	
		
			
				|  |  | +                vo.getPromotionTotalCost().divide(BigDecimal.valueOf(vo.getTotalAmountCount()), 2, RoundingMode.HALF_UP));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //计算d2,d3,d7,d15数据
 | 
	
		
			
				|  |  |          //计算d2(次日)数据
 | 
	
	
		
			
				|  | @@ -487,7 +494,7 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
 | 
	
		
			
				|  |  |                  	round(if(SUM(click_count) > 0, SUM(today_cost) / SUM(click_count), 0), 2) as avg_click_cost,
 | 
	
		
			
				|  |  |                  	round(if(SUM(show_count) > 0, SUM(click_count) / SUM(show_count), 0), 4) as ctr,
 | 
	
		
			
				|  |  |                  	SUM(convert_count) as convert_count,
 | 
	
		
			
				|  |  | -                	SUM(convert_cost) as convert_cost,
 | 
	
		
			
				|  |  | +                	ROUND(IF(SUM(convert_count) > 0, SUM(today_cost) / SUM(convert_count), 0), 2) as convert_cost,
 | 
	
		
			
				|  |  |                  	round(if(SUM(click_count) > 0, SUM(convert_count) / SUM(click_count), 0), 4) as convert_rate,
 | 
	
		
			
				|  |  |                  	SUM(reg_num) as reg_num,
 | 
	
		
			
				|  |  |                  	SUM(first_role_num) as first_role_num,
 | 
	
	
		
			
				|  | @@ -547,9 +554,12 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
 | 
	
		
			
				|  |  |                      SUM(first_attribution_game_in_app_ltv1day) as first_attribution_game_in_app_ltv1day,
 | 
	
		
			
				|  |  |                      ROUND(IF(SUM(today_cost) > 0 , SUM(first_attribution_game_in_app_ltv1day) / SUM(today_cost), 0), 4) as first_attribution_game_in_app_roi1day,
 | 
	
		
			
				|  |  |                      SUM(game_pay_count) as game_pay_count,
 | 
	
		
			
				|  |  | +                    ROUND(IF(SUM(game_pay_count) > 0, SUM(today_cost) / SUM(game_pay_count), 0), 2) as game_pay_count_cost,
 | 
	
		
			
				|  |  |                      ROUND(IF(SUM(reg_num) > 0, SUM(first_attribution_game_in_app_ltv1day) / SUM(reg_num), 0), 2) as ltv_day1,
 | 
	
		
			
				|  |  | -                    (SUM(first_new_user_amount_count) - SUM(game_pay_count)) as sub_order_num,
 | 
	
		
			
				|  |  | -                    (SUM(first_new_user_amount) - SUM(first_attribution_game_in_app_ltv1day)) as sub_order_amount
 | 
	
		
			
				|  |  | +                    (SUM(first_new_user_amount_count) - SUM(first_sub_amount_count)) as sub_order_num,
 | 
	
		
			
				|  |  | +                    (SUM(first_new_user_amount) - SUM(first_sub_amount)) as sub_order_amount,
 | 
	
		
			
				|  |  | +                    ROUND(IF(SUM(first_new_user_amount_count) > 0, SUM(today_cost) / SUM(first_new_user_amount_count), 0), 2) as first_new_user_amount_count_cost,
 | 
	
		
			
				|  |  | +                    ROUND(IF(SUM(new_user_total_amount_count) > 0, SUM(today_cost) / SUM(new_user_total_amount_count), 0), 2) as new_user_total_amount_count_cost
 | 
	
		
			
				|  |  |                  FROM
 | 
	
		
			
				|  |  |                  	game_ads.ads_promotion_day
 | 
	
		
			
				|  |  |                  """;
 | 
	
	
		
			
				|  | @@ -606,7 +616,7 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
 | 
	
		
			
				|  |  |                  	round(if(SUM(click_count) > 0, SUM(today_cost) / SUM(click_count), 0), 2) as avg_click_cost,
 | 
	
		
			
				|  |  |                  	round(if(SUM(show_count) > 0, SUM(click_count) / SUM(show_count), 0), 4) as ctr,
 | 
	
		
			
				|  |  |                  	IFNULL(SUM(convert_count), 0) as convert_count,
 | 
	
		
			
				|  |  | -                	IFNULL(SUM(convert_cost), 0) as convert_cost,
 | 
	
		
			
				|  |  | +                	ROUND(IF(SUM(convert_count) > 0, SUM(today_cost) / SUM(convert_count), 0), 2) as convert_cost,
 | 
	
		
			
				|  |  |                  	round(if(SUM(click_count) > 0, SUM(convert_count) / SUM(click_count), 0), 4) as convert_rate,
 | 
	
		
			
				|  |  |                  	IFNULL(SUM(reg_num), 0) as reg_num,
 | 
	
		
			
				|  |  |                  	IFNULL(SUM(first_role_num), 0) as first_role_num,
 | 
	
	
		
			
				|  | @@ -666,9 +676,12 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
 | 
	
		
			
				|  |  |                      SUM(first_attribution_game_in_app_ltv1day) as first_attribution_game_in_app_ltv1day,
 | 
	
		
			
				|  |  |                      ROUND(IF(SUM(today_cost) > 0 , SUM(first_attribution_game_in_app_ltv1day) / SUM(today_cost), 0), 4) as first_attribution_game_in_app_roi1day,
 | 
	
		
			
				|  |  |                      SUM(game_pay_count) as game_pay_count,
 | 
	
		
			
				|  |  | +                    ROUND(IF(SUM(game_pay_count) > 0, SUM(today_cost) / SUM(game_pay_count), 0), 2) as game_pay_count_cost,
 | 
	
		
			
				|  |  |                      ROUND(IF(SUM(reg_num) > 0, SUM(first_attribution_game_in_app_ltv1day) / SUM(reg_num), 0), 2) as ltv_day1,
 | 
	
		
			
				|  |  | -                    (SUM(first_new_user_amount_count) - SUM(game_pay_count)) as sub_order_num,
 | 
	
		
			
				|  |  | -                    (SUM(first_new_user_amount) - SUM(first_attribution_game_in_app_ltv1day)) as sub_order_amount
 | 
	
		
			
				|  |  | +                    (SUM(first_new_user_amount_count) - SUM(first_sub_amount_count)) as sub_order_num,
 | 
	
		
			
				|  |  | +                    (SUM(first_new_user_amount) - SUM(first_sub_amount)) as sub_order_amount,
 | 
	
		
			
				|  |  | +                    ROUND(IF(SUM(first_new_user_amount_count) > 0, SUM(today_cost) / SUM(first_new_user_amount_count), 0), 2) as first_new_user_amount_count_cost,
 | 
	
		
			
				|  |  | +                    ROUND(IF(SUM(new_user_total_amount_count) > 0, SUM(today_cost) / SUM(new_user_total_amount_count), 0), 2) as new_user_total_amount_count_cost
 | 
	
		
			
				|  |  |                  FROM
 | 
	
		
			
				|  |  |                  	game_ads.ads_promotion_day
 | 
	
		
			
				|  |  |                  """;
 | 
	
	
		
			
				|  | @@ -710,4 +723,5 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
 | 
	
		
			
				|  |  |                  FROM
 | 
	
		
			
				|  |  |                  """;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  }
 |