后台-小游戏-灵-抽水
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.accompany.business.vo.game;
|
||||
package com.accompany.admin.vo.game;
|
||||
|
||||
import com.accompany.business.model.game.GameFeeRateConfig;
|
||||
import lombok.Data;
|
||||
@@ -14,7 +14,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class GameFeeRateConfigVO extends GameFeeRateConfig {
|
||||
public class GameFeeRateConfigAdminVo extends GameFeeRateConfig {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long erbanNo;
|
@@ -0,0 +1,31 @@
|
||||
package com.accompany.admin.vo.game;
|
||||
|
||||
import com.accompany.business.model.game.GameFeeRateConfig;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 游戏抽水配置视图实体类
|
||||
*
|
||||
* @author
|
||||
* @since 2025-02-12
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class GameFeeRateUserRechargeLevelConfigAdminVo {
|
||||
|
||||
private String userRechargeLevel;
|
||||
private String channel;
|
||||
private String channelName;
|
||||
private String gameId;
|
||||
private String gameName;
|
||||
private Double feeRate;
|
||||
|
||||
private String updateTime;
|
||||
|
||||
private Integer adminId;
|
||||
private String adminName;
|
||||
|
||||
}
|
@@ -2,14 +2,12 @@ package com.accompany.admin.service.game;
|
||||
|
||||
import com.accompany.admin.model.AdminUser;
|
||||
import com.accompany.admin.service.system.AdminUserService;
|
||||
import com.accompany.admin.vo.guild.GuildApplyAuditVo;
|
||||
import com.accompany.business.model.game.GameFeeRateConfig;
|
||||
import com.accompany.business.model.guild.GuildApply;
|
||||
import com.accompany.business.service.game.GameFeeRateConfigService;
|
||||
import com.accompany.business.service.game.GameService;
|
||||
import com.accompany.business.service.user.UsersService;
|
||||
import com.accompany.business.vo.game.GameConfigVO;
|
||||
import com.accompany.business.vo.game.GameFeeRateConfigVO;
|
||||
import com.accompany.admin.vo.game.GameFeeRateConfigAdminVo;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.result.PageResult;
|
||||
@@ -41,7 +39,7 @@ public class GameFeeRateConfigAdminService {
|
||||
@Autowired
|
||||
private UserRechargeLevelService userRechargeLevelService;
|
||||
|
||||
public BusiResult<PageResult<GameFeeRateConfigVO>> feeRateList(String channel, Long erbanNo, Integer pageNo, Integer pageSize, Byte validStatus) {
|
||||
public BusiResult<PageResult<GameFeeRateConfigAdminVo>> feeRateList(String channel, Long erbanNo, Integer pageNo, Integer pageSize, Byte validStatus) {
|
||||
Long uid = null;
|
||||
if (erbanNo != null) {
|
||||
Users user = usersService.getUserByErbanNo(erbanNo);
|
||||
@@ -59,9 +57,9 @@ public class GameFeeRateConfigAdminService {
|
||||
wrapper.eq(GameFeeRateConfig::getValidStatus, validStatus);
|
||||
}
|
||||
Page<GameFeeRateConfig> page = gameFeeRateConfigService.getBaseMapper().selectPage(new Page<>(pageNo, pageSize), wrapper);
|
||||
PageResult<GameFeeRateConfigVO> pageResult = new PageResult<>();
|
||||
PageResult<GameFeeRateConfigAdminVo> pageResult = new PageResult<>();
|
||||
pageResult.setTotal((int)page.getTotal());
|
||||
List<GameFeeRateConfigVO> list = new ArrayList<>();
|
||||
List<GameFeeRateConfigAdminVo> list = new ArrayList<>();
|
||||
pageResult.setRows(list);
|
||||
List<GameFeeRateConfig> records = page.getRecords();
|
||||
if (CollectionUtils.isEmpty(records)) {
|
||||
@@ -91,25 +89,25 @@ public class GameFeeRateConfigAdminService {
|
||||
Map<String, String> gameNameMap = gameService.getConfigGameList().stream().collect(Collectors.toMap(GameConfigVO::getGameId, GameConfigVO::getGameName));
|
||||
|
||||
for (GameFeeRateConfig record : records) {
|
||||
GameFeeRateConfigVO gameFeeRateConfigVO = new GameFeeRateConfigVO();
|
||||
BeanUtils.copyProperties(record, gameFeeRateConfigVO);
|
||||
gameFeeRateConfigVO.setGameName(gameNameMap.get(record.getGameId()));
|
||||
GameFeeRateConfigAdminVo gameFeeRateConfigAdminVO = new GameFeeRateConfigAdminVo();
|
||||
BeanUtils.copyProperties(record, gameFeeRateConfigAdminVO);
|
||||
gameFeeRateConfigAdminVO.setGameName(gameNameMap.get(record.getGameId()));
|
||||
|
||||
Users users = usersMap.get(record.getUid());
|
||||
if (users != null) {
|
||||
gameFeeRateConfigVO.setNick(users.getNick());
|
||||
gameFeeRateConfigVO.setErbanNo(users.getErbanNo());
|
||||
gameFeeRateConfigAdminVO.setNick(users.getNick());
|
||||
gameFeeRateConfigAdminVO.setErbanNo(users.getErbanNo());
|
||||
}
|
||||
|
||||
gameFeeRateConfigVO.setUserRechargeLevel(userRechargeLevelMap.get(record.getUid()));
|
||||
gameFeeRateConfigAdminVO.setUserRechargeLevel(userRechargeLevelMap.get(record.getUid()));
|
||||
|
||||
if (null != record.getInvalidAdminId()){
|
||||
AdminUser adminUser = adminUserMap.get(record.getInvalidAdminId());
|
||||
if (null != adminUser){
|
||||
gameFeeRateConfigVO.setAdminName(adminUser.getUsername());
|
||||
gameFeeRateConfigAdminVO.setAdminName(adminUser.getUsername());
|
||||
}
|
||||
}
|
||||
list.add(gameFeeRateConfigVO);
|
||||
list.add(gameFeeRateConfigAdminVO);
|
||||
}
|
||||
return BusiResult.success(pageResult);
|
||||
}
|
||||
|
@@ -0,0 +1,120 @@
|
||||
|
||||
package com.accompany.admin.service.game;
|
||||
|
||||
import com.accompany.admin.model.AdminUser;
|
||||
import com.accompany.admin.service.system.AdminUserService;
|
||||
import com.accompany.admin.vo.game.GameFeeRateUserRechargeLevelConfigAdminVo;
|
||||
import com.accompany.business.model.game.GameFeeRateUserRechargeLevelConfig;
|
||||
import com.accompany.business.service.game.GameFeeRateUserRechargeLevelConfigService;
|
||||
import com.accompany.business.service.game.GameService;
|
||||
import com.accompany.business.vo.game.GameConfigVO;
|
||||
import com.accompany.common.constant.GameConstant;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.core.exception.AdminServiceException;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class GameFeeRateUserRechargeLevelConfigAdminService {
|
||||
|
||||
@Autowired
|
||||
private AdminUserService adminUserService;
|
||||
@Autowired
|
||||
private GameService gameService;
|
||||
@Autowired
|
||||
private GameFeeRateUserRechargeLevelConfigService service;
|
||||
|
||||
public Page<GameFeeRateUserRechargeLevelConfigAdminVo> page(String userRechargeLevel, String channel, String gameId,
|
||||
Integer pageNo, Integer pageSize) {
|
||||
Page<GameFeeRateUserRechargeLevelConfigAdminVo> voPage = new Page<>(pageNo, pageSize);
|
||||
|
||||
Page<GameFeeRateUserRechargeLevelConfig> doPage = new Page<>(pageNo, pageSize);
|
||||
|
||||
LambdaQueryWrapper<GameFeeRateUserRechargeLevelConfig> wrapper = Wrappers.<GameFeeRateUserRechargeLevelConfig>lambdaQuery()
|
||||
.eq(StringUtils.hasText(userRechargeLevel), GameFeeRateUserRechargeLevelConfig::getUserRechargeLevel, userRechargeLevel)
|
||||
.eq(StringUtils.hasText(channel), GameFeeRateUserRechargeLevelConfig::getChannel, channel)
|
||||
.eq(StringUtils.hasText(gameId), GameFeeRateUserRechargeLevelConfig::getGameId, gameId);
|
||||
|
||||
service.page(doPage, wrapper);
|
||||
|
||||
if (CollectionUtils.isEmpty(doPage.getRecords())){
|
||||
return voPage;
|
||||
}
|
||||
|
||||
List<Integer> adminIdList = doPage.getRecords().stream().map(GameFeeRateUserRechargeLevelConfig::getAdminId).collect(Collectors.toList());
|
||||
|
||||
Map<Integer, AdminUser> adminUserMap = CollectionUtils.isNotEmpty(adminIdList)?
|
||||
adminUserService.adminUserMap(adminIdList):
|
||||
Collections.emptyMap();
|
||||
|
||||
Map<String, String> gameNameMap = gameService.getConfigGameList().stream().collect(Collectors.toMap(GameConfigVO::getGameId, GameConfigVO::getGameName));
|
||||
gameNameMap.put(GameService.ALL, "全部");
|
||||
|
||||
List<GameFeeRateUserRechargeLevelConfigAdminVo> voList = doPage.getRecords().stream()
|
||||
.map(record -> {
|
||||
GameFeeRateUserRechargeLevelConfigAdminVo vo = new GameFeeRateUserRechargeLevelConfigAdminVo();
|
||||
vo.setUserRechargeLevel(record.getUserRechargeLevel());
|
||||
vo.setChannel(record.getChannel());
|
||||
vo.setChannelName(GameConstant.GameChannel.valueOf(record.getChannel()).getDesc());
|
||||
|
||||
vo.setGameId(record.getGameId());
|
||||
vo.setGameName(gameNameMap.get(record.getGameId()));
|
||||
vo.setFeeRate(record.getFeeRate());
|
||||
|
||||
vo.setUpdateTime(DateTimeUtil.convertDateTime(record.getUpdateTime()));
|
||||
|
||||
vo.setAdminId(record.getAdminId());
|
||||
|
||||
AdminUser adminUser = adminUserMap.get(record.getAdminId());
|
||||
if (adminUser != null) {
|
||||
vo.setAdminName(adminUser.getUsername());
|
||||
}
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
voPage.setTotal(doPage.getTotal());
|
||||
voPage.setRecords(voList);
|
||||
return voPage;
|
||||
}
|
||||
|
||||
public void save(String userRechargeLevel, String channel, String gameId, Double feeRate, Integer adminId) {
|
||||
if (feeRate == 0 || feeRate > 100) {
|
||||
throw new AdminServiceException("抽水比例不能为0并且不能大于100");
|
||||
}
|
||||
|
||||
GameFeeRateUserRechargeLevelConfig config = service.lambdaQuery()
|
||||
.eq(GameFeeRateUserRechargeLevelConfig::getUserRechargeLevel, userRechargeLevel)
|
||||
.eq(GameFeeRateUserRechargeLevelConfig::getChannel, channel)
|
||||
.eq(GameFeeRateUserRechargeLevelConfig::getGameId, gameId)
|
||||
.one();
|
||||
if (null == config){
|
||||
config = new GameFeeRateUserRechargeLevelConfig();
|
||||
config.setUserRechargeLevel(userRechargeLevel);
|
||||
config.setChannel(channel);
|
||||
config.setGameId(gameId);
|
||||
config.setFeeRate(feeRate);
|
||||
config.setUpdateTime(new Date());
|
||||
config.setAdminId(adminId);
|
||||
service.save(config);
|
||||
return;
|
||||
}
|
||||
|
||||
service.lambdaUpdate()
|
||||
.eq(GameFeeRateUserRechargeLevelConfig::getUserRechargeLevel, userRechargeLevel)
|
||||
.eq(GameFeeRateUserRechargeLevelConfig::getChannel, channel)
|
||||
.eq(GameFeeRateUserRechargeLevelConfig::getGameId, gameId)
|
||||
.set(GameFeeRateUserRechargeLevelConfig::getFeeRate, feeRate)
|
||||
.set(GameFeeRateUserRechargeLevelConfig::getUpdateTime, new Date())
|
||||
.set(GameFeeRateUserRechargeLevelConfig::getAdminId, adminId)
|
||||
.update();
|
||||
|
||||
}
|
||||
}
|
@@ -1,93 +1,43 @@
|
||||
package com.accompany.admin.controller.game;
|
||||
|
||||
import com.accompany.admin.controller.BaseController;
|
||||
import com.accompany.admin.service.game.GameFeeRateConfigAdminService;
|
||||
import com.accompany.business.service.game.GameService;
|
||||
import com.accompany.business.vo.game.GameConfigVO;
|
||||
import com.accompany.business.vo.game.GameFeeRateConfigVO;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.result.PageResult;
|
||||
import com.accompany.core.exception.AdminServiceException;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.Collections.EMPTY_LIST;
|
||||
|
||||
@Api(tags = "游戏抽水配置", value = "游戏抽水配置")
|
||||
@Api(tags = "游戏配置", value = "游戏配置")
|
||||
@RestController
|
||||
@RequestMapping("/admin/game")
|
||||
public class GameAdminController extends BaseController {
|
||||
@Autowired
|
||||
private GameFeeRateConfigAdminService gameFeeRateConfigAdminService;
|
||||
@Autowired
|
||||
private GameService gameService;
|
||||
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "erbanNo", value = "平台id", dataType = "LONG", required = true),
|
||||
@ApiImplicitParam(name = "validStatus", value = "1-有效,0-无效,-1全部", dataType = "LONG", required = true),
|
||||
@ApiImplicitParam(name = "pageNo", value = "pageNo", dataType = "LONG", required = true),
|
||||
@ApiImplicitParam(name = "pageSize", value = "pageSize", dataType = "LONG", required = true),
|
||||
})
|
||||
@ApiOperation(value = "游戏抽水配置-列表", httpMethod = "POST")
|
||||
@PostMapping("/feeRateList")
|
||||
public BusiResult<PageResult<GameFeeRateConfigVO>> feeRateList(@RequestParam(defaultValue = "LEADERCC") String channel, Long erbanNo, Byte validStatus,
|
||||
@RequestParam(defaultValue = "1") Integer pageNo, @RequestParam(defaultValue = "20") Integer pageSize) {
|
||||
|
||||
return gameFeeRateConfigAdminService.feeRateList(channel, erbanNo, pageNo, pageSize, validStatus);
|
||||
}
|
||||
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "erbanNo", value = "平台id", dataType = "LONG", required = true),
|
||||
@ApiImplicitParam(name = "gameId", value = "游戏id", dataType = "string", required = true ),
|
||||
@ApiImplicitParam(name = "gameFeeRate", value = "抽水比例", dataType = "double", required = true ),
|
||||
})
|
||||
@ApiOperation(value = "游戏抽水配置-保存", httpMethod = "POST")
|
||||
@PostMapping("/feeRate")
|
||||
public BusiResult<Void> feeRate(@RequestParam(defaultValue = "LEADERCC") String channel, @RequestParam Long erbanNo,
|
||||
@RequestParam String gameId, @RequestParam Double gameFeeRate) {
|
||||
List<GameConfigVO> configGameList = gameService.getConfigGameList();
|
||||
if (!"All".equals(gameId) && CollectionUtils.isEmpty(configGameList)
|
||||
&& CollectionUtils.isEmpty(configGameList.stream().filter(x -> x.getGameId().equals(gameId)).collect(Collectors.toList()))) {
|
||||
throw new AdminServiceException("游戏配置有误key=leadercc_game");
|
||||
}
|
||||
return gameFeeRateConfigAdminService.feeRate(channel, erbanNo, gameId, gameFeeRate, getAdminId());
|
||||
}
|
||||
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "平台id", dataType = "LONG", required = true),
|
||||
})
|
||||
@ApiOperation(value = "游戏抽水配置-失效", httpMethod = "GET")
|
||||
@GetMapping("/feeRate/invalid")
|
||||
public BusiResult<Void> invalid(@RequestParam Long id) {
|
||||
return gameFeeRateConfigAdminService.feeRateInvalid(id, getAdminId());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "游戏列表", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public BusiResult<List<GameConfigVO>> list(@RequestParam(defaultValue = "LEADERCC") String channel) {
|
||||
List<GameConfigVO> configGameList = gameService.getAllConfigGameList(channel);
|
||||
if (CollectionUtils.isEmpty(configGameList)) {
|
||||
return BusiResult.success(EMPTY_LIST);
|
||||
return BusiResult.success(Collections.emptyList());
|
||||
}
|
||||
boolean containAll = false;
|
||||
for (GameConfigVO gameConfigVO : configGameList) {
|
||||
if (gameConfigVO.getGameName().trim().contains("全部")) {
|
||||
gameConfigVO.setGameId(gameService.ALL);
|
||||
gameConfigVO.setGameId(GameService.ALL);
|
||||
containAll = true;
|
||||
}
|
||||
}
|
||||
if (!containAll) {
|
||||
GameConfigVO gameConfigVO = new GameConfigVO();
|
||||
gameConfigVO.setGameId(gameService.ALL);
|
||||
gameConfigVO.setGameName(gameService.ALL);
|
||||
gameConfigVO.setGameId(GameService.ALL);
|
||||
gameConfigVO.setGameName(GameService.ALL);
|
||||
configGameList.add(0, gameConfigVO);
|
||||
}
|
||||
return BusiResult.success(configGameList);
|
||||
|
@@ -0,0 +1,71 @@
|
||||
package com.accompany.admin.controller.game;
|
||||
|
||||
import com.accompany.admin.controller.BaseController;
|
||||
import com.accompany.admin.service.game.GameFeeRateConfigAdminService;
|
||||
import com.accompany.business.service.game.GameService;
|
||||
import com.accompany.business.vo.game.GameConfigVO;
|
||||
import com.accompany.admin.vo.game.GameFeeRateConfigAdminVo;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.result.PageResult;
|
||||
import com.accompany.core.exception.AdminServiceException;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Api(tags = "游戏抽水配置", value = "游戏抽水配置")
|
||||
@RestController
|
||||
@RequestMapping("/admin/game/feeRate")
|
||||
public class GameFeeRateAdminController extends BaseController {
|
||||
@Autowired
|
||||
private GameFeeRateConfigAdminService gameFeeRateConfigAdminService;
|
||||
@Autowired
|
||||
private GameService gameService;
|
||||
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "erbanNo", value = "平台id", dataType = "LONG", required = true),
|
||||
@ApiImplicitParam(name = "validStatus", value = "1-有效,0-无效,-1全部", dataType = "LONG", required = true),
|
||||
@ApiImplicitParam(name = "pageNo", value = "pageNo", dataType = "LONG", required = true),
|
||||
@ApiImplicitParam(name = "pageSize", value = "pageSize", dataType = "LONG", required = true),
|
||||
})
|
||||
@ApiOperation(value = "游戏抽水配置-列表", httpMethod = "POST")
|
||||
@PostMapping("/list")
|
||||
public BusiResult<PageResult<GameFeeRateConfigAdminVo>> feeRateList(@RequestParam(defaultValue = "LEADERCC") String channel, Long erbanNo, Byte validStatus,
|
||||
@RequestParam(defaultValue = "1") Integer pageNo, @RequestParam(defaultValue = "20") Integer pageSize) {
|
||||
|
||||
return gameFeeRateConfigAdminService.feeRateList(channel, erbanNo, pageNo, pageSize, validStatus);
|
||||
}
|
||||
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "erbanNo", value = "平台id", dataType = "LONG", required = true),
|
||||
@ApiImplicitParam(name = "gameId", value = "游戏id", dataType = "string", required = true ),
|
||||
@ApiImplicitParam(name = "gameFeeRate", value = "抽水比例", dataType = "double", required = true ),
|
||||
})
|
||||
@ApiOperation(value = "游戏抽水配置-保存", httpMethod = "POST")
|
||||
@PostMapping("/save")
|
||||
public BusiResult<Void> feeRate(@RequestParam(defaultValue = "LEADERCC") String channel, @RequestParam Long erbanNo,
|
||||
@RequestParam String gameId, @RequestParam Double gameFeeRate) {
|
||||
List<GameConfigVO> configGameList = gameService.getConfigGameList();
|
||||
if (!"All".equals(gameId) && CollectionUtils.isEmpty(configGameList)
|
||||
&& CollectionUtils.isEmpty(configGameList.stream().filter(x -> x.getGameId().equals(gameId)).collect(Collectors.toList()))) {
|
||||
throw new AdminServiceException("游戏配置有误key=leadercc_game");
|
||||
}
|
||||
return gameFeeRateConfigAdminService.feeRate(channel, erbanNo, gameId, gameFeeRate, getAdminId());
|
||||
}
|
||||
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "平台id", dataType = "LONG", required = true),
|
||||
})
|
||||
@ApiOperation(value = "游戏抽水配置-失效", httpMethod = "GET")
|
||||
@GetMapping("/invalid")
|
||||
public BusiResult<Void> invalid(@RequestParam Long id) {
|
||||
return gameFeeRateConfigAdminService.feeRateInvalid(id, getAdminId());
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
package com.accompany.admin.controller.game;
|
||||
|
||||
import com.accompany.admin.controller.BaseController;
|
||||
import com.accompany.admin.service.game.GameFeeRateUserRechargeLevelConfigAdminService;
|
||||
import com.accompany.admin.vo.game.GameFeeRateUserRechargeLevelConfigAdminVo;
|
||||
import com.accompany.business.service.game.GameService;
|
||||
import com.accompany.business.vo.game.GameConfigVO;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.result.PageResult;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.core.exception.AdminServiceException;
|
||||
import com.accompany.core.util.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Api(tags = "游戏用户充值等级抽水配置", value = "游戏用户充值等级抽水配置")
|
||||
@RestController
|
||||
@RequestMapping("/admin/game/feeRateUserRechargeLevel")
|
||||
public class GameFeeRateUserRechargeLevelAdminController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private GameService gameService;
|
||||
@Autowired
|
||||
private GameFeeRateUserRechargeLevelConfigAdminService service;
|
||||
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "erbanNo", value = "平台id", dataType = "LONG", required = true),
|
||||
@ApiImplicitParam(name = "validStatus", value = "1-有效,0-无效,-1全部", dataType = "LONG", required = true),
|
||||
@ApiImplicitParam(name = "pageNo", value = "pageNo", dataType = "LONG", required = true),
|
||||
@ApiImplicitParam(name = "pageSize", value = "pageSize", dataType = "LONG", required = true),
|
||||
})
|
||||
@ApiOperation(value = "游戏抽水配置-列表", httpMethod = "GET")
|
||||
@GetMapping("/page")
|
||||
public BusiResult<PageResult<GameFeeRateUserRechargeLevelConfigAdminVo>> feeRateList(String userRechargeLevel, @RequestParam(defaultValue = "LEADERCC") String channel, String gameId,
|
||||
Integer pageNo, Integer pageSize) {
|
||||
Page<GameFeeRateUserRechargeLevelConfigAdminVo> page = service.page(userRechargeLevel, channel, gameId, pageNo, pageSize);
|
||||
return BusiResult.success(new PageResult<>(page));
|
||||
}
|
||||
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "erbanNo", value = "平台id", dataType = "LONG", required = true),
|
||||
@ApiImplicitParam(name = "gameId", value = "游戏id", dataType = "string", required = true ),
|
||||
@ApiImplicitParam(name = "gameFeeRate", value = "抽水比例", dataType = "double", required = true ),
|
||||
})
|
||||
@ApiOperation(value = "游戏抽水配置-保存", httpMethod = "POST")
|
||||
@PostMapping("/save")
|
||||
public BusiResult<Void> feeRate(String userRechargeLevel, @RequestParam(defaultValue = "LEADERCC") String channel,
|
||||
String gameId, Double feeRate) {
|
||||
if (StringUtils.isAnyBlank(userRechargeLevel, channel, gameId) || null == feeRate){
|
||||
throw new AdminServiceException(BusiStatus.PARAMERROR);
|
||||
}
|
||||
|
||||
List<GameConfigVO> configGameList = gameService.getConfigGameList();
|
||||
if (GameService.ALL.equals(gameId) && CollectionUtils.isEmpty(configGameList)
|
||||
&& CollectionUtils.isEmpty(configGameList.stream().filter(x -> x.getGameId().equals(gameId)).collect(Collectors.toList()))) {
|
||||
throw new AdminServiceException("游戏配置有误key=leadercc_game");
|
||||
}
|
||||
|
||||
service.save(userRechargeLevel, channel, gameId, feeRate, getAdminId());
|
||||
return BusiResult.success();
|
||||
}
|
||||
|
||||
}
|
@@ -24,23 +24,11 @@ public class GameFeeRateUserRechargeLevelConfig {
|
||||
* 抽水比例
|
||||
*/
|
||||
private Double feeRate;
|
||||
/**
|
||||
* 状态0-失效,1-有效
|
||||
*/
|
||||
private Byte validStatus;
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 操作人
|
||||
*/
|
||||
private Integer adminId;
|
||||
/**
|
||||
* 失效时间
|
||||
*/
|
||||
private Date invalidTime;
|
||||
|
||||
/**
|
||||
* 失效操作人
|
||||
*/
|
||||
private Integer invalidAdminId;
|
||||
|
||||
}
|
||||
|
@@ -31,7 +31,6 @@ public class GameFeeRateUserRechargeLevelConfigService extends ServiceImpl<GameF
|
||||
.eq(GameFeeRateUserRechargeLevelConfig::getUserRechargeLevel, userRechargeLevel)
|
||||
.eq(GameFeeRateUserRechargeLevelConfig::getChannel, channel)
|
||||
.in(GameFeeRateUserRechargeLevelConfig::getGameId, List.of(gameId, GameService.ALL))
|
||||
.eq(GameFeeRateUserRechargeLevelConfig::getValidStatus, Constant.StatusV2.valid)
|
||||
.list();
|
||||
if (CollectionUtils.isEmpty(configList)){
|
||||
return null;
|
||||
|
@@ -33,6 +33,7 @@ import org.redisson.client.codec.StringCodec;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@@ -216,7 +217,7 @@ public class GameService {
|
||||
if (StringUtils.isNotEmpty(confValueById)) {
|
||||
return JSONObject.parseArray(confValueById, GameConfigVO.class);
|
||||
}
|
||||
return EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private Boolean checkGameId(String gameId) {
|
||||
|
Reference in New Issue
Block a user