|
@@ -2505,25 +2505,43 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
//h5账面
|
|
|
String show = """
|
|
|
select
|
|
|
- sum(h5_buy_amount) as h5_buy_amount,
|
|
|
- sum(h5_buy_amount_num) as h5_buy_amount_num,
|
|
|
- sum(h5_nature_amount) as h5_nature_amount,
|
|
|
- sum(h5_nature_amount_num) as h5_nature_amount_num
|
|
|
- from ads_h5_game_day
|
|
|
+ sum(a.h5_buy_amount) as h5_buy_amount,
|
|
|
+ (select count(distinct user_id) from ads_information
|
|
|
+ where
|
|
|
+ source_system = a.source_system
|
|
|
+ and h5_game_id = a.game_id
|
|
|
+ and agent_id != 0
|
|
|
+ and classify = 5
|
|
|
+ and order_time >= @rechargeBeginDay
|
|
|
+ and order_time <= @rechargeEndDay) as h5_buy_amount_num,
|
|
|
+ sum(a.h5_nature_amount) as h5_nature_amount,
|
|
|
+ (select count(distinct user_id) from ads_information
|
|
|
+ where
|
|
|
+ source_system = a.source_system
|
|
|
+ and h5_game_id = a.game_id
|
|
|
+ and agent_id = 0
|
|
|
+ and classify = 5
|
|
|
+ and order_time >= @rechargeBeginDay
|
|
|
+ and order_time <= @rechargeEndDay) as h5_nature_amount_num
|
|
|
+ from ads_h5_game_day a
|
|
|
""";
|
|
|
Sql showSql = Sqls.queryEntity(show + "$condition");
|
|
|
+ showSql.setParam("rechargeBeginDay", dto.getRechargeBeginDate());
|
|
|
+ showSql.setParam("rechargeEndDay", dto.getRechargeEndDate());
|
|
|
Entity<ShowRecharge> showEntity = dao.getEntity(ShowRecharge.class);
|
|
|
List<GameDataH5VO> gameDataH5VOList = sql.getList(GameDataH5VO.class).stream().map(item -> {
|
|
|
{
|
|
|
SimpleCriteria showCri = Cnd.cri();
|
|
|
if (StringUtils.isNotBlank(dto.getGameName())) {
|
|
|
- showCri.where().andLike("game_name", dto.getGameName());
|
|
|
+ showCri.where().andLike("a.game_name", dto.getGameName());
|
|
|
}
|
|
|
- showCri.where().and("dt", ">=", dto.getRechargeBeginDate()).and("dt", "<=", dto.getRechargeEndDate());
|
|
|
- showCri.groupBy("source_system,game_id");
|
|
|
- showCri.where().andEquals("game_id", item.getGameId());
|
|
|
- showCri.where().andEquals("id", 1);
|
|
|
- showCri.where().andEquals("source_system", item.getSourceSystem());
|
|
|
+ showCri.where().and("a.dt", ">=", dto.getRechargeBeginDate()).and("a.dt", "<=", dto.getRechargeEndDate());
|
|
|
+ showCri.groupBy("a.source_system,a.game_id");
|
|
|
+ Long h5GameId = item.getGameId();
|
|
|
+ showCri.where().andEquals("a.game_id", h5GameId);
|
|
|
+ showCri.where().andEquals("a.id", 1);
|
|
|
+ String sourceSystem = item.getSourceSystem();
|
|
|
+ showCri.where().andEquals("a.source_system", sourceSystem);
|
|
|
showSql.setEntity(showEntity).setCondition(showCri);
|
|
|
dao.execute(showSql);
|
|
|
ShowRecharge showRecharge = showSql.getObject(ShowRecharge.class);
|
|
@@ -2539,8 +2557,8 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
item.setH5BuyAmountNum(0L);
|
|
|
}
|
|
|
|
|
|
- dayNMap.put("sourceSystem", item.getSourceSystem());
|
|
|
- dayNMap.put("h5GameId", item.getGameId());
|
|
|
+ dayNMap.put("sourceSystem", sourceSystem);
|
|
|
+ dayNMap.put("h5GameId", h5GameId);
|
|
|
|
|
|
H5DayN h5PayDayN = getH5PayDayN(dto, dayNMap);
|
|
|
//h5充值时间范围内存在买量充值数据
|
|
@@ -2604,16 +2622,25 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
|
|
|
Sql natureShowGameSql = Sqls.queryEntity("""
|
|
|
select
|
|
|
- nature_source_system,
|
|
|
- nature_game_id,
|
|
|
- sum(h5_lead_nature_amount) as h5_lead_nature_amount,
|
|
|
- sum(h5_lead_nature_amount_num) as h5_lead_nature_amount_num
|
|
|
- from ads_h5_game_day
|
|
|
+ a.nature_source_system,
|
|
|
+ a.nature_game_id,
|
|
|
+ sum(a.h5_lead_nature_amount) as h5_lead_nature_amount,
|
|
|
+ (select count(distinct user_id) from ads_information
|
|
|
where
|
|
|
- game_id = @gameId
|
|
|
+ source_system = a.nature_source_system
|
|
|
+ and game_id = a.nature_game_id
|
|
|
+ and order_h5_game_id = @gameId
|
|
|
+ and agent_id = 0
|
|
|
+ and classify != 5
|
|
|
+ and order_game_classify = 5
|
|
|
+ and order_time >= @beginDay
|
|
|
+ and order_time <= @endDay) as h5_lead_nature_amount_num
|
|
|
+ from ads_h5_game_day a
|
|
|
+ where
|
|
|
+ a.game_id = @gameId
|
|
|
and
|
|
|
- dt>=@beginDay and dt<=@endDay
|
|
|
- group by nature_source_system,nature_game_id
|
|
|
+ a.dt>=@beginDay and a.dt<=@endDay
|
|
|
+ group by a.nature_source_system,a.nature_game_id
|
|
|
""");
|
|
|
natureShowGameSql.setParam("gameId", item.getGameId());
|
|
|
natureShowGameSql.setParam("beginDay", dto.getRechargeBeginDate());
|
|
@@ -2625,12 +2652,21 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
.filter(tt -> null != tt.getNatureGameId())
|
|
|
.collect(Collectors.groupingBy(H5NatureUserVO::getNatureGameId));
|
|
|
|
|
|
+ Map<String,Object> natureNewUserMap = new HashMap<>(7);
|
|
|
+ natureNewUserMap.put("h5GameId",item.getGameId());
|
|
|
+ natureNewUserMap.put("rechargeBeginDay",dto.getRechargeBeginDate());
|
|
|
+ natureNewUserMap.put("rechargeEndDay",dto.getRechargeEndDate());
|
|
|
+ natureNewUserMap.put("costBeginDay",dto.getCostBeginDate());
|
|
|
+ natureNewUserMap.put("costEndDay",dto.getCostEndDate());
|
|
|
List<H5NatureUserVO> natureGameList = natureGameSql.getList(H5NatureUserVO.class).stream()
|
|
|
.filter(tt -> null != tt.getNatureGameId())
|
|
|
.map(natureGame -> {
|
|
|
+ natureNewUserMap.put("natureSourceSystem",natureGame.getNatureSourceSystem());
|
|
|
+ natureNewUserMap.put("natureGameId",natureGame.getNatureGameId());
|
|
|
+
|
|
|
importDayNMap.put("sourceSystem", natureGame.getNatureSourceSystem());
|
|
|
importDayNMap.put("gameId", natureGame.getNatureGameId());
|
|
|
- H5DayN importNatureH5DayN = getImportNatureH5DayN(dto, importDayNMap);
|
|
|
+ H5DayN importNatureH5DayN = getImportNatureH5DayN(dto, importDayNMap, natureNewUserMap);
|
|
|
if (null != showBuyGameMap && null != showBuyGameMap.get(natureGame.getNatureGameId()) && !showBuyGameMap.get(natureGame.getNatureGameId()).isEmpty()) {
|
|
|
natureGame.setH5LeadNatureAmount(showBuyGameMap.get(natureGame.getNatureGameId()).get(0).getH5LeadNatureAmount());
|
|
|
natureGame.setH5LeadNatureAmountNum(showBuyGameMap.get(natureGame.getNatureGameId()).get(0).getH5LeadNatureAmountNum());
|
|
@@ -2678,16 +2714,25 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
//买量导入游戏账面
|
|
|
Sql buyShowGameSql = Sqls.queryEntity("""
|
|
|
select
|
|
|
- buy_source_system,
|
|
|
- buy_game_id,
|
|
|
- sum(h5_lead_buy_amount) as h5_lead_buy_amount,
|
|
|
- sum(h5_lead_buy_amount_num) as h5_lead_buy_amount_num
|
|
|
- from ads_h5_game_day
|
|
|
+ a.buy_source_system as buy_source_system,
|
|
|
+ a.buy_game_id as buy_game_id,
|
|
|
+ sum(a.h5_lead_buy_amount) as h5_lead_buy_amount,
|
|
|
+ (select count(distinct user_id) from ads_information
|
|
|
where
|
|
|
- game_id = @gameId
|
|
|
+ source_system = a.buy_source_system
|
|
|
+ and game_id = a.buy_game_id
|
|
|
+ and order_h5_game_id = @gameId
|
|
|
+ and agent_id != 0
|
|
|
+ and classify != 5
|
|
|
+ and order_game_classify = 5
|
|
|
+ and order_time >= @beginDay
|
|
|
+ and order_time <= @endDay) as h5_lead_buy_amount_num
|
|
|
+ from ads_h5_game_day a
|
|
|
+ where
|
|
|
+ a.game_id = @gameId
|
|
|
and
|
|
|
- dt>=@beginDay and dt<=@endDay
|
|
|
- group by buy_source_system,buy_game_id
|
|
|
+ a.dt>=@beginDay and a.dt<=@endDay
|
|
|
+ group by a.buy_source_system,a.buy_game_id
|
|
|
""");
|
|
|
buyShowGameSql.setParam("gameId", item.getGameId());
|
|
|
buyShowGameSql.setParam("beginDay", dto.getRechargeBeginDate());
|
|
@@ -2699,12 +2744,21 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
.filter(tt -> null != tt.getBuyGameId())
|
|
|
.collect(Collectors.groupingBy(H5BuyUserVO::getBuyGameId));
|
|
|
|
|
|
+ Map<String,Object> buyNewUserMap = new HashMap<>(7);
|
|
|
+ buyNewUserMap.put("h5GameId",item.getGameId());
|
|
|
+ buyNewUserMap.put("rechargeBeginDay",dto.getRechargeBeginDate());
|
|
|
+ buyNewUserMap.put("rechargeEndDay",dto.getRechargeEndDate());
|
|
|
+ buyNewUserMap.put("costBeginDay",dto.getCostBeginDate());
|
|
|
+ buyNewUserMap.put("costEndDay",dto.getCostEndDate());
|
|
|
List<H5BuyUserVO> buyGameList = buyGameSql.getList(H5BuyUserVO.class).stream()
|
|
|
.filter(tt -> null != tt.getBuyGameId())
|
|
|
.map(buyGame -> {
|
|
|
importDayNMap.put("sourceSystem", buyGame.getBuySourceSystem());
|
|
|
importDayNMap.put("gameId", buyGame.getBuyGameId());
|
|
|
- H5DayN importBuyH5DayN = getImportBuyH5DayN(dto, importDayNMap);
|
|
|
+
|
|
|
+ buyNewUserMap.put("buySourceSystem",buyGame.getBuySourceSystem());
|
|
|
+ buyNewUserMap.put("buyGameId",buyGame.getBuyGameId());
|
|
|
+ H5DayN importBuyH5DayN = getImportBuyH5DayN(dto, importDayNMap, buyNewUserMap);
|
|
|
if (null != showBuyGameMap && null != showBuyGameMap.get(buyGame.getBuyGameId()) && !showBuyGameMap.get(buyGame.getBuyGameId()).isEmpty()) {
|
|
|
buyGame.setH5LeadBuyAmount(showBuyGameMap.get(buyGame.getBuyGameId()).get(0).getH5LeadBuyAmount());
|
|
|
buyGame.setH5LeadBuyAmountNum(showBuyGameMap.get(buyGame.getBuyGameId()).get(0).getH5LeadBuyAmountNum());
|
|
@@ -2725,7 +2779,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
return buyGameList;
|
|
|
}
|
|
|
|
|
|
- private H5DayN getImportNatureH5DayN(GameDataH5DTO dto, Map<String, Object> dayNMap) {
|
|
|
+ private H5DayN getImportNatureH5DayN(GameDataH5DTO dto, Map<String, Object> dayNMap, Map<String, Object> natureNewUserMap) {
|
|
|
Sql importNatureSqlDayN = Sqls.queryString("""
|
|
|
select dayN from ads_dayn_h5_lead_nature_game
|
|
|
where
|
|
@@ -2736,6 +2790,28 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
importNatureSqlDayN.setParams(dayNMap);
|
|
|
dao.execute(importNatureSqlDayN);
|
|
|
List<String> importNatureDayNList = importNatureSqlDayN.getList(String.class);
|
|
|
+
|
|
|
+ Sql newUserNum = Sqls.fetchLong("""
|
|
|
+ select
|
|
|
+ count(DISTINCT user_id)
|
|
|
+ from
|
|
|
+ ads_information
|
|
|
+ where
|
|
|
+ source_system = @natureSourceSystem
|
|
|
+ and game_id = @natureGameId
|
|
|
+ and order_h5_game_id = @h5GameId
|
|
|
+ and agent_id = 0
|
|
|
+ and classify != 5
|
|
|
+ and order_game_classify = 5
|
|
|
+ and order_time >= @rechargeBeginDay
|
|
|
+ and order_time <= @rechargeEndDay
|
|
|
+ and reg_time >= @costBeginDay
|
|
|
+ and reg_time <= @costEndDay
|
|
|
+ """);
|
|
|
+ newUserNum.setParams(natureNewUserMap);
|
|
|
+ dao.execute(newUserNum);
|
|
|
+ Long newUserNumLong = newUserNum.getLong();
|
|
|
+
|
|
|
H5DayN importNatureDayN = null;
|
|
|
//ads_dayn_h5_nature_game 存在充值数据
|
|
|
if (!CollectionUtils.isEmpty(importNatureDayNList)) {
|
|
@@ -2763,14 +2839,14 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
String[] parts = resultMap.get("dayN").split("-");
|
|
|
importNatureDayN = H5DayN.builder()
|
|
|
.rechargeMoney(new BigDecimal(parts[0]))
|
|
|
- .rechargeNum(Long.valueOf(parts[1]))
|
|
|
+ .rechargeNum(newUserNumLong)
|
|
|
.build();
|
|
|
}
|
|
|
}
|
|
|
return importNatureDayN;
|
|
|
}
|
|
|
|
|
|
- private H5DayN getImportBuyH5DayN(GameDataH5DTO dto, Map<String, Object> dayNMap) {
|
|
|
+ private H5DayN getImportBuyH5DayN(GameDataH5DTO dto, Map<String, Object> dayNMap, Map<String, Object> buyNewUserMap) {
|
|
|
Sql importBuySqlDayN = Sqls.queryString("""
|
|
|
select dayN from ads_dayn_h5_lead_buy_game
|
|
|
where
|
|
@@ -2781,6 +2857,28 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
importBuySqlDayN.setParams(dayNMap);
|
|
|
dao.execute(importBuySqlDayN);
|
|
|
List<String> importBuyDayNList = importBuySqlDayN.getList(String.class);
|
|
|
+
|
|
|
+ Sql newUserNum = Sqls.fetchLong("""
|
|
|
+ select
|
|
|
+ count(DISTINCT user_id)
|
|
|
+ from
|
|
|
+ ads_information
|
|
|
+ where
|
|
|
+ source_system = @buySourceSystem
|
|
|
+ and game_id = @buyGameId
|
|
|
+ and order_h5_game_id = @h5GameId
|
|
|
+ and agent_id != 0
|
|
|
+ and classify != 5
|
|
|
+ and order_game_classify = 5
|
|
|
+ and order_time >= @rechargeBeginDay
|
|
|
+ and order_time <= @rechargeEndDay
|
|
|
+ and reg_time >= @costBeginDay
|
|
|
+ and reg_time <= @costEndDay
|
|
|
+ """);
|
|
|
+ newUserNum.setParams(buyNewUserMap);
|
|
|
+ dao.execute(newUserNum);
|
|
|
+ Long newUserNumLong = newUserNum.getLong();
|
|
|
+
|
|
|
H5DayN importBuyDayN = null;
|
|
|
//ads_dayn_h5_nature_game 存在充值数据
|
|
|
if (!CollectionUtils.isEmpty(importBuyDayNList)) {
|
|
@@ -2808,7 +2906,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
String[] parts = resultMap.get("dayN").split("-");
|
|
|
importBuyDayN = H5DayN.builder()
|
|
|
.rechargeMoney(new BigDecimal(parts[0]))
|
|
|
- .rechargeNum(Long.valueOf(parts[1]))
|
|
|
+ .rechargeNum(newUserNumLong)
|
|
|
.build();
|
|
|
}
|
|
|
}
|
|
@@ -2826,6 +2924,28 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
natureSqlDayN.setParams(dayNMap);
|
|
|
dao.execute(natureSqlDayN);
|
|
|
List<String> natureDayNList = natureSqlDayN.getList(String.class);
|
|
|
+
|
|
|
+ Sql newUserNum = Sqls.fetchLong("""
|
|
|
+ select
|
|
|
+ count(DISTINCT user_id)
|
|
|
+ from
|
|
|
+ ads_information
|
|
|
+ where
|
|
|
+ source_system = @sourceSystem
|
|
|
+ and h5_game_id = @h5GameId
|
|
|
+ and agent_id = 0
|
|
|
+ and classify = 5
|
|
|
+ and order_time >= @rechargeBeginDay
|
|
|
+ and order_time <= @rechargeEndDay
|
|
|
+ and reg_time >= @costBeginDay
|
|
|
+ and reg_time <= @costEndDay
|
|
|
+ """);
|
|
|
+ Map<String, Object> newUserNumMap = new HashMap<>(6);
|
|
|
+ newUserNumMap.put("costBeginDay", dto.getCostBeginDate());
|
|
|
+ newUserNumMap.put("costEndDay", dto.getCostEndDate());
|
|
|
+ newUserNumMap.put("rechargeBeginDay", dto.getRechargeBeginDate());
|
|
|
+ newUserNumMap.put("rechargeEndDay", dto.getRechargeEndDate());
|
|
|
+
|
|
|
H5DayN h5NatureDayN = null;
|
|
|
//ads_dayn_h5_nature_game 存在充值数据
|
|
|
if (!CollectionUtils.isEmpty(natureDayNList)) {
|
|
@@ -2849,11 +2969,16 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ newUserNumMap.put("sourceSystem", dayNMap.get("sourceSystem"));
|
|
|
+ newUserNumMap.put("h5GameId", dayNMap.get("h5GameId"));
|
|
|
+ newUserNum.setParams(newUserNumMap);
|
|
|
+ dao.execute(newUserNum);
|
|
|
+ Long newUserNumLong = newUserNum.getLong();
|
|
|
if (!resultMap.isEmpty() && !resultMap.get("dayN").isEmpty()) {
|
|
|
String[] parts = resultMap.get("dayN").split("-");
|
|
|
h5NatureDayN = H5DayN.builder()
|
|
|
.rechargeMoney(new BigDecimal(parts[0]))
|
|
|
- .rechargeNum(Long.valueOf(parts[1]))
|
|
|
+ .rechargeNum(newUserNumLong)
|
|
|
.build();
|
|
|
}
|
|
|
}
|
|
@@ -2873,6 +2998,26 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
dao.execute(paySqlDayN);
|
|
|
List<String> payDayNList = paySqlDayN.getList(String.class);
|
|
|
|
|
|
+ Sql newUserNum = Sqls.fetchLong("""
|
|
|
+ select
|
|
|
+ count(DISTINCT user_id)
|
|
|
+ from
|
|
|
+ ads_information
|
|
|
+ where
|
|
|
+ source_system = @sourceSystem
|
|
|
+ and h5_game_id = @h5GameId
|
|
|
+ and agent_id != 0
|
|
|
+ and classify = 5
|
|
|
+ and order_time >= @rechargeBeginDay
|
|
|
+ and order_time <= @rechargeEndDay
|
|
|
+ and reg_time >= @costBeginDay
|
|
|
+ and reg_time <= @costEndDay
|
|
|
+ """);
|
|
|
+ Map<String, Object> newUserNumMap = new HashMap<>(6);
|
|
|
+ newUserNumMap.put("costBeginDay", dto.getCostBeginDate());
|
|
|
+ newUserNumMap.put("costEndDay", dto.getCostEndDate());
|
|
|
+ newUserNumMap.put("rechargeBeginDay", dto.getRechargeBeginDate());
|
|
|
+ newUserNumMap.put("rechargeEndDay", dto.getRechargeEndDate());
|
|
|
//ads_dayn_h5_pay_game存在充值数据
|
|
|
if (!CollectionUtils.isEmpty(payDayNList)) {
|
|
|
Gson gson = new Gson();
|
|
@@ -2895,11 +3040,16 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ newUserNumMap.put("sourceSystem", dayNMap.get("sourceSystem"));
|
|
|
+ newUserNumMap.put("h5GameId", dayNMap.get("h5GameId"));
|
|
|
+ newUserNum.setParams(newUserNumMap);
|
|
|
+ dao.execute(newUserNum);
|
|
|
+ Long newUserNumLong = newUserNum.getLong();
|
|
|
if (!resultMap.isEmpty() && !resultMap.get("dayN").isEmpty()) {
|
|
|
String[] parts = resultMap.get("dayN").split("-");
|
|
|
h5PayDayN = H5DayN.builder()
|
|
|
.rechargeMoney(new BigDecimal(parts[0]))
|
|
|
- .rechargeNum(Long.valueOf(parts[1]))
|
|
|
+ .rechargeNum(newUserNumLong)
|
|
|
.build();
|
|
|
}
|
|
|
}
|