|
@@ -15,8 +15,11 @@ import com.zanxiang.game.data.serve.pojo.vo.RechargeTrendVO;
|
|
|
import com.zanxiang.game.data.serve.service.IAccountAgentDayService;
|
|
|
import com.zanxiang.game.data.serve.utils.Page;
|
|
|
import com.zanxiang.module.util.DateUtil;
|
|
|
+import io.swagger.annotations.ApiModelProperty;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
import lombok.Builder;
|
|
|
import lombok.Data;
|
|
|
+import lombok.NoArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.nutz.dao.Cnd;
|
|
@@ -281,14 +284,12 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
|
|
|
if (null != dto.getCostEndDay()) {
|
|
|
cri.where().and("a.dt", "<=", dto.getCostEndDay());
|
|
|
}
|
|
|
- cri.groupBy("a.account_id,a.agent_id");
|
|
|
+ cri.groupBy("a.account_id,a.agent_id,a.source_system");
|
|
|
cri.orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType());
|
|
|
Sql sql = Sqls.queryEntity(accountAgentTotalSql() + "$condition");
|
|
|
sql.setPager(pager);
|
|
|
Entity<GamePromoteTotalVO> entity = dao.getEntity(GamePromoteTotalVO.class);
|
|
|
sql.setEntity(entity).setCondition(cri);
|
|
|
- sql.setParam("rechargeBeginDay", dto.getRechargeBeginDay());
|
|
|
- sql.setParam("rechargeEndDay", dto.getRechargeEndDay());
|
|
|
dao.execute(sql);
|
|
|
Sql sqlCount = Sqls.queryEntity("select count(*) from ads_account_agent_day a " + "$condition");
|
|
|
sqlCount.setCondition(cri);
|
|
@@ -300,8 +301,43 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
|
|
|
dayNMap.put("beginDay", dto.getCostBeginDay());
|
|
|
dayNMap.put("endDay", dto.getCostEndDay());
|
|
|
|
|
|
+ String show = """
|
|
|
+ select
|
|
|
+ ifnull(sum(amount_count),0) as show_recharge_count,
|
|
|
+ ifnull(sum(amount_num),0) as show_recharge_user,
|
|
|
+ ifnull(sum(amount),0) as show_recharge_money,
|
|
|
+ round(if(sum(amount_count) > 0, sum(amount) / sum(amount_count), 0), 4) as avg_show_user_recharge,
|
|
|
+ round(if(sum(amount_num) > 0, sum(amount) / sum(amount_num), 0), 4) as show_recharge_arpu
|
|
|
+ from
|
|
|
+ ads_account_agent_day
|
|
|
+ where
|
|
|
+ source_system = @sourceSystem
|
|
|
+ and agent_id = @agentId
|
|
|
+ and account_id = @accountId
|
|
|
+ and dt >= @rechargeBeginDay
|
|
|
+ and dt <= @rechargeEndDay
|
|
|
+ group by
|
|
|
+ account_id,agent_id,source_system
|
|
|
+ """;
|
|
|
+ Sql showSql = Sqls.queryEntity(show);
|
|
|
+ Entity<ShowRecharge> showEntity = dao.getEntity(ShowRecharge.class);
|
|
|
+ showSql.setEntity(showEntity);
|
|
|
+ showSql.setParam("rechargeBeginDay", dto.getRechargeBeginDay());
|
|
|
+ showSql.setParam("rechargeEndDay", dto.getRechargeEndDay());
|
|
|
//循环总数据的每条数据
|
|
|
List<GamePromoteTotalVO> hasRechargeDayList = list.stream().map(item -> {
|
|
|
+ showSql.setParam("sourceSystem", item.getSourceSystem());
|
|
|
+ showSql.setParam("agentId", item.getAgentId());
|
|
|
+ showSql.setParam("accountId", item.getAccountId());
|
|
|
+ dao.execute(showSql);
|
|
|
+ ShowRecharge showRecharge = showSql.getObject(ShowRecharge.class);
|
|
|
+ if (null != showRecharge){
|
|
|
+ item.setShowRechargeArpu(showRecharge.showRechargeArpu);
|
|
|
+ item.setShowRechargeCount(showRecharge.getShowRechargeCount());
|
|
|
+ item.setShowRechargeMoney(showRecharge.showRechargeMoney);
|
|
|
+ item.setShowRechargeUser(showRecharge.getShowRechargeUser());
|
|
|
+ item.setAvgShowUserRecharge(showRecharge.avgShowUserRecharge);
|
|
|
+ }
|
|
|
Sql sqlDayN = Sqls.queryString("select dayN from ads_dayn_amount where " +
|
|
|
"dt>=@beginDay and dt<=@endDay " +
|
|
|
"and account_id = @accountId " +
|
|
@@ -569,6 +605,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
|
|
|
return """
|
|
|
select
|
|
|
concat(a.account_id, a.agent_id) as id,
|
|
|
+ a.source_system,
|
|
|
a.account_id,
|
|
|
a.agent_id,
|
|
|
max(a.agent_name) as agent_name,
|
|
@@ -611,9 +648,6 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
|
|
|
sum(a.first_new_user_amount_count) as user_recharge_count,
|
|
|
sum(a.first_new_user_amount_num) as user_recharge_user,
|
|
|
sum(a.first_new_user_amount) as user_recharge_money,
|
|
|
- ifnull(sum(b.amount_count),0) as show_recharge_count,
|
|
|
- ifnull(sum(b.amount_num),0) as show_recharge_user,
|
|
|
- ifnull(sum(b.amount),0) as show_recharge_money,
|
|
|
sum(a.old_amount_count) as old_user_recharge_count,
|
|
|
sum(a.old_amount_num) as old_user_recharge_user,
|
|
|
sum(a.old_amount) as old_user_recharge_money,
|
|
@@ -635,24 +669,16 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
|
|
|
round(if(sum(a.register_num) > 0, sum(a.new_user_total_amount_num) / sum(a.register_num), 0), 4) as today_recharge_rate,
|
|
|
round(if(sum(a.first_new_user_amount_count) > 0, sum(a.first_new_user_amount) / sum(a.first_new_user_amount_count), 0), 4) as avg_first_user_recharge,
|
|
|
round(if(sum(a.new_user_total_amount_count) > 0, sum(a.new_user_total_amount) / sum(a.new_user_total_amount_count), 0), 4) as avg_today_recharge,
|
|
|
- round(if(sum(b.amount_count) > 0, sum(b.amount) / sum(b.amount_count), 0), 4) as avg_show_user_recharge,
|
|
|
round(if(sum(a.first_new_user_amount_num) > 0, sum(a.cost) / sum(a.first_new_user_amount_num), 0), 4) as first_recharge_cost,
|
|
|
round(if(sum(a.new_user_total_amount_num) > 0, sum(a.cost) / sum(a.new_user_total_amount_num), 0), 4) as today_recharge_cost,
|
|
|
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) as today_repeat_recharge_rate,
|
|
|
round(if(sum(a.register_num) > 0, sum(a.new_user_total_amount) / sum(a.register_num), 0), 4) as new_reg_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), 4) as first_recharge_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), 4) as today_recharge_arpu,
|
|
|
- round(if(sum(a.amount_num) > 0, sum(a.amount) / sum(a.amount_num), 0), 4) as show_recharge_arpu,
|
|
|
sum(a.hundred_user_num) as hundred_user_num,
|
|
|
round(if(sum(a.hundred_user_num) > 0, sum(a.cost) / sum(a.hundred_user_num), 0), 4) as hundred_user_num_cost
|
|
|
from
|
|
|
ads_account_agent_day a
|
|
|
- left join game_ads.ads_account_agent_day b on
|
|
|
- b.pitcher_id = a.pitcher_id
|
|
|
- and b.agent_id = a.agent_id
|
|
|
- and b.account_id = a.account_id
|
|
|
- and b.dt >= @rechargeBeginDay
|
|
|
- and b.dt <= @rechargeEndDay
|
|
|
""";
|
|
|
}
|
|
|
|
|
@@ -664,4 +690,20 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
|
|
|
private Long rechargeNum;
|
|
|
private Long repeatNum;
|
|
|
}
|
|
|
+
|
|
|
+ @Data
|
|
|
+ @NoArgsConstructor
|
|
|
+ @AllArgsConstructor
|
|
|
+ @Builder
|
|
|
+ public static class ShowRecharge{
|
|
|
+ private Long showRechargeCount;
|
|
|
+
|
|
|
+ private Long showRechargeUser;
|
|
|
+
|
|
|
+ private BigDecimal showRechargeMoney;
|
|
|
+
|
|
|
+ private BigDecimal avgShowUserRecharge;
|
|
|
+
|
|
|
+ private BigDecimal showRechargeArpu;
|
|
|
+ }
|
|
|
}
|