|
@@ -1948,11 +1948,76 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
buy_amount_d27,
|
|
|
buy_amount_d28,
|
|
|
buy_amount_d29,
|
|
|
- buy_amount_m1,
|
|
|
- buy_amount_m2,
|
|
|
- buy_amount_m3,
|
|
|
+ buy_amount_d30,
|
|
|
+ buy_amount_d31,
|
|
|
+ buy_amount_d32,
|
|
|
+ buy_amount_d33,
|
|
|
+ buy_amount_d34,
|
|
|
+ buy_amount_d35,
|
|
|
+ buy_amount_d36,
|
|
|
+ buy_amount_d37,
|
|
|
+ buy_amount_d38,
|
|
|
+ buy_amount_d39,
|
|
|
+ buy_amount_d40,
|
|
|
+ buy_amount_d41,
|
|
|
+ buy_amount_d42,
|
|
|
+ buy_amount_d43,
|
|
|
+ buy_amount_d44,
|
|
|
+ buy_amount_d45,
|
|
|
+ buy_amount_d46,
|
|
|
+ buy_amount_d47,
|
|
|
+ buy_amount_d48,
|
|
|
+ buy_amount_d49,
|
|
|
+ buy_amount_d50,
|
|
|
+ buy_amount_d51,
|
|
|
+ buy_amount_d52,
|
|
|
+ buy_amount_d53,
|
|
|
+ buy_amount_d54,
|
|
|
+ buy_amount_d55,
|
|
|
+ buy_amount_d56,
|
|
|
+ buy_amount_d57,
|
|
|
+ buy_amount_d58,
|
|
|
+ buy_amount_d59,
|
|
|
+ buy_amount_d60,
|
|
|
+ buy_amount_d61,
|
|
|
+ buy_amount_d62,
|
|
|
+ buy_amount_d63,
|
|
|
+ buy_amount_d64,
|
|
|
+ buy_amount_d65,
|
|
|
+ buy_amount_d66,
|
|
|
+ buy_amount_d67,
|
|
|
+ buy_amount_d68,
|
|
|
+ buy_amount_d69,
|
|
|
+ buy_amount_d70,
|
|
|
+ buy_amount_d71,
|
|
|
+ buy_amount_d72,
|
|
|
+ buy_amount_d73,
|
|
|
+ buy_amount_d74,
|
|
|
+ buy_amount_d75,
|
|
|
+ buy_amount_d76,
|
|
|
+ buy_amount_d77,
|
|
|
+ buy_amount_d78,
|
|
|
+ buy_amount_d79,
|
|
|
+ buy_amount_d80,
|
|
|
+ buy_amount_d81,
|
|
|
+ buy_amount_d82,
|
|
|
+ buy_amount_d83,
|
|
|
+ buy_amount_d84,
|
|
|
+ buy_amount_d85,
|
|
|
+ buy_amount_d86,
|
|
|
+ buy_amount_d87,
|
|
|
+ buy_amount_d88,
|
|
|
+ buy_amount_d89,
|
|
|
+ buy_amount_d90,
|
|
|
+ buy_amount_m4,
|
|
|
+ buy_amount_m5,
|
|
|
buy_amount_m6,
|
|
|
- buy_amount_y1,
|
|
|
+ buy_amount_m7,
|
|
|
+ buy_amount_m8,
|
|
|
+ buy_amount_m9,
|
|
|
+ buy_amount_m10,
|
|
|
+ buy_amount_m11,
|
|
|
+ buy_amount_m12,
|
|
|
buy_amount_sum,
|
|
|
buy_reg_cost,
|
|
|
buy_first_amount_cost as buy_first_new_user_recharge_cost,
|
|
@@ -2023,11 +2088,76 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
nature_amount_d27,
|
|
|
nature_amount_d28,
|
|
|
nature_amount_d29,
|
|
|
- nature_amount_m1,
|
|
|
- nature_amount_m2,
|
|
|
- nature_amount_m3,
|
|
|
+ nature_amount_d30,
|
|
|
+ nature_amount_d31,
|
|
|
+ nature_amount_d32,
|
|
|
+ nature_amount_d33,
|
|
|
+ nature_amount_d34,
|
|
|
+ nature_amount_d35,
|
|
|
+ nature_amount_d36,
|
|
|
+ nature_amount_d37,
|
|
|
+ nature_amount_d38,
|
|
|
+ nature_amount_d39,
|
|
|
+ nature_amount_d40,
|
|
|
+ nature_amount_d41,
|
|
|
+ nature_amount_d42,
|
|
|
+ nature_amount_d43,
|
|
|
+ nature_amount_d44,
|
|
|
+ nature_amount_d45,
|
|
|
+ nature_amount_d46,
|
|
|
+ nature_amount_d47,
|
|
|
+ nature_amount_d48,
|
|
|
+ nature_amount_d49,
|
|
|
+ nature_amount_d50,
|
|
|
+ nature_amount_d51,
|
|
|
+ nature_amount_d52,
|
|
|
+ nature_amount_d53,
|
|
|
+ nature_amount_d54,
|
|
|
+ nature_amount_d55,
|
|
|
+ nature_amount_d56,
|
|
|
+ nature_amount_d57,
|
|
|
+ nature_amount_d58,
|
|
|
+ nature_amount_d59,
|
|
|
+ nature_amount_d60,
|
|
|
+ nature_amount_d61,
|
|
|
+ nature_amount_d62,
|
|
|
+ nature_amount_d63,
|
|
|
+ nature_amount_d64,
|
|
|
+ nature_amount_d65,
|
|
|
+ nature_amount_d66,
|
|
|
+ nature_amount_d67,
|
|
|
+ nature_amount_d68,
|
|
|
+ nature_amount_d69,
|
|
|
+ nature_amount_d70,
|
|
|
+ nature_amount_d71,
|
|
|
+ nature_amount_d72,
|
|
|
+ nature_amount_d73,
|
|
|
+ nature_amount_d74,
|
|
|
+ nature_amount_d75,
|
|
|
+ nature_amount_d76,
|
|
|
+ nature_amount_d77,
|
|
|
+ nature_amount_d78,
|
|
|
+ nature_amount_d79,
|
|
|
+ nature_amount_d80,
|
|
|
+ nature_amount_d81,
|
|
|
+ nature_amount_d82,
|
|
|
+ nature_amount_d83,
|
|
|
+ nature_amount_d84,
|
|
|
+ nature_amount_d85,
|
|
|
+ nature_amount_d86,
|
|
|
+ nature_amount_d87,
|
|
|
+ nature_amount_d88,
|
|
|
+ nature_amount_d89,
|
|
|
+ nature_amount_d90,
|
|
|
+ nature_amount_m4,
|
|
|
+ nature_amount_m5,
|
|
|
nature_amount_m6,
|
|
|
- nature_amount_y1,
|
|
|
+ nature_amount_m7,
|
|
|
+ nature_amount_m8,
|
|
|
+ nature_amount_m9,
|
|
|
+ nature_amount_m10,
|
|
|
+ nature_amount_m11,
|
|
|
+ nature_amount_m12,
|
|
|
nature_amount_sum,
|
|
|
nature_reg_cost,
|
|
|
nature_first_amount_cost as nature_first_new_user_recharge_cost,
|
|
@@ -2098,11 +2228,76 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
amount_d27,
|
|
|
amount_d28,
|
|
|
amount_d29,
|
|
|
- amount_m1,
|
|
|
- amount_m2,
|
|
|
- amount_m3,
|
|
|
+ amount_d30,
|
|
|
+ amount_d31,
|
|
|
+ amount_d32,
|
|
|
+ amount_d33,
|
|
|
+ amount_d34,
|
|
|
+ amount_d35,
|
|
|
+ amount_d36,
|
|
|
+ amount_d37,
|
|
|
+ amount_d38,
|
|
|
+ amount_d39,
|
|
|
+ amount_d40,
|
|
|
+ amount_d41,
|
|
|
+ amount_d42,
|
|
|
+ amount_d43,
|
|
|
+ amount_d44,
|
|
|
+ amount_d45,
|
|
|
+ amount_d46,
|
|
|
+ amount_d47,
|
|
|
+ amount_d48,
|
|
|
+ amount_d49,
|
|
|
+ amount_d50,
|
|
|
+ amount_d51,
|
|
|
+ amount_d52,
|
|
|
+ amount_d53,
|
|
|
+ amount_d54,
|
|
|
+ amount_d55,
|
|
|
+ amount_d56,
|
|
|
+ amount_d57,
|
|
|
+ amount_d58,
|
|
|
+ amount_d59,
|
|
|
+ amount_d60,
|
|
|
+ amount_d61,
|
|
|
+ amount_d62,
|
|
|
+ amount_d63,
|
|
|
+ amount_d64,
|
|
|
+ amount_d65,
|
|
|
+ amount_d66,
|
|
|
+ amount_d67,
|
|
|
+ amount_d68,
|
|
|
+ amount_d69,
|
|
|
+ amount_d70,
|
|
|
+ amount_d71,
|
|
|
+ amount_d72,
|
|
|
+ amount_d73,
|
|
|
+ amount_d74,
|
|
|
+ amount_d75,
|
|
|
+ amount_d76,
|
|
|
+ amount_d77,
|
|
|
+ amount_d78,
|
|
|
+ amount_d79,
|
|
|
+ amount_d80,
|
|
|
+ amount_d81,
|
|
|
+ amount_d82,
|
|
|
+ amount_d83,
|
|
|
+ amount_d84,
|
|
|
+ amount_d85,
|
|
|
+ amount_d86,
|
|
|
+ amount_d87,
|
|
|
+ amount_d88,
|
|
|
+ amount_d89,
|
|
|
+ amount_d90,
|
|
|
+ amount_m4,
|
|
|
+ amount_m5,
|
|
|
amount_m6,
|
|
|
- amount_y1,
|
|
|
+ amount_m7,
|
|
|
+ amount_m8,
|
|
|
+ amount_m9,
|
|
|
+ amount_m10,
|
|
|
+ amount_m11,
|
|
|
+ amount_m12,
|
|
|
amount_sum,
|
|
|
reg_cost,
|
|
|
first_amount_cost as first_new_user_recharge_cost,
|
|
@@ -2132,272 +2327,139 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
private String gameDataDayTotalSql() {
|
|
|
return """
|
|
|
SELECT
|
|
|
- IFNULL(SUM(cost), 0) cost,
|
|
|
-
|
|
|
- IFNULL(SUM(buy_reg_num), 0) buy_reg_num,
|
|
|
- IFNULL(SUM(nature_reg_num), 0) nature_reg_num,
|
|
|
- IFNULL(SUM(reg_num), 0) reg_num,
|
|
|
-
|
|
|
- """
|
|
|
- + amountDay("buy_") +
|
|
|
- """
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now() , CAST(SPLIT_PART(buy_amount_m1 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_m1, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_m1, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now(), CAST(SPLIT_PART(buy_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS buy_amount_m1,
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now() , CAST(SPLIT_PART(buy_amount_m2 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_m2, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_m2, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now(), CAST(SPLIT_PART(buy_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS buy_amount_m2,
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now() , CAST(SPLIT_PART(buy_amount_m3 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_m3, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_m3, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now(), CAST(SPLIT_PART(buy_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS buy_amount_m3,
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now() , CAST(SPLIT_PART(buy_amount_m6 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_m6, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_m6, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now(), CAST(SPLIT_PART(buy_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS buy_amount_m6,
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now() , CAST(SPLIT_PART(buy_amount_y1 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_y1, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_y1, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now(), CAST(SPLIT_PART(buy_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS buy_amount_y1,
|
|
|
- CONCAT(
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_sum , '/', 1) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_sum, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_sum, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(cost), '/',
|
|
|
- SUM(CAST(SPLIT_PART(buy_amount_d1 , '/', 1) AS DECIMAL(10, 2)))
|
|
|
- ) AS buy_amount_sum,
|
|
|
- IFNULL(SUM(buy_first_new_user_amount_count), 0) buy_first_new_user_amount_count,
|
|
|
- IFNULL(SUM(buy_first_new_user_amount_num), 0) buy_first_new_user_amount_num,
|
|
|
- IFNULL(SUM(buy_first_new_user_amount), 0) buy_first_new_user_amount,
|
|
|
- IFNULL(SUM(buy_old_user_count), 0) buy_old_user_count,
|
|
|
- IFNULL(SUM(buy_old_user_num), 0) buy_old_user_num,
|
|
|
- IFNULL(SUM(buy_old_user_amount), 0) buy_old_user_amount,
|
|
|
- IFNULL(SUM(buy_amount_count), 0) buy_amount_count,
|
|
|
- IFNULL(SUM(buy_amount_num), 0) buy_amount_num,
|
|
|
- IFNULL(SUM(buy_amount), 0) buy_amount,
|
|
|
- IFNULL(SUM(buy_new_user_total_amount_count), 0) buy_new_user_total_amount_count,
|
|
|
- IFNULL(SUM(buy_new_user_total_amount_num), 0) buy_new_user_total_amount_num,
|
|
|
- IFNULL(SUM(buy_new_user_total_amount), 0) buy_new_user_total_amount,
|
|
|
- round(if(SUM(cost) > 0 , SUM(buy_first_new_user_amount) / SUM(cost) ,0), 4) buy_first_roi,
|
|
|
- round(if(SUM(buy_reg_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_reg_num) ,0), 4) buy_first_amount_rate,
|
|
|
- round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount_num) / SUM(buy_reg_num), 0) ,4) buy_today_amount_rate,
|
|
|
- round(if(SUM(buy_amount_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_amount_num) ,0), 4) buy_new_user_rate,
|
|
|
- round(if(SUM(buy_first_new_user_amount_count) > 0, SUM(buy_first_new_user_amount) / SUM(buy_first_new_user_amount_count), 0), 2) buy_first_avg_amount,
|
|
|
- round(if(SUM(buy_new_user_total_amount_count) > 0, SUM(buy_new_user_total_amount) / SUM(buy_new_user_total_amount_count), 0), 2) buy_today_avg_amount,
|
|
|
- round(if(SUM(buy_amount_count) > 0, SUM(buy_amount) / SUM(buy_amount_count), 0), 2) buy_avg_amount,
|
|
|
- round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(buy_reg_order_user_again) / SUM(buy_new_user_total_amount_num), 0), 4) buy_user_again_rate,
|
|
|
- round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount) / SUM(buy_reg_num), 0), 2) buy_reg_user_arpu,
|
|
|
- round(if(SUM(buy_first_new_user_amount_num) > 0 , SUM(buy_first_new_user_amount) / SUM(buy_first_new_user_amount_num), 0), 2) buy_first_amount_arpu,
|
|
|
- round(if(SUM(buy_new_user_total_amount_num) > 0 , SUM(buy_new_user_total_amount) / SUM(buy_new_user_total_amount_num), 0), 2) buy_today_amount_arpu,
|
|
|
- round(if(SUM(buy_amount_num) > 0, SUM(buy_amount) / SUM(buy_amount_num), 0), 2) buy_amount_arpu,
|
|
|
- round(if(SUM(buy_reg_num) > 0, SUM(cost) / SUM(buy_reg_num), 0), 2) buy_reg_cost,
|
|
|
- round(if(SUM(buy_first_new_user_amount_num) > 0, SUM(cost) / SUM(buy_first_new_user_amount_num), 0), 2) buy_first_new_user_recharge_cost,
|
|
|
- round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(cost) / SUM(buy_new_user_total_amount_num), 0), 2) buy_total_recharge_cost,
|
|
|
- round(if(SUM(cost) > 0, SUM(buy_new_user_total_amount) / SUM(cost), 0), 4) buy_total_roi,
|
|
|
- SUM(buy_hundred_user_num) buy_hundred_user_num,
|
|
|
- round(IF(SUM(buy_hundred_user_num) > 0, SUM(cost) / SUM(buy_hundred_user_num), 0), 2) buy_hundred_user_num_cost,
|
|
|
- SUM(buy_first_role_num) buy_first_role_num,
|
|
|
- SUM(buy_role_num) buy_role_num,
|
|
|
- SUM(buy_new_user_total_role_num) buy_new_user_total_role_num,
|
|
|
- round(IF(SUM(buy_first_role_num) > 0, SUM(cost) / SUM(buy_first_role_num), 0), 2) buy_first_role_num_cost,
|
|
|
- round(IF(SUM(buy_role_num) > 0, SUM(cost) / SUM(buy_role_num), 0), 2) buy_role_num_cost,
|
|
|
- round(IF(SUM(buy_new_user_total_role_num) >0, SUM(cost) / SUM(buy_new_user_total_role_num), 0), 2) buy_new_user_total_role_num_cost,
|
|
|
- round(IF(SUM(buy_reg_num) >0, SUM(buy_first_role_num) / SUM(buy_reg_num), 0), 4) buy_first_role_num_rate,
|
|
|
- round(IF(SUM(buy_reg_num) >0, SUM(buy_role_num) / SUM(buy_reg_num), 0), 4) buy_role_num_rate,
|
|
|
- round(IF(SUM(buy_reg_num) >0, SUM(buy_new_user_total_role_num) / SUM(buy_reg_num), 0), 4) buy_new_user_total_role_num_rate,
|
|
|
-
|
|
|
- """
|
|
|
- + amountDay("nature_") +
|
|
|
- """
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now() , CAST(SPLIT_PART(nature_amount_m1 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_m1, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_m1, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now(), CAST(SPLIT_PART(nature_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS nature_amount_m1,
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now() , CAST(SPLIT_PART(nature_amount_m2 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_m2, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_m2, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now(), CAST(SPLIT_PART(nature_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS nature_amount_m2,
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now() , CAST(SPLIT_PART(nature_amount_m3 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_m3, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_m3, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now(), CAST(SPLIT_PART(nature_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS nature_amount_m3,
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now() , CAST(SPLIT_PART(nature_amount_m6 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_m6, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_m6, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now(), CAST(SPLIT_PART(nature_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS nature_amount_m6,
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now() , CAST(SPLIT_PART(nature_amount_y1 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_y1, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_y1, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now(), CAST(SPLIT_PART(nature_amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS nature_amount_y1,
|
|
|
- CONCAT(
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_sum , '/', 1) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_sum, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_sum, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(cost), '/',
|
|
|
- SUM(CAST(SPLIT_PART(nature_amount_d1 , '/', 1) AS DECIMAL(10, 2)))
|
|
|
- ) AS nature_amount_sum,
|
|
|
- IFNULL(SUM(nature_first_new_user_amount_count), 0) nature_first_new_user_amount_count,
|
|
|
- IFNULL(SUM(nature_first_new_user_amount_num), 0) nature_first_new_user_amount_num,
|
|
|
- IFNULL(SUM(nature_first_new_user_amount), 0) nature_first_new_user_amount,
|
|
|
- IFNULL(SUM(nature_old_user_count), 0) nature_old_user_count,
|
|
|
- IFNULL(SUM(nature_old_user_num), 0) nature_old_user_num,
|
|
|
- IFNULL(SUM(nature_old_user_amount), 0) nature_old_user_amount,
|
|
|
- IFNULL(SUM(nature_amount_count), 0) nature_amount_count,
|
|
|
- IFNULL(SUM(nature_amount_num), 0) nature_amount_num,
|
|
|
- IFNULL(SUM(nature_amount), 0) nature_amount,
|
|
|
- IFNULL(SUM(nature_new_user_total_amount_count), 0) nature_new_user_total_amount_count,
|
|
|
- IFNULL(SUM(nature_new_user_total_amount_num), 0) nature_new_user_total_amount_num,
|
|
|
- IFNULL(SUM(nature_new_user_total_amount), 0) nature_new_user_total_amount,
|
|
|
- round(if(SUM(cost) > 0 , SUM(nature_first_new_user_amount) / SUM(cost) ,0), 4) nature_first_roi,
|
|
|
- round(if(SUM(nature_reg_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_reg_num) ,0), 4) nature_first_amount_rate,
|
|
|
- round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount_num) / SUM(nature_reg_num), 0) ,4) nature_today_amount_rate,
|
|
|
- round(if(SUM(nature_amount_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_amount_num) ,0), 4) nature_new_user_rate,
|
|
|
- round(if(SUM(nature_first_new_user_amount_count) > 0, SUM(nature_first_new_user_amount) / SUM(nature_first_new_user_amount_count), 0), 2) nature_first_avg_amount,
|
|
|
- round(if(SUM(nature_new_user_total_amount_count) > 0, SUM(nature_new_user_total_amount) / SUM(nature_new_user_total_amount_count), 0), 2) nature_today_avg_amount,
|
|
|
- round(if(SUM(nature_amount_count) > 0, SUM(nature_amount) / SUM(nature_amount_count), 0), 2) nature_avg_amount,
|
|
|
- round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(nature_reg_order_user_again) / SUM(nature_new_user_total_amount_num), 0), 4) nature_user_again_rate,
|
|
|
- round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount) / SUM(nature_reg_num), 0), 2) nature_reg_user_arpu,
|
|
|
- round(if(SUM(nature_first_new_user_amount_num) > 0 , SUM(nature_first_new_user_amount) / SUM(nature_first_new_user_amount_num), 0), 2) nature_first_amount_arpu,
|
|
|
- round(if(SUM(nature_new_user_total_amount_num) > 0 , SUM(nature_new_user_total_amount) / SUM(nature_new_user_total_amount_num), 0), 2) nature_today_amount_arpu,
|
|
|
- round(if(SUM(nature_amount_num) > 0, SUM(nature_amount) / SUM(nature_amount_num), 0), 2) nature_amount_arpu,
|
|
|
- round(if(SUM(nature_reg_num) > 0, SUM(cost) / SUM(nature_reg_num), 0), 2) nature_reg_cost,
|
|
|
- round(if(SUM(nature_first_new_user_amount_num) > 0, SUM(cost) / SUM(nature_first_new_user_amount_num), 0), 2) nature_first_new_user_recharge_cost,
|
|
|
- round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(cost) / SUM(nature_new_user_total_amount_num), 0), 2) nature_total_recharge_cost,
|
|
|
- round(if(SUM(cost) > 0, SUM(nature_new_user_total_amount) / SUM(cost), 0), 4) nature_total_roi,
|
|
|
- SUM(nature_hundred_user_num) nature_hundred_user_num,
|
|
|
- round(IF(SUM(nature_hundred_user_num) > 0, SUM(cost) / SUM(nature_hundred_user_num), 0), 2) nature_hundred_user_num_cost,
|
|
|
- SUM(nature_first_role_num) nature_first_role_num,
|
|
|
- SUM(nature_role_num) nature_role_num,
|
|
|
- SUM(nature_new_user_total_role_num) nature_new_user_total_role_num,
|
|
|
- round(IF(SUM(nature_first_role_num) > 0, SUM(cost) / SUM(nature_first_role_num), 0), 2) nature_first_role_num_cost,
|
|
|
- round(IF(SUM(nature_role_num) > 0, SUM(cost) / SUM(nature_role_num), 0), 2) nature_role_num_cost,
|
|
|
- round(IF(SUM(nature_new_user_total_role_num) >0, SUM(cost) / SUM(nature_new_user_total_role_num), 0), 2) nature_new_user_total_role_num_cost,
|
|
|
- round(IF(SUM(nature_reg_num) >0, SUM(nature_first_role_num) / SUM(nature_reg_num), 0), 4) nature_first_role_num_rate,
|
|
|
- round(IF(SUM(nature_reg_num) >0, SUM(nature_role_num) / SUM(nature_reg_num), 0), 4) nature_role_num_rate,
|
|
|
- round(IF(SUM(nature_reg_num) >0, SUM(nature_new_user_total_role_num) / SUM(nature_reg_num), 0), 4) nature_new_user_total_role_num_rate,
|
|
|
-
|
|
|
- """
|
|
|
- + amountDay("") +
|
|
|
- """
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now() , CAST(SPLIT_PART(amount_m1 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(amount_m1, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(amount_m1, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 29 day) <= LocalDate.now(), CAST(SPLIT_PART(amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS amount_m1,
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now() , CAST(SPLIT_PART(amount_m2 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(amount_m2, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(amount_m2, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 59 day) <= LocalDate.now(), CAST(SPLIT_PART(amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS amount_m2,
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now() , CAST(SPLIT_PART(amount_m3 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(amount_m3, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(amount_m3, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 89 day) <= LocalDate.now(), CAST(SPLIT_PART(amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS amount_m3,
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now() , CAST(SPLIT_PART(amount_m6 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(amount_m6, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(amount_m6, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 179 day) <= LocalDate.now(), CAST(SPLIT_PART(amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS amount_m6,
|
|
|
- CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now() , CAST(SPLIT_PART(amount_y1 , '/', 1) AS DECIMAL(10, 2)), 0 )), '/',
|
|
|
- SUM(CAST(SPLIT_PART(amount_y1, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(amount_y1, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now(), cost, 0)), '/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL 1 year) <= LocalDate.now(), CAST(SPLIT_PART(amount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
- ) AS amount_y1,
|
|
|
- CONCAT(
|
|
|
- SUM(CAST(SPLIT_PART(amount_sum , '/', 1) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(amount_sum, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
- SUM(CAST(SPLIT_PART(amount_sum, '/', 2) AS BIGINT)), '/',
|
|
|
- SUM(cost), '/',
|
|
|
- SUM(CAST(SPLIT_PART(amount_d1 , '/', 1) AS DECIMAL(10, 2)))
|
|
|
- ) AS amount_sum,
|
|
|
- IFNULL(SUM(first_new_user_amount_count), 0) first_new_user_amount_count,
|
|
|
- IFNULL(SUM(first_new_user_amount_num), 0) first_new_user_amount_num,
|
|
|
- IFNULL(SUM(first_new_user_amount), 0) first_new_user_amount,
|
|
|
- IFNULL(SUM(old_user_count), 0) old_user_count,
|
|
|
- IFNULL(SUM(old_user_num), 0) old_user_num,
|
|
|
- IFNULL(SUM(old_user_amount), 0) old_user_amount,
|
|
|
- IFNULL(SUM(amount_count), 0) amount_count,
|
|
|
- IFNULL(SUM(amount_num), 0) amount_num,
|
|
|
- IFNULL(SUM(amount), 0) amount,
|
|
|
- IFNULL(SUM(new_user_total_amount_count), 0) new_user_total_amount_count,
|
|
|
- IFNULL(SUM(new_user_total_amount_num), 0) new_user_total_amount_num,
|
|
|
- IFNULL(SUM(new_user_total_amount), 0) new_user_total_amount,
|
|
|
- round(if(SUM(cost) > 0 , SUM(first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
|
|
|
- round(if(SUM(reg_num) > 0 , SUM(first_new_user_amount_num) / SUM(reg_num) ,0), 4) first_amount_rate,
|
|
|
- round(if(SUM(reg_num) > 0, SUM(new_user_total_amount_num) / SUM(reg_num), 0) ,4) today_amount_rate,
|
|
|
- round(if(SUM(amount_num) > 0 , SUM(first_new_user_amount_num) / SUM(amount_num) ,0), 4) new_user_rate,
|
|
|
- round(if(SUM(first_new_user_amount_count) > 0, SUM(first_new_user_amount) / SUM(first_new_user_amount_count), 0), 2) first_avg_amount,
|
|
|
- round(if(SUM(new_user_total_amount_count) > 0, SUM(new_user_total_amount) / SUM(new_user_total_amount_count), 0), 2) today_avg_amount,
|
|
|
- round(if(SUM(amount_count) > 0, SUM(amount) / SUM(amount_count), 0), 2) avg_amount,
|
|
|
- round(if(SUM(new_user_total_amount_num) > 0, SUM(reg_order_user_again) / SUM(new_user_total_amount_num), 0), 4) user_again_rate,
|
|
|
- round(if(SUM(reg_num) > 0, SUM(new_user_total_amount) / SUM(reg_num), 0), 2) reg_user_arpu,
|
|
|
- round(if(SUM(first_new_user_amount_num) > 0 , SUM(first_new_user_amount) / SUM(first_new_user_amount_num), 0), 2) first_amount_arpu,
|
|
|
- round(if(SUM(new_user_total_amount_num) > 0 , SUM(new_user_total_amount) / SUM(new_user_total_amount_num), 0), 2) today_amount_arpu,
|
|
|
- round(if(SUM(amount_num) > 0, SUM(amount) / SUM(amount_num), 0), 2) amount_arpu,
|
|
|
- round(if(SUM(reg_num) > 0, SUM(cost) / SUM(reg_num), 0), 2) reg_cost,
|
|
|
- round(if(SUM(first_new_user_amount_num) > 0, SUM(cost) / SUM(first_new_user_amount_num), 0), 2) first_new_user_recharge_cost,
|
|
|
- round(if(SUM(new_user_total_amount_num) > 0, SUM(cost) / SUM(new_user_total_amount_num), 0), 2) total_recharge_cost,
|
|
|
- round(if(SUM(cost) > 0, SUM(new_user_total_amount) / SUM(cost), 0), 4) total_roi,
|
|
|
- SUM(hundred_user_num) hundred_user_num,
|
|
|
- round(IF(SUM(hundred_user_num) > 0, SUM(cost) / SUM(hundred_user_num), 0), 2) hundred_user_num_cost,
|
|
|
- SUM(first_role_num) first_role_num,
|
|
|
- SUM(role_num) role_num,
|
|
|
- SUM(new_user_total_role_num) new_user_total_role_num,
|
|
|
- round(IF(SUM(first_role_num) > 0, SUM(cost) / SUM(first_role_num), 0), 2) first_role_num_cost,
|
|
|
- round(IF(SUM(role_num) > 0, SUM(cost) / SUM(role_num), 0), 2) role_num_cost,
|
|
|
- round(IF(SUM(new_user_total_role_num) >0, SUM(cost) / SUM(new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
|
|
|
- round(IF(SUM(reg_num) >0, SUM(first_role_num) / SUM(reg_num), 0), 4) first_role_num_rate,
|
|
|
- round(IF(SUM(reg_num) >0, SUM(role_num) / SUM(reg_num), 0), 4) role_num_rate,
|
|
|
- round(IF(SUM(reg_num) >0, SUM(new_user_total_role_num) / SUM(reg_num), 0), 4) new_user_total_role_num_rate
|
|
|
-
|
|
|
- FROM
|
|
|
- ads_game_day
|
|
|
-
|
|
|
-
|
|
|
- """;
|
|
|
+ IFNULL(SUM(cost), 0) cost,
|
|
|
+ IFNULL(SUM(buy_reg_num), 0) buy_reg_num,
|
|
|
+ IFNULL(SUM(nature_reg_num), 0) nature_reg_num,
|
|
|
+ IFNULL(SUM(reg_num), 0) reg_num,
|
|
|
+ """
|
|
|
+ + amountDay("buy_") +
|
|
|
+ """
|
|
|
+ IFNULL(SUM(buy_first_new_user_amount_count), 0) buy_first_new_user_amount_count,
|
|
|
+ IFNULL(SUM(buy_first_new_user_amount_num), 0) buy_first_new_user_amount_num,
|
|
|
+ IFNULL(SUM(buy_first_new_user_amount), 0) buy_first_new_user_amount,
|
|
|
+ IFNULL(SUM(buy_old_user_count), 0) buy_old_user_count,
|
|
|
+ IFNULL(SUM(buy_old_user_num), 0) buy_old_user_num,
|
|
|
+ IFNULL(SUM(buy_old_user_amount), 0) buy_old_user_amount,
|
|
|
+ IFNULL(SUM(buy_amount_count), 0) buy_amount_count,
|
|
|
+ IFNULL(SUM(buy_amount_num), 0) buy_amount_num,
|
|
|
+ IFNULL(SUM(buy_amount), 0) buy_amount,
|
|
|
+ IFNULL(SUM(buy_new_user_total_amount_count), 0) buy_new_user_total_amount_count,
|
|
|
+ IFNULL(SUM(buy_new_user_total_amount_num), 0) buy_new_user_total_amount_num,
|
|
|
+ IFNULL(SUM(buy_new_user_total_amount), 0) buy_new_user_total_amount,
|
|
|
+ round(if(SUM(cost) > 0 , SUM(buy_first_new_user_amount) / SUM(cost) ,0), 4) buy_first_roi,
|
|
|
+ round(if(SUM(buy_reg_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_reg_num) ,0), 4) buy_first_amount_rate,
|
|
|
+ round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount_num) / SUM(buy_reg_num), 0) ,4) buy_today_amount_rate,
|
|
|
+ round(if(SUM(buy_amount_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_amount_num) ,0), 4) buy_new_user_rate,
|
|
|
+ round(if(SUM(buy_first_new_user_amount_count) > 0, SUM(buy_first_new_user_amount) / SUM(buy_first_new_user_amount_count), 0), 2) buy_first_avg_amount,
|
|
|
+ round(if(SUM(buy_new_user_total_amount_count) > 0, SUM(buy_new_user_total_amount) / SUM(buy_new_user_total_amount_count), 0), 2) buy_today_avg_amount,
|
|
|
+ round(if(SUM(buy_amount_count) > 0, SUM(buy_amount) / SUM(buy_amount_count), 0), 2) buy_avg_amount,
|
|
|
+ round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(buy_reg_order_user_again) / SUM(buy_new_user_total_amount_num), 0), 4) buy_user_again_rate,
|
|
|
+ round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount) / SUM(buy_reg_num), 0), 2) buy_reg_user_arpu,
|
|
|
+ round(if(SUM(buy_first_new_user_amount_num) > 0 , SUM(buy_first_new_user_amount) / SUM(buy_first_new_user_amount_num), 0), 2) buy_first_amount_arpu,
|
|
|
+ round(if(SUM(buy_new_user_total_amount_num) > 0 , SUM(buy_new_user_total_amount) / SUM(buy_new_user_total_amount_num), 0), 2) buy_today_amount_arpu,
|
|
|
+ round(if(SUM(buy_amount_num) > 0, SUM(buy_amount) / SUM(buy_amount_num), 0), 2) buy_amount_arpu,
|
|
|
+ round(if(SUM(buy_reg_num) > 0, SUM(cost) / SUM(buy_reg_num), 0), 2) buy_reg_cost,
|
|
|
+ round(if(SUM(buy_first_new_user_amount_num) > 0, SUM(cost) / SUM(buy_first_new_user_amount_num), 0), 2) buy_first_new_user_recharge_cost,
|
|
|
+ round(if(SUM(buy_new_user_total_amount_num) > 0, SUM(cost) / SUM(buy_new_user_total_amount_num), 0), 2) buy_total_recharge_cost,
|
|
|
+ round(if(SUM(cost) > 0, SUM(buy_new_user_total_amount) / SUM(cost), 0), 4) buy_total_roi,
|
|
|
+ SUM(buy_hundred_user_num) buy_hundred_user_num,
|
|
|
+ round(IF(SUM(buy_hundred_user_num) > 0, SUM(cost) / SUM(buy_hundred_user_num), 0), 2) buy_hundred_user_num_cost,
|
|
|
+ SUM(buy_first_role_num) buy_first_role_num,
|
|
|
+ SUM(buy_role_num) buy_role_num,
|
|
|
+ SUM(buy_new_user_total_role_num) buy_new_user_total_role_num,
|
|
|
+ round(IF(SUM(buy_first_role_num) > 0, SUM(cost) / SUM(buy_first_role_num), 0), 2) buy_first_role_num_cost,
|
|
|
+ round(IF(SUM(buy_role_num) > 0, SUM(cost) / SUM(buy_role_num), 0), 2) buy_role_num_cost,
|
|
|
+ round(IF(SUM(buy_new_user_total_role_num) >0, SUM(cost) / SUM(buy_new_user_total_role_num), 0), 2) buy_new_user_total_role_num_cost,
|
|
|
+ round(IF(SUM(buy_reg_num) >0, SUM(buy_first_role_num) / SUM(buy_reg_num), 0), 4) buy_first_role_num_rate,
|
|
|
+ round(IF(SUM(buy_reg_num) >0, SUM(buy_role_num) / SUM(buy_reg_num), 0), 4) buy_role_num_rate,
|
|
|
+ round(IF(SUM(buy_reg_num) >0, SUM(buy_new_user_total_role_num) / SUM(buy_reg_num), 0), 4) buy_new_user_total_role_num_rate,
|
|
|
+ """
|
|
|
+ + amountDay("nature_") +
|
|
|
+ """
|
|
|
+ IFNULL(SUM(nature_first_new_user_amount_count), 0) nature_first_new_user_amount_count,
|
|
|
+ IFNULL(SUM(nature_first_new_user_amount_num), 0) nature_first_new_user_amount_num,
|
|
|
+ IFNULL(SUM(nature_first_new_user_amount), 0) nature_first_new_user_amount,
|
|
|
+ IFNULL(SUM(nature_old_user_count), 0) nature_old_user_count,
|
|
|
+ IFNULL(SUM(nature_old_user_num), 0) nature_old_user_num,
|
|
|
+ IFNULL(SUM(nature_old_user_amount), 0) nature_old_user_amount,
|
|
|
+ IFNULL(SUM(nature_amount_count), 0) nature_amount_count,
|
|
|
+ IFNULL(SUM(nature_amount_num), 0) nature_amount_num,
|
|
|
+ IFNULL(SUM(nature_amount), 0) nature_amount,
|
|
|
+ IFNULL(SUM(nature_new_user_total_amount_count), 0) nature_new_user_total_amount_count,
|
|
|
+ IFNULL(SUM(nature_new_user_total_amount_num), 0) nature_new_user_total_amount_num,
|
|
|
+ IFNULL(SUM(nature_new_user_total_amount), 0) nature_new_user_total_amount,
|
|
|
+ round(if(SUM(cost) > 0 , SUM(nature_first_new_user_amount) / SUM(cost) ,0), 4) nature_first_roi,
|
|
|
+ round(if(SUM(nature_reg_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_reg_num) ,0), 4) nature_first_amount_rate,
|
|
|
+ round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount_num) / SUM(nature_reg_num), 0) ,4) nature_today_amount_rate,
|
|
|
+ round(if(SUM(nature_amount_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_amount_num) ,0), 4) nature_new_user_rate,
|
|
|
+ round(if(SUM(nature_first_new_user_amount_count) > 0, SUM(nature_first_new_user_amount) / SUM(nature_first_new_user_amount_count), 0), 2) nature_first_avg_amount,
|
|
|
+ round(if(SUM(nature_new_user_total_amount_count) > 0, SUM(nature_new_user_total_amount) / SUM(nature_new_user_total_amount_count), 0), 2) nature_today_avg_amount,
|
|
|
+ round(if(SUM(nature_amount_count) > 0, SUM(nature_amount) / SUM(nature_amount_count), 0), 2) nature_avg_amount,
|
|
|
+ round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(nature_reg_order_user_again) / SUM(nature_new_user_total_amount_num), 0), 4) nature_user_again_rate,
|
|
|
+ round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount) / SUM(nature_reg_num), 0), 2) nature_reg_user_arpu,
|
|
|
+ round(if(SUM(nature_first_new_user_amount_num) > 0 , SUM(nature_first_new_user_amount) / SUM(nature_first_new_user_amount_num), 0), 2) nature_first_amount_arpu,
|
|
|
+ round(if(SUM(nature_new_user_total_amount_num) > 0 , SUM(nature_new_user_total_amount) / SUM(nature_new_user_total_amount_num), 0), 2) nature_today_amount_arpu,
|
|
|
+ round(if(SUM(nature_amount_num) > 0, SUM(nature_amount) / SUM(nature_amount_num), 0), 2) nature_amount_arpu,
|
|
|
+ round(if(SUM(nature_reg_num) > 0, SUM(cost) / SUM(nature_reg_num), 0), 2) nature_reg_cost,
|
|
|
+ round(if(SUM(nature_first_new_user_amount_num) > 0, SUM(cost) / SUM(nature_first_new_user_amount_num), 0), 2) nature_first_new_user_recharge_cost,
|
|
|
+ round(if(SUM(nature_new_user_total_amount_num) > 0, SUM(cost) / SUM(nature_new_user_total_amount_num), 0), 2) nature_total_recharge_cost,
|
|
|
+ round(if(SUM(cost) > 0, SUM(nature_new_user_total_amount) / SUM(cost), 0), 4) nature_total_roi,
|
|
|
+ SUM(nature_hundred_user_num) nature_hundred_user_num,
|
|
|
+ round(IF(SUM(nature_hundred_user_num) > 0, SUM(cost) / SUM(nature_hundred_user_num), 0), 2) nature_hundred_user_num_cost,
|
|
|
+ SUM(nature_first_role_num) nature_first_role_num,
|
|
|
+ SUM(nature_role_num) nature_role_num,
|
|
|
+ SUM(nature_new_user_total_role_num) nature_new_user_total_role_num,
|
|
|
+ round(IF(SUM(nature_first_role_num) > 0, SUM(cost) / SUM(nature_first_role_num), 0), 2) nature_first_role_num_cost,
|
|
|
+ round(IF(SUM(nature_role_num) > 0, SUM(cost) / SUM(nature_role_num), 0), 2) nature_role_num_cost,
|
|
|
+ round(IF(SUM(nature_new_user_total_role_num) >0, SUM(cost) / SUM(nature_new_user_total_role_num), 0), 2) nature_new_user_total_role_num_cost,
|
|
|
+ round(IF(SUM(nature_reg_num) >0, SUM(nature_first_role_num) / SUM(nature_reg_num), 0), 4) nature_first_role_num_rate,
|
|
|
+ round(IF(SUM(nature_reg_num) >0, SUM(nature_role_num) / SUM(nature_reg_num), 0), 4) nature_role_num_rate,
|
|
|
+ round(IF(SUM(nature_reg_num) >0, SUM(nature_new_user_total_role_num) / SUM(nature_reg_num), 0), 4) nature_new_user_total_role_num_rate,
|
|
|
+ """
|
|
|
+ + amountDay("") +
|
|
|
+ """
|
|
|
+ IFNULL(SUM(first_new_user_amount_count), 0) first_new_user_amount_count,
|
|
|
+ IFNULL(SUM(first_new_user_amount_num), 0) first_new_user_amount_num,
|
|
|
+ IFNULL(SUM(first_new_user_amount), 0) first_new_user_amount,
|
|
|
+ IFNULL(SUM(old_user_count), 0) old_user_count,
|
|
|
+ IFNULL(SUM(old_user_num), 0) old_user_num,
|
|
|
+ IFNULL(SUM(old_user_amount), 0) old_user_amount,
|
|
|
+ IFNULL(SUM(amount_count), 0) amount_count,
|
|
|
+ IFNULL(SUM(amount_num), 0) amount_num,
|
|
|
+ IFNULL(SUM(amount), 0) amount,
|
|
|
+ IFNULL(SUM(new_user_total_amount_count), 0) new_user_total_amount_count,
|
|
|
+ IFNULL(SUM(new_user_total_amount_num), 0) new_user_total_amount_num,
|
|
|
+ IFNULL(SUM(new_user_total_amount), 0) new_user_total_amount,
|
|
|
+ round(if(SUM(cost) > 0 , SUM(first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
|
|
|
+ round(if(SUM(reg_num) > 0 , SUM(first_new_user_amount_num) / SUM(reg_num) ,0), 4) first_amount_rate,
|
|
|
+ round(if(SUM(reg_num) > 0, SUM(new_user_total_amount_num) / SUM(reg_num), 0) ,4) today_amount_rate,
|
|
|
+ round(if(SUM(amount_num) > 0 , SUM(first_new_user_amount_num) / SUM(amount_num) ,0), 4) new_user_rate,
|
|
|
+ round(if(SUM(first_new_user_amount_count) > 0, SUM(first_new_user_amount) / SUM(first_new_user_amount_count), 0), 2) first_avg_amount,
|
|
|
+ round(if(SUM(new_user_total_amount_count) > 0, SUM(new_user_total_amount) / SUM(new_user_total_amount_count), 0), 2) today_avg_amount,
|
|
|
+ round(if(SUM(amount_count) > 0, SUM(amount) / SUM(amount_count), 0), 2) avg_amount,
|
|
|
+ round(if(SUM(new_user_total_amount_num) > 0, SUM(reg_order_user_again) / SUM(new_user_total_amount_num), 0), 4) user_again_rate,
|
|
|
+ round(if(SUM(reg_num) > 0, SUM(new_user_total_amount) / SUM(reg_num), 0), 2) reg_user_arpu,
|
|
|
+ round(if(SUM(first_new_user_amount_num) > 0 , SUM(first_new_user_amount) / SUM(first_new_user_amount_num), 0), 2) first_amount_arpu,
|
|
|
+ round(if(SUM(new_user_total_amount_num) > 0 , SUM(new_user_total_amount) / SUM(new_user_total_amount_num), 0), 2) today_amount_arpu,
|
|
|
+ round(if(SUM(amount_num) > 0, SUM(amount) / SUM(amount_num), 0), 2) amount_arpu,
|
|
|
+ round(if(SUM(reg_num) > 0, SUM(cost) / SUM(reg_num), 0), 2) reg_cost,
|
|
|
+ round(if(SUM(first_new_user_amount_num) > 0, SUM(cost) / SUM(first_new_user_amount_num), 0), 2) first_new_user_recharge_cost,
|
|
|
+ round(if(SUM(new_user_total_amount_num) > 0, SUM(cost) / SUM(new_user_total_amount_num), 0), 2) total_recharge_cost,
|
|
|
+ round(if(SUM(cost) > 0, SUM(new_user_total_amount) / SUM(cost), 0), 4) total_roi,
|
|
|
+ SUM(hundred_user_num) hundred_user_num,
|
|
|
+ round(IF(SUM(hundred_user_num) > 0, SUM(cost) / SUM(hundred_user_num), 0), 2) hundred_user_num_cost,
|
|
|
+ SUM(first_role_num) first_role_num,
|
|
|
+ SUM(role_num) role_num,
|
|
|
+ SUM(new_user_total_role_num) new_user_total_role_num,
|
|
|
+ round(IF(SUM(first_role_num) > 0, SUM(cost) / SUM(first_role_num), 0), 2) first_role_num_cost,
|
|
|
+ round(IF(SUM(role_num) > 0, SUM(cost) / SUM(role_num), 0), 2) role_num_cost,
|
|
|
+ round(IF(SUM(new_user_total_role_num) >0, SUM(cost) / SUM(new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
|
|
|
+ round(IF(SUM(reg_num) >0, SUM(first_role_num) / SUM(reg_num), 0), 4) first_role_num_rate,
|
|
|
+ round(IF(SUM(reg_num) >0, SUM(role_num) / SUM(reg_num), 0), 4) role_num_rate,
|
|
|
+ round(IF(SUM(reg_num) >0, SUM(new_user_total_role_num) / SUM(reg_num), 0), 4) new_user_total_role_num_rate
|
|
|
+ FROM
|
|
|
+ ads_game_day
|
|
|
+ """;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2409,17 +2471,38 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
private String amountDay(String type) {
|
|
|
//拼接查询条件
|
|
|
StringBuilder trendDay = new StringBuilder(StringUtils.EMPTY);
|
|
|
- for (int day = 1; day <= 29; day++) {
|
|
|
+ for (int day = 1; day <= 90; day++) {
|
|
|
trendDay.append("""
|
|
|
CONCAT(
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL %s day) <= LocalDate.now() , CAST(SPLIT_PART(%samount_d%s , '/', 1) AS DECIMAL(10, 2)), 0 )),'/',
|
|
|
- SUM(CAST(SPLIT_PART( %samount_d%s, '/', 6) AS DECIMAL(10, 2))),'/',
|
|
|
- SUM(CAST(SPLIT_PART(%samount_d%s, '/', 2) AS BIGINT)),'/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL %s day) <= LocalDate.now(), cost, 0)),'/',
|
|
|
- SUM(IF( DATE_ADD(dt, INTERVAL %s day) <= LocalDate.now(), CAST(SPLIT_PART(%samount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
+ SUM(IF( DATE_ADD(dt, INTERVAL %s day) <= LocalDate.now() , CAST(SPLIT_PART(%samount_d%s , '/', 1) AS DECIMAL(10, 2)), 0 )),'/',
|
|
|
+ SUM(CAST(SPLIT_PART( %samount_d%s, '/', 6) AS DECIMAL(10, 2))),'/',
|
|
|
+ SUM(CAST(SPLIT_PART(%samount_d%s, '/', 2) AS BIGINT)),'/',
|
|
|
+ SUM(IF( DATE_ADD(dt, INTERVAL %s day) <= LocalDate.now(), cost, 0)),'/',
|
|
|
+ SUM(IF( DATE_ADD(dt, INTERVAL %s day) <= LocalDate.now(), CAST(SPLIT_PART(%samount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
) AS %samount_d%s ,
|
|
|
- """.formatted(day - 1, type, day, type, day, type, day, day - 1, day - 1, type, type, day));
|
|
|
+ """.formatted(day - 1, type, day, type, day, type, day, day - 1, day - 1, type, type, day));
|
|
|
}
|
|
|
+ for (int month = 4; month <= 12; month++) {
|
|
|
+ trendDay.append("""
|
|
|
+ CONCAT(
|
|
|
+ SUM(IF( DATE_ADD(dt, INTERVAL %s month) <= LocalDate.now() , CAST(SPLIT_PART(%samount_m%s , '/', 1) AS DECIMAL(10, 2)), 0 )),'/',
|
|
|
+ SUM(CAST(SPLIT_PART(%samount_m%s, '/', 6) AS DECIMAL(10, 2))),'/',
|
|
|
+ SUM(CAST(SPLIT_PART(%samount_m%s, '/', 2) AS BIGINT)),'/',
|
|
|
+ SUM(IF( DATE_ADD(dt, INTERVAL %s month) <= LocalDate.now(), cost, 0)),'/',
|
|
|
+ SUM(IF( DATE_ADD(dt, INTERVAL %s month) <= LocalDate.now(), CAST(SPLIT_PART(%samount_d1 , '/', 1) AS DECIMAL(10, 2)) , 0))
|
|
|
+ ) AS %samount_m%s ,
|
|
|
+ """.formatted(month, type, month, type, month, type, month, month, month, type, type, month));
|
|
|
+ }
|
|
|
+ //拼接sum数据
|
|
|
+ trendDay.append("""
|
|
|
+ CONCAT(
|
|
|
+ SUM(CAST(SPLIT_PART(%samount_sum , '/', 1) AS DECIMAL(10, 2))), '/',
|
|
|
+ SUM(CAST(SPLIT_PART(%samount_sum, '/', 6) AS DECIMAL(10, 2))), '/',
|
|
|
+ SUM(CAST(SPLIT_PART(%samount_sum, '/', 2) AS BIGINT)), '/',
|
|
|
+ SUM(cost), '/',
|
|
|
+ SUM(CAST(SPLIT_PART(%samount_d1 , '/', 1) AS DECIMAL(10, 2)))
|
|
|
+ ) AS %samount_sum ,
|
|
|
+ """.formatted(type, type, type, type, type));
|
|
|
|
|
|
return trendDay.toString();
|
|
|
}
|