Kaynağa Gözat

:feat:角色充值排行榜增加筛选条件

zhangxianyu 1 yıl önce
ebeveyn
işleme
573bf4d391

+ 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 = ">=";
 }

+ 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
                             -- 角色等级、角色攻击力(取最新的信息)