Prechádzať zdrojové kódy

:fix:
- 解决角色充值排行榜查询发送消息详情时,查询游戏名称不对的问题
- 解决角色充值排行榜小于等于出现数据不对的问题
feat:
- 添加角色充值排行榜2-8天ROI的字段

zhangxianyu 1 rok pred
rodič
commit
0f4b0ddbb1

+ 48 - 1
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/PromotionDayTotalVO.java

@@ -901,7 +901,13 @@ public class PromotionDayTotalVO {
      * 七日人均付费次数(广告)
      */
     @ApiModelProperty("七日人均付费次数(广告)")
-    private Long attributionActivePay7dPerCount;
+    private BigDecimal attributionActivePay7dPerCount;
+
+    /**
+     * 七日首次付费次数(广告)(也就是7日内付费的人数)
+     */
+    @ApiModelProperty("七日首次付费次数(广告)(也就是7日内付费的人数)")
+    private Long firstAttributionGamePay7dCount;
 
     /**
      * 七日付费成本(广告)
@@ -976,4 +982,45 @@ public class PromotionDayTotalVO {
     @ApiModelProperty(value = "至今付费200+用户付费成本")
     private BigDecimal newUserTwoHundredUserNumCost;
 
+
+    /**
+     * 激活后一日付费ROI
+     */
+    @ApiModelProperty(value = "激活后一日付费ROI")
+    private BigDecimal attributionGameInAppRoi2days;
+
+    /**
+     * 激活后二日付费ROI
+     */
+    @ApiModelProperty(value = "激活后二日付费ROI")
+    private BigDecimal attributionGameInAppRoi3days;
+    /**
+     * 激活后三日付费ROI
+     */
+    @ApiModelProperty(value = "激活后三日付费ROI")
+    private BigDecimal attributionGameInAppRoi4days;
+    /**
+     * 激活后四日付费ROI
+     */
+    @ApiModelProperty(value = "激活后四日付费ROI")
+    private BigDecimal attributionGameInAppRoi5days;
+    /**
+     * 激活后五日付费ROI
+     */
+    @ApiModelProperty(value = "激活后五日付费ROI")
+    private BigDecimal attributionGameInAppRoi6days;
+    /**
+     * 激活后六日付费ROI
+     */
+    @ApiModelProperty(value = "激活后六日付费ROI")
+    private BigDecimal attributionGameInAppRoi7days;
+    /**
+     * 激活后七日付费ROI
+     */
+    @ApiModelProperty(value = "激活后七日付费ROI")
+    private BigDecimal attributionGameInAppRoi8days;
+
+
+
+
 }

+ 37 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/PromotionDayVO.java

@@ -1152,5 +1152,42 @@ public class PromotionDayVO {
     @ApiModelProperty(value = "至今付费200+用户付费成本")
     private BigDecimal newUserTwoHundredUserNumCost;
 
+    /**
+     * 激活后一日付费ROI
+     */
+    @ApiModelProperty(value = "激活后一日付费ROI")
+    private BigDecimal attributionGameInAppRoi2days;
+
+    /**
+     * 激活后二日付费ROI
+     */
+    @ApiModelProperty(value = "激活后二日付费ROI")
+    private BigDecimal attributionGameInAppRoi3days;
+    /**
+     * 激活后三日付费ROI
+     */
+    @ApiModelProperty(value = "激活后三日付费ROI")
+    private BigDecimal attributionGameInAppRoi4days;
+    /**
+     * 激活后四日付费ROI
+     */
+    @ApiModelProperty(value = "激活后四日付费ROI")
+    private BigDecimal attributionGameInAppRoi5days;
+    /**
+     * 激活后五日付费ROI
+     */
+    @ApiModelProperty(value = "激活后五日付费ROI")
+    private BigDecimal attributionGameInAppRoi6days;
+    /**
+     * 激活后六日付费ROI
+     */
+    @ApiModelProperty(value = "激活后六日付费ROI")
+    private BigDecimal attributionGameInAppRoi7days;
+    /**
+     * 激活后七日付费ROI
+     */
+    @ApiModelProperty(value = "激活后七日付费ROI")
+    private BigDecimal attributionGameInAppRoi8days;
+
 
 }

+ 28 - 4
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PromotionDayServiceImpl.java

@@ -1076,7 +1076,14 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
                     day7_two_hundred_amount_num,
                     day7_two_hundred_amount_num_cost,
                     new_user_two_hundred_user_num,
