refactor(ff-game): 重构游戏模块代码

- 更新了多个类中的服务接口引用
- 重命名了部分接口和类,如 IPlatformService 改为 IPlatformBiz
- 调整了部分代码结构,提高了代码的可读性和可维护性
main-pp
shi 2025-04-12 15:06:38 +08:00
parent d1be064c7b
commit 01178478e0
18 changed files with 81 additions and 31 deletions

View File

@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil;
import com.ff.game.domain.GameExchangeMoney;
import com.ff.game.mapper.GameExchangeMoneyMapper;
import com.ff.game.service.IGameExchangeMoneyService;
import com.ff.utils.DateUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,8 +1,9 @@
package com.ff.exception;
import com.ff.base.enums.ErrorCode;
import com.sun.istack.internal.Nullable;
import enums.ErrorCode;
import lombok.Getter;
import org.springframework.lang.Nullable;
/**
*

View File

@ -1,4 +1,4 @@
package com.ff.enums;
package enums;
import lombok.Getter;

View File

@ -83,7 +83,7 @@ public class ApiGameController extends BaseController {
private IMemberService memberService;
@Resource
private ITenantGameQuotaService tenantGameQuotaService;
private ITenantGameQuotaBiz tenantGameQuotaService;
@Resource
private ITenantGameQuotaBiz tenantGameQuotaBiz;

View File

@ -0,0 +1,25 @@
package com.ff.base.enums;
import com.alibaba.druid.filter.AutoLoad;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
*
* @author shi
* @date 2025/04/09
*/
@AllArgsConstructor
@Getter
public enum TimeOutType {
GAME_EXCHANGE_MONEY("gameExchangeMoney", "游戏余额转移");
/**
*
*/
private final String code;
/**
*
*/
private final String info;
}

View File

@ -0,0 +1,20 @@
package com.ff.base.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
*
* @author shi
* @date 2025/04/09
*/
@Getter
@AllArgsConstructor
public enum TriggerType {
MANUAL(1, "用户调用手动触发"),
TIMER(2, "定时器触发");
private final int code;
private final String description;
}

View File

