فهرست منبع

Merge remote-tracking branch 'origin/package' into package

bilingfeng 1 سال پیش
والد
کامیت
ffcedfa483

+ 24 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/RoleRechargeRankingDTO.java

@@ -201,4 +201,28 @@ public class RoleRechargeRankingDTO extends BasePage {
     @ApiModelProperty(notes = "玩家操作系统筛选:windows;mac;ios;devtools;android")
     private String os;
 
+
+    /**
+     * 创角24小时内单笔充值金额
+     */
+    @ApiModelProperty(value = "创角24小时内单笔充值金额")
+    private Long rechargeAmountWithin24h;
+
+    /**
+     * 创角24小时内单笔充值金额范围单位
+     */
+    @ApiModelProperty(value = "创角24小时内单笔充值金额范围单位(>=,<=,=,<,>)")
+    private String rechargeAmountWithin24hUnit = ">=";
+
+    /**
+     * 创角24小时以内累计充值金额
+     */
+    @ApiModelProperty(value = "创角24小时以内累计充值金额")
+    private Long rechargeTotalAmountWithin24h;
+
+    /**
+     * 创角24小时以内累计充值金额范围单位
+     */
+    @ApiModelProperty(value = "创角24小时以内累计充值金额范围单位(>=,<=,=,<,>)")
+    private String rechargeTotalAmountWithin24hUnit = ">=";
 }

+ 4 - 15
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/vo/FlowMonitorVO.java

@@ -20,11 +20,7 @@ public class FlowMonitorVO implements Serializable {
      */
     @ApiModelProperty(value = "SDK类型")
     private String sourceSystem;
-    /**
-     * 投手名称
-     */
-    @ApiModelProperty(value = "投手名称")
-    private String pitcherName;
+
 
     /**
      * 消耗开始时间
@@ -112,15 +108,8 @@ public class FlowMonitorVO implements Serializable {
     private Double costCount = 0.0;
 
     /**
-     * 游戏名称
+     * 昨日充值总数
      */
-    @ApiModelProperty(value = "游戏名称")
-    private String gameName;
-
-    /**
-     * 渠道名称
-     */
-    @ApiModelProperty(value = "渠道名称")
-    private String agentName;
-
+    @ApiModelProperty(value = "yesterday_amount")
+    private Double yesterdayAmount = 0.0;
 }

+ 97 - 100
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/GameDataServiceImpl.java

