|
@@ -77,8 +77,6 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
|
|
|
@Override
|
|
|
public Page<GameDataTotalVO> getGameDataTotal(GameDataTotalDTO dto) {
|
|
|
- //设置是否含有充值时间查询参数 默认含有
|
|
|
- Boolean hasRechargeDate = true;
|
|
|
//如果注册时间参数为空,默认设置为当天
|
|
|
if (dto.getRegisteredBeginDate() == null || dto.getRechargeEndDate() == null) {
|
|
|
dto.setRegisteredBeginDate(LocalDate.now());
|
|
@@ -86,10 +84,8 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
}
|
|
|
//如果充值时间参数为空,默认设置为注册时间
|
|
|
if (dto.getRechargeBeginDate() == null || dto.getRechargeEndDate() == null) {
|
|
|
- //修改布尔值
|
|
|
- hasRechargeDate = false;
|
|
|
- dto.setRechargeBeginDate(dto.getRegisteredBeginDate());
|
|
|
- dto.setRechargeEndDate(dto.getRegisteredEndDate());
|
|
|
+ dto.setRechargeBeginDate(LocalDate.now());
|
|
|
+ dto.setRechargeEndDate(LocalDate.now());
|
|
|
}
|
|
|
//根据传入的dto拼接查询参数
|
|
|
Criteria cri = Cnd.cri();
|
|
@@ -106,7 +102,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
cri.where().andBetween("a.dt", dto.getRegisteredBeginDate(), dto.getRegisteredEndDate());
|
|
|
}
|
|
|
//拼接分组条件
|
|
|
- cri.getGroupBy().groupBy("a.game_name");
|
|
|
+ cri.getGroupBy().groupBy("a.game_name", "a.game_id", "a.game_classify");
|
|
|
//创建sql语句 执行sql
|
|
|
Sql sql = Sqls.create(gameDataTotalSql() + cri);
|
|
|
//设置自定义参数
|
|
@@ -124,10 +120,28 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
List<GameDataTotalVO> list = sql.getList(GameDataTotalVO.class);
|
|
|
//设置查询总数
|
|
|
pager.setRecordCount(list.size());
|
|
|
- //如果带有充值时间查询条件 需要联表查询修改结果
|
|
|
- if (hasRechargeDate) {
|
|
|
- //充值时间查询 逻辑处理
|
|
|
- }
|
|
|
+
|
|
|
+ /*//根据充值时间修改值
|
|
|
+ list.stream().map(new Function<GameDataTotalVO, Object>() {
|
|
|
+ //第一个参数 转换之前的参数
|
|
|
+ //第二个参数,转换之后的参数
|
|
|
+ //apply中的传入参数 就是流中的每一个数据
|
|
|
+ //返回值类型就是需要转换之后的类型
|
|
|
+ @Override
|
|
|
+ public Object apply(GameDataTotalVO gameDataTotalVO) {
|
|
|
+
|
|
|
+ //联表查询根据充值时间查询出相关参数
|
|
|
+
|
|
|
+
|
|
|
+ //设置新用户相关数据
|
|
|
+
|
|
|
+
|
|
|
+ //联表查询新用户复充人数
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ });*/
|
|
|
|
|
|
//返回list结果封装到page对象里
|
|
|
return new Page<>(list, pager);
|
|
@@ -145,6 +159,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
dt cost_date,
|
|
|
game_name,
|
|
|
game_classify,
|
|
|
+
|
|
|
buy_reg_num,
|
|
|
nature_reg_num,
|
|
|
reg_num,
|
|
@@ -174,11 +189,13 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
buy_amount_arpu,
|
|
|
buy_amount_d1,
|
|
|
buy_amount_d3,
|
|
|
+ buy_amount_d5,
|
|
|
buy_amount_d7,
|
|
|
buy_amount_d15,
|
|
|
buy_amount_m1,
|
|
|
buy_amount_m2,
|
|
|
buy_amount_m3,
|
|
|
+ buy_amount_m6,
|
|
|
buy_amount_sum,
|
|
|
|
|
|
nature_first_new_user_amount_count,
|
|
@@ -206,11 +223,13 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
nature_amount_arpu,
|
|
|
nature_amount_d1,
|
|
|
nature_amount_d3,
|
|
|
+ nature_amount_d5,
|
|
|
nature_amount_d7,
|
|
|
nature_amount_d15,
|
|
|
nature_amount_m1,
|
|
|
nature_amount_m2,
|
|
|
nature_amount_m3,
|
|
|
+ nature_amount_m6,
|
|
|
nature_amount_sum,
|
|
|
|
|
|
first_new_user_amount_count,
|
|
@@ -238,11 +257,13 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
amount_arpu,
|
|
|
amount_d1,
|
|
|
amount_d3,
|
|
|
+ amount_d5,
|
|
|
amount_d7,
|
|
|
amount_d15,
|
|
|
amount_m1,
|
|
|
amount_m2,
|
|
|
amount_m3,
|
|
|
+ amount_m6,
|
|
|
amount_sum
|
|
|
|
|
|
FROM ads_game_day
|
|
@@ -257,14 +278,85 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
private String gameDataTotalSql() {
|
|
|
return """
|
|
|
SELECT
|
|
|
- a.game_name game_name
|
|
|
+ a.game_id game_id,
|
|
|
+ a.game_name game_name,
|
|
|
+ a.game_classify game_classify,
|
|
|
+
|
|
|
+ sum(a.buy_reg_num) buy_reg_num,
|
|
|
+ sum(a.nature_reg_num) nature_reg_num,
|
|
|
+ sum(a.reg_num) reg_num,
|
|
|
+
|
|
|
+ sum(a.buy_first_new_user_amount_count) buy_first_new_user_amount_count,
|
|
|
+ sum(a.buy_first_new_user_amount_num) buy_first_new_user_amount_num,
|
|
|
+ sum(a.buy_first_new_user_amount) buy_first_new_user_amount,
|
|
|
+ sum(a.nature_first_new_user_amount_count) nature_first_new_user_amount_count,
|
|
|
+ sum(a.nature_first_new_user_amount_num) nature_first_new_user_amount_num,
|
|
|
+ sum(a.nature_first_new_user_amount) nature_first_new_user_amount,
|
|
|
+ sum(a.first_new_user_amount_count) first_new_user_amount_count,
|
|
|
+ sum(a.first_new_user_amount_num) first_new_user_amount_num,
|
|
|
+ sum(a.first_new_user_amount) first_new_user_amount,
|
|
|
+
|
|
|
+ sum(b.buy_amount_count) buy_amount_count,
|
|
|
+ sum(b.buy_amount_num) buy_amount_num,
|
|
|
+ sum(b.buy_amount) buy_amount,
|
|
|
+ sum(b.nature_amount_count) nature_amount_count,
|
|
|
+ sum(b.nature_amount_num) nature_amount_num,
|
|
|
+ sum(b.nature_amount) nature_amount,
|
|
|
+ sum(b.amount_count) amount_count,
|
|
|
+ sum(b.amount_num) amount_num,
|
|
|
+ sum(b.amount) amount,
|
|
|
+
|
|
|
+ sum(a.buy_new_user_total_amount_count) buy_new_user_total_amount_count,
|
|
|
+ sum(a.buy_new_user_total_amount_num) buy_new_user_total_amount_num,
|
|
|
+ sum(a.buy_new_user_total_amount) buy_new_user_total_amount,
|
|
|
+ sum(a.nature_new_user_total_amount_count) nature_new_user_total_amount_count,
|
|
|
+ sum(a.nature_new_user_total_amount_num) nature_new_user_total_amount_num,
|
|
|
+ sum(a.nature_new_user_total_amount) nature_new_user_total_amount,
|
|
|
+ sum(a.new_user_total_amount_count) new_user_total_amount_count,
|
|
|
+ sum(a.new_user_total_amount_num) new_user_total_amount_num,
|
|
|
+ sum(a.new_user_total_amount) new_user_total_amount,
|
|
|
+
|
|
|
+ round(if(sum(a.buy_reg_num) > 0 ,sum(a.buy_first_new_user_amount_num) / sum(a.buy_reg_num), 0), 4) buy_first_roi,
|
|
|
+ round(if(sum(a.buy_reg_num) > 0, sum(a.buy_new_user_total_amount_num) / sum(a.buy_reg_num), 0), 4) buy_today_roi,
|
|
|
+ round(if(sum(a.nature_reg_num) > 0 ,sum(a.nature_first_new_user_amount_num) / sum(a.nature_reg_num), 0), 4) nature_first_roi,
|
|
|
+ round(if(sum(a.nature_reg_num) > 0, sum(a.nature_new_user_total_amount_num) / sum(a.nature_reg_num), 0), 4) nature_today_roi,
|
|
|
+ round(if(sum(a.reg_num) > 0 ,sum(a.first_new_user_amount_num) / sum(a.reg_num), 0), 4) first_roi,
|
|
|
+ round(if(sum(a.reg_num) > 0, sum(a.new_user_total_amount_num) / sum(a.reg_num), 0), 4) today_roi,
|
|
|
+
|
|
|
+ round(if(sum(a.buy_first_new_user_amount_count) > 0, sum(a.buy_first_new_user_amount) / sum(a.buy_first_new_user_amount_count), 0), 2) buy_first_avg_amount,
|
|
|
+ round(if(sum(a.buy_new_user_total_amount_count) > 0, sum(a.buy_new_user_total_amount) / sum(a.buy_new_user_total_amount_count), 0), 2) buy_today_avg_amount,
|
|
|
+ round(if(sum(b.buy_amount_count) > 0, sum(b.buy_amount) / sum(b.buy_amount_count), 0), 2) buy_avg_amount,
|
|
|
+ round(if(sum(a.nature_first_new_user_amount_count) > 0, sum(a.nature_first_new_user_amount) / sum(a.nature_first_new_user_amount_count), 0), 2) nature_first_avg_amount,
|
|
|
+ round(if(sum(a.nature_new_user_total_amount_count) > 0, sum(a.nature_new_user_total_amount) / sum(a.nature_new_user_total_amount_count), 0), 2) nature_today_avg_amount,
|
|
|
+ round(if(sum(b.nature_amount_count) > 0, sum(b.nature_amount) / sum(b.nature_amount_count), 0), 2) nature_avg_amount,
|
|
|
+ round(if(sum(a.first_new_user_amount_count) > 0, sum(a.first_new_user_amount) / sum(a.first_new_user_amount_count), 0), 2) first_avg_amount,
|
|
|
+ round(if(sum(a.new_user_total_amount_count) > 0, sum(a.new_user_total_amount) / sum(a.new_user_total_amount_count), 0), 2) today_avg_amount,
|
|
|
+ round(if(sum(b.amount_count) > 0, sum(b.amount) / sum(b.amount_count), 0), 2) avg_amount,
|
|
|
+
|
|
|
+ round(if(sum(a.buy_new_user_total_amount_num) > 0 , sum(a.buy_reg_order_user_again) / sum(a.buy_new_user_total_amount_num), 0), 4) buy_today_again_rate,
|
|
|
+ round(if(sum(a.nature_new_user_total_amount_num) > 0 , sum(a.nature_reg_order_user_again) / sum(a.nature_new_user_total_amount_num), 0), 4) nature_today_again_rate,
|
|
|
+ round(if(sum(a.new_user_total_amount_num) > 0 , sum(a.reg_order_user_again) / sum(a.new_user_total_amount_num), 0), 4) today_again_rate,
|
|
|
+
|
|
|
+ round(if(sum(a.buy_reg_num) > 0 , sum(a.buy_new_user_total_amount) / sum(a.buy_reg_num), 0), 2) buy_reg_user_arpu,
|
|
|
+ round(if(sum(a.buy_first_new_user_amount_num) > 0 , sum(a.buy_first_new_user_amount) / sum(a.buy_first_new_user_amount_num), 0), 2) buy_first_amount_arpu,
|
|
|
+ round(if(sum(a.buy_new_user_total_amount_num) > 0 , sum(a.buy_new_user_total_amount) / sum(a.buy_new_user_total_amount_num), 0), 2) buy_today_amount_arpu,
|
|
|
+ round(if(sum(b.buy_amount_num) > 0 , sum(b.buy_amount) / sum(b.buy_amount_num), 0), 2) buy_amount_arpu,
|
|
|
+ round(if(sum(a.nature_reg_num) > 0 , sum(a.nature_new_user_total_amount) / sum(a.nature_reg_num), 0), 2) nature_reg_user_arpu,
|
|
|
+ round(if(sum(a.nature_first_new_user_amount_num) > 0 , sum(a.nature_first_new_user_amount) / sum(a.nature_first_new_user_amount_num), 0), 2) nature_first_amount_arpu,
|
|
|
+ round(if(sum(a.nature_new_user_total_amount_num) > 0 , sum(a.nature_new_user_total_amount) / sum(a.nature_new_user_total_amount_num), 0), 2) nature_today_amount_arpu,
|
|
|
+ round(if(sum(b.nature_amount_num) > 0 , sum(b.nature_amount) / sum(b.nature_amount_num), 0), 2) nature_amount_arpu,
|
|
|
+ round(if(sum(a.reg_num) > 0 , sum(a.new_user_total_amount) / sum(a.reg_num), 0), 2) reg_user_arpu,
|
|
|
+ round(if(sum(a.first_new_user_amount_num) > 0 , sum(a.first_new_user_amount) / sum(a.first_new_user_amount_num), 0), 2) first_amount_arpu,
|
|
|
+ round(if(sum(a.new_user_total_amount_num) > 0 , sum(a.new_user_total_amount) / sum(a.new_user_total_amount_num), 0), 2) today_amount_arpu,
|
|
|
+ round(if(sum(b.amount_num) > 0 , sum(b.amount) / sum(b.amount_num), 0), 2) amount_arpu
|
|
|
FROM
|
|
|
ads_game_day a
|
|
|
left join
|
|
|
- game_ads.ads_game_day b
|
|
|
+ ads_game_day b
|
|
|
on
|
|
|
- a.game_name = b.game_name
|
|
|
- and
|
|
|
+ a.game_name = b.game_name and
|
|
|
+ a.game_id = b.game_id and
|
|
|
+ a.game_classify = b.game_classify and
|
|
|
(b.dt between @rechargeBeginDate and @rechargeEndDate)
|
|
|
""";
|
|
|
}
|