wcc 1 éve
szülő
commit
496a38d0ad

+ 2 - 2
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/controller/RankingController.java

@@ -55,7 +55,7 @@ public class RankingController {
     @ApiOperation(value = "推广渠道充值排行榜")
     @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = AdsAgentRechargeRankingVO.class)})
     @PostMapping("/agent")
-    public ResultVO<Page<AdsAgentRechargeRankingVO>> list(@Validated @RequestBody AdsAgentRechargeRankingListDTO dto) {
+    public ResultVO<Page<AdsAgentRechargeRankingVO>> agent(@Validated @RequestBody AdsAgentRechargeRankingListDTO dto) {
         return ResultVO.ok(adsAgentRechargeRankingService.listOfPage(dto));
     }
 
@@ -63,7 +63,7 @@ public class RankingController {
     @ApiOperation(value = "推广账号充值排行榜")
     @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = AdsAccountRechargeRankingVO.class)})
     @PostMapping("/account")
-    public ResultVO<Page<AdsAccountRechargeRankingVO>> list(@Validated @RequestBody AdsAccountRechargeRankingListDTO dto) {
+    public ResultVO<Page<AdsAccountRechargeRankingVO>> account(@Validated @RequestBody AdsAccountRechargeRankingListDTO dto) {
         return ResultVO.ok(adsAccountRechargeRankingService.listOfPage(dto));
     }
 }

+ 2 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/AdsAccountRechargeRankingListDTO.java

