refactor(game): 重构游戏平台交易ID生成逻辑
- 移除 CreateOrderServiceImpl 中的 getTransactionId 方法 - 在每个游戏平台的实现类中添加 getTransactionId 方法,具体实现如下: - GamesAEServiceImpl - GamesDGServiceImpl - GamesFCServiceImpl - GamesJILIServiceImpl - GamesKMServiceImpl - GamesPGServiceImpl - GamesPGTServiceImpl - GamesPGXServiceImpl - GamesSAServiceImpl - 更新 DBSportsServiceImpl 和 FBSportsServiceImpl 中的交易ID生成逻辑 - 重构后的交易ID生成逻辑更清晰,每个平台有自己的实现方式main-pgt
parent
265b626b6e
commit
3236b4ab55
|
|
@ -38,11 +38,10 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||||
|
|
||||||
public static String DAY_END_TIME = "23:59:59";
|
public static String DAY_END_TIME = "23:59:59";
|
||||||
|
|
||||||
public static final String ISO_8601_FORMAT= "yyyy-MM-dd'T'HH:mm:ss";
|
public static final String ISO_8601_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String ISO_8601_FORMAT_Z = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
||||||
public static final String ISO_8601_FORMAT_Z= "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -213,8 +212,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||||
* 将时间戳转换为指定格式的时间字符串
|
* 将时间戳转换为指定格式的时间字符串
|
||||||
*
|
*
|
||||||
* @param timestamp 时间戳(毫秒)
|
* @param timestamp 时间戳(毫秒)
|
||||||
* @param format 目标时间格式,例如:yyyy-MM-dd'T'HH:mm:ssXXX
|
* @param format 目标时间格式,例如:yyyy-MM-dd'T'HH:mm:ssXXX
|
||||||
* @param timeZone 时区,例如:GMT+8,UTC等
|
* @param timeZone 时区,例如:GMT+8,UTC等
|
||||||
* @return 格式化后的时间字符串
|
* @return 格式化后的时间字符串
|
||||||
*/
|
*/
|
||||||
public static String convertTimestampToFormattedDate(long timestamp, String format, String timeZone) {
|
public static String convertTimestampToFormattedDate(long timestamp, String format, String timeZone) {
|
||||||
|
|
@ -251,7 +250,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加 LocalDate ==> Date
|
* 增加 LocalDate ==> Date
|
||||||
*/
|
*/
|
||||||
|
|
@ -943,4 +941,38 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||||
public static boolean isBetween(Long value, Long minValue, Long maxValue) {
|
public static boolean isBetween(Long value, Long minValue, Long maxValue) {
|
||||||
return value >= minValue && value <= maxValue;
|
return value >= minValue && value <= maxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将日期字符串转换为指定时区的毫秒时间戳
|
||||||
|
*
|
||||||
|
* @param dateString 日期字符串,格式为 "yyyy-MM-dd'T'HH:mm:ss.SSS"
|
||||||
|
* @param timezone 时区(如 UTC、Asia/Shanghai)
|
||||||
|
* @return 时区下的毫秒时间戳
|
||||||
|
* @throws Exception 日期解析异常
|
||||||
|
*/
|
||||||
|
public static long convertToMillisWithTimezone(String dateString, String timezone) {
|
||||||
|
try {
|
||||||
|
// 设置日期格式
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
|
||||||
|
|
||||||
|
// 设置解析时使用的时区
|
||||||
|
sdf.setTimeZone(TimeZone.getTimeZone(timezone));
|
||||||
|
|
||||||
|
// 解析日期字符串为 Date 对象
|
||||||
|
Date date = sdf.parse(dateString);
|
||||||
|
|
||||||
|
// 获取项目默认时区
|
||||||
|
TimeZone defaultTimeZone = TimeZone.getDefault();
|
||||||
|
|
||||||
|
// 使用默认时区的 Calendar 计算
|
||||||
|
Calendar calendar = Calendar.getInstance(defaultTimeZone);
|
||||||
|
calendar.setTime(date);
|
||||||
|
|
||||||
|
// 返回该时区对应的毫秒时间戳
|
||||||
|
return calendar.getTimeInMillis();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,14 @@ public interface IGamesService {
|
||||||
*/
|
*/
|
||||||
String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO);
|
String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按代理id进行交换转账
|
* 按代理id进行交换转账
|
||||||
|
|
|
||||||
|
|
@ -218,10 +218,27 @@ public class GamesAEServiceImpl implements IGamesService {
|
||||||
game.setNameInfo(Collections.singletonList(nameInfo));
|
game.setNameInfo(Collections.singletonList(nameInfo));
|
||||||
game.setGameId(StringUtils.addSuffix(GamePlatforms.AE.getCode(), 1));
|
game.setGameId(StringUtils.addSuffix(GamePlatforms.AE.getCode(), 1));
|
||||||
gameService.insertGame(game);
|
gameService.insertGame(game);
|
||||||
|
}else {
|
||||||
|
NameInfo nameInfo = new NameInfo();
|
||||||
|
nameInfo.setLang("zh-CN");
|
||||||
|
nameInfo.setName("AE大厅");
|
||||||
|
game.setNameInfo(Collections.singletonList(nameInfo));
|
||||||
|
gameService.updateGame(game);
|
||||||
}
|
}
|
||||||
return CacheConstants.AE_GAMES;
|
return CacheConstants.AE_GAMES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
return GamePlatforms.AE.getCode() + IdUtils.simpleUUID();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按代理id进行交换转账
|
* 按代理id进行交换转账
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.address;
|
package com.ff.game.api.db.address;
|
||||||
|
|
||||||
import com.dtflys.forest.callback.AddressSource;
|
import com.dtflys.forest.callback.AddressSource;
|
||||||
import com.dtflys.forest.http.ForestAddress;
|
import com.dtflys.forest.http.ForestAddress;
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package com.ff.sports.db.client;
|
package com.ff.game.api.db.client;
|
||||||
|
|
||||||
import com.dtflys.forest.annotation.*;
|
import com.dtflys.forest.annotation.*;
|
||||||
import com.ff.sports.db.address.DBSportsAddress;
|
import com.ff.game.api.db.address.DBSportsAddress;
|
||||||
import com.ff.sports.db.dto.*;
|
import com.ff.game.api.db.dto.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author cengy
|
* @author cengy
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
import com.ff.base.utils.sign.Md5Utils;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author cengy
|
* @author cengy
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
import com.ff.base.utils.sign.Md5Utils;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
import com.ff.base.utils.sign.Md5Utils;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
import com.ff.base.utils.sign.Md5Utils;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
import com.ff.base.utils.sign.Md5Utils;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
import com.ff.base.utils.sign.Md5Utils;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
import com.ff.base.utils.sign.Md5Utils;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.db.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.impl;
|
package com.ff.game.api.db.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.ff.base.constant.CacheConstants;
|
import com.ff.base.constant.CacheConstants;
|
||||||
|
|
@ -12,6 +12,7 @@ import com.ff.base.utils.StringUtils;
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
import com.ff.base.utils.sign.Md5Utils;
|
||||||
import com.ff.base.utils.uuid.IdUtils;
|
import com.ff.base.utils.uuid.IdUtils;
|
||||||
import com.ff.game.api.IGamesService;
|
import com.ff.game.api.IGamesService;
|
||||||
|
import com.ff.game.api.db.dto.*;
|
||||||
import com.ff.game.api.request.*;
|
import com.ff.game.api.request.*;
|
||||||
import com.ff.game.domain.*;
|
import com.ff.game.domain.*;
|
||||||
import com.ff.game.service.IGameBettingDetailsService;
|
import com.ff.game.service.IGameBettingDetailsService;
|
||||||
|
|
@ -19,12 +20,10 @@ import com.ff.game.service.IGameExchangeMoneyService;
|
||||||
import com.ff.game.service.IGameService;
|
import com.ff.game.service.IGameService;
|
||||||
import com.ff.member.domain.Member;
|
import com.ff.member.domain.Member;
|
||||||
import com.ff.member.service.IMemberService;
|
import com.ff.member.service.IMemberService;
|
||||||
import com.ff.sports.db.client.DBSportsClient;
|
import com.ff.game.api.db.client.DBSportsClient;
|
||||||
import com.ff.sports.db.dto.*;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Assert;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
|
|
@ -120,37 +119,13 @@ public class DBSportsServiceImpl implements IGamesService {
|
||||||
@Transactional
|
@Transactional
|
||||||
public Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO requestDTO) {
|
public Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO requestDTO) {
|
||||||
|
|
||||||
Member member = memberService.selectMemberByGameAccount(requestDTO.getAccount());
|
GameExchangeMoney exchangeMoney = gameExchangeMoneyService.selectGameExchangeMoneyById(requestDTO.getGameExchangeId());
|
||||||
String transactionId = GamePlatforms.DBSports.getCode() + IdUtils.simpleUUID();
|
|
||||||
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(
|
|
||||||
GameExchangeMoney.builder()
|
|
||||||
.tenantKey(requestDTO.getTenantKey())
|
|
||||||
.orderId(requestDTO.getOrderId())
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
Assert.isTrue(CollectionUtils.isEmpty(gameExchangeMonies), "订单号重复");
|
|
||||||
//获取下一个自增id
|
|
||||||
GameExchangeMoney exchangeMoney = GameExchangeMoney
|
|
||||||
.builder()
|
|
||||||
.orderId(requestDTO.getOrderId())
|
|
||||||
.tenantKey(requestDTO.getTenantKey())
|
|
||||||
.quota(requestDTO.getQuota())
|
|
||||||
.balance(requestDTO.getAmount())
|
|
||||||
.exchangeType(requestDTO.getTransferType())
|
|
||||||
.currencyCode(requestDTO.getSystemCurrency())
|
|
||||||
.memberId(member.getId())
|
|
||||||
.transactionId(transactionId)
|
|
||||||
.platformCode(GamePlatforms.DBSports.getCode())
|
|
||||||
.build();
|
|
||||||
exchangeMoney.setCreateBy(Constants.SYSTEM);
|
|
||||||
//接口限制限制50字符
|
|
||||||
exchangeMoney.setTransactionId(transactionId);
|
|
||||||
// 转入
|
// 转入
|
||||||
if (requestDTO.getTransferType().equals(TransferType.GAMES.getCode())) {
|
if (requestDTO.getTransferType().equals(TransferType.GAMES.getCode())) {
|
||||||
TransferRequest request = new TransferRequest();
|
TransferRequest request = new TransferRequest();
|
||||||
request.setUserName(requestDTO.getAccount());
|
request.setUserName(requestDTO.getAccount());
|
||||||
request.setTransferType(1);
|
request.setTransferType(1);
|
||||||
request.setTransferId(requestDTO.getOrderId());
|
request.setTransferId(requestDTO.getTransactionId());
|
||||||
request.setMerchantCode(requestDTO.getAgentId());
|
request.setMerchantCode(requestDTO.getAgentId());
|
||||||
request.setAmount(requestDTO.getAmount().toString());
|
request.setAmount(requestDTO.getAmount().toString());
|
||||||
request.buildSignature(requestDTO.getAgentKey());
|
request.buildSignature(requestDTO.getAgentKey());
|
||||||
|
|
@ -179,15 +154,19 @@ public class DBSportsServiceImpl implements IGamesService {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("查询会员失败, errorCode:{}, errorMessage:{}", response.getCode(), response.getMsg(), e);
|
log.error("查询会员失败, errorCode:{}, errorMessage:{}", response.getCode(), response.getMsg(), e);
|
||||||
}
|
}
|
||||||
exchangeMoney.setStatus(StatusType.SUCCESS.getValue()); // SUCCESS
|
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
||||||
gameExchangeMoneyService.insertGameExchangeMoney(exchangeMoney);
|
exchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
||||||
|
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
||||||
} else {
|
} else {
|
||||||
|
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
||||||
|
exchangeMoney.setStepStatus(GameExchangeStepStatus.FAILURE.getCode());
|
||||||
|
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
||||||
throw new ApiException(ErrorCode.Transfer_In_Failure.getCode());
|
throw new ApiException(ErrorCode.Transfer_In_Failure.getCode());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 获取第三方钱包余额
|
// 获取第三方钱包余额
|
||||||
MemberInfoRequestDTO memberInfoRequestDTO = MemberInfoRequestDTO.builder()
|
MemberInfoRequestDTO memberInfoRequestDTO = MemberInfoRequestDTO.builder()
|
||||||
.accounts(member.getGameAccount())
|
.accounts(requestDTO.getAccount())
|
||||||
.agentId(requestDTO.getAgentId())
|
.agentId(requestDTO.getAgentId())
|
||||||
.agentKey(requestDTO.getAgentKey())
|
.agentKey(requestDTO.getAgentKey())
|
||||||
.build();
|
.build();
|
||||||
|
|
@ -199,7 +178,7 @@ public class DBSportsServiceImpl implements IGamesService {
|
||||||
TransferRequest request = new TransferRequest();
|
TransferRequest request = new TransferRequest();
|
||||||
request.setUserName(requestDTO.getAccount());
|
request.setUserName(requestDTO.getAccount());
|
||||||
request.setTransferType(2); // 转出
|
request.setTransferType(2); // 转出
|
||||||
request.setTransferId(requestDTO.getOrderId());
|
request.setTransferId(requestDTO.getTransactionId());
|
||||||
request.setMerchantCode(requestDTO.getAgentId());
|
request.setMerchantCode(requestDTO.getAgentId());
|
||||||
request.setAmount(/*requestDTO.getAmount().toString()*/ balance.toString());
|
request.setAmount(/*requestDTO.getAmount().toString()*/ balance.toString());
|
||||||
request.buildSignature(requestDTO.getAgentKey());
|
request.buildSignature(requestDTO.getAgentKey());
|
||||||
|
|
@ -221,14 +200,28 @@ public class DBSportsServiceImpl implements IGamesService {
|
||||||
exchangeMoney.setCoinAfter(afterAmount);
|
exchangeMoney.setCoinAfter(afterAmount);
|
||||||
exchangeMoney.setCurrencyBefore(beforeAmount);
|
exchangeMoney.setCurrencyBefore(beforeAmount);
|
||||||
exchangeMoney.setCurrencyAfter(afterAmount);
|
exchangeMoney.setCurrencyAfter(afterAmount);
|
||||||
exchangeMoney.setStatus(StatusType.SUCCESS.getValue()); // SUCCESS
|
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
||||||
gameExchangeMoneyService.insertGameExchangeMoney(exchangeMoney);
|
exchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
||||||
|
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
||||||
} else {
|
} else {
|
||||||
|
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
||||||
|
exchangeMoney.setStepStatus(GameExchangeStepStatus.FAILURE.getCode());
|
||||||
|
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
||||||
throw new ApiException(ErrorCode.Transfer_Out_Failure.getCode());
|
throw new ApiException(ErrorCode.Transfer_Out_Failure.getCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return exchangeMoney.getId();
|
return exchangeMoney.getId();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
return gameExchangeMoneyService.getTransactionId(GamePlatforms.DBSports.getInfo(), 11);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取会员信息
|
* 获取会员信息
|
||||||
|
|
@ -204,10 +204,28 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
game.setNameInfo(Collections.singletonList(new NameInfo("真人棋牌", "zh-CN")));
|
game.setNameInfo(Collections.singletonList(new NameInfo("真人棋牌", "zh-CN")));
|
||||||
game.setGameId(StringUtils.addSuffix(GamePlatforms.DG.getCode(), 1));
|
game.setGameId(StringUtils.addSuffix(GamePlatforms.DG.getCode(), 1));
|
||||||
gameService.insertGame(game);
|
gameService.insertGame(game);
|
||||||
|
}else {
|
||||||
|
game.setNameInfo(Collections.singletonList(new NameInfo("真人棋牌", "zh-CN")));
|
||||||
|
gameService.updateGame(game);
|
||||||
}
|
}
|
||||||
return CacheConstants.DG_GAMES;
|
return CacheConstants.DG_GAMES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
return GamePlatforms.DG.getInfo() + IdUtils.simpleUUID();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按代理id进行交换转账
|
* 按代理id进行交换转账
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,24 @@ import com.ff.base.exception.base.ApiException;
|
||||||
import com.ff.base.manager.AsyncManager;
|
import com.ff.base.manager.AsyncManager;
|
||||||
import com.ff.base.utils.DateUtils;
|
import com.ff.base.utils.DateUtils;
|
||||||
import com.ff.base.utils.uuid.IdUtils;
|
import com.ff.base.utils.uuid.IdUtils;
|
||||||
|
import com.ff.game.api.IGamesService;
|
||||||
import com.ff.game.api.exchange.AbstractStepProcessor;
|
import com.ff.game.api.exchange.AbstractStepProcessor;
|
||||||
import com.ff.game.api.exchange.StepProcessorFactory;
|
import com.ff.game.api.exchange.StepProcessorFactory;
|
||||||
import com.ff.game.api.exchange.StepProcessorService;
|
import com.ff.game.api.exchange.StepProcessorService;
|
||||||
import com.ff.game.api.exchange.dto.GameExchangeDTO;
|
import com.ff.game.api.exchange.dto.GameExchangeDTO;
|
||||||
import com.ff.game.api.request.ExchangeTransferStatusRequestDTO;
|
import com.ff.game.api.request.ExchangeTransferStatusRequestDTO;
|
||||||
|
import com.ff.game.api.request.TransactionIdRequestDTO;
|
||||||
import com.ff.game.domain.GameExchangeMoney;
|
import com.ff.game.domain.GameExchangeMoney;
|
||||||
import com.ff.game.service.IGameExchangeMoneyService;
|
import com.ff.game.service.IGameExchangeMoneyService;
|
||||||
import com.ff.member.domain.Member;
|
import com.ff.member.domain.Member;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建订单impl
|
* 创建订单impl
|
||||||
|
|
@ -33,11 +37,12 @@ public class CreateOrderServiceImpl extends AbstractStepProcessor {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
private IGameExchangeMoneyService gameExchangeMoneyService;
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private StepProcessorFactory stepProcessorFactory;
|
private StepProcessorFactory stepProcessorFactory;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Map<String, IGamesService> gamesService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 步进键
|
* 步进键
|
||||||
*
|
*
|
||||||
|
|
@ -56,10 +61,10 @@ public class CreateOrderServiceImpl extends AbstractStepProcessor {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean doProcess(GameExchangeDTO gameExchangeMoney) {
|
public boolean doProcess(GameExchangeDTO gameExchangeMoney) {
|
||||||
|
|
||||||
|
String transactionId = gamesService.get(gameExchangeMoney.getPlatformCode()+Constants.SERVICE).getTransactionId(TransactionIdRequestDTO.builder().exchangeType(gameExchangeMoney.getExchangeType()).gameAccount(gameExchangeMoney.getGameAccount()).build());
|
||||||
gameExchangeMoney.setTransactionId(this.getTransactionId(GamePlatforms.getByCode(gameExchangeMoney.getPlatformCode()),gameExchangeMoney.getExchangeType(),gameExchangeMoney.getGameAccount()));
|
gameExchangeMoney.setTransactionId(transactionId);
|
||||||
gameExchangeMoney.setCreateBy(Constants.SYSTEM);
|
gameExchangeMoney.setCreateBy(Constants.SYSTEM);
|
||||||
gameExchangeMoney.setStatus(StatusType.IN_PROGRESS.getValue());
|
gameExchangeMoney.setStatus(StatusType.IN_PROGRESS.getValue());
|
||||||
gameExchangeMoney.setStep(GameExchangeStep.CREATE_ORDER.getCode());
|
gameExchangeMoney.setStep(GameExchangeStep.CREATE_ORDER.getCode());
|
||||||
|
|
@ -67,49 +72,6 @@ public class CreateOrderServiceImpl extends AbstractStepProcessor {
|
||||||
return gameExchangeMoneyService.insertGameExchangeMoney(gameExchangeMoney) > 0;
|
return gameExchangeMoneyService.insertGameExchangeMoney(gameExchangeMoney) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取交易id
|
|
||||||
*
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
private String getTransactionId(GamePlatforms gamePlatforms,Integer exchangeType ,String account) {
|
|
||||||
switch (gamePlatforms) {
|
|
||||||
case AE:
|
|
||||||
return GamePlatforms.AE.getCode() + IdUtils.simpleUUID();
|
|
||||||
case JILI:
|
|
||||||
return GamePlatforms.JILI.getInfo() + IdUtils.simpleUUID();
|
|
||||||
case XK:
|
|
||||||
return GamePlatforms.XK.getCode() + IdUtils.simpleUUID();
|
|
||||||
case PG:
|
|
||||||
return gameExchangeMoneyService.getTransactionId(GamePlatforms.PG.getCode(), 32);
|
|
||||||
case PGX:
|
|
||||||
return gameExchangeMoneyService.getTransactionId(GamePlatforms.PGX.getInfo(), 17);
|
|
||||||
case FC:
|
|
||||||
return gameExchangeMoneyService.getTransactionId(GamePlatforms.FC.getInfo(), 30);
|
|
||||||
case DG:
|
|
||||||
return GamePlatforms.DG.getInfo() + IdUtils.simpleUUID();
|
|
||||||
|
|
||||||
case MT:
|
|
||||||
return GamePlatforms.MT.getCode() + IdUtils.simpleUUID();
|
|
||||||
case SA:
|
|
||||||
//判断是转入还是转出
|
|
||||||
String transactionId = "OUT" + DateUtils.dateTimeNow() + account;
|
|
||||||
if (!TransferType.ALL.getCode().equals(exchangeType)) {
|
|
||||||
transactionId = "IN" + DateUtils.dateTimeNow() + account;
|
|
||||||
}
|
|
||||||
|
|
||||||
return transactionId;
|
|
||||||
case KM:
|
|
||||||
return GamePlatforms.KM.getInfo() + IdUtils.simpleUUID();
|
|
||||||
case PGT:
|
|
||||||
return gameExchangeMoneyService.getTransactionId(GamePlatforms.PGT.getInfo(), 17);
|
|
||||||
case FBSports:
|
|
||||||
return GamePlatforms.FBSports.getCode() + IdUtils.simpleUUID();
|
|
||||||
case SV388:
|
|
||||||
return GamePlatforms.SV388.getCode() + IdUtils.simpleUUID();
|
|
||||||
}
|
|
||||||
throw new ApiException(ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.address;
|
package com.ff.game.api.fb.address;
|
||||||
|
|
||||||
import com.dtflys.forest.callback.AddressSource;
|
import com.dtflys.forest.callback.AddressSource;
|
||||||
import com.dtflys.forest.http.ForestAddress;
|
import com.dtflys.forest.http.ForestAddress;
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package com.ff.sports.fb.client;
|
package com.ff.game.api.fb.client;
|
||||||
|
|
||||||
import com.dtflys.forest.annotation.*;
|
import com.dtflys.forest.annotation.*;
|
||||||
import com.ff.sports.fb.address.FBSportsAddress;
|
import com.ff.game.api.fb.address.FBSportsAddress;
|
||||||
import com.ff.sports.fb.dto.*;
|
import com.ff.game.api.fb.dto.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <a href="https://doc.newsportspro.com/apidoc_data.html">数据接口文档</a><br/>
|
* <a href="https://doc.newsportspro.com/apidoc_data.html">数据接口文档</a><br/>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.db.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author cengy
|
* @author cengy
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.dto;
|
package com.ff.game.api.fb.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.ff.sports.fb.impl;
|
package com.ff.game.api.fb.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.ff.base.constant.CacheConstants;
|
import com.ff.base.constant.CacheConstants;
|
||||||
|
|
@ -12,6 +12,7 @@ import com.ff.base.utils.StringUtils;
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
import com.ff.base.utils.sign.Md5Utils;
|
||||||
import com.ff.base.utils.uuid.IdUtils;
|
import com.ff.base.utils.uuid.IdUtils;
|
||||||
import com.ff.game.api.IGamesService;
|
import com.ff.game.api.IGamesService;
|
||||||
|
import com.ff.game.api.fb.dto.*;
|
||||||
import com.ff.game.api.request.*;
|
import com.ff.game.api.request.*;
|
||||||
import com.ff.game.domain.*;
|
import com.ff.game.domain.*;
|
||||||
import com.ff.game.service.IGameBettingDetailsService;
|
import com.ff.game.service.IGameBettingDetailsService;
|
||||||
|
|
@ -19,13 +20,11 @@ import com.ff.game.service.IGameExchangeMoneyService;
|
||||||
import com.ff.game.service.IGameService;
|
import com.ff.game.service.IGameService;
|
||||||
import com.ff.member.domain.Member;
|
import com.ff.member.domain.Member;
|
||||||
import com.ff.member.service.IMemberService;
|
import com.ff.member.service.IMemberService;
|
||||||
import com.ff.sports.fb.client.FBSportsClient;
|
import com.ff.game.api.fb.client.FBSportsClient;
|
||||||
import com.ff.sports.fb.dto.*;
|
|
||||||
import com.ff.utils.TimestampFromString;
|
import com.ff.utils.TimestampFromString;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Assert;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
|
|
@ -138,7 +137,7 @@ public class FBSportsServiceImpl implements IGamesService {
|
||||||
TransferInRequest request = new TransferInRequest();
|
TransferInRequest request = new TransferInRequest();
|
||||||
request.setMerchantUserId(requestDTO.getAccount());
|
request.setMerchantUserId(requestDTO.getAccount());
|
||||||
request.setAmount(requestDTO.getAmount());
|
request.setAmount(requestDTO.getAmount());
|
||||||
request.setBusinessId(requestDTO.getOrderId());
|
request.setBusinessId(requestDTO.getTransactionId());
|
||||||
request.setCurrencyId(Integer.parseInt(requestDTO.getCurrency()));
|
request.setCurrencyId(Integer.parseInt(requestDTO.getCurrency()));
|
||||||
long timestamp = System.currentTimeMillis();
|
long timestamp = System.currentTimeMillis();
|
||||||
String jsonBody = request.toJSON();
|
String jsonBody = request.toJSON();
|
||||||
|
|
@ -161,15 +160,19 @@ public class FBSportsServiceImpl implements IGamesService {
|
||||||
exchangeMoney.setCoinAfter(response.getData());
|
exchangeMoney.setCoinAfter(response.getData());
|
||||||
exchangeMoney.setCurrencyBefore(response.getData().subtract(transAmount));
|
exchangeMoney.setCurrencyBefore(response.getData().subtract(transAmount));
|
||||||
exchangeMoney.setCurrencyAfter(response.getData());
|
exchangeMoney.setCurrencyAfter(response.getData());
|
||||||
exchangeMoney.setStatus(StatusType.SUCCESS.getValue()); // SUCCESS
|
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
||||||
gameExchangeMoneyService.insertGameExchangeMoney(exchangeMoney);
|
exchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
||||||
|
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
||||||
} else {
|
} else {
|
||||||
|
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
||||||
|
exchangeMoney.setStepStatus(GameExchangeStepStatus.FAILURE.getCode());
|
||||||
|
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
||||||
throw new ApiException(ErrorCode.Transfer_In_Failure.getCode());
|
throw new ApiException(ErrorCode.Transfer_In_Failure.getCode());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 获取第三方钱包余额
|
// 获取第三方钱包余额
|
||||||
MemberInfoRequestDTO memberInfoRequestDTO = MemberInfoRequestDTO.builder()
|
MemberInfoRequestDTO memberInfoRequestDTO = MemberInfoRequestDTO.builder()
|
||||||
.accounts(member.getGameAccount())
|
.accounts(requestDTO.getAccount())
|
||||||
.agentId(requestDTO.getAgentId())
|
.agentId(requestDTO.getAgentId())
|
||||||
.agentKey(requestDTO.getAgentKey())
|
.agentKey(requestDTO.getAgentKey())
|
||||||
.build();
|
.build();
|
||||||
|
|
@ -178,7 +181,7 @@ public class FBSportsServiceImpl implements IGamesService {
|
||||||
TransferOutRequest request = new TransferOutRequest();
|
TransferOutRequest request = new TransferOutRequest();
|
||||||
request.setMerchantUserId(requestDTO.getAccount());
|
request.setMerchantUserId(requestDTO.getAccount());
|
||||||
request.setAmount(/*requestDTO.getAmount()*/ balance);
|
request.setAmount(/*requestDTO.getAmount()*/ balance);
|
||||||
request.setBusinessId(requestDTO.getOrderId());
|
request.setBusinessId(requestDTO.getTransactionId());
|
||||||
request.setCurrencyId(Integer.parseInt(requestDTO.getCurrency()));
|
request.setCurrencyId(Integer.parseInt(requestDTO.getCurrency()));
|
||||||
|
|
||||||
long timestamp = System.currentTimeMillis();
|
long timestamp = System.currentTimeMillis();
|
||||||
|
|
@ -207,9 +210,13 @@ public class FBSportsServiceImpl implements IGamesService {
|
||||||
exchangeMoney.setCoinAfter(response.getData());
|
exchangeMoney.setCoinAfter(response.getData());
|
||||||
exchangeMoney.setCurrencyBefore(response.getData().add(transAmount));
|
exchangeMoney.setCurrencyBefore(response.getData().add(transAmount));
|
||||||
exchangeMoney.setCurrencyAfter(response.getData());
|
exchangeMoney.setCurrencyAfter(response.getData());
|
||||||
exchangeMoney.setStatus(StatusType.SUCCESS.getValue()); // SUCCESS
|
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
||||||
gameExchangeMoneyService.insertGameExchangeMoney(exchangeMoney);
|
exchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
||||||
|
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
||||||
} else {
|
} else {
|
||||||
|
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
||||||
|
exchangeMoney.setStepStatus(GameExchangeStepStatus.FAILURE.getCode());
|
||||||
|
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
||||||
throw new ApiException(ErrorCode.Transfer_Out_Failure.getCode());
|
throw new ApiException(ErrorCode.Transfer_Out_Failure.getCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -256,6 +263,19 @@ public class FBSportsServiceImpl implements IGamesService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
return GamePlatforms.FBSports.getCode() + IdUtils.simpleUUID();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无重定向登录
|
* 无重定向登录
|
||||||
*
|
*
|
||||||
|
|
@ -421,7 +441,7 @@ public class FBSportsServiceImpl implements IGamesService {
|
||||||
);
|
);
|
||||||
if (this.isSuccess(response.getCode())) {
|
if (this.isSuccess(response.getCode())) {
|
||||||
status = StatusType.SUCCESS.getValue();
|
status = StatusType.SUCCESS.getValue();
|
||||||
}else {
|
} else {
|
||||||
status = StatusType.FAILURE.getValue();
|
status = StatusType.FAILURE.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -283,6 +283,11 @@ public class GamesFCServiceImpl implements IGamesService {
|
||||||
gameService.insertGame(game);
|
gameService.insertGame(game);
|
||||||
} else {
|
} else {
|
||||||
game = games.get(0);
|
game = games.get(0);
|
||||||
|
List<NameInfo> nameInfos = new ArrayList<>();
|
||||||
|
nameInfos.add(NameInfo.builder().lang("zh-CN").name(gameDetails.getGameNameOfChinese()).build());
|
||||||
|
nameInfos.add(NameInfo.builder().lang("en-US").name(gameDetails.getGameNameOfEnglish()).build());
|
||||||
|
game.setNameInfo(nameInfos);
|
||||||
|
gameService.updateGame(game);
|
||||||
|
|
||||||
}
|
}
|
||||||
gameDetails.setSystemGameId(game.getGameId());
|
gameDetails.setSystemGameId(game.getGameId());
|
||||||
|
|
@ -366,6 +371,19 @@ public class GamesFCServiceImpl implements IGamesService {
|
||||||
return exchangeMoney.getId();
|
return exchangeMoney.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
return gameExchangeMoneyService.getTransactionId(GamePlatforms.FC.getInfo(), 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 汇兑转移状态
|
* 汇兑转移状态
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -252,6 +252,11 @@ public class GamesJILIServiceImpl implements IGamesService {
|
||||||
gameService.insertGame(game);
|
gameService.insertGame(game);
|
||||||
} else {
|
} else {
|
||||||
game = games.get(0);
|
game = games.get(0);
|
||||||
|
List<NameInfo> nameInfos = new ArrayList<>();
|
||||||
|
nameInfos.add(new NameInfo(gamesDataDTO.getName().getZhCN(), "zh-CN"));
|
||||||
|
nameInfos.add(new NameInfo(gamesDataDTO.getName().getEnUS(), "en-US"));
|
||||||
|
game.setNameInfo(nameInfos);
|
||||||
|
gameService.updateGame(game);
|
||||||
}
|
}
|
||||||
gamesDataDTO.setSystemGameId(game.getGameId());
|
gamesDataDTO.setSystemGameId(game.getGameId());
|
||||||
|
|
||||||
|
|
@ -269,6 +274,17 @@ public class GamesJILIServiceImpl implements IGamesService {
|
||||||
return CacheConstants.JILI_GAMES;
|
return CacheConstants.JILI_GAMES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
return GamePlatforms.JILI.getInfo() + IdUtils.simpleUUID();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按代理id进行交换转账
|
* 按代理id进行交换转账
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -301,12 +301,30 @@ public class GamesKMServiceImpl implements IGamesService {
|
||||||
gameService.insertGame(game);
|
gameService.insertGame(game);
|
||||||
} else {
|
} else {
|
||||||
game = games.get(0);
|
game = games.get(0);
|
||||||
|
List<NameInfo> nameInfos = new ArrayList<>();
|
||||||
|
nameInfos.add(new NameInfo(gamesDataDTO.getName(), "zh-CN"));
|
||||||
|
game.setNameInfo(nameInfos);
|
||||||
|
gameService.updateGame(game);
|
||||||
}
|
}
|
||||||
gamesDataDTO.setSystemGameId(game.getGameId());
|
gamesDataDTO.setSystemGameId(game.getGameId());
|
||||||
}
|
}
|
||||||
return gameList.getGames();
|
return gameList.getGames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
return GamePlatforms.KM.getInfo() + IdUtils.simpleUUID();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按代理id进行交换转账
|
* 按代理id进行交换转账
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -247,6 +247,11 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
||||||
gameService.insertGame(game);
|
gameService.insertGame(game);
|
||||||
} else {
|
} else {
|
||||||
game = games.get(0);
|
game = games.get(0);
|
||||||
|
List<NameInfo> nameInfos = new ArrayList<>();
|
||||||
|
nameInfos.add(new NameInfo(gamesDataDTO.getCnName(), "zh-CN"));
|
||||||
|
nameInfos.add(new NameInfo(gamesDataDTO.getEnName(), "en-US"));
|
||||||
|
game.setNameInfo(nameInfos);
|
||||||
|
gameService.updateGame(game);
|
||||||
}
|
}
|
||||||
gamesDataDTO.setSystemGameId(game.getGameId());
|
gamesDataDTO.setSystemGameId(game.getGameId());
|
||||||
}
|
}
|
||||||
|
|
@ -258,6 +263,17 @@ public class MeiTianGameServiceImpl implements IGamesService {
|
||||||
return CacheConstants.MeiTian_GAMES;
|
return CacheConstants.MeiTian_GAMES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
return GamePlatforms.MT.getCode() + IdUtils.simpleUUID();
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 按代理id进行交换转账
|
* 按代理id进行交换转账
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import com.ff.base.utils.DateUtils;
|
||||||
import com.ff.base.utils.SleepUtil;
|
import com.ff.base.utils.SleepUtil;
|
||||||
import com.ff.base.utils.StringUtils;
|
import com.ff.base.utils.StringUtils;
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
import com.ff.base.utils.sign.Md5Utils;
|
||||||
|
import com.ff.base.utils.uuid.IdUtils;
|
||||||
import com.ff.config.KeyConfig;
|
import com.ff.config.KeyConfig;
|
||||||
import com.ff.game.api.IGamesService;
|
import com.ff.game.api.IGamesService;
|
||||||
import com.ff.game.api.ng.client.NGClient;
|
import com.ff.game.api.ng.client.NGClient;
|
||||||
|
|
@ -258,6 +259,12 @@ public class GamesPGServiceImpl implements IGamesService {
|
||||||
gameService.insertGame(game);
|
gameService.insertGame(game);
|
||||||
} else {
|
} else {
|
||||||
game = games.get(0);
|
game = games.get(0);
|
||||||
|
List<NameInfo> nameInfos = new ArrayList<>();
|
||||||
|
nameInfos.add(new NameInfo(apiGameInfoResponseDTO.getGameName().get("zh-hans"), "zh-CN"));
|
||||||
|
nameInfos.add(new NameInfo(apiGameInfoResponseDTO.getGameName().get("zh-hant"), "zh-TW"));
|
||||||
|
nameInfos.add(new NameInfo(apiGameInfoResponseDTO.getGameName().get("en"), "en-US"));
|
||||||
|
game.setNameInfo(nameInfos);
|
||||||
|
gameService.updateGame(game);
|
||||||
}
|
}
|
||||||
apiGameInfoResponseDTO.setSystemGameId(game.getId());
|
apiGameInfoResponseDTO.setSystemGameId(game.getId());
|
||||||
|
|
||||||
|
|
@ -273,6 +280,19 @@ public class GamesPGServiceImpl implements IGamesService {
|
||||||
return CacheConstants.PG_GAMES;
|
return CacheConstants.PG_GAMES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
return gameExchangeMoneyService.getTransactionId(GamePlatforms.PG.getCode(), 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按代理id进行交换转账
|
* 按代理id进行交换转账
|
||||||
*
|
*
|
||||||
|
|
@ -298,10 +318,14 @@ public class GamesPGServiceImpl implements IGamesService {
|
||||||
.agentKey(exchangeTransferMoneyRequestDTO.getAgentKey())
|
.agentKey(exchangeTransferMoneyRequestDTO.getAgentKey())
|
||||||
.currency(exchangeTransferMoneyRequestDTO.getCurrency())
|
.currency(exchangeTransferMoneyRequestDTO.getCurrency())
|
||||||
.build();
|
.build();
|
||||||
MemberInfoResponseDTO memberInfo = this.getMemberInfo(gamesBaseRequestDTO);
|
|
||||||
//判断是不是转出
|
//判断是不是转出
|
||||||
if (NGTransferType.TRANSFER_OUT.getValue().equals(type)) {
|
if (NGTransferType.TRANSFER_OUT.getValue().equals(type)) {
|
||||||
|
MemberInfoResponseDTO memberInfo = this.getMemberInfo(gamesBaseRequestDTO);
|
||||||
exchangeTransferMoneyRequestDTO.setAmount(memberInfo.getBalance());
|
exchangeTransferMoneyRequestDTO.setAmount(memberInfo.getBalance());
|
||||||
|
if (exchangeTransferMoneyRequestDTO.getAmount().compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
throw new ApiException(ErrorCode.INSUFFICIENT_PLAYER_BALANCE.getCode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -322,6 +346,20 @@ public class GamesPGServiceImpl implements IGamesService {
|
||||||
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
||||||
exchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
exchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
||||||
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
||||||
|
ExchangeTransferStatusRequestDTO exchangeTransferStatusRequestDTO = new ExchangeTransferStatusRequestDTO();
|
||||||
|
exchangeTransferStatusRequestDTO.setAccount(exchangeTransferMoneyRequestDTO.getAccount());
|
||||||
|
exchangeTransferStatusRequestDTO.setCurrency(exchangeTransferMoneyRequestDTO.getCurrency());
|
||||||
|
exchangeTransferStatusRequestDTO.setOrderId(exchangeTransferMoneyRequestDTO.getTransactionId());
|
||||||
|
exchangeTransferStatusRequestDTO.setAgentId(exchangeTransferMoneyRequestDTO.getAgentId());
|
||||||
|
exchangeTransferStatusRequestDTO.setAgentKey(exchangeTransferMoneyRequestDTO.getAgentKey());
|
||||||
|
ExchangeTransferStatusResponseDTO statusResponseDTO = this.exchangeTransferStatus(exchangeTransferStatusRequestDTO);
|
||||||
|
//更新钱
|
||||||
|
exchangeMoney.setBalance(statusResponseDTO.getBalance());
|
||||||
|
exchangeMoney.setCoinBefore(statusResponseDTO.getCoinBefore());
|
||||||
|
exchangeMoney.setCoinAfter(statusResponseDTO.getCoinAfter());
|
||||||
|
exchangeMoney.setCurrencyBefore(exchangeMoney.getCoinBefore());
|
||||||
|
exchangeMoney.setCurrencyAfter(exchangeMoney.getCoinAfter());
|
||||||
|
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
||||||
} else {
|
} else {
|
||||||
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
||||||
exchangeMoney.setStepStatus(GameExchangeStepStatus.FAILURE.getCode());
|
exchangeMoney.setStepStatus(GameExchangeStepStatus.FAILURE.getCode());
|
||||||
|
|
@ -341,6 +379,7 @@ public class GamesPGServiceImpl implements IGamesService {
|
||||||
@Override
|
@Override
|
||||||
public ExchangeTransferStatusResponseDTO exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO) {
|
public ExchangeTransferStatusResponseDTO exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO) {
|
||||||
|
|
||||||
|
SleepUtil.sleep(1000);
|
||||||
|
|
||||||
Map<String, Object> paramsMap = new HashMap<>();
|
Map<String, Object> paramsMap = new HashMap<>();
|
||||||
paramsMap.put("playerId", exchangeTransferMoneyRequestDTO.getAccount());
|
paramsMap.put("playerId", exchangeTransferMoneyRequestDTO.getAccount());
|
||||||
|
|
@ -359,7 +398,7 @@ public class GamesPGServiceImpl implements IGamesService {
|
||||||
.build();
|
.build();
|
||||||
ApiExchangeTransferStatusResponseDTO apiNGResponseDTOData = apiNGResponseDTO.getData();
|
ApiExchangeTransferStatusResponseDTO apiNGResponseDTOData = apiNGResponseDTO.getData();
|
||||||
if (!ObjectUtils.isEmpty(apiNGResponseDTOData)) {
|
if (!ObjectUtils.isEmpty(apiNGResponseDTOData)) {
|
||||||
transferStatusResponseDTO.setBalance(apiNGResponseDTOData.getAmount());
|
transferStatusResponseDTO.setBalance(apiNGResponseDTOData.getAmount().abs());
|
||||||
transferStatusResponseDTO.setCoinBefore(NumberUtil.sub(apiNGResponseDTOData.getAmount(), apiNGResponseDTOData.getAfterBalance()).abs());
|
transferStatusResponseDTO.setCoinBefore(NumberUtil.sub(apiNGResponseDTOData.getAmount(), apiNGResponseDTOData.getAfterBalance()).abs());
|
||||||
transferStatusResponseDTO.setCoinAfter(apiNGResponseDTOData.getAfterBalance());
|
transferStatusResponseDTO.setCoinAfter(apiNGResponseDTOData.getAfterBalance());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import com.ff.base.utils.DateUtils;
|
||||||
import com.ff.base.utils.JsonUtil;
|
import com.ff.base.utils.JsonUtil;
|
||||||
import com.ff.base.utils.StringUtils;
|
import com.ff.base.utils.StringUtils;
|
||||||
import com.ff.base.utils.sign.Base64;
|
import com.ff.base.utils.sign.Base64;
|
||||||
|
import com.ff.base.utils.uuid.IdUtils;
|
||||||
import com.ff.config.KeyConfig;
|
import com.ff.config.KeyConfig;
|
||||||
import com.ff.game.api.IGamesService;
|
import com.ff.game.api.IGamesService;
|
||||||
import com.ff.game.api.fc.dto.ApiFCGameListResponseDTO;
|
import com.ff.game.api.fc.dto.ApiFCGameListResponseDTO;
|
||||||
|
|
@ -243,6 +244,10 @@ public class GamesPGTServiceImpl implements IGamesService {
|
||||||
gameService.insertGame(game);
|
gameService.insertGame(game);
|
||||||
} else {
|
} else {
|
||||||
game = games.get(0);
|
game = games.get(0);
|
||||||
|
List<NameInfo> nameInfos = new ArrayList<>();
|
||||||
|
nameInfos.add(NameInfo.builder().lang("en-US").name(gameIdKey.getName()).build());
|
||||||
|
game.setNameInfo(nameInfos);
|
||||||
|
gameService.updateGame(game);
|
||||||
}
|
}
|
||||||
gameIdKey.setSystemGameId(game.getGameId());
|
gameIdKey.setSystemGameId(game.getGameId());
|
||||||
}
|
}
|
||||||
|
|
@ -256,7 +261,16 @@ public class GamesPGTServiceImpl implements IGamesService {
|
||||||
}
|
}
|
||||||
return CacheConstants.PGT_GAMES;
|
return CacheConstants.PGT_GAMES;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
return gameExchangeMoneyService.getTransactionId(GamePlatforms.PGT.getInfo(), 17);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 按代理id进行交换转账
|
* 按代理id进行交换转账
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -79,13 +79,13 @@ public class PGXBetHistoryResponse {
|
||||||
* 下注时间 (玩家实际的投注时间) 依据 GMT/UTC +0 时区
|
* 下注时间 (玩家实际的投注时间) 依据 GMT/UTC +0 时区
|
||||||
*/
|
*/
|
||||||
@JsonProperty("start_time")
|
@JsonProperty("start_time")
|
||||||
private Date startTime;
|
private String startTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结算时间 (String类型) 依据 GMT/UTC +0 时区
|
* 结算时间 (String类型) 依据 GMT/UTC +0 时区
|
||||||
*/
|
*/
|
||||||
@JsonProperty("end_time")
|
@JsonProperty("end_time")
|
||||||
private Date endTime;
|
private String endTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开赛时间 (String类型) 依据 GMT/UTC +0 时区
|
* 开赛时间 (String类型) 依据 GMT/UTC +0 时区
|
||||||
|
|
|
||||||
|
|
@ -251,6 +251,10 @@ public class GamesPGXServiceImpl implements IGamesService {
|
||||||
gameService.insertGame(game);
|
gameService.insertGame(game);
|
||||||
} else {
|
} else {
|
||||||
game = games.get(0);
|
game = games.get(0);
|
||||||
|
List<NameInfo> nameInfos = new ArrayList<>();
|
||||||
|
nameInfos.add(new NameInfo(gamesDataDTO.getGameName(), "en-US"));
|
||||||
|
game.setNameInfo(nameInfos);
|
||||||
|
gameService.updateGame(game);
|
||||||
}
|
}
|
||||||
gamesDataDTO.setSystemGameId(game.getGameId());
|
gamesDataDTO.setSystemGameId(game.getGameId());
|
||||||
|
|
||||||
|
|
@ -430,6 +434,21 @@ public class GamesPGXServiceImpl implements IGamesService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
return gameExchangeMoneyService.getTransactionId(GamePlatforms.PGX.getInfo(), 17);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 赠送免费局数
|
* 赠送免费局数
|
||||||
*
|
*
|
||||||
|
|
@ -585,6 +604,7 @@ public class GamesPGXServiceImpl implements IGamesService {
|
||||||
payoffAmount = NumberUtil.sub(payout, resultBean.getBet()).negate();
|
payoffAmount = NumberUtil.sub(payout, resultBean.getBet()).negate();
|
||||||
gameStatus = GameStatus.FAIL.getCode();
|
gameStatus = GameStatus.FAIL.getCode();
|
||||||
}
|
}
|
||||||
|
long endTime = DateUtils.convertToMillisWithTimezone(resultBean.getEndTime(), "UTC");
|
||||||
//数据构造
|
//数据构造
|
||||||
GameBettingDetails gameBettingDetails = GameBettingDetails.builder()
|
GameBettingDetails gameBettingDetails = GameBettingDetails.builder()
|
||||||
.tenantKey(member.getTenantKey())
|
.tenantKey(member.getTenantKey())
|
||||||
|
|
@ -602,11 +622,11 @@ public class GamesPGXServiceImpl implements IGamesService {
|
||||||
.gameCurrencyCode(/*currencyDTO.getCurrency()*/gamesDataBuildDTO.getCurrencyCode())
|
.gameCurrencyCode(/*currencyDTO.getCurrency()*/gamesDataBuildDTO.getCurrencyCode())
|
||||||
.account(resultBean.getMember())
|
.account(resultBean.getMember())
|
||||||
.wagersId(String.valueOf(resultBean.getId()))
|
.wagersId(String.valueOf(resultBean.getId()))
|
||||||
.wagersTime(resultBean.getStartTime().getTime())
|
.wagersTime(DateUtils.convertToMillisWithTimezone(resultBean.getStartTime(),"UTC"))
|
||||||
.betAmount(resultBean.getBet())
|
.betAmount(resultBean.getBet())
|
||||||
.payoffTime(resultBean.getEndTime().getTime())
|
.payoffTime(endTime)
|
||||||
.payoffAmount(payoffAmount)
|
.payoffAmount(payoffAmount)
|
||||||
.settlementTime(resultBean.getEndTime().getTime())
|
.settlementTime(endTime)
|
||||||
.turnover(resultBean.getTurnover())
|
.turnover(resultBean.getTurnover())
|
||||||
.settlementStatus(PGXBetRecordStatus.findSystemCodeByCode(resultBean.getStatus()))
|
.settlementStatus(PGXBetRecordStatus.findSystemCodeByCode(resultBean.getStatus()))
|
||||||
.build();
|
.build();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.ff.game.api.request;
|
||||||
|
|
||||||
|
import com.ff.base.annotation.Excel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事务id请求dto
|
||||||
|
*
|
||||||
|
* @author shi
|
||||||
|
* @date 2025/04/11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class TransactionIdRequestDTO {
|
||||||
|
/** 转出类型 1游戏商转入到用户全部转出 2 用户转移到游戏商 3 游戏商转移额度到平台商 */
|
||||||
|
private Integer exchangeType;
|
||||||
|
|
||||||
|
/** 游戏账号 */
|
||||||
|
private String gameAccount;
|
||||||
|
}
|
||||||
|
|
@ -10,6 +10,7 @@ import com.ff.base.exception.base.ApiException;
|
||||||
import com.ff.base.system.service.ISysConfigService;
|
import com.ff.base.system.service.ISysConfigService;
|
||||||
import com.ff.base.utils.*;
|
import com.ff.base.utils.*;
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
import com.ff.base.utils.sign.Md5Utils;
|
||||||
|
import com.ff.base.utils.uuid.IdUtils;
|
||||||
import com.ff.config.KeyConfig;
|
import com.ff.config.KeyConfig;
|
||||||
import com.ff.game.api.IGamesService;
|
import com.ff.game.api.IGamesService;
|
||||||
import com.ff.game.api.request.*;
|
import com.ff.game.api.request.*;
|
||||||
|
|
@ -240,11 +241,34 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
game.setGameId(StringUtils.addSuffix(GamePlatforms.SA.getCode(), 1));
|
game.setGameId(StringUtils.addSuffix(GamePlatforms.SA.getCode(), 1));
|
||||||
game.setNameInfo(nameInfos);
|
game.setNameInfo(nameInfos);
|
||||||
gameService.updateGame(game);
|
gameService.updateGame(game);
|
||||||
|
}else {
|
||||||
|
List<NameInfo> nameInfos = new ArrayList<>();
|
||||||
|
nameInfos.add(new NameInfo("真人棋牌", "zh-CN"));;
|
||||||
|
game.setNameInfo(nameInfos);
|
||||||
|
gameService.updateGame(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CacheConstants.SA_GAMES;
|
return CacheConstants.SA_GAMES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
//判断是转入还是转出
|
||||||
|
String transactionId = "OUT" + DateUtils.dateTimeNow() + transactionIdRequestDTO.getGameAccount();
|
||||||
|
if (!TransferType.ALL.getCode().equals(transactionIdRequestDTO.getExchangeType())) {
|
||||||
|
transactionId = "IN" + DateUtils.dateTimeNow() + transactionIdRequestDTO.getGameAccount();
|
||||||
|
}
|
||||||
|
|
||||||
|
return transactionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按代理id进行交换转账
|
* 按代理id进行交换转账
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ public class SV388GamesServiceImpl implements IGamesService {
|
||||||
List<Game> gameList = gameService.selectGameList(condition);
|
List<Game> gameList = gameService.selectGameList(condition);
|
||||||
Platform platform = gamesBaseRequestDTO.getVendor();
|
Platform platform = gamesBaseRequestDTO.getVendor();
|
||||||
//不存在这个游戏
|
//不存在这个游戏
|
||||||
if (ObjectUtils.isEmpty(gameList)) {
|
if (CollectionUtils.isEmpty(gameList)) {
|
||||||
Game game = new Game();
|
Game game = new Game();
|
||||||
game.setId(IdUtil.getSnowflakeNextId());
|
game.setId(IdUtil.getSnowflakeNextId());
|
||||||
game.setSortNo(gameService.selectMaxSortNo(platformType, GamePlatforms.SV388.getCode()) + 1);
|
game.setSortNo(gameService.selectMaxSortNo(platformType, GamePlatforms.SV388.getCode()) + 1);
|
||||||
|
|
@ -215,6 +215,15 @@ public class SV388GamesServiceImpl implements IGamesService {
|
||||||
game.setNameInfo(Collections.singletonList(nameInfo));
|
game.setNameInfo(Collections.singletonList(nameInfo));
|
||||||
game.setGameId(StringUtils.addSuffix(GamePlatforms.SV388.getCode(), 1));
|
game.setGameId(StringUtils.addSuffix(GamePlatforms.SV388.getCode(), 1));
|
||||||
gameService.insertGame(game);
|
gameService.insertGame(game);
|
||||||
|
}else {
|
||||||
|
for (Game game : gameList) {
|
||||||
|
NameInfo nameInfo = new NameInfo();
|
||||||
|
nameInfo.setLang("zh-CN");
|
||||||
|
nameInfo.setName("SV388真人");
|
||||||
|
game.setNameInfo(Collections.singletonList(nameInfo));
|
||||||
|
gameService.updateGame(game);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return CacheConstants.SV388_GAMES;
|
return CacheConstants.SV388_GAMES;
|
||||||
}
|
}
|
||||||
|
|
@ -275,6 +284,17 @@ public class SV388GamesServiceImpl implements IGamesService {
|
||||||
|
|
||||||
return exchangeMoney.getId();
|
return exchangeMoney.getId();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
return GamePlatforms.SV388.getCode() + IdUtils.simpleUUID();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 汇兑转移状态
|
* 汇兑转移状态
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,16 @@ public class GamesXKServiceImpl implements IGamesService {
|
||||||
throw new BaseException(xkLoginWithoutRedirectResponseDTO.getMsg());
|
throw new BaseException(xkLoginWithoutRedirectResponseDTO.getMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取交易id
|
||||||
|
*
|
||||||
|
* @param transactionIdRequestDTO 事务id请求dto
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||||
|
return GamePlatforms.XK.getCode() + IdUtils.simpleUUID();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取游戏列表
|
* 获取游戏列表
|
||||||
|
|
@ -251,6 +260,11 @@ public class GamesXKServiceImpl implements IGamesService {
|
||||||
gameService.insertGame(game);
|
gameService.insertGame(game);
|
||||||
} else {
|
} else {
|
||||||
game = games.get(0);
|
game = games.get(0);
|
||||||
|
List<NameInfo> nameInfos = new ArrayList<>();
|
||||||
|
nameInfos.add(new NameInfo(gamesDataDTO.getName(), "zh-CN"));
|
||||||
|
game.setNameInfo(nameInfos);
|
||||||
|
|
||||||
|
gameService.updateGame(game);
|
||||||
}
|
}
|
||||||
gamesDataDTO.setSystemGameId(game.getGameId());
|
gamesDataDTO.setSystemGameId(game.getGameId());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue