Jelajahi Sumber

修改内容:推广创角数

shishaosong 1 tahun lalu
induk
melakukan
315d39c09c

+ 18 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/entity/AdsAccountAgentDay.java

@@ -909,5 +909,23 @@ public class AdsAccountAgentDay implements Serializable {
     @Column
     private Long regOrderUserAgain;
 
+    /**
+     * 首日创角人数
+     */
+    @Column
+    private Long firstRoleNum;
+
+    /**
+     * 新用户累计创角人数
+     */
+    @Column
+    private Long newUserTotalRoleNum;
+
+    /**
+     * 创角人数
+     */
+    @Column
+    private Long roleNum;
+
 
 }

+ 18 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/GamePromoteDayTotalVO.java

@@ -518,4 +518,22 @@ public class GamePromoteDayTotalVO {
 
     @ApiModelProperty(notes = "新用户累计充值次数成本 = 消耗/新用户累计充值次数")
     private BigDecimal newUserRechargeCountCost;
+
+    /**
+     * 首日创角人数
+     */
+    @ApiModelProperty(value = "首日创角人数")
+    private Long firstRoleNum;
+
+    /**
+     * 新用户累计创角人数
+     */
+    @ApiModelProperty(value = "新用户累计创角人数")
+    private Long newUserTotalRoleNum;
+
+    /**
+     * 创角人数
+     */
+    @ApiModelProperty(value = "创角人数")
+    private Long roleNum;
 }

+ 18 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/GamePromoteDayVO.java

@@ -554,4 +554,22 @@ public class GamePromoteDayVO {
 
     @ApiModelProperty(notes = "单日付费100+成本")
     private String hundredUserNumCost;
+
+    /**
+     * 首日创角人数
+     */
+    @ApiModelProperty(value = "首日创角人数")
+    private Long firstRoleNum;
+
+    /**
+     * 新用户累计创角人数
+     */
+    @ApiModelProperty(value = "新用户累计创角人数")
+    private Long newUserTotalRoleNum;
+
+    /**
+     * 创角人数
+     */
+    @ApiModelProperty(value = "创角人数")
+    private Long roleNum;
 }

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

@@ -551,4 +551,22 @@ public class GamePromoteTotalSumVO {
 
     @ApiModelProperty(notes = "新用户累计充值次数成本 = 消耗/新用户累计充值次数")
     private BigDecimal newUserRechargeCountCost;
+
+    /**
+     * 首日创角人数
+     */
+    @ApiModelProperty(value = "首日创角人数")
+    private Long firstRoleNum;
+
+    /**
+     * 新用户累计创角人数
+     */
+    @ApiModelProperty(value = "新用户累计创角人数")
+    private Long newUserTotalRoleNum;
+
+    /**
+     * 创角人数
+     */
+    @ApiModelProperty(value = "创角人数")
+    private Long roleNum;
 }

+ 18 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/GamePromoteTotalVO.java

@@ -583,4 +583,22 @@ public class GamePromoteTotalVO {
 
     @ApiModelProperty(notes = "新用户累计充值次数成本 = 消耗/新用户累计充值次数")
     private BigDecimal newUserRechargeCountCost;
+
+    /**
+     * 首日创角人数
+     */
+    @ApiModelProperty(value = "首日创角人数")
+    private Long firstRoleNum;
+
+    /**
+     * 新用户累计创角人数
+     */
+    @ApiModelProperty(value = "新用户累计创角人数")
+    private Long newUserTotalRoleNum;
+
+    /**
+     * 创角人数
+     */
+    @ApiModelProperty(value = "创角人数")
+    private Long roleNum;
 }

+ 64 - 12
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/AccountAgentDayServiceImpl.java

@@ -434,6 +434,21 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
                     group by user_id) a
                 WHERE a.repeatNum > 1
                 """);
+
+        Sql roleUserNum = Sqls.fetchLong("""
+                select
+                	count(DISTINCT role_user_id)
+                from
+                	dw_create_role_detail
+                where
+                    source_system = @sourceSystem
+                    and user_agent_id = @agentId
+                    and user_account_id = @accountId
+                    and DATE(role_create_time) >= @rechargeBeginDay
+                    and DATE(role_create_time) <= @rechargeEndDay
+                    and user_dt >= @costBeginDay
+                    and user_dt <= @costEndDay
+                """);
         //循环总数据的每条数据
         List<GamePromoteTotalVO> hasRechargeDayList = list.stream().map(item -> {
             showSql.setParam("sourceSystem", item.getSourceSystem());
@@ -472,6 +487,12 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
             List<String> dayNList = sqlDayN.getList(String.class);
             DayN dayN = null;
             //ads_dayn_amount存在充值数据
+            newUserNumMap.put("accountId", item.getAccountId());
+            newUserNumMap.put("agentId", item.getAgentId());
+            newUserNumMap.put("sourceSystem", item.getSourceSystem());
+            roleUserNum.setParams(newUserNumMap);
+            dao.execute(roleUserNum);
+            Long roleUserNumLong = roleUserNum.getLong();
             if (!CollectionUtils.isEmpty(dayNList)) {
                 Gson gson = new Gson();
                 List<Map<String, String>> jsonList = gson.fromJson(dayNList.toString(), ArrayList.class);
@@ -496,9 +517,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
                     }
                 }
 
-                newUserNumMap.put("accountId", item.getAccountId());
-                newUserNumMap.put("agentId", item.getAgentId());
-                newUserNumMap.put("sourceSystem", item.getSourceSystem());
+
                 newUserNum.setParams(newUserNumMap);
                 dao.execute(newUserNum);
                 Long newUserNumLong = newUserNum.getLong();
@@ -516,6 +535,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
                             .build();
                 }
             }
+            item.setRoleNum(roleUserNumLong);
             //充值时间范围内存在充值数据
             if (null != dayN) {
                 item.setUserRechargeMoney(dayN.getRechargeMoney());
@@ -816,7 +836,23 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
                     group by user_id) a
                 WHERE a.repeatNum > 1
                 """);
