Compare commits
No commits in common. "aa7848e342679bdba23c48d0bfcff6bf8a071a98" and "106bad5be4deb6fc24f91f7068498e5235294c5b" have entirely different histories.
aa7848e342
...
106bad5be4
|
|
@ -63,12 +63,6 @@ public class CacheConstants
|
|||
*/
|
||||
public static final String FC_GAMES= "fc_games:";
|
||||
|
||||
/**
|
||||
* sa游戏
|
||||
*/
|
||||
public static final String SA_GAMES= "sa_games:";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* pg游戏投注货币
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ public class ConfigConstants
|
|||
public static final String VIEW_FILE_URL = "view.file.url";
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 域名nginx配置文件
|
||||
*/
|
||||
|
|
@ -28,18 +26,6 @@ public class ConfigConstants
|
|||
*/
|
||||
public static final String DOMAIN_NGINX_CONFIG_PARAM = "domain.nginx.config.param";
|
||||
|
||||
/**
|
||||
*sa游戏登录地址
|
||||
*/
|
||||
public static final String SA_API_LOGIN_URL = "sa.api.login.url";
|
||||
|
||||
|
||||
/**
|
||||
* sa-api大厅代码
|
||||
*/
|
||||
public static final String SA_API_HALL_CODE = "sa.api.hall.code";
|
||||
|
||||
|
||||
/**
|
||||
* 邀请url
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -202,13 +202,6 @@ public class Constants {
|
|||
* xk 接口请求前缀
|
||||
*/
|
||||
public static final String XK_API_BASE_URL = "xk.api.base.url";
|
||||
|
||||
|
||||
/**
|
||||
* sa-api基本url
|
||||
*/
|
||||
public static final String SA_API_BASE_URL = "sa.api.base.url";
|
||||
|
||||
/**
|
||||
* 服务
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ public enum ErrorCode {
|
|||
INSUFFICIENT_PLAYER_BALANCE(1012, "玩家余额不足"),
|
||||
KICK_OUT_AILED(1013, "玩家踢出失败"),
|
||||
ACCOUNT_NOT_ONLINE(1014, "账号不在线"),
|
||||
FREQUENT_BALANCE_TRANSFER(1015, "当前游戏账号余额转移频繁"),
|
||||
PLATFORM_NOT_METHODS(1016, "游戏平台不支持的方法"),
|
||||
;
|
||||
|
||||
// 获取错误码
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ public enum GamePlatforms {
|
|||
XK("XK", "XK"),
|
||||
PG("PG", "PG"),
|
||||
FC("FC", "FC"),
|
||||
SA("SA", "SA"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
package com.ff.base.utils;
|
||||
|
||||
import com.ff.base.exception.base.BaseException;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.DESKeySpec;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.KeySpec;
|
||||
import java.util.Base64;
|
||||
|
||||
|
||||
/**
|
||||
* 解密有用
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/03/24
|
||||
*/
|
||||
public class DESEncryptUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 给…解密
|
||||
*
|
||||
* @param inString 字符串中
|
||||
* @param key 钥匙
|
||||
* @return {@link String }
|
||||
* @throws Exception 例外
|
||||
*/
|
||||
public static String DESEncrypt(String inString, String key) {
|
||||
|
||||
try {
|
||||
|
||||
byte[] encryptKey = key.getBytes(); // encryptKey
|
||||
KeySpec keySpec = new DESKeySpec(encryptKey);
|
||||
SecretKey myDesKey = SecretKeyFactory.getInstance("DES").generateSecret(keySpec);
|
||||
IvParameterSpec iv = new IvParameterSpec(encryptKey);
|
||||
|
||||
KeyGenerator keygenerator = KeyGenerator.getInstance("DES");
|
||||
|
||||
Cipher desCipher;
|
||||
|
||||
// Create the cipher
|
||||
desCipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
|
||||
|
||||
// Initialize the cipher for encryption
|
||||
desCipher.init(Cipher.ENCRYPT_MODE, myDesKey, iv);
|
||||
|
||||
//sensitive information
|
||||
String source = inString;
|
||||
byte[] text = source.getBytes();
|
||||
|
||||
System.out.println("Text [Byte Format] : " + text);
|
||||
System.out.println("Text : " + new String(text));
|
||||
|
||||
// Encrypt the text
|
||||
byte[] textEncrypted = desCipher.doFinal(text);
|
||||
String t = Base64.getEncoder().encodeToString(textEncrypted);
|
||||
|
||||
System.out.println("Text Encryted [Byte Format] : " + textEncrypted);
|
||||
System.out.println("Text Encryted : " + t);
|
||||
|
||||
// Initialize the same cipher for decryption
|
||||
desCipher.init(Cipher.DECRYPT_MODE, myDesKey, iv);
|
||||
|
||||
// Decrypt the text
|
||||
byte[] textDecrypted = desCipher.doFinal(textEncrypted);
|
||||
|
||||
System.out.println("Text Decryted : " + new String(textDecrypted));
|
||||
return t;
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BaseException("解密失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
package com.ff.base.utils;
|
||||
|
||||
import com.ff.base.exception.base.BaseException;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.DESKeySpec;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import java.io.StringReader;
|
||||
import java.security.spec.KeySpec;
|
||||
import java.util.Base64;
|
||||
|
||||
|
||||
/**
|
||||
* 解密有用
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/03/24
|
||||
*/
|
||||
public class XmlUtils {
|
||||
|
||||
|
||||
/**
|
||||
* xml失败
|
||||
*
|
||||
* @param xmlString xml字符串
|
||||
* @param clas 类
|
||||
* @param <T> 泛型类型
|
||||
* @return {@link T} 对象
|
||||
*/
|
||||
public static <T> T xmlDecrypt(String xmlString, Class<T> clas) {
|
||||
try {
|
||||
// 创建 JAXBContext 对象,绑定目标类
|
||||
JAXBContext jaxbContext = JAXBContext.newInstance(clas);
|
||||
|
||||
// 创建 Unmarshaller
|
||||
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
||||
|
||||
// 将 XML 字符串转换为目标类对象
|
||||
return clas.cast(unmarshaller.unmarshal(new StringReader(xmlString)));
|
||||
|
||||
} catch (JAXBException e) {
|
||||
// 在异常中包含原始异常信息
|
||||
throw new BaseException("XML 转化失败失败,错误信息:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -23,11 +23,6 @@
|
|||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
<!-- Jackson XML 数据格式支持 -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
|
|||
// 获取平台接口密钥
|
||||
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.platformCode(gameBalanceExchange.getPlatformCode())
|
||||
.systemCurrency(gameBalanceExchange.getCurrencyCode()).build());
|
||||
.currency(gameBalanceExchange.getCurrencyCode()).build());
|
||||
|
||||
// 检查平台密钥是否存在,否则抛出异常
|
||||
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||
|
|
|
|||
|
|
@ -446,7 +446,8 @@ public class GamesFCServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public Boolean exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
|
||||
return Boolean.TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -536,7 +537,9 @@ public class GamesFCServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public Boolean createFreeSpin(CreateFreeSpinRequestDTO createFreeSpinRequest) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -547,7 +550,14 @@ public class GamesFCServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public GetGameDetailResponseDTO getGameDetail(GetGameDetailRequestDTO getGameDetailRequestDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
|
||||
List<GameBettingDetails> gameBettingDetails = gameBettingDetailsService.selectGameBettingDetailsList(GameBettingDetailsDTO.builder().wagersId(getGameDetailRequestDTO.getWagersId()).build());
|
||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
||||
GetGameDetailResponseDTO getGameDetailResponseDTO = new GetGameDetailResponseDTO();
|
||||
getGameDetailResponseDTO.setUrl(gameBettingDetails.get(0).getBetContent());
|
||||
return getGameDetailResponseDTO;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -597,7 +607,9 @@ public class GamesFCServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public List<GameFreeRecord> getFreeSpinDashflow(GetFreeSpinDashflowRequestDTO getFreeSpinDashflowRequestDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -608,7 +620,8 @@ public class GamesFCServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public Boolean cancelFreeSpin(CancelFreeSpinRequestDTO cancelFreeSpinRequestDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
package com.ff.game.api.sa.address;
|
||||
|
||||
import com.dtflys.forest.callback.AddressSource;
|
||||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
/**
|
||||
* 我jili address来源
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/02/10
|
||||
*/
|
||||
@Component
|
||||
public class MySAAddressSource implements AddressSource {
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
|
||||
|
||||
@Override
|
||||
public ForestAddress getAddress(ForestRequest request) {
|
||||
String apiBaseUrl = configService.selectConfigByKey(Constants.SA_API_BASE_URL);
|
||||
return new ForestAddress("https",apiBaseUrl, 443,"api");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
package com.ff.game.api.sa.client;
|
||||
|
||||
import com.dtflys.forest.annotation.*;
|
||||
import com.ff.game.api.jili.dto.*;
|
||||
import com.ff.game.api.sa.address.MySAAddressSource;
|
||||
import com.ff.game.api.xk.dto.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* xk 请求
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/02/10
|
||||
*/
|
||||
@Address(source = MySAAddressSource.class)
|
||||
public interface SAClient {
|
||||
/**
|
||||
* 创建成员
|
||||
*
|
||||
* @param parameters 参数
|
||||
* @return {@link String }
|
||||
*/
|
||||
@Post( url ="/api.aspx/RegUserInfo",
|
||||
headers = {
|
||||
"Content-type: application/x-www-form-urlencoded"
|
||||
})
|
||||
String createMember(@Body String parameters);
|
||||
|
||||
/**
|
||||
* 获取会员信息
|
||||
*
|
||||
* @return {@link String }
|
||||
*/
|
||||
@Post( url ="/api.aspx/GetUserStatusDV",
|
||||
headers = {
|
||||
"Content-type: application/x-www-form-urlencoded"
|
||||
})
|
||||
String getMemberInfo(@Body String params);
|
||||
|
||||
/**
|
||||
* 无重定向登录
|
||||
*
|
||||
* @param params 参数
|
||||
*/
|
||||
@Post( url ="/api.aspx/LoginRequest",
|
||||
headers = {
|
||||
"Content-type: application/x-www-form-urlencoded"
|
||||
})
|
||||
String loginWithoutRedirect(@Body String params);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 兑换转入
|
||||
*
|
||||
* @param params 参数
|
||||
* @return {@link String }
|
||||
*/
|
||||
@Post( url ="/api.aspx/CreditBalanceDV",
|
||||
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 参数
|
||||
* @return {@link String }
|
||||
*/
|
||||
@Post( url ="/api.aspx/GetAllBetDetailsForTimeIntervalDV",
|
||||
headers = {
|
||||
"Content-type: application/x-www-form-urlencoded"
|
||||
})
|
||||
String getBetRecordByTime( @Body String params);
|
||||
|
||||
|
||||
/**
|
||||
* 踢出队员
|
||||
*
|
||||
* @param params 参数
|
||||
* @return {@link String }
|
||||
*/
|
||||
@Post( url ="/api.aspx/KickUser",
|
||||
headers = {
|
||||
"Content-type: application/x-www-form-urlencoded"
|
||||
})
|
||||
String kickMember( @Body String params);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
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;
|
||||
}
|
||||
|
|
@ -1,431 +0,0 @@
|
|||
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,80 +0,0 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* sa获取用户状态响应
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/03/26
|
||||
*/
|
||||
@Data
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "GetUserStatusResponse")
|
||||
public class SAGetUserStatusResponse {
|
||||
|
||||
/**
|
||||
* 错误消息ID
|
||||
*/
|
||||
@XmlElement(name = "ErrorMsgId")
|
||||
private int errorMsgId;
|
||||
|
||||
/**
|
||||
* 错误消息
|
||||
*/
|
||||
@XmlElement(name = "ErrorMsg")
|
||||
private String errorMsg;
|
||||
|
||||
/**
|
||||
* 请求是否成功
|
||||
*/
|
||||
@XmlElement(name = "IsSuccess")
|
||||
private boolean isSuccess;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@XmlElement(name = "Username")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 余额
|
||||
*/
|
||||
@XmlElement(name = "Balance")
|
||||
private BigDecimal balance;
|
||||
|
||||
/**
|
||||
* 用户是否在线
|
||||
*/
|
||||
@XmlElement(name = "Online")
|
||||
private boolean online;
|
||||
|
||||
/**
|
||||
* 是否已经投注
|
||||
*/
|
||||
@XmlElement(name = "Betted")
|
||||
private boolean betted;
|
||||
|
||||
/**
|
||||
* 已投注金额
|
||||
*/
|
||||
@XmlElement(name = "BettedAmount")
|
||||
private double bettedAmount;
|
||||
|
||||
/**
|
||||
* 最大余额
|
||||
*/
|
||||
@XmlElement(name = "MaxBalance")
|
||||
private double maxBalance;
|
||||
|
||||
/**
|
||||
* 最大赢得金额
|
||||
*/
|
||||
@XmlElement(name = "MaxWinning")
|
||||
private double maxWinning;
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* 响应类,用于踢出用户的请求返回。
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/03/26
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@Data
|
||||
@XmlRootElement(name = "KickUserResponse")
|
||||
public class SAKickUserResponse {
|
||||
|
||||
/**
|
||||
* 错误信息ID。
|
||||
*/
|
||||
@XmlElement(name = "ErrorMsgId")
|
||||
private int errorMsgId;
|
||||
|
||||
/**
|
||||
* 错误信息描述。
|
||||
*/
|
||||
@XmlElement(name = "ErrorMsg")
|
||||
private String errorMsg;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* salogin请求响应
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025/03/26
|
||||
*/
|
||||
@Data
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "LoginRequestResponse")
|
||||
public class SALoginRequestResponse {
|
||||
|
||||
/**
|
||||
* 错误消息 ID
|
||||
*/
|
||||
@XmlElement(name = "ErrorMsgId")
|
||||
private int errorMsgId;
|
||||
|
||||
/**
|
||||
* 错误消息
|
||||
*/
|
||||
@XmlElement(name = "ErrorMsg")
|
||||
private String errorMsg;
|
||||
|
||||
/**
|
||||
* 登录令牌
|
||||
*/
|
||||
@XmlElement(name = "Token")
|
||||
private String token;
|
||||
|
||||
/**
|
||||
* 显示名称
|
||||
*/
|
||||
@XmlElement(name = "DisplayName")
|
||||
private String displayName;
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
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;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* sa 创建用户返回类
|
||||
* @author shi
|
||||
* @date 2025/03/25
|
||||
*/
|
||||
@Data
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "RegUserInfoResponse")
|
||||
public class SARegUserInfoResponse {
|
||||
@XmlElement(name = "ErrorMsgId")
|
||||
private Integer errorMsgId;
|
||||
@XmlElement(name = "ErrorMsg")
|
||||
private String errorMsg;
|
||||
@XmlElement(name = "Username")
|
||||
private String username;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,622 +0,0 @@
|
|||
package com.ff.game.api.sa.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.ff.base.constant.CacheConstants;
|
||||
import com.ff.base.constant.ConfigConstants;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.core.redis.RedisCache;
|
||||
import com.ff.base.enums.*;
|
||||
import com.ff.base.exception.base.ApiException;
|
||||
import com.ff.base.exception.base.BaseException;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.utils.*;
|
||||
import com.ff.base.utils.sign.Md5Utils;
|
||||
import com.ff.base.utils.uuid.IdUtils;
|
||||
import com.ff.config.KeyConfig;
|
||||
import com.ff.game.api.IGamesService;
|
||||
import com.ff.game.api.request.*;
|
||||
import com.ff.game.api.sa.client.SAClient;
|
||||
import com.ff.game.api.sa.dto.*;
|
||||
import com.ff.game.api.xk.dto.*;
|
||||
import com.ff.game.domain.*;
|
||||
import com.ff.game.dto.GameSecretKeyCurrencyDTO;
|
||||
import com.ff.game.service.*;
|
||||
import com.ff.member.domain.Member;
|
||||
import com.ff.member.service.IMemberService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* SA 游戏 impl
|
||||
*
|
||||
* @author shi
|
||||
* @date 2024/11/12
|
||||
*/
|
||||
@Service("SAService")
|
||||
@Slf4j
|
||||
public class GamesSAServiceImpl implements IGamesService {
|
||||
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
|
||||
@Resource
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Resource
|
||||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
||||
|
||||
|
||||
@Resource
|
||||
private IGamePlatformService gamePlatformService;
|
||||
|
||||
|
||||
@Resource
|
||||
private IGameService gameService;
|
||||
|
||||
|
||||
@Resource
|
||||
private IMemberService memberService;
|
||||
|
||||
@Resource
|
||||
private IGameFreeRecordService gameFreeRecordService;
|
||||
@Resource
|
||||
private IGameSecretKeyService gameSecretKeyService;
|
||||
|
||||
@Resource
|
||||
private IGameSecretKeyCurrencyService gameSecretKeyCurrencyService;
|
||||
|
||||
@Resource
|
||||
private SAClient SAClient;
|
||||
|
||||
|
||||
@Resource
|
||||
private KeyConfig keyConfig;
|
||||
|
||||
@Resource
|
||||
private IGameBettingDetailsService gameBettingDetailsService;
|
||||
|
||||
@Resource
|
||||
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;
|
||||
|
||||
/**
|
||||
* 获得就是成功
|
||||
*
|
||||
* @param errorCode 错误代码
|
||||
* @return {@link Boolean }
|
||||
*/
|
||||
private Boolean getIsSuccess(Integer errorCode) {
|
||||
ApiException.isTrue(113 != errorCode, ErrorCode.GAME_ACCOUNT_CREATION_FAILED.getCode());
|
||||
ApiException.isTrue(116 != errorCode, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||
ApiException.isTrue(122 != errorCode, ErrorCode.FREQUENT_BALANCE_TRANSFER.getCode());
|
||||
return 0 == errorCode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取密钥
|
||||
*
|
||||
* @param gamesBaseRequestDTO 游戏请求dto
|
||||
* @return {@link String }
|
||||
*/
|
||||
private String getKey(GamesBaseRequestDTO gamesBaseRequestDTO, String method) {
|
||||
String dateTimeNow = DateUtils.dateTimeNow();
|
||||
String query = "method=" + method + "&Key=" + gamesBaseRequestDTO.getAgentKey() + "&Time=" + dateTimeNow + "&" + gamesBaseRequestDTO.getQuery();
|
||||
String q = DESEncryptUtils.DESEncrypt(query, "g9G16nTs");
|
||||
String s = Md5Utils.md5New(query + gamesBaseRequestDTO.getAgentId() + dateTimeNow + gamesBaseRequestDTO.getAgentKey());
|
||||
return "q=" + q + "&s=" + s;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建成员
|
||||
*
|
||||
* @param createMemberRequestDTO 创建成员请求dto
|
||||
* @return {@link Boolean }
|
||||
*/
|
||||
@Override
|
||||
public Boolean createMember(CreateMemberRequestDTO createMemberRequestDTO) {
|
||||
log.info("GamesSAServiceImpl [createMember] 请求参数 {}", createMemberRequestDTO);
|
||||
|
||||
Map<String, Object> params = new LinkedHashMap<>();
|
||||
params.put("Username", createMemberRequestDTO.getAccount());
|
||||
params.put("CurrencyType", createMemberRequestDTO.getCurrency());
|
||||
String query = JsonUtil.mapToQueryString(params);
|
||||
createMemberRequestDTO.setQuery(query);
|
||||
String key = this.getKey(createMemberRequestDTO, "RegUserInfo");
|
||||
String result = SAClient.createMember(key);
|
||||
SARegUserInfoResponse saRegUserInfoResponse = XmlUtils.xmlDecrypt(result, SARegUserInfoResponse.class);
|
||||
Integer errorCode = saRegUserInfoResponse.getErrorMsgId();
|
||||
if (this.getIsSuccess(errorCode)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
//判断是否获取成功
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取会员信息
|
||||
*
|
||||
* @param memberInfoRequestDTO 会员信息请求dto
|
||||
* @return {@link MemberInfoResponseDTO }
|
||||
*/
|
||||
@Override
|
||||
public MemberInfoResponseDTO getMemberInfo(MemberInfoRequestDTO memberInfoRequestDTO) {
|
||||
log.info("GamesSAServiceImpl [getMemberInfo] 请求参数 {}", memberInfoRequestDTO);
|
||||
Map<String, Object> params = new LinkedHashMap<>();
|
||||
params.put("Username", memberInfoRequestDTO.getAccounts());
|
||||
String query = JsonUtil.mapToQueryString(params);
|
||||
memberInfoRequestDTO.setQuery(query);
|
||||
String key = this.getKey(memberInfoRequestDTO, "GetUserStatusDV");
|
||||
String result = SAClient.getMemberInfo(key);
|
||||
SAGetUserStatusResponse saGetUserStatusResponse = XmlUtils.xmlDecrypt(result, SAGetUserStatusResponse.class);
|
||||
Integer errorCode = saGetUserStatusResponse.getErrorMsgId();
|
||||
if (this.getIsSuccess(errorCode)) {
|
||||
|
||||
return MemberInfoResponseDTO.builder()
|
||||
.account(memberInfoRequestDTO.getAccounts())
|
||||
.balance(saGetUserStatusResponse.getBalance())
|
||||
.status(saGetUserStatusResponse.isOnline() ? GameMemberStatus.ONLINE.getCode() : GameMemberStatus.OFFLINE.getCode())
|
||||
.build();
|
||||
} else {
|
||||
throw new ApiException(ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 无重定向登录
|
||||
*
|
||||
* @param gamesLogin 游戏登录
|
||||
* @return {@link String }
|
||||
*/
|
||||
@Override
|
||||
public String loginWithoutRedirect(GamesLogin gamesLogin) {
|
||||
log.info("GamesSAServiceImpl [loginWithoutRedirect] 请求参数 {}", gamesLogin);
|
||||
|
||||
Map<String, Object> params = new LinkedHashMap<>();
|
||||
params.put("Username", gamesLogin.getAccount());
|
||||
params.put("CurrencyType", gamesLogin.getCurrency());
|
||||
String query = JsonUtil.mapToQueryString(params);
|
||||
gamesLogin.setQuery(query);
|
||||
String key = this.getKey(gamesLogin, "LoginRequest");
|
||||
String result = SAClient.loginWithoutRedirect(key);
|
||||
SALoginRequestResponse saLoginRequestResponse = XmlUtils.xmlDecrypt(result, SALoginRequestResponse.class);
|
||||
Integer errorCode = saLoginRequestResponse.getErrorMsgId();
|
||||
|
||||
|
||||
//判断是否获取成功
|
||||
if (this.getIsSuccess(errorCode)) {
|
||||
|
||||
String loginUrl = configService.selectConfigByKey(ConfigConstants.SA_API_LOGIN_URL);
|
||||
String hallCode = configService.selectConfigByKey(ConfigConstants.SA_API_HALL_CODE);
|
||||
params = new LinkedHashMap<>();
|
||||
params.put("username", gamesLogin.getAccount());
|
||||
params.put("token", saLoginRequestResponse.getToken());
|
||||
params.put("lobby", hallCode);
|
||||
params.put("lang", gamesLogin.getLang());
|
||||
if (StringUtils.isEmpty(gamesLogin.getHomeUrl())) {
|
||||
params.put("returnurl", gamesLogin.getHomeUrl());
|
||||
}
|
||||
return loginUrl + "?" + JsonUtil.mapToQueryString(params);
|
||||
} else {
|
||||
throw new ApiException(ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取游戏列表
|
||||
*
|
||||
* @param gamesBaseRequestDTO 游戏请求dto
|
||||
* @return {@link String }
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO) {
|
||||
GamePlatform gamePlatform = gamePlatformService.selectGamePlatformById(PLATFORM_ID);
|
||||
//没有此平台就新增一个平台
|
||||
if (ObjectUtils.isEmpty(gamePlatform)) {
|
||||
gamePlatform = new GamePlatform();
|
||||
gamePlatform.setPlatformType(PlatformType.CARD_GAME.getCode());
|
||||
gamePlatform.setPlatformName(GamePlatforms.SA.getInfo() + PlatformType.CARD_GAME.getName());
|
||||
gamePlatform.setSortNo(gamePlatformService.selectMaxSortNo() + 1);
|
||||
gamePlatform.setCreateBy(Constants.SYSTEM);
|
||||
gamePlatformService.insertGamePlatform(gamePlatform);
|
||||
}
|
||||
Game game = gameService.selectGameById(GAME_ID);
|
||||
//不存在这个游戏
|
||||
if (ObjectUtils.isEmpty(game)) {
|
||||
game = new Game();
|
||||
game.setSortNo(gameService.selectMaxSortNoByPlatformId(gamePlatform.getId()) + 1);
|
||||
game.setPlatformId(gamePlatform.getId());
|
||||
game.setGameCode("1");
|
||||
game.setGameSourceType(1);
|
||||
game.setGameName("真人棋牌");
|
||||
game.setCreateBy(Constants.SYSTEM);
|
||||
gameService.insertGame(game);
|
||||
}
|
||||
GameName gameName = gameNameService.selectGameNameById(GAME_NAME_ID);
|
||||
if (ObjectUtils.isEmpty(gameName)) {
|
||||
gameNameService.insertGameName(GameName.builder()
|
||||
.gameId(game.getId())
|
||||
.gameName(game.getGameName())
|
||||
.langCode("zh-CN")
|
||||
.createBy(Constants.SYSTEM)
|
||||
.build());
|
||||
}
|
||||
return CacheConstants.SA_GAMES;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按代理id进行交换转账
|
||||
*
|
||||
* @param exchangeTransferMoneyRequestDTO 外汇转账moeny dto
|
||||
* @return {@link Long }
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO) {
|
||||
log.info("GamesSAServiceImpl [exchangeTransferByAgentId] 请求参数 {}", exchangeTransferMoneyRequestDTO);
|
||||
GameSecretKeyCurrency currencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.platformCode(GamePlatforms.SA.getInfo())
|
||||
.code(exchangeTransferMoneyRequestDTO.getAgentId())
|
||||
.build());
|
||||
|
||||
Member member = memberService.selectMemberByGameAccount(exchangeTransferMoneyRequestDTO.getAccount());
|
||||
|
||||
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(
|
||||
GameExchangeMoney.builder()
|
||||
.tenantKey(exchangeTransferMoneyRequestDTO.getTenantKey())
|
||||
.orderId(exchangeTransferMoneyRequestDTO.getOrderId())
|
||||
.build()
|
||||
);
|
||||
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
|
||||
GameExchangeMoney exchangeMoney = GameExchangeMoney
|
||||
.builder()
|
||||
.tenantKey(exchangeTransferMoneyRequestDTO.getTenantKey())
|
||||
.orderId(exchangeTransferMoneyRequestDTO.getOrderId())
|
||||
.quota(exchangeTransferMoneyRequestDTO.getQuota())
|
||||
.balance(exchangeTransferMoneyRequestDTO.getAmount())
|
||||
.exchangeType(exchangeTransferMoneyRequestDTO.getTransferType())
|
||||
.currencyCode(currencyDTO.getSystemCurrency())
|
||||
.memberId(member.getId())
|
||||
.transactionId(transactionId)
|
||||
.platformCode(GamePlatforms.SA.getCode())
|
||||
.build();
|
||||
exchangeMoney.setCreateBy(Constants.SYSTEM);
|
||||
if (TransferType.ALL.getCode().equals(exchangeTransferMoneyRequestDTO.getTransferType())) {
|
||||
Map<String, Object> params = new LinkedHashMap<>();
|
||||
params.put("Username", exchangeTransferMoneyRequestDTO.getAccount());
|
||||
params.put("OrderId", exchangeMoney.getTransactionId());
|
||||
String query = JsonUtil.mapToQueryString(params);
|
||||
exchangeTransferMoneyRequestDTO.setQuery(query);
|
||||
String key = this.getKey(exchangeTransferMoneyRequestDTO, "DebitAllBalanceDV");
|
||||
String result = SAClient.exchangeTransferByOut(key);
|
||||
SADebitAllBalanceResponse saDebitAllBalanceResponse = XmlUtils.xmlDecrypt(result, SADebitAllBalanceResponse.class);
|
||||
Integer errorCode = saDebitAllBalanceResponse.getErrorMsgId();
|
||||
//判断是否转移成功
|
||||
if (this.getIsSuccess(errorCode)) {
|
||||
|
||||
|
||||
//更新数据
|
||||
exchangeMoney.setBalance(saDebitAllBalanceResponse.getDebitAmount());
|
||||
exchangeMoney.setCoinBefore(saDebitAllBalanceResponse.getDebitAmount());
|
||||
exchangeMoney.setCoinAfter(BigDecimal.ZERO);
|
||||
exchangeMoney.setCurrencyBefore(exchangeMoney.getCurrencyBefore());
|
||||
exchangeMoney.setCurrencyAfter(exchangeMoney.getCurrencyAfter());
|
||||
exchangeMoney.setStatus(StatusType.SUCCESS.getValue());
|
||||
gameExchangeMoneyService.insertGameExchangeMoney(exchangeMoney);
|
||||
} else {
|
||||
log.error("GamesXKServiceImpl [exchangeTransferByAgentId] 金额转移失败,错误代码{}", errorCode);
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 汇兑转移状态
|
||||
*
|
||||
* @param exchangeTransferMoneyRequestDTO 兑换转账请求dto
|
||||
* @return {@link Boolean }
|
||||
*/
|
||||
@Override
|
||||
public Boolean exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 按时间获取投注记录
|
||||
*
|
||||
* @param betRecordByTimeDTO 按时间dto投注记录
|
||||
* @return {@link List }<{@link GameBettingDetails }>
|
||||
*/
|
||||
@Override
|
||||
public Boolean getBetRecordByTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
||||
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("GamesSAServiceImpl [getBetRecordByTime] 请求参数 {}", betRecordByTimeDTO);
|
||||
Map<String, Object> params = new LinkedHashMap<>();
|
||||
params.put("FromTime", startTime);
|
||||
params.put("ToTime", endTime);
|
||||
String query = JsonUtil.mapToQueryString(params);
|
||||
betRecordByTimeDTO.setQuery(query);
|
||||
String key = this.getKey(betRecordByTimeDTO, "GetAllBetDetailsForTimeIntervalDV");
|
||||
|
||||
String result = SAClient.getBetRecordByTime(key);
|
||||
SAGetAllBetDetailsResponse saGetAllBetDetailsResponse = XmlUtils.xmlDecrypt(result, SAGetAllBetDetailsResponse.class);
|
||||
Integer errorCode = saGetAllBetDetailsResponse.getErrorMsgId();
|
||||
|
||||
|
||||
//判断是否获取成功
|
||||
if (this.getIsSuccess(errorCode)) {
|
||||
//数据组装
|
||||
this.batchInsert(saGetAllBetDetailsResponse);
|
||||
|
||||
return Boolean.TRUE;
|
||||
} else {
|
||||
log.error("GamesXKServiceImpl [getBetRecordByTime] 获取投注记录失败,错误代码{}", errorCode);
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按历史时间获取投注记录
|
||||
*
|
||||
* @param betRecordByTimeDTO 按时间dto投注记录
|
||||
* @return {@link Boolean }
|
||||
*/
|
||||
@Override
|
||||
public Boolean getBetRecordByHistoryTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 赠送免费局数
|
||||
*
|
||||
* @param createFreeSpinRequest 创建自由旋转请求
|
||||
* @return {@link Boolean }
|
||||
*/
|
||||
@Override
|
||||
public Boolean createFreeSpin(CreateFreeSpinRequestDTO createFreeSpinRequest) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取游戏详细信息
|
||||
*
|
||||
* @param getGameDetailRequestDTO 获取游戏详细信息请求dto
|
||||
* @return {@link GetGameDetailResponseDTO }
|
||||
*/
|
||||
@Override
|
||||
public GetGameDetailResponseDTO getGameDetail(GetGameDetailRequestDTO getGameDetailRequestDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* 强制会员从游戏注销
|
||||
*
|
||||
* @param kickMemberRequestDTO 踢会员请求dto
|
||||
* @return {@link Boolean }
|
||||
*/
|
||||
@Override
|
||||
public Boolean kickMember(KickMemberRequestDTO kickMemberRequestDTO) {
|
||||
log.info("GamesSAServiceImpl [kickMember] 请求参数 {}", kickMemberRequestDTO);
|
||||
Map<String, Object> params = new LinkedHashMap<>();
|
||||
params.put("Username", kickMemberRequestDTO.getAccount());
|
||||
String query = JsonUtil.mapToQueryString(params);
|
||||
kickMemberRequestDTO.setQuery(query);
|
||||
String key = this.getKey(kickMemberRequestDTO, "KickUser");
|
||||
String result = SAClient.kickMember(key);
|
||||
SAKickUserResponse saKickUserResponse = XmlUtils.xmlDecrypt(result, SAKickUserResponse.class);
|
||||
Integer errorCode = saKickUserResponse.getErrorMsgId();
|
||||
//判断是否获取成功
|
||||
if (this.getIsSuccess(errorCode)) {
|
||||
return Boolean.TRUE;
|
||||
} else {
|
||||
throw new ApiException(ErrorCode.KICK_OUT_AILED.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 踢成员全部
|
||||
*
|
||||
* @param kickMemberAllDTO 踢成员全部dto
|
||||
* @return {@link Boolean }
|
||||
*/
|
||||
@Override
|
||||
public Boolean kickMemberAll(KickMemberAllDTO kickMemberAllDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* 免费游戏玩家使用的纪录
|
||||
*
|
||||
* @param getFreeSpinDashflowRequestDTO 获取自由旋转dashflow请求dto
|
||||
* @return {@link List }<{@link GameFreeRecord }>
|
||||
*/
|
||||
@Override
|
||||
public List<GameFreeRecord> getFreeSpinDashflow(GetFreeSpinDashflowRequestDTO getFreeSpinDashflowRequestDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消赠送免费局数
|
||||
*
|
||||
* @param cancelFreeSpinRequestDTO 取消免费旋转请求
|
||||
* @return {@link Boolean }
|
||||
*/
|
||||
@Override
|
||||
public Boolean cancelFreeSpin(CancelFreeSpinRequestDTO cancelFreeSpinRequestDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param saGetAllBetDetailsResponse sa获取所有投注详细信息响应
|
||||
*/
|
||||
private void batchInsert(SAGetAllBetDetailsResponse saGetAllBetDetailsResponse) {
|
||||
List<GameBettingDetails> gameBettingDetails = new ArrayList<>();
|
||||
List<String> wagersIds = new ArrayList<>();
|
||||
//数据组装
|
||||
List<SAGetAllBetDetailsResponse.BetDetail> result = saGetAllBetDetailsResponse.getBetDetailList();
|
||||
//数据转化
|
||||
for (SAGetAllBetDetailsResponse.BetDetail bean : result) {
|
||||
GameBettingDetails bettingDetails = this.dataBuild(GamesDataBuildDTO.builder().data(bean).build());
|
||||
if (!ObjectUtils.isEmpty(bettingDetails)) {
|
||||
bettingDetails.setId(IdUtil.getSnowflakeNextId());
|
||||
gameBettingDetails.add(bettingDetails);
|
||||
}
|
||||
wagersIds.add(String.valueOf(bean.getBetID()));
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
||||
//查询重复数据id
|
||||
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds);
|
||||
//用steam流清除list中与wagersIds集合相同的数据
|
||||
gameBettingDetails = gameBettingDetails.stream()
|
||||
.filter(detail -> !removeWagersIds.contains(detail.getWagersId()))
|
||||
.collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
||||
gameBettingDetailsService.batchInsert(gameBettingDetails);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据构建
|
||||
*
|
||||
* @param gamesDataBuildDTO 数据
|
||||
* @return {@link GameBettingDetails }
|
||||
*/
|
||||
@Override
|
||||
public GameBettingDetails dataBuild(GamesDataBuildDTO gamesDataBuildDTO) {
|
||||
//转化类
|
||||
SAGetAllBetDetailsResponse.BetDetail resultBean = (SAGetAllBetDetailsResponse.BetDetail) gamesDataBuildDTO.getData();
|
||||
|
||||
GameSecretKeyCurrency currencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.platformCode(GamePlatforms.SA.getInfo())
|
||||
.currency(resultBean.getCurrency())
|
||||
.build());
|
||||
|
||||
Member member = memberService.selectMemberByGameAccount(resultBean.getUsername());
|
||||
if (ObjectUtils.isEmpty(member)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Game game = gameService.selectGameById(GAME_ID);
|
||||
|
||||
// 判断输赢
|
||||
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()
|
||||
.tenantKey(member.getTenantKey())
|
||||
//保存我们的币种id
|
||||
.currencyCode(currencyDTO.getSystemCurrency())
|
||||
.memberId(member.getId())
|
||||
.gameCode(resultBean.getGameID())
|
||||
.gameType(1)
|
||||
.platformCode(GamePlatforms.SA.getCode())
|
||||
.gameId(GAME_ID)
|
||||
.gameName(game.getGameName())
|
||||
.gameStatus(gameStatus)
|
||||
.gameStatusType(1)
|
||||
.gameCurrencyCode(resultBean.getCurrency())
|
||||
.account(resultBean.getUsername())
|
||||
.wagersId(String.valueOf(resultBean.getBetID()))
|
||||
.wagersTime(resultBean.getBetTime().getTime())
|
||||
.betAmount(resultBean.getBetAmount())
|
||||
.payoffTime(resultBean.getPayoutTime().getTime())
|
||||
.payoffAmount(resultBean.getResultAmount().abs())
|
||||
.settlementTime(resultBean.getPayoutTime().getTime())
|
||||
.turnover(resultBean.getRolling())
|
||||
.orderNo(null)
|
||||
.round(String.valueOf(resultBean.getRound()))
|
||||
.table(String.valueOf(resultBean.getHostID()))
|
||||
.seat(String.valueOf(resultBean.getSet()))
|
||||
.settlementStatus(SettlementStatusEnum.COMPLETED.getCode())
|
||||
.build();
|
||||
gameBettingDetails.setCreateBy(Constants.SYSTEM);
|
||||
gameBettingDetails.setCreateTime(DateUtils.getNowDate());
|
||||
return gameBettingDetails;
|
||||
}
|
||||
}
|
||||
|
|
@ -347,7 +347,7 @@ public class GamesXKServiceImpl implements IGamesService {
|
|||
Map<String, Object> params = new LinkedHashMap<>();
|
||||
params.put("account", exchangeTransferMoneyRequestDTO.getAccount());
|
||||
params.put("transactionId", exchangeMoney.getTransactionId());
|
||||
params.put("amount", exchangeTransferMoneyRequestDTO.getAmount().stripTrailingZeros().toPlainString());
|
||||
params.put("amount", exchangeTransferMoneyRequestDTO.getAmount().stripTrailingZeros().toString());
|
||||
params.put("transferType", exchangeTransferMoneyRequestDTO.getTransferType());
|
||||
params.put("agentId", exchangeTransferMoneyRequestDTO.getAgentId());
|
||||
String query = JsonUtil.mapToQueryString(params);
|
||||
|
|
@ -463,7 +463,7 @@ public class GamesXKServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public Boolean createFreeSpin(CreateFreeSpinRequestDTO createFreeSpinRequest) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
throw new BaseException("当前平台不支持");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -474,7 +474,7 @@ public class GamesXKServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public GetGameDetailResponseDTO getGameDetail(GetGameDetailRequestDTO getGameDetailRequestDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
throw new BaseException("当前平台不支持");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -510,7 +510,7 @@ public class GamesXKServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public Boolean kickMemberAll(KickMemberAllDTO kickMemberAllDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
throw new BaseException("当前平台不支持");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -521,7 +521,7 @@ public class GamesXKServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public List<GameFreeRecord> getFreeSpinDashflow(GetFreeSpinDashflowRequestDTO getFreeSpinDashflowRequestDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
throw new BaseException("当前平台不支持");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -532,7 +532,7 @@ public class GamesXKServiceImpl implements IGamesService {
|
|||
*/
|
||||
@Override
|
||||
public Boolean cancelFreeSpin(CancelFreeSpinRequestDTO cancelFreeSpinRequestDTO) {
|
||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
throw new BaseException("当前平台不支持");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue