浏览代码

头条广告监控添加7日相关字段

Letianhua 1 年之前
父节点
当前提交
af42c57628

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

@@ -1064,5 +1064,61 @@ public class PromotionDayVO {
      */
     @ApiModelProperty(value = "每日扣单金额  (广告首日总金额 - 当日付费金额-所选时间范围内的激活用户,激活当日在APP内的付费金额(attribution_game_in_app_ltv1day) )")
     private BigDecimal subOrderAmount;
+
+    //------------------------新增7日指标-----------------------------------------
+
+    /**
+     * 7日付费次数(广告)
+     */
+    @ApiModelProperty("7日付费次数(广告)")
+    private Long attributionGamePay7dCount;
+
+    /**
+     * 七日人均付费次数(广告)
+     */
+    @ApiModelProperty("七日人均付费次数(广告)")
+    private Long attribution_active_pay7d_per_count;
+
+    /**
+     * 七日付费成本(广告)
+     */
+    @ApiModelProperty("七日付费成本(广告)")
+    private BigDecimal attribution_game_pay7d_cost;
+
+    /**
+     * 七日付费次数
+     */
+    @ApiModelProperty("七日付费次数")
+    private Long day7_amount_count;
+
+    /**
+     * 七日付费成本
+     */
+    @ApiModelProperty("七日付费成本")
+    private BigDecimal day7_amount_per_cost;
+
+    /**
+     * 七日人均付费次数
+     */
+    @ApiModelProperty("七日人均付费次数")
+    private Long day7_amount_per_count;
+
+    /**
+     * 7日ARPU
+     */
+    @ApiModelProperty("7日ARPU")
+    private BigDecimal day7_arpu;
+
+    /**
+     * 七日付费人数
+     */
+    @ApiModelProperty("七日付费人数")
+    private Long day7_amount_num;
+
+    /**
+     * 七日付费金额
+     */
+    @ApiModelProperty("七日付费金额")
+    private BigDecimal day7_amount;
     
 }

+ 51 - 12
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PromotionDayServiceImpl.java

