From 952096471a64af6868f663eb53f679a325edfa3e Mon Sep 17 00:00:00 2001 From: hokli <2629910752@qq.com> Date: Mon, 18 Aug 2025 10:44:55 +0800 Subject: [PATCH] gamedata --- .../game/GameDataAdminController.java | 32 +++++++++++++++++++ .../service/game/GameDayStatDataService.java | 3 ++ .../game/impl/GameDayStatDataServiceImpl.java | 13 ++++++-- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/accompany-admin/accompany-admin-web/src/main/java/com/accompany/admin/controller/game/GameDataAdminController.java b/accompany-admin/accompany-admin-web/src/main/java/com/accompany/admin/controller/game/GameDataAdminController.java index 9825ab7b9..8950d1db5 100644 --- a/accompany-admin/accompany-admin-web/src/main/java/com/accompany/admin/controller/game/GameDataAdminController.java +++ b/accompany-admin/accompany-admin-web/src/main/java/com/accompany/admin/controller/game/GameDataAdminController.java @@ -81,6 +81,19 @@ public class GameDataAdminController extends BaseController { return BusiResult.success(gameUserDataDetailVoPageResult); } + @ApiOperation(value = "Game用户汇总", httpMethod = "GET") + @ApiImplicitParams({ + @ApiImplicitParam(name = "erbanNoStr", value = "用户id,逗号隔开", required = false), + @ApiImplicitParam(name = "channel", value = "第三方名称,LEADERCC-灵,BAISHUN-百顺", required = true), + @ApiImplicitParam(name = "gameId", value = "游戏id", required = false), + }) + @GetMapping("/v2/user/total") + public BusiResult> userTotalV2(String erbanNoStr, String channel, String gameId, BasePageParams params) { + PageResult gameUserDataDetailVoPageResult = gameDayStatDataService.userTotalV2(erbanNoStr, channel, gameId, params.getStartTime(), params.getEndTime(), + params.getPartitionId(), params.getPageNo(), params.getPageSize()); + return BusiResult.success(gameUserDataDetailVoPageResult); + } + @ApiOperation(value = "Game用户汇总(近七天,14天的数据,)", httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(name = "erbanNoStr", value = "用户id,逗号隔开", required = false), @@ -113,6 +126,25 @@ public class GameDataAdminController extends BaseController { EasyExcel.write(response.getOutputStream(), GameUserDataDetailVo.class).sheet("Game用户汇总").doWrite(gameDataTotalVoPageResult.getRows()); } + @ApiOperation(value = "Game用户汇总导出", httpMethod = "POST") + @ApiImplicitParams({ + @ApiImplicitParam(name = "erbanNoStr", value = "用户id,逗号隔开", required = false), + @ApiImplicitParam(name = "channel", value = "第三方名称,LEADERCC-灵,BAISHUN-百顺", required = true), + @ApiImplicitParam(name = "gameId", value = "游戏id", required = false), + }) + @PostMapping("/v2/user/export") + public void userExportv2(HttpServletResponse response, String erbanNoStr, String channel, String gameId, BasePageParams params) throws IOException { + params.setPageSize(100000); + PageResult gameDataTotalVoPageResult = gameDayStatDataService.userTotalV2(erbanNoStr, channel, gameId, params.getStartTime(), params.getEndTime(), + params.getPartitionId(), 0, -1); + response.setContentType("application/vnd.ms-excel"); + response.setCharacterEncoding("utf-8"); + // 这里URLEncoder.encode可以防止中文乱码 + String excelName = URLEncoder.encode("Game用户汇总", StandardCharsets.UTF_8); + response.setHeader("Content-disposition", "attachment;filename=" + excelName + ExcelTypeEnum.XLSX.getValue()); + EasyExcel.write(response.getOutputStream(), GameUserDataDetailVo.class).sheet("Game用户汇总").doWrite(gameDataTotalVoPageResult.getRows()); + } + @ApiOperation(value = "游戏明细(参数同明细)", httpMethod = "GET") @ApiImplicitParams({ diff --git a/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/game/GameDayStatDataService.java b/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/game/GameDayStatDataService.java index 55b172b36..234cdd4a7 100644 --- a/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/game/GameDayStatDataService.java +++ b/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/game/GameDayStatDataService.java @@ -25,6 +25,9 @@ public interface GameDayStatDataService extends IService { PageResult userTotal(String erbanNoStr, String channel, String gameId, String startDate, String endDate, Integer partitionId, Integer pageNo, Integer pageSize); + PageResult userTotalV2(String erbanNoStr, + String channel, String gameId, String startDate, String endDate, Integer partitionId, Integer pageNo, Integer pageSize); + List userListOffset7and14(String erbanNoStr, String channel, String gameId, Integer partitionId); diff --git a/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/game/impl/GameDayStatDataServiceImpl.java b/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/game/impl/GameDayStatDataServiceImpl.java index 2030f00ed..01379b8b7 100644 --- a/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/game/impl/GameDayStatDataServiceImpl.java +++ b/accompany-business/accompany-business-service/src/main/java/com/accompany/business/service/game/impl/GameDayStatDataServiceImpl.java @@ -210,14 +210,19 @@ public class GameDayStatDataServiceImpl extends ServiceImpl userTotal(String erbanNoStr, String channel, String gameId, String startDate, String endDate, Integer partitionId, Integer pageNo, Integer pageSize) { + if (StringUtils.isEmpty(erbanNoStr)) { + throw new AdminServiceException("请输入用户ID"); + } + return userTotalV2(erbanNoStr, channel, gameId, startDate, endDate, partitionId, pageNo, pageSize); + } + + @Override + public PageResult userTotalV2(String erbanNoStr, String channel, String gameId, String startDate, String endDate, Integer partitionId, Integer pageNo, Integer pageSize) { GameConstant.GameChannel byChannel = GameConstant.GameChannel.getByChannel(channel); if (byChannel == null) { throw new AdminServiceException("请选择第三方名称"); } List uids = new ArrayList<>(); - if (StringUtils.isEmpty(erbanNoStr)) { - throw new AdminServiceException("请输入用户ID"); - } String[] split = erbanNoStr.trim().split(SymbolConstants.COMMA); List erbanNos = Arrays.stream(split).map(Long::valueOf).collect(Collectors.toList()); for (Long erbanNo : erbanNos) { @@ -299,6 +304,8 @@ public class GameDayStatDataServiceImpl extends ServiceImpl userListOffset7and14(String erbanNoStr, String channel, String gameId, Integer partitionId) { GameConstant.GameChannel byChannel = GameConstant.GameChannel.getByChannel(channel);