@@ -5325,112 +5325,109 @@ public class GameDataServiceImpl implements IGameDataService {
      */
     public String flowMonitorSql(FlowMonitorDTO dto, Criteria cri, Criteria criCost, String costTable, String orderTable) {
         String gameColumn = "game_id  ";
-        String gameNameColumn = "game_name ";
         if (dto.getGameDimension() != 1) {
             gameColumn = "parent_game_id ";
-            gameNameColumn = "parent_game_name ";
         }
 
         String sql =
-                """
-                        SELECT 
-                              s.source_system,-- SDK类型
-                              s.minDay cost_begin_date, -- 消耗开始时间
-                              s.maxDay cost_end_date, -- 消耗结束时间
-                              s.day as order_date, -- 订单时间
-                              s.ten_amount, -- 10点充值
-                              s.ten_rate, -- 10点环比
-                              IFNULL(s.ten_recovery,0), -- 10点回报率
-                              s.fourteen_amount,  -- 14点充值
-                              s.fourteen_rate, -- 14点环比
-                              IFNULL(s.fourteen_recovery,0), -- 14点回报率  
-                              s.seventeen_amount, -- 17点充值
-                              s.seventeen_rate, -- 17点环比
-                              IFNULL(s.seventeen_recovery,0), -- 17点回报率
-                              s.twentyfour_amount, -- 24点充值
-                              s.twentyfour_rate, -- 24点环比
-                              IFNULL(s.twentyfour_recovery,0), -- 24点回报率
-                              IFNULL(s.costCount,0) as cost_count , -- 消耗总计
-                              s.pitcher_id, -- 投手id
-                              s.pitcher_name, -- 投手名称
-                              s.agent_id,
-                              s.account_id,
-                              s.agent_name,
-                              s. """ + gameNameColumn +
-                        """
-                              , s. """ + gameColumn +
-                        """
-                                      -- 游戏id
-                                     
-                                from (          
-                                     SELECT
-                                          a.source_system,
-                                          b.minDay,
-                                          b.maxDay,
-                                          a.day,
-                                          a.ten_amount, 
-                                          ROUND(a.ten_rate,2)*100 as ten_rate,  -- 10点环比
-                                          ROUND(IF(ten_amount>0,ten_amount/b.costCount,ten_amount),2)*100 as ten_recovery, -- 10点回报率(充值/消耗)
-                                          a.fourteen_amount, -- 14点充值
-                                          ROUND(a.fourteen_rate,2)*100 as fourteen_rate,  -- 14点环比
-                                          ROUND(IF(fourteen_amount>0,fourteen_amount/b.costCount,fourteen_amount),2)*100 as fourteen_recovery, -- 14点回报率
-                                          a.seventeen_amount, -- 17点充值
-                                          ROUND(a.seventeen_rate,2)*100 as seventeen_rate,  -- 17点环比
-                                          ROUND(IF(seventeen_amount>0,seventeen_amount/b.costCount,seventeen_amount),2)*100 as seventeen_recovery, -- 17点回报率
-                                          a.twentyfour_amount, -- 24点充值
-                                          ROUND(a.twentyfour_rate,2)*100 as twentyfour_rate,  -- 24点环比
-                                          ROUND(IF(twentyfour_amount>0,twentyfour_amount/b.costCount,twentyfour_amount),2)*100 as twentyfour_recovery, -- 24点回报率
-                                          b.costCount,
-                                          a.pitcher_id, -- 投手id
-                                          a.pitcher_name, -- 投手名称
-                                          a.agent_id,
-                                          a.account_id,
-                                          a.agent_name,
-                                          a.
-                                          """ + gameNameColumn + """
-                                          , a. """ + gameColumn + """
+             """
+                 select
+                        cost_begin_date, -- 消耗开始时间
+                        cost_end_date, -- 消耗结束时间
+                        order_date,
+                        source_system,
+                        ten_amount, -- 10点充值金额
+                        ROUND(IF(ten_amount>0,ten_amount/cost_count,cost_count),2)*100 as ten_recovery, -- 10点回报率(充值/消耗)
+                        ROUND(IF(cost_count>0,ten_amount/yesterday_amount,cost_count),2)*100 as ten_rate, -- 10点环比(前一天充值总额/消耗)
+                        fourteen_amount, -- 14点充值金额
+                        ROUND(IF(cost_count>0,fourteen_amount/cost_count,cost_count),2)*100 as fourteen_recovery, -- 14点回报率(充值/消耗)
+                        ROUND(IF(cost_count>0,fourteen_amount/yesterday_amount,cost_count),2)*100 as fourteen_rate, -- 14点环比(前一天充值总额/消耗)
+                        seventeen_amount, -- 17点充值金额
+                        ROUND(IF(cost_count>0,seventeen_amount/cost_count,cost_count),2)*100 as seventeen_recovery, -- 17点回报率(充值/消耗)
+                        ROUND(IF(cost_count>0,seventeen_amount/yesterday_amount,cost_count),2)*100 as seventeen_rate, -- 17点环比(前一天充值总额/消耗)
+                        twentyfour_amount, -- 24点充值金额
+                        ROUND(IF(cost_count>0,twentyfour_amount/cost_count,cost_count),2)*100 as twentyfour_recovery, -- 24点回报率(充值/消耗)
+                        ROUND(IF(cost_count>0,twentyfour_amount/yesterday_amount,cost_count),2)*100 as twentyfour_rate, -- 17点环比(前一天充值总额/消耗)
+                        cost_count, -- 消耗总计
+                        yesterday_amount -- 昨日充值总额
+                  from (
+                               SELECT
+                                      order_date,
+                                      ANY_VALUE(cost_begin_date) cost_begin_date , -- 消耗开始时间
+                                      ANY_VALUE(cost_end_date) cost_end_date, -- 消耗结束时间
+                                      sum(ten_amount) ten_amount,
+                                      sum(fourteen_amount) fourteen_amount ,
+                                      sum(seventeen_amount) seventeen_amount,
+                                      sum(twentyfour_amount) twentyfour_amount,
+                                      any_value(cost_count) cost_count,
+                                      any_value(source_system) source_system,
+                                      sum(yesterday_amount) yesterday_amount
+                                from (
+                                           SELECT
+                                                 s.source_system,-- SDK类型
+                                                 s.minDay cost_begin_date, -- 消耗开始时间
+                                                 s.maxDay cost_end_date, -- 消耗结束时间
+                                                 s.day as order_date, -- 订单时间
+                                                 s.ten_amount, -- 10点充值
+                                                 s.fourteen_amount,  -- 14点充值
+                                                 s.seventeen_amount, -- 17点充值
+                                                 s.twentyfour_amount, -- 24点充值
+                                                 IFNULL(s.costCount,0) as cost_count , -- 消耗总计
+                                                 s.yesterday_amount   -- 昨日充值总额
+                                           from (
+                                                    SELECT
+                                                            a.source_system,
+                                                            b.minDay,
+                                                            b.maxDay,
+                                                            a.day,
+                                                            a.ten_amount,
+                                                            a.fourteen_amount, -- 14点充值
+                                                            a.seventeen_amount, -- 17点充值
+                                                            a.twentyfour_amount, -- 24点充值
+                                                            b.costCount,
+                                                            a.pitcher_id, -- 投手id
+                                                            a.agent_id,
+                                                            a.account_id,
+                                                            a.yesterday_amount,
+                                                            a.""" + gameColumn + """
                                                  
-                        FROM
-                        		(
-                        			SELECT
-                        				day,
-                        				source_system,
-                        				ten_amount,
-                                        fourteen_amount,
-                                        seventeen_amount,
-                                        twentyfour_amount,
-                                        ten_rate,
-                                        fourteen_rate,
-                                        seventeen_rate,
-                                        twentyfour_rate,
-                                        pitcher_id,
-                                        pitcher_name,   
-                                        agent_id,
-                                        account_id,
-                                        agent_name,
-                                        """ + gameNameColumn +"""
-                         , """
-                        + gameColumn +
-                        """
-                                    FROM      
-                                """ + orderTable +
-                        """
-                                	) a
-                                LEFT JOIN (
-                                	SELECT
-                                		source_system,
-                                		sum(cost) costCount,
-                                		max(day) maxDay,
-                                		min(day) minDay
-                                	FROM  
-                                	""" + costTable +
-                        """
-                                """ + criCost +
-                        """
-                                            		GROUP BY source_system
-                                            	) b on a.source_system = b.source_system
-                                )s   
-                                """ + cri;
+                                                       FROM
+                                                      (
+                                                       SELECT
+                                                         day,
+                                                         source_system,
+                                                         ten_amount,
+                                                         fourteen_amount,
+                                                         seventeen_amount,
+                                                         twentyfour_amount,
+                                                         ten_rate,
+                                                         fourteen_rate,
+                                                         seventeen_rate,
+                                                         twentyfour_rate,
+                                                         pitcher_id,
+                                                         agent_id,
+                                                         account_id,
+                                                         yesterday_amount,
+                                                         """ + gameColumn + """
+                                                       FROM
+                                                         """ + orderTable + """
+                                                       ) a
+                                                             LEFT JOIN (
+                                                                    SELECT
+                                                                        source_system,
+                                                                        sum(cost) costCount,
+                                                                        max(day) maxDay,
+                                                                        min(day) minDay
+                                                                     FROM  
+                                                                        """ + costTable + """
+                                                                        """ + criCost + """
+                                                                        GROUP BY source_system
+                                            	                        ) b on a.source_system = b.source_system
+                                           )s""" + cri + """
+                                )a    group by order_date
+                                 
+                  )  aa  ORDER BY order_date DESC
+               """;
         return sql;
     }
 

+ 3 - 3
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/PitcherDataServiceImpl.java

@@ -264,7 +264,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
         List<PitcherDataDayVO> list = tempList.stream().map(vo -> {
             Long[] usersID = ArrayUtils.EMPTY_LONG_OBJECT_ARRAY;
             //将pitcherId和需要查询的注册时间拼接
-            String pitcherIdDate = vo.getPitcherId() + "/" + dto.getBeginDate();
+            String pitcherIdDate = vo.getPitcherId() + "/" + vo.getDt();
             //取出所有usersId
             if (map.containsKey(pitcherIdDate)) {
                 //string[] -> Long[]
@@ -325,7 +325,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
         findUsersCri.where().andNotEquals("reg_agent_id", 0);
         Sql findUsersIdSql;
         Criteria groupByCri = Cnd.cri();
-        groupByCri.getGroupBy().groupBy("pitcher_id", "DATE(reg_user_time)");
+        groupByCri.getGroupBy().groupBy("pitcher_id", "DATE(dt)");
         findUsersIdSql = Sqls.create(findUsersIdSql(findUsersCri, groupByCri));
         //自定义回传
         findUsersIdSql.setCallback((connection, resultSet, sql) -> {
@@ -349,7 +349,7 @@ public class PitcherDataServiceImpl implements IPitcherDataService {
     private String findUsersIdSql(Criteria cri, Criteria groupByCri) {
         return """
                 SELECT
-                    CONCAT(pitcher_id,'/',DATE(reg_user_time)) as game_id_date,
+                    CONCAT(pitcher_id,'/',DATE(dt)) as game_id_date,
                     GROUP_CONCAT(CONVERT (player_id, varchar), "/") as amount_users_id
                 FROM
                     game_ads.ads_player_recharge_ranking

+ 59 - 3
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/RoleManageServiceImpl.java

@@ -58,6 +58,15 @@ public class RoleManageServiceImpl implements IRoleManageService {
             //角色注册子游戏
             criA.where().andInList("role_reg_game_id", dto.getGameId());
         }
+
+        //拼接24内充值金额条件
+        if(dto.getRechargeAmountWithin24h()!=null){
+            criA = spliceRechargeAmountWithin24h(dto, criA);
+        }
+        if(dto.getRechargeTotalAmountWithin24h()!=null){
+            criA = spliceRechargeTotalAmountWithin24h(dto, criA);
+        }
+
         if (CollectionUtils.isNotEmpty(dto.getParentGameIds())) {
             //角色注册父游戏
             criA.where().andInList("role_reg_parent_game_id", dto.getParentGameIds());
@@ -216,7 +225,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
         sql.setPager(pager);
         dao.execute(sql);
         List<Map> list = sql.getList(Map.class).stream().map(map -> {
-            getNameById(map);
+             getNameById(map);
             //去除‘null’字符串
             if ("null".equals(map.get("add_corp_user_id"))) {
                 map.put("add_corp_user_id", null);
@@ -240,6 +249,34 @@ public class RoleManageServiceImpl implements IRoleManageService {
         return new Page<>(list, pager);
     }
 
+    private Criteria spliceRechargeTotalAmountWithin24h(RoleRechargeRankingDTO dto, Criteria criA) {
+        switch (dto.getRechargeTotalAmountWithin24hUnit()) {
+            case ">" -> criA.where().andGT("role_total_amount", dto.getRechargeTotalAmountWithin24h());
+            case ">=" -> criA.where().andGTE("role_total_amount", dto.getRechargeTotalAmountWithin24h());
+            case "=" -> criA.where().andEquals("role_total_amount", dto.getRechargeTotalAmountWithin24h());
+            case "<" -> criA.where().andLT("role_total_amount", dto.getRechargeTotalAmountWithin24h());
+            case "<=" -> criA.where().andLTE("role_total_amount", dto.getRechargeTotalAmountWithin24h());
+            default -> {
+                criA.where().andGTE("role_total_amount", dto.getRechargeTotalAmountWithin24h());
+            }
+        }
+        return criA;
+    }
+
+    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());
+            default -> {
+                criA.where().andGTE("max_amount", dto.getRechargeAmountWithin24h());
+            }
+        }
+        return criA;
+    }
+
     /**
      * 角色战力排行榜
      * @param dto RoleCombatRankingDTO
@@ -928,7 +965,9 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 		j.create_by as create_by, -- 创建者
                 		j.update_time as update_time, -- 更新时间
                 		j.update_by as update_by, -- 更新者
-                		j.is_delete as is_delete -- 是否删除 1-删除;0-正常
+                		j.is_delete as is_delete, -- 是否删除 1-删除;0-正常
+                		ara.role_total_amount as role_total_amount, -- 创角24小时内总充值金额
+                		ara.max_amount as max_amount -- 创角24小时内单笔最大充值金额
                 	FROM
                 	(
                 		SELECT
@@ -953,6 +992,13 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 		) a
                 		WHERE num = 1
                 	) a
+                	left join(
+                	    SELECT source_system,
+                	    role_id,
+                	    role_total_amount,
+                	    array_max(role_amount) max_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
                 			-- 角色等级、角色攻击力(取最新的信息)
@@ -1328,7 +1374,9 @@ public class RoleManageServiceImpl implements IRoleManageService {
                         j.create_by as create_by, -- 创建者
                         j.update_time as update_time, -- 更新时间
                         j.update_by as update_by, -- 更新者
-                        j.is_delete as is_delete -- 是否删除 1-删除;0-正常
+                        j.is_delete as is_delete, -- 是否删除 1-删除;0-正常
+                        ara.role_total_amount as role_total_amount, -- 创角24小时内总充值金额
+                		ara.max_amount as max_amount -- 创角24小时内单笔最大充值金额
                     FROM
                     (
                         SELECT
@@ -1353,6 +1401,14 @@ public class RoleManageServiceImpl implements IRoleManageService {
                         ) a
                         WHERE num = 1
                     ) a
+                    left join(
+                	    SELECT 
+                	        source_system,
+                	        role_id,
+                	        role_total_amount,
+                	        array_max(role_amount) max_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
                             -- 角色等级、角色攻击力(取最新的信息)