Parcourir la source

修改内容:推广每日总计

shishaosong il y a 1 an
Parent
commit
9267fc77d5

+ 9 - 8
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/controller/AccountAgentDayController.java

@@ -1,14 +1,8 @@
 package com.zanxiang.game.data.serve.controller;
 
 import com.zanxiang.erp.security.annotation.PreAuthorize;
-import com.zanxiang.game.data.serve.pojo.dto.AgentDayAgainDTO;
-import com.zanxiang.game.data.serve.pojo.dto.GamePromoteDayDTO;
-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.vo.AgentDayAgainVO;
-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.dto.*;
+import com.zanxiang.game.data.serve.pojo.vo.*;
 import com.zanxiang.game.data.serve.service.IAccountAgentDayService;
 import com.zanxiang.game.data.serve.utils.Page;
 import com.zanxiang.module.util.pojo.ResultVO;
@@ -52,6 +46,13 @@ public class AccountAgentDayController {
         return ResultVO.ok(accountAgentDayService.accountAgentTotal(dto));
     }
 
+    @ApiOperation(value = "推广总数据总计")
+    @PreAuthorize(permissionKey = "gameData:promote:totalSum")
+    @PostMapping("/total/sum")
+    public ResultVO<GamePromoteTotalSumVO> accountAgentTotalSum(@RequestBody GamePromoteTotalSumDTO dto) {
+        return ResultVO.ok(accountAgentDayService.accountAgentTotalSum(dto));
+    }
+
     @ApiOperation(value = "推广渠道每日复充数据")
     @PreAuthorize(permissionKey = "gameData:accountAgent:again")
     @PostMapping("/again")

+ 4 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/GamePromoteDayDTO.java

@@ -8,6 +8,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.time.LocalDate;
+import java.util.List;
 
 @Data
 @NoArgsConstructor
