dos 3 luni în urmă
părinte
comite
2c914d38d8

+ 24 - 10
game-business/src/main/java/com/game/business/service/impl/AppGameCommissionServiceImpl.java

@@ -106,17 +106,31 @@ public class AppGameCommissionServiceImpl extends ServiceImpl<AppGameCommissionM
         List<AppGameCommission> list = appGameCommissionMapper.selectList(queryWrapper);
         if(null != list && list.size() > 0){
             List<Long> gameIds = list.stream().map(e->e.getGameId()).collect(Collectors.toList());
-            List<AppGame> games = appGameService.selectByIds(gameIds);
-            Map<String,String> map = new HashMap<>();
-            if(null != games && games.size() > 0){
-                map = games.stream().collect(Collectors.toMap(j->String.valueOf(j.getId()),AppGame::getName,(k1,k2)->k1));
-            }
-            Map<String, String> finalMap = map;
-            list.forEach(e->{
-                if(null != finalMap.get(String.valueOf(e.getGameId()))){
-                    e.setGameName(finalMap.get(String.valueOf(e.getGameId())));
+            AppGame queryGame = new AppGame();
+//            queryGame.setStatus(1L);
+            List<AppGame> games = appGameService.selectAppGameList(queryGame);
+            for(AppGame game:games){
+                Map<String,Boolean> userMap = new HashMap<>();
+                for(AppGameCommission appGameCommission : list){
+                    if(game.getId().equals(appGameCommission.getGameId())){
+                        if(null == userMap.get(appGameCommission.getUserId())){
+                            userMap.put(String.valueOf(appGameCommission.getUserId()),true);
+                        }
+                        appGameCommission.setGameName(game.getName());
+                    }
+                }
+
+                List<Long> unIds = ids.stream().filter(e->null==userMap.get(String.valueOf(e))).collect(Collectors.toList());
+                for(Long unId:unIds){
+                    //未设置过该游戏
+                    AppGameCommission appGameCommission = new AppGameCommission();
+                    appGameCommission.setGameId(game.getId());
+                    appGameCommission.setGameRate(0L);
+                    appGameCommission.setGameName(game.getName());
+                    appGameCommission.setUserId(unId);
+                    list.add(appGameCommission);
                 }
-            });
+            }
         }
         return list;
     }

+ 7 - 1
game-business/src/main/java/com/game/business/service/impl/AppUserAgentServiceImpl.java

@@ -212,7 +212,13 @@ public class AppUserAgentServiceImpl extends ServiceImpl<AppUserAgentMapper, App
                         collect(Collectors.groupingBy(j->String.valueOf(j.getUserId())));
                 list.forEach(e->{
                     if(null != map.get(String.valueOf(e.getUserId()))){
-                        e.setGameCommissionList(map.get(String.valueOf(e.getUserId())));
+                        List<AppGameCommission> commissionList = map.get(String.valueOf(e.getUserId()));
+                        commissionList.forEach(commission->{
+                            if(null == commission.getPid()){
+                                commission.setPid(e.getPid());
+                            }
+                        });
+                        e.setGameCommissionList(commissionList);
                     }else if(null != gameList && gameList.size() > 0){
                         e.setGameCommissionList(gameList.stream().map(j->{
                             AppGameCommission gameCommission = new AppGameCommission();