-                    new_user_two_hundred_user_num_cost
+                    new_user_two_hundred_user_num_cost,
+                    attribution_game_in_app_roi2days,
+                    attribution_game_in_app_roi3days,
+                    attribution_game_in_app_roi4days,
+                    attribution_game_in_app_roi5days,
+                    attribution_game_in_app_roi6days,
+                    attribution_game_in_app_roi7days,
+                    attribution_game_in_app_roi8days
                 FROM
                 	game_ads.ads_promotion_day
                 """;
@@ -1199,7 +1206,15 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
                      	SUM(day7_two_hundred_amount_num) as day7_two_hundred_amount_num,
                      	SUM(day7_two_hundred_amount_num_cost) as day7_two_hundred_amount_num_cost,
                      	SUM(new_user_two_hundred_user_num) as new_user_two_hundred_user_num,
-                     	SUM(new_user_two_hundred_user_num_cost) as new_user_two_hundred_user_num_cost
+                     	SUM(new_user_two_hundred_user_num_cost) as new_user_two_hundred_user_num_cost,
+                        -- 2-8日的roi
+                        ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv2days)/SUM(today_cost),0),4) as attribution_game_in_app_roi2days,
+                        ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv3days)/SUM(today_cost),0),4) as attribution_game_in_app_roi3days,
+                        ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv4days)/SUM(today_cost),0),4) as attribution_game_in_app_roi4days,
+                        ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv5days)/SUM(today_cost),0),4) as attribution_game_in_app_roi5days,
+                        ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv6days)/SUM(today_cost),0),4) as attribution_game_in_app_roi6days,
+                        ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv7days)/SUM(today_cost),0),4) as attribution_game_in_app_roi7days,
+                        ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv8days)/SUM(today_cost),0),4) as attribution_game_in_app_roi8days
                 	FROM
                 		game_ads.ads_promotion_day
                 """ + criA +
@@ -1329,7 +1344,8 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
                     ROUND(IF(SUM(first_new_user_amount_count) > 0, SUM(today_cost) / SUM(first_new_user_amount_count), 0), 2) as first_new_user_amount_count_cost,
                     ROUND(IF(SUM(new_user_total_amount_count) > 0, SUM(today_cost) / SUM(new_user_total_amount_count), 0), 2) as new_user_total_amount_count_cost,
                     SUM(attribution_game_pay7d_count) as attribution_game_pay7d_count,
-                    SUM(attribution_active_pay7d_per_count) as attribution_active_pay7d_per_count,
+                    SUM(first_attribution_game_pay7d_count) as first_attribution_game_pay7d_count,
+                    ROUND(SUM(attribution_active_pay7d_per_count)/SUM(first_attribution_game_pay7d_count),2) as attribution_active_pay7d_per_count,   -- 总计的人均要用  七日付费次数/七日首次付费次数(也就是付费人数)
                     ROUND(if(SUM(attribution_game_pay7d_count) > 0, SUM(today_cost) / SUM(attribution_game_pay7d_count), 0), 2) as attribution_game_pay7d_cost,
                     SUM(day7_amount_count) as day7_amount_count,
                     ROUND(if(SUM(day7_amount_count) > 0, SUM(today_cost) / SUM(day7_amount_count), 0), 2) as day7_amount_per_cost,
@@ -1342,7 +1358,15 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
                     SUM(day7_two_hundred_amount_num) as day7_two_hundred_amount_num,
                     SUM(day7_two_hundred_amount_num_cost) as day7_two_hundred_amount_num_cost,
                     SUM(new_user_two_hundred_user_num) as new_user_two_hundred_user_num,
