Browse Source

:feat:游戏媒体留存

zhangxianyu 7 months ago
parent
commit
bd0d013190

+ 39 - 6
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/MediaActiveDataDayVO.java

@@ -71,7 +71,7 @@ public class MediaActiveDataDayVO implements Serializable {
      * 注册人数
      */
     @ApiModelProperty(value = "注册人数")
-    private Long registerNum;
+    private Long regNum;
 
     /**
      * 首日新用户充值次数
@@ -95,19 +95,19 @@ public class MediaActiveDataDayVO implements Serializable {
      * 老用户充值次数
      */
     @ApiModelProperty(value = "老用户充值次数")
-    private Long oldAmountCount;
+    private Long oldUserCount;
 
     /**
      * 老用户充值人数
      */
     @ApiModelProperty(value = "老用户充值人数")
-    private Long old_amount_num;
+    private Long oldUserNum;
 
     /**
      * 老用户充值金额
      */
     @ApiModelProperty(value = "老用户充值金额")
-    private BigDecimal old_amount;
+    private BigDecimal oldUserAmount;
 
     /**
      * 账面充值次数
@@ -157,11 +157,44 @@ public class MediaActiveDataDayVO implements Serializable {
     @ApiModelProperty(value = "当天付费率")
     private BigDecimal todayAmountRate;
 
+    /**
+     * 当天付费ARPU
+     */
+    @ApiModelProperty(value = "当天付费ARPU")
+    private BigDecimal todayAmountArpu;
+
+    /**
+     * 账面ARPU
+     */
+    @ApiModelProperty(value = "账面ARPU")
+    private BigDecimal amountArpu;
+
+    /**
+     * 首日付费ARPU
+     */
+    @ApiModelProperty(value = "首日付费ARPU")
+    private BigDecimal firstAmountArpu;
+
+    /**
+     * 账面客单价
+     */
+    @ApiModelProperty(value = "账面客单价")
+    private BigDecimal avgAmount;
+
+    @ApiModelProperty(value = "总回收率 = 新用户累计充值金额 / 消耗")
+    private BigDecimal totalRoi;
+
+    /**
+     * 新增注册ARPU
+     */
+    @ApiModelProperty(value = "新增注册ARPU")
+    private BigDecimal regUserArpu;
+
     /**
      * 新用户付费比
      */
     @ApiModelProperty(value = "新用户付费比")
-    private BigDecimal newUserAmountRate;
+    private BigDecimal newUserRate;
 
     /**
      * 首日客单价
@@ -212,7 +245,7 @@ public class MediaActiveDataDayVO implements Serializable {
     private BigDecimal paperArpu;
 
     @ApiModelProperty(value = "注册成本 = 消耗 / 注册人数")
-    private BigDecimal registerCost;
+    private BigDecimal regCost;
 
     @ApiModelProperty(value = "当日回收率")
     private BigDecimal todayRoi;

+ 30 - 19
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/IActiveDataServiceImpl.java

@@ -65,7 +65,7 @@ public class IActiveDataServiceImpl implements IActiveDataService {
                     continue;
                 }
                 fieldMap.put(field.getName(), field);
-                if (field.getType() == MediaActiveDataDayVO.class) {
+                if (field.getType() == ActiveDataTrendVO.class) {
                     //存储所有类型为ActiveDataTrendVO属性的映射 以Trend为结尾的
                     dayNFieldList.add(field);
                 }
@@ -411,9 +411,9 @@ public class IActiveDataServiceImpl implements IActiveDataService {
 
     @Override
     public Page<MediaActiveDataDayVO> getMediaActiveDataDay(MediaActiveDataDayDTO dto) {
-//        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
-//        List<Long> userGameIds = dto.getGameId() == null ? poerInfo.second : dto.getGameId();
-        List<Long> userGameIds = null;
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> userGameIds = dto.getGameId() == null ? poerInfo.second : dto.getGameId();
+//        List<Long> userGameIds = null;
         //默认查询的字段及表名
         String gameColumn = "game_id";
         String classifyColumn = "game_classify";
@@ -537,13 +537,13 @@ public class IActiveDataServiceImpl implements IActiveDataService {
                                        account_type,
                                        source_system,
                                        cost,
-                                       register_num,
+                                       register_num as reg_num,
                                        first_new_user_amount_count,
                                        first_new_user_amount_num,
                                        first_new_user_amount,
-                                       old_amount_count,
-                                       old_amount_num,
-                                       old_amount,
+                                       old_amount_count as old_user_count,
+                                       old_amount_num as old_user_num,
+                                       old_amount as old_user_amount,
                                        amount_count,
                                        amount_num,
                                        amount,
@@ -554,7 +554,7 @@ public class IActiveDataServiceImpl implements IActiveDataService {
                                        first_roi,
                                        first_amount_rate,
                                        today_amount_rate,
-                                       new_user_amount_rate,
+                                         new_user_amount_rate as new_user_rate
                                        first_avg_amount,
                                        today_avg_amount,
                                        paper_avg,
@@ -564,13 +564,18 @@ public class IActiveDataServiceImpl implements IActiveDataService {
                                        today_arpu,
                                        paper_arpu,
                                        first_amount_cost as first_new_user_recharge_cost,
-                                       register_cost,
+                                       register_cost as reg_cost,
                                        hundred_user_num,
                                        hundred_user_num_cost,
                                        today_amount_cost,
                                        first_role_num,
                                        role_num,
                                        new_user_total_role_num,
+                                        round(if(amount_count > 0, amount / amount_count, 0), 2)                    avg_amount,
+                                         round(if(first_new_user_amount_num > 0, first_new_user_amount / first_new_user_amount_num, 0),2) first_amount_arpu,
+                                        round(if(amount_num > 0, amount / amount_num, 0), 2)                        amount_arpu,
+                                        round(if(register_num > 0, new_user_total_amount / register_num, 0), 2)     reg_user_arpu,
+                                        round(if(cost > 0, new_user_total_amount / cost, 0), 4)                     total_roi,
                                        round(IF(first_role_num > 0, cost / first_role_num, 0), 2) first_role_num_cost,
                                        round(IF(role_num > 0, cost / role_num, 0), 2) role_num_cost,
                                        round(IF(new_user_total_role_num >0, cost / new_user_total_role_num, 0), 2) new_user_total_role_num_cost,
@@ -708,13 +713,13 @@ public class IActiveDataServiceImpl implements IActiveDataService {
                                        game_classify,
                                        source_system,
                                        cost,
-                                       register_num,
+                                       register_num as reg_num,
                                        first_new_user_amount_count,
                                        first_new_user_amount_num,
                                        first_new_user_amount,
-                                       old_amount_count,
-                                       old_amount_num,
-                                       old_amount,
+                                         old_amount_count as old_user_count,
+                                         old_amount_num as old_user_num,
+                                         old_amount as old_user_amount,
                                        amount_count,
                                        amount_num,
                                        amount,
@@ -725,7 +730,7 @@ public class IActiveDataServiceImpl implements IActiveDataService {
                                        first_roi,
                                        first_amount_rate,
                                        today_amount_rate,
-                                       new_user_amount_rate,
+                                       new_user_amount_rate as new_user_rate,
                                        first_avg_amount,
                                        today_avg_amount,
                                        paper_avg,
@@ -735,13 +740,19 @@ public class IActiveDataServiceImpl implements IActiveDataService {
                                        today_arpu,
                                        paper_arpu,
                                        first_amount_cost as first_new_user_recharge_cost,
-                                       register_cost,
+                                        register_cost as reg_cost,
                                        hundred_user_num,
                                        hundred_user_num_cost,
                                        today_amount_cost,
                                        first_role_num,
                                        role_num,
                                        new_user_total_role_num,
+                                        round(if(amount_count > 0, amount / amount_count, 0), 2)                    avg_amount,
+                                         round(if(first_new_user_amount_num > 0, first_new_user_amount / first_new_user_amount_num, 0),2) first_amount_arpu,
+                                        round(if(amount_num > 0, amount / amount_num, 0), 2)                        amount_arpu,
+                                        round(if(new_user_total_amount_num > 0, new_user_total_amount /new_user_total_amount_num, 0),2)   today_amount_arpu,
+                                        round(if(register_num > 0, new_user_total_amount / register_num, 0), 2)     reg_user_arpu,
+                                        round(if(cost > 0, new_user_total_amount / cost, 0), 4)                     total_roi,
                                        round(IF(first_role_num > 0, cost / first_role_num, 0), 2) first_role_num_cost,
                                        round(IF(role_num > 0, cost / role_num, 0), 2) role_num_cost,
                                        round(IF(new_user_total_role_num >0, cost / new_user_total_role_num, 0), 2) new_user_total_role_num_cost,
@@ -867,9 +878,9 @@ public class IActiveDataServiceImpl implements IActiveDataService {
 
     @Override
     public MediaActiveDataTotalVO getMediaActiveDataTotal(MediaActiveDataDayDTO dto) {
-//        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
-//        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : dto.getGameId();
-        List<Long> gameIds = null;
+        com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : dto.getGameId();
+//        List<Long> gameIds = null;
 
         //默认查询字段
         String gameColumn = "game_id";