+
+        Sql roleUserNum = Sqls.fetchLong("""
+                select
+                	count(DISTINCT role_user_id)
+                from
+                	dw_create_role_detail
+                where
+                    source_system = @sourceSystem
+                    and user_agent_id = @agentId
+                    and user_account_id = @accountId
+                    and DATE(role_create_time) >= @rechargeBeginDay
+                    and DATE(role_create_time) <= @rechargeEndDay
+                    and user_dt >= @costBeginDay
+                    and user_dt <= @costEndDay
+                """);
         AtomicReference<Long> showRechargeUserNum = new AtomicReference<>(0L);
+        AtomicReference<Long> roleUserNumLong = new AtomicReference<>(0L);
         DayN dayNTotal = agentAccountList.stream().map(item -> {
             showRechargeUserSql.setParam("sourceSystem", item.getSourceSystem());
             showRechargeUserSql.setParam("agentId", item.getAgentId());
@@ -831,6 +867,14 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
             dao.execute(sqlDayN);
             List<String> dayNList = sqlDayN.getList(String.class);
             DayN dayN = null;
+
+            newUserNumMap.put("accountId", item.getAccountId());
+            newUserNumMap.put("agentId", item.getAgentId());
+            newUserNumMap.put("sourceSystem", item.getSourceSystem());
+
+            roleUserNum.setParams(newUserNumMap);
+            dao.execute(roleUserNum);
+            roleUserNumLong.set(roleUserNumLong.get() + roleUserNum.getLong());
             //ads_dayn_amount存在充值数据
             if (!CollectionUtils.isEmpty(dayNList)) {
                 Gson gson = new Gson();
@@ -856,9 +900,6 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
                     }
                 }
                 if (!resultMap.isEmpty() && !resultMap.get("dayN").isEmpty()) {
-                    newUserNumMap.put("accountId", item.getAccountId());
-                    newUserNumMap.put("agentId", item.getAgentId());
-                    newUserNumMap.put("sourceSystem", item.getSourceSystem());
                     newUserNum.setParams(newUserNumMap);
                     dao.execute(newUserNum);
                     Long newUserNumLong = newUserNum.getLong();
@@ -885,6 +926,7 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
             return accumulator;
         }).orElse(new DayN());
 
+        gamePromoteTotalSumVO.setRoleNum(roleUserNumLong.get());
         gamePromoteTotalSumVO.setShowRechargeUser(showRechargeUserNum.get());
         gamePromoteTotalSumVO.setShowRechargeArpu(gamePromoteTotalSumVO.getShowRechargeUser() == 0 ? BigDecimal.ZERO :
                 gamePromoteTotalSumVO.getShowRechargeMoney().divide(new BigDecimal(gamePromoteTotalSumVO.getShowRechargeUser()), 4, RoundingMode.DOWN));
@@ -1182,7 +1224,10 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
                 	round(if(amount_count > 0, cost / amount_count, 0), 4) as show_recharge_count_cost,
                 	round(if(new_user_total_amount_count > 0, cost / new_user_total_amount_count, 0), 4) as new_user_recharge_count_cost,
                 	hundred_user_num,
-                	hundred_user_num_cost
+                	hundred_user_num_cost,
+                	first_role_num,
+                	new_user_total_role_num,
+                	role_num
                 from
                 	ads_account_agent_day
                 """;
@@ -1284,9 +1329,12 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
                     round(if(sum(amount_count) > 0, sum(cost) / sum(amount_count), 0), 4) as show_recharge_count_cost,
                     round(if(sum(new_user_total_amount_count) > 0, sum(cost) / sum(new_user_total_amount_count), 0), 4) as new_user_recharge_count_cost,
                     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
-                        from
-                        	ads_account_agent_day
+                    round(if(sum(hundred_user_num) > 0, sum(cost) / sum(hundred_user_num), 0), 4) as hundred_user_num_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
+                    from
+                    ads_account_agent_day
                         """;
     }
 
@@ -1407,7 +1455,9 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
                 	round(if(sum(first_new_user_amount_count) > 0, sum(cost) / sum(first_new_user_amount_count), 0), 4) as first_recharge_count_cost,
                 	round(if(sum(new_user_total_amount_count) > 0, sum(cost) / sum(new_user_total_amount_count), 0), 4) as new_user_recharge_count_cost,
                 	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), 4) as hundred_user_num_cost,
+                	sum(first_role_num) as first_role_num,
+                    sum(new_user_total_role_num) as new_user_total_role_num
                 from
                 	ads_account_agent_day a
                 """;
@@ -1499,7 +1549,9 @@ public class AccountAgentDayServiceImpl implements IAccountAgentDayService {
                 	round(if(sum(first_new_user_amount_count) > 0, sum(cost) / sum(first_new_user_amount_count), 0), 4) as first_recharge_count_cost,
                 	round(if(sum(new_user_total_amount_count) > 0, sum(cost) / sum(new_user_total_amount_count), 0), 4) as new_user_recharge_count_cost,
                 	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), 4) as hundred_user_num_cost,
+                	sum(first_role_num) as first_role_num,
+                    sum(new_user_total_role_num) as new_user_total_role_num
                 from
                 	ads_account_agent_day a
                 """;