This commit is contained in:
2025-08-18 10:44:55 +08:00
parent f0e915783d
commit 952096471a
3 changed files with 45 additions and 3 deletions

View File

@@ -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<PageResult<GameUserDataDetailVo>> userTotalV2(String erbanNoStr, String channel, String gameId, BasePageParams params) {
PageResult<GameUserDataDetailVo> 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<GameUserDataDetailVo> 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({

View File

@@ -25,6 +25,9 @@ public interface GameDayStatDataService extends IService<GameDayStatData> {
PageResult<GameUserDataDetailVo> userTotal(String erbanNoStr,
String channel, String gameId, String startDate, String endDate, Integer partitionId, Integer pageNo, Integer pageSize);
PageResult<GameUserDataDetailVo> userTotalV2(String erbanNoStr,
String channel, String gameId, String startDate, String endDate, Integer partitionId, Integer pageNo, Integer pageSize);
List<GameUserDataDetailVo> userListOffset7and14(String erbanNoStr,
String channel, String gameId, Integer partitionId);

View File

@@ -210,14 +210,19 @@ public class GameDayStatDataServiceImpl extends ServiceImpl<GameDayStatDataMappe
@Override
public PageResult<GameUserDataDetailVo> 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<GameUserDataDetailVo> 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<Long> uids = new ArrayList<>();
if (StringUtils.isEmpty(erbanNoStr)) {
throw new AdminServiceException("请输入用户ID");
}
String[] split = erbanNoStr.trim().split(SymbolConstants.COMMA);
List<Long> erbanNos = Arrays.stream(split).map(Long::valueOf).collect(Collectors.toList());
for (Long erbanNo : erbanNos) {
@@ -299,6 +304,8 @@ public class GameDayStatDataServiceImpl extends ServiceImpl<GameDayStatDataMappe
return pageResult;
}
@Override
public List<GameUserDataDetailVo> userListOffset7and14(String erbanNoStr, String channel, String gameId, Integer partitionId) {
GameConstant.GameChannel byChannel = GameConstant.GameChannel.getByChannel(channel);