|
@@ -1,5 +1,6 @@
|
|
|
package com.zanxiang.game.data.serve.service.impl;
|
|
|
|
|
|
+import com.google.common.base.CaseFormat;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.zanxiang.erp.security.util.SecurityUtil;
|
|
|
import com.zanxiang.game.data.serve.pojo.dto.GamePromoteDayDTO;
|
|
@@ -7,9 +8,11 @@ import com.zanxiang.game.data.serve.pojo.dto.GamePromoteDayTotalDTO;
|
|
|
import com.zanxiang.game.data.serve.pojo.dto.GamePromoteTotalDTO;
|
|
|
import com.zanxiang.game.data.serve.pojo.entity.AdsAccountAgentDay;
|
|
|
import com.zanxiang.game.data.serve.pojo.entity.AdsGameDay;
|
|
|
+import com.zanxiang.game.data.serve.pojo.enums.OrderByEnum;
|
|
|
import com.zanxiang.game.data.serve.pojo.vo.GamePromoteDayTotalVO;
|
|
|
import com.zanxiang.game.data.serve.pojo.vo.GamePromoteDayVO;
|
|
|
import com.zanxiang.game.data.serve.pojo.vo.GamePromoteTotalVO;
|
|
|
+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;
|
|
@@ -51,6 +54,12 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
|
|
|
Long sysUserId = SecurityUtil.isAdmin() ? null : SecurityUtil.getUserId();
|
|
|
sysUserId = null == dto.getSysUserId() ? sysUserId : dto.getSysUserId();
|
|
|
dto.setSysUserId(sysUserId);
|
|
|
+ if (StringUtils.isBlank(dto.getSortFiled())){
|
|
|
+ dto.setSortFiled("dt");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(dto.getSortType())){
|
|
|
+ dto.setSortType(OrderByEnum.DESC.getOrderType());
|
|
|
+ }
|
|
|
if (null == dto.getBeginDay() || null == dto.getEndDay()){
|
|
|
dto.setBeginDay(LocalDate.now());
|
|
|
dto.setEndDay(LocalDate.now());
|
|
@@ -83,13 +92,88 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
|
|
|
if (null != dto.getEndDay()) {
|
|
|
cri.where().and("dt", "<=", dto.getEndDay());
|
|
|
}
|
|
|
- Sql sql = Sqls.queryEntity(accountAgentDaySql() + "$condition" + " order by dt desc");
|
|
|
+ cri.orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType());
|
|
|
+ Sql sql = Sqls.queryEntity(accountAgentDaySql() + "$condition");
|
|
|
sql.setPager(pager);
|
|
|
Entity<GamePromoteDayVO> entity = dao.getEntity(GamePromoteDayVO.class);
|
|
|
sql.setEntity(entity).setCondition(cri);
|
|
|
dao.execute(sql);
|
|
|
pager.setRecordCount(dao.count(AdsAccountAgentDay.class, cri));
|
|
|
- return new Page<>(sql.getList(GamePromoteDayVO.class), pager);
|
|
|
+ List<GamePromoteDayVO> collect = sql.getList(GamePromoteDayVO.class).stream().map(item -> {
|
|
|
+ String[] trendDay1 = item.getTrendDay1().split("/");
|
|
|
+ item.setRechargeTrendDay1(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(trendDay1[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(trendDay1[1]))
|
|
|
+ .increase(new BigDecimal(trendDay1[2]))
|
|
|
+ .back(new BigDecimal(trendDay1[3]))
|
|
|
+ .multiples(new BigDecimal(trendDay1[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] trendDay3 = item.getTrendDay3().split("/");
|
|
|
+ item.setRechargeTrendDay3(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(trendDay3[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(trendDay3[1]))
|
|
|
+ .increase(new BigDecimal(trendDay3[2]))
|
|
|
+ .back(new BigDecimal(trendDay3[3]))
|
|
|
+ .multiples(new BigDecimal(trendDay3[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] trendDay7 = item.getTrendDay7().split("/");
|
|
|
+ item.setRechargeTrendDay7(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(trendDay7[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(trendDay7[1]))
|
|
|
+ .increase(new BigDecimal(trendDay7[2]))
|
|
|
+ .back(new BigDecimal(trendDay7[3]))
|
|
|
+ .multiples(new BigDecimal(trendDay7[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] trendDay15 = item.getTrendDay15().split("/");
|
|
|
+ item.setRechargeTrendDay15(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(trendDay15[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(trendDay15[1]))
|
|
|
+ .increase(new BigDecimal(trendDay15[2]))
|
|
|
+ .back(new BigDecimal(trendDay15[3]))
|
|
|
+ .multiples(new BigDecimal(trendDay15[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] trendMonth1 = item.getTrendMonth1().split("/");
|
|
|
+ item.setRechargeTrendMonth1(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(trendMonth1[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(trendMonth1[1]))
|
|
|
+ .increase(new BigDecimal(trendMonth1[2]))
|
|
|
+ .back(new BigDecimal(trendMonth1[3]))
|
|
|
+ .multiples(new BigDecimal(trendMonth1[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] trendMonth2 = item.getTrendMonth2().split("/");
|
|
|
+ item.setRechargeTrendMonth2(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(trendMonth2[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(trendMonth2[1]))
|
|
|
+ .increase(new BigDecimal(trendMonth2[2]))
|
|
|
+ .back(new BigDecimal(trendMonth2[3]))
|
|
|
+ .multiples(new BigDecimal(trendMonth2[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] trendMonth3 = item.getTrendMonth3().split("/");
|
|
|
+ item.setRechargeTrendMonth3(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(trendMonth3[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(trendMonth3[1]))
|
|
|
+ .increase(new BigDecimal(trendMonth3[2]))
|
|
|
+ .back(new BigDecimal(trendMonth3[3]))
|
|
|
+ .multiples(new BigDecimal(trendMonth3[4]))
|
|
|
+ .build());
|
|
|
+
|
|
|
+ String[] trendTotal = item.getTrendTotal().split("/");
|
|
|
+ item.setRechargeTrendTotal(RechargeTrendVO.builder()
|
|
|
+ .rechargeMoney(new BigDecimal(trendTotal[0]))
|
|
|
+ .rechargeUserCount(Long.valueOf(trendTotal[1]))
|
|
|
+ .increase(new BigDecimal(trendTotal[2]))
|
|
|
+ .back(new BigDecimal(trendTotal[3]))
|
|
|
+ .multiples(new BigDecimal(trendTotal[4]))
|
|
|
+ .build());
|
|
|
+ return item;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return new Page<>(collect, pager);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -136,6 +220,12 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
|
|
|
Long sysUserId = SecurityUtil.isAdmin() ? null : SecurityUtil.getUserId();
|
|
|
sysUserId = null == dto.getSysUserId() ? sysUserId : dto.getSysUserId();
|
|
|
dto.setSysUserId(sysUserId);
|
|
|
+ if (StringUtils.isBlank(dto.getSortFiled())){
|
|
|
+ dto.setSortFiled("cost");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(dto.getSortType())){
|
|
|
+ dto.setSortType(OrderByEnum.DESC.getOrderType());
|
|
|
+ }
|
|
|
if (null == dto.getCostEndDay() || null == dto.getCostBeginDay()) {
|
|
|
dto.setCostBeginDay(LocalDate.now());
|
|
|
dto.setCostEndDay(LocalDate.now());
|
|
@@ -173,6 +263,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
|
|
|
cri.where().and("a.dt", "<=", dto.getCostEndDay());
|
|
|
}
|
|
|
cri.groupBy("a.account_id,a.agent_id");
|
|
|
+ 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);
|
|
@@ -356,14 +447,14 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
|
|
|
first_arpu AS first_recharge_arpu,
|
|
|
today_arpu AS today_recharge_arpu,
|
|
|
paper_arpu AS show_recharge_arpu,
|
|
|
- amount_d1 AS recharge_trend_day1,
|
|
|
- amount_d3 AS recharge_trend_day3,
|
|
|
- amount_d7 AS recharge_trend_day7,
|
|
|
- amount_d15 AS recharge_trend_day15,
|
|
|
- amount_m1 AS recharge_trend_month1,
|
|
|
- amount_m2 AS recharge_trend_month2,
|
|
|
- amount_m3 AS recharge_trend_month3,
|
|
|
- amount_sum AS recharge_trend_total,
|
|
|
+ amount_d1 AS trend_day1,
|
|
|
+ amount_d3 AS trend_day3,
|
|
|
+ amount_d7 AS trend_day7,
|
|
|
+ amount_d15 AS trend_day15,
|
|
|
+ amount_m1 AS trend_month1,
|
|
|
+ amount_m2 AS trend_month2,
|
|
|
+ amount_m3 AS trend_month3,
|
|
|
+ amount_sum AS trend_total,
|
|
|
hundred_user_num,
|
|
|
hundred_user_num_cost
|
|
|
from
|
|
@@ -499,9 +590,9 @@ 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,
|
|
|
- sum(b.amount_count) as show_recharge_count,
|
|
|
- sum(b.amount_num) as show_recharge_user,
|
|
|
- sum(b.amount) as show_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,
|