@@ -12,6 +12,8 @@ public class AdsAccountRechargeRankingListDTO  extends BasePage {
 
     private LocalDate endDay;
 
+    private String sourceSystem;
+
     private String accountId;
 
     private String pitcherId;

+ 2 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/AdsAgentRechargeRankingListDTO.java

@@ -12,6 +12,8 @@ public class AdsAgentRechargeRankingListDTO extends BasePage {
 
     private LocalDate endDay;
 
+    private String sourceSystem;
+
     private String agentId;
 
     private String pitcherId;

+ 2 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/entity/AdsAccountRechargeRanking.java

@@ -35,6 +35,8 @@ public class AdsAccountRechargeRanking implements Serializable {
      */
     private LocalDate dt;
 
+    private String sourceSystem;
+
     /**
      * 推广账号
      */

+ 5 - 3
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/entity/AdsAgentRechargeRanking.java

@@ -35,6 +35,8 @@ public class AdsAgentRechargeRanking implements Serializable {
      */
     private LocalDate dt;
 
+    private String sourceSystem;
+
     /**
      * 推广渠道账号
      */
@@ -74,19 +76,19 @@ public class AdsAgentRechargeRanking implements Serializable {
      * 累计充值今额
      */
     @Column
-    private BigDecimal newUserTotalRechargeAmount;
+    private BigDecimal totalRechargeAmount;
 
     /**
      * 累计充值人数
      */
     @Column
-    private Long newUserTotalRechargeNum;
+    private Long totalRechargeNum;
 
     /**
      * 累计充值次数
      */
     @Column
-    private Long newUserTotalRechargeCount;
+    private Long totalRechargeCount;
 
     /**
      * 平均单价

+ 4 - 4
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/AdsAgentRechargeRankingVO.java

@@ -29,14 +29,14 @@ public class AdsAgentRechargeRankingVO {
     @ApiModelProperty(notes = "当天充值金额")
     private BigDecimal todayAmount;
 
-    @ApiModelProperty(notes = "新用户累计充值金额")
-    private BigDecimal newUserTotalRechargeAmount;
+    @ApiModelProperty(notes = "累计充值金额")
+    private BigDecimal totalRechargeAmount;
 
     @ApiModelProperty(notes = "累计充值人数")
-    private Long newUserTotalRechargeNum;
+    private Long totalRechargeNum;
 
     @ApiModelProperty(notes = "累计充值次数")
-    private Long newUserTotalRechargeCount;
+    private Long totalRechargeCount;
 
     @ApiModelProperty(notes = "累计消耗")
     private Long totalCost;

+ 8 - 5
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AdsAccountRechargeRankingServiceImpl.java

@@ -4,6 +4,7 @@ import com.google.common.base.CaseFormat;
 import com.zanxiang.erp.security.util.SecurityUtil;
 import com.zanxiang.game.data.serve.pojo.dto.AdsAccountRechargeRankingListDTO;
 import com.zanxiang.game.data.serve.pojo.entity.AdsAccountRechargeRanking;
+import com.zanxiang.game.data.serve.pojo.entity.AdsAgentRechargeRanking;
 import com.zanxiang.game.data.serve.pojo.vo.AdsAccountRechargeRankingVO;
 import com.zanxiang.game.data.serve.service.IAdsAccountRechargeRankingService;
 import com.zanxiang.game.data.serve.utils.Page;
@@ -52,13 +53,13 @@ public class AdsAccountRechargeRankingServiceImpl implements IAdsAccountRecharge
                 sum(reg_user_cnt) as reg_user_cnt,
                 sum(cost) / sum(reg_user_cnt) as reg_cost,
                 sum(first_role) as first_role,
-                sum(total_role) as total_role,
+                max(total_role) as total_role,
                 sum(first_amount) as first_amount,
                 sum(first_amount_user) as first_amount_user,
                 sum(first_amount_count) as first_amount_count,
-                sum(total_amount) as total_amount,
-                sum(total_amount_user) as total_amount_user,
-                sum(total_amount_count) as total_amount_count,
+                max(total_amount) as total_amount,
+                max(total_amount_user) as total_amount_user,
+                max(total_amount_count) as total_amount_count,
                 sum(cost) / sum(first_amount) as first_roi,
                 sum(total_amount) / sum(total_amount_count) as avg_amount,
                 sum(total_amount) / sum(cost) as roi
@@ -80,6 +81,9 @@ public class AdsAccountRechargeRankingServiceImpl implements IAdsAccountRecharge
         if (StringUtils.isNotBlank(dto.getType())) {
             cri.where().and(AdsAccountRechargeRanking::getType, "=", dto.getType());
         }
+        if (StringUtils.isNotBlank(dto.getSourceSystem())) {
+            cri.where().and(AdsAgentRechargeRanking::getSourceSystem, "=", dto.getSourceSystem());
+        }
         cri.groupBy("account_id", "pitcher_id", "type", "game_id");
         cri.orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType());
         Sql sql = Sqls.queryEntity(sqlStr + "$condition");
@@ -92,7 +96,6 @@ public class AdsAccountRechargeRankingServiceImpl implements IAdsAccountRecharge
         sql.setPager(pager);
         dao.execute(sql);
 
-
         List<AdsAccountRechargeRankingVO> result = sql.getList(AdsAccountRechargeRankingVO.class);
         int beginIndex = (dto.getPageNum() - 1) * dto.getPageSize();
         int size = result.size();

+ 8 - 5
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AdsAgentRechargeRankingServiceImpl.java

@@ -43,12 +43,12 @@ public class AdsAgentRechargeRankingServiceImpl implements IAdsAgentRechargeRank
         String sqlStr = """
                 select agent_id, max(agent_name) as agent_name, pitcher_id, max(pitcher) as pitcher, `type`,
                 sum(today_amount) as today_amount,
-                sum(new_user_total_recharge_amount) as new_user_total_recharge_amount,
-                sum(new_user_total_recharge_num) as new_user_total_recharge_num,
-                sum(new_user_total_recharge_count) as new_user_total_recharge_count,
+                max(total_recharge_amount) as total_recharge_amount,
+                max(total_recharge_num) as total_recharge_num,
+                max(total_recharge_count) as total_recharge_count,
                 sum(total_cost) as total_cost,
-                sum(new_user_total_recharge_amount) / sum(new_user_total_recharge_count) as avg_amount,
-                if (sum(total_cost) > 0, sum(new_user_total_recharge_amount) / sum(total_cost), 'xx') as roi
+                max(total_recharge_amount) / max(total_recharge_count) as avg_amount,
+                if (sum(total_cost) > 0, max(total_recharge_amount) / sum(total_cost), 'xx') as roi
                 from ads_agent_recharge_ranking
                 """;
         SimpleCriteria cri = Cnd.cri();
@@ -64,6 +64,9 @@ public class AdsAgentRechargeRankingServiceImpl implements IAdsAgentRechargeRank
         if (StringUtils.isNotBlank(dto.getType())) {
             cri.where().and(AdsAgentRechargeRanking::getType, "=", dto.getType());
         }
+        if (StringUtils.isNotBlank(dto.getSourceSystem())) {
+            cri.where().and(AdsAgentRechargeRanking::getSourceSystem, "=", dto.getSourceSystem());
+        }
         cri.groupBy("agent_id", "pitcher_id", "type");
         cri.orderBy(CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, dto.getSortFiled()), dto.getSortType());
         Sql sql = Sqls.queryEntity(sqlStr + "$condition");