Explorar el Código

游戏每日数据修改、投手游戏每日数据修改

Letianhua hace 1 año
padre
commit
8de250e193

+ 2 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/GameDataDayDTO.java

@@ -8,6 +8,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.time.LocalDate;
+import java.util.List;
 
 /**
  * @author tianhua
@@ -30,7 +31,7 @@ public class GameDataDayDTO extends BasePage {
      * 游戏ID
      */
     @ApiModelProperty(notes = "游戏ID")
-    private Long gameId;
+    private List<Long> gameId;
 
     /**
      * 推广游戏应用类别

+ 3 - 2
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/PitcherGameDataDayDTO.java

@@ -8,6 +8,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.time.LocalDate;
+import java.util.List;
 
 /**
  * @author tianhua
@@ -42,13 +43,13 @@ public class PitcherGameDataDayDTO extends BasePage {
      * 投手ID
      */
     @ApiModelProperty(value = "投手ID")
-    private Long pitcherId;
+    private List<Long> pitcherId;
 
     /**
      * 游戏ID
      */
     @ApiModelProperty(value = "游戏ID")
-    private String gameId;
+    private List<Long> gameId;
 
     /**
      * 游戏CP方

+ 190 - 5
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameDataServiceImpl.java

@@ -16,6 +16,7 @@ import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.nutz.dao.Cnd;
@@ -32,7 +33,6 @@ import org.springframework.beans.BeanWrapper;
 import org.springframework.beans.BeanWrapperImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
 import reactor.util.function.Tuple2;
 import reactor.util.function.Tuples;
 
@@ -196,7 +196,7 @@ public class GameDataServiceImpl implements IGameDataService {
     @Override
     public Page<GameDataDayVO> getGameDataDay(GameDataDayDTO dto) {
         com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
-        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
+        List<Long> gameIds = CollectionUtils.isEmpty(dto.getGameId()) ? poerInfo.second : dto.getGameId();
 
         //默认查询 total 总量数据
         if (StringUtils.isBlank(dto.getTableTypes())) {
@@ -208,7 +208,7 @@ public class GameDataServiceImpl implements IGameDataService {
             //拼接游戏名称查询条件
             cri.where().andEquals("game_name", dto.getGameName());
         }
-        if (gameIds != null) {
+        if (CollectionUtils.isNotEmpty(gameIds)) {
             //拼接游戏id查询条件
             cri.where().andInList("game_id", gameIds);
         }
@@ -223,6 +223,8 @@ public class GameDataServiceImpl implements IGameDataService {
             //拼接SDK来源
             cri.where().andEquals("source_system", dto.getSourceSystem());
         }
+        //按时间分组
+        cri.getGroupBy().groupBy("dt", "source_system");
         //拼接排序条件
         if (StringUtils.isBlank(dto.getSortType())) {
             dto.setSortType(OrderByEnum.DESC.getOrderType());
@@ -234,7 +236,7 @@ public class GameDataServiceImpl implements IGameDataService {
             cri.getOrderBy().orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType());
         }
         //编写sql语句 拼接查询条件
-        Sql sql = Sqls.create(gameDataDaySql(dto.getTableTypes()) + cri);
+        Sql sql = Sqls.create(gameDataDayGroupByDtSql(dto.getTableTypes()) + cri);
         //设置自定义回显对象
         sql.setCallback(Sqls.callback.entities());
         sql.setEntity(dao.getEntity(GameDataDayVO.class));
@@ -246,7 +248,21 @@ public class GameDataServiceImpl implements IGameDataService {
         //得到结果集list
         List<GameDataDayVO> list = sql.getList(GameDataDayVO.class);
         //设置查询总数
-        pager.setRecordCount(dao.count(AdsGameDay.class, cri));
+        Sql sqlCount = Sqls.create(
+                    """
+                    SELECT
+                    	COUNT(1)
+                    FROM (
+                    	SELECT
+                    		COUNT(1)
+                    	FROM game_ads.ads_game_day
+                    """ + cri +
+                    """
+                    ) a;
+                    """);
+        sqlCount.setCallback(Sqls.callback.integer());
+        dao.execute(sqlCount);
+        pager.setRecordCount(sqlCount.getInt());
 
         List<GameDataDayVO> gameDataDayVOList = list.stream().map(vo -> {
             formatDayN(vo);
@@ -2034,6 +2050,175 @@ public class GameDataServiceImpl implements IGameDataService {
                 """;
     }
 
+    /**
+     * 游戏每日数据总计sql
+     *
+     * @param tableType 查询的类型
+     * @return String
+     */
+    private String gameDataDayGroupByDtSql(String tableType) {
+        if ("buy".equals(tableType)) {
+            return """
+                    SELECT
+                        dt as cost_date,
+                        source_system,
+                        GROUP_CONCAT(game_name) as game_name,
+                        IFNULL(SUM(cost), 0) cost,
+                        IFNULL(SUM(buy_reg_num), 0) reg_num,
+                    """
+                    + amountDay("buy_") +
+                    """
+                        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
+                    """;
+        } else if ("nature".equals(tableType)) {
+            return """
+                    SELECT
+                        dt as cost_date,
+                        source_system,
+                        GROUP_CONCAT(game_name) as game_name,
+                        IFNULL(SUM(cost), 0) cost,
+                        IFNULL(SUM(nature_reg_num), 0) reg_num,
+                    """
+                    + amountDay("nature_") +
+                    """
+                        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,
+                        SUM(nature_hundred_user_num) hundred_user_num,
+                        round(IF(SUM(nature_hundred_user_num) > 0, SUM(cost) / SUM(nature_hundred_user_num), 0), 2) hundred_user_num_cost,
+                        SUM(nature_first_role_num) first_role_num,
+                        SUM(nature_role_num) role_num,
+                        SUM(nature_new_user_total_role_num) 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_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_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_new_user_total_role_num) / SUM(nature_reg_num), 0), 4) new_user_total_role_num_rate
+                    FROM
+                        ads_game_day
+                    """;
+        }
+        //总量数据
+        return """
+                SELECT
+                    dt as cost_date,
+                    source_system,
+                    GROUP_CONCAT(game_name) as game_name,
+                    IFNULL(SUM(cost), 0) cost,
+                    IFNULL(SUM(reg_num), 0) reg_num,
+                """
+                + amountDay("") +
+                """
+                    IFNULL(SUM(first_new_user_amount_count), 0) first_new_user_amount_count,
+                    IFNULL(SUM(first_new_user_amount_num), 0) first_new_user_amount_num,
+                    IFNULL(SUM(first_new_user_amount), 0) first_new_user_amount,
+                    IFNULL(SUM(old_user_count), 0) old_user_count,
+                    IFNULL(SUM(old_user_num), 0) old_user_num,
+                    IFNULL(SUM(old_user_amount), 0) old_user_amount,
+                    IFNULL(SUM(amount_count), 0) amount_count,
+                    IFNULL(SUM(amount_num), 0) amount_num,
+                    IFNULL(SUM(amount), 0) amount,
+                    IFNULL(SUM(new_user_total_amount_count), 0) new_user_total_amount_count,
+                    IFNULL(SUM(new_user_total_amount_num), 0) new_user_total_amount_num,
+                    IFNULL(SUM(new_user_total_amount), 0) new_user_total_amount,
+                    round(if(SUM(cost) > 0 , SUM(first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
+                    round(if(SUM(reg_num) > 0 , SUM(first_new_user_amount_num) / SUM(reg_num) ,0), 4) first_amount_rate,
+                    round(if(SUM(reg_num) > 0, SUM(new_user_total_amount_num) / SUM(reg_num), 0) ,4) today_amount_rate,
+                    round(if(SUM(amount_num) > 0 , SUM(first_new_user_amount_num) / SUM(amount_num) ,0), 4) new_user_rate,
+                    round(if(SUM(first_new_user_amount_count) > 0, SUM(first_new_user_amount) / SUM(first_new_user_amount_count), 0), 2) first_avg_amount,
+                    round(if(SUM(new_user_total_amount_count) > 0, SUM(new_user_total_amount) / SUM(new_user_total_amount_count), 0), 2) today_avg_amount,
+                    round(if(SUM(amount_count) > 0, SUM(amount) / SUM(amount_count), 0), 2) avg_amount,
+                    round(if(SUM(new_user_total_amount_num) > 0, SUM(reg_order_user_again) / SUM(new_user_total_amount_num), 0), 4) user_again_rate,
+                    round(if(SUM(reg_num) > 0, SUM(new_user_total_amount) / SUM(reg_num), 0), 2) reg_user_arpu,
+                    round(if(SUM(first_new_user_amount_num) > 0 , SUM(first_new_user_amount) / SUM(first_new_user_amount_num), 0), 2) first_amount_arpu,
+                    round(if(SUM(new_user_total_amount_num) > 0 , SUM(new_user_total_amount) / SUM(new_user_total_amount_num), 0), 2) today_amount_arpu,
+                    round(if(SUM(amount_num) > 0, SUM(amount) / SUM(amount_num), 0), 2) amount_arpu,
+                    round(if(SUM(reg_num) > 0, SUM(cost) / SUM(reg_num), 0), 2) reg_cost,
+                    round(if(SUM(first_new_user_amount_num) > 0, SUM(cost) / SUM(first_new_user_amount_num), 0), 2) first_new_user_recharge_cost,
+                    round(if(SUM(new_user_total_amount_num) > 0, SUM(cost) / SUM(new_user_total_amount_num), 0), 2) total_recharge_cost,
+                    round(if(SUM(cost) > 0, SUM(new_user_total_amount) / SUM(cost), 0), 4) total_roi,
+                    SUM(hundred_user_num) hundred_user_num,
+                    round(IF(SUM(hundred_user_num) > 0, SUM(cost) / SUM(hundred_user_num), 0), 2) hundred_user_num_cost,
+                    SUM(first_role_num) first_role_num,
+                    SUM(role_num) role_num,
+                    SUM(new_user_total_role_num) new_user_total_role_num,
+                    round(IF(SUM(first_role_num) > 0, SUM(cost) / SUM(first_role_num), 0), 2) first_role_num_cost,
+                    round(IF(SUM(role_num) > 0, SUM(cost) / SUM(role_num), 0), 2) role_num_cost,
+                    round(IF(SUM(new_user_total_role_num) >0, SUM(cost) / SUM(new_user_total_role_num), 0), 2) new_user_total_role_num_cost,
+                    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(new_user_total_role_num) / SUM(reg_num), 0), 4) new_user_total_role_num_rate
+                FROM
+                    ads_game_day
+                """;
+    }
+
     /**
      * 游戏每日数据总计sql
      *

+ 119 - 7
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PitcherDataServiceImpl.java

@@ -15,8 +15,9 @@ import com.zanxiang.game.data.serve.utils.Page;
 import com.zanxiang.module.util.DateUtil;
 import com.zanxiang.module.util.exception.BaseException;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.dubbo.common.utils.CollectionUtils;
 import org.nutz.dao.Cnd;
 import org.nutz.dao.Dao;
 import org.nutz.dao.Sqls;
@@ -487,8 +488,9 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
     @Override
     public Page<PitcherGameDataDayVO> getPitcherGameDataDay(PitcherGameDataDayDTO dto) {
         com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
-        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(Long.parseLong(dto.getGameId()));
+        List<Long> userIds = CollectionUtils.isEmpty(dto.getPitcherId()) ? poerInfo.first : dto.getPitcherId();
+        List<Long> gameIds = CollectionUtils.isEmpty(dto.getGameId()) ? poerInfo.second : dto.getGameId();
+
         //不传递时间,默认查询当天
         if (dto.getBeginDate() == null || dto.getEndDate() == null) {
             dto.setBeginDate(LocalDate.now());
@@ -496,10 +498,10 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
         }
         //创建查询条件
         Criteria cri = Cnd.cri();
-        if (userIds != null) {
+        if (CollectionUtils.isNotEmpty(userIds)) {
             cri.where().andInList("pitcher_id", userIds);
         }
-        if (gameIds != null) {
+        if (CollectionUtils.isNotEmpty(gameIds)) {
             cri.where().andInList("game_id", gameIds);
         }
         if (StringUtils.isNotBlank(dto.getSourceSystem())) {
@@ -514,6 +516,8 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
         if (dto.getGameType() != null) {
             cri.where().andEquals("game_type", dto.getGameType());
         }
+        //按照日期,投手分组
+        cri.getGroupBy().groupBy("dt", "source_system", "pitcher_id");
         //排序条件
         //拼接排序条件,如果没有排序条件给默认值
         if (StringUtils.isBlank(dto.getSortType())) {
@@ -528,7 +532,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
         //Pager对象
         Pager pager = dao.createPager(dto.getPageNum(), dto.getPageSize());
         //sql语句
-        Sql sql = Sqls.create(pitcherGameDataDaySql() + cri);
+        Sql sql = Sqls.create(pitcherGameDataDayGroupByDtAndPitcherSql() + cri);
         //设置回传对象
         sql.setCallback(Sqls.callback.entities());
         sql.setEntity(dao.getEntity(PitcherGameDataDayVO.class));
@@ -666,7 +670,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
             Map<String, String> gameIDToDayNData = pitcherGameDataTotalDayNMap.get(vo.getPitcherId().toString());
             //取到dayN数据
             String dayNStr;
-            if (CollectionUtils.isEmptyMap(gameIDToDayNData)) {
+            if (MapUtils.isEmpty(gameIDToDayNData)) {
                 dayNStr = "0.00-0";
             } else {
                 dayNStr = gameIDToDayNData.get(vo.getGameId());
@@ -2123,6 +2127,114 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
                 """;
     }
 
+    /**
+     * 查询投手游戏每日数据SQL(投手游戏每日按日期以及投手聚合)
+     *
+     * @return String
+     */
+    private String pitcherGameDataDayGroupByDtAndPitcherSql() {
+        return """
+                SELECT
+                    dt,
+                    source_system ,
+                    pitcher_id ,
+                    MAX(pitcher) pitcher ,
+                    GROUP_CONCAT(game_name) as game_name ,
+                    SUM(cost) as cost,
+                    SUM(plan_count) as plan_count,
+                    SUM(account_count) as account_count,
+                    SUM(agent_count) as agent_count,
+                    SUM(register_num) as register_num,
+                    ROUND(IF(SUM(register_num) > 0, SUM(cost) / SUM(register_num), 0), 2) as register_cost,
+                    SUM(first_role_num) as first_role_num,
+                    SUM(new_user_total_role_num) as new_user_total_role_num,
+                    SUM(role_num) as role_num,
+                    ROUND(IF(SUM(role_num) > 0 , SUM(cost) / SUM(role_num), 0), 2) as role_num_cost,
+                    ROUND(IF(SUM(first_role_num) > 0 , SUM(cost) / SUM(first_role_num), 0), 2) as first_role_cost,
+                    ROUND(IF(SUM(new_user_total_role_num) > 0 , SUM(cost) / SUM(new_user_total_role_num), 0), 2) as new_user_total_role_cost,
+                    ROUND(IF(SUM(register_num) > 0 , SUM(first_role_num) / SUM(register_num), 0), 4) as first_role_rate,
+                    ROUND(IF(SUM(register_num) > 0 , SUM(new_user_total_role_num) / SUM(register_num), 0), 4) as new_user_total_role_rate,
+                    ROUND(IF(SUM(register_num) > 0 , SUM(role_num) / SUM(register_num), 0), 4) as role_num_rate,
+                    SUM(first_new_user_amount_count) as first_new_user_amount_count,
+                    SUM(first_new_user_amount_num) as first_new_user_amount_num,
+                    SUM(first_new_user_amount) as first_new_user_amount,
+                    SUM(amount_count) as amount_count,
+                    SUM(amount_num) as amount_num,
+                    SUM(amount) as amount,
+                    SUM(old_amount_count) as old_amount_count,
+                    SUM(old_amount_num) as old_amount_num,
+                    SUM(old_amount) as old_amount,
+                    SUM(new_user_total_amount_count) as new_user_total_amount_count,
+                    SUM(new_user_total_amount_num) as new_user_total_amount_num,
+                    SUM(new_user_total_amount) as new_user_total_amount,
+                    SUM(buy_new_user_total_amount) as buy_new_user_total_amount,
+                    SUM(buy_new_user_total_amount_num) as buy_new_user_total_amount_num,
+                    SUM(buy_new_user_total_amount_count) as buy_new_user_total_amount_count,
+                    ROUND(IF(SUM(cost) > 0, SUM(first_new_user_amount) / SUM(cost), 0), 4) as first_roi,
+                    ROUND(IF(SUM(cost) > 0, SUM(buy_new_user_total_amount) / SUM(cost), 0), 4) as buy_roi,
+                    ROUND(IF(SUM(cost) > 0, SUM(new_user_total_amount) / SUM(cost), 0), 4) as today_roi,
+                    (SUM(new_user_total_amount) - SUM(cost)) as gross_profit,
+                    ROUND(IF(SUM(register_num) > 0, SUM(first_new_user_amount_num) / SUM(register_num), 0), 4) as first_rate,
+                    ROUND(IF(SUM(register_num) > 0, SUM(buy_new_user_total_amount_num) / SUM(register_num), 0), 4) as buy_user_rate,
+                    ROUND(IF(SUM(register_num) > 0, SUM(new_user_total_amount_num) / SUM(register_num), 0), 4) as today_rate,
+                    ROUND(IF(SUM(amount_num) > 0, SUM(first_new_user_amount_num) / SUM(amount_num), 0), 4) as new_user_amount_ratio,
+                    ROUND(IF(SUM(first_new_user_amount_count) > 0 , SUM(first_new_user_amount) / SUM(first_new_user_amount_count), 0), 2) as first_avg,
+                    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) as buy_avg,
+                    ROUND(IF(SUM(new_user_total_amount_count) > 0 , SUM(new_user_total_amount) / SUM(new_user_total_amount_count), 0), 2) as today_avg,
+                    ROUND(IF(SUM(amount_count) > 0 , SUM(amount) / SUM(amount_count), 0), 2) as paper_avg,
+                    ROUND(IF(SUM(first_new_user_amount_num) > 0 , SUM(cost) / SUM(first_new_user_amount_num), 0), 2) as first_amount_cost,
+                    ROUND(IF(SUM(buy_new_user_total_amount_num) > 0 , SUM(cost) / SUM(buy_new_user_total_amount_num), 0), 2) as buy_amount_cost,
+                    ROUND(IF(SUM(new_user_total_amount_num) > 0 , SUM(cost) / SUM(new_user_total_amount_num), 0), 2) as today_amount_cost,
+                    SUM(reg_order_user_again) as reg_order_user_again,
+                    ROUND(IF(SUM(new_user_total_amount_num) > 0 ,SUM(reg_order_user_again) / SUM(new_user_total_amount_num), 0), 4) as today_again_rate,
+                    ROUND(IF(SUM(register_num) > 0 , SUM(new_user_total_amount) / SUM(register_num), 0), 2) as new_reg_arpu,
+                    ROUND(IF(SUM(first_new_user_amount_num) > 0 , SUM(first_new_user_amount) / SUM(first_new_user_amount_num), 0), 2) as first_arpu,
+                    ROUND(IF(SUM(new_user_total_amount_num) > 0 , SUM(new_user_total_amount) / SUM(new_user_total_amount_num), 0), 2) as today_arpu,
+                    ROUND(IF(SUM(amount_num) > 0 , SUM(amount) / SUM(amount_num), 0), 2) as paper_arpu,
+                    SUM(hundred_user_num) as hundred_user_num,
+                    ROUND(IF(SUM(hundred_user_num) > 0 , SUM(cost) / SUM(hundred_user_num), 0), 2) as hundred_user_num_cost,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da1) / SUM(cost), 0), 4) as roi1,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da2) / SUM(cost), 0), 4) as roi2,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da3) / SUM(cost), 0), 4) as roi3,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da4) / SUM(cost), 0), 4) as roi4,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da5) / SUM(cost), 0), 4) as roi5,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da6) / SUM(cost), 0), 4) as roi6,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da7) / SUM(cost), 0), 4) as roi7,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da8) / SUM(cost), 0), 4) as roi8,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da9) / SUM(cost), 0), 4) as roi9,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da10) / SUM(cost), 0), 4) as roi10,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da11) / SUM(cost), 0), 4) as roi11,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da12) / SUM(cost), 0), 4) as roi12,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da13) / SUM(cost), 0), 4) as roi13,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da14) / SUM(cost), 0), 4) as roi14,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da15) / SUM(cost), 0), 4) as roi15,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da16) / SUM(cost), 0), 4) as roi16,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da17) / SUM(cost), 0), 4) as roi17,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da18) / SUM(cost), 0), 4) as roi18,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da19) / SUM(cost), 0), 4) as roi19,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da20) / SUM(cost), 0), 4) as roi20,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da21) / SUM(cost), 0), 4) as roi21,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da22) / SUM(cost), 0), 4) as roi22,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da23) / SUM(cost), 0), 4) as roi23,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da24) / SUM(cost), 0), 4) as roi24,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da25) / SUM(cost), 0), 4) as roi25,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da26) / SUM(cost), 0), 4) as roi26,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da27) / SUM(cost), 0), 4) as roi27,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da28) / SUM(cost), 0), 4) as roi28,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da29) / SUM(cost), 0), 4) as roi29,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da30) / SUM(cost), 0), 4) as roi30,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da60) / SUM(cost), 0), 4) as roi60,
+                    ROUND(IF(SUM(cost) > 0 , SUM(da90) / SUM(cost), 0), 4) as roi90,
+                    ROUND(IF(SUM(cost) > 0 , SUM(m6) / SUM(cost), 0), 4) as roi180,
+                    ROUND(IF(SUM(cost) > 0 , SUM(m12) / SUM(cost), 0), 4) as roi1yaer,
+                    ROUND(IF(SUM(cost) > 0 , SUM(total) / SUM(cost), 0), 4) as roi_total,
+                """ + getPitcherGameDataDayTotalDayNsql() +
+                """
+                FROM
+                    game_ads.ads_game_pitcher_day
+                """;
+    }
+
     /**
      * 查询投手每日数据总计SQL(投手每日总计)
      *