Преглед на файлове

feat:1、游戏帮派数据列表 2、游戏帮派角色列表

zhangxianyu преди 1 месец
родител
ревизия
87c6814f80

+ 6 - 0
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/pojo/dto/GameCountryParamDTO.java

@@ -18,6 +18,12 @@ public class GameCountryParamDTO {
    @Size(max = 4,message = "帮派最多选择4个")
    @Size(max = 4,message = "帮派最多选择4个")
    private List<String> gameCountryList;
    private List<String> gameCountryList;
 
 
+   @ApiModelProperty(value = "父游戏id")
+   private List<Long> gameId;
+
+   @ApiModelProperty(value = "区服id")
+   private List<String> serverId;
+
 
 
 
 
 }
 }

+ 38 - 25
game-data/game-data-serve/src/main/java/com/zanxiang/game/data/serve/service/impl/RoleManageServiceImpl.java

@@ -937,7 +937,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
         dao.execute(sql);
         dao.execute(sql);
         //查询结果
         //查询结果
         List<Map> list = sql.getList(Map.class);
         List<Map> list = sql.getList(Map.class);
-        if(CollectionUtils.isNotEmpty(list)){
+        if (CollectionUtils.isNotEmpty(list)) {
             List<String> keys = Arrays.asList("pitcherId", "operUserId", "gsId", "customerServiceId");
             List<String> keys = Arrays.asList("pitcherId", "operUserId", "gsId", "customerServiceId");
             List<Long> userIds = new ArrayList<>();
             List<Long> userIds = new ArrayList<>();
             for (Map map : list) {
             for (Map map : list) {
@@ -1009,7 +1009,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
         dao.execute(sql1);
         dao.execute(sql1);
         //查询结果
         //查询结果
         List<RoleGameCountryVO> list = sql1.getList(RoleGameCountryVO.class);
         List<RoleGameCountryVO> list = sql1.getList(RoleGameCountryVO.class);
-        if(CollectionUtils.isNotEmpty(list)){
+        if (CollectionUtils.isNotEmpty(list)) {
             //以country为key,value是list分组
             //以country为key,value是list分组
             Map<String, List<RoleGameCountryVO>> map = list.stream().collect(Collectors.groupingBy(RoleGameCountryVO::getCs));
             Map<String, List<RoleGameCountryVO>> map = list.stream().collect(Collectors.groupingBy(RoleGameCountryVO::getCs));
             return map;
             return map;
@@ -1067,30 +1067,36 @@ public class RoleManageServiceImpl implements IRoleManageService {
 
 
     private Criteria getSqlByQuery(RoleGameCountryParamDTO dto) {
     private Criteria getSqlByQuery(RoleGameCountryParamDTO dto) {
         Criteria cri = Cnd.cri();
         Criteria cri = Cnd.cri();
-        if(StringUtils.isNotEmpty(dto.getCountry())){
-            cri.where().andEquals("country",dto.getCountry());
+        if (StringUtils.isNotEmpty(dto.getCountry())) {
+            cri.where().andEquals("country", dto.getCountry());
         }
         }
-        if(StringUtils.isNotEmpty(dto.getServerId())){
-            cri.where().andEquals("server_id",dto.getServerId());
+        if (StringUtils.isNotEmpty(dto.getServerId())) {
+            cri.where().andEquals("server_id", dto.getServerId());
         }
         }
-        cri.where().andInList("game_id", Arrays.asList(35L,36L,10035L));
+        cri.where().andInList("game_id", Arrays.asList(35L, 36L, 10035L));
         return cri;
         return cri;
     }
     }
 
 
     private Criteria getSqlByQuery(GameCountryParamDTO dto) {
     private Criteria getSqlByQuery(GameCountryParamDTO dto) {
         Criteria criA = Cnd.cri();
         Criteria criA = Cnd.cri();
         //如果帮派为空就取4个帮派
         //如果帮派为空就取4个帮派
-        if(CollectionUtils.isEmpty(dto.getGameCountryList())){
-            String countryListSql = getCountryListSql();
+        if (CollectionUtils.isEmpty(dto.getGameCountryList())) {
+            String countryListSql = getCountryListSql(dto);
             Sql sql = Sqls.create(countryListSql);
             Sql sql = Sqls.create(countryListSql);
             sql.setCallback(Sqls.callback.strList());
             sql.setCallback(Sqls.callback.strList());
             dao.execute(sql);
             dao.execute(sql);
             List<String> list = sql.getList(String.class);
             List<String> list = sql.getList(String.class);
-            if(CollectionUtils.isNotEmpty(list)){
+            if (CollectionUtils.isNotEmpty(list)) {
                 criA.where().andInStrList("cs", list);
                 criA.where().andInStrList("cs", list);
             }
             }
-        }else {
-                criA.where().andInStrList("country", dto.getGameCountryList());
+        } else {
+            criA.where().andInStrList("country", dto.getGameCountryList());
+        }
+        if (CollectionUtils.isNotEmpty(dto.getGameId())) {
+            criA.where().andInList("game_id", dto.getGameId());
+        }
+        if (CollectionUtils.isNotEmpty(dto.getServerId())) {
+            criA.where().andInStrList("server_id", dto.getServerId());
         }
         }
         return criA;
         return criA;
     }
     }
@@ -1118,15 +1124,22 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 	where game_id in (35,36,10035)
                 	where game_id in (35,36,10035)
                 	and dt = Date(NOW()) ) d  on b.role_id = d.role_id and d.num = 1
                 	and dt = Date(NOW()) ) d  on b.role_id = d.role_id and d.num = 1
                                ) a
                                ) a
-                               """+criA+"""
+                               """ + criA + """
                 group by country_level,country,server_id   order by role_count desc
                 group by country_level,country,server_id   order by role_count desc
                 """;
                 """;
     }
     }
 
 
-    private String getCountryListSql() {
+    private String getCountryListSql(GameCountryParamDTO dto) {
+        Criteria criA = Cnd.cri();
+        if (CollectionUtils.isNotEmpty(dto.getGameId())) {
+            criA.where().andInList("game_id", dto.getGameId());
+        }
+        if (CollectionUtils.isNotEmpty(dto.getServerId())) {
+            criA.where().andInStrList("server_id", dto.getServerId());
+        }
         return """
         return """
                 select concat(country,',',server_id) from dm_game_order.t_game_user_role  where country is not null and country != '' and country !='null'  and  game_id in(35,36,1003) group by country,server_id order by count(role_id) desc limit 4;
                 select concat(country,',',server_id) from dm_game_order.t_game_user_role  where country is not null and country != '' and country !='null'  and  game_id in(35,36,1003) group by country,server_id order by count(role_id) desc limit 4;
-                   """;
+                   """ + criA;
     }
     }
 
 
     private String getIpInfoListSql(Criteria criA) {
     private String getIpInfoListSql(Criteria criA) {
@@ -1187,7 +1200,7 @@ public class RoleManageServiceImpl implements IRoleManageService {
 
 
     private Criteria getSqlByQuery(RoleIpInfoParamDTO dto) {
     private Criteria getSqlByQuery(RoleIpInfoParamDTO dto) {
         Criteria criA = Cnd.cri();
         Criteria criA = Cnd.cri();
-        if (dto.getUserId()!=null) {
+        if (dto.getUserId() != null) {
             //玩家id
             //玩家id
             criA.where().andEquals("a.user_id", dto.getUserId());
             criA.where().andEquals("a.user_id", dto.getUserId());
         }
         }
@@ -1210,9 +1223,9 @@ public class RoleManageServiceImpl implements IRoleManageService {
         if (CollectionUtils.isNotEmpty(dto.getGameId())) {
         if (CollectionUtils.isNotEmpty(dto.getGameId())) {
             //游戏id
             //游戏id
             criA.where().andInList("a.game_id", dto.getGameId());
             criA.where().andInList("a.game_id", dto.getGameId());
-        }else {
+        } else {
             //游戏id
             //游戏id
-            criA.where().andInList("a.game_id", Arrays.asList(35L,36L,10035L));
+            criA.where().andInList("a.game_id", Arrays.asList(35L, 36L, 10035L));
         }
         }
         if (StringUtils.isNotEmpty(dto.getRoleId())) {
         if (StringUtils.isNotEmpty(dto.getRoleId())) {
             //角色id
             //角色id
@@ -1294,28 +1307,28 @@ public class RoleManageServiceImpl implements IRoleManageService {
                 LEFT JOIN role_ip_roles f ON a.role_id = f.role_id
                 LEFT JOIN role_ip_roles f ON a.role_id = f.role_id
                 LEFT JOIN user_role_counts urc ON a.user_id = urc.user_id
                 LEFT JOIN user_role_counts urc ON a.user_id = urc.user_id
                 LEFT JOIN dm_game_order.t_game game ON a.game_id = game.id AND game.source_system = 'ZX_ONE'
                 LEFT JOIN dm_game_order.t_game game ON a.game_id = game.id AND game.source_system = 'ZX_ONE'
-                """+
+                """ +
                 criA
                 criA
-                +"""
+                + """
                 ) a
                 ) a
-                """ ;
+                """;
     }
     }
 
 
     private Criteria getSqlByQuery(RoleLevelParamDTO dto) {
     private Criteria getSqlByQuery(RoleLevelParamDTO dto) {
         Criteria criA = Cnd.cri();
         Criteria criA = Cnd.cri();
-        if(dto.getGsId()!=null){
+        if (dto.getGsId() != null) {
             //gsId
             //gsId
             criA.where().andEquals("b.gs_id", dto.getGsId());
             criA.where().andEquals("b.gs_id", dto.getGsId());
         }
         }
-        if(dto.getPitcherId()!=null){
+        if (dto.getPitcherId() != null) {
             //投手id
             //投手id
             criA.where().andEquals("c.pitcher_id", dto.getPitcherId());
             criA.where().andEquals("c.pitcher_id", dto.getPitcherId());
         }
         }
-        if(dto.getCustomerServiceId()!=null){
+        if (dto.getCustomerServiceId() != null) {
             //客服id
             //客服id
             criA.where().andEquals("b.customer_service_id", dto.getCustomerServiceId());
             criA.where().andEquals("b.customer_service_id", dto.getCustomerServiceId());
         }
         }
-        if(dto.getOperUserId()!=null){
+        if (dto.getOperUserId() != null) {
             //运营id
             //运营id
             criA.where().andEquals("b.oper_user_id", dto.getOperUserId());
             criA.where().andEquals("b.oper_user_id", dto.getOperUserId());
         }
         }