Procházet zdrojové kódy

fix : 原始服实现排序

bilingfeng před 1 rokem
rodič
revize
3ae5c77ccf

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java

@@ -21,7 +21,7 @@ public class ManageApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(ManageApplication.class, args);
-        System.out.println("赞象Manage服务启动成功 <新增获取全量区服接口4> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 <原始服实现排序> ( ´・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 6 - 3
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameServerServiceImpl.java

@@ -189,12 +189,15 @@ public class GameServerServiceImpl extends ServiceImpl<GameServerMapper, GameSer
         }
         //合服原始服列表
         if (sourceServerIdArray != null) {
+            List<Integer> sourceServerIdList = Arrays.stream(sourceServerIdArray)
+                    .map(Integer::parseInt)
+                    .sorted().collect(Collectors.toList());
             List<GameServerListVO.ServerBean> sourceServerList = new ArrayList<>();
-            for (String sourceServerId : sourceServerIdArray) {
-                GameServer sourceServer = gameServerMap.get(sourceServerId);
+            for (Integer sourceServerId : sourceServerIdList) {
+                GameServer sourceServer = gameServerMap.get(sourceServerId.toString());
                 if (sourceServer != null) {
                     sourceServerList.add(GameServerListVO.ServerBean.builder()
-                            .serverId(sourceServerId)
+                            .serverId(sourceServerId.toString())
                             .serverName(sourceServer.getServerName())
                             .build());
                 }