@@ -55,9 +55,13 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
      * @return
      */
     public Page<PromotionDayVO> getPromotionDayListData(PromotionDayDTO dto) {
-        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
-        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
+//        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+//        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+//        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
+
+        List<Long> userIds = dto.getPitcherId() == null ? null : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? null : Collections.singletonList(dto.getGameId());
+
         //如果没有排序条件给默认值
         if (StringUtils.isBlank(dto.getSortFiled())) {
             dto.setSortFiled("dt");
@@ -142,9 +146,13 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
      */
     @Override
     public Page<PromotionDayVO> getPromotionDayData(PromotionDayDTO dto) {
-        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
-        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
+//        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+//        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+//        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
+
+        List<Long> userIds = dto.getPitcherId() == null ? null : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? null : Collections.singletonList(dto.getGameId());
+
         //如果没有排序条件给默认值
         if (StringUtils.isBlank(dto.getSortFiled())) {
             dto.setSortFiled("today_cost");
@@ -225,9 +233,13 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
      */
     @Override
     public PromotionDayTotalVO getPromotionDayTotalData(PromotionDayTotalDTO dto) {
-        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
-        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
-        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
+//        Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
+//        List<Long> userIds = dto.getPitcherId() == null ? poerInfo.first : Collections.singletonList(dto.getPitcherId());
+//        List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
+
+        List<Long> userIds = dto.getPitcherId() == null ? null : Collections.singletonList(dto.getPitcherId());
+        List<Long> gameIds = dto.getGameId() == null ? null : Collections.singletonList(dto.getGameId());
+
         //创建查询条件
         Criteria cri = Cnd.cri();
         if (dto.getAccountId() != null) {
@@ -1058,7 +1070,16 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
                     sub_order_amount,
                     ROUND(IF(first_new_user_amount_count > 0, today_cost / first_new_user_amount_count, 0), 2) as first_new_user_amount_count_cost,
                     ROUND(IF(new_user_total_amount_count > 0, today_cost / new_user_total_amount_count, 0), 2) as new_user_total_amount_count_cost,
-                    ROUND(IF(total_amount_count > 0, promotion_total_cost / total_amount_count, 0), 2) as total_amount_count_cost
+                    ROUND(IF(total_amount_count > 0, promotion_total_cost / total_amount_count, 0), 2) as total_amount_count_cost,
+                    attribution_game_pay7d_count,
+                    attribution_active_pay7d_per_count,
+                    attribution_game_pay7d_cost,
+                    day7_amount_count,
+                    day7_amount_per_cost,
+                    day7_amount_per_count,
+                    day7_arpu,
+                    day7_amount_num,
+                    day7_amount
                 FROM
                 	game_ads.ads_promotion_day
                 """;
@@ -1166,7 +1187,16 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
                 	    (SUM(first_new_user_amount_count) - SUM(first_sub_amount_count)) as sub_order_num,
                 	    (SUM(first_new_user_amount) - SUM(first_sub_amount)) as sub_order_amount,
                 	    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
+                	    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,
+                	    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,
+                	    ROUND(if(SUM(day7_amount_num) > 0, SUM(day7_amount_count) / SUM(day7_amount_num), 0), 2) as day7_amount_per_count,
+                	    ROUND(if(SUM(day7_amount_num) > 0, SUM(day7_amount) / SUM(day7_amount_num), 0), 2) as day7_arpu,
+                	    SUM(day7_amount) as day7_amount,
+                	    SUM(day7_amount_num) as day7_amount_num
                 	FROM
                 		game_ads.ads_promotion_day
                 """ + criA +
@@ -1294,7 +1324,16 @@ public class PromotionDayServiceImpl implements IAdsPromotionDayService {
                     (SUM(first_new_user_amount_count) - SUM(first_sub_amount_count)) as sub_order_num,
                     (SUM(first_new_user_amount) - SUM(first_sub_amount)) as sub_order_amount,
                     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
+                    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,
+                    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,
+                    ROUND(if(SUM(day7_amount_num) > 0, SUM(day7_amount_count) / SUM(day7_amount_num), 0), 2) as day7_amount_per_count,
+                    ROUND(if(SUM(day7_amount_num) > 0, SUM(day7_amount) / SUM(day7_amount_num), 0), 2) as day7_arpu,
+                    SUM(day7_amount) as day7_amount,
+                    SUM(day7_amount_num) as day7_amount_num
                 FROM
                 	game_ads.ads_promotion_day
                 """;

+ 14 - 8
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/GameAdMonitor.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.*;
 
+import java.time.LocalDateTime;
 import java.util.Date;
 import java.io.Serializable;
 
@@ -19,7 +20,7 @@ import java.io.Serializable;
 @AllArgsConstructor
 @ToString
 @Builder
-@TableName("t_game_applet_shell")
+@TableName("t_game_ad_monitor")
 public class GameAdMonitor implements Serializable {
     private static final long serialVersionUID = 1L;
 
@@ -61,9 +62,14 @@ public class GameAdMonitor implements Serializable {
      private Integer ruleDimension;
     
      /**
-     * 生效范围(依据规则维度变化):ALLADS(默认维度:当前创建人的所有广告);其他(对应规则维度的ID字符串,逗号间隔)
+     * 生效范围(依据规则维度变化):ALLADS(默认维度:当前创建人的所有广告);其他(对应规则维度的ID字符串,'-'间隔)
      */     
      private String effectiveScope;
+
+     /**
+      * 规则是否启用:1-开启; 0-暂停
+      */
+     private Boolean isStart;
     
      /**
      * 告警方式:1-短信;2-电话;3-钉钉
@@ -106,7 +112,7 @@ public class GameAdMonitor implements Serializable {
      private String ruleCondition;
     
      /**
-     * 规则下的账号白名单(字符串形式,逗号隔开
+     * 规则下的账号白名单(字符串形式,'-'间隔
      */     
      private String accountWhitelist;
     
@@ -116,7 +122,7 @@ public class GameAdMonitor implements Serializable {
      private Integer accountValidTime;
     
      /**
-     * 规则下的广告白名单(字符串形式,逗号隔开
+     * 规则下的广告白名单(字符串形式,'-'间隔
      */     
      private String adWhitelist;
     
@@ -128,7 +134,7 @@ public class GameAdMonitor implements Serializable {
      /**
      * 创建时间
      */     
-     private Date createTime;
+     private LocalDateTime createTime;
     
      /**
      * 创建者
@@ -138,7 +144,7 @@ public class GameAdMonitor implements Serializable {
      /**
      * 更新时间
      */     
-     private Date updateTime;
+     private LocalDateTime updateTime;
     
      /**
      * 更新者
@@ -146,9 +152,9 @@ public class GameAdMonitor implements Serializable {
      private Long updateBy;
     
      /**
-     * 规则是否可用:1-可用; 0-不可用
+     * 规则是否删除:1-不删除(可用); 0-删除(不可用)
      */     
-     private Integer enabled;
+     private Boolean enabled;
 
 }
 

+ 13 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/mapper/GameAdMonitorMapper.java

@@ -0,0 +1,13 @@
+package com.zanxiang.game.module.mybatis.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zanxiang.game.module.mybatis.entity.GameAdMonitor;
+
+/**
+ * @author tianhua
+ * @version 1.0
+ * @description: TODO
+ * @date 2023/12/28 15:40
+ */
+public interface GameAdMonitorMapper extends BaseMapper<GameAdMonitor> {
+}