-                    SUM(new_user_two_hundred_user_num_cost) as new_user_two_hundred_user_num_cost
+                    SUM(new_user_two_hundred_user_num_cost) as new_user_two_hundred_user_num_cost,
+                     -- 2-8日的roi
+                    ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv2days)/SUM(today_cost),0),4) as attribution_game_in_app_roi2days,
+                    ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv3days)/SUM(today_cost),0),4) as attribution_game_in_app_roi3days,
+                    ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv4days)/SUM(today_cost),0),4) as attribution_game_in_app_roi4days,
+                    ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv5days)/SUM(today_cost),0),4) as attribution_game_in_app_roi5days,
+                    ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv6days)/SUM(today_cost),0),4) as attribution_game_in_app_roi6days,
+                    ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv7days)/SUM(today_cost),0),4) as attribution_game_in_app_roi7days,
+                    ROUND(IF(SUM(today_cost)>0,SUM(attribution_game_in_app_ltv8days)/SUM(today_cost),0),4) as attribution_game_in_app_roi8days
                 FROM
                 	game_ads.ads_promotion_day
                 """;

+ 20 - 11
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/RoleManageServiceImpl.java

@@ -278,12 +278,13 @@ public class RoleManageServiceImpl implements IRoleManageService {
     private Criteria spliceRechargeAmountWithin24h(RoleRechargeRankingDTO dto, Criteria criA) {
         switch (dto.getRechargeAmountWithin24hUnit()) {
             case ">" -> criA.where().andGT("max_amount", dto.getRechargeAmountWithin24h());
-            case ">=" -> criA.where().andGTE("max_amount", dto.getRechargeAmountWithin24h());
-            case "=" -> criA.where().andEquals("max_amount", dto.getRechargeAmountWithin24h());
-            case "<" -> criA.where().andLT("max_amount", dto.getRechargeAmountWithin24h());
-            case "<=" -> criA.where().andLTE("max_amount", dto.getRechargeAmountWithin24h());
+//            case ">=" -> criA.where().andGTE("max_amount", dto.getRechargeAmountWithin24h());
+            //这里用到了array_contains 函数,如果包含则返回1,不包含则返回0
+            case "=" -> criA.where().andEquals("array_contains(role_amount,"+dto.getRechargeAmountWithin24h()+")", 1);
+            case "<" -> criA.where().andLT("min_amount", dto.getRechargeAmountWithin24h());
+//            case "<=" -> criA.where().andLTE("max_amount", dto.getRechargeAmountWithin24h());
             default -> {
-                criA.where().andGTE("max_amount", dto.getRechargeAmountWithin24h());
+                criA.where().andGT("max_amount", dto.getRechargeAmountWithin24h());
             }
         }
         return criA;
@@ -646,7 +647,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
             Criteria cri = Cnd.cri();
             //拼接游戏ID
             cri.where().andInStrList("role_id", roleId);
-            cri.where().andEquals("parent_id", sendMsgResultVo.getGameId());
+            cri.where().andEquals("b.id", sendMsgResultVo.getGameId());
 
             //补齐参数
             Sql sql = Sqls.create(getTaskResultSql() + cri);
@@ -1368,7 +1369,9 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 		j.update_by as update_by, -- 更新者
                 		j.is_delete as is_delete, -- 是否删除 1-删除;0-正常
                 		ara.role_total_amount as role_total_amount, -- 创角24小时内总充值金额
-                		ara.max_amount as max_amount -- 创角24小时内单笔最大充值金额
+                		ara.max_amount as max_amount, -- 创角24小时内单笔最大充值金额
+                		ara.min_amount as min_amount, -- 创角24小时内单笔最小充值金额
+                		ara.role_amount as role_amount -- 角色充值数组
                 	FROM
                 	(
                 		SELECT
@@ -1397,8 +1400,10 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 	    SELECT source_system,
                 	    role_id,
                 	    role_total_amount,
-                	    array_max(role_amount) max_amount 
-                	FROM game_ads.ads_role_amount 
+                	    array_min(role_amount) min_amount,
+                	    array_max(role_amount) max_amount,
+                	    role_amount
+                	FROM game_ads.ads_role_amount
                 	) ara on a.role_id = ara.role_id and a.source_system = ara.source_system
                 	LEFT JOIN (
                 		SELECT
@@ -1777,7 +1782,9 @@ public class RoleManageServiceImpl implements IRoleManageService {
                         j.update_by as update_by, -- 更新者
                         j.is_delete as is_delete, -- 是否删除 1-删除;0-正常
                         ara.role_total_amount as role_total_amount, -- 创角24小时内总充值金额
-                		ara.max_amount as max_amount -- 创角24小时内单笔最大充值金额
+                		ara.max_amount as max_amount, -- 创角24小时内单笔最大充值金额
+                		ara.min_amount as min_amount, -- 创角24小时内单笔最小充值金额
+                		ara.role_amount as role_amount -- 角色充值数组
                     FROM
                     (
                         SELECT
@@ -1807,7 +1814,9 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 	        source_system,
                 	        role_id,
                 	        role_total_amount,
-                	        array_max(role_amount) max_amount 
+                	        array_min(role_amount) min_amount,
+                	        array_max(role_amount) max_amount,
+                	        role_amount
                 	    FROM game_ads.ads_role_amount 
                 	) ara on a.role_id = ara.role_id and a.source_system = ara.source_system
                     LEFT JOIN (