|
@@ -1,9 +1,12 @@
|
|
package com.zanxiang.game.data.serve.service.impl;
|
|
package com.zanxiang.game.data.serve.service.impl;
|
|
|
|
|
|
|
|
+import com.github.sd4324530.jtuple.Tuple2;
|
|
|
|
+import com.zanxiang.game.data.serve.component.DataPowerComponent;
|
|
import com.zanxiang.game.data.serve.pojo.dto.ChoiceListDTO;
|
|
import com.zanxiang.game.data.serve.pojo.dto.ChoiceListDTO;
|
|
import com.zanxiang.game.data.serve.pojo.vo.GameListVO;
|
|
import com.zanxiang.game.data.serve.pojo.vo.GameListVO;
|
|
import com.zanxiang.game.data.serve.service.IGameListService;
|
|
import com.zanxiang.game.data.serve.service.IGameListService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.nutz.dao.Cnd;
|
|
import org.nutz.dao.Cnd;
|
|
import org.nutz.dao.Dao;
|
|
import org.nutz.dao.Dao;
|
|
@@ -13,6 +16,8 @@ import org.nutz.dao.sql.Sql;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.Collections;
|
|
|
|
+import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -26,15 +31,22 @@ public class GameListServiceImpl implements IGameListService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private Dao dao;
|
|
private Dao dao;
|
|
|
|
+ @Autowired
|
|
|
|
+ private DataPowerComponent dataPowerComponent;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 游戏列表接口 查看所有游戏、父游戏、超父游戏列表
|
|
* 游戏列表接口 查看所有游戏、父游戏、超父游戏列表
|
|
|
|
+ *
|
|
* @param dto
|
|
* @param dto
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public GameListVO getGameList(ChoiceListDTO dto) {
|
|
public GameListVO getGameList(ChoiceListDTO dto) {
|
|
-
|
|
|
|
|
|
+ Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo(dto.getSourceSystem());
|
|
|
|
+ List<Long> gameIds = poerInfo.second;
|
|
|
|
+ if (CollectionUtils.isEmpty(gameIds)) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
Criteria cri = Cnd.cri();
|
|
Criteria cri = Cnd.cri();
|
|
if (StringUtils.isBlank(dto.getSourceSystem())) {
|
|
if (StringUtils.isBlank(dto.getSourceSystem())) {
|
|
//默认查询“ZX_ONE”数据
|
|
//默认查询“ZX_ONE”数据
|
|
@@ -44,7 +56,7 @@ public class GameListServiceImpl implements IGameListService {
|
|
//不同的数据源
|
|
//不同的数据源
|
|
cri.where().andEquals("source_system", dto.getSourceSystem());
|
|
cri.where().andEquals("source_system", dto.getSourceSystem());
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ cri.where().andInList("id", gameIds);
|
|
//查询游戏列表
|
|
//查询游戏列表
|
|
Sql gameListSql = Sqls.create("""
|
|
Sql gameListSql = Sqls.create("""
|
|
SELECT
|
|
SELECT
|
|
@@ -72,8 +84,8 @@ public class GameListServiceImpl implements IGameListService {
|
|
) a
|
|
) a
|
|
""" + cri +
|
|
""" + cri +
|
|
"""
|
|
"""
|
|
- GROUP BY id, game_name, parent_game_id, source_system, parent_game_name, super_game_id, super_game_name;
|
|
|
|
- """);
|
|
|
|
|
|
+ GROUP BY id, game_name, parent_game_id, source_system, parent_game_name, super_game_id, super_game_name;
|
|
|
|
+ """);
|
|
gameListSql.setCallback(Sqls.callback.maps());
|
|
gameListSql.setCallback(Sqls.callback.maps());
|
|
dao.execute(gameListSql);
|
|
dao.execute(gameListSql);
|
|
|
|
|
|
@@ -100,8 +112,8 @@ public class GameListServiceImpl implements IGameListService {
|
|
) a
|
|
) a
|
|
""" + cri +
|
|
""" + cri +
|
|
"""
|
|
"""
|
|
- GROUP BY parent_game_id, source_system, parent_game_name, super_game_id, super_game_name;
|
|
|
|
- """);
|
|
|
|
|
|
+ GROUP BY parent_game_id, source_system, parent_game_name, super_game_id, super_game_name;
|
|
|
|
+ """);
|
|
parentGameListSql.setCallback(Sqls.callback.maps());
|
|
parentGameListSql.setCallback(Sqls.callback.maps());
|
|
dao.execute(parentGameListSql);
|
|
dao.execute(parentGameListSql);
|
|
|
|
|
|
@@ -123,8 +135,8 @@ public class GameListServiceImpl implements IGameListService {
|
|
) a
|
|
) a
|
|
""" + cri +
|
|
""" + cri +
|
|
"""
|
|
"""
|
|
- GROUP BY super_game_id, source_system, super_game_name;
|
|
|
|
- """);
|
|
|
|
|
|
+ GROUP BY super_game_id, source_system, super_game_name;
|
|
|
|
+ """);
|
|
superGameListSql.setCallback(Sqls.callback.maps());
|
|
superGameListSql.setCallback(Sqls.callback.maps());
|
|
dao.execute(superGameListSql);
|
|
dao.execute(superGameListSql);
|
|
|
|
|