Explorar o código

fix:修改筛选条件

zhangxianyu hai 1 mes
pai
achega
a075bb3320

+ 43 - 42
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/RoleManageServiceImpl.java

@@ -1096,7 +1096,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
     public List<Map> ipDetailList(RoleIpInfoParamDTO dto) {
         Criteria criteria = Cnd.cri();
         criteria.where().andEquals("role_id", dto.getRoleId());
-        if(CollectionUtils.isNotEmpty(dto.getGameId())){
+        if (CollectionUtils.isNotEmpty(dto.getGameId())) {
             criteria.where().andInList("game_id", dto.getGameId());
         }
         String ipDetailListSql = getIpDetailListSql(criteria);
@@ -1111,11 +1111,11 @@ public class RoleManageServiceImpl implements IRoleManageService {
         Criteria criteria = Cnd.cri();
         criteria.where().andInStrList("ip", ip);
         criteria.where().andNotIsNull("ip");
-        criteria.where().andNotEquals("ip","null");
-        criteria.where().andNotEquals("ip","");
+        criteria.where().andNotEquals("ip", "null");
+        criteria.where().andNotEquals("ip", "");
         criteria.where().andNotIsNull("role_id");
-        criteria.where().andNotEquals("role_id","null");
-        criteria.where().andNotEquals("role_id","");
+        criteria.where().andNotEquals("role_id", "null");
+        criteria.where().andNotEquals("role_id", "");
         String ipCountList = getIpCountList(criteria);
         Sql sql = Sqls.create(ipCountList);
         sql.setCallback(Sqls.callback.maps());
@@ -1292,21 +1292,23 @@ public class RoleManageServiceImpl implements IRoleManageService {
 
     private String getGameCountryRoleListSql(Criteria criA) {
         return """
-                select a.country as country,a.role_id as roleId,a.user_id as userId ,a.role_name as roleName ,a.role_level as roleLevel ,combat_num as combatNum,
-                                                                                             a.server_id as serverId ,a.server_name as serverName ,create_time as createTime,IFNULL(b.amount,0) as roleTotalAmount
-                                                                                             from dm_game_order.t_game_user_role a
-                                                                                             left join game_dw.dw_order_day_amount b on a.role_id = b.role_id
-                """ + criA;
+                select a.country as country,a.role_id as roleId,a.user_id as userId ,any_value(a.role_name) as roleName ,any_value(a.role_level) as roleLevel ,any_value(combat_num) as combatNum,
+                                                                                                            a.server_id as serverId ,any_value(a.server_name) as serverName ,any_value(create_time) as createTime,SUM(IFNULL(b.amount,0)) as roleTotalAmount
+                                                                                                            from dm_game_order.t_game_user_role a
+                                                                                                            left join game_dw.dw_order_day_amount b on a.role_id = b.role_id
+                                                                                                            """ + criA + """
+                 GROUP BY a.country, a.role_id, a.user_id, a.server_id
+                """;
     }
 
     private String getGameCountryRoleCountSql(Criteria criA) {
         return """
-                select count(1) from ( select a.country as country,a.role_id as roleId,a.user_id as userId ,a.role_name as roleName ,a.role_level as roleLevel ,a.combat_num as combatNum,
-                              a.server_id as serverId ,a.server_name as serverName ,a.create_time as createTime,IFNULL(b.amount,0) as roleTotalAmount
-                              from dm_game_order.t_game_user_role a
-                              left join game_dw.dw_order_day_amount b on a.role_id = b.role_id
-                              """ + criA + """
-                                ) a
+                select count(1) from (select a.country as country,a.role_id as roleId,a.user_id as userId ,any_value(a.role_name) as roleName ,any_value(a.role_level) as roleLevel ,any_value(combat_num) as combatNum,
+                                                                                                                                               a.server_id as serverId ,any_value(a.server_name) as serverName ,any_value(create_time) as createTime,SUM(IFNULL(b.amount,0)) as roleTotalAmount
+                                                                                                                                               from dm_game_order.t_game_user_role a
+                                                                                                                                               left join game_dw.dw_order_day_amount b on a.role_id = b.role_id
+                                                                                                                                               """ + criA + """
+                                                    GROUP BY a.country, a.role_id, a.user_id, a.server_id) a
                 """;
     }
 
@@ -1355,32 +1357,31 @@ public class RoleManageServiceImpl implements IRoleManageService {
     private String getGameCountryListSql(Criteria criA) {
         return """
                 select country,
-                       country_level,
-                       sum(role_total_amount) as role_total_amount,
-                       count(1) as role_count,
-                       sum(active) as active_count,
-                       server_id,
-                       ANY_VALUE(cs) cs,
-                       ANY_VALUE(game_id) gameId,
-                       ANY_VALUE(server_name) serverName
-                from (select a.country,
-                                      a.game_id,
-                                      a.server_name,
-                                      IFNULL(c.amount, 0) as role_total_amount,
-                                      if(b.role_level <= 13, 0, 1)      as country_level,
-                                      if(d.role_id is not null, 1, 0) as active,
-                                      a.server_id,
-                                      concat(a.country,',',a.server_id) as cs
-                               from dm_game_order.t_server_country a
-                                        left join dm_game_order.t_game_user_role b on a.country = b.country and a.server_id = b.server_id
-                                        left join game_dw.dw_order_day_amount c on c.role_id = b.role_id
-                               	left join (
-                	select role_id,ROW_NUMBER()over(partition by role_id) as num from game_dw.dw_active_log
-                	where game_id in (35,36,10035)
-                	and dt = Date(NOW()) ) d  on b.role_id = d.role_id and d.num = 1
-                               ) a
-                               """ + criA + """
-                group by country_level,country,server_id   order by role_count desc
+                                       country_level,
+                                       sum(role_total_amount) as role_total_amount,
+                                       count(1) as role_count,
+                                       sum(active) as active_count,
+                                       server_id,
+                                       ANY_VALUE(cs) cs,
+                                       ANY_VALUE(game_id) gameId,
+                                       ANY_VALUE(server_name) serverName
+                                from (select a.country,
+                                                      a.game_id,
+                                                      a.server_name,
+                                                      (select IFNULL(sum(amount),0) as amount  from game_dw.dw_order_day_amount where role_id = b.role_id) as role_total_amount,
+                                                      if(b.role_level <= 13, 0, 1)      as country_level,
+                                                      if(d.role_id is not null, 1, 0) as active,
+                                                      a.server_id,
+                                                      concat(a.country,',',a.server_id) as cs
+                                               from dm_game_order.t_server_country a
+                                                        left join dm_game_order.t_game_user_role b on a.country = b.country and a.server_id = b.server_id
+                                               	left join (
+                                	select role_id,ROW_NUMBER()over(partition by role_id) as num from game_dw.dw_active_log
+                                	where game_id in (35,36,10035)
+                                	and dt = Date(NOW()) ) d  on b.role_id = d.role_id and d.num = 1
+                                               ) a
+                 """ + criA + """
+                                group by country_level,country,server_id   order by role_count desc
                 """;
     }