@ -16,6 +16,7 @@ import com.ff.game.api.db.dto.*;
import com.ff.game.api.request.*;
import com.ff.game.domain.*;
import com.ff.game.service.IGameBettingDetailsService;
import com.ff.game.service.IGameExchangeMoneyBiz;
import com.ff.game.service.IGameExchangeMoneyService;
import com.ff.game.service.IGameService;
import com.ff.member.domain.Member;
@ -54,6 +55,8 @@ public class DBSportsServiceImpl implements IGamesService {
@Resource
private IGameService gameService;
@Resource
private IGameExchangeMoneyBiz gameExchangeMoneyBiz;
@Resource
@ -221,7 +224,7 @@ public class DBSportsServiceImpl implements IGamesService {
*/
@Override
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
return gameExchangeMoneyService.getTransactionId(GamePlatforms.DBSports.getInfo(), 11);
return gameExchangeMoneyBiz.getTransactionId(GamePlatforms.DBSports.getInfo(), 11);
}
/**

View File

@ -7,8 +7,6 @@ import com.ff.base.utils.StringUtils;
import com.ff.common.domain.TenantGameQuotaFlow;
import com.ff.common.dto.BalanceChangesDTO;
import com.ff.common.dto.GameBalanceExchange;
import com.ff.common.service.ITenantGameQuotaFlowService;
import com.ff.common.service.ITenantGameQuotaService;
import com.ff.game.api.IGamesService;
import com.ff.game.api.exchange.AbstractStepProcessor;
import com.ff.game.api.exchange.dto.GameExchangeDTO;
@ -18,9 +16,12 @@ import com.ff.game.api.request.ExchangeTransferStatusResponseDTO;
import com.ff.game.domain.KeyInfo;
import com.ff.game.domain.Platform;
import com.ff.game.service.IGameExchangeMoneyService;
import com.ff.game.service.IPlatformBiz;
import com.ff.game.service.IPlatformService;
import com.ff.member.domain.Member;
import com.ff.member.service.IMemberService;
import com.ff.tenant.service.ITenantGameQuotaBiz;
import com.ff.tenant.service.ITenantGameQuotaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;
@ -49,13 +50,13 @@ public class AddBalanceServiceImpl extends AbstractStepProcessor {
private IMemberService memberService;
@Resource
private ITenantGameQuotaService tenantGameQuotaService;
private ITenantGameQuotaBiz tenantGameQuotaService;
@Resource
private IGameExchangeMoneyService gameExchangeMoneyService;
@Resource
private PlatformTransactionManager transactionManager;
@Resource
private IPlatformService platformService;
private IPlatformBiz platformService;
/**
*
*

View File

@ -11,8 +11,6 @@ import com.ff.common.domain.TenantGameQuota;
import com.ff.common.domain.TenantGameQuotaFlow;
import com.ff.common.dto.BalanceChangesDTO;
import com.ff.common.dto.GameBalanceExchange;
import com.ff.common.service.ITenantGameQuotaFlowService;
import com.ff.common.service.ITenantGameQuotaService;
import com.ff.game.api.exchange.AbstractStepProcessor;
import com.ff.game.api.exchange.StepProcessorFactory;
import com.ff.game.api.exchange.dto.GameExchangeDTO;
@ -20,8 +18,12 @@ import com.ff.game.domain.GameExchangeMoney;
import com.ff.game.domain.KeyInfo;
import com.ff.game.domain.Platform;
import com.ff.game.service.IGameExchangeMoneyService;
import com.ff.game.service.IPlatformBiz;
import com.ff.game.service.IPlatformService;
import com.ff.member.service.IMemberService;
import com.ff.tenant.service.ITenantGameQuotaBiz;
import com.ff.tenant.service.ITenantGameQuotaFlowService;
import com.ff.tenant.service.ITenantGameQuotaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;
@ -49,13 +51,13 @@ public class DeductBalanceServiceImpl extends AbstractStepProcessor {
private IGameExchangeMoneyService gameExchangeMoneyService;
@Resource
private ITenantGameQuotaService tenantGameQuotaService;
private ITenantGameQuotaBiz tenantGameQuotaService;
@Resource
private IMemberService memberService;
@Resource
private IPlatformService platformService;
private IPlatformBiz platformService;
@Resource
private ITenantGameQuotaFlowService tenantGameQuotaFlowService;
@Autowired

View File

@ -7,8 +7,6 @@ import com.ff.base.utils.StringUtils;
import com.ff.common.domain.TenantGameQuotaFlow;
import com.ff.common.dto.BalanceChangesDTO;
import com.ff.common.dto.GameBalanceExchange;
import com.ff.common.service.ITenantGameQuotaFlowService;
import com.ff.common.service.ITenantGameQuotaService;
import com.ff.game.api.IGamesService;
import com.ff.game.api.exchange.AbstractStepProcessor;
import com.ff.game.api.exchange.dto.GameExchangeDTO;
@ -19,6 +17,7 @@ import com.ff.game.domain.GameExchangeMoney;
import com.ff.game.domain.KeyInfo;
import com.ff.game.domain.Platform;
import com.ff.game.service.IGameExchangeMoneyService;
import com.ff.game.service.IPlatformBiz;
import com.ff.game.service.IPlatformService;
import com.ff.member.domain.Member;
import com.ff.member.service.IMemberService;
@ -50,7 +49,7 @@ public class PlatformTransactionServiceImpl extends AbstractStepProcessor {
private IMemberService memberService;
@Resource
private IPlatformService platformService;
private IPlatformBiz platformService;
@Autowired
private Map<String, IGamesService> gamesService;

View File

@ -379,7 +379,7 @@ public class GamesFCServiceImpl implements IGamesService {
*/
@Override
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
return gameExchangeMoneyService.getTransactionId(GamePlatforms.FC.getInfo(), 30);
return gameExchangeMoneyBiz.getTransactionId(GamePlatforms.FC.getInfo(), 30);
}

View File

@ -290,7 +290,7 @@ public class GamesPGServiceImpl implements IGamesService {
*/
@Override
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
return gameExchangeMoneyService.getTransactionId(GamePlatforms.PG.getCode(), 32);
return gameExchangeMoneyBiz.getTransactionId(GamePlatforms.PG.getCode(), 32);
}

