|
@@ -4,9 +4,7 @@ import com.google.common.base.CaseFormat;
|
|
import com.zanxiang.game.data.serve.component.DataPowerComponent;
|
|
import com.zanxiang.game.data.serve.component.DataPowerComponent;
|
|
import com.zanxiang.game.data.serve.pojo.dto.ActiveDataDayDTO;
|
|
import com.zanxiang.game.data.serve.pojo.dto.ActiveDataDayDTO;
|
|
import com.zanxiang.game.data.serve.pojo.dto.ActiveDataTotalDTO;
|
|
import com.zanxiang.game.data.serve.pojo.dto.ActiveDataTotalDTO;
|
|
-import com.zanxiang.game.data.serve.pojo.entity.AdsGameActiveOrderDay;
|
|
|
|
-import com.zanxiang.game.data.serve.pojo.entity.AdsGameActiveRegDay;
|
|
|
|
-import com.zanxiang.game.data.serve.pojo.entity.AdsGameActiveRoleDay;
|
|
|
|
|
|
+import com.zanxiang.game.data.serve.pojo.entity.*;
|
|
import com.zanxiang.game.data.serve.pojo.enums.OrderByEnum;
|
|
import com.zanxiang.game.data.serve.pojo.enums.OrderByEnum;
|
|
import com.zanxiang.game.data.serve.pojo.vo.ActiveDataDayVO;
|
|
import com.zanxiang.game.data.serve.pojo.vo.ActiveDataDayVO;
|
|
import com.zanxiang.game.data.serve.pojo.vo.ActiveDataTotalVO;
|
|
import com.zanxiang.game.data.serve.pojo.vo.ActiveDataTotalVO;
|
|
@@ -128,6 +126,15 @@ public class IActiveDataServiceImpl implements IActiveDataService {
|
|
public Page<ActiveDataDayVO> getActiveDataDay(ActiveDataDayDTO dto) {
|
|
public Page<ActiveDataDayVO> getActiveDataDay(ActiveDataDayDTO dto) {
|
|
com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
|
|
com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
|
|
List<Long> userGameIds = dto.getGameId() == null ? poerInfo.second : dto.getGameId();
|
|
List<Long> userGameIds = dto.getGameId() == null ? poerInfo.second : dto.getGameId();
|
|
|
|
+
|
|
|
|
+ //默认查询的字段及表名
|
|
|
|
+ String gameColumn = "game_id";
|
|
|
|
+ String classifyColumn = "game_classify";
|
|
|
|
+
|
|
|
|
+ if (dto.getGameDimension() == null) {
|
|
|
|
+ //默认子游戏维度
|
|
|
|
+ dto.setGameDimension(1L);
|
|
|
|
+ }
|
|
//默认查询总数据
|
|
//默认查询总数据
|
|
if (StringUtils.isBlank(dto.getTableTypes())) {
|
|
if (StringUtils.isBlank(dto.getTableTypes())) {
|
|
dto.setTableTypes("total");
|
|
dto.setTableTypes("total");
|
|
@@ -153,15 +160,33 @@ public class IActiveDataServiceImpl implements IActiveDataService {
|
|
tempClazz = AdsGameActiveOrderDay.class;
|
|
tempClazz = AdsGameActiveOrderDay.class;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (dto.getGameDimension() == 2L) {
|
|
|
|
+ gameColumn = "parent_game_id";
|
|
|
|
+ classifyColumn = "parent_game_classify";
|
|
|
|
+ switch (dto.getActiveTypes()) {
|
|
|
|
+ case "reg" -> {
|
|
|
|
+ queryTableName = "ads_game_active_reg_day_parent";
|
|
|
|
+ tempClazz = AdsGameActiveRegDayParent.class;
|
|
|
|
+ }
|
|
|
|
+ case "role" -> {
|
|
|
|
+ queryTableName = "ads_game_active_role_day_parent";
|
|
|
|
+ tempClazz = AdsGameActiveRoleDayParent.class;
|
|
|
|
+ }
|
|
|
|
+ case "amount" -> {
|
|
|
|
+ queryTableName = "ads_game_active_order_day_parent";
|
|
|
|
+ tempClazz = AdsGameActiveOrderDayParent.class;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//创建查询条件
|
|
//创建查询条件
|
|
Criteria cri = Cnd.cri();
|
|
Criteria cri = Cnd.cri();
|
|
//拼接游戏ID
|
|
//拼接游戏ID
|
|
if (CollectionUtils.isNotEmpty(userGameIds)) {
|
|
if (CollectionUtils.isNotEmpty(userGameIds)) {
|
|
- cri.where().andInList("game_id", userGameIds);
|
|
|
|
|
|
+ cri.where().andInList(gameColumn, userGameIds);
|
|
}
|
|
}
|
|
//拼接游戏应用类型
|
|
//拼接游戏应用类型
|
|
if (dto.getClassify() != null) {
|
|
if (dto.getClassify() != null) {
|
|
- cri.where().andEquals("game_classify", dto.getClassify());
|
|
|
|
|
|
+ cri.where().andEquals(classifyColumn, dto.getClassify());
|
|
}
|
|
}
|
|
//拼接SDK来源
|
|
//拼接SDK来源
|
|
if ("reg".equals(dto.getActiveTypes())) {
|
|
if ("reg".equals(dto.getActiveTypes())) {
|
|
@@ -189,7 +214,12 @@ public class IActiveDataServiceImpl implements IActiveDataService {
|
|
orderByCri.getOrderBy().orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType());
|
|
orderByCri.getOrderBy().orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType());
|
|
}
|
|
}
|
|
//创建sql查询数据
|
|
//创建sql查询数据
|
|
- Sql sql = Sqls.create(getActiveDataDaySql(dto.getTableTypes(), queryTableName, cri) + orderByCri);
|
|
|
|
|
|
+ Sql sql;
|
|
|
|
+ if (dto.getGameDimension() == 1L) {
|
|
|
|
+ sql = Sqls.create(getActiveDataDaySql(dto.getTableTypes(), queryTableName, cri) + orderByCri);
|
|
|
|
+ } else {
|
|
|
|
+ sql = Sqls.create(getActiveDataDaySqlForParent(dto.getTableTypes(), queryTableName, cri) + orderByCri);
|
|
|
|
+ }
|
|
//设置自定义回传类型
|
|
//设置自定义回传类型
|
|
sql.setCallback(Sqls.callback.entities());
|
|
sql.setCallback(Sqls.callback.entities());
|
|
sql.setEntity(dao.getEntity(ActiveDataDayVO.class));
|
|
sql.setEntity(dao.getEntity(ActiveDataDayVO.class));
|
|
@@ -220,6 +250,16 @@ public class IActiveDataServiceImpl implements IActiveDataService {
|
|
public ActiveDataTotalVO getActiveDataTotal(ActiveDataTotalDTO dto) {
|
|
public ActiveDataTotalVO getActiveDataTotal(ActiveDataTotalDTO dto) {
|
|
com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
|
|
com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
|
|
List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : dto.getGameId();
|
|
List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : dto.getGameId();
|
|
|
|
+
|
|
|
|
+ //默认查询字段
|
|
|
|
+ String gameColumn = "game_id";
|
|
|
|
+ String classifyColumn = "game_classify";
|
|
|
|
+ String tableName = "game_ads.ads_game_day";
|
|
|
|
+
|
|
|
|
+ if (dto.getGameDimension() == null) {
|
|
|
|
+ //默认查询子游戏维度
|
|
|
|
+ dto.setGameDimension(1L);
|
|
|
|
+ }
|
|
//默认查询总数据
|
|
//默认查询总数据
|
|
if (StringUtils.isBlank(dto.getTableTypes())) {
|
|
if (StringUtils.isBlank(dto.getTableTypes())) {
|
|
dto.setTableTypes("total");
|
|
dto.setTableTypes("total");
|
|
@@ -234,15 +274,25 @@ public class IActiveDataServiceImpl implements IActiveDataService {
|
|
case "role" -> queryTableName = "ads_game_active_role_day";
|
|
case "role" -> queryTableName = "ads_game_active_role_day";
|
|
case "amount" -> queryTableName = "ads_game_active_order_day";
|
|
case "amount" -> queryTableName = "ads_game_active_order_day";
|
|
}
|
|
}
|
|
|
|
+ if (dto.getGameDimension() == 2L) {
|
|
|
|
+ gameColumn = "parent_game_id";
|
|
|
|
+ classifyColumn = "parent_game_classify";
|
|
|
|
+ tableName = "game_ads_parent.ads_game_day_parent";
|
|
|
|
+ switch (dto.getActiveTypes()) {
|
|
|
|
+ case "reg" -> queryTableName = "ads_game_active_reg_day_parent";
|
|
|
|
+ case "role" -> queryTableName = "ads_game_active_role_day_parent";
|
|
|
|
+ case "amount" -> queryTableName = "ads_game_active_order_day_parent";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//创建查询条件
|
|
//创建查询条件
|
|
Criteria cri = Cnd.cri();
|
|
Criteria cri = Cnd.cri();
|
|
//拼接游戏ID
|
|
//拼接游戏ID
|
|
if (CollectionUtils.isNotEmpty(gameIds)) {
|
|
if (CollectionUtils.isNotEmpty(gameIds)) {
|
|
- cri.where().andInList("game_id", gameIds);
|
|
|
|
|
|
+ cri.where().andInList(gameColumn, gameIds);
|
|
}
|
|
}
|
|
//拼接游戏应用类型
|
|
//拼接游戏应用类型
|
|
if (dto.getClassify() != null) {
|
|
if (dto.getClassify() != null) {
|
|
- cri.where().andEquals("game_classify", dto.getClassify());
|
|
|
|
|
|
+ cri.where().andEquals(classifyColumn, dto.getClassify());
|
|
}
|
|
}
|
|
//拼接SDK来源
|
|
//拼接SDK来源
|
|
if ("reg".equals(dto.getActiveTypes())) {
|
|
if ("reg".equals(dto.getActiveTypes())) {
|
|
@@ -258,7 +308,7 @@ public class IActiveDataServiceImpl implements IActiveDataService {
|
|
cri.where().andBetween("dt", dto.getRegisteredBeginDate(), dto.getRegisteredEndDate());
|
|
cri.where().andBetween("dt", dto.getRegisteredBeginDate(), dto.getRegisteredEndDate());
|
|
}
|
|
}
|
|
//创建sql 获取游戏数据部分的数据
|
|
//创建sql 获取游戏数据部分的数据
|
|
- Sql sqlGameData = Sqls.create(getTotalGameData(dto.getTableTypes()) + cri);
|
|
|
|
|
|
+ Sql sqlGameData = Sqls.create(getTotalGameData(dto.getTableTypes(), tableName) + cri);
|
|
//设置自定义回传对象
|
|
//设置自定义回传对象
|
|
sqlGameData.setCallback(Sqls.callback.entity());
|
|
sqlGameData.setCallback(Sqls.callback.entity());
|
|
sqlGameData.setEntity(dao.getEntity(ActiveDataTotalVO.class));
|
|
sqlGameData.setEntity(dao.getEntity(ActiveDataTotalVO.class));
|
|
@@ -1111,106 +1161,620 @@ public class IActiveDataServiceImpl implements IActiveDataService {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 游戏数据每日总计一栏(按类型返回sql)
|
|
|
|
|
|
+ * 留存每日数据sql-父游戏维度
|
|
*
|
|
*
|
|
- * @param type 查询的类型 buy、nature、total
|
|
|
|
|
|
+ * @param type 查询的类型 buy -> 买量 ; nature -> 自然量 ; total -> 总量
|
|
|
|
+ * @param tableName 查询的表名
|
|
|
|
+ * @param cri 查询条件
|
|
* @return String
|
|
* @return String
|
|
*/
|
|
*/
|
|
- private String getTotalGameData(String type) {
|
|
|
|
|
|
+ private String getActiveDataDaySqlForParent(String type, String tableName, Criteria cri) {
|
|
if ("buy".equals(type)) {
|
|
if ("buy".equals(type)) {
|
|
return """
|
|
return """
|
|
SELECT
|
|
SELECT
|
|
- IFNULL(SUM(cost), 0) cost,
|
|
|
|
- IFNULL(SUM(buy_reg_num), 0) reg_num,
|
|
|
|
- IFNULL(SUM(buy_first_new_user_amount_count), 0) first_new_user_amount_count,
|
|
|
|
- IFNULL(SUM(buy_first_new_user_amount_num), 0) first_new_user_amount_num,
|
|
|
|
- IFNULL(SUM(buy_first_new_user_amount), 0) first_new_user_amount,
|
|
|
|
- IFNULL(SUM(buy_old_user_count), 0) old_user_count,
|
|
|
|
- IFNULL(SUM(buy_old_user_num), 0) old_user_num,
|
|
|
|
- IFNULL(SUM(buy_old_user_amount), 0) old_user_amount,
|
|
|
|
- IFNULL(SUM(buy_amount_count), 0) amount_count,
|
|
|
|
- IFNULL(SUM(buy_amount_num), 0) amount_num,
|
|
|
|
- IFNULL(SUM(buy_amount), 0) amount,
|
|
|
|
- IFNULL(SUM(buy_new_user_total_amount_count), 0) new_user_total_amount_count,
|
|
|
|
- IFNULL(SUM(buy_new_user_total_amount_num), 0) new_user_total_amount_num,
|
|
|
|
- IFNULL(SUM(buy_new_user_total_amount), 0) new_user_total_amount,
|
|
|
|
- round(if(SUM(cost) > 0 , SUM(buy_first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
|
|
|
|
- round(if(SUM(buy_reg_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_reg_num) ,0), 4) first_amount_rate,
|
|
|
|
- round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount_num) / SUM(buy_reg_num), 0) ,4) today_amount_rate,
|
|
|
|
- round(if(SUM(buy_amount_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_amount_num) ,0), 4) 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) 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) today_avg_amount,
|
|
|
|
- round(if(SUM(buy_amount_count) > 0, SUM(buy_amount) / SUM(buy_amount_count), 0), 2) 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) user_again_rate,
|
|
|
|
- round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount) / SUM(buy_reg_num), 0), 2) 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) 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) today_amount_arpu,
|
|
|
|
- round(if(SUM(buy_amount_num) > 0, SUM(buy_amount) / SUM(buy_amount_num), 0), 2) amount_arpu,
|
|
|
|
- round(if(SUM(buy_reg_num) > 0, SUM(cost) / SUM(buy_reg_num), 0), 2) reg_cost,
|
|
|
|
- round(if(SUM(buy_first_new_user_amount_num) > 0, SUM(cost) / SUM(buy_first_new_user_amount_num), 0), 2) 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) total_recharge_cost,
|
|
|
|
- round(if(SUM(cost) > 0, SUM(buy_new_user_total_amount) / SUM(cost), 0), 4) total_roi,
|
|
|
|
- IFNULL(SUM(buy_hundred_user_num), 0) hundred_user_num,
|
|
|
|
- round(IF(SUM(buy_hundred_user_num) > 0, SUM(cost) / SUM(buy_hundred_user_num), 0), 2) hundred_user_num_cost,
|
|
|
|
- IFNULL(SUM(buy_first_role_num), 0) first_role_num,
|
|
|
|
- IFNULL(SUM(buy_role_num), 0) role_num,
|
|
|
|
- IFNULL(SUM(buy_new_user_total_role_num), 0) new_user_total_role_num,
|
|
|
|
- round(IF(SUM(buy_first_role_num) > 0, SUM(cost) / SUM(buy_first_role_num), 0), 2) first_role_num_cost,
|
|
|
|
- round(IF(SUM(buy_role_num) > 0, SUM(cost) / SUM(buy_role_num), 0), 2) role_num_cost,
|
|
|
|
- round(IF(SUM(buy_new_user_total_role_num) >0, SUM(cost) / SUM(buy_new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
|
|
|
|
- round(IF(SUM(buy_reg_num) >0, SUM(buy_first_role_num) / SUM(buy_reg_num), 0), 4) first_role_num_rate,
|
|
|
|
- round(IF(SUM(buy_reg_num) >0, SUM(buy_role_num) / SUM(buy_reg_num), 0), 4) role_num_rate,
|
|
|
|
- round(IF(SUM(buy_reg_num) >0, SUM(buy_new_user_total_role_num) / SUM(buy_reg_num), 0), 4) new_user_total_role_num_rate
|
|
|
|
- FROM
|
|
|
|
- ads_game_day
|
|
|
|
|
|
+ a.*,
|
|
|
|
+ b.*
|
|
|
|
+ FROM (
|
|
|
|
+ SELECT
|
|
|
|
+ dt cost_date,
|
|
|
|
+ parent_game_name as game_name,
|
|
|
|
+ parent_game_id as game_id,
|
|
|
|
+ parent_game_name_classify as game_classify,
|
|
|
|
+ source_system,
|
|
|
|
+ cost,
|
|
|
|
+ buy_reg_num as reg_num,
|
|
|
|
+ buy_first_new_user_amount_count as first_new_user_amount_count,
|
|
|
|
+ buy_first_new_user_amount_num as first_new_user_amount_num,
|
|
|
|
+ buy_first_new_user_amount as first_new_user_amount,
|
|
|
|
+ buy_old_user_count as old_user_count,
|
|
|
|
+ buy_old_user_num as old_user_num,
|
|
|
|
+ buy_old_user_amount as old_user_amount,
|
|
|
|
+ buy_amount_count as amount_count,
|
|
|
|
+ buy_amount_num as amount_num,
|
|
|
|
+ buy_amount as amount,
|
|
|
|
+ buy_new_user_total_amount_count as new_user_total_amount_count,
|
|
|
|
+ buy_new_user_total_amount_num as new_user_total_amount_num,
|
|
|
|
+ buy_new_user_total_amount as new_user_total_amount,
|
|
|
|
+ buy_total_roi as total_roi,
|
|
|
|
+ buy_first_roi as first_roi,
|
|
|
|
+ buy_first_amount_rate as first_amount_rate,
|
|
|
|
+ buy_today_amount_rate as today_amount_rate,
|
|
|
|
+ buy_new_user_rate as new_user_rate,
|
|
|
|
+ buy_first_avg_amount as first_avg_amount,
|
|
|
|
+ buy_today_avg_amount as today_avg_amount,
|
|
|
|
+ buy_avg_amount as avg_amount,
|
|
|
|
+ buy_user_again_rate as user_again_rate,
|
|
|
|
+ buy_reg_user_arpu as reg_user_arpu,
|
|
|
|
+ buy_first_amount_arpu as first_amount_arpu,
|
|
|
|
+ buy_today_amount_arpu as today_amount_arpu,
|
|
|
|
+ buy_amount_arpu as amount_arpu,
|
|
|
|
+ buy_reg_cost as reg_cost,
|
|
|
|
+ buy_first_amount_cost as first_new_user_recharge_cost,
|
|
|
|
+ buy_total_amount_cost as total_recharge_cost,
|
|
|
|
+ buy_hundred_user_num as hundred_user_num,
|
|
|
|
+ buy_hundred_user_num_cost as hundred_user_num_cost,
|
|
|
|
+ buy_first_role_num as first_role_num,
|
|
|
|
+ buy_role_num as role_num,
|
|
|
|
+ buy_new_user_total_role_num as new_user_total_role_num,
|
|
|
|
+ round(IF(buy_first_role_num > 0, cost / buy_first_role_num, 0), 2) first_role_num_cost,
|
|
|
|
+ round(IF(buy_role_num > 0, cost / buy_role_num, 0), 2) role_num_cost,
|
|
|
|
+ round(IF(buy_new_user_total_role_num >0, cost / buy_new_user_total_role_num, 0), 2) new_user_total_role_num_cost,
|
|
|
|
+ round(IF(buy_reg_num >0, buy_first_role_num / buy_reg_num, 0), 4) first_role_num_rate,
|
|
|
|
+ round(IF(buy_reg_num >0, buy_role_num / buy_reg_num, 0), 4) role_num_rate,
|
|
|
|
+ round(IF(buy_reg_num >0, buy_new_user_total_role_num / buy_reg_num, 0), 4) new_user_total_role_num_rate
|
|
|
|
+ FROM
|
|
|
|
+ game_ads_parent.ads_game_day_parent
|
|
|
|
+ """ + cri +
|
|
|
|
+ """
|
|
|
|
+ ) a
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT
|
|
|
|
+ parent_game_id as game_id,
|
|
|
|
+ parent_game_name as game_name,
|
|
|
|
+ dt,
|
|
|
|
+ buy_da1 as da1,
|
|
|
|
+ buy_da2 as da2,
|
|
|
|
+ buy_da3 as da3,
|
|
|
|
+ buy_da4 as da4,
|
|
|
|
+ buy_da5 as da5,
|
|
|
|
+ buy_da6 as da6,
|
|
|
|
+ buy_da7 as da7,
|
|
|
|
+ buy_da8 as da8,
|
|
|
|
+ buy_da9 as da9,
|
|
|
|
+ buy_da10 as da10,
|
|
|
|
+ buy_da11 as da11,
|
|
|
|
+ buy_da12 as da12,
|
|
|
|
+ buy_da13 as da13,
|
|
|
|
+ buy_da14 as da14,
|
|
|
|
+ buy_da15 as da15,
|
|
|
|
+ buy_da16 as da16,
|
|
|
|
+ buy_da17 as da17,
|
|
|
|
+ buy_da18 as da18,
|
|
|
|
+ buy_da19 as da19,
|
|
|
|
+ buy_da20 as da20,
|
|
|
|
+ buy_da21 as da21,
|
|
|
|
+ buy_da22 as da22,
|
|
|
|
+ buy_da23 as da23,
|
|
|
|
+ buy_da24 as da24,
|
|
|
|
+ buy_da25 as da25,
|
|
|
|
+ buy_da26 as da26,
|
|
|
|
+ buy_da27 as da27,
|
|
|
|
+ buy_da28 as da28,
|
|
|
|
+ buy_da29 as da29,
|
|
|
|
+ buy_da30 as da30,
|
|
|
|
+ buy_da31 as da31,
|
|
|
|
+ buy_da32 as da32,
|
|
|
|
+ buy_da33 as da33,
|
|
|
|
+ buy_da34 as da34,
|
|
|
|
+ buy_da35 as da35,
|
|
|
|
+ buy_da36 as da36,
|
|
|
|
+ buy_da37 as da37,
|
|
|
|
+ buy_da38 as da38,
|
|
|
|
+ buy_da39 as da39,
|
|
|
|
+ buy_da40 as da40,
|
|
|
|
+ buy_da41 as da41,
|
|
|
|
+ buy_da42 as da42,
|
|
|
|
+ buy_da43 as da43,
|
|
|
|
+ buy_da44 as da44,
|
|
|
|
+ buy_da45 as da45,
|
|
|
|
+ buy_da46 as da46,
|
|
|
|
+ buy_da47 as da47,
|
|
|
|
+ buy_da48 as da48,
|
|
|
|
+ buy_da49 as da49,
|
|
|
|
+ buy_da50 as da50,
|
|
|
|
+ buy_da51 as da51,
|
|
|
|
+ buy_da52 as da52,
|
|
|
|
+ buy_da53 as da53,
|
|
|
|
+ buy_da54 as da54,
|
|
|
|
+ buy_da55 as da55,
|
|
|
|
+ buy_da56 as da56,
|
|
|
|
+ buy_da57 as da57,
|
|
|
|
+ buy_da58 as da58,
|
|
|
|
+ buy_da59 as da59,
|
|
|
|
+ buy_da60 as da60,
|
|
|
|
+ buy_da61 as da61,
|
|
|
|
+ buy_da62 as da62,
|
|
|
|
+ buy_da63 as da63,
|
|
|
|
+ buy_da64 as da64,
|
|
|
|
+ buy_da65 as da65,
|
|
|
|
+ buy_da66 as da66,
|
|
|
|
+ buy_da67 as da67,
|
|
|
|
+ buy_da68 as da68,
|
|
|
|
+ buy_da69 as da69,
|
|
|
|
+ buy_da70 as da70,
|
|
|
|
+ buy_da71 as da71,
|
|
|
|
+ buy_da72 as da72,
|
|
|
|
+ buy_da73 as da73,
|
|
|
|
+ buy_da74 as da74,
|
|
|
|
+ buy_da75 as da75,
|
|
|
|
+ buy_da76 as da76,
|
|
|
|
+ buy_da77 as da77,
|
|
|
|
+ buy_da78 as da78,
|
|
|
|
+ buy_da79 as da79,
|
|
|
|
+ buy_da80 as da80,
|
|
|
|
+ buy_da81 as da81,
|
|
|
|
+ buy_da82 as da82,
|
|
|
|
+ buy_da83 as da83,
|
|
|
|
+ buy_da84 as da84,
|
|
|
|
+ buy_da85 as da85,
|
|
|
|
+ buy_da86 as da86,
|
|
|
|
+ buy_da87 as da87,
|
|
|
|
+ buy_da88 as da88,
|
|
|
|
+ buy_da89 as da89,
|
|
|
|
+ buy_da90 as da90,
|
|
|
|
+ buy_m4 as m4,
|
|
|
|
+ buy_m5 as m5,
|
|
|
|
+ buy_m6 as m6,
|
|
|
|
+ buy_m7 as m7,
|
|
|
|
+ buy_m8 as m8,
|
|
|
|
+ buy_m9 as m9,
|
|
|
|
+ buy_m10 as m10,
|
|
|
|
+ buy_m11 as m11,
|
|
|
|
+ buy_m12 as m12
|
|
|
|
+ FROM
|
|
|
|
+ """ + tableName + cri +
|
|
|
|
+ """
|
|
|
|
+ ) b
|
|
|
|
+ ON a.game_id = b.game_id and a.cost_date = b.dt and a.game_name = b.game_name
|
|
""";
|
|
""";
|
|
} else if ("nature".equals(type)) {
|
|
} else if ("nature".equals(type)) {
|
|
return """
|
|
return """
|
|
SELECT
|
|
SELECT
|
|
- IFNULL(SUM(cost), 0) cost,
|
|
|
|
- IFNULL(SUM(nature_reg_num), 0) reg_num,
|
|
|
|
- IFNULL(SUM(nature_first_new_user_amount_count), 0) first_new_user_amount_count,
|
|
|
|
- IFNULL(SUM(nature_first_new_user_amount_num), 0) first_new_user_amount_num,
|
|
|
|
- IFNULL(SUM(nature_first_new_user_amount), 0) first_new_user_amount,
|
|
|
|
- IFNULL(SUM(nature_old_user_count), 0) old_user_count,
|
|
|
|
- IFNULL(SUM(nature_old_user_num), 0) old_user_num,
|
|
|
|
- IFNULL(SUM(nature_old_user_amount), 0) old_user_amount,
|
|
|
|
- IFNULL(SUM(nature_amount_count), 0) amount_count,
|
|
|
|
- IFNULL(SUM(nature_amount_num), 0) amount_num,
|
|
|
|
- IFNULL(SUM(nature_amount), 0) amount,
|
|
|
|
- IFNULL(SUM(nature_new_user_total_amount_count), 0) new_user_total_amount_count,
|
|
|
|
- IFNULL(SUM(nature_new_user_total_amount_num), 0) new_user_total_amount_num,
|
|
|
|
- IFNULL(SUM(nature_new_user_total_amount), 0) new_user_total_amount,
|
|
|
|
- round(if(SUM(cost) > 0 , SUM(nature_first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
|
|
|
|
- round(if(SUM(nature_reg_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_reg_num) ,0), 4) first_amount_rate,
|
|
|
|
- round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount_num) / SUM(nature_reg_num), 0) ,4) today_amount_rate,
|
|
|
|
- round(if(SUM(nature_amount_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_amount_num) ,0), 4) 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) 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) today_avg_amount,
|
|
|
|
- round(if(SUM(nature_amount_count) > 0, SUM(nature_amount) / SUM(nature_amount_count), 0), 2) 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) user_again_rate,
|
|
|
|
- round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount) / SUM(nature_reg_num), 0), 2) 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) 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) today_amount_arpu,
|
|
|
|
- round(if(SUM(nature_amount_num) > 0, SUM(nature_amount) / SUM(nature_amount_num), 0), 2) amount_arpu,
|
|
|
|
- round(if(SUM(nature_reg_num) > 0, SUM(cost) / SUM(nature_reg_num), 0), 2) reg_cost,
|
|
|
|
- round(if(SUM(nature_first_new_user_amount_num) > 0, SUM(cost) / SUM(nature_first_new_user_amount_num), 0), 2) 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) total_recharge_cost,
|
|
|
|
- round(if(SUM(cost) > 0, SUM(nature_new_user_total_amount) / SUM(cost), 0), 4) total_roi,
|
|
|
|
- IFNULL(SUM(nature_hundred_user_num), 0) hundred_user_num,
|
|
|
|
- round(IF(SUM(nature_hundred_user_num) > 0, SUM(cost) / SUM(nature_hundred_user_num), 0), 2) hundred_user_num_cost,
|
|
|
|
- IFNULL(SUM(nature_first_role_num), 0) first_role_num,
|
|
|
|
- IFNULL(SUM(nature_role_num), 0) role_num,
|
|
|
|
- IFNULL(SUM(nature_new_user_total_role_num), 0) new_user_total_role_num,
|
|
|
|
|
|
+ a.*,
|
|
|
|
+ b.*
|
|
|
|
+ FROM (
|
|
|
|
+ SELECT
|
|
|
|
+ dt cost_date,
|
|
|
|
+ parent_game_name as game_name,
|
|
|
|
+ parent_game_id as game_id,
|
|
|
|
+ parent_game_name_classify as game_classify,
|
|
|
|
+ source_system,
|
|
|
|
+ cost,
|
|
|
|
+ nature_reg_num as reg_num,
|
|
|
|
+ nature_first_new_user_amount_count as first_new_user_amount_count,
|
|
|
|
+ nature_first_new_user_amount_num as first_new_user_amount_num,
|
|
|
|
+ nature_first_new_user_amount as first_new_user_amount,
|
|
|
|
+ nature_old_user_count as old_user_count,
|
|
|
|
+ nature_old_user_num as old_user_num,
|
|
|
|
+ nature_old_user_amount as old_user_amount,
|
|
|
|
+ nature_amount_count as amount_count,
|
|
|
|
+ nature_amount_num as amount_num,
|
|
|
|
+ nature_amount as amount,
|
|
|
|
+ nature_new_user_total_amount_count as new_user_total_amount_count,
|
|
|
|
+ nature_new_user_total_amount_num as new_user_total_amount_num,
|
|
|
|
+ nature_new_user_total_amount as new_user_total_amount,
|
|
|
|
+ nature_total_roi as total_roi,
|
|
|
|
+ nature_first_roi as first_roi,
|
|
|
|
+ nature_first_amount_rate as first_amount_rate,
|
|
|
|
+ nature_today_amount_rate as today_amount_rate,
|
|
|
|
+ nature_new_user_rate as new_user_rate,
|
|
|
|
+ nature_first_avg_amount as first_avg_amount,
|
|
|
|
+ nature_today_avg_amount as today_avg_amount,
|
|
|
|
+ nature_avg_amount as avg_amount,
|
|
|
|
+ nature_user_again_rate as user_again_rate,
|
|
|
|
+ nature_reg_user_arpu as reg_user_arpu,
|
|
|
|
+ nature_first_amount_arpu as first_amount_arpu,
|
|
|
|
+ nature_today_amount_arpu as today_amount_arpu,
|
|
|
|
+ nature_amount_arpu as amount_arpu,
|
|
|
|
+ nature_reg_cost as reg_cost,
|
|
|
|
+ nature_first_amount_cost as first_new_user_recharge_cost,
|
|
|
|
+ nature_total_amount_cost as total_recharge_cost,
|
|
|
|
+ nature_hundred_user_num as hundred_user_num,
|
|
|
|
+ nature_hundred_user_num_cost as hundred_user_num_cost,
|
|
|
|
+ nature_first_role_num as first_role_num,
|
|
|
|
+ nature_role_num as role_num,
|
|
|
|
+ nature_new_user_total_role_num as new_user_total_role_num,
|
|
|
|
+ round(IF(nature_first_role_num > 0, cost / nature_first_role_num, 0), 2) first_role_num_cost,
|
|
|
|
+ round(IF(nature_role_num > 0, cost / nature_role_num, 0), 2) role_num_cost,
|
|
|
|
+ round(IF(nature_new_user_total_role_num >0, cost / nature_new_user_total_role_num, 0), 2) new_user_total_role_num_cost,
|
|
|
|
+ round(IF(nature_reg_num >0, nature_first_role_num / nature_reg_num, 0), 4) first_role_num_rate,
|
|
|
|
+ round(IF(nature_reg_num >0, nature_role_num / nature_reg_num, 0), 4) role_num_rate,
|
|
|
|
+ round(IF(nature_reg_num >0, nature_new_user_total_role_num / nature_reg_num, 0), 4) new_user_total_role_num_rate
|
|
|
|
+ FROM
|
|
|
|
+ game_ads_parent.ads_game_day_parent
|
|
|
|
+ """ + cri +
|
|
|
|
+ """
|
|
|
|
+ ) a
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT
|
|
|
|
+ parent_game_id as game_id,
|
|
|
|
+ parent_game_name as game_name,
|
|
|
|
+ dt,
|
|
|
|
+ nature_da1 as da1,
|
|
|
|
+ nature_da2 as da2,
|
|
|
|
+ nature_da3 as da3,
|
|
|
|
+ nature_da4 as da4,
|
|
|
|
+ nature_da5 as da5,
|
|
|
|
+ nature_da6 as da6,
|
|
|
|
+ nature_da7 as da7,
|
|
|
|
+ nature_da8 as da8,
|
|
|
|
+ nature_da9 as da9,
|
|
|
|
+ nature_da10 as da10,
|
|
|
|
+ nature_da11 as da11,
|
|
|
|
+ nature_da12 as da12,
|
|
|
|
+ nature_da13 as da13,
|
|
|
|
+ nature_da14 as da14,
|
|
|
|
+ nature_da15 as da15,
|
|
|
|
+ nature_da16 as da16,
|
|
|
|
+ nature_da17 as da17,
|
|
|
|
+ nature_da18 as da18,
|
|
|
|
+ nature_da19 as da19,
|
|
|
|
+ nature_da20 as da20,
|
|
|
|
+ nature_da21 as da21,
|
|
|
|
+ nature_da22 as da22,
|
|
|
|
+ nature_da23 as da23,
|
|
|
|
+ nature_da24 as da24,
|
|
|
|
+ nature_da25 as da25,
|
|
|
|
+ nature_da26 as da26,
|
|
|
|
+ nature_da27 as da27,
|
|
|
|
+ nature_da28 as da28,
|
|
|
|
+ nature_da29 as da29,
|
|
|
|
+ nature_da30 as da30,
|
|
|
|
+ nature_da31 as da31,
|
|
|
|
+ nature_da32 as da32,
|
|
|
|
+ nature_da33 as da33,
|
|
|
|
+ nature_da34 as da34,
|
|
|
|
+ nature_da35 as da35,
|
|
|
|
+ nature_da36 as da36,
|
|
|
|
+ nature_da37 as da37,
|
|
|
|
+ nature_da38 as da38,
|
|
|
|
+ nature_da39 as da39,
|
|
|
|
+ nature_da40 as da40,
|
|
|
|
+ nature_da41 as da41,
|
|
|
|
+ nature_da42 as da42,
|
|
|
|
+ nature_da43 as da43,
|
|
|
|
+ nature_da44 as da44,
|
|
|
|
+ nature_da45 as da45,
|
|
|
|
+ nature_da46 as da46,
|
|
|
|
+ nature_da47 as da47,
|
|
|
|
+ nature_da48 as da48,
|
|
|
|
+ nature_da49 as da49,
|
|
|
|
+ nature_da50 as da50,
|
|
|
|
+ nature_da51 as da51,
|
|
|
|
+ nature_da52 as da52,
|
|
|
|
+ nature_da53 as da53,
|
|
|
|
+ nature_da54 as da54,
|
|
|
|
+ nature_da55 as da55,
|
|
|
|
+ nature_da56 as da56,
|
|
|
|
+ nature_da57 as da57,
|
|
|
|
+ nature_da58 as da58,
|
|
|
|
+ nature_da59 as da59,
|
|
|
|
+ nature_da60 as da60,
|
|
|
|
+ nature_da61 as da61,
|
|
|
|
+ nature_da62 as da62,
|
|
|
|
+ nature_da63 as da63,
|
|
|
|
+ nature_da64 as da64,
|
|
|
|
+ nature_da65 as da65,
|
|
|
|
+ nature_da66 as da66,
|
|
|
|
+ nature_da67 as da67,
|
|
|
|
+ nature_da68 as da68,
|
|
|
|
+ nature_da69 as da69,
|
|
|
|
+ nature_da70 as da70,
|
|
|
|
+ nature_da71 as da71,
|
|
|
|
+ nature_da72 as da72,
|
|
|
|
+ nature_da73 as da73,
|
|
|
|
+ nature_da74 as da74,
|
|
|
|
+ nature_da75 as da75,
|
|
|
|
+ nature_da76 as da76,
|
|
|
|
+ nature_da77 as da77,
|
|
|
|
+ nature_da78 as da78,
|
|
|
|
+ nature_da79 as da79,
|
|
|
|
+ nature_da80 as da80,
|
|
|
|
+ nature_da81 as da81,
|
|
|
|
+ nature_da82 as da82,
|
|
|
|
+ nature_da83 as da83,
|
|
|
|
+ nature_da84 as da84,
|
|
|
|
+ nature_da85 as da85,
|
|
|
|
+ nature_da86 as da86,
|
|
|
|
+ nature_da87 as da87,
|
|
|
|
+ nature_da88 as da88,
|
|
|
|
+ nature_da89 as da89,
|
|
|
|
+ nature_da90 as da90,
|
|
|
|
+ nature_m4 as m4,
|
|
|
|
+ nature_m5 as m5,
|
|
|
|
+ nature_m6 as m6,
|
|
|
|
+ nature_m7 as m7,
|
|
|
|
+ nature_m8 as m8,
|
|
|
|
+ nature_m9 as m9,
|
|
|
|
+ nature_m10 as m10,
|
|
|
|
+ nature_m11 as m11,
|
|
|
|
+ nature_m12 as m12
|
|
|
|
+ FROM
|
|
|
|
+ """ + tableName + cri +
|
|
|
|
+ """
|
|
|
|
+ ) b
|
|
|
|
+ ON a.game_id = b.game_id and a.cost_date = b.dt and a.game_name = b.game_name
|
|
|
|
+ """;
|
|
|
|
+ }
|
|
|
|
+ //总量 total
|
|
|
|
+ return """
|
|
|
|
+ SELECT
|
|
|
|
+ a.*,
|
|
|
|
+ b.*
|
|
|
|
+ FROM (
|
|
|
|
+ SELECT
|
|
|
|
+ dt cost_date,
|
|
|
|
+ parent_game_name as game_name,
|
|
|
|
+ parent_game_id as game_id,
|
|
|
|
+ parent_game_name_classify as game_classify,
|
|
|
|
+ source_system,
|
|
|
|
+ cost,
|
|
|
|
+ reg_num,
|
|
|
|
+ first_new_user_amount_count,
|
|
|
|
+ first_new_user_amount_num,
|
|
|
|
+ first_new_user_amount,
|
|
|
|
+ old_user_count,
|
|
|
|
+ old_user_num,
|
|
|
|
+ old_user_amount,
|
|
|
|
+ amount_count,
|
|
|
|
+ amount_num,
|
|
|
|
+ amount,
|
|
|
|
+ new_user_total_amount_count,
|
|
|
|
+ new_user_total_amount_num,
|
|
|
|
+ new_user_total_amount,
|
|
|
|
+ total_roi,
|
|
|
|
+ first_roi,
|
|
|
|
+ first_amount_rate,
|
|
|
|
+ today_amount_rate,
|
|
|
|
+ new_user_rate,
|
|
|
|
+ first_avg_amount,
|
|
|
|
+ today_avg_amount,
|
|
|
|
+ avg_amount,
|
|
|
|
+ user_again_rate,
|
|
|
|
+ reg_user_arpu,
|
|
|
|
+ first_amount_arpu,
|
|
|
|
+ today_amount_arpu,
|
|
|
|
+ amount_arpu,
|
|
|
|
+ reg_cost,
|
|
|
|
+ first_amount_cost as first_new_user_recharge_cost,
|
|
|
|
+ total_amount_cost as total_recharge_cost,
|
|
|
|
+ hundred_user_num,
|
|
|
|
+ hundred_user_num_cost,
|
|
|
|
+ first_role_num,
|
|
|
|
+ role_num,
|
|
|
|
+ new_user_total_role_num,
|
|
|
|
+ round(IF(first_role_num > 0, cost / first_role_num, 0), 2) first_role_num_cost,
|
|
|
|
+ round(IF(role_num > 0, cost / role_num, 0), 2) role_num_cost,
|
|
|
|
+ round(IF(new_user_total_role_num >0, cost / new_user_total_role_num, 0), 2) new_user_total_role_num_cost,
|
|
|
|
+ round(IF(reg_num >0, first_role_num / reg_num, 0), 4) first_role_num_rate,
|
|
|
|
+ round(IF(reg_num >0, role_num / reg_num, 0), 4) role_num_rate,
|
|
|
|
+ round(IF(reg_num >0, new_user_total_role_num / reg_num, 0), 4) new_user_total_role_num_rate
|
|
|
|
+ FROM
|
|
|
|
+ game_ads_parent.ads_game_day_parent
|
|
|
|
+ """ + cri +
|
|
|
|
+ """
|
|
|
|
+ ) a
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT
|
|
|
|
+ parent_game_id as game_id,
|
|
|
|
+ parent_game_name as game_name,
|
|
|
|
+ dt,
|
|
|
|
+ da1,
|
|
|
|
+ da2,
|
|
|
|
+ da3,
|
|
|
|
+ da4,
|
|
|
|
+ da5,
|
|
|
|
+ da6,
|
|
|
|
+ da7,
|
|
|
|
+ da8,
|
|
|
|
+ da9,
|
|
|
|
+ da10,
|
|
|
|
+ da11,
|
|
|
|
+ da12,
|
|
|
|
+ da13,
|
|
|
|
+ da14,
|
|
|
|
+ da15,
|
|
|
|
+ da16,
|
|
|
|
+ da17,
|
|
|
|
+ da18,
|
|
|
|
+ da19,
|
|
|
|
+ da20,
|
|
|
|
+ da21,
|
|
|
|
+ da22,
|
|
|
|
+ da23,
|
|
|
|
+ da24,
|
|
|
|
+ da25,
|
|
|
|
+ da26,
|
|
|
|
+ da27,
|
|
|
|
+ da28,
|
|
|
|
+ da29,
|
|
|
|
+ da30,
|
|
|
|
+ da31,
|
|
|
|
+ da32,
|
|
|
|
+ da33,
|
|
|
|
+ da34,
|
|
|
|
+ da35,
|
|
|
|
+ da36,
|
|
|
|
+ da37,
|
|
|
|
+ da38,
|
|
|
|
+ da39,
|
|
|
|
+ da40,
|
|
|
|
+ da41,
|
|
|
|
+ da42,
|
|
|
|
+ da43,
|
|
|
|
+ da44,
|
|
|
|
+ da45,
|
|
|
|
+ da46,
|
|
|
|
+ da47,
|
|
|
|
+ da48,
|
|
|
|
+ da49,
|
|
|
|
+ da50,
|
|
|
|
+ da51,
|
|
|
|
+ da52,
|
|
|
|
+ da53,
|
|
|
|
+ da54,
|
|
|
|
+ da55,
|
|
|
|
+ da56,
|
|
|
|
+ da57,
|
|
|
|
+ da58,
|
|
|
|
+ da59,
|
|
|
|
+ da60,
|
|
|
|
+ da61,
|
|
|
|
+ da62,
|
|
|
|
+ da63,
|
|
|
|
+ da64,
|
|
|
|
+ da65,
|
|
|
|
+ da66,
|
|
|
|
+ da67,
|
|
|
|
+ da68,
|
|
|
|
+ da69,
|
|
|
|
+ da70,
|
|
|
|
+ da71,
|
|
|
|
+ da72,
|
|
|
|
+ da73,
|
|
|
|
+ da74,
|
|
|
|
+ da75,
|
|
|
|
+ da76,
|
|
|
|
+ da77,
|
|
|
|
+ da78,
|
|
|
|
+ da79,
|
|
|
|
+ da80,
|
|
|
|
+ da81,
|
|
|
|
+ da82,
|
|
|
|
+ da83,
|
|
|
|
+ da84,
|
|
|
|
+ da85,
|
|
|
|
+ da86,
|
|
|
|
+ da87,
|
|
|
|
+ da88,
|
|
|
|
+ da89,
|
|
|
|
+ da90,
|
|
|
|
+ m4,
|
|
|
|
+ m5,
|
|
|
|
+ m6,
|
|
|
|
+ m7,
|
|
|
|
+ m8,
|
|
|
|
+ m9,
|
|
|
|
+ m10,
|
|
|
|
+ m11,
|
|
|
|
+ m12
|
|
|
|
+ FROM
|
|
|
|
+ """ + tableName + cri +
|
|
|
|
+ """
|
|
|
|
+ ) b
|
|
|
|
+ ON a.game_id = b.game_id and a.cost_date = b.dt and a.game_name = b.game_name
|
|
|
|
+ """;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 游戏数据每日总计一栏(按类型返回sql)
|
|
|
|
+ *
|
|
|
|
+ * @param type 查询的类型 buy、nature、total
|
|
|
|
+ * @return String
|
|
|
|
+ */
|
|
|
|
+ private String getTotalGameData(String type, String tableName) {
|
|
|
|
+ if ("buy".equals(type)) {
|
|
|
|
+ return """
|
|
|
|
+ SELECT
|
|
|
|
+ IFNULL(SUM(cost), 0) cost,
|
|
|
|
+ IFNULL(SUM(buy_reg_num), 0) reg_num,
|
|
|
|
+ IFNULL(SUM(buy_first_new_user_amount_count), 0) first_new_user_amount_count,
|
|
|
|
+ IFNULL(SUM(buy_first_new_user_amount_num), 0) first_new_user_amount_num,
|
|
|
|
+ IFNULL(SUM(buy_first_new_user_amount), 0) first_new_user_amount,
|
|
|
|
+ IFNULL(SUM(buy_old_user_count), 0) old_user_count,
|
|
|
|
+ IFNULL(SUM(buy_old_user_num), 0) old_user_num,
|
|
|
|
+ IFNULL(SUM(buy_old_user_amount), 0) old_user_amount,
|
|
|
|
+ IFNULL(SUM(buy_amount_count), 0) amount_count,
|
|
|
|
+ IFNULL(SUM(buy_amount_num), 0) amount_num,
|
|
|
|
+ IFNULL(SUM(buy_amount), 0) amount,
|
|
|
|
+ IFNULL(SUM(buy_new_user_total_amount_count), 0) new_user_total_amount_count,
|
|
|
|
+ IFNULL(SUM(buy_new_user_total_amount_num), 0) new_user_total_amount_num,
|
|
|
|
+ IFNULL(SUM(buy_new_user_total_amount), 0) new_user_total_amount,
|
|
|
|
+ round(if(SUM(cost) > 0 , SUM(buy_first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
|
|
|
|
+ round(if(SUM(buy_reg_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_reg_num) ,0), 4) first_amount_rate,
|
|
|
|
+ round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount_num) / SUM(buy_reg_num), 0) ,4) today_amount_rate,
|
|
|
|
+ round(if(SUM(buy_amount_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_amount_num) ,0), 4) 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) 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) today_avg_amount,
|
|
|
|
+ round(if(SUM(buy_amount_count) > 0, SUM(buy_amount) / SUM(buy_amount_count), 0), 2) 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) user_again_rate,
|
|
|
|
+ round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount) / SUM(buy_reg_num), 0), 2) 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) 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) today_amount_arpu,
|
|
|
|
+ round(if(SUM(buy_amount_num) > 0, SUM(buy_amount) / SUM(buy_amount_num), 0), 2) amount_arpu,
|
|
|
|
+ round(if(SUM(buy_reg_num) > 0, SUM(cost) / SUM(buy_reg_num), 0), 2) reg_cost,
|
|
|
|
+ round(if(SUM(buy_first_new_user_amount_num) > 0, SUM(cost) / SUM(buy_first_new_user_amount_num), 0), 2) 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) total_recharge_cost,
|
|
|
|
+ round(if(SUM(cost) > 0, SUM(buy_new_user_total_amount) / SUM(cost), 0), 4) total_roi,
|
|
|
|
+ IFNULL(SUM(buy_hundred_user_num), 0) hundred_user_num,
|
|
|
|
+ round(IF(SUM(buy_hundred_user_num) > 0, SUM(cost) / SUM(buy_hundred_user_num), 0), 2) hundred_user_num_cost,
|
|
|
|
+ IFNULL(SUM(buy_first_role_num), 0) first_role_num,
|
|
|
|
+ IFNULL(SUM(buy_role_num), 0) role_num,
|
|
|
|
+ IFNULL(SUM(buy_new_user_total_role_num), 0) new_user_total_role_num,
|
|
|
|
+ round(IF(SUM(buy_first_role_num) > 0, SUM(cost) / SUM(buy_first_role_num), 0), 2) first_role_num_cost,
|
|
|
|
+ round(IF(SUM(buy_role_num) > 0, SUM(cost) / SUM(buy_role_num), 0), 2) role_num_cost,
|
|
|
|
+ round(IF(SUM(buy_new_user_total_role_num) >0, SUM(cost) / SUM(buy_new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
|
|
|
|
+ round(IF(SUM(buy_reg_num) >0, SUM(buy_first_role_num) / SUM(buy_reg_num), 0), 4) first_role_num_rate,
|
|
|
|
+ round(IF(SUM(buy_reg_num) >0, SUM(buy_role_num) / SUM(buy_reg_num), 0), 4) role_num_rate,
|
|
|
|
+ round(IF(SUM(buy_reg_num) >0, SUM(buy_new_user_total_role_num) / SUM(buy_reg_num), 0), 4) new_user_total_role_num_rate
|
|
|
|
+ FROM
|
|
|
|
+ """ + tableName;
|
|
|
|
+ } else if ("nature".equals(type)) {
|
|
|
|
+ return """
|
|
|
|
+ SELECT
|
|
|
|
+ IFNULL(SUM(cost), 0) cost,
|
|
|
|
+ IFNULL(SUM(nature_reg_num), 0) reg_num,
|
|
|
|
+ IFNULL(SUM(nature_first_new_user_amount_count), 0) first_new_user_amount_count,
|
|
|
|
+ IFNULL(SUM(nature_first_new_user_amount_num), 0) first_new_user_amount_num,
|
|
|
|
+ IFNULL(SUM(nature_first_new_user_amount), 0) first_new_user_amount,
|
|
|
|
+ IFNULL(SUM(nature_old_user_count), 0) old_user_count,
|
|
|
|
+ IFNULL(SUM(nature_old_user_num), 0) old_user_num,
|
|
|
|
+ IFNULL(SUM(nature_old_user_amount), 0) old_user_amount,
|
|
|
|
+ IFNULL(SUM(nature_amount_count), 0) amount_count,
|
|
|
|
+ IFNULL(SUM(nature_amount_num), 0) amount_num,
|
|
|
|
+ IFNULL(SUM(nature_amount), 0) amount,
|
|
|
|
+ IFNULL(SUM(nature_new_user_total_amount_count), 0) new_user_total_amount_count,
|
|
|
|
+ IFNULL(SUM(nature_new_user_total_amount_num), 0) new_user_total_amount_num,
|
|
|
|
+ IFNULL(SUM(nature_new_user_total_amount), 0) new_user_total_amount,
|
|
|
|
+ round(if(SUM(cost) > 0 , SUM(nature_first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
|
|
|
|
+ round(if(SUM(nature_reg_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_reg_num) ,0), 4) first_amount_rate,
|
|
|
|
+ round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount_num) / SUM(nature_reg_num), 0) ,4) today_amount_rate,
|
|
|
|
+ round(if(SUM(nature_amount_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_amount_num) ,0), 4) 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) 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) today_avg_amount,
|
|
|
|
+ round(if(SUM(nature_amount_count) > 0, SUM(nature_amount) / SUM(nature_amount_count), 0), 2) 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) user_again_rate,
|
|
|
|
+ round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount) / SUM(nature_reg_num), 0), 2) 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) 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) today_amount_arpu,
|
|
|
|
+ round(if(SUM(nature_amount_num) > 0, SUM(nature_amount) / SUM(nature_amount_num), 0), 2) amount_arpu,
|
|
|
|
+ round(if(SUM(nature_reg_num) > 0, SUM(cost) / SUM(nature_reg_num), 0), 2) reg_cost,
|
|
|
|
+ round(if(SUM(nature_first_new_user_amount_num) > 0, SUM(cost) / SUM(nature_first_new_user_amount_num), 0), 2) 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) total_recharge_cost,
|
|
|
|
+ round(if(SUM(cost) > 0, SUM(nature_new_user_total_amount) / SUM(cost), 0), 4) total_roi,
|
|
|
|
+ IFNULL(SUM(nature_hundred_user_num), 0) hundred_user_num,
|
|
|
|
+ round(IF(SUM(nature_hundred_user_num) > 0, SUM(cost) / SUM(nature_hundred_user_num), 0), 2) hundred_user_num_cost,
|
|
|
|
+ IFNULL(SUM(nature_first_role_num), 0) first_role_num,
|
|
|
|
+ IFNULL(SUM(nature_role_num), 0) role_num,
|
|
|
|
+ IFNULL(SUM(nature_new_user_total_role_num), 0) new_user_total_role_num,
|
|
round(IF(SUM(nature_first_role_num) > 0, SUM(cost) / SUM(nature_first_role_num), 0), 2) first_role_num_cost,
|
|
round(IF(SUM(nature_first_role_num) > 0, SUM(cost) / SUM(nature_first_role_num), 0), 2) first_role_num_cost,
|
|
round(IF(SUM(nature_role_num) > 0, SUM(cost) / SUM(nature_role_num), 0), 2) role_num_cost,
|
|
round(IF(SUM(nature_role_num) > 0, SUM(cost) / SUM(nature_role_num), 0), 2) role_num_cost,
|
|
round(IF(SUM(nature_new_user_total_role_num) >0, SUM(cost) / SUM(nature_new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
|
|
round(IF(SUM(nature_new_user_total_role_num) >0, SUM(cost) / SUM(nature_new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
|
|
round(IF(SUM(nature_reg_num) >0, SUM(nature_first_role_num) / SUM(nature_reg_num), 0), 4) first_role_num_rate,
|
|
round(IF(SUM(nature_reg_num) >0, SUM(nature_first_role_num) / SUM(nature_reg_num), 0), 4) first_role_num_rate,
|
|
round(IF(SUM(nature_reg_num) >0, SUM(nature_role_num) / SUM(nature_reg_num), 0), 4) role_num_rate,
|
|
round(IF(SUM(nature_reg_num) >0, SUM(nature_role_num) / SUM(nature_reg_num), 0), 4) role_num_rate,
|
|
round(IF(SUM(nature_reg_num) >0, SUM(nature_new_user_total_role_num) / SUM(nature_reg_num), 0), 4) new_user_total_role_num_rate
|
|
round(IF(SUM(nature_reg_num) >0, SUM(nature_new_user_total_role_num) / SUM(nature_reg_num), 0), 4) new_user_total_role_num_rate
|
|
- FROM
|
|
|
|
- ads_game_day
|
|
|
|
- """;
|
|
|
|
|
|
+ FROM
|
|
|
|
+ """ + tableName;
|
|
}
|
|
}
|
|
//total总量数据
|
|
//total总量数据
|
|
return """
|
|
return """
|
|
@@ -1256,9 +1820,8 @@ public class IActiveDataServiceImpl implements IActiveDataService {
|
|
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(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(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
|
|
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
|
|
|
|
- """;
|
|
|
|
|
|
+ FROM
|
|
|
|
+ """ + tableName;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|