|
@@ -969,6 +969,20 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
public Page<GameDataWaterVO> getGameDataWater(GameDataWaterDTO dto) {
|
|
|
com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
|
|
|
List<Long> userGameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
|
|
|
+
|
|
|
+ if (dto.getGameDimension() == null) {
|
|
|
+ //默认查询子游戏维度
|
|
|
+ dto.setGameDimension(1L);
|
|
|
+ }
|
|
|
+ //默认查询的字段
|
|
|
+ String gameColumn = "game_id";
|
|
|
+ String classifyColumn = "game_classify";
|
|
|
+ String gameNameColumn = "game_name";
|
|
|
+ if (dto.getGameDimension() == 2L) {
|
|
|
+ gameColumn = "parent_game_id";
|
|
|
+ classifyColumn = "parent_game_classify";
|
|
|
+ gameNameColumn = "parent_game_name";
|
|
|
+ }
|
|
|
if (null == dto.getRechargeDate()) {
|
|
|
dto.setRechargeDate(LocalDate.now());
|
|
|
}
|
|
@@ -982,27 +996,37 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
// 创建一个 Criteria 接口实例
|
|
|
SimpleCriteria cri = Cnd.cri();
|
|
|
if (StringUtils.isNotBlank(dto.getGameName())) {
|
|
|
- cri.where().andLike("game_name", dto.getGameName());
|
|
|
+ cri.where().andLike(gameNameColumn, dto.getGameName());
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(dto.getGameClassify())) {
|
|
|
- cri.where().andEquals("game_classify", dto.getGameClassify());
|
|
|
+ cri.where().andEquals(classifyColumn, dto.getGameClassify());
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(dto.getSourceSystem())) {
|
|
|
cri.where().andEquals("source_system", dto.getSourceSystem());
|
|
|
}
|
|
|
- if (null != userGameIds) {
|
|
|
- cri.where().andInList("game_id", userGameIds);
|
|
|
+ if (CollectionUtils.isNotEmpty(userGameIds)) {
|
|
|
+ cri.where().andInList(gameColumn, userGameIds);
|
|
|
}
|
|
|
cri.where().and("dt", "=", dto.getRechargeDate());
|
|
|
- cri.groupBy("source_system,game_id");
|
|
|
+ cri.groupBy("source_system", gameColumn);
|
|
|
cri.orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType());
|
|
|
- Sql sql = Sqls.queryEntity(waterSql() + "$condition");
|
|
|
+ Sql sql;
|
|
|
+ if (dto.getGameDimension() == 1L) {
|
|
|
+ sql = Sqls.queryEntity(waterSql() + "$condition");
|
|
|
+ } else {
|
|
|
+ sql = Sqls.queryEntity(waterSqlForParent() + "$condition");
|
|
|
+ }
|
|
|
sql.setPager(pager);
|
|
|
Entity<GameDataWaterVO> entity = dao.getEntity(GameDataWaterVO.class);
|
|
|
sql.setEntity(entity).setCondition(cri);
|
|
|
dao.execute(sql);
|
|
|
|
|
|
- Sql sqlCount = Sqls.queryEntity("select count(*) from ads_everyday_water " + "$condition");
|
|
|
+ Sql sqlCount;
|
|
|
+ if (dto.getGameDimension() == 1L) {
|
|
|
+ sqlCount = Sqls.queryEntity("select count(*) from ads_everyday_water " + "$condition");
|
|
|
+ } else {
|
|
|
+ sqlCount = Sqls.queryEntity("select count(*) from game_ads_parent.ads_everyday_water_parent " + "$condition");
|
|
|
+ }
|
|
|
sqlCount.setCondition(cri);
|
|
|
pager.setRecordCount((int) Daos.queryCount(dao, sqlCount));
|
|
|
|
|
@@ -1015,7 +1039,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
|
|
|
SimpleCriteria templateCri = Cnd.cri();
|
|
|
templateCri.where().and("dt", "=", dto.getRechargeDate());
|
|
|
- templateCri.where().andInList("game_id", gameIds);
|
|
|
+ templateCri.where().andInList(gameColumn, gameIds);
|
|
|
Sql templateSql = Sqls.queryEntity(waterTemplateSql() + "$condition");
|
|
|
Entity<AdsEverydayWater> everydayWaterEntity = dao.getEntity(AdsEverydayWater.class);
|
|
|
templateSql.setEntity(everydayWaterEntity).setCondition(templateCri);
|
|
@@ -4247,7 +4271,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
}
|
|
|
//新增查询条件
|
|
|
Criteria cri = Cnd.cri();
|
|
|
- if (userGameIds != null) {
|
|
|
+ if (CollectionUtils.isNotEmpty(userGameIds)) {
|
|
|
//拼接游戏id
|
|
|
cri.where().andInList(gameColumn, userGameIds);
|
|
|
}
|
|
@@ -8819,6 +8843,9 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
""";
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 子游戏维度
|
|
|
+ */
|
|
|
private String waterSql() {
|
|
|
return """
|
|
|
select
|
|
@@ -8834,6 +8861,24 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
""";
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 父游戏维度
|
|
|
+ */
|
|
|
+ private String waterSqlForParent() {
|
|
|
+ return """
|
|
|
+ select
|
|
|
+ parent_game_id as id,
|
|
|
+ source_system,
|
|
|
+ parent_game_id as game_id,
|
|
|
+ max(parent_game_name) as game_name,
|
|
|
+ max(parent_game_classify) as game_classify,
|
|
|
+ max(amount) as amount,
|
|
|
+ max(buy_amount) as buy_amount,
|
|
|
+ max(nature_amount) as nature_amount
|
|
|
+ from game_ads_parent.ads_everyday_water_parent
|
|
|
+ """;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 流水临时sql
|
|
|
*
|