@@ -18,11 +19,13 @@ public class GamePromoteDayDTO extends BasePage {
     private String sourceSystem;
     @ApiModelProperty(notes = "投手id")
     private Long sysUserId;
+    @ApiModelProperty(notes = "推广账号类型")
+    private String accountType;
     @ApiModelProperty(notes = "推广账号ID")
     private String accountId;
 
     @ApiModelProperty(notes = "投放渠道Id")
-    private Long agentId;
+    private List<Long> agentId;
 
     @ApiModelProperty(notes = "cp名")
     private String cpName;

+ 4 - 2
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/GamePromoteDayTotalDTO.java

@@ -7,6 +7,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.time.LocalDate;
+import java.util.List;
 
 @Data
 @NoArgsConstructor
@@ -19,9 +20,10 @@ public class GamePromoteDayTotalDTO {
     private Long sysUserId;
     @ApiModelProperty(notes = "推广账号ID")
     private String accountId;
-
+    @ApiModelProperty(notes = "推广账号类型")
+    private String accountType;
     @ApiModelProperty(notes = "投放渠道Id")
-    private Long agentId;
+    private List<Long> agentId;
 
     @ApiModelProperty(notes = "cp名")
     private String cpName;

+ 4 - 2
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/GamePromoteTotalDTO.java

@@ -8,6 +8,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.time.LocalDate;
+import java.util.List;
 
 @Data
 @NoArgsConstructor
@@ -20,9 +21,10 @@ public class GamePromoteTotalDTO extends BasePage {
     private Long sysUserId;
     @ApiModelProperty(notes = "推广账号ID")
     private String accountId;
-
+    @ApiModelProperty(notes = "推广账号类型")
+    private String accountType;
     @ApiModelProperty(notes = "投放渠道Id")
-    private Long agentId;
+    private List<Long> agentId;
 
     @ApiModelProperty(notes = "cp名")
     private String cpName;

+ 50 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/GamePromoteTotalSumDTO.java

@@ -0,0 +1,50 @@
+package com.zanxiang.game.data.serve.pojo.dto;
+
+import com.zanxiang.game.data.serve.pojo.base.BasePage;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.time.LocalDate;
+import java.util.List;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class GamePromoteTotalSumDTO extends BasePage {
+    @ApiModelProperty(notes = "SDK来源")
+    private String sourceSystem;
+    @ApiModelProperty(notes = "投手id")
+    private Long sysUserId;
+    @ApiModelProperty(notes = "推广账号ID")
+    private String accountId;
+
+    @ApiModelProperty(notes = "推广账号类型")
+    private String accountType;
+    @ApiModelProperty(notes = "投放渠道Id")
+    private List<Long> agentId;
+
+    @ApiModelProperty(notes = "cp名")
+    private String cpName;
+
+    @ApiModelProperty(notes = "游戏id")
+    private Long gameId;
+
+    @ApiModelProperty(notes = "游戏名")
+    private String gameName;
+    @ApiModelProperty(notes = "游戏应用类型")
+    private String gameType;
+
+    @ApiModelProperty(notes = "消耗开始日期")
+    private LocalDate costBeginDay;
+    @ApiModelProperty(notes = "消耗结束日期")
+    private LocalDate costEndDay;
+
+    @ApiModelProperty(notes = "充值开始日期")
+    private LocalDate rechargeBeginDay;
+    @ApiModelProperty(notes = "充值结束日期")
+    private LocalDate rechargeEndDay;
+}

+ 2 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/GamePromoteDayVO.java

@@ -25,7 +25,8 @@ public class GamePromoteDayVO {
 
     @ApiModelProperty(notes = "渠道名称")
     private String agentName;
-
+    @ApiModelProperty(notes = "推广账号类型")
+    private String accountType;
     @ApiModelProperty(notes = "推广账号ID")
     private String accountId;
 

+ 244 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/GamePromoteTotalSumVO.java

@@ -0,0 +1,244 @@
+package com.zanxiang.game.data.serve.pojo.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class GamePromoteTotalSumVO {
+
+    @ApiModelProperty(notes = "消耗")
+    private BigDecimal cost;
+
+    @ApiModelProperty(notes = "广告计划数量")
+    private Long adPlanCount;
+
+    @ApiModelProperty(notes = "曝光数")
+    private Long viewCount;
+
+    @ApiModelProperty(notes = "点击数")
+    private Long clickCount;
+
+    @ApiModelProperty(notes = "转化量")
+    private Long convertCount;
+
+    @ApiModelProperty(notes = "转化率(目标转化率)=转化量/点击量100%")
+    private BigDecimal convertRate;
+
+    @ApiModelProperty(notes = "平均转化成本=实际消耗/转化量")
+    private BigDecimal avgConvertCost;
+
+    @ApiModelProperty(notes = "深度转化量")
+    private Long deepConvertCount;
+
+    @ApiModelProperty(notes = "深度转化成本=实际消耗/深度转化量")
+    private BigDecimal deepConvertCost;
+
+    @ApiModelProperty(notes = "深度转化率=深度转化量/转化量100%")
+    private BigDecimal deepConvertRate;
+
+    @ApiModelProperty(notes = "千次曝光成本=实际消耗/曝光量1000")
+    private BigDecimal thousandViewCost;
+
+    @ApiModelProperty(notes = "点击率=点击量/曝光量100%")
+    private BigDecimal clickRate;
+
+    @ApiModelProperty(notes = "平均点击均价=实际消耗/点击量")
+    private BigDecimal avgClickCost;
+
+    @ApiModelProperty(notes = "应用下载量")
+    private Long appDownloadCount;
+
+    @ApiModelProperty(notes = "应用下载成本=实际消耗/安卓下载开始数")
+    private BigDecimal appDownloadCost;
+
+    @ApiModelProperty(notes = "应用下载率=安卓下载开始数/点击数")
+    private BigDecimal appDownloadRate;
+
+    @ApiModelProperty(notes = "应用下载完成量")
+    private Long downloadFinish;
+
+    @ApiModelProperty(notes = "应用安装量")
+    private Long appInstallCount;
+
+    @ApiModelProperty(notes = "应用安装成本=实际消耗/安卓安装完成数")
+    private BigDecimal appInstallCost;
+
+    @ApiModelProperty(notes = "应用安装率=安卓安装完成数/安卓下载完成数")
+    private BigDecimal appInstallRate;
+
+    @ApiModelProperty(notes = "应用下载完成成本=实际消耗/安卓下载完成数")
+    private BigDecimal downloadFinishCost;
+
+    @ApiModelProperty(notes = "应用下载完成率=安卓下载完成数/安卓下载开始数")
+    private BigDecimal downloadFinishRate;
+
+    @ApiModelProperty(notes = "应用激活数")
+    private Long appActiveCount;
+
+    @ApiModelProperty(notes = "应用激活成本=实际消耗/激活数")
+    private BigDecimal appActiveCost;
+
+    @ApiModelProperty(notes = "应用激活率=激活数/点击数100%")
+    private BigDecimal appActiveRate;
+
+    @ApiModelProperty(notes = "注册人数")
+    private Long regUserCount;
+
+    @ApiModelProperty(notes = "注册成本=实际消耗/注册人数")
+    private BigDecimal regCost;
+
+    @ApiModelProperty(notes = "首日新用户充值次数")
+    private Long firstUserRechargeCount;
+
+    @ApiModelProperty(notes = "首日新用户充值人数")
+    private Long firstUserRechargeUser;
+
+    @ApiModelProperty(notes = "首日新用户充值金额")
+    private BigDecimal firstUserRechargeMoney;
+
+    @ApiModelProperty(notes = "新用户充值次数")
+    private Long userRechargeCount;
+
+    @ApiModelProperty(notes = "新用户充值人数")
+    private Long userRechargeUser;
+
+    @ApiModelProperty(notes = "不展示字段--新用户复充人数")
+    private Long repeatRechargeUser;
+
+    @ApiModelProperty(notes = "新用户充值金额")
+    private BigDecimal userRechargeMoney;
+
+    @ApiModelProperty(notes = "老用户充值次数")
+    private Long oldUserRechargeCount;
+
+    @ApiModelProperty(notes = "老用户充值人数")
+    private Long oldUserRechargeUser;
+
+    @ApiModelProperty(notes = "老用户充值金额")
+    private BigDecimal oldUserRechargeMoney;
+
+    @ApiModelProperty(notes = "账面充值次数")
+    private Long showRechargeCount;
+
+    @ApiModelProperty(notes = "账面充值人数")
+    private Long showRechargeUser;
+
+    @ApiModelProperty(notes = "账面充值金额")
+    private BigDecimal showRechargeMoney;
+
+    @ApiModelProperty(notes = "新用户累计充值次数")
+    private Long newUserRechargeCount;
+
+    @ApiModelProperty(notes = "新用户累计充值人数")
+    private Long newUserRechargeUser;
+
+    @ApiModelProperty(notes = "新用户累计充值金额")
+    private BigDecimal newUserRechargeMoney;
+
+    @ApiModelProperty(notes = "首日回收率=首日新用户充值金额/实际消耗")
+    private BigDecimal firstRecoveryRate;
+
+    @ApiModelProperty(notes = "当日回收率=新用户累计充值金额/实际消耗")
+    private BigDecimal todayRecoveryRate;
+
+    @ApiModelProperty(notes = "回收率=新用户充值金额/实际消耗")
+    private BigDecimal recoveryRate;
+
+    @ApiModelProperty(notes = "毛利额=新用户累计充值金额-实际消耗")
+    private BigDecimal grossMargin;
+
+    @ApiModelProperty(notes = "3日ROI=新用户3日累计充值金额/实际消耗")
+    private BigDecimal roiDay3;
+
+    @ApiModelProperty(notes = "5日ROI=新用户5日累计充值金额/实际消耗")
+    private BigDecimal roiDay5;
+
+    @ApiModelProperty(notes = "7日ROI=新用户7日累计充值金额/实际消耗")
+    private BigDecimal roiDay7;
+
+    @ApiModelProperty(notes = "15日ROI=新用户15日累计充值金额/实际消耗")
+    private BigDecimal roiDay15;
+
+    @ApiModelProperty(notes = "30日ROI=新用户30日累计充值金额/实际消耗")
+    private BigDecimal roiDay30;
+
+    @ApiModelProperty(notes = "60日ROI=新用户60日累计充值金额/实际消耗")
+    private BigDecimal roiDay60;
+
+    @ApiModelProperty(notes = "180日ROI=新用户180日累计充值金额/实际消耗")
+    private BigDecimal roiDay180;
+
+    @ApiModelProperty(notes = "一年ROI=新用户一年累计充值金额/实际消耗")
+    private BigDecimal roiYear1;
+
+    @ApiModelProperty(notes = "首日付费率=首日新用户充值人数/注册人数")
+    private BigDecimal firstRechargeRate;
+
+    @ApiModelProperty(notes = "新用户付费率=新用户充值人数/注册人数")
+    private BigDecimal userRechargeRate;
+
+    @ApiModelProperty(notes = "当天付费率=新用户累计充值人数/注册人数")
+    private BigDecimal todayRechargeRate;
+
+    @ApiModelProperty(notes = "新用户付费比=新用户充值人数/账面充值人数")
+    private BigDecimal newUserRechargeRatio;
+
+    @ApiModelProperty(notes = "首日客单价=首日新用户充值金额/首日新用户充值次数")
+    private BigDecimal avgFirstUserRecharge;
+
+    @ApiModelProperty(notes = "新用户客单价=新用户充值金额/新用户充值次数")
+    private BigDecimal avgUserRecharge;
+
+    @ApiModelProperty(notes = "当天客单价=新用户累计充值金额/新用户累计充值次数")
+    private BigDecimal avgTodayRecharge;
+
+    @ApiModelProperty(notes = "账面客单价=账面充值金额/账面充值次数")
+    private BigDecimal avgShowUserRecharge;
+
+    @ApiModelProperty(notes = "首日充值成本=实际消耗/首日新用户充值人数")
+    private BigDecimal firstRechargeCost;
+
+    @ApiModelProperty(notes = "新用户充值成本=实际消耗/新用户充值人数")
+    private BigDecimal userRechargeCost;
+
+    @ApiModelProperty(notes = "当天充值成本=实际消耗/首日新用户充值人数")
+    private BigDecimal todayRechargeCost;
+
+    @ApiModelProperty(notes = "复充率=新用户复充人数/新用户充值人数")
+    private BigDecimal repeatRechargeRate;
+
+    @ApiModelProperty(notes = "新用户复充率=新用户复充人数/新用户累计充值人数")
+    private BigDecimal userRepeatRechargeRate;
+
+    @ApiModelProperty(notes = "当天复充率=复充人数/新用户累计充值人数")
+    private BigDecimal todayRepeatRechargeRate;
+
+    @ApiModelProperty(notes = "新增注册Arpu=新用户累计充值金额/注册人数")
+    private BigDecimal newRegArpu;
+
+    @ApiModelProperty(notes = "首日付费Arpu=首日新用户充值金额/首日新用户充值人数")
+    private BigDecimal firstRechargeArpu;
+
+    @ApiModelProperty(notes = "新用户付费Arpu=新用户充值金额/新用户充值人数")
+    private BigDecimal userRechargeArpu;
+
+    @ApiModelProperty(notes = "当天付费Arpu=新用户累计充值金额/新用户累计充值人数")
+    private BigDecimal todayRechargeArpu;
+
+    @ApiModelProperty(notes = "账面Arpu=账面充值金额/账面充值人数")
+    private BigDecimal showRechargeArpu;
+
+    @ApiModelProperty(notes = "单日付费100+人数")
+    private String hundredUserNum;
+
+    @ApiModelProperty(notes = "单日付费100+成本")
+    private String hundredUserNumCost;
+}

+ 2 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/GamePromoteTotalVO.java

@@ -24,7 +24,8 @@ public class GamePromoteTotalVO {
 
     @ApiModelProperty(notes = "渠道名称")
     private String agentName;
-
+    @ApiModelProperty(notes = "推广账号类型")
+    private String accountType;
     @ApiModelProperty(notes = "推广账号ID")
     private String accountId;
 

+ 4 - 8
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/IAccountAgentDayService.java

@@ -1,13 +1,7 @@
 package com.zanxiang.game.data.serve.service;
 
-import com.zanxiang.game.data.serve.pojo.dto.AgentDayAgainDTO;
-import com.zanxiang.game.data.serve.pojo.dto.GamePromoteDayDTO;
-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.vo.AgentDayAgainVO;
-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.dto.*;
+import com.zanxiang.game.data.serve.pojo.vo.*;
 import com.zanxiang.game.data.serve.utils.Page;
 
 import java.time.LocalDate;
@@ -42,4 +36,6 @@ public interface IAccountAgentDayService {
      * @return
      */
     Map<LocalDate, List<AgentDayAgainVO>> accountAgentDayAgain(AgentDayAgainDTO dto);
+
+    GamePromoteTotalSumVO accountAgentTotalSum(GamePromoteTotalSumDTO dto);
 }

+ 342 - 21
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AccountAgentDayServiceImpl.java

@@ -3,10 +3,7 @@ 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.AgentDayAgainDTO;
-import com.zanxiang.game.data.serve.pojo.dto.GamePromoteDayDTO;
-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.dto.*;
 import com.zanxiang.game.data.serve.pojo.entity.AdsAccountAgentDay;
 import com.zanxiang.game.data.serve.pojo.entity.AdsAgentDayAgain;
 import com.zanxiang.game.data.serve.pojo.enums.OrderByEnum;
@@ -72,8 +69,11 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
         if (StringUtils.isNotBlank(dto.getAccountId())) {
             cri.where().andEquals("account_id", dto.getAccountId());
         }
-        if (null != dto.getAgentId()) {
-            cri.where().andEquals("agent_id", dto.getAgentId());
+        if (StringUtils.isNotBlank(dto.getAccountType())) {
+            cri.where().andEquals("account_type", dto.getAccountId());
+        }
+        if (!CollectionUtils.isEmpty(dto.getAgentId())) {
+            cri.where().andInList("agent_id", dto.getAgentId());
         }
         if (StringUtils.isNotBlank(dto.getCpName())) {
             cri.where().andLike("game_cp", dto.getCpName());
@@ -216,8 +216,11 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
         if (StringUtils.isNotBlank(dto.getAccountId())) {
             cri.where().andEquals("account_id", dto.getAccountId());
         }
-        if (null != dto.getAgentId()) {
-            cri.where().andEquals("agent_id", dto.getAgentId());
+        if (StringUtils.isNotBlank(dto.getAccountType())) {
+            cri.where().andEquals("account_type", dto.getAccountId());
+        }
+        if (!CollectionUtils.isEmpty(dto.getAgentId())) {
+            cri.where().andInList("agent_id", dto.getAgentId());
         }
         if (StringUtils.isNotBlank(dto.getCpName())) {
             cri.where().andLike("game_cp", dto.getCpName());
@@ -276,8 +279,11 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
         if (StringUtils.isNotBlank(dto.getAccountId())) {
             cri.where().andEquals("a.account_id", dto.getAccountId());
         }
-        if (null != dto.getAgentId()) {
-            cri.where().andEquals("a.agent_id", dto.getAgentId());
+        if (StringUtils.isNotBlank(dto.getAccountType())) {
+            cri.where().andEquals("account_type", dto.getAccountId());
+        }
+        if (!CollectionUtils.isEmpty(dto.getAgentId())) {
+            cri.where().andInList("agent_id", dto.getAgentId());
         }
         if (StringUtils.isNotBlank(dto.getCpName())) {
             cri.where().andLike("a.game_cp", dto.getCpName());
@@ -436,7 +442,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
                         BigDecimal.ZERO:item.getUserRechargeMoney().divide(BigDecimal.valueOf(item.getUserRechargeCount()),4, RoundingMode.DOWN));
 
                 item.setUserRechargeCost(item.getUserRechargeUser() == 0 ?
-                        BigDecimal.ZERO:item.getCost().divide(BigDecimal.valueOf(item.getUserRechargeUser()),4, RoundingMode.DOWN));
+                        BigDecimal.ZERO:item.getCost().divide(BigDecimal.valueOf(item.getUserRechargeUser()),2, RoundingMode.DOWN));
 
                 item.setRepeatRechargeRate(item.getUserRechargeUser() == 0 ?
                         BigDecimal.ZERO:BigDecimal.valueOf(item.getRepeatRechargeUser()).divide(BigDecimal.valueOf(item.getUserRechargeUser()),4, RoundingMode.DOWN));
@@ -556,6 +562,217 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
         return map;
     }
 
+    @Override
+    public GamePromoteTotalSumVO accountAgentTotalSum(GamePromoteTotalSumDTO dto) {
+        Long sysUserId = SecurityUtil.isAdmin() ? null : SecurityUtil.getUserId();
+        sysUserId = null == dto.getSysUserId() ? sysUserId : dto.getSysUserId();
+        dto.setSysUserId(sysUserId);
+        if (null == dto.getCostEndDay() || null == dto.getCostBeginDay()) {
+            dto.setCostBeginDay(LocalDate.now());
+            dto.setCostEndDay(LocalDate.now());
+        }
+        if (null == dto.getRechargeEndDay() || null == dto.getRechargeBeginDay()) {
+            dto.setRechargeEndDay(LocalDate.now());
+            dto.setRechargeBeginDay(LocalDate.now());
+        }
+        // 推广总计
+        SimpleCriteria cri = getSimpleCriteria(dto);
+        if (null != dto.getCostBeginDay()) {
+            cri.where().and("a.dt", ">=", dto.getCostBeginDay());
+        }
+        if (null != dto.getCostEndDay()) {
+            cri.where().and("a.dt", "<=", dto.getCostEndDay());
+        }
+        Sql sql = Sqls.queryEntity(accountAgentTotalSumSql() + "$condition");
+        Entity<GamePromoteTotalSumVO> entity = dao.getEntity(GamePromoteTotalSumVO.class);
+        sql.setEntity(entity).setCondition(cri);
+        dao.execute(sql);
+        GamePromoteTotalSumVO gamePromoteTotalSumVO = sql.getObject(GamePromoteTotalSumVO.class);
+
+        //账面总计
+        SimpleCriteria showCri = getSimpleCriteria(dto);
+        if (null != dto.getRechargeBeginDay()) {
+            showCri.where().and("a.dt", ">=", dto.getRechargeBeginDay());
+        }
+        if (null != dto.getRechargeEndDay()) {
+            showCri.where().and("a.dt", "<=", dto.getRechargeEndDay());
+        }
+        String show = """
+                select
+                ifnull(sum(a.amount_count),0) as show_recharge_count,
+                ifnull(sum(a.amount_num),0) as show_recharge_user,
+                ifnull(sum(a.amount),0) as show_recharge_money,
+                round(if(sum(a.amount_count) > 0, sum(a.amount) / sum(a.amount_count), 0), 4) as avg_show_user_recharge,
+                round(if(sum(a.amount_num) > 0, sum(a.amount) / sum(a.amount_num), 0), 4) as show_recharge_arpu
+                from
+                ads_account_agent_day a
+                """;
+        Sql showSql = Sqls.queryEntity(show + "$condition");
+        Entity<ShowRecharge> showEntity = dao.getEntity(ShowRecharge.class);
+        showSql.setEntity(showEntity).setCondition(showCri);
+        dao.execute(showSql);
+        ShowRecharge showRecharge = showSql.getObject(ShowRecharge.class);
+        if (null != showRecharge) {
+            gamePromoteTotalSumVO.setShowRechargeArpu(showRecharge.showRechargeArpu);
+            gamePromoteTotalSumVO.setShowRechargeCount(showRecharge.getShowRechargeCount());
+            gamePromoteTotalSumVO.setShowRechargeMoney(showRecharge.showRechargeMoney);
+            gamePromoteTotalSumVO.setShowRechargeUser(showRecharge.getShowRechargeUser());
+            gamePromoteTotalSumVO.setAvgShowUserRecharge(showRecharge.avgShowUserRecharge);
+        } else {
+            gamePromoteTotalSumVO.setShowRechargeArpu(BigDecimal.ZERO);
+            gamePromoteTotalSumVO.setShowRechargeCount(0L);
+            gamePromoteTotalSumVO.setShowRechargeMoney(BigDecimal.ZERO);
+            gamePromoteTotalSumVO.setShowRechargeUser(0L);
+            gamePromoteTotalSumVO.setAvgShowUserRecharge(BigDecimal.ZERO);
+        }
+
+        // dayN总计
+        SimpleCriteria agentAccountCri = getSimpleCriteria(dto);
+        if (null != dto.getCostBeginDay()) {
+            agentAccountCri.where().and("a.dt", ">=", dto.getCostBeginDay());
+        }
+        if (null != dto.getCostEndDay()) {
+            agentAccountCri.where().and("a.dt", "<=", dto.getCostEndDay());
+        }
+        agentAccountCri.groupBy("a.account_id,a.agent_id,a.source_system");
+        Sql agentAccountSql = Sqls.queryEntity(accountAgentTotalSumDayNSql() + "$condition");
+        Entity<AgentAccount> agentAccountEntity = dao.getEntity(AgentAccount.class);
+        agentAccountSql.setEntity(agentAccountEntity).setCondition(agentAccountCri);
+        dao.execute(agentAccountSql);
+        List<AgentAccount> agentAccountList = agentAccountSql.getList(AgentAccount.class);
+        //渠道注册时间内的dayn充值数据,获取表ads_dayn_amount的json数据
+        Map<String, Object> dayNMap = new HashMap<>(4);
+        dayNMap.put("beginDay", dto.getCostBeginDay());
+        dayNMap.put("endDay", dto.getCostEndDay());
+        Sql sqlDayN = Sqls.queryString("""
+                select dayN
+                from ads_dayn_amount
+                where
+                dt>=@beginDay and dt<=@endDay
+                and account_id = @accountId
+                and agent_id = @agentId
+                and source_system = @sourceSystem
+                """);
+        DayN dayNTotal = agentAccountList.stream().map(item -> {
+            dayNMap.put("accountId", item.getAccountId());
+            dayNMap.put("agentId", item.getAgentId());
+            dayNMap.put("sourceSystem", item.getSourceSystem());
+            sqlDayN.setParams(dayNMap);
+            dao.execute(sqlDayN);
+            List<String> dayNList = sqlDayN.getList(String.class);
+            DayN dayN = null;
+            //ads_dayn_amount存在充值数据
+            if (!CollectionUtils.isEmpty(dayNList)) {
+                Gson gson = new Gson();
+                List<Map<String, String>> jsonList = gson.fromJson(dayNList.toString(), ArrayList.class);
+
+                Map<String, String> resultMap = new HashMap<>();
+                resultMap.put("dayN", "0.00-0-0-0");
+                for (Map<String, String> jsonMap : jsonList) {
+                    for (Map.Entry<String, String> entry : jsonMap.entrySet()) {
+                        String key = entry.getKey();
+                        String value = entry.getValue();
+                        String[] parts = value.split("-");
+                        if (DateUtil.parseLocalDate(key).compareTo(dto.getRechargeBeginDay()) >= 0
+                                && DateUtil.parseLocalDate(key).compareTo(dto.getRechargeEndDay()) <= 0) {
+                            String[] existingParts = resultMap.get("dayN").split("-");
+                            BigDecimal money = new BigDecimal(existingParts[0]).add(new BigDecimal(parts[0]));
+                            int count = Integer.parseInt(existingParts[1]) + Integer.parseInt(parts[1]);
+                            int num = Integer.parseInt(existingParts[2]) + Integer.parseInt(parts[2]);
+                            int repeatNum = Integer.parseInt(existingParts[3]) + Integer.parseInt(parts[3]);
+                            String newValue = money + "-" + count + "-" + num + "-" + repeatNum;
+                            resultMap.put("dayN", newValue);
+                        }
+                    }
+                }
+                if (!resultMap.isEmpty() && !resultMap.get("dayN").isEmpty()) {
+                    String[] parts = resultMap.get("dayN").split("-");
+                    dayN = DayN.builder()
+                            .rechargeMoney(new BigDecimal(parts[0]))
+                            .rechargeCount(Long.valueOf(parts[1]))
+                            .rechargeNum(Long.valueOf(parts[2]))
+                            .repeatNum(Long.valueOf(parts[3]))
+                            .build();
+                }
+            }
+            return dayN;
+        }).filter(Objects::nonNull).reduce((accumulator, currentItem) -> {
+            // 如果 accumulator 为空,直接返回 currentItem
+            accumulator.setRechargeCount(accumulator.getRechargeCount() + currentItem.getRechargeCount());
+            accumulator.setRechargeMoney(accumulator.getRechargeMoney().add(currentItem.getRechargeMoney()));
+            accumulator.setRechargeNum(accumulator.getRechargeNum() + currentItem.getRechargeNum());
+            accumulator.setRepeatNum(accumulator.getRepeatNum() + currentItem.getRepeatNum());
+            // 其他字段相加的逻辑
+            return accumulator;
+        }).orElse(new DayN());
+
+        //充值时间范围内存在充值数据
+        gamePromoteTotalSumVO.setUserRechargeMoney(dayNTotal.getRechargeMoney());
+        gamePromoteTotalSumVO.setUserRechargeCount(dayNTotal.getRechargeCount());
+        gamePromoteTotalSumVO.setUserRechargeUser(dayNTotal.getRechargeNum());
+        gamePromoteTotalSumVO.setRepeatRechargeUser(dayNTotal.getRepeatNum());
+        gamePromoteTotalSumVO.setUserRechargeArpu(gamePromoteTotalSumVO.getUserRechargeUser() == 0 ?
+                BigDecimal.ZERO : gamePromoteTotalSumVO.getUserRechargeMoney().divide(BigDecimal.valueOf(gamePromoteTotalSumVO.getUserRechargeUser()), 4, RoundingMode.DOWN));
+
+        gamePromoteTotalSumVO.setOldUserRechargeMoney(gamePromoteTotalSumVO.getShowRechargeMoney().subtract(gamePromoteTotalSumVO.getUserRechargeMoney()));
+        gamePromoteTotalSumVO.setOldUserRechargeCount(gamePromoteTotalSumVO.getShowRechargeCount() - gamePromoteTotalSumVO.getUserRechargeCount());
+        gamePromoteTotalSumVO.setOldUserRechargeUser(gamePromoteTotalSumVO.getShowRechargeUser() - gamePromoteTotalSumVO.getUserRechargeUser());
+
+        gamePromoteTotalSumVO.setRecoveryRate(gamePromoteTotalSumVO.getCost().compareTo(BigDecimal.ZERO) == 0 ?
+                BigDecimal.ZERO : gamePromoteTotalSumVO.getUserRechargeMoney().divide(gamePromoteTotalSumVO.getCost(), 4, RoundingMode.DOWN));
+
+        gamePromoteTotalSumVO.setUserRechargeRate(gamePromoteTotalSumVO.getRegUserCount() == 0 ?
+                BigDecimal.ZERO : BigDecimal.valueOf(gamePromoteTotalSumVO.getUserRechargeUser()).divide(BigDecimal.valueOf(gamePromoteTotalSumVO.getRegUserCount()), 4, RoundingMode.DOWN));
+
+        gamePromoteTotalSumVO.setNewUserRechargeRatio(gamePromoteTotalSumVO.getShowRechargeUser() == 0 ?
+                BigDecimal.ZERO : BigDecimal.valueOf(gamePromoteTotalSumVO.getUserRechargeUser()).divide(BigDecimal.valueOf(gamePromoteTotalSumVO.getShowRechargeUser()), 4, RoundingMode.DOWN));
+
+        gamePromoteTotalSumVO.setAvgUserRecharge(gamePromoteTotalSumVO.getUserRechargeCount() == 0 ?
+                BigDecimal.ZERO : gamePromoteTotalSumVO.getUserRechargeMoney().divide(BigDecimal.valueOf(gamePromoteTotalSumVO.getUserRechargeCount()), 4, RoundingMode.DOWN));
+
+        gamePromoteTotalSumVO.setUserRechargeCost(gamePromoteTotalSumVO.getUserRechargeUser() == 0 ?
+                BigDecimal.ZERO : gamePromoteTotalSumVO.getCost().divide(BigDecimal.valueOf(gamePromoteTotalSumVO.getUserRechargeUser()), 2, RoundingMode.DOWN));
+
+        gamePromoteTotalSumVO.setRepeatRechargeRate(gamePromoteTotalSumVO.getUserRechargeUser() == 0 ?
+                BigDecimal.ZERO : BigDecimal.valueOf(gamePromoteTotalSumVO.getRepeatRechargeUser()).divide(BigDecimal.valueOf(gamePromoteTotalSumVO.getUserRechargeUser()), 4, RoundingMode.DOWN));
+        gamePromoteTotalSumVO.setUserRepeatRechargeRate(gamePromoteTotalSumVO.getNewUserRechargeUser() == 0 ?
+                BigDecimal.ZERO : BigDecimal.valueOf(gamePromoteTotalSumVO.getRepeatRechargeUser()).divide(BigDecimal.valueOf(gamePromoteTotalSumVO.getNewUserRechargeUser()), 4, RoundingMode.DOWN));
+        return gamePromoteTotalSumVO;
+    }
+
+    private SimpleCriteria getSimpleCriteria(GamePromoteTotalSumDTO dto) {
+        SimpleCriteria cri = Cnd.cri();
+        // 组装条件
+        if (null != dto.getSysUserId()) {
+            cri.where().andEquals("a.pitcher_id", dto.getSysUserId());
+        }
+        if (StringUtils.isNotBlank(dto.getAccountId())) {
+            cri.where().andEquals("a.account_id", dto.getAccountId());
+        }
+        if (StringUtils.isNotBlank(dto.getAccountType())) {
+            cri.where().andEquals("account_type", dto.getAccountId());
+        }
+        if (!CollectionUtils.isEmpty(dto.getAgentId())) {
+            cri.where().andInList("agent_id", dto.getAgentId());
+        }
+        if (StringUtils.isNotBlank(dto.getCpName())) {
+            cri.where().andLike("a.game_cp", dto.getCpName());
+        }
+        if (StringUtils.isNotBlank(dto.getGameName())) {
+            cri.where().andLike("a.game_name", dto.getGameName());
+        }
+        if (StringUtils.isNotBlank(dto.getGameType())) {
+            cri.where().andEquals("a.game_type", dto.getGameType());
+        }
+        if (null != dto.getGameId()) {
+            cri.where().andEquals("a.game_id", dto.getGameId());
+        }
+        if (StringUtils.isNotBlank(dto.getSourceSystem())) {
+            cri.where().andEquals("a.source_system", dto.getSourceSystem());
+        }
+        return cri;
+    }
+
     /**
      * 初始化List数据
      * @param list 需要初始化的数据
@@ -635,6 +852,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
                 	source_system,
                 	agent_id,
                 	agent_name,
+                	account_type,
                 	account_id,
                 	agent_id,
                 	pitcher AS sys_user_name,
@@ -789,20 +1007,109 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
                 	round(if(sum(first_new_user_amount_count) > 0, sum(first_new_user_amount) / sum(first_new_user_amount_count), 0), 4) as avg_first_user_recharge,
                 	round(if(sum(buy_new_user_total_amount_count) > 0, sum(buy_new_user_total_amount) / sum(buy_new_user_total_amount_count), 0), 4) as avg_buy_user_recharge,
                 	round(if(sum(amount_count) > 0, sum(amount) / sum(amount_count), 0), 4) as avg_show_user_recharge,
-                	round(if(sum(first_new_user_amount_num) > 0, sum(cost) / sum(first_new_user_amount_num), 0), 4) as first_recharge_cost,
-                	round(if(sum(buy_new_user_total_amount_num) > 0, sum(cost) / sum(buy_new_user_total_amount_num), 0), 4) as buy_user_recharge_cost,
+                	round(if(sum(first_new_user_amount_num) > 0, sum(cost) / sum(first_new_user_amount_num), 0), 2) as first_recharge_cost,
+                	round(if(sum(buy_new_user_total_amount_num) > 0, sum(cost) / sum(buy_new_user_total_amount_num), 0), 2) as buy_user_recharge_cost,
                 	round(if(sum(new_user_total_amount_num) > 0, sum(reg_order_user_again) / sum(new_user_total_amount_num), 0), 4) as repeat_recharge_rate,
                 	round(if(sum(register_num) > 0, sum(new_user_total_amount) / sum(register_num), 0), 4) 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), 4) as first_recharge_arpu,
                 	round(if(sum(new_user_total_amount_num) > 0, sum(new_user_total_amount) / sum(new_user_total_amount_num), 0), 4) as today_recharge_arpu,
                 	round(if(sum(amount_num) > 0, sum(amount) / sum(amount_num), 0), 4) as show_recharge_arpu,
                 	sum(hundred_user_num) as hundred_user_num,
-                	round(if(sum(hundred_user_num) > 0, sum(cost) / sum(hundred_user_num), 0), 4) as hundred_user_num_cost
+                	round(if(sum(hundred_user_num) > 0, sum(cost) / sum(hundred_user_num), 0), 2) as hundred_user_num_cost
                 from
                 	ads_account_agent_day
                 """;
     }
 
+    /**
+     * 推广总数据SQL
+     * @return
+     */
+    private String accountAgentTotalSumDayNSql() {
+        return """
+                select
+                a.source_system as source_system,
+                a.agent_id as agent_id,
+                a.account_id as account_id
+                from
+                	ads_account_agent_day a
+                """;
+    }
+
+    /**
+     * 推广总数据SQL
+     * @return
+     */
+    private String accountAgentTotalSumSql() {
+        return """
+                select
+                	sum(a.cost) as cost,
+                	sum(a.plan_count) as ad_plan_count,
+                	sum(a.view_count) as view_count,
+                	sum(a.click_count) as click_count,
+                	sum(a.change_count) as convert_count,
+                	round(if(sum(a.click_count) > 0, sum(a.change_count) / sum(a.click_count), 0), 4) as convert_rate,
+                	round(if(sum(a.change_count) > 0, sum(a.cost) / sum(a.change_count), 0), 2) as avg_convert_cost,
+                	sum(a.depth_change_count) as deep_convert_count,
+                	round(if(sum(a.change_count) > 0, sum(a.depth_change_count) / sum(a.change_count), 0), 4) as deep_convert_rate,
+                	round(if(sum(a.depth_change_count) > 0, sum(a.cost) / sum(a.depth_change_count), 0), 2) as deep_convert_cost,
+                	round(if(sum(a.view_count) > 0, sum(a.cost) / sum(a.view_count) * 1000, 0), 2) as thousand_view_cost,
+                	round(if(sum(a.view_count) > 0, sum(a.click_count) / sum(a.view_count), 0), 4) as click_rate,
+                	round(if(sum(a.click_count) > 0, sum(a.cost) / sum(a.click_count), 0), 2) as avg_click_cost,
+                	sum(a.download_start) as app_download_count,
+                	round(if(sum(a.download_start) > 0, sum(a.cost) / sum(a.download_start), 0), 2) as app_download_cost,
+                	round(if(sum(a.click_count) > 0, sum(a.download_start) / sum(a.click_count), 0), 4) as app_download_rate,
+                	sum(a.download_finish) as download_finish,
+                	round(if(sum(a.download_finish) > 0, sum(a.cost) / sum(a.download_finish), 0), 2) as download_finish_cost,
+                	round(if(sum(a.download_start) > 0, sum(a.download_finish) / sum(a.download_start), 0), 4) as download_finish_rate,
+                	sum(a.install_finish) as app_install_count,
+                	round(if(sum(a.install_finish) > 0, sum(a.cost) / sum(a.install_finish), 0), 2) as app_install_cost,
+                	round(if(sum(a.download_finish) > 0, sum(a.install_finish) / sum(a.download_finish), 0), 4) as app_install_rate,
+                	sum(a.active) as app_active_count,
+                	round(if(sum(a.active) > 0, sum(a.cost) / sum(a.active), 0), 2) as app_active_cost,
+                	round(if(sum(a.click_count) > 0, sum(a.active) / sum(a.click_count), 0), 4) as app_active_rate,
+                	sum(a.register_num) as reg_user_count,
+                	round(if(sum(a.register_num) > 0, sum(a.cost) / sum(a.register_num), 0), 2) as reg_cost,
+                	sum(a.first_new_user_amount_count) as first_user_recharge_count,
+                	sum(a.first_new_user_amount_num) as first_user_recharge_user,
+                	sum(a.first_new_user_amount) as first_user_recharge_money,
+                	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(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,
+                	sum(a.new_user_total_amount_count) as new_user_recharge_count,
+                	sum(a.new_user_total_amount_num) as new_user_recharge_user,
+                	sum(a.new_user_total_amount) as new_user_recharge_money,
+                	round(if(sum(a.cost) > 0, sum(a.first_new_user_amount) / sum(a.cost), 0), 4) as first_recovery_rate,
+                	round(if(sum(a.cost) > 0, sum(a.new_user_total_amount) / sum(a.cost), 0), 4) as today_recovery_rate,
+                	sum(a.gross_profit) as gross_margin,
+                	round(if(sum(a.cost) > 0, sum(a.SPLIT_PART(a.amount_d3, '/', 1)) / sum(a.cost), 0), 4) as roi_day3,
+                	round(if(sum(a.cost) > 0, sum(a.SPLIT_PART(a.amount_d5, '/', 1)) / sum(a.cost), 0), 4) as roi_day5,
+                	round(if(sum(a.cost) > 0, sum(a.SPLIT_PART(a.amount_d7, '/', 1)) / sum(a.cost), 0), 4) as roi_day7,
+                	round(if(sum(a.cost) > 0, sum(a.SPLIT_PART(a.amount_d15, '/', 1)) / sum(a.cost), 0), 4) as roi_day15,
+                	round(if(sum(a.cost) > 0, sum(a.SPLIT_PART(a.amount_m1, '/', 1)) / sum(a.cost), 0), 4) as roi_day30,
+                	round(if(sum(a.cost) > 0, sum(a.SPLIT_PART(a.amount_m2, '/', 1)) / sum(a.cost), 0), 4) as roi_day60,
+                	round(if(sum(a.cost) > 0, sum(a.SPLIT_PART(a.amount_m6, '/', 1)) / sum(a.cost), 0), 4) as roi_day180,
+                	round(if(sum(a.cost) > 0, sum(a.SPLIT_PART(a.amount_y1, '/', 1)) / sum(a.cost), 0), 4) as roi_year1,
+                	round(if(sum(a.register_num) > 0, sum(a.first_new_user_amount_num) / sum(a.register_num), 0), 4) as first_recharge_rate,
+                	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(a.first_new_user_amount_num) > 0, sum(a.cost) / sum(a.first_new_user_amount_num), 0), 2) 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), 2) 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,
+                	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), 2) as hundred_user_num_cost
+                from
+                	ads_account_agent_day a
+                """;
+    }
+
     /**
      * 推广总数据SQL
      * @return
@@ -876,26 +1183,28 @@ 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(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.first_new_user_amount_num) > 0, sum(a.cost) / sum(a.first_new_user_amount_num), 0), 2) 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), 2) 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,
                 	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
+                	round(if(sum(a.hundred_user_num) > 0, sum(a.cost) / sum(a.hundred_user_num), 0), 2) as hundred_user_num_cost
                 from
                 	ads_account_agent_day a
                 """;
     }
 
     @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
     @Builder
     public static class DayN{
-        private BigDecimal rechargeMoney;
-        private Long rechargeCount;
-        private Long rechargeNum;
-        private Long repeatNum;
+        private BigDecimal rechargeMoney = BigDecimal.ZERO;
+        private Long rechargeCount = 0L;
+        private Long rechargeNum = 0L;
+        private Long repeatNum = 0L;
     }
 
     @Data
@@ -913,4 +1222,16 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
 
         private BigDecimal showRechargeArpu;
     }
+
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @Builder
+    public static class AgentAccount{
+        private String sourceSystem;
+
+        private Long accountId;
+
+        private Long agentId;
+    }
 }