Browse Source

修改内容:空值处理

lth 1 year ago
parent
commit
2f7b400fea

+ 73 - 9
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/GameDataTotalTotalVO.java

@@ -134,16 +134,19 @@ public class GameDataTotalTotalVO {
     private BigDecimal buyNewUserTotalAmount;
 
     /**
-     * 首日付费率(买量)
+     * 首日Roi(买量)
      */
-    @ApiModelProperty(value = "首日付费率(买量)")
+    @ApiModelProperty(value = "首日Roi(买量)")
     private BigDecimal buyFirstRoi;
 
+    @ApiModelProperty(value = "首日付费率(买量)")
+    private BigDecimal buyFirstAmountRate;
+
     /**
      * 当天付费率(买量)
      */
     @ApiModelProperty(value = "当天付费率(买量)")
-    private BigDecimal buyTodayRoi;
+    private BigDecimal buyTodayAmountRate;
 
     /**
      * 新用户付费率(买量)
@@ -326,16 +329,19 @@ public class GameDataTotalTotalVO {
     private BigDecimal natureNewUserTotalAmount;
 
     /**
-     * 首日付费率(自然量)
+     * 首日Roi(自然量)
      */
-    @ApiModelProperty(value = "首日付费率(自然量)")
+    @ApiModelProperty(value = "首日Roi(自然量)")
     private BigDecimal natureFirstRoi;
 
+    @ApiModelProperty(value = "首日付费率")
+    private BigDecimal natureFirstAmountRate;
+
     /**
      * 当天付费率(自然量)
      */
     @ApiModelProperty(value = "当天付费率(自然量)")
-    private BigDecimal natureTodayRoi;
+    private BigDecimal natureTodayAmountRate;
 
     /**
      * 新用户付费率(自然量)
@@ -518,16 +524,19 @@ public class GameDataTotalTotalVO {
     private BigDecimal newUserTotalAmount;
 
     /**
-     * 首日付费率(总量)
+     * 首日Roi(总量)
      */
-    @ApiModelProperty(value = "首日付费率(总量)")
+    @ApiModelProperty(value = "首日Roi(总量)")
     private BigDecimal firstRoi;
 
+    @ApiModelProperty(value = "首日付费率")
+    private BigDecimal firstAmountRate;
+
     /**
      * 当天付费率(总量)
      */
     @ApiModelProperty(value = "当天付费率(总量)")
-    private BigDecimal todayRoi;
+    private BigDecimal todayAmountRate;
 
     /**
      * 新用户付费率(总量)
@@ -619,4 +628,59 @@ public class GameDataTotalTotalVO {
     @ApiModelProperty(value = "新用户付费ARPU(总量)")
     private BigDecimal newUserAmountArpu;
 
+
+    @ApiModelProperty(value = "注册成本(总量) = 消耗 / 注册人数")
+    private BigDecimal regCost;
+
+    @ApiModelProperty(value = "总回收率(总量) = 新用户累计充值金额 / 消耗")
+    private BigDecimal totalRoi;
+
+    @ApiModelProperty(value = "首日充值成本(总量) = 消耗 / 首日新用户充值人数")
+    private BigDecimal firstNewUserRechargeCost;
+
+    @ApiModelProperty(value = "总充值成本(总量) = 消耗 / 新用户累计充值人数")
+    private BigDecimal totalRechargeCost;
+
+    @ApiModelProperty(value = "新用户回收率(总量) = 新用户充值今日 / 消耗")
+    private BigDecimal newUserRechargeRate;
+
+    @ApiModelProperty(value = "新用户充值成本(总量) = 消耗 / 新用户充值人数")
+    private BigDecimal newUserRechargeCost;
+
+    @ApiModelProperty(value = "注册成本(买量) = 消耗 / 注册人数")
+    private BigDecimal buyRegCost;
+
+    @ApiModelProperty(value = "总回收率(买量) = 新用户累计充值金额 / 消耗")
+    private BigDecimal buyTotalRoi;
+
+    @ApiModelProperty(value = "首日充值成本(买量) = 消耗 / 首日新用户充值人数")
+    private BigDecimal buyFirstNewUserRechargeCost;
+
+    @ApiModelProperty(value = "总充值成本(买量) = 消耗 / 新用户累计充值人数")
+    private BigDecimal buyTotalRechargeCost;
+
+    @ApiModelProperty(value = "新用户回收率(买量) = 新用户充值今日 / 消耗")
+    private BigDecimal buyNewUserRechargeRate;
+
+    @ApiModelProperty(value = "新用户充值成本(买量) = 消耗 / 新用户充值人数")
+    private BigDecimal buyNewUserRechargeCost;
+
+    @ApiModelProperty(value = "注册成本(自然量) = 消耗 / 注册人数")
+    private BigDecimal natureRegCost;
+
+    @ApiModelProperty(value = "总回收率(自然量) = 新用户累计充值金额 / 消耗")
+    private BigDecimal natureTotalRoi;
+
+    @ApiModelProperty(value = "首日充值成本(自然量) = 消耗 / 首日新用户充值人数")
+    private BigDecimal natureFirstNewUserRechargeCost;
+
+    @ApiModelProperty(value = "总充值成本(自然量) = 消耗 / 新用户累计充值人数")
+    private BigDecimal natureTotalRechargeCost;
+
+    @ApiModelProperty(value = "新用户回收率(自然量) = 新用户充值今日 / 消耗")
+    private BigDecimal natureNewUserRechargeRate;
+
+    @ApiModelProperty(value = "新用户充值成本(自然量) = 消耗 / 新用户充值人数")
+    private BigDecimal natureNewUserRechargeCost;
+
 }

+ 48 - 42
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameDataServiceImpl.java

@@ -231,7 +231,9 @@ public class GameDataServiceImpl implements IGameDataService {
         dao.execute(gameDataDayTotalsql);
         //得到每日总计对象
         GameDataDayTotalVO vo = gameDataDayTotalsql.getObject(GameDataDayTotalVO.class);
-        formatDayNTotal(vo);
+        if (vo.getAmountD1() != null) {
+            formatDayNTotal(vo);
+        }
         return vo;
     }
 
@@ -469,6 +471,10 @@ public class GameDataServiceImpl implements IGameDataService {
      * @return 返回给前端额数据
      */
     public GameDataTotalTotalVO getGameDataTotalTotal(GameDataTotalTotalDTO dto) {
+
+
+
+
         return null;
     }
 
@@ -983,7 +989,7 @@ public class GameDataServiceImpl implements IGameDataService {
                             .back(d1ToDNTotalAmount.divide(vo.getCost(), 4, RoundingMode.HALF_UP))
                             .multiples(d1ToDNTotalAmount.divide(buyAmountD1, 4, RoundingMode.HALF_UP))
                             .build());
-                } else if (temps.equals("nature")) {
+                } else if (temps[3].equals("nature")) {
                     dayNTotalFieldMap.getT2().set(vo, RechargeTrendVO.builder()
                             .rechargeMoney(dNAmount)
                             .rechargeUserCount(Long.valueOf(temps[2]))
@@ -1390,11 +1396,11 @@ public class GameDataServiceImpl implements IGameDataService {
     private String gameDataDayTotalSql() {
         return """
                 SELECT
-                SUM(cost) cost,
+                IFNULL(SUM(cost), 0) cost,
                                 
-                SUM(buy_reg_num) buy_reg_num,
-                SUM(nature_reg_num) nature_reg_num,
-                SUM(reg_num) reg_num,
+                IFNULL(SUM(buy_reg_num), 0) buy_reg_num,
+                IFNULL(SUM(nature_reg_num), 0) nature_reg_num,
+                IFNULL(SUM(reg_num), 0) reg_num,
                 
                 """
                 + amountDay("buy_") +
@@ -1405,18 +1411,18 @@ public class GameDataServiceImpl implements IGameDataService {
                 CONCAT(SUM(CAST(SPLIT_PART(buy_amount_m6 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_m6, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_m6, '/', 2) AS BIGINT)),'/buy') AS buy_amount_m6,
                 CONCAT(SUM(CAST(SPLIT_PART(buy_amount_y1 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_m6, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_y1, '/', 2) AS BIGINT)),'/buy') AS buy_amount_y1,
                 CONCAT(SUM(CAST(SPLIT_PART(buy_amount_sum , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_sum, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(buy_amount_sum, '/', 2) AS BIGINT)),'/buy') AS buy_amount_sum,
-                SUM(buy_first_new_user_amount_count) buy_first_new_user_amount_count,
-                SUM(buy_first_new_user_amount_num) buy_first_new_user_amount_num,
-                SUM(buy_first_new_user_amount) buy_first_new_user_amount,
-                SUM(buy_old_user_count) buy_old_user_count,
-                SUM(buy_old_user_num) buy_old_user_num,
-                SUM(buy_old_user_amount) buy_old_user_amount,
-                SUM(buy_amount_count) buy_amount_count,
-                SUM(buy_amount_num) buy_amount_num,
-                SUM(buy_amount) buy_amount,
-                SUM(buy_new_user_total_amount_count) buy_new_user_total_amount_count,
-                SUM(buy_new_user_total_amount_num) buy_new_user_total_amount_num,
-                SUM(buy_new_user_total_amount) buy_new_user_total_amount,
+                IFNULL(SUM(buy_first_new_user_amount_count), 0) buy_first_new_user_amount_count,
+                IFNULL(SUM(buy_first_new_user_amount_num), 0) buy_first_new_user_amount_num,
+                IFNULL(SUM(buy_first_new_user_amount), 0) buy_first_new_user_amount,
+                IFNULL(SUM(buy_old_user_count), 0) buy_old_user_count,
+                IFNULL(SUM(buy_old_user_num), 0) buy_old_user_num,
+                IFNULL(SUM(buy_old_user_amount), 0) buy_old_user_amount,
+                IFNULL(SUM(buy_amount_count), 0) buy_amount_count,
+                IFNULL(SUM(buy_amount_num), 0) buy_amount_num,
+                IFNULL(SUM(buy_amount), 0) buy_amount,
+                IFNULL(SUM(buy_new_user_total_amount_count), 0) buy_new_user_total_amount_count,
+                IFNULL(SUM(buy_new_user_total_amount_num), 0) buy_new_user_total_amount_num,
+                IFNULL(SUM(buy_new_user_total_amount), 0) buy_new_user_total_amount,
                 round(if(SUM(cost) > 0 , SUM(buy_first_new_user_amount) / SUM(cost) ,0), 4) buy_first_roi,
                 round(if(SUM(buy_reg_num) > 0 , SUM(buy_first_new_user_amount_num) / SUM(buy_reg_num) ,0), 4) buy_first_amount_rate,
                 round(if(SUM(buy_reg_num) > 0, SUM(buy_new_user_total_amount_num) / SUM(buy_reg_num), 0) ,4) buy_today_amount_rate,
@@ -1443,18 +1449,18 @@ public class GameDataServiceImpl implements IGameDataService {
                 CONCAT(SUM(CAST(SPLIT_PART(nature_amount_m6 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_m6, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_m6, '/', 2) AS BIGINT)),'/nature') AS nature_amount_m6,
                 CONCAT(SUM(CAST(SPLIT_PART(nature_amount_y1 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_m6, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_y1, '/', 2) AS BIGINT)),'/nature') AS nature_amount_y1,
                 CONCAT(SUM(CAST(SPLIT_PART(nature_amount_sum , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_sum, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(nature_amount_sum, '/', 2) AS BIGINT)),'/nature') AS nature_amount_sum,
-                SUM(nature_first_new_user_amount_count) nature_first_new_user_amount_count,
-                SUM(nature_first_new_user_amount_num) nature_first_new_user_amount_num,
-                SUM(nature_first_new_user_amount) nature_first_new_user_amount,
-                SUM(nature_old_user_count) nature_old_user_count,
-                SUM(nature_old_user_num) nature_old_user_num,
-                SUM(nature_old_user_amount) nature_old_user_amount,
-                SUM(nature_amount_count) nature_amount_count,
-                SUM(nature_amount_num) nature_amount_num,
-                SUM(nature_amount) nature_amount,
-                SUM(nature_new_user_total_amount_count) nature_new_user_total_amount_count,
-                SUM(nature_new_user_total_amount_num) nature_new_user_total_amount_num,
-                SUM(nature_new_user_total_amount) nature_new_user_total_amount,
+                IFNULL(SUM(nature_first_new_user_amount_count), 0) nature_first_new_user_amount_count,
+                IFNULL(SUM(nature_first_new_user_amount_num), 0) nature_first_new_user_amount_num,
+                IFNULL(SUM(nature_first_new_user_amount), 0) nature_first_new_user_amount,
+                IFNULL(SUM(nature_old_user_count), 0) nature_old_user_count,
+                IFNULL(SUM(nature_old_user_num), 0) nature_old_user_num,
+                IFNULL(SUM(nature_old_user_amount), 0) nature_old_user_amount,
+                IFNULL(SUM(nature_amount_count), 0) nature_amount_count,
+                IFNULL(SUM(nature_amount_num), 0) nature_amount_num,
+                IFNULL(SUM(nature_amount), 0) nature_amount,
+                IFNULL(SUM(nature_new_user_total_amount_count), 0) nature_new_user_total_amount_count,
+                IFNULL(SUM(nature_new_user_total_amount_num), 0) nature_new_user_total_amount_num,
+                IFNULL(SUM(nature_new_user_total_amount), 0) nature_new_user_total_amount,
                 round(if(SUM(cost) > 0 , SUM(nature_first_new_user_amount) / SUM(cost) ,0), 4) nature_first_roi,
                 round(if(SUM(nature_reg_num) > 0 , SUM(nature_first_new_user_amount_num) / SUM(nature_reg_num) ,0), 4) nature_first_amount_rate,
                 round(if(SUM(nature_reg_num) > 0, SUM(nature_new_user_total_amount_num) / SUM(nature_reg_num), 0) ,4) nature_today_amount_rate,
@@ -1481,18 +1487,18 @@ public class GameDataServiceImpl implements IGameDataService {
                 CONCAT(SUM(CAST(SPLIT_PART(amount_m6 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_m6, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_m6, '/', 2) AS BIGINT)),'/total') AS amount_m6,
                 CONCAT(SUM(CAST(SPLIT_PART(amount_y1 , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_m6, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_y1, '/', 2) AS BIGINT)),'/total') AS amount_y1,
                 CONCAT(SUM(CAST(SPLIT_PART(amount_sum , '/', 1) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_sum, '/', 6) AS DECIMAL(10, 2))),'/',SUM(CAST(SPLIT_PART(amount_sum, '/', 2) AS BIGINT)),'/total') AS amount_sum,
-                SUM(first_new_user_amount_count) first_new_user_amount_count,
-                SUM(first_new_user_amount_num) first_new_user_amount_num,
-                SUM(first_new_user_amount) first_new_user_amount,
-                SUM(old_user_count) old_user_count,
-                SUM(old_user_num) old_user_num,
-                SUM(old_user_amount) old_user_amount,
-                SUM(amount_count) amount_count,
-                SUM(amount_num) amount_num,
-                SUM(amount) amount,
-                SUM(new_user_total_amount_count) new_user_total_amount_count,
-                SUM(new_user_total_amount_num) new_user_total_amount_num,
-                SUM(new_user_total_amount) new_user_total_amount,
+                IFNULL(SUM(first_new_user_amount_count), 0) first_new_user_amount_count,
+                IFNULL(SUM(first_new_user_amount_num), 0) first_new_user_amount_num,
+                IFNULL(SUM(first_new_user_amount), 0) first_new_user_amount,
+                IFNULL(SUM(old_user_count), 0) old_user_count,
+                IFNULL(SUM(old_user_num), 0) old_user_num,
+                IFNULL(SUM(old_user_amount), 0) old_user_amount,
+                IFNULL(SUM(amount_count), 0) amount_count,
+                IFNULL(SUM(amount_num), 0) amount_num,
+                IFNULL(SUM(amount), 0) amount,
+                IFNULL(SUM(new_user_total_amount_count), 0) new_user_total_amount_count,
+                IFNULL(SUM(new_user_total_amount_num), 0) new_user_total_amount_num,
+                IFNULL(SUM(new_user_total_amount), 0) new_user_total_amount,
                 round(if(SUM(cost) > 0 , SUM(first_new_user_amount) / SUM(cost) ,0), 4) first_roi,
                 round(if(SUM(reg_num) > 0 , SUM(first_new_user_amount_num) / SUM(reg_num) ,0), 4) first_amount_rate,
                 round(if(SUM(reg_num) > 0, SUM(new_user_total_amount_num) / SUM(reg_num), 0) ,4) today_amount_rate,