|
@@ -19,6 +19,7 @@ import com.zanxiang.game.module.manage.pojo.params.GameMergeServerParam;
|
|
|
import com.zanxiang.game.module.manage.pojo.params.GameServerAddUpdateParam;
|
|
|
import com.zanxiang.game.module.manage.pojo.params.GameServerAssignParam;
|
|
|
import com.zanxiang.game.module.manage.pojo.params.GameServerListParam;
|
|
|
+import com.zanxiang.game.module.manage.pojo.vo.GameServerExcelVO;
|
|
|
import com.zanxiang.game.module.manage.pojo.vo.GameServerListVO;
|
|
|
import com.zanxiang.game.module.manage.pojo.vo.GameServerVO;
|
|
|
import com.zanxiang.game.module.manage.service.*;
|
|
@@ -29,6 +30,7 @@ import com.zanxiang.game.module.mybatis.mapper.GameServerMapper;
|
|
|
import com.zanxiang.module.util.bean.BeanUtil;
|
|
|
import com.zanxiang.module.util.excel.ExcelUtil;
|
|
|
import com.zanxiang.module.util.exception.BaseException;
|
|
|
+import com.zanxiang.module.web.util.WebExcelUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.apache.logging.log4j.util.Strings;
|
|
@@ -38,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import reactor.util.function.Tuple2;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
@@ -301,6 +304,45 @@ public class GameServerServiceImpl extends ServiceImpl<GameServerMapper, GameSer
|
|
|
).convert(this::toVo);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void getGameServerExcel(GameServerListParam param, HttpServletResponse response) {
|
|
|
+ //游戏获取
|
|
|
+ Tuple2<String, List<Long>> gameTuple = gameAuthService.getUserGameList(null);
|
|
|
+ List<Long> gameIdList = gameTuple.getT2();
|
|
|
+ if (CollectionUtils.isEmpty(gameIdList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //不包含参数游戏
|
|
|
+ if (param.getGameId() != null && !gameIdList.contains(param.getGameId())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Long gameId = null;
|
|
|
+ if (param.getGameId() != null) {
|
|
|
+ GameDTO gameDTO = gameService.getById(param.getGameId());
|
|
|
+ if (gameDTO == null || gameDTO.getSuperGameId() == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ gameId = gameDTO.getSuperGameId();
|
|
|
+ }
|
|
|
+ final Long superGameId = gameId;
|
|
|
+ //excel下载
|
|
|
+ WebExcelUtil.httpExport(response, "游戏区服", GameServerExcelVO.class, ((pageNumber, pageSize) -> {
|
|
|
+ //查询订单
|
|
|
+ List<GameServer> gameServerList = page(new Page<>(pageNumber, pageSize),
|
|
|
+ new QueryWrapper<GameServer>().lambda()
|
|
|
+ .eq(Strings.isNotBlank(param.getServerId()), GameServer::getServerId, param.getServerId())
|
|
|
+ .eq(superGameId != null, GameServer::getGameId, superGameId)
|
|
|
+ .like(Strings.isNotBlank(param.getServerName()), GameServer::getServerName, param.getServerName())
|
|
|
+ .like(Strings.isNotBlank(param.getNickName()), GameServer::getNickName, param.getNickName())
|
|
|
+ .ge(param.getStartTime() != null, GameServer::getStartTime, param.getStartTime() == null ? null : LocalDateTime.of(param.getStartTime(), LocalTime.MIN))
|
|
|
+ .le(param.getEndTime() != null, GameServer::getStartTime, param.getEndTime() == null ? null : LocalDateTime.of(param.getEndTime(), LocalTime.MAX))
|
|
|
+ .eq(param.getIsSourceServer() != null, GameServer::getIsSourceServer, param.getIsSourceServer())
|
|
|
+ .orderByDesc(GameServer::getCreateTime)).getRecords();
|
|
|
+ //excel字段赋值
|
|
|
+ return gameServerList.stream().map(gameServer -> BeanUtil.copy(gameServer, GameServerExcelVO.class)).collect(Collectors.toList());
|
|
|
+ }), ExcelUtil.DEFAULT_MAX_DATA_SIZE);
|
|
|
+ }
|
|
|
+
|
|
|
private GameServerListVO toVo(GameServer gameServer) {
|
|
|
if (Objects.isNull(gameServer)) {
|
|
|
return null;
|