feat(game): 添加 SA 游戏平台支持
- 新增 SA游戏平台的接口实现类 GamesSAServiceImpl - 添加 SA 游戏平台相关的错误码和缓存常量 - 实现 SA游戏平台的用户登录、余额转移、投注记录查询等功能 - 新增 SA 游戏类型枚举类 SAGameType - 添加 XML 响应对象的序列化和反序列化支持main-sa
parent
9f6d1710b0
commit
8332c4fdcd
|
@ -63,6 +63,12 @@ public class CacheConstants
|
||||||
*/
|
*/
|
||||||
public static final String FC_GAMES= "fc_games:";
|
public static final String FC_GAMES= "fc_games:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sa游戏
|
||||||
|
*/
|
||||||
|
public static final String SA_GAMES= "sa_games:";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pg游戏投注货币
|
* pg游戏投注货币
|
||||||
|
|
|
@ -28,6 +28,7 @@ public enum ErrorCode {
|
||||||
INSUFFICIENT_PLAYER_BALANCE(1012, "玩家余额不足"),
|
INSUFFICIENT_PLAYER_BALANCE(1012, "玩家余额不足"),
|
||||||
KICK_OUT_AILED(1013, "玩家踢出失败"),
|
KICK_OUT_AILED(1013, "玩家踢出失败"),
|
||||||
ACCOUNT_NOT_ONLINE(1014, "账号不在线"),
|
ACCOUNT_NOT_ONLINE(1014, "账号不在线"),
|
||||||
|
FREQUENT_BALANCE_TRANSFER(1015, "当前游戏账号余额转移频繁"),
|
||||||
;
|
;
|
||||||
|
|
||||||
// 获取错误码
|
// 获取错误码
|
||||||
|
|
|
@ -8,6 +8,7 @@ public enum GamePlatforms {
|
||||||
XK("XK", "XK"),
|
XK("XK", "XK"),
|
||||||
PG("PG", "PG"),
|
PG("PG", "PG"),
|
||||||
FC("FC", "FC"),
|
FC("FC", "FC"),
|
||||||
|
SA("SA", "SA"),
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.ff.base.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sagame类型
|
||||||
|
*
|
||||||
|
* @author shi
|
||||||
|
* @date 2025/03/26
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum SAGameType {
|
||||||
|
// 编号与名称映射
|
||||||
|
M_COLOR_DISC(531, "M 色碟"),
|
||||||
|
M_DICE_BAO(532, "M 骰宝"),
|
||||||
|
M_ROULETTE(533, "M 轮盘"),
|
||||||
|
M_DRAGON_TIGER(534, "M 龙虎"),
|
||||||
|
M_BODING(535, "M 博丁"),
|
||||||
|
M_BLACKJACK(536, "M 黑杰克"),
|
||||||
|
M_ANDABAH(537, "M 安达巴哈"),
|
||||||
|
M_INDIA_ZHA_ZHENG(538, "M 印度炸金花"),
|
||||||
|
M_THAI_DICE_BAO(539, "M 泰国骰宝"),
|
||||||
|
M_FISH_SHRIMP_CRAB(540, "M 鱼虾蟹"),
|
||||||
|
C_ROULETTE(861, "C 轮盘"),
|
||||||
|
C_BACCARAT_C01(871, "百家乐 C01"),
|
||||||
|
C_BACCARAT_C02(872, "百家乐 C02"),
|
||||||
|
C_BACCARAT_C03(873, "百家乐 C03"),
|
||||||
|
C_BACCARAT_C04(874, "百家乐 C04"),
|
||||||
|
C_BACCARAT_C05(875, "百家乐 C05"),
|
||||||
|
C_BACCARAT_C06(876, "百家乐 C06"),
|
||||||
|
C_BACCARAT_C07(877, "百家乐 C07"),
|
||||||
|
C_FAST_BACCARAT_C08(878, "极速百家乐 C08"),
|
||||||
|
D_BACCARAT_D01(901, "百家乐 D01"),
|
||||||
|
D_BACCARAT_D02(902, "百家乐 D02"),
|
||||||
|
D_BACCARAT_D03(903, "百家乐 D03"),
|
||||||
|
D_BACCARAT_D04(904, "百家乐 D04"),
|
||||||
|
D_BACCARAT_D05(905, "百家乐 D05"),
|
||||||
|
D_BACCARAT_D06(906, "百家乐 D06"),
|
||||||
|
D_BACCARAT_D07(907, "百家乐 D07"),
|
||||||
|
D_FAST_BACCARAT_D08(908, "极速百家乐 D08"),
|
||||||
|
D_BLACKJACK(921, "D 黑杰克"),
|
||||||
|
D_DRAGON_TIGER(922, "D 龙虎"),
|
||||||
|
D_BODING(923, "D 博丁"),
|
||||||
|
D_ROULETTE(924, "D 轮盘"),
|
||||||
|
D_DICE_BAO(925, "D 骰宝"),
|
||||||
|
D_THAI_DICE_BAO(926, "D 泰国骰宝"),
|
||||||
|
D_COLOR_DISC(927, "D 色碟");
|
||||||
|
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public static String getNameByCode(int code) {
|
||||||
|
for (SAGameType gameType : values()) {
|
||||||
|
if (gameType.getCode() == code) {
|
||||||
|
return gameType.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -291,7 +291,7 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
|
||||||
// 获取平台接口密钥
|
// 获取平台接口密钥
|
||||||
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
.platformCode(gameBalanceExchange.getPlatformCode())
|
.platformCode(gameBalanceExchange.getPlatformCode())
|
||||||
.currency(gameBalanceExchange.getCurrencyCode()).build());
|
.systemCurrency(gameBalanceExchange.getCurrencyCode()).build());
|
||||||
|
|
||||||
// 检查平台密钥是否存在,否则抛出异常
|
// 检查平台密钥是否存在,否则抛出异常
|
||||||
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||||
|
|
|
@ -58,23 +58,44 @@ public interface SAClient {
|
||||||
@Post("/getGameList")
|
@Post("/getGameList")
|
||||||
XKGamesDTO getGameList(@JSONBody Map<String, Object> params);
|
XKGamesDTO getGameList(@JSONBody Map<String, Object> params);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按代理id进行交换转账
|
* 兑换转入
|
||||||
*
|
*
|
||||||
* @param params 参数
|
* @param params 参数
|
||||||
* @return {@link JILIExchangeMoneyResponseDTO }
|
* @return {@link String }
|
||||||
*/
|
*/
|
||||||
@Post(url = "/exchangeTransferByAgentId")
|
@Post( url ="/api.aspx/CreditBalanceDV",
|
||||||
XKExchangeMoneyResponseDTO exchangeTransferByAgentId( @JSONBody Map<String, Object> params);
|
headers = {
|
||||||
|
"Content-type: application/x-www-form-urlencoded"
|
||||||
|
})
|
||||||
|
String exchangeTransferByInto(@Body String params);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外汇转出
|
||||||
|
*
|
||||||
|
* @param params 参数
|
||||||
|
* @return {@link String }
|
||||||
|
*/
|
||||||
|
@Post( url ="/api.aspx/DebitAllBalanceDV",
|
||||||
|
headers = {
|
||||||
|
"Content-type: application/x-www-form-urlencoded"
|
||||||
|
})
|
||||||
|
String exchangeTransferByOut(@Body String params);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按时间获取投注记录
|
* 按时间获取投注记录
|
||||||
*
|
*
|
||||||
* @param params 参数
|
* @param params 参数
|
||||||
* @return {@link XKBetRecordResponseDTO }
|
* @return {@link String }
|
||||||
*/
|
*/
|
||||||
@Post(url = "/getGameRecordByTime")
|
@Post( url ="/api.aspx/GetAllBetDetailsForTimeIntervalDV",
|
||||||
XKBetRecordResponseDTO getBetRecordByTime( @JSONBody Map<String, Object> params);
|
headers = {
|
||||||
|
"Content-type: application/x-www-form-urlencoded"
|
||||||
|
})
|
||||||
|
String getBetRecordByTime( @Body String params);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.ff.game.api.sa.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 信贷余额响应
|
||||||
|
*
|
||||||
|
* @author shi
|
||||||
|
* @date 2025/03/26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@XmlRootElement(name = "CreditBalanceResponse")
|
||||||
|
public class SACreditBalanceResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误消息 ID
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "ErrorMsgId")
|
||||||
|
private int errorMsgId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误消息
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "ErrorMsg")
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "Username")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "Balance")
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 信用额度
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "CreditAmount")
|
||||||
|
private BigDecimal creditAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "OrderId")
|
||||||
|
private String orderId;
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.ff.game.api.sa.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sadebit全平衡反应
|
||||||
|
*
|
||||||
|
* @author shi
|
||||||
|
* @date 2025/03/26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@XmlRootElement(name = "DebitAllBalanceResponse")
|
||||||
|
public class SADebitAllBalanceResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误消息 ID
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "ErrorMsgId")
|
||||||
|
private int errorMsgId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误消息
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "ErrorMsg")
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "Username")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 借记金额
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "DebitAmount")
|
||||||
|
private BigDecimal debitAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "OrderId")
|
||||||
|
private String orderId;
|
||||||
|
}
|
|
@ -0,0 +1,431 @@
|
||||||
|
package com.ff.game.api.sa.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.smartcardio.Card;
|
||||||
|
import javax.xml.bind.annotation.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GetAllBetDetailsResponse 类表示获取所有投注详情的响应数据。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@XmlRootElement(name = "GetAllBetDetailsForTimeIntervalResponse")
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
public class SAGetAllBetDetailsResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回的记录数。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "NumOfRecord")
|
||||||
|
private int numOfRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 包含投注详情的列表。
|
||||||
|
*/
|
||||||
|
@XmlElementWrapper(name = "BetDetailList")
|
||||||
|
@XmlElement(name = "BetDetail")
|
||||||
|
private List<BetDetail> betDetailList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误信息的 ID。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "ErrorMsgId")
|
||||||
|
private int errorMsgId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误信息描述。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "ErrorMsg")
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BetDetail 类表示单个投注的详细信息。
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@Data
|
||||||
|
public static class BetDetail {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投注时间。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BetTime")
|
||||||
|
private Date betTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算时间。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "PayoutTime")
|
||||||
|
private Date payoutTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户名。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "Username")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 桌台 ID。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "HostID")
|
||||||
|
private int hostID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保留字段。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "Detail")
|
||||||
|
private String detail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏编号。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "GameID")
|
||||||
|
private String gameID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 局编号。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "Round")
|
||||||
|
private int round;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 靴编号。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "Set")
|
||||||
|
private int set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投注编号。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BetID")
|
||||||
|
private long betID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 币种。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "Currency")
|
||||||
|
private String currency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投注金额。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BetAmount")
|
||||||
|
private BigDecimal betAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效投注额或洗码量。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "Rolling")
|
||||||
|
private BigDecimal rolling;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 输赢金额。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "ResultAmount")
|
||||||
|
private BigDecimal resultAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投注后的余额。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "Balance")
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏类型。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "GameType")
|
||||||
|
private String gameType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投注类型。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BetType")
|
||||||
|
private int betType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 投注来源。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BetSource")
|
||||||
|
private int betSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单一钱包下注交易编号。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "TransactionID")
|
||||||
|
private long transactionID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下注确认状态:0 - 手动,1 - 自动。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BetConfirmation")
|
||||||
|
private int betConfirmation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏结果。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "GameResult")
|
||||||
|
private GameResult gameResult;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GameResult 类表示游戏的结果。
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@Data
|
||||||
|
public static class GameResult {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 百家乐游戏的结果。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BaccaratResult")
|
||||||
|
private BaccaratResult baccaratResult;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BaccaratResult 类表示百家乐游戏的具体结果。
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@Data
|
||||||
|
public static class BaccaratResult {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 玩家卡1。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "PlayerCard1")
|
||||||
|
private Card playerCard1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 玩家卡2。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "PlayerCard2")
|
||||||
|
private Card playerCard2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 玩家卡3。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "PlayerCard3")
|
||||||
|
private Card playerCard3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 庄家卡1。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BankerCard1")
|
||||||
|
private Card bankerCard1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 庄家卡2。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BankerCard2")
|
||||||
|
private Card bankerCard2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏结果详情。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "ResultDetail")
|
||||||
|
private ResultDetail resultDetail;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Card 类表示一张牌的基本信息,包括花色和点数。
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@Data
|
||||||
|
public static class Card {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 花色(例如:1 = 黑桃, 2 = 红心, 3 = 方块, 4 = 梅花)。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "Suit")
|
||||||
|
private int suit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点数(例如:2 - 10、J、Q、K、A)。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "Rank")
|
||||||
|
private int rank;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ResultDetail 类表示游戏的详细结果,包括多个胜负状态和奖励信息。
|
||||||
|
*/
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
|
@Data
|
||||||
|
public static class ResultDetail {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否平局。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRTie")
|
||||||
|
private boolean brTie;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否玩家赢。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRPlayerWin")
|
||||||
|
private boolean brPlayerWin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否庄家赢。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRBankerWin")
|
||||||
|
private boolean brBankerWin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否玩家对子。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRPlayerPair")
|
||||||
|
private boolean brPlayerPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否庄家对子。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRBankerPair")
|
||||||
|
private boolean brBankerPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否两张牌幸运六。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRS2CardsLuckySix")
|
||||||
|
private boolean brS2CardsLuckySix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否三张牌幸运六。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRS3CardsLuckySix")
|
||||||
|
private boolean brS3CardsLuckySix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否三张牌幸运六(SS)。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSS2CardsLuckySix")
|
||||||
|
private boolean brSSS2CardsLuckySix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否三张牌幸运六(SS)。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSS3CardsLuckySix")
|
||||||
|
private boolean brSSS3CardsLuckySix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否玩家奖金(SS)。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSPlayerBonus")
|
||||||
|
private boolean brSPlayerBonus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否庄家奖金(SS)。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSBankerBonus")
|
||||||
|
private boolean brSBankerBonus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否和局(SS)。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSTie")
|
||||||
|
private boolean brSSTie;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否玩家胜(SS)。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSPlayerWin")
|
||||||
|
private boolean brSSPlayerWin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否庄家胜(SS)。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSBankerWin")
|
||||||
|
private boolean brSSBankerWin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否玩家对子(SS)。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSPlayerPair")
|
||||||
|
private boolean brSSPlayerPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否庄家对子(SS)。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSBankerPair")
|
||||||
|
private boolean brSSBankerPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否玩家自然。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRPlayerNatural")
|
||||||
|
private boolean brPlayerNatural;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否庄家自然。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRBankerNatural")
|
||||||
|
private boolean brBankerNatural;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否玩家自然(SS)。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSPlayerNatural")
|
||||||
|
private boolean brSSPlayerNatural;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否庄家自然(SS)。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSBankerNatural")
|
||||||
|
private boolean brSSBankerNatural;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否任意对子。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSAnyPair")
|
||||||
|
private boolean brSAnyPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否三张对子。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSSAnyPair")
|
||||||
|
private boolean brSSSAnyPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否完美对子。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSPerfectPair")
|
||||||
|
private boolean brSPerfectPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否完美三张对子。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSSPerfectPair")
|
||||||
|
private boolean brSSSPerfectPair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否三张牌玩家奖金。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSSPlayerBonus")
|
||||||
|
private boolean brSSSPlayerBonus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否三张牌庄家奖金。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSSBankerBonus")
|
||||||
|
private boolean brSSSBankerBonus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否三张牌幸运六。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSSSLuckySix")
|
||||||
|
private boolean brSSSLuckySix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否两张牌幸运六。
|
||||||
|
*/
|
||||||
|
@XmlElement(name = "BRSLuckySix")
|
||||||
|
private boolean brSLuckySix;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.ff.game.api.sa.dto;
|
package com.ff.game.api.sa.dto;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -12,6 +14,7 @@ import java.math.BigDecimal;
|
||||||
* @date 2025/03/26
|
* @date 2025/03/26
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
@XmlRootElement(name = "GetUserStatusResponse")
|
@XmlRootElement(name = "GetUserStatusResponse")
|
||||||
public class SAGetUserStatusResponse {
|
public class SAGetUserStatusResponse {
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.ff.game.api.sa.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
@ -13,6 +15,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
* @date 2025/03/25
|
* @date 2025/03/25
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
@XmlRootElement(name = "RegUserInfoResponse")
|
@XmlRootElement(name = "RegUserInfoResponse")
|
||||||
public class SARegUserInfoResponse {
|
public class SARegUserInfoResponse {
|
||||||
@XmlElement(name = "ErrorMsgId")
|
@XmlElement(name = "ErrorMsgId")
|
||||||
|
|
|
@ -17,9 +17,7 @@ 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.*;
|
||||||
import com.ff.game.api.sa.client.SAClient;
|
import com.ff.game.api.sa.client.SAClient;
|
||||||
import com.ff.game.api.sa.dto.SALoginRequestResponse;
|
import com.ff.game.api.sa.dto.*;
|
||||||
import com.ff.game.api.sa.dto.SARegUserInfoResponse;
|
|
||||||
import com.ff.game.api.sa.dto.SAGetUserStatusResponse;
|
|
||||||
import com.ff.game.api.xk.dto.*;
|
import com.ff.game.api.xk.dto.*;
|
||||||
import com.ff.game.domain.*;
|
import com.ff.game.domain.*;
|
||||||
import com.ff.game.dto.GameSecretKeyCurrencyDTO;
|
import com.ff.game.dto.GameSecretKeyCurrencyDTO;
|
||||||
|
@ -93,6 +91,20 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
@Resource
|
@Resource
|
||||||
private IGameNameService gameNameService;
|
private IGameNameService gameNameService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏id
|
||||||
|
*/
|
||||||
|
private static final Long GAME_ID = 1904452832756002817L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台ID
|
||||||
|
*/
|
||||||
|
private static final Long PLATFORM_ID = 1904411420157108225L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏名称id
|
||||||
|
*/
|
||||||
|
private static final Long GAME_NAME_ID = 1904452832756002817L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得就是成功
|
* 获得就是成功
|
||||||
|
@ -103,6 +115,7 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
private Boolean getIsSuccess(Integer errorCode) {
|
private Boolean getIsSuccess(Integer errorCode) {
|
||||||
ApiException.isTrue(113 != errorCode, ErrorCode.GAME_ACCOUNT_CREATION_FAILED.getCode());
|
ApiException.isTrue(113 != errorCode, ErrorCode.GAME_ACCOUNT_CREATION_FAILED.getCode());
|
||||||
ApiException.isTrue(116 != errorCode, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
ApiException.isTrue(116 != errorCode, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||||
|
ApiException.isTrue(122 != errorCode, ErrorCode.FREQUENT_BALANCE_TRANSFER.getCode());
|
||||||
return 0 == errorCode;
|
return 0 == errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,8 +186,7 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
.balance(saGetUserStatusResponse.getBalance())
|
.balance(saGetUserStatusResponse.getBalance())
|
||||||
.status(saGetUserStatusResponse.isOnline() ? GameMemberStatus.ONLINE.getCode() : GameMemberStatus.OFFLINE.getCode())
|
.status(saGetUserStatusResponse.isOnline() ? GameMemberStatus.ONLINE.getCode() : GameMemberStatus.OFFLINE.getCode())
|
||||||
.build();
|
.build();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw new ApiException(ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
throw new ApiException(ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +199,7 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String loginWithoutRedirect(GamesLogin gamesLogin) {
|
public String loginWithoutRedirect(GamesLogin gamesLogin) {
|
||||||
log.info("GamesXKServiceImpl [loginWithoutRedirect] 请求参数 {}", gamesLogin);
|
log.info("GamesSAServiceImpl [loginWithoutRedirect] 请求参数 {}", gamesLogin);
|
||||||
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
params.put("Username", gamesLogin.getAccount());
|
params.put("Username", gamesLogin.getAccount());
|
||||||
|
@ -210,10 +222,10 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
params.put("token", saLoginRequestResponse.getToken());
|
params.put("token", saLoginRequestResponse.getToken());
|
||||||
params.put("lobby", hallCode);
|
params.put("lobby", hallCode);
|
||||||
params.put("lang", gamesLogin.getLang());
|
params.put("lang", gamesLogin.getLang());
|
||||||
if (StringUtils.isEmpty(gamesLogin.getHomeUrl())){
|
if (StringUtils.isEmpty(gamesLogin.getHomeUrl())) {
|
||||||
params.put("returnurl", gamesLogin.getHomeUrl());
|
params.put("returnurl", gamesLogin.getHomeUrl());
|
||||||
}
|
}
|
||||||
return loginUrl+"?"+JsonUtil.mapToQueryString(params);
|
return loginUrl + "?" + JsonUtil.mapToQueryString(params);
|
||||||
} else {
|
} else {
|
||||||
throw new ApiException(ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
throw new ApiException(ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||||
}
|
}
|
||||||
|
@ -229,58 +241,30 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO) {
|
public String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO) {
|
||||||
|
GamePlatform gamePlatform = gamePlatformService.selectGamePlatformById(PLATFORM_ID);
|
||||||
List<XKGamesDTO.DataBean> gamesDatas = redisCache.getCacheList(CacheConstants.XK_GAMES);
|
|
||||||
if (!CollectionUtils.isEmpty(gamesDatas)) {
|
|
||||||
return CacheConstants.XK_GAMES;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
|
||||||
params.put("agentId", gamesBaseRequestDTO.getAgentId());
|
|
||||||
String query = JsonUtil.mapToQueryString(params);
|
|
||||||
gamesBaseRequestDTO.setQuery(query);
|
|
||||||
String key = this.getKey(gamesBaseRequestDTO, null);
|
|
||||||
params.put("key", key);
|
|
||||||
|
|
||||||
XKGamesDTO xkGamesDTO = SAClient.getGameList(params);
|
|
||||||
//判断是否获取成功
|
|
||||||
if (this.getIsSuccess(xkGamesDTO.getCode())) {
|
|
||||||
|
|
||||||
for (XKGamesDTO.DataBean gamesDataDTO : xkGamesDTO.getData()) {
|
|
||||||
GamePlatform gamePlatform = GamePlatform.builder()
|
|
||||||
.platformType(XKGameType.findSystemByCode(gamesDataDTO.getGameCategoryId()))
|
|
||||||
.platformCode(GamePlatforms.XK.getCode())
|
|
||||||
.build();
|
|
||||||
List<GamePlatform> gamePlatforms = gamePlatformService.selectGamePlatformList(gamePlatform);
|
|
||||||
//没有此平台就新增一个平台
|
//没有此平台就新增一个平台
|
||||||
if (CollectionUtils.isEmpty(gamePlatforms)) {
|
if (ObjectUtils.isEmpty(gamePlatform)) {
|
||||||
gamePlatform.setPlatformName(GamePlatforms.XK.getInfo() + XKGameType.findInfoByCode(gamesDataDTO.getGameCategoryId()));
|
gamePlatform = new GamePlatform();
|
||||||
|
gamePlatform.setPlatformType(PlatformType.CARD_GAME.getCode());
|
||||||
|
gamePlatform.setPlatformName(GamePlatforms.SA.getInfo() + PlatformType.CARD_GAME.getName());
|
||||||
gamePlatform.setSortNo(gamePlatformService.selectMaxSortNo() + 1);
|
gamePlatform.setSortNo(gamePlatformService.selectMaxSortNo() + 1);
|
||||||
gamePlatform.setCreateBy(Constants.SYSTEM);
|
gamePlatform.setCreateBy(Constants.SYSTEM);
|
||||||
gamePlatformService.insertGamePlatform(gamePlatform);
|
gamePlatformService.insertGamePlatform(gamePlatform);
|
||||||
} else {
|
|
||||||
gamePlatform = gamePlatforms.get(0);
|
|
||||||
}
|
}
|
||||||
Game game = Game.builder()
|
Game game = gameService.selectGameById(GAME_ID);
|
||||||
.platformId(gamePlatform.getId())
|
|
||||||
.gameCode(String.valueOf(gamesDataDTO.getGameId()))
|
|
||||||
.build();
|
|
||||||
List<Game> games = gameService.selectGameList(game);
|
|
||||||
//不存在这个游戏
|
//不存在这个游戏
|
||||||
if (CollectionUtils.isEmpty(games)) {
|
if (ObjectUtils.isEmpty(game)) {
|
||||||
game.setGameSourceType(gamesDataDTO.getGameCategoryId());
|
game = new Game();
|
||||||
game.setFreespin(gamesDataDTO.isFreeSpin());
|
|
||||||
game.setSortNo(gameService.selectMaxSortNoByPlatformId(gamePlatform.getId()) + 1);
|
game.setSortNo(gameService.selectMaxSortNoByPlatformId(gamePlatform.getId()) + 1);
|
||||||
game.setGameName(gamesDataDTO.getName());
|
game.setPlatformId(gamePlatform.getId());
|
||||||
|
game.setGameCode("1");
|
||||||
|
game.setGameSourceType(1);
|
||||||
|
game.setGameName("真人棋牌");
|
||||||
game.setCreateBy(Constants.SYSTEM);
|
game.setCreateBy(Constants.SYSTEM);
|
||||||
gameService.insertGame(game);
|
gameService.insertGame(game);
|
||||||
} else {
|
|
||||||
game = games.get(0);
|
|
||||||
}
|
}
|
||||||
gamesDataDTO.setSystemGameId(game.getId());
|
GameName gameName = gameNameService.selectGameNameById(GAME_NAME_ID);
|
||||||
List<GameName> gameNames = gameNameService.selectGameNameList(GameName.builder().gameId(game.getId()).gameName(game.getGameName()).build());
|
if (ObjectUtils.isEmpty(gameName)) {
|
||||||
if (CollectionUtils.isEmpty(gameNames)) {
|
|
||||||
gameNameService.insertGameName(GameName.builder()
|
gameNameService.insertGameName(GameName.builder()
|
||||||
.gameId(game.getId())
|
.gameId(game.getId())
|
||||||
.gameName(game.getGameName())
|
.gameName(game.getGameName())
|
||||||
|
@ -288,18 +272,7 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
.createBy(Constants.SYSTEM)
|
.createBy(Constants.SYSTEM)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
return CacheConstants.SA_GAMES;
|
||||||
}
|
|
||||||
|
|
||||||
redisCache.deleteObject(CacheConstants.XK_GAMES);
|
|
||||||
redisCache.setCacheList(CacheConstants.XK_GAMES, xkGamesDTO.getData());
|
|
||||||
redisCache.expire(CacheConstants.XK_GAMES, 5L, TimeUnit.HOURS);
|
|
||||||
} else {
|
|
||||||
throw new BaseException(xkGamesDTO.getMsg());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return CacheConstants.XK_GAMES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -311,14 +284,14 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO) {
|
public Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO) {
|
||||||
log.info("GamesXKServiceImpl [exchangeTransferByAgentId] 请求参数 {}", exchangeTransferMoneyRequestDTO);
|
log.info("GamesSAServiceImpl [exchangeTransferByAgentId] 请求参数 {}", exchangeTransferMoneyRequestDTO);
|
||||||
GameSecretKeyCurrency currencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
GameSecretKeyCurrency currencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
.platformCode(GamePlatforms.XK.getInfo())
|
.platformCode(GamePlatforms.SA.getInfo())
|
||||||
.code(exchangeTransferMoneyRequestDTO.getAgentId())
|
.code(exchangeTransferMoneyRequestDTO.getAgentId())
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
Member member = memberService.selectMemberByGameAccount(exchangeTransferMoneyRequestDTO.getAccount());
|
Member member = memberService.selectMemberByGameAccount(exchangeTransferMoneyRequestDTO.getAccount());
|
||||||
String transactionId = GamePlatforms.XK.getCode() + IdUtils.simpleUUID();
|
|
||||||
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(
|
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(
|
||||||
GameExchangeMoney.builder()
|
GameExchangeMoney.builder()
|
||||||
.tenantKey(exchangeTransferMoneyRequestDTO.getTenantKey())
|
.tenantKey(exchangeTransferMoneyRequestDTO.getTenantKey())
|
||||||
|
@ -326,6 +299,12 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
Assert.isTrue(CollectionUtils.isEmpty(gameExchangeMonies), "订单号重复");
|
Assert.isTrue(CollectionUtils.isEmpty(gameExchangeMonies), "订单号重复");
|
||||||
|
//判断是转入还是转出
|
||||||
|
String transactionId = "OUT" + DateUtils.dateTimeNow() + exchangeTransferMoneyRequestDTO.getAccount();
|
||||||
|
if (!TransferType.ALL.getCode().equals(exchangeTransferMoneyRequestDTO.getTransferType())) {
|
||||||
|
transactionId = "IN" + DateUtils.dateTimeNow() + exchangeTransferMoneyRequestDTO.getAccount();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//获取下一个自增id
|
//获取下一个自增id
|
||||||
GameExchangeMoney exchangeMoney = GameExchangeMoney
|
GameExchangeMoney exchangeMoney = GameExchangeMoney
|
||||||
|
@ -338,39 +317,65 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
.currencyCode(currencyDTO.getSystemCurrency())
|
.currencyCode(currencyDTO.getSystemCurrency())
|
||||||
.memberId(member.getId())
|
.memberId(member.getId())
|
||||||
.transactionId(transactionId)
|
.transactionId(transactionId)
|
||||||
.platformCode(GamePlatforms.XK.getCode())
|
.platformCode(GamePlatforms.SA.getCode())
|
||||||
.build();
|
.build();
|
||||||
exchangeMoney.setCreateBy(Constants.SYSTEM);
|
exchangeMoney.setCreateBy(Constants.SYSTEM);
|
||||||
//接口限制限制50字符
|
if (TransferType.ALL.getCode().equals(exchangeTransferMoneyRequestDTO.getTransferType())) {
|
||||||
exchangeMoney.setTransactionId(GamePlatforms.XK.getCode() + IdUtils.simpleUUID());
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
params.put("account", exchangeTransferMoneyRequestDTO.getAccount());
|
params.put("Username", exchangeTransferMoneyRequestDTO.getAccount());
|
||||||
params.put("transactionId", exchangeMoney.getTransactionId());
|
params.put("OrderId", exchangeMoney.getTransactionId());
|
||||||
params.put("amount", exchangeTransferMoneyRequestDTO.getAmount().stripTrailingZeros().toString());
|
|
||||||
params.put("transferType", exchangeTransferMoneyRequestDTO.getTransferType());
|
|
||||||
params.put("agentId", exchangeTransferMoneyRequestDTO.getAgentId());
|
|
||||||
String query = JsonUtil.mapToQueryString(params);
|
String query = JsonUtil.mapToQueryString(params);
|
||||||
exchangeTransferMoneyRequestDTO.setQuery(query);
|
exchangeTransferMoneyRequestDTO.setQuery(query);
|
||||||
String key = this.getKey(exchangeTransferMoneyRequestDTO, null);
|
String key = this.getKey(exchangeTransferMoneyRequestDTO, "DebitAllBalanceDV");
|
||||||
params.put("key", key);
|
String result = SAClient.exchangeTransferByOut(key);
|
||||||
XKExchangeMoneyResponseDTO exchangeMoneyResponse = SAClient.exchangeTransferByAgentId(params);
|
SADebitAllBalanceResponse saDebitAllBalanceResponse = XmlUtils.xmlDecrypt(result, SADebitAllBalanceResponse.class);
|
||||||
|
Integer errorCode = saDebitAllBalanceResponse.getErrorMsgId();
|
||||||
//判断是否转移成功
|
//判断是否转移成功
|
||||||
if (this.getIsSuccess(exchangeMoneyResponse.getCode())) {
|
if (this.getIsSuccess(errorCode)) {
|
||||||
XKExchangeMoneyResponseDTO.DataBean exchangeMoneyResponseData = exchangeMoneyResponse.getData();
|
|
||||||
ApiException.isTrue(!StatusType.FAILURE.getValue().equals(exchangeMoneyResponseData.getStatus()), ErrorCode.BALANCE_TRANSFER_FAILED.getCode());
|
|
||||||
|
|
||||||
//更新数据
|
//更新数据
|
||||||
exchangeMoney.setBalance(NumberUtil.sub(exchangeMoneyResponseData.getCurrencyAfter(), exchangeMoneyResponseData.getCurrencyBefore()).abs());
|
exchangeMoney.setBalance(saDebitAllBalanceResponse.getDebitAmount());
|
||||||
exchangeMoney.setCoinBefore(exchangeMoneyResponseData.getCoinBefore());
|
exchangeMoney.setCoinBefore(saDebitAllBalanceResponse.getDebitAmount());
|
||||||
exchangeMoney.setCoinAfter(exchangeMoneyResponseData.getCoinAfter());
|
exchangeMoney.setCoinAfter(BigDecimal.ZERO);
|
||||||
exchangeMoney.setCurrencyBefore(exchangeMoneyResponseData.getCurrencyBefore());
|
exchangeMoney.setCurrencyBefore(exchangeMoney.getCurrencyBefore());
|
||||||
exchangeMoney.setCurrencyAfter(exchangeMoneyResponseData.getCurrencyAfter());
|
exchangeMoney.setCurrencyAfter(exchangeMoney.getCurrencyAfter());
|
||||||
exchangeMoney.setStatus(exchangeMoneyResponseData.getStatus());
|
exchangeMoney.setStatus(StatusType.SUCCESS.getValue());
|
||||||
gameExchangeMoneyService.insertGameExchangeMoney(exchangeMoney);
|
gameExchangeMoneyService.insertGameExchangeMoney(exchangeMoney);
|
||||||
} else {
|
} else {
|
||||||
log.error("GamesXKServiceImpl [exchangeTransferByAgentId] 金额转移失败,错误代码{},错误信息{}", exchangeMoneyResponse.getCode(), exchangeMoneyResponse.getMsg());
|
log.error("GamesXKServiceImpl [exchangeTransferByAgentId] 金额转移失败,错误代码{}", errorCode);
|
||||||
throw new BaseException(exchangeMoneyResponse.getMsg());
|
throw new ApiException(ErrorCode.BALANCE_TRANSFER_FAILED.getCode());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
|
params.put("Username", exchangeTransferMoneyRequestDTO.getAccount());
|
||||||
|
params.put("OrderId", exchangeMoney.getTransactionId());
|
||||||
|
params.put("CreditAmount", exchangeTransferMoneyRequestDTO.getAmount().stripTrailingZeros().toPlainString());
|
||||||
|
params.put("CurrencyType", currencyDTO.getCurrency());
|
||||||
|
String query = JsonUtil.mapToQueryString(params);
|
||||||
|
exchangeTransferMoneyRequestDTO.setQuery(query);
|
||||||
|
String key = this.getKey(exchangeTransferMoneyRequestDTO, "CreditBalanceDV");
|
||||||
|
String result = SAClient.exchangeTransferByInto(key);
|
||||||
|
SACreditBalanceResponse saCreditBalanceResponse = XmlUtils.xmlDecrypt(result, SACreditBalanceResponse.class);
|
||||||
|
Integer errorCode = saCreditBalanceResponse.getErrorMsgId();
|
||||||
|
//判断是否转移成功
|
||||||
|
if (this.getIsSuccess(errorCode)) {
|
||||||
|
|
||||||
|
|
||||||
|
//更新数据
|
||||||
|
exchangeMoney.setBalance(saCreditBalanceResponse.getCreditAmount());
|
||||||
|
exchangeMoney.setCoinBefore(NumberUtil.sub(saCreditBalanceResponse.getBalance(), saCreditBalanceResponse.getCreditAmount()).abs());
|
||||||
|
exchangeMoney.setCoinAfter(saCreditBalanceResponse.getBalance());
|
||||||
|
exchangeMoney.setCurrencyBefore(exchangeMoney.getCoinBefore());
|
||||||
|
exchangeMoney.setCurrencyAfter(exchangeMoney.getCoinAfter());
|
||||||
|
exchangeMoney.setStatus(StatusType.SUCCESS.getValue());
|
||||||
|
gameExchangeMoneyService.insertGameExchangeMoney(exchangeMoney);
|
||||||
|
} else {
|
||||||
|
log.error("GamesXKServiceImpl [exchangeTransferByAgentId] 金额转移失败,错误代码{}", errorCode);
|
||||||
|
throw new ApiException(ErrorCode.BALANCE_TRANSFER_FAILED.getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return exchangeMoney.getId();
|
return exchangeMoney.getId();
|
||||||
}
|
}
|
||||||
|
@ -395,52 +400,33 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean getBetRecordByTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
public Boolean getBetRecordByTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
||||||
List<GameBettingDetails> gameBettingDetails = new ArrayList<>();
|
String startTime = DateUtils.convertTimeZone(betRecordByTimeDTO.getStartTime(), "Asia/Shanghai", DateUtils.YYYY_MM_DD_HH_MM_SS);
|
||||||
|
String endTime = DateUtils.convertTimeZone(betRecordByTimeDTO.getEndTime(), "Asia/Shanghai", DateUtils.YYYY_MM_DD_HH_MM_SS);
|
||||||
|
|
||||||
//请求参数
|
//请求参数
|
||||||
log.info("GamesXKServiceImpl [getBetRecordByTime] 请求参数 {}", betRecordByTimeDTO);
|
log.info("GamesSAServiceImpl [getBetRecordByTime] 请求参数 {}", betRecordByTimeDTO);
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
params.put("startTime", betRecordByTimeDTO.getStartTime());
|
params.put("FromTime", startTime);
|
||||||
params.put("endTime", betRecordByTimeDTO.getEndTime());
|
params.put("ToTime",endTime);
|
||||||
params.put("page", betRecordByTimeDTO.getPage());
|
|
||||||
params.put("pageLimit", betRecordByTimeDTO.getPageLimit());
|
|
||||||
params.put("agentId", betRecordByTimeDTO.getAgentId());
|
|
||||||
String query = JsonUtil.mapToQueryString(params);
|
String query = JsonUtil.mapToQueryString(params);
|
||||||
betRecordByTimeDTO.setQuery(query);
|
betRecordByTimeDTO.setQuery(query);
|
||||||
String key = this.getKey(betRecordByTimeDTO, null);
|
String key = this.getKey(betRecordByTimeDTO, "GetAllBetDetailsForTimeIntervalDV");
|
||||||
params.put("key", key);
|
|
||||||
XKBetRecordResponseDTO xkBetRecordResponseDTO = SAClient.getBetRecordByTime(params);
|
String result = SAClient.getBetRecordByTime(key);
|
||||||
|
SAGetAllBetDetailsResponse saGetAllBetDetailsResponse = XmlUtils.xmlDecrypt(result, SAGetAllBetDetailsResponse.class);
|
||||||
|
Integer errorCode = saGetAllBetDetailsResponse.getErrorMsgId();
|
||||||
|
|
||||||
|
|
||||||
//判断是否获取成功
|
//判断是否获取成功
|
||||||
if (this.getIsSuccess(xkBetRecordResponseDTO.getCode())) {
|
if (this.getIsSuccess(errorCode)) {
|
||||||
//数据组装
|
//数据组装
|
||||||
XKBetRecordResponseDTO.DataBean dataBean = xkBetRecordResponseDTO.getData();
|
this.batchInsert(saGetAllBetDetailsResponse);
|
||||||
this.batchInsert(xkBetRecordResponseDTO);
|
|
||||||
|
|
||||||
//获取下一页数据
|
|
||||||
while (!Objects.equals(dataBean.getCurrentPage(), dataBean.getTotalPages()) && dataBean.getTotalPages() > 0) {
|
|
||||||
betRecordByTimeDTO.setPage(dataBean.getCurrentPage() + 1);
|
|
||||||
//请求参数
|
|
||||||
params = new LinkedHashMap<>();
|
|
||||||
params.put("startTime", betRecordByTimeDTO.getStartTime());
|
|
||||||
params.put("endTime", betRecordByTimeDTO.getEndTime());
|
|
||||||
params.put("page", betRecordByTimeDTO.getPage());
|
|
||||||
params.put("pageLimit", betRecordByTimeDTO.getPageLimit());
|
|
||||||
params.put("agentId", betRecordByTimeDTO.getAgentId());
|
|
||||||
query = JsonUtil.mapToQueryString(params);
|
|
||||||
betRecordByTimeDTO.setQuery(query);
|
|
||||||
key = this.getKey(betRecordByTimeDTO, null);
|
|
||||||
params.put("key", key);
|
|
||||||
xkBetRecordResponseDTO = SAClient.getBetRecordByTime(params);
|
|
||||||
this.batchInsert(xkBetRecordResponseDTO);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
} else {
|
} else {
|
||||||
log.error("GamesXKServiceImpl [getBetRecordByTime] 获取投注记录失败,错误代码{},错误信息{}", xkBetRecordResponseDTO.getCode(), xkBetRecordResponseDTO.getMsg());
|
log.error("GamesXKServiceImpl [getBetRecordByTime] 获取投注记录失败,错误代码{}", errorCode);
|
||||||
throw new BaseException(xkBetRecordResponseDTO.getMsg());
|
|
||||||
}
|
}
|
||||||
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -538,21 +524,21 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
/**
|
/**
|
||||||
* 批量插入
|
* 批量插入
|
||||||
*
|
*
|
||||||
* @param xkBetRecordResponseDTO xk下注记录响应dto
|
* @param saGetAllBetDetailsResponse sa获取所有投注详细信息响应
|
||||||
*/
|
*/
|
||||||
private void batchInsert(XKBetRecordResponseDTO xkBetRecordResponseDTO) {
|
private void batchInsert(SAGetAllBetDetailsResponse saGetAllBetDetailsResponse) {
|
||||||
List<GameBettingDetails> gameBettingDetails = new ArrayList<>();
|
List<GameBettingDetails> gameBettingDetails = new ArrayList<>();
|
||||||
List<String> wagersIds = new ArrayList<>();
|
List<String> wagersIds = new ArrayList<>();
|
||||||
//数据组装
|
//数据组装
|
||||||
XKBetRecordResponseDTO.DataBean dataBean = xkBetRecordResponseDTO.getData();
|
List<SAGetAllBetDetailsResponse.BetDetail> result = saGetAllBetDetailsResponse.getBetDetailList();
|
||||||
//数据转化
|
//数据转化
|
||||||
for (XKBetRecordResponseDTO.DataBean.ResultBean bean : dataBean.getResult()) {
|
for (SAGetAllBetDetailsResponse.BetDetail bean : result) {
|
||||||
GameBettingDetails bettingDetails = this.dataBuild(GamesDataBuildDTO.builder().data(bean).build());
|
GameBettingDetails bettingDetails = this.dataBuild(GamesDataBuildDTO.builder().data(bean).build());
|
||||||
if (!ObjectUtils.isEmpty(bettingDetails)) {
|
if (!ObjectUtils.isEmpty(bettingDetails)) {
|
||||||
bettingDetails.setId(IdUtil.getSnowflakeNextId());
|
bettingDetails.setId(IdUtil.getSnowflakeNextId());
|
||||||
gameBettingDetails.add(bettingDetails);
|
gameBettingDetails.add(bettingDetails);
|
||||||
}
|
}
|
||||||
wagersIds.add(String.valueOf(bean.getWagersId()));
|
wagersIds.add(String.valueOf(bean.getBetID()));
|
||||||
}
|
}
|
||||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
||||||
//查询重复数据id
|
//查询重复数据id
|
||||||
|
@ -577,50 +563,56 @@ public class GamesSAServiceImpl implements IGamesService {
|
||||||
@Override
|
@Override
|
||||||
public GameBettingDetails dataBuild(GamesDataBuildDTO gamesDataBuildDTO) {
|
public GameBettingDetails dataBuild(GamesDataBuildDTO gamesDataBuildDTO) {
|
||||||
//转化类
|
//转化类
|
||||||
XKBetRecordResponseDTO.DataBean.ResultBean resultBean = (XKBetRecordResponseDTO.DataBean.ResultBean) gamesDataBuildDTO.getData();
|
SAGetAllBetDetailsResponse.BetDetail resultBean = (SAGetAllBetDetailsResponse.BetDetail) gamesDataBuildDTO.getData();
|
||||||
|
|
||||||
GameSecretKeyCurrency currencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
GameSecretKeyCurrency currencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
.platformCode(GamePlatforms.XK.getInfo())
|
.platformCode(GamePlatforms.SA.getInfo())
|
||||||
.code(resultBean.getAgentId())
|
.currency(resultBean.getCurrency())
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
Member member = memberService.selectMemberByGameAccount(resultBean.getAccount());
|
Member member = memberService.selectMemberByGameAccount(resultBean.getUsername());
|
||||||
if (ObjectUtils.isEmpty(member)) {
|
if (ObjectUtils.isEmpty(member)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<XKGamesDTO.DataBean> gamesDatas = redisCache.getCacheList(CacheConstants.XK_GAMES);
|
|
||||||
Map<String, XKGamesDTO.DataBean> dataDTOMap = gamesDatas.stream().collect(Collectors.toMap(XKGamesDTO.DataBean::getGameId, e -> e));
|
|
||||||
XKGamesDTO.DataBean gamesDataDTO = dataDTOMap.get(resultBean.getGameId());
|
|
||||||
BigDecimal payoffAmount = BigDecimal.ZERO;
|
|
||||||
|
|
||||||
if (GameStatus.WIN.getCode().equals(resultBean.getStatus())) {
|
|
||||||
payoffAmount = NumberUtil.sub(resultBean.getPayoffAmount(), resultBean.getTurnover());
|
Game game = gameService.selectGameById(GAME_ID);
|
||||||
} else if (GameStatus.FAIL.getCode().equals(resultBean.getStatus())) {
|
|
||||||
payoffAmount = NumberUtil.sub(resultBean.getPayoffAmount(), resultBean.getTurnover()).negate();
|
// 判断输赢
|
||||||
|
Integer gameStatus = GameStatus.FLAT.getCode();
|
||||||
|
if (BigDecimal.ZERO.compareTo(resultBean.getResultAmount()) > 0) {
|
||||||
|
gameStatus = GameStatus.FAIL.getCode();
|
||||||
|
} else if (BigDecimal.ZERO.compareTo(resultBean.getResultAmount()) < 0) {
|
||||||
|
gameStatus = GameStatus.WIN.getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//数据构造
|
//数据构造
|
||||||
GameBettingDetails gameBettingDetails = GameBettingDetails.builder()
|
GameBettingDetails gameBettingDetails = GameBettingDetails.builder()
|
||||||
.tenantKey(member.getTenantKey())
|
.tenantKey(member.getTenantKey())
|
||||||
//保存我们的币种id
|
//保存我们的币种id
|
||||||
.currencyCode(currencyDTO.getSystemCurrency())
|
.currencyCode(currencyDTO.getSystemCurrency())
|
||||||
.memberId(member.getId())
|
.memberId(member.getId())
|
||||||
.gameCode(resultBean.getGameId())
|
.gameCode(resultBean.getGameID())
|
||||||
.gameType(XKGameType.findSystemByCode(resultBean.getGameCategoryId()))
|
.gameType(1)
|
||||||
.platformCode(GamePlatforms.XK.getCode())
|
.platformCode(GamePlatforms.SA.getCode())
|
||||||
.gameId(gamesDataDTO.getSystemGameId())
|
.gameId(GAME_ID)
|
||||||
.gameName(gamesDataDTO.getName())
|
.gameName(game.getGameName())
|
||||||
.gameStatus(resultBean.getStatus())
|
.gameStatus(gameStatus)
|
||||||
.gameStatusType(resultBean.getType())
|
.gameStatusType(1)
|
||||||
.gameCurrencyCode(resultBean.getAgentId())
|
.gameCurrencyCode(resultBean.getCurrency())
|
||||||
.account(String.valueOf(resultBean.getAccount()))
|
.account(resultBean.getUsername())
|
||||||
.wagersId(String.valueOf(resultBean.getWagersId()))
|
.wagersId(String.valueOf(resultBean.getBetID()))
|
||||||
.wagersTime(resultBean.getWagersTime())
|
.wagersTime(resultBean.getBetTime().getTime())
|
||||||
.betAmount(resultBean.getBetAmount().abs())
|
.betAmount(resultBean.getBetAmount())
|
||||||
.payoffTime(resultBean.getPayoffTime())
|
.payoffTime(resultBean.getPayoutTime().getTime())
|
||||||
.payoffAmount(payoffAmount)
|
.payoffAmount(resultBean.getResultAmount().abs())
|
||||||
.settlementTime(resultBean.getSettlementTime())
|
.settlementTime(resultBean.getPayoutTime().getTime())
|
||||||
.turnover(resultBean.getTurnover())
|
.turnover(resultBean.getRolling())
|
||||||
.orderNo(String.valueOf(resultBean.getRoundIndex()))
|
.orderNo(null)
|
||||||
|
.round(String.valueOf(resultBean.getRound()))
|
||||||
|
.table(String.valueOf(resultBean.getHostID()))
|
||||||
|
.seat(String.valueOf(resultBean.getSet()))
|
||||||
.settlementStatus(SettlementStatusEnum.COMPLETED.getCode())
|
.settlementStatus(SettlementStatusEnum.COMPLETED.getCode())
|
||||||
.build();
|
.build();
|
||||||
gameBettingDetails.setCreateBy(Constants.SYSTEM);
|
gameBettingDetails.setCreateBy(Constants.SYSTEM);
|
||||||
|
|
|
@ -347,7 +347,7 @@ public class GamesXKServiceImpl implements IGamesService {
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
params.put("account", exchangeTransferMoneyRequestDTO.getAccount());
|
params.put("account", exchangeTransferMoneyRequestDTO.getAccount());
|
||||||
params.put("transactionId", exchangeMoney.getTransactionId());
|
params.put("transactionId", exchangeMoney.getTransactionId());
|
||||||
params.put("amount", exchangeTransferMoneyRequestDTO.getAmount().stripTrailingZeros().toString());
|
params.put("amount", exchangeTransferMoneyRequestDTO.getAmount().stripTrailingZeros().toPlainString());
|
||||||
params.put("transferType", exchangeTransferMoneyRequestDTO.getTransferType());
|
params.put("transferType", exchangeTransferMoneyRequestDTO.getTransferType());
|
||||||
params.put("agentId", exchangeTransferMoneyRequestDTO.getAgentId());
|
params.put("agentId", exchangeTransferMoneyRequestDTO.getAgentId());
|
||||||
String query = JsonUtil.mapToQueryString(params);
|
String query = JsonUtil.mapToQueryString(params);
|
||||||
|
|
Loading…
Reference in New Issue