|
@@ -2,10 +2,7 @@ package com.zanxiang.game.data.serve.service.impl;
|
|
|
|
|
|
import com.google.common.base.CaseFormat;
|
|
|
import com.zanxiang.game.data.serve.component.DataPowerComponent;
|
|
|
-import com.zanxiang.game.data.serve.pojo.dto.GameServerDayDTO;
|
|
|
-import com.zanxiang.game.data.serve.pojo.dto.GameServerDayTotalDTO;
|
|
|
-import com.zanxiang.game.data.serve.pojo.dto.GameServerSumDayDTO;
|
|
|
-import com.zanxiang.game.data.serve.pojo.dto.GameServerSumDayTotalDTO;
|
|
|
+import com.zanxiang.game.data.serve.pojo.dto.*;
|
|
|
import com.zanxiang.game.data.serve.pojo.entity.AdsGameServerDay;
|
|
|
import com.zanxiang.game.data.serve.pojo.entity.AdsGameServerSumDay;
|
|
|
import com.zanxiang.game.data.serve.pojo.enums.OrderByEnum;
|
|
@@ -13,6 +10,7 @@ import com.zanxiang.game.data.serve.pojo.vo.*;
|
|
|
import com.zanxiang.game.data.serve.service.IGameServerService;
|
|
|
import com.zanxiang.game.data.serve.utils.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.nutz.dao.Cnd;
|
|
|
import org.nutz.dao.Dao;
|
|
@@ -22,7 +20,6 @@ import org.nutz.dao.sql.Criteria;
|
|
|
import org.nutz.dao.sql.Sql;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
import reactor.util.function.Tuple2;
|
|
|
import reactor.util.function.Tuples;
|
|
|
|
|
@@ -373,18 +370,14 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
|
*/
|
|
|
@Override
|
|
|
public GameServerSumDayTotalVO getGameServerDataSumDayTotal(GameServerSumDayTotalDTO dto) {
|
|
|
- /*com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
|
|
|
- List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());*/
|
|
|
+ com.github.sd4324530.jtuple.Tuple2<List<Long>, List<Long>> poerInfo = dataPowerComponent.getPowerInfo();
|
|
|
+ List<Long> gameIds = dto.getGameId() == null ? poerInfo.second : Collections.singletonList(dto.getGameId());
|
|
|
|
|
|
//创建查询条件
|
|
|
Criteria cri = Cnd.cri();
|
|
|
- /*if (gameIds != null) {
|
|
|
+ if (gameIds != null) {
|
|
|
//拼接游戏ID查询条件
|
|
|
cri.where().andInList("game_id", gameIds);
|
|
|
- }*/
|
|
|
- if (dto.getGameId() != null) {
|
|
|
- //拼接游戏ID查询条件
|
|
|
- cri.where().andEquals("game_id", dto.getGameId());
|
|
|
}
|
|
|
if (dto.getBeginDate() != null && dto.getEndDate() != null) {
|
|
|
//拼接开服时间查询条件
|
|
@@ -410,6 +403,33 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<GameServerVO> getAllGameServer(GameServerListDTO dto) {
|
|
|
+ if (StringUtils.isBlank(dto.getSourceSystem())) {
|
|
|
+ dto.setSourceSystem("ZX_ONE");
|
|
|
+ }
|
|
|
+ //创建查询条件
|
|
|
+ Criteria cri = Cnd.cri();
|
|
|
+ if (StringUtils.isNotBlank(dto.getSourceSystem())) {
|
|
|
+ cri.where().andEquals("source_system", dto.getSourceSystem());
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getGameId())) {
|
|
|
+ cri.where().andInList("game_id", dto.getGameId());
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(dto.getParentGameId())) {
|
|
|
+ cri.where().andInList("parent_game_id", dto.getParentGameId());
|
|
|
+ }
|
|
|
+ //排序条件
|
|
|
+ cri.getOrderBy().orderBy("game_id", OrderByEnum.ASC.getOrderType());
|
|
|
+ cri.getOrderBy().orderBy("create_time", OrderByEnum.ASC.getOrderType());
|
|
|
+
|
|
|
+ Sql sql = Sqls.create(gameServerSql() + cri);
|
|
|
+ sql.setCallback(Sqls.callback.entities());
|
|
|
+ sql.setEntity(dao.getEntity(GameServerVO.class));
|
|
|
+ dao.execute(sql);
|
|
|
+ return sql.getList(GameServerVO.class);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 将vo中的原始String数据修改为一个对象
|
|
|
* @param vo 展示给前端的游戏区服数据
|
|
@@ -1394,5 +1414,28 @@ public class GameServerServiceImpl implements IGameServerService {
|
|
|
""";
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取所有区服sql
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String gameServerSql() {
|
|
|
+ return """
|
|
|
+ SELECT
|
|
|
+ *
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ a.source_system ,
|
|
|
+ a.game_id ,
|
|
|
+ a.game_name ,
|
|
|
+ a.server_id ,
|
|
|
+ a.server_name ,
|
|
|
+ IFNULL(b.parent_id , a.game_id ) as parent_game_id,
|
|
|
+ a.create_time
|
|
|
+ FROM dm_game_order.t_game_server a
|
|
|
+ LEFT JOIN dm_game_order.t_game b on a.source_system = b.source_system AND a.game_id = b.id
|
|
|
+ ) a
|
|
|
+ """;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|