| 
					
				 | 
			
			
				@@ -1,15 +1,19 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.zanxiang.game.module.manage.service.impl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.github.sd4324530.jtuple.Tuple3; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zanxiang.game.module.manage.service.IGameGiftPackConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.zanxiang.game.module.manage.service.IGameService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.zanxiang.game.module.mybatis.entity.Game; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zanxiang.game.module.mybatis.entity.GameGiftPackConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zanxiang.game.module.mybatis.mapper.GameGiftPackConfigMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zanxiang.module.util.JsonUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.collections4.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import reactor.util.function.Tuple2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import reactor.util.function.Tuples; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.stream.Collectors; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -23,23 +27,29 @@ import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Service 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class GameGiftPackConfigServiceImpl extends ServiceImpl<GameGiftPackConfigMapper, GameGiftPackConfig> implements IGameGiftPackConfigService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private IGameService gameService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public List<Tuple3<Long, List<Long>, Map<String, String>>> getGameGiftPackConfig() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<Tuple2<Map<Long, String>, Map<String, String>>> getGameGiftPackConfig() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<GameGiftPackConfig> gameGiftPackConfigList = super.list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (CollectionUtils.isEmpty(gameGiftPackConfigList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return Collections.emptyList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Tuple3<Long, List<Long>, Map<String, String>>> list = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<Long, String> gameMap = gameService.list().stream().collect(Collectors.toMap(Game::getId, Game::getName)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Tuple2<Map<Long, String>, Map<String, String>>> list = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         gameGiftPackConfigList.forEach(config -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String gameIds = config.getGameIds(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String codeTypeConfig = config.getCodeTypeConfig(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (StringUtils.isAnyEmpty(gameIds, codeTypeConfig)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<Long> gameIdList = Arrays.stream(gameIds.split(",")).distinct() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    .map(Long::valueOf).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //类型配置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Map<String, String> codeTypeMap = JsonUtil.toMap(codeTypeConfig, Map.class, String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            list.add(Tuple3.with(config.getSuperGameId(), gameIdList, codeTypeMap)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //添加返回 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Arrays.stream(gameIds.split(",")).distinct() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .map(Long::valueOf) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .forEach(gameId -> list.add(Tuples.of(Collections.singletonMap(gameId, gameMap.get(gameId)), codeTypeMap))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 |