View File

@ -271,7 +271,7 @@ public class GamesPGTServiceImpl implements IGamesService {
*/
@Override
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
return gameExchangeMoneyService.getTransactionId(GamePlatforms.PGT.getInfo(), 17);
return gameExchangeMoneyBiz.getTransactionId(GamePlatforms.PGT.getInfo(), 17);
}
/**
* id

View File

@ -447,7 +447,7 @@ public class GamesPGXServiceImpl implements IGamesService {
*/
@Override
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
return gameExchangeMoneyService.getTransactionId(GamePlatforms.PGX.getInfo(), 17);
return gameExchangeMoneyBiz.getTransactionId(GamePlatforms.PGX.getInfo(), 17);
}

View File

@ -6,6 +6,7 @@ import com.dtflys.forest.http.ForestRequest;
import com.ff.base.constant.Constants;
import com.ff.base.enums.GamePlatforms;
import com.ff.base.system.service.ISysConfigService;
import com.ff.game.service.IPlatformBiz;
import com.ff.game.service.IPlatformService;
import org.springframework.stereotype.Component;
@ -21,16 +22,16 @@ import javax.annotation.Resource;
@Component
public class MyPPAddressSource implements AddressSource {
@Resource
private IPlatformService platformService;
private IPlatformBiz platformBiz;
@Override
public ForestAddress getAddress(ForestRequest request) {
String apiBaseUrl = platformService.get(GamePlatforms.PP.getCode())
String apiBaseUrl = platformBiz.get(GamePlatforms.PP.getCode())
.getUrlInfo().getUrl();
String host = platformService.get(GamePlatforms.PP.getCode())
String host = platformBiz.get(GamePlatforms.PP.getCode())
.getUrlInfo().getHost();
String https = platformService.get(GamePlatforms.PP.getCode())
String https = platformBiz.get(GamePlatforms.PP.getCode())
.getUrlInfo().getHttps();
return new ForestAddress(https,apiBaseUrl, Integer.parseInt(host),"/IntegrationService/v3/http/CasinoGameAPI");
}

View File

@ -3,6 +3,7 @@ package com.ff.game.controller;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.enums.GamePlatforms;
import com.ff.game.service.IPlatformBiz;
import com.ff.game.service.IPlatformService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
@ -23,7 +24,7 @@ public class GamePlatformController extends BaseController {
@Resource
private IPlatformService platformService;
private IPlatformBiz platformBiz;
/**
*
@ -44,7 +45,7 @@ public class GamePlatformController extends BaseController {
@PreAuthorize("@ss.hasPermi('game:platform:all')")
@GetMapping("/all")
public AjaxResult all() {
platformService.loadToCache();
platformBiz.loadToCache();
return AjaxResult.success();
}
}

View File

@ -21,8 +21,6 @@ import com.ff.base.system.domain.TenantSecretKey;
import com.ff.common.dto.BalanceChangesDTO;
import com.ff.common.dto.BalanceRealChangesDTO;
import com.ff.common.dto.GameBalanceExchange;
import com.ff.common.service.ITenantGameQuotaFlowService;
import com.ff.common.service.ITenantQuotaExchangeService;
import com.ff.base.system.service.ITenantSecretKeyService;
import com.ff.game.api.IGamesService;
import com.ff.game.api.request.MemberInfoRequestDTO;
@ -34,9 +32,7 @@ import com.ff.tenant.service.ITenantGameQuotaFlowService;
import com.ff.tenant.service.ITenantQuotaExchangeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.common.mapper.TenantGameQuotaMapper;
import com.ff.common.domain.TenantGameQuota;
import com.ff.common.service.ITenantGameQuotaService;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;

View File

@ -4,7 +4,7 @@ import cn.hutool.core.util.IdUtil;
import com.ff.client.DBSportsClient;
import com.ff.client.IGamesService;
import com.ff.dto.*;
import com.ff.enums.ErrorCode;
import enums.ErrorCode;
import com.ff.enums.GamePlatforms;
import com.ff.enums.PlatformType;
import com.ff.enums.StatusType;