Compare commits
No commits in common. "a8e2fab5661d8acf6e1a4be7429d1128c82f94ee" and "8744ad3589c834bc8076b373dffdca701f10766d" have entirely different histories.
a8e2fab566
...
8744ad3589
|
|
@ -1,49 +0,0 @@
|
||||||
######################################################################
|
|
||||||
# Build Tools
|
|
||||||
|
|
||||||
.gradle
|
|
||||||
/build/
|
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
target/
|
|
||||||
!.mvn/wrapper/maven-wrapper.jar
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
# IDE
|
|
||||||
|
|
||||||
### STS ###
|
|
||||||
.apt_generated
|
|
||||||
.classpath
|
|
||||||
.factorypath
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
.springBeans
|
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
|
||||||
.idea
|
|
||||||
*.iws
|
|
||||||
*.iml
|
|
||||||
*.ipr
|
|
||||||
|
|
||||||
### JRebel ###
|
|
||||||
rebel.xml
|
|
||||||
|
|
||||||
### NetBeans ###
|
|
||||||
nbproject/private/
|
|
||||||
build/*
|
|
||||||
nbbuild/
|
|
||||||
dist/
|
|
||||||
nbdist/
|
|
||||||
.nb-gradle/
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
# Others
|
|
||||||
*.log
|
|
||||||
*.xml.versionsBackup
|
|
||||||
*.swp
|
|
||||||
|
|
||||||
!*/build/*.java
|
|
||||||
!*/build/*.html
|
|
||||||
!*/build/*.xml
|
|
||||||
logs/
|
|
||||||
.idea/
|
|
||||||
|
|
@ -5,7 +5,8 @@ package com.ff.base.constant;
|
||||||
*
|
*
|
||||||
* @author ff
|
* @author ff
|
||||||
*/
|
*/
|
||||||
public class CacheConstants {
|
public class CacheConstants
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* 登录用户 redis key
|
* 登录用户 redis key
|
||||||
*/
|
*/
|
||||||
|
|
@ -51,31 +52,11 @@ public class CacheConstants {
|
||||||
*/
|
*/
|
||||||
public static final String XK_GAMES= "xk_games:";
|
public static final String XK_GAMES= "xk_games:";
|
||||||
|
|
||||||
/**
|
|
||||||
* ae游戏
|
|
||||||
*/
|
|
||||||
public static final String AE_GAMES = "ae_games:";
|
|
||||||
/**
|
|
||||||
* km游戏
|
|
||||||
*/
|
|
||||||
public static final String KM_GAMES = "km_games:";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pgx游戏
|
|
||||||
*/
|
|
||||||
public static final String PGX_GAMES = "pgx_games:";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pg游戏
|
* pg游戏
|
||||||
*/
|
*/
|
||||||
public static final String PG_GAMES= "pg_games:";
|
public static final String PG_GAMES= "pg_games:";
|
||||||
|
|
||||||
/**
|
|
||||||
* pgt游戏
|
|
||||||
*/
|
|
||||||
public static final String PGT_GAMES = "pgt_games:";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pp游戏
|
* pp游戏
|
||||||
*/
|
*/
|
||||||
|
|
@ -95,55 +76,10 @@ public class CacheConstants {
|
||||||
* dg游戏
|
* dg游戏
|
||||||
*/
|
*/
|
||||||
public static final String DG_GAMES= "dg_games:";
|
public static final String DG_GAMES= "dg_games:";
|
||||||
/**
|
|
||||||
* fb体育
|
|
||||||
*/
|
|
||||||
public static final String FB_Sports = "fp_sports:";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* db体育
|
|
||||||
*/
|
|
||||||
public static final String DB_Sports = "db_sports:";
|
|
||||||
/**
|
/**
|
||||||
* pg游戏投注货币
|
* pg游戏投注货币
|
||||||
*/
|
*/
|
||||||
public static final String PG_GAMES_BET_CURRENCY= "pg_games:bet:currency";
|
public static final String PG_GAMES_BET_CURRENCY= "pg_games:bet:currency";
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pgt下一个id
|
|
||||||
*/
|
|
||||||
public static final String PGT_NEXT_ID = "pgt_next:id:";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ae时间从
|
|
||||||
*/
|
|
||||||
public static final String AE_TIME_FROM= "ae:time:from";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 美天棋牌游戏
|
|
||||||
*/
|
|
||||||
public static final String MeiTian_GAMES = "meitian_games:";
|
|
||||||
|
|
||||||
|
|
||||||
public static final String Platform = "platform:";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* km用户令牌
|
|
||||||
*/
|
|
||||||
public static final String KM_USER_TOKEN = "km:user:token:";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ae时间从
|
|
||||||
*/
|
|
||||||
public static final String SV388_TIME_FROM= "sv388:time:from";
|
|
||||||
|
|
||||||
public static final String SV388_GAMES = "sv388_games:";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,10 @@ public class Constants {
|
||||||
*/
|
*/
|
||||||
public static final String DG_API_BASE_URL = "dg.api.base.url";
|
public static final String DG_API_BASE_URL = "dg.api.base.url";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pp api基本url
|
||||||
|
*/
|
||||||
|
public static final String PP_API_BASE_URL = "pp.api.base.url";
|
||||||
/**
|
/**
|
||||||
* sa-api基本url
|
* sa-api基本url
|
||||||
*/
|
*/
|
||||||
|
|
@ -226,12 +229,15 @@ public class Constants {
|
||||||
public static final String SYSTEM = "system";
|
public static final String SYSTEM = "system";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主 数据源
|
* 主 数据源
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SOURCE = "master";
|
public static final String DATA_SOURCE = "master";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户id
|
* 租户id
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import java.util.stream.Stream;
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum ErrorCode {
|
public enum ErrorCode {
|
||||||
ERROR(500, "业务异常"),
|
ERROR(500, "系统业务异常"),
|
||||||
GAME_ACCOUNT_CREATION_FAILED(1001, "当前游戏账号已存在"),
|
GAME_ACCOUNT_CREATION_FAILED(1001, "当前游戏账号已存在"),
|
||||||
ACCOUNT_NOT_EXIST(1002, "当前游戏账号不存在"),
|
ACCOUNT_NOT_EXIST(1002, "当前游戏账号不存在"),
|
||||||
PLATFORM_NOT_EXIST(1003, "游戏平台不存在"),
|
PLATFORM_NOT_EXIST(1003, "游戏平台不存在"),
|
||||||
|
|
@ -30,14 +30,6 @@ public enum ErrorCode {
|
||||||
ACCOUNT_NOT_ONLINE(1014, "账号不在线"),
|
ACCOUNT_NOT_ONLINE(1014, "账号不在线"),
|
||||||
FREQUENT_BALANCE_TRANSFER(1015, "当前游戏账号余额转移频繁"),
|
FREQUENT_BALANCE_TRANSFER(1015, "当前游戏账号余额转移频繁"),
|
||||||
PLATFORM_NOT_METHODS(1016, "游戏平台不支持的方法"),
|
PLATFORM_NOT_METHODS(1016, "游戏平台不支持的方法"),
|
||||||
Create_Member_Failure(1017, "创建会员失败"),
|
|
||||||
Transfer_In_Failure(1018, "转入失败"),
|
|
||||||
Transfer_Out_Failure(1019, "转出失败"),
|
|
||||||
Get_Member_Info_Failure(1020, "获取会员信息失败"),
|
|
||||||
Transfer_Not_Exist(1021, "转帐操作不存在"),
|
|
||||||
Get_Url_Failure(1022, "获取URL失败"),
|
|
||||||
Miss_Config(1023, "缺少配置"),
|
|
||||||
DUPLICATE_ORDER_ID (1024, "重复的订单id"),
|
|
||||||
;
|
;
|
||||||
|
|
||||||
// 获取错误码
|
// 获取错误码
|
||||||
|
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xkgame类型
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2024/11/13
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
public enum FBSportsType {
|
|
||||||
|
|
||||||
Sports("8", 8,"FB体育"),
|
|
||||||
;
|
|
||||||
|
|
||||||
private final String code;
|
|
||||||
private final Integer systemCode;
|
|
||||||
private final String info;
|
|
||||||
FBSportsType(String code, Integer systemCode, String info)
|
|
||||||
{
|
|
||||||
this.code = code;
|
|
||||||
this.systemCode = systemCode;
|
|
||||||
this.info = info;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按代码查找系统
|
|
||||||
*
|
|
||||||
* @param code 代码
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
public static Integer findSystemByCode(String code) {
|
|
||||||
Optional<Integer> system = Stream.of(FBSportsType.values())
|
|
||||||
.filter(gameType -> gameType.getCode().equals(code))
|
|
||||||
.map(FBSportsType::getSystemCode)
|
|
||||||
.findFirst();
|
|
||||||
return system.orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按代码查找信息
|
|
||||||
*
|
|
||||||
* @param code 代码
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
public static String findInfoByCode(String code) {
|
|
||||||
Optional<String> system = Stream.of(FBSportsType.values())
|
|
||||||
.filter(gameType -> gameType.getCode().equals(code))
|
|
||||||
.map(FBSportsType::getInfo)
|
|
||||||
.findFirst();
|
|
||||||
return system.orElse(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xkgame类型
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2024/11/13
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum GPXGameType {
|
|
||||||
|
|
||||||
SL("SL", 1,"电子")
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
private final String code;
|
|
||||||
private final Integer systemCode;
|
|
||||||
private final String info;
|
|
||||||
/**
|
|
||||||
* 按代码查找系统
|
|
||||||
*
|
|
||||||
* @param code 代码
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
public static Integer findSystemByCode(String code) {
|
|
||||||
Optional<Integer> system = Stream.of(XKGameType.values())
|
|
||||||
.filter(gameType -> gameType.getCode().equals(code))
|
|
||||||
.map(XKGameType::getSystemCode)
|
|
||||||
.findFirst();
|
|
||||||
return system.orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按代码查找信息
|
|
||||||
*
|
|
||||||
* @param code 代码
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
public static String findInfoByCode(String code) {
|
|
||||||
Optional<String> system = Stream.of(XKGameType.values())
|
|
||||||
.filter(gameType -> gameType.getCode().equals(code))
|
|
||||||
.map(XKGameType::getInfo)
|
|
||||||
.findFirst();
|
|
||||||
return system.orElse(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏交换步骤
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/08
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum GameExchangeStep {
|
|
||||||
CREATE_ORDER(1, "创建订单"),
|
|
||||||
DEDUCT_BALANCE(2, "转入提前扣租户余额"),
|
|
||||||
PLATFORM_TRANSACTION(3, "平台交易成功"),
|
|
||||||
TENANT_QUOTA_DEDUCTED(4, "转出租户额度增加成功");
|
|
||||||
|
|
||||||
private final Integer code;
|
|
||||||
private final String description;
|
|
||||||
|
|
||||||
// 根据 code 获取对应的枚举
|
|
||||||
public static GameExchangeStep getByCode(int code) {
|
|
||||||
for (GameExchangeStep step : GameExchangeStep.values()) {
|
|
||||||
if (step.getCode() == code) {
|
|
||||||
return step;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏交换步骤状态
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/08
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum GameExchangeStepStatus {
|
|
||||||
IN_PROGRESS(0, "进行中"),
|
|
||||||
SUCCESS(1, "成功"),
|
|
||||||
FAILURE(2, "失败");
|
|
||||||
|
|
||||||
private final int code;
|
|
||||||
private final String description;
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package com.ff.base.enums;
|
package com.ff.base.enums;
|
||||||
|
|
||||||
import com.ff.base.exception.base.ApiException;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -9,42 +7,23 @@ public enum GamePlatforms {
|
||||||
JILI("JILI", "JILI"),
|
JILI("JILI", "JILI"),
|
||||||
XK("XK", "XK"),
|
XK("XK", "XK"),
|
||||||
PG("PG", "PG"),
|
PG("PG", "PG"),
|
||||||
PGX("PGX", "PGX"),
|
|
||||||
FC("FC", "FC"),
|
FC("FC", "FC"),
|
||||||
SA("SA", "SA"),
|
SA("SA", "SA"),
|
||||||
DG("DG", "DG"),
|
DG("DG", "DG"),
|
||||||
MT("MT", "美天棋牌"),
|
;
|
||||||
AE("AE", "AE"),
|
|
||||||
KM("KM", "KM"),
|
|
||||||
PGT("PGT", "PGT"),
|
|
||||||
FBSports("FBSports", "FB体育"),
|
|
||||||
SV388("SV388", "SV388真人"),
|
|
||||||
DBSports("DBSports", "DB体育");
|
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
private final String info;
|
private final String info;
|
||||||
|
|
||||||
GamePlatforms(String code, String info) {
|
GamePlatforms(String code, String info)
|
||||||
|
{
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过代码获取
|
|
||||||
*
|
|
||||||
* @param code 代码
|
|
||||||
* @return {@link GamePlatforms }
|
|
||||||
*/
|
|
||||||
public static GamePlatforms getByCode(String code) {
|
|
||||||
for (GamePlatforms platform : GamePlatforms.values()) {
|
|
||||||
if (platform.getCode().equals(code)) {
|
|
||||||
return platform;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new ApiException(ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<String> getCodes() {
|
public static List<String> getCodes()
|
||||||
|
{
|
||||||
List<String> result=new ArrayList<>();
|
List<String> result=new ArrayList<>();
|
||||||
GamePlatforms[] values = GamePlatforms.values();
|
GamePlatforms[] values = GamePlatforms.values();
|
||||||
for (GamePlatforms value : values) {
|
for (GamePlatforms value : values) {
|
||||||
|
|
@ -53,11 +32,13 @@ public enum GamePlatforms {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCode() {
|
public String getCode()
|
||||||
|
{
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getInfo() {
|
public String getInfo()
|
||||||
|
{
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xkgame类型
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2024/11/13
|
|
||||||
*/
|
|
||||||
public enum KMGameType {
|
|
||||||
|
|
||||||
ELECTRON("KMQM", 1,"电子")
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
private final String code;
|
|
||||||
private final Integer systemCode;
|
|
||||||
private final String info;
|
|
||||||
KMGameType(String code, Integer systemCode, String info)
|
|
||||||
{
|
|
||||||
this.code = code;
|
|
||||||
this.systemCode = systemCode;
|
|
||||||
this.info = info;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCode()
|
|
||||||
{
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSystemCode()
|
|
||||||
{
|
|
||||||
return systemCode;
|
|
||||||
}
|
|
||||||
public String getInfo()
|
|
||||||
{
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 按代码查找系统
|
|
||||||
*
|
|
||||||
* @param code 代码
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
public static Integer findSystemByCode(String code) {
|
|
||||||
Optional<Integer> system = Stream.of(KMGameType.values())
|
|
||||||
.filter(gameType -> gameType.getCode().equals(code))
|
|
||||||
.map(KMGameType::getSystemCode)
|
|
||||||
.findFirst();
|
|
||||||
return system.orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按代码查找信息
|
|
||||||
*
|
|
||||||
* @param code 代码
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
public static String findInfoByCode(String code) {
|
|
||||||
Optional<String> system = Stream.of(KMGameType.values())
|
|
||||||
.filter(gameType -> gameType.getCode().equals(code))
|
|
||||||
.map(KMGameType::getInfo)
|
|
||||||
.findFirst();
|
|
||||||
return system.orElse(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum MeiTianGameType {
|
|
||||||
ELECTRON(4, 1, "电子"),
|
|
||||||
CHESS(2, 2, "棋牌"),
|
|
||||||
GAME_HALL(0, 3, "游戏大厅"),
|
|
||||||
CATCH_FISH(3, 4, "捕鱼"),
|
|
||||||
bai_ren(1, 5,"百人场")
|
|
||||||
,
|
|
||||||
;
|
|
||||||
private final Integer code;
|
|
||||||
private final Integer systemCode;
|
|
||||||
private final String info;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按代码查找系统
|
|
||||||
*
|
|
||||||
* @param code 代码
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
public static Integer findSystemByCode(Integer code) {
|
|
||||||
Optional<Integer> system = Stream.of(MeiTianGameType.values())
|
|
||||||
.filter(gameType -> gameType.getCode().equals(code))
|
|
||||||
.map(MeiTianGameType::getSystemCode)
|
|
||||||
.findFirst();
|
|
||||||
return system.orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按代码查找信息
|
|
||||||
*
|
|
||||||
* @param code 代码
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
public static String findInfoByCode(Integer code) {
|
|
||||||
Optional<String> system = Stream.of(MeiTianGameType.values())
|
|
||||||
.filter(gameType -> gameType.getCode().equals(code))
|
|
||||||
.map(MeiTianGameType::getInfo)
|
|
||||||
.findFirst();
|
|
||||||
return system.orElse(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 完成
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/07
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum PGTBetStatus {
|
|
||||||
OPEN(1, "打开 或 未结算", "OPEN"),
|
|
||||||
SETTLED(2, "已结算", "SETTLED"),
|
|
||||||
UNSETTLED(1, "未结算", "UNSETTLED"),
|
|
||||||
VOID(3, "作废 或 无效", "VOID");
|
|
||||||
|
|
||||||
private final int code;
|
|
||||||
private final String description;
|
|
||||||
private final String type;
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pgt名称类型
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/07
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum PGTGameType {
|
|
||||||
EGAMES("EGAMES",1, "游戏老虎机"),
|
|
||||||
LIVECASINO("LIVECASINO",2, "现场赌场"),
|
|
||||||
SPORT("SPORT",8, "体育"),
|
|
||||||
POKER("POKER",2, "扑克"),
|
|
||||||
TRADING("TRADING",1, "贸易");
|
|
||||||
|
|
||||||
// 枚举字段
|
|
||||||
private final String code;
|
|
||||||
private final Integer systemCode;
|
|
||||||
private final String description;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按代码查找系统
|
|
||||||
*
|
|
||||||
* @param code 代码
|
|
||||||
* @return {@link Integer }
|
|
||||||
*/
|
|
||||||
public static Integer findSystemByCode(String code) {
|
|
||||||
Optional<Integer> system = Stream.of(PGTGameType.values())
|
|
||||||
.filter(gameType -> gameType.getCode().equals(code))
|
|
||||||
.map(PGTGameType::getSystemCode)
|
|
||||||
.findFirst();
|
|
||||||
return system.orElse(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
import com.dtflys.forest.annotation.Get;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pgtplayout状态
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/07
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum PGTPayoutStatus {
|
|
||||||
|
|
||||||
LOSE("LOSE", 2, "输"),
|
|
||||||
WIN("WIN",1, "赢"),
|
|
||||||
DRAW("DRAW",3, "平"),
|
|
||||||
UNKNOWN("UNKNOWN",4, "未知");
|
|
||||||
|
|
||||||
private final String code;
|
|
||||||
private final Integer systemCode;
|
|
||||||
private final String description;
|
|
||||||
|
|
||||||
public static PGTPayoutStatus getByCode(String code) {
|
|
||||||
for (PGTPayoutStatus status : PGTPayoutStatus.values()) {
|
|
||||||
if (status.getCode().equals(code)) {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return UNKNOWN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* pgxbet记录状态
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/03/28
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum PGXBetRecordStatus {
|
|
||||||
VALID(1, 2,"有效注单"),
|
|
||||||
RUNNING(0,0, "赛事进行中"),
|
|
||||||
INVALID(-1,3, "无效注单 (作废, 取消)");
|
|
||||||
|
|
||||||
|
|
||||||
private final Integer code;
|
|
||||||
private final Integer systemCode;
|
|
||||||
private final String description;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按值查找代码
|
|
||||||
*
|
|
||||||
* @param code 代码
|
|
||||||
* @return {@link Integer }
|
|
||||||
*/
|
|
||||||
public static Integer findSystemCodeByCode(Integer code) {
|
|
||||||
Optional<Integer> system = Stream.of(PGXBetRecordStatus.values())
|
|
||||||
.filter(transactionStatusValue -> transactionStatusValue.getCode().equals(code))
|
|
||||||
.map(PGXBetRecordStatus::getSystemCode)
|
|
||||||
.findFirst();
|
|
||||||
return system.orElse(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转移状态
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/03/28
|
|
||||||
*/
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Getter
|
|
||||||
public enum PGXTransactionStatus {
|
|
||||||
SUCCESS("SUCCESS",1, "成功"),
|
|
||||||
PROCESSING("PROCESSING",0, "进行中,请稍后再确认"),
|
|
||||||
FAILED("FAILED",2, "失败");
|
|
||||||
|
|
||||||
// 枚举字段
|
|
||||||
private final String code;
|
|
||||||
private final Integer value;
|
|
||||||
private final String description;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按值查找代码
|
|
||||||
*
|
|
||||||
* @param code 代码
|
|
||||||
* @return {@link Integer }
|
|
||||||
*/
|
|
||||||
public static Integer findValueByCode(String code) {
|
|
||||||
Optional<Integer> system = Stream.of(PGXTransactionStatus.values())
|
|
||||||
.filter(transactionStatusValue -> transactionStatusValue.getCode().equals(code))
|
|
||||||
.map(PGXTransactionStatus::getValue)
|
|
||||||
.findFirst();
|
|
||||||
return system.orElse(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 长传输类型
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/03/12
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum PGXTransferType {
|
|
||||||
WITHDRAW("1", "提出"),
|
|
||||||
DEPOSIT("0", "存入");
|
|
||||||
|
|
||||||
private final String code;
|
|
||||||
private final String description;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -18,11 +18,10 @@ public enum PlatformType {
|
||||||
GAME_HALL(3, "游戏大厅"),
|
GAME_HALL(3, "游戏大厅"),
|
||||||
FISHING(4, "捕鱼"),
|
FISHING(4, "捕鱼"),
|
||||||
BETTING_MACHINE(5, "押分机 (含宾果)"),
|
BETTING_MACHINE(5, "押分机 (含宾果)"),
|
||||||
VIDEO(6, "真人视讯"),
|
VIDEO(6, "视讯"),
|
||||||
LOTTERY(7, "彩票"),
|
LOTTERY(7, "彩票"),
|
||||||
SPORTS(8, "体育"),
|
SPORTS(8, "体育"),
|
||||||
HUNTING(9, "捕猎"),
|
HUNTING(9, "捕猎");
|
||||||
BaiRen(10, "百人场");
|
|
||||||
|
|
||||||
private final int code;
|
private final int code;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
import com.alibaba.druid.filter.AutoLoad;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 超时类型
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/09
|
|
||||||
*/
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Getter
|
|
||||||
public enum TimeOutType {
|
|
||||||
GAME_EXCHANGE_MONEY("gameExchangeMoney", "游戏余额转移");
|
|
||||||
/**
|
|
||||||
* 代码
|
|
||||||
*/
|
|
||||||
private final String code;
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
private final String info;
|
|
||||||
}
|
|
||||||
|
|
@ -9,8 +9,7 @@ package com.ff.base.enums;
|
||||||
*/
|
*/
|
||||||
public enum TransferType {
|
public enum TransferType {
|
||||||
ALL(1, "从游戏商转移额度到平台商(不看amount值,全部转出"),
|
ALL(1, "从游戏商转移额度到平台商(不看amount值,全部转出"),
|
||||||
GAMES(2, "从平台商转移额度到游戏商"),
|
GAMES(2, "从平台商转移额度到游戏商");
|
||||||
;
|
|
||||||
private final Integer code;
|
private final Integer code;
|
||||||
private final String info;
|
private final String info;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 触发类型
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/09
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum TriggerType {
|
|
||||||
MANUAL(1, "用户调用手动触发"),
|
|
||||||
TIMER(2, "定时器触发");
|
|
||||||
|
|
||||||
private final int code;
|
|
||||||
private final String description;
|
|
||||||
}
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
package com.ff.base.handler;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import org.apache.ibatis.type.BaseTypeHandler;
|
|
||||||
import org.apache.ibatis.type.JdbcType;
|
|
||||||
|
|
||||||
import java.sql.CallableStatement;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* mybatis json字段转换
|
|
||||||
*
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
public class JsonHandler<T> extends BaseTypeHandler<T> {
|
|
||||||
private final Class<T> type;
|
|
||||||
|
|
||||||
|
|
||||||
public JsonHandler(Class<T> type) {
|
|
||||||
if (type == null) {
|
|
||||||
throw new IllegalArgumentException("Type argument cannot be null");
|
|
||||||
}
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setNonNullParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType) throws SQLException {
|
|
||||||
ps.setString(i, JSON.toJSONString(parameter));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public T getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
|
||||||
String json = rs.getString(columnName);
|
|
||||||
if (json != null) {
|
|
||||||
return JSON.parseObject(json, type);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public T getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
|
||||||
String json = rs.getString(columnIndex);
|
|
||||||
if (json != null) {
|
|
||||||
return JSON.parseObject(json, type);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public T getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
|
||||||
String json = cs.getString(columnIndex);
|
|
||||||
if (json != null) {
|
|
||||||
return JSON.parseObject(json, type);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
package com.ff.base.handler;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import org.apache.ibatis.type.BaseTypeHandler;
|
|
||||||
import org.apache.ibatis.type.JdbcType;
|
|
||||||
|
|
||||||
import java.sql.CallableStatement;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* mybatis json字段转换
|
|
||||||
*
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
public class JsonListHandler<T> extends BaseTypeHandler<List<T>> {
|
|
||||||
private final Class<T> type;
|
|
||||||
|
|
||||||
public JsonListHandler(Class<T> type) {
|
|
||||||
if (type == null) {
|
|
||||||
throw new IllegalArgumentException("Type argument cannot be null");
|
|
||||||
}
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setNonNullParameter(PreparedStatement ps, int i, List<T> parameter, JdbcType jdbcType) throws SQLException {
|
|
||||||
// Convert the List<Item> to JSON string
|
|
||||||
String json = JSON.toJSONString(parameter);
|
|
||||||
ps.setString(i, json);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<T> getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
|
||||||
|
|
||||||
String json = rs.getString(columnName);
|
|
||||||
if (json == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return JSON.parseArray(json, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<T> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
|
||||||
String json = rs.getString(columnIndex);
|
|
||||||
if (json == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return JSON.parseArray(json, type);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<T> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
|
||||||
String json = cs.getString(columnIndex);
|
|
||||||
if (json == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return JSON.parseArray(json, type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -2,12 +2,11 @@ package com.ff.base.manager;
|
||||||
|
|
||||||
import com.ff.base.utils.Threads;
|
import com.ff.base.utils.Threads;
|
||||||
import com.ff.base.utils.spring.SpringUtils;
|
import com.ff.base.utils.spring.SpringUtils;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步任务管理器
|
* 异步任务管理器
|
||||||
|
|
@ -25,33 +24,10 @@ public class AsyncManager {
|
||||||
*/
|
*/
|
||||||
private ScheduledExecutorService executor = SpringUtils.getBean("scheduledExecutorService");
|
private ScheduledExecutorService executor = SpringUtils.getBean("scheduledExecutorService");
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 顺序执行线程池
|
|
||||||
*/
|
|
||||||
private List<ExecutorService> orderedExecutor = new ArrayList<>();
|
|
||||||
/**
|
|
||||||
* 最大线程数
|
|
||||||
*/
|
|
||||||
public static final int MAX_THREAD_COUNT = 16;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 线程池
|
|
||||||
*/
|
|
||||||
private ThreadPoolTaskExecutor taskExecutor;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单例模式
|
* 单例模式
|
||||||
*/
|
*/
|
||||||
private AsyncManager() {
|
private AsyncManager() {
|
||||||
for (int i = 0; i < MAX_THREAD_COUNT; i++) {
|
|
||||||
orderedExecutor.add(Executors.newSingleThreadExecutor());
|
|
||||||
}
|
|
||||||
executor = SpringUtils.getBean("scheduledExecutorService");
|
|
||||||
taskExecutor = SpringUtils.getBean("threadPoolTaskExecutor");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AsyncManager me = new AsyncManager();
|
private static AsyncManager me = new AsyncManager();
|
||||||
|
|
@ -60,22 +36,6 @@ public class AsyncManager {
|
||||||
return me;
|
return me;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void executeOrdered(String key, Runnable task) {
|
|
||||||
|
|
||||||
if (null == key || key.isEmpty()) {
|
|
||||||
taskExecutor.execute(task);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int hash = key.hashCode();
|
|
||||||
int index = Math.abs(hash % MAX_THREAD_COUNT);
|
|
||||||
orderedExecutor.get(index).execute(task);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行任务
|
* 执行任务
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface ISysConfigService
|
public interface ISysConfigService
|
||||||
{
|
{
|
||||||
|
|
||||||
SysConfig getByConfigKey(String configKey);
|
|
||||||
/**
|
/**
|
||||||
* 查询参数配置信息
|
* 查询参数配置信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,6 @@ public class SysConfigServiceImpl implements ISysConfigService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
|
|
||||||
@Override
|
|
||||||
public SysConfig getByConfigKey(String configKey) {
|
|
||||||
SysConfig config = new SysConfig();
|
|
||||||
config.setConfigKey(configKey);
|
|
||||||
return configMapper.selectConfig(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询参数配置信息
|
* 查询参数配置信息
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||||
|
|
||||||
public static String DAY_END_TIME = "23:59:59";
|
public static String DAY_END_TIME = "23:59:59";
|
||||||
|
|
||||||
public static final String ISO_8601_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
|
|
||||||
|
|
||||||
|
|
||||||
public static final String ISO_8601_FORMAT_Z = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前Date型日期
|
* 获取当前Date型日期
|
||||||
*
|
*
|
||||||
|
|
@ -208,28 +202,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||||
return zdt.format(formatter);
|
return zdt.format(formatter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 将时间戳转换为指定格式的时间字符串
|
|
||||||
*
|
|
||||||
* @param timestamp 时间戳(毫秒)
|
|
||||||
* @param format 目标时间格式,例如:yyyy-MM-dd'T'HH:mm:ssXXX
|
|
||||||
* @param timeZone 时区,例如:GMT+8,UTC等
|
|
||||||
* @return 格式化后的时间字符串
|
|
||||||
*/
|
|
||||||
public static String convertTimestampToFormattedDate(long timestamp, String format, String timeZone) {
|
|
||||||
// 创建日期格式化对象
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
|
||||||
|
|
||||||
// 设置时区为GMT+8
|
|
||||||
sdf.setTimeZone(TimeZone.getTimeZone(timeZone));
|
|
||||||
|
|
||||||
// 转换为 Date 对象
|
|
||||||
Date date = new Date(timestamp);
|
|
||||||
|
|
||||||
// 返回格式化后的时间字符串
|
|
||||||
return sdf.format(date);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将毫秒时间戳转换为指定时区的时间,并按指定格式输出
|
* 将毫秒时间戳转换为指定时区的时间,并按指定格式输出
|
||||||
*
|
*
|
||||||
|
|
@ -250,6 +222,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加 LocalDate ==> Date
|
* 增加 LocalDate ==> Date
|
||||||
*/
|
*/
|
||||||
|
|
@ -941,38 +914,4 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||||
public static boolean isBetween(Long value, Long minValue, Long maxValue) {
|
public static boolean isBetween(Long value, Long minValue, Long maxValue) {
|
||||||
return value >= minValue && value <= maxValue;
|
return value >= minValue && value <= maxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 将日期字符串转换为指定时区的毫秒时间戳
|
|
||||||
*
|
|
||||||
* @param dateString 日期字符串,格式为 "yyyy-MM-dd'T'HH:mm:ss.SSS"
|
|
||||||
* @param timezone 时区(如 UTC、Asia/Shanghai)
|
|
||||||
* @return 时区下的毫秒时间戳
|
|
||||||
* @throws Exception 日期解析异常
|
|
||||||
*/
|
|
||||||
public static long convertToMillisWithTimezone(String dateString, String timezone) {
|
|
||||||
try {
|
|
||||||
// 设置日期格式
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
|
|
||||||
|
|
||||||
// 设置解析时使用的时区
|
|
||||||
sdf.setTimeZone(TimeZone.getTimeZone(timezone));
|
|
||||||
|
|
||||||
// 解析日期字符串为 Date 对象
|
|
||||||
Date date = sdf.parse(dateString);
|
|
||||||
|
|
||||||
// 获取项目默认时区
|
|
||||||
TimeZone defaultTimeZone = TimeZone.getDefault();
|
|
||||||
|
|
||||||
// 使用默认时区的 Calendar 计算
|
|
||||||
Calendar calendar = Calendar.getInstance(defaultTimeZone);
|
|
||||||
calendar.setTime(date);
|
|
||||||
|
|
||||||
// 返回该时区对应的毫秒时间戳
|
|
||||||
return calendar.getTimeInMillis();
|
|
||||||
} catch (Exception e) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
||||||
public class NumberUtils {
|
public class NumberUtils {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算比例
|
* 计算比例
|
||||||
*
|
*
|
||||||
|
|
@ -67,13 +68,17 @@ public class NumberUtils {
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
// 每位字符可以是大写字母(A-Z)或数字(0-9)
|
// 每位字符可以是字母(A-Z, a-z)或数字(0-9)
|
||||||
for (int i = 0; i <size ; i++) {
|
for (int i = 0; i <size ; i++) {
|
||||||
int choice = random.nextInt(2);
|
int choice = random.nextInt(3);
|
||||||
if (choice == 0) {
|
if (choice == 0) {
|
||||||
// 随机大写字母
|
// 随机字母(大写或小写)
|
||||||
char letter = (char) ('A' + random.nextInt(26));
|
char letter = (char) ('A' + random.nextInt(26));
|
||||||
sb.append(letter);
|
sb.append(letter);
|
||||||
|
} else if (choice == 1) {
|
||||||
|
// 随机小写字母
|
||||||
|
char letter = (char) ('a' + random.nextInt(26));
|
||||||
|
sb.append(letter);
|
||||||
} else {
|
} else {
|
||||||
// 随机数字
|
// 随机数字
|
||||||
sb.append(random.nextInt(10));
|
sb.append(random.nextInt(10));
|
||||||
|
|
@ -83,5 +88,4 @@ public class NumberUtils {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,28 +43,9 @@ public class RandomGeneratorUtils {
|
||||||
if (Character.isLetter(randomChar)) {
|
if (Character.isLetter(randomChar)) {
|
||||||
sb.append(Character.toUpperCase(randomChar));
|
sb.append(Character.toUpperCase(randomChar));
|
||||||
} else {
|
} else {
|
||||||
sb.append(randomChar);
|
sb.append(randomChar); // 保持数字
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成 5-8 之间的随机长度,只包含小写字母和数字
|
|
||||||
*
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
public static String generateRandomAccountLower() {
|
|
||||||
int length = 5 + RANDOM.nextInt(4);
|
|
||||||
StringBuilder sb = new StringBuilder(length);
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
char randomChar = CHARACTERS.charAt(RANDOM.nextInt(CHARACTERS.length()));
|
|
||||||
// 保持字母小写,数字不变
|
|
||||||
sb.append(randomChar);
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -585,12 +585,12 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||||
/**
|
/**
|
||||||
* 加后缀
|
* 加后缀
|
||||||
*
|
*
|
||||||
* @param code 代码
|
* @param account 账户
|
||||||
* @param suffix 后缀
|
* @param suffix 后缀
|
||||||
* @return {@link String }
|
* @return {@link String }
|
||||||
*/
|
*/
|
||||||
public static String addSuffix(String code, Object suffix) {
|
public static String addSuffix(String account, String suffix) {
|
||||||
return code +"_"+ suffix;
|
return account + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.ff.base.constant.Constants;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import sun.misc.BASE64Encoder;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
@ -14,23 +15,27 @@ import java.security.NoSuchAlgorithmException;
|
||||||
*
|
*
|
||||||
* @author ff
|
* @author ff
|
||||||
*/
|
*/
|
||||||
public class Md5Utils {
|
public class Md5Utils
|
||||||
|
{
|
||||||
private static final Logger log = LoggerFactory.getLogger(Md5Utils.class);
|
private static final Logger log = LoggerFactory.getLogger(Md5Utils.class);
|
||||||
|
|
||||||
private static byte[] md5(String s) {
|
private static byte[] md5(String s)
|
||||||
|
{
|
||||||
MessageDigest algorithm;
|
MessageDigest algorithm;
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
algorithm = MessageDigest.getInstance("MD5");
|
algorithm = MessageDigest.getInstance("MD5");
|
||||||
algorithm.reset();
|
algorithm.reset();
|
||||||
algorithm.update(s.getBytes("UTF-8"));
|
algorithm.update(s.getBytes("UTF-8"));
|
||||||
byte[] messageDigest = algorithm.digest();
|
byte[] messageDigest = algorithm.digest();
|
||||||
return messageDigest;
|
return messageDigest;
|
||||||
} catch (Exception e) {
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
log.error("MD5 Error...", e);
|
log.error("MD5 Error...", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String md5New(String input) {
|
public static String md5New(String input) {
|
||||||
try {
|
try {
|
||||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
|
@ -60,22 +65,28 @@ public class Md5Utils {
|
||||||
String result = "";
|
String result = "";
|
||||||
try{
|
try{
|
||||||
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
MessageDigest md5 = MessageDigest.getInstance("MD5");
|
||||||
result = Base64.encode(md5.digest(str.getBytes(StandardCharsets.UTF_8)));
|
BASE64Encoder base64en = new BASE64Encoder();
|
||||||
|
result = base64en.encode(md5.digest(str.getBytes(StandardCharsets.UTF_8)));
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("encoderByMd5...{}", str, e);
|
log.error("encoderByMd5...{0}", str, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String toHex(byte hash[]) {
|
private static final String toHex(byte hash[])
|
||||||
if (hash == null) {
|
{
|
||||||
|
if (hash == null)
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
StringBuffer buf = new StringBuffer(hash.length * 2);
|
StringBuffer buf = new StringBuffer(hash.length * 2);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < hash.length; i++) {
|
for (i = 0; i < hash.length; i++)
|
||||||
if ((hash[i] & 0xff) < 0x10) {
|
{
|
||||||
|
if ((hash[i] & 0xff) < 0x10)
|
||||||
|
{
|
||||||
buf.append("0");
|
buf.append("0");
|
||||||
}
|
}
|
||||||
buf.append(Long.toString(hash[i] & 0xff, 16));
|
buf.append(Long.toString(hash[i] & 0xff, 16));
|
||||||
|
|
@ -83,11 +94,15 @@ public class Md5Utils {
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String hash(String s) {
|
public static String hash(String s)
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
return new String(toHex(md5(Constants.PASS_PREFIX +s)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
|
return new String(toHex(md5(Constants.PASS_PREFIX +s)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8);
|
||||||
} catch (Exception e) {
|
}
|
||||||
log.error("not supported charset...", e);
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("not supported charset...{}", e);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,7 @@
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!--<dependency>
|
|
||||||
<groupId>org.apache.rocketmq</groupId>
|
|
||||||
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
|
||||||
<version>2.4.10</version> <!– 请检查最新版本 –>
|
|
||||||
</dependency>-->
|
|
||||||
<!-- spring-boot-devtools -->
|
<!-- spring-boot-devtools -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.ff.api.controller;
|
package com.ff.api.controller;
|
||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import com.ff.annotation.CheckHeader;
|
import com.ff.annotation.CheckHeader;
|
||||||
import com.ff.api.request.*;
|
import com.ff.api.request.*;
|
||||||
import com.ff.api.response.*;
|
import com.ff.api.response.*;
|
||||||
|
|
@ -11,29 +11,27 @@ import com.ff.base.core.domain.AjaxResult;
|
||||||
import com.ff.base.core.page.TableDataInfo;
|
import com.ff.base.core.page.TableDataInfo;
|
||||||
import com.ff.base.enums.*;
|
import com.ff.base.enums.*;
|
||||||
import com.ff.base.exception.base.ApiException;
|
import com.ff.base.exception.base.ApiException;
|
||||||
import com.ff.base.manager.AsyncManager;
|
import com.ff.base.exception.base.BaseException;
|
||||||
import com.ff.base.system.domain.TenantSecretKey;
|
|
||||||
import com.ff.base.utils.StringUtils;
|
import com.ff.base.utils.StringUtils;
|
||||||
import com.ff.base.utils.bean.BeanUtils;
|
import com.ff.base.utils.bean.BeanUtils;
|
||||||
|
import com.ff.base.system.domain.TenantSecretKey;
|
||||||
import com.ff.common.dto.GameBalanceExchange;
|
import com.ff.common.dto.GameBalanceExchange;
|
||||||
import com.ff.common.service.ITenantGameQuotaFlowService;
|
import com.ff.common.service.ITenantGameQuotaFlowService;
|
||||||
import com.ff.common.service.ITenantGameQuotaService;
|
import com.ff.common.service.ITenantGameQuotaService;
|
||||||
import com.ff.config.KeyConfig;
|
import com.ff.config.KeyConfig;
|
||||||
import com.ff.game.api.IGamesService;
|
import com.ff.game.api.IGamesService;
|
||||||
import com.ff.game.api.exchange.StepProcessorFactory;
|
|
||||||
import com.ff.game.api.exchange.dto.GameExchangeDTO;
|
|
||||||
import com.ff.game.api.request.*;
|
import com.ff.game.api.request.*;
|
||||||
import com.ff.game.domain.*;
|
import com.ff.game.domain.*;
|
||||||
import com.ff.game.dto.GameBettingDetailsDTO;
|
import com.ff.game.dto.GameBettingDetailsDTO;
|
||||||
|
import com.ff.game.dto.GameSecretKeyCurrencyDTO;
|
||||||
|
import com.ff.game.dto.GameSecretKeyLangDTO;
|
||||||
import com.ff.game.service.*;
|
import com.ff.game.service.*;
|
||||||
import com.ff.member.domain.Member;
|
import com.ff.member.domain.Member;
|
||||||
import com.ff.member.service.IMemberService;
|
import com.ff.member.service.IMemberService;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
@ -44,14 +42,13 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.context.request.async.DeferredResult;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.Map;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* api控制器
|
* api控制器
|
||||||
|
|
@ -77,12 +74,22 @@ public class ApiGameController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private KeyConfig keyConfig;
|
private KeyConfig keyConfig;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGameSecretKeyService gameSecretKeyService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IMemberService memberService;
|
private IMemberService memberService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGamePlatformService gamePlatformService;
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ITenantGameQuotaService tenantGameQuotaService;
|
private ITenantGameQuotaService tenantGameQuotaService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ITenantGameQuotaFlowService tenantGameQuotaFlowService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IGameBettingDetailsService gameBettingDetailsService;
|
private IGameBettingDetailsService gameBettingDetailsService;
|
||||||
|
|
||||||
|
|
@ -91,16 +98,17 @@ public class ApiGameController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
private IGameExchangeMoneyService gameExchangeMoneyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGameSecretKeyCurrencyService gameSecretKeyCurrencyService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGameSecretKeyLangService gameSecretKeyLangService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@Qualifier("threadPoolTaskExecutor")
|
@Qualifier("threadPoolTaskExecutor")
|
||||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IPlatformService platformService;
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private StepProcessorFactory stepProcessorFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
|
|
@ -110,15 +118,11 @@ public class ApiGameController extends BaseController {
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public AjaxResult list() {
|
public AjaxResult list() {
|
||||||
List<GameResponse> gameResponses = gameService.selectGameResponseList();
|
List<GameResponse> gameResponses = gameService.selectGameResponseList();
|
||||||
for (GameResponse gameResponse : gameResponses) {
|
for (GameResponse gameRespons : gameResponses) {
|
||||||
Platform platform = platformService.get(gameResponse.getPlatformCode());
|
|
||||||
if (null == platform) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> currencyCode = new ArrayList<>(platform.getCurrencyInfo().keySet());
|
|
||||||
gameResponse.setCurrencyCode(currencyCode);
|
|
||||||
|
|
||||||
|
List<GameSecretKeyCurrencyDTO> gameSecretKeyCurrencies = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder().platformCode(gameRespons.getPlatformCode()).build());
|
||||||
|
List<String> currencyCode = gameSecretKeyCurrencies.stream().map(GameSecretKeyCurrencyDTO::getSystemCurrency).collect(Collectors.toList());
|
||||||
|
gameRespons.setCurrencyCode(currencyCode);
|
||||||
}
|
}
|
||||||
return AjaxResult.success(gameResponses);
|
return AjaxResult.success(gameResponses);
|
||||||
}
|
}
|
||||||
|
|
@ -127,57 +131,49 @@ public class ApiGameController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 登录
|
* 登录
|
||||||
*
|
*
|
||||||
* @param loginRequest 登入游戏
|
* @param memberCreateApiRequest 成员创建api请求
|
||||||
* @return {@link AjaxResult }
|
* @return {@link AjaxResult }
|
||||||
*/
|
*/
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public AjaxResult login(@Validated @RequestBody GameLoginRequest loginRequest) {
|
public AjaxResult login(@Validated @RequestBody GameLoginRequest memberCreateApiRequest) {
|
||||||
|
|
||||||
Game game = gameService.selectGameByGameId(loginRequest.getGameId());
|
Game game = gameService.selectGameById(memberCreateApiRequest.getGameId());
|
||||||
ApiException.notNull(game, ErrorCode.GAME_NOT_EXIST.getCode());
|
ApiException.notNull(game, ErrorCode.GAME_NOT_EXIST.getCode());
|
||||||
|
|
||||||
Platform platform = platformService.get(game.getPlatformCode());
|
GamePlatform gamePlatform = gamePlatformService.selectGamePlatformById(game.getPlatformId());
|
||||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
ApiException.notNull(gamePlatform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||||
IGamesService iGamesService = gamesService.get(platform.getPlatformCode() + Constants.SERVICE);
|
|
||||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(loginRequest.getCurrencyCode());
|
|
||||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(loginRequest.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(loginRequest.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
String targetLang = platform.getLangInfo().get(loginRequest.getLangCode());
|
|
||||||
ApiException.notNull(targetLang, ErrorCode.LANG_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
|
|
||||||
Member member = memberService.selectMemberByAccount(loginRequest.getAccount(), loginRequest.getCurrencyCode(), platform.getPlatformCode());
|
IGamesService iGamesService = gamesService.get(gamePlatform.getPlatformCode() + Constants.SERVICE);
|
||||||
|
|
||||||
|
|
||||||
|
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||||
|
GameSecretKeyCurrencyDTO secretKeyCurrencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
|
.platformCode(gamePlatform.getPlatformCode())
|
||||||
|
.systemCurrency(memberCreateApiRequest.getCurrencyCode()).build());
|
||||||
|
ApiException.notNull(secretKeyCurrencyDTO, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
GameSecretKeyLangDTO gameSecretKeyLangDTO = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
|
||||||
|
.platformCode(gamePlatform.getPlatformCode())
|
||||||
|
.systemLangCode(memberCreateApiRequest.getLangCode())
|
||||||
|
.build());
|
||||||
|
ApiException.notNull(gameSecretKeyLangDTO, ErrorCode.LANG_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
|
||||||
|
Member member = memberService.selectMemberByAccount(memberCreateApiRequest.getAccount(), memberCreateApiRequest.getCurrencyCode(), gamePlatform.getPlatformCode());
|
||||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||||
|
|
||||||
GamesLogin gamesLogin = GamesLogin.builder()
|
GamesLogin gamesLogin = GamesLogin.builder()
|
||||||
.agentId(keyInfo.getCode())
|
.agentId(secretKeyCurrencyDTO.getCode())
|
||||||
.agentKey(keyInfo.getKey())
|
.agentKey(secretKeyCurrencyDTO.getKey())
|
||||||
.account(member.getGameAccount())
|
.account(member.getGameAccount())
|
||||||
.gameType(game.getGameSourceType())
|
.gameType(game.getGameSourceType())
|
||||||
.currency(/*secretKeyCurrencyDTO.getCurrency()*/targetCurrency)
|
.currency(secretKeyCurrencyDTO.getCurrency())
|
||||||
.gameId(game.getGameCode())
|
.gameId(game.getGameCode())
|
||||||
.homeUrl(loginRequest.getHomeUrl())
|
.homeUrl(memberCreateApiRequest.getHomeUrl())
|
||||||
.betLimit(loginRequest.getBetLimit())
|
.platform(memberCreateApiRequest.getPlatform())
|
||||||
.platform(loginRequest.getPlatform())
|
.disableFullScreen(memberCreateApiRequest.getDisableFullScreen())
|
||||||
.disableFullScreen(loginRequest.getDisableFullScreen())
|
.lang(gameSecretKeyLangDTO.getLang())
|
||||||
.lang(/*gameSecretKeyLangDTO.getLang()*/ targetLang)
|
|
||||||
.vendor(platform)
|
|
||||||
.keyInfo(keyInfo)
|
|
||||||
.systemCurrency(loginRequest.getCurrencyCode())
|
|
||||||
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
String login = iGamesService.loginWithoutRedirect(gamesLogin);
|
String login = iGamesService.loginWithoutRedirect(gamesLogin);
|
||||||
|
|
@ -193,101 +189,53 @@ public class ApiGameController extends BaseController {
|
||||||
* @return {@link AjaxResult }
|
* @return {@link AjaxResult }
|
||||||
*/
|
*/
|
||||||
@PostMapping("/exchange/balance")
|
@PostMapping("/exchange/balance")
|
||||||
public DeferredResult<AjaxResult> exchangeBalance(@Validated @RequestBody GameExchangeBalanceRequest gameExchangeBalanceRequest) {
|
@Transactional
|
||||||
|
public AjaxResult exchangeBalance(@Validated @RequestBody GameExchangeBalanceRequest gameExchangeBalanceRequest) {
|
||||||
|
|
||||||
|
|
||||||
IGamesService iGamesService = gamesService.get(gameExchangeBalanceRequest.getPlatformCode() + Constants.SERVICE);
|
IGamesService iGamesService = gamesService.get(gameExchangeBalanceRequest.getPlatformCode() + Constants.SERVICE);
|
||||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||||
|
|
||||||
TenantSecretKey tenantSecretKey = keyConfig.get();
|
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||||
|
|
||||||
|
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
|
.platformCode(gameExchangeBalanceRequest.getPlatformCode())
|
||||||
|
.systemCurrency(gameExchangeBalanceRequest.getCurrencyCode()).build());
|
||||||
|
|
||||||
Platform platform = platformService.get(gameExchangeBalanceRequest.getPlatformCode());
|
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(gameExchangeBalanceRequest.getCurrencyCode());
|
BigDecimal quota = tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
|
||||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
.platformCode(gameExchangeBalanceRequest.getPlatformCode())
|
||||||
|
.sourceId(gameExchangeBalanceRequest.getOrderId())
|
||||||
KeyInfo keyInfo = null;
|
.currencyCode(gameExchangeBalanceRequest.getCurrencyCode())
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
.transferType(gameExchangeBalanceRequest.getTransferType())
|
||||||
if (StringUtils.isNotEmpty(gameExchangeBalanceRequest.getCurrencyCode())) {
|
.amount(gameExchangeBalanceRequest.getAmount())
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(gameExchangeBalanceRequest.getCurrencyCode())) {
|
.account(gameExchangeBalanceRequest.getAccount())
|
||||||
keyInfo = keyData;
|
.tenantKey(tenantSecretKey.getTenantKey())
|
||||||
break;
|
.build());
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
Member member = memberService.selectMemberByAccount(gameExchangeBalanceRequest.getAccount(), gameExchangeBalanceRequest.getCurrencyCode(), gameExchangeBalanceRequest.getPlatformCode());
|
Member member = memberService.selectMemberByAccount(gameExchangeBalanceRequest.getAccount(), gameExchangeBalanceRequest.getCurrencyCode(), gameExchangeBalanceRequest.getPlatformCode());
|
||||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||||
|
|
||||||
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(
|
|
||||||
GameExchangeMoney.builder()
|
//操作第三方额度接口
|
||||||
.tenantKey(tenantSecretKey.getTenantKey())
|
ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO = ExchangeTransferMoneyRequestDTO.builder()
|
||||||
|
.agentId(gameSecretKey.getCode())
|
||||||
|
.agentKey(gameSecretKey.getKey())
|
||||||
.orderId(gameExchangeBalanceRequest.getOrderId())
|
.orderId(gameExchangeBalanceRequest.getOrderId())
|
||||||
.build()
|
.account(member.getGameAccount())
|
||||||
);
|
.currency(gameSecretKey.getCurrency())
|
||||||
|
|
||||||
ApiException.isTrue(CollectionUtils.isEmpty(gameExchangeMonies), ErrorCode.DUPLICATE_ORDER_ID.getCode());
|
|
||||||
|
|
||||||
|
|
||||||
Long gameExchangeMoneyId = IdUtil.getSnowflakeNextId();
|
|
||||||
GameExchangeDTO exchangeMoney = GameExchangeDTO.builder()
|
|
||||||
.id(gameExchangeMoneyId)
|
|
||||||
.tenantKey(tenantSecretKey.getTenantKey())
|
.tenantKey(tenantSecretKey.getTenantKey())
|
||||||
.memberId(member.getId())
|
.quota(quota)
|
||||||
.gameAccount(member.getGameAccount())
|
.amount(gameExchangeBalanceRequest.getAmount())
|
||||||
.memberAccount(member.getMemberAccount())
|
.transferType(gameExchangeBalanceRequest.getTransferType())
|
||||||
.exchangeType(gameExchangeBalanceRequest.getTransferType())
|
.build();
|
||||||
.currencyCode(gameExchangeBalanceRequest.getCurrencyCode())
|
Long exchangeTransferId = iGamesService.exchangeTransferByAgentId(exchangeTransferMoneyRequestDTO);
|
||||||
.orderId(gameExchangeBalanceRequest.getOrderId())
|
GameExchangeMoney gameExchangeMoney = gameExchangeMoneyService.selectGameExchangeMoneyById(exchangeTransferId);
|
||||||
.balance(gameExchangeBalanceRequest.getAmount())
|
|
||||||
.triggerType(TriggerType.MANUAL.getCode())
|
|
||||||
.platformCode(gameExchangeBalanceRequest.getPlatformCode()).build();
|
|
||||||
|
|
||||||
|
|
||||||
//转出设置转出金额为0
|
|
||||||
if (TransferType.ALL.getCode().equals(gameExchangeBalanceRequest.getTransferType())){
|
|
||||||
exchangeMoney.setBalance(BigDecimal.ZERO);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ExtInfo extInfo = platform.getExtInfo();
|
|
||||||
Long timeout = 5000L;
|
|
||||||
if (extInfo != null) {
|
|
||||||
timeout = extInfo.getTimeout(TimeOutType.GAME_EXCHANGE_MONEY.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DeferredResult<AjaxResult> output = new DeferredResult<>(timeout);
|
|
||||||
AsyncManager.me().executeOrdered(
|
|
||||||
exchangeMoney.getOrderId(),
|
|
||||||
() -> {
|
|
||||||
try {
|
|
||||||
stepProcessorFactory.getStepProcessor(GameExchangeStep.CREATE_ORDER).process(exchangeMoney);
|
|
||||||
|
|
||||||
GameExchangeMoney gameExchangeMoney = gameExchangeMoneyService.selectGameExchangeMoneyById(gameExchangeMoneyId);
|
|
||||||
GameExchangeBalanceResponse gameExchangeBalanceResponse = new GameExchangeBalanceResponse();
|
GameExchangeBalanceResponse gameExchangeBalanceResponse = new GameExchangeBalanceResponse();
|
||||||
BeanUtils.copyProperties(gameExchangeMoney, gameExchangeBalanceResponse);
|
BeanUtils.copyProperties(gameExchangeMoney, gameExchangeBalanceResponse);
|
||||||
output.setResult(AjaxResult.success(gameExchangeBalanceResponse));
|
return AjaxResult.success(gameExchangeBalanceResponse);
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("ApiGameController [exchangeBalance] 余额转移失败 gameExchangeMoneyId {}", gameExchangeMoneyId,e);
|
|
||||||
stepProcessorFactory.getStepProcessor(GameExchangeStep.getByCode(exchangeMoney.getStep())).rollBack(exchangeMoney);
|
|
||||||
output.setErrorResult(AjaxResult.error(ErrorCode.BALANCE_TRANSFER_FAILED.getCode(), ErrorCode.BALANCE_TRANSFER_FAILED.getMessage()));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
// 超时时间处理逻辑
|
|
||||||
output.onTimeout(() -> {
|
|
||||||
GameExchangeMoney gameExchangeMoney = gameExchangeMoneyService.selectGameExchangeMoneyById(gameExchangeMoneyId);
|
|
||||||
GameExchangeBalanceResponse gameExchangeBalanceResponse = new GameExchangeBalanceResponse();
|
|
||||||
BeanUtils.copyProperties(gameExchangeMoney, gameExchangeBalanceResponse);
|
|
||||||
output.setErrorResult(AjaxResult.success(gameExchangeBalanceResponse));
|
|
||||||
});
|
|
||||||
return output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -327,22 +275,12 @@ public class ApiGameController extends BaseController {
|
||||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
|
||||||
Platform platform = platformService.get(gameCreateFreeSpinRequest.getPlatformCode());
|
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
|
.platformCode(gameCreateFreeSpinRequest.getPlatformCode())
|
||||||
|
.systemCurrency(gameCreateFreeSpinRequest.getCurrencyCode()).build());
|
||||||
|
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||||
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(gameCreateFreeSpinRequest.getCurrencyCode());
|
|
||||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(gameCreateFreeSpinRequest.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(gameCreateFreeSpinRequest.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
Member member = memberService.selectMemberByAccount(gameCreateFreeSpinRequest.getAccount(), gameCreateFreeSpinRequest.getCurrencyCode(), gameCreateFreeSpinRequest.getPlatformCode());
|
Member member = memberService.selectMemberByAccount(gameCreateFreeSpinRequest.getAccount(), gameCreateFreeSpinRequest.getCurrencyCode(), gameCreateFreeSpinRequest.getPlatformCode());
|
||||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||||
|
|
@ -350,18 +288,15 @@ public class ApiGameController extends BaseController {
|
||||||
|
|
||||||
CreateFreeSpinRequestDTO createFreeSpinRequestDTO = CreateFreeSpinRequestDTO.builder()
|
CreateFreeSpinRequestDTO createFreeSpinRequestDTO = CreateFreeSpinRequestDTO.builder()
|
||||||
.account(member.getGameAccount())
|
.account(member.getGameAccount())
|
||||||
.currency(/*gameCreateFreeSpinRequest.getCurrencyCode()*/targetCurrency)
|
.currency(gameCreateFreeSpinRequest.getCurrencyCode())
|
||||||
.agentId(keyInfo.getCode())
|
.agentId(gameSecretKey.getCode())
|
||||||
.agentKey(keyInfo.getKey())
|
.agentKey(gameSecretKey.getKey())
|
||||||
.referenceId(gameCreateFreeSpinRequest.getReferenceId())
|
.referenceId(gameCreateFreeSpinRequest.getReferenceId())
|
||||||
.freeSpinValidity(gameCreateFreeSpinRequest.getFreeSpinValidity())
|
.freeSpinValidity(gameCreateFreeSpinRequest.getFreeSpinValidity())
|
||||||
.numberOfRounds(gameCreateFreeSpinRequest.getNumberOfRounds())
|
.numberOfRounds(gameCreateFreeSpinRequest.getNumberOfRounds())
|
||||||
.gameIds(gameCreateFreeSpinRequest.getGameIds())
|
.gameIds(gameCreateFreeSpinRequest.getGameIds())
|
||||||
.betValue(gameCreateFreeSpinRequest.getBetValue())
|
.betValue(gameCreateFreeSpinRequest.getBetValue())
|
||||||
.startTime(gameCreateFreeSpinRequest.getStartTime())
|
.startTime(gameCreateFreeSpinRequest.getStartTime())
|
||||||
.vendor(platform)
|
|
||||||
.keyInfo(keyInfo)
|
|
||||||
.systemCurrency(gameCreateFreeSpinRequest.getCurrencyCode())
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -414,53 +349,32 @@ public class ApiGameController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@PostMapping("/get/detail")
|
@PostMapping("/get/detail")
|
||||||
public AjaxResult getDetail(@Validated @RequestBody GameGetDetailRequest gameGetDetailRequest) {
|
public AjaxResult getDetail(@Validated @RequestBody GameGetDetailRequest gameGetDetailRequest) {
|
||||||
Platform platform = platformService.get(gameGetDetailRequest.getPlatformCode());
|
|
||||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(gameGetDetailRequest.getCurrencyCode());
|
|
||||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(gameGetDetailRequest.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(gameGetDetailRequest.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
String targetLang = platform.getLangInfo().get(gameGetDetailRequest.getLangCode());
|
|
||||||
ApiException.notNull(targetLang, ErrorCode.LANG_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
|
||||||
// .platformCode(gameGetDetailRequest.getPlatformCode())
|
|
||||||
// .systemCurrency(gameGetDetailRequest.getCurrencyCode()).build());
|
|
||||||
|
|
||||||
|
|
||||||
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
|
.platformCode(gameGetDetailRequest.getPlatformCode())
|
||||||
|
.systemCurrency(gameGetDetailRequest.getCurrencyCode()).build());
|
||||||
|
|
||||||
|
|
||||||
|
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
|
||||||
IGamesService iGamesService = gamesService.get(gameGetDetailRequest.getPlatformCode() + Constants.SERVICE);
|
IGamesService iGamesService = gamesService.get(gameGetDetailRequest.getPlatformCode() + Constants.SERVICE);
|
||||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
|
||||||
// GameSecretKeyLangDTO gameSecretKeyLang = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
|
GameSecretKeyLangDTO gameSecretKeyLang = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
|
||||||
// .platformCode(gameGetDetailRequest.getPlatformCode())
|
.platformCode(gameGetDetailRequest.getPlatformCode())
|
||||||
// .systemLangCode(gameGetDetailRequest.getLangCode())
|
.systemLangCode(gameGetDetailRequest.getLangCode())
|
||||||
// .build());
|
.build());
|
||||||
// ApiException.notNull(gameSecretKeyLang, ErrorCode.LANG_NOT_EXIST.getCode());
|
ApiException.notNull(gameSecretKeyLang, ErrorCode.LANG_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
|
||||||
GetGameDetailResponseDTO gameDetail = iGamesService.getGameDetail(GetGameDetailRequestDTO.builder()
|
GetGameDetailResponseDTO gameDetail = iGamesService.getGameDetail(GetGameDetailRequestDTO.builder()
|
||||||
.wagersId(gameGetDetailRequest.getWagersId())
|
.wagersId(gameGetDetailRequest.getWagersId())
|
||||||
.lang(/*gameSecretKeyLang.getLang()*/targetLang)
|
.lang(gameSecretKeyLang.getLang())
|
||||||
.agentId(keyInfo.getCode())
|
.agentId(gameSecretKey.getCode())
|
||||||
.agentKey(keyInfo.getKey())
|
.agentKey(gameSecretKey.getKey())
|
||||||
.vendor(platform)
|
|
||||||
.keyInfo(keyInfo)
|
|
||||||
.systemCurrency(gameGetDetailRequest.getCurrencyCode())
|
|
||||||
.build());
|
.build());
|
||||||
return AjaxResult.success(gameDetail);
|
return AjaxResult.success(gameDetail);
|
||||||
}
|
}
|
||||||
|
|
@ -473,82 +387,45 @@ public class ApiGameController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@PostMapping("/kick/member")
|
@PostMapping("/kick/member")
|
||||||
public AjaxResult kickMember(@Validated @RequestBody GameKickMemeberRequest gameKickMemeberRequest) {
|
public AjaxResult kickMember(@Validated @RequestBody GameKickMemeberRequest gameKickMemeberRequest) {
|
||||||
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
// .platformCode(gameKickMemeberRequest.getPlatformCode())
|
.platformCode(gameKickMemeberRequest.getPlatformCode())
|
||||||
// .systemCurrency(gameKickMemeberRequest.getCurrencyCode()).build());
|
.systemCurrency(gameKickMemeberRequest.getCurrencyCode()).build());
|
||||||
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||||
|
|
||||||
Platform platform = platformService.get(gameKickMemeberRequest.getPlatformCode());
|
|
||||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(gameKickMemeberRequest.getCurrencyCode());
|
Member member = memberService.selectMemberByAccount(gameKickMemeberRequest.getAccount(), gameKickMemeberRequest.getCurrencyCode(), gameKickMemeberRequest.getPlatformCode());
|
||||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||||
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(gameKickMemeberRequest.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(gameKickMemeberRequest.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
|
|
||||||
IGamesService iGamesService = gamesService.get(gameKickMemeberRequest.getPlatformCode() + Constants.SERVICE);
|
IGamesService iGamesService = gamesService.get(gameKickMemeberRequest.getPlatformCode() + Constants.SERVICE);
|
||||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
|
||||||
Member member = memberService.selectMemberByAccount(gameKickMemeberRequest.getAccount(), gameKickMemeberRequest.getCurrencyCode(), gameKickMemeberRequest.getPlatformCode());
|
|
||||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
return AjaxResult.success(iGamesService.kickMember(KickMemberRequestDTO.builder()
|
return AjaxResult.success(iGamesService.kickMember(KickMemberRequestDTO.builder()
|
||||||
.account(member.getGameAccount())
|
.account(member.getGameAccount())
|
||||||
.agentId(keyInfo.getCode())
|
.agentId(gameSecretKey.getCode())
|
||||||
.currency(targetCurrency)
|
.currency(gameSecretKey.getCurrency())
|
||||||
.agentKey(keyInfo.getKey())
|
.agentKey(gameSecretKey.getKey())
|
||||||
.vendor(platform)
|
|
||||||
.keyInfo(keyInfo)
|
|
||||||
.systemCurrency(gameKickMemeberRequest.getCurrencyCode())
|
|
||||||
.build()));
|
.build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/kick/member/all")
|
@PostMapping("/kick/member/all")
|
||||||
public AjaxResult kickMemberAll(@Validated @RequestBody GameKickMemeberAllRequest gameKickMemeberAllRequest) {
|
public AjaxResult kickMemberAll(@Validated @RequestBody GameKickMemeberAllRequest gameKickMemeberAllRequest) {
|
||||||
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
// .platformCode(gameKickMemeberAllRequest.getPlatformCode())
|
.platformCode(gameKickMemeberAllRequest.getPlatformCode())
|
||||||
// .systemCurrency(gameKickMemeberAllRequest.getCurrencyCode()).build());
|
.systemCurrency(gameKickMemeberAllRequest.getCurrencyCode()).build());
|
||||||
//
|
|
||||||
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
Platform platform = platformService.get(gameKickMemeberAllRequest.getPlatformCode());
|
|
||||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(gameKickMemeberAllRequest.getCurrencyCode());
|
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(gameKickMemeberAllRequest.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(gameKickMemeberAllRequest.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
IGamesService iGamesService = gamesService.get(gameKickMemeberAllRequest.getPlatformCode() + Constants.SERVICE);
|
IGamesService iGamesService = gamesService.get(gameKickMemeberAllRequest.getPlatformCode() + Constants.SERVICE);
|
||||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
KickMemberAllDTO kickMemberAllDTO = KickMemberAllDTO.builder()
|
KickMemberAllDTO kickMemberAllDTO = KickMemberAllDTO.builder()
|
||||||
.agentId(keyInfo.getCode())
|
.agentId(gameSecretKey.getCode())
|
||||||
.agentKey(keyInfo.getKey())
|
.agentKey(gameSecretKey.getKey())
|
||||||
.currency(/*gameSecretKey.getCurrency()*/targetCurrency)
|
.currency(gameSecretKey.getCurrency())
|
||||||
.vendor(platform)
|
|
||||||
.keyInfo(keyInfo)
|
|
||||||
.systemCurrency(gameKickMemeberAllRequest.getCurrencyCode())
|
|
||||||
.build();
|
.build();
|
||||||
if (!ObjectUtils.isEmpty(gameKickMemeberAllRequest.getGameId())) {
|
if (!ObjectUtils.isEmpty(gameKickMemeberAllRequest.getGameId())) {
|
||||||
Game game = gameService.selectGameById(gameKickMemeberAllRequest.getGameId());
|
Game game = gameService.selectGameById(gameKickMemeberAllRequest.getGameId());
|
||||||
|
|
@ -597,43 +474,23 @@ public class ApiGameController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 取消自由旋转
|
* 取消自由旋转
|
||||||
*
|
*
|
||||||
* @param request 游戏获得免费旋转dashflow请求
|
* @param gameGetFreeSpinDashflowRequest 游戏获得免费旋转dashflow请求
|
||||||
* @return {@link TableDataInfo }
|
* @return {@link TableDataInfo }
|
||||||
*/
|
*/
|
||||||
@PostMapping("/cancel/free/spin")
|
@PostMapping("/cancel/free/spin")
|
||||||
public AjaxResult cancelFreeSpin(@Validated @RequestBody GameCancelFreeSpinRequest request) {
|
public AjaxResult cancelFreeSpin(@Validated @RequestBody GameCancelFreeSpinRequest gameGetFreeSpinDashflowRequest) {
|
||||||
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
// .platformCode(gameGetFreeSpinDashflowRequest.getPlatformCode())
|
.platformCode(gameGetFreeSpinDashflowRequest.getPlatformCode())
|
||||||
// .systemCurrency(gameGetFreeSpinDashflowRequest.getCurrencyCode()).build());
|
.systemCurrency(gameGetFreeSpinDashflowRequest.getCurrencyCode()).build());
|
||||||
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||||
|
|
||||||
Platform platform = platformService.get(request.getPlatformCode());
|
IGamesService iGamesService = gamesService.get(gameGetFreeSpinDashflowRequest.getPlatformCode() + Constants.SERVICE);
|
||||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(request.getCurrencyCode());
|
|
||||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(request.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(request.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
IGamesService iGamesService = gamesService.get(request.getPlatformCode() + Constants.SERVICE);
|
|
||||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||||
|
|
||||||
Boolean cancelFreeSpin = iGamesService.cancelFreeSpin(CancelFreeSpinRequestDTO.builder()
|
Boolean cancelFreeSpin = iGamesService.cancelFreeSpin(CancelFreeSpinRequestDTO.builder()
|
||||||
.agentId(keyInfo.getCode())
|
.agentId(gameSecretKey.getCode())
|
||||||
.agentKey(keyInfo.getKey())
|
.agentKey(gameSecretKey.getKey())
|
||||||
.referenceId(request.getReferenceId())
|
.referenceId(gameGetFreeSpinDashflowRequest.getReferenceId())
|
||||||
.vendor(platform)
|
|
||||||
.keyInfo(keyInfo)
|
|
||||||
.systemCurrency(request.getCurrencyCode())
|
|
||||||
.build());
|
.build());
|
||||||
return AjaxResult.success(cancelFreeSpin);
|
return AjaxResult.success(cancelFreeSpin);
|
||||||
}
|
}
|
||||||
|
|
@ -641,80 +498,45 @@ public class ApiGameController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 信息全部
|
* 信息全部
|
||||||
*
|
*
|
||||||
* @param request 成员信息所有api请求
|
* @param gameExchangeBalanceAllRequest 成员信息所有api请求
|
||||||
* @return {@link AjaxResult }
|
* @return {@link AjaxResult }
|
||||||
*//*
|
*/
|
||||||
@PostMapping("/exchange/balance/all")
|
@PostMapping("/exchange/balance/all")
|
||||||
public AjaxResult exchangeBalanceAll(@Validated @RequestBody GameExchangeBalanceAllRequest request) {
|
public AjaxResult exchangeBalanceAll(@Validated @RequestBody GameExchangeBalanceAllRequest gameExchangeBalanceAllRequest) {
|
||||||
|
|
||||||
TenantSecretKey tenantSecretKey = keyConfig.get();
|
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||||
|
|
||||||
// List<GameSecretKeyCurrencyDTO> gameSecretKeys = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder()
|
|
||||||
// .systemCurrency(gameExchangeBalanceAllRequest.getCurrencyCode()).build());
|
|
||||||
|
|
||||||
|
List<GameSecretKeyCurrencyDTO> gameSecretKeys = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder()
|
||||||
|
.systemCurrency(gameExchangeBalanceAllRequest.getCurrencyCode()).build());
|
||||||
|
|
||||||
List<Key> keys = new ArrayList<>();
|
|
||||||
for (GamePlatforms platformEnum : GamePlatforms.values()) {
|
|
||||||
|
|
||||||
Platform platform = platformService.get(platformEnum.getCode());
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(request.getCurrencyCode());
|
|
||||||
if (StringUtils.isEmpty(targetCurrency)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(request.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(request.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (null == keyInfo) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Key key = new Key();
|
|
||||||
key.setPlatformCode(platform.getPlatformCode());
|
|
||||||
key.setCode(keyInfo.getCode());
|
|
||||||
key.setKey(keyInfo.getKey());
|
|
||||||
key.setCurrency(targetCurrency);
|
|
||||||
key.setPlatform(platform);
|
|
||||||
key.setKeyInfo(keyInfo);
|
|
||||||
key.setSystemCurrency(request.getCurrencyCode());
|
|
||||||
keys.add(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建线程池
|
// 创建线程池
|
||||||
Map<String, BigDecimal> balanceMap = new LinkedHashMap<>();
|
Map<String, BigDecimal> balanceMap = new LinkedHashMap<>();
|
||||||
CountDownLatch latch = new CountDownLatch(keys.size());
|
CountDownLatch latch = new CountDownLatch(gameSecretKeys.size());
|
||||||
|
|
||||||
// 使用List存储Future对象,用于获取异步执行的结果
|
// 使用List存储Future对象,用于获取异步执行的结果
|
||||||
List<Future<Long>> futures = new ArrayList<>();
|
List<Future<Long>> futures = new ArrayList<>();
|
||||||
|
|
||||||
// 提交异步任务到线程池
|
// 提交异步任务到线程池
|
||||||
// for (GameSecretKeyCurrencyDTO gameSecretKeyCurrencyDTO : gameSecretKeys) {
|
for (GameSecretKeyCurrencyDTO gameSecretKeyCurrencyDTO : gameSecretKeys) {
|
||||||
for (Key key : keys) {
|
|
||||||
futures.add(threadPoolTaskExecutor.submit(() -> {
|
futures.add(threadPoolTaskExecutor.submit(() -> {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
IGamesService iGamesService = gamesService.get(key.getPlatformCode() + Constants.SERVICE);
|
IGamesService iGamesService = gamesService.get(gameSecretKeyCurrencyDTO.getPlatformCode() + Constants.SERVICE);
|
||||||
|
|
||||||
Member member = memberService.selectMemberByAccount(request.getAccount(), request.getCurrencyCode(), key.getPlatformCode());
|
Member member = memberService.selectMemberByAccount(gameExchangeBalanceAllRequest.getAccount(), gameExchangeBalanceAllRequest.getCurrencyCode(), gameSecretKeyCurrencyDTO.getPlatformCode());
|
||||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||||
|
|
||||||
//操作第三方钱包
|
//操作第三方钱包
|
||||||
ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO = ExchangeTransferMoneyRequestDTO.builder()
|
ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO = ExchangeTransferMoneyRequestDTO.builder()
|
||||||
.agentId(key.getCode())
|
.agentId(gameSecretKeyCurrencyDTO.getCode())
|
||||||
.agentKey(key.getKey())
|
.agentKey(gameSecretKeyCurrencyDTO.getKey())
|
||||||
.orderId(request.getOrderId())
|
.orderId(gameExchangeBalanceAllRequest.getOrderId())
|
||||||
.amount(BigDecimal.ONE)
|
.amount(BigDecimal.ONE)
|
||||||
.currency(*//*gameSecretKeyCurrencyDTO.getCurrency()*//*key.currency)
|
.currency(gameSecretKeyCurrencyDTO.getCurrency())
|
||||||
.tenantKey(tenantSecretKey.getTenantKey())
|
.tenantKey(tenantSecretKey.getTenantKey())
|
||||||
.account(member.getGameAccount())
|
.account(member.getGameAccount())
|
||||||
.vendor(key.getPlatform())
|
|
||||||
.keyInfo(key.getKeyInfo())
|
|
||||||
.systemCurrency(key.systemCurrency)
|
|
||||||
.transferType(TransferType.ALL.getCode())
|
.transferType(TransferType.ALL.getCode())
|
||||||
.build();
|
.build();
|
||||||
return iGamesService.exchangeTransferByAgentId(exchangeTransferMoneyRequestDTO);
|
return iGamesService.exchangeTransferByAgentId(exchangeTransferMoneyRequestDTO);
|
||||||
|
|
@ -749,15 +571,11 @@ public class ApiGameController extends BaseController {
|
||||||
tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
|
tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
|
||||||
.platformCode(gameExchangeMoney.getPlatformCode())
|
.platformCode(gameExchangeMoney.getPlatformCode())
|
||||||
.currencyCode(gameExchangeMoney.getCurrencyCode())
|
.currencyCode(gameExchangeMoney.getCurrencyCode())
|
||||||
.sourceId(request.getOrderId())
|
.sourceId(gameExchangeBalanceAllRequest.getOrderId())
|
||||||
.transferType(TransferType.ALL.getCode())
|
.transferType(TransferType.ALL.getCode())
|
||||||
.amount(gameExchangeMoney.getBalance())
|
.amount(gameExchangeMoney.getBalance())
|
||||||
.account(member.getMemberAccount())
|
.account(member.getMemberAccount())
|
||||||
.tenantKey(tenantSecretKey.getTenantKey())
|
.tenantKey(tenantSecretKey.getTenantKey())
|
||||||
.currency()
|
|
||||||
.systemCurrency(gameExchangeMoney.getCurrencyCode())
|
|
||||||
.agentId()
|
|
||||||
.agentKey()
|
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -769,77 +587,5 @@ public class ApiGameController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
return AjaxResult.success(balanceMap);
|
return AjaxResult.success(balanceMap);
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 演示登录
|
|
||||||
*
|
|
||||||
* @param request 游戏演示登录请求
|
|
||||||
* @return {@link AjaxResult }
|
|
||||||
*/
|
|
||||||
@PostMapping("/demo/login")
|
|
||||||
public AjaxResult demoLogin(@Validated @RequestBody GameDemoLoginRequest request) {
|
|
||||||
|
|
||||||
Game game = gameService.selectGameById(request.getGameId());
|
|
||||||
ApiException.notNull(game, ErrorCode.GAME_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
//GamePlatform gamePlatform = gamePlatformService.selectGamePlatformById(game.getPlatformId());
|
|
||||||
//ApiException.notNull(gamePlatform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
Platform platform = platformService.get(game.getPlatformCode());
|
|
||||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
IGamesService iGamesService = gamesService.get(platform.getPlatformCode() + Constants.SERVICE);
|
|
||||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(request.getCurrencyCode());
|
|
||||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(request.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(request.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
String targetLang = platform.getLangInfo().get(request.getLangCode());
|
|
||||||
ApiException.notNull(targetLang, ErrorCode.LANG_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
// GameSecretKeyLangDTO gameSecretKeyLangDTO = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
|
|
||||||
// .platformCode(gamePlatform.getPlatformCode())
|
|
||||||
// .systemLangCode(gameDemoLoginRequest.getLangCode())
|
|
||||||
// .build());
|
|
||||||
// ApiException.notNull(gameSecretKeyLangDTO, ErrorCode.LANG_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
|
|
||||||
GameDemoLoginRequestDTO gamesLogin = GameDemoLoginRequestDTO.builder()
|
|
||||||
.gameId(game.getGameCode())
|
|
||||||
.gameType(game.getGameSourceType())
|
|
||||||
.lang(/*gameSecretKeyLangDTO.getLang()*/targetLang)
|
|
||||||
.vendor(platform)
|
|
||||||
.keyInfo(keyInfo)
|
|
||||||
.systemCurrency(request.getCurrencyCode())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
GameDemoLoginResponseDTO gameDemoLoginResponseDTO = iGamesService.gameDemoLogin(gamesLogin);
|
|
||||||
GameDemoLoginResponse gameDemoLoginResponse = new GameDemoLoginResponse();
|
|
||||||
BeanUtils.copyProperties(gameDemoLoginResponseDTO, gameDemoLoginResponse);
|
|
||||||
return AjaxResult.success(gameDemoLoginResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
class Key {
|
|
||||||
private String platformCode;
|
|
||||||
private String code;
|
|
||||||
private String currency;
|
|
||||||
private String key;
|
|
||||||
private Platform platform;
|
|
||||||
private KeyInfo keyInfo;
|
|
||||||
private String systemCurrency;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,22 +11,20 @@ import com.ff.base.constant.Constants;
|
||||||
import com.ff.base.core.controller.BaseController;
|
import com.ff.base.core.controller.BaseController;
|
||||||
import com.ff.base.core.domain.AjaxResult;
|
import com.ff.base.core.domain.AjaxResult;
|
||||||
import com.ff.base.enums.ErrorCode;
|
import com.ff.base.enums.ErrorCode;
|
||||||
import com.ff.base.enums.GamePlatforms;
|
|
||||||
import com.ff.base.exception.base.ApiException;
|
import com.ff.base.exception.base.ApiException;
|
||||||
import com.ff.base.exception.base.BaseException;
|
import com.ff.base.exception.base.BaseException;
|
||||||
import com.ff.base.system.domain.TenantSecretKey;
|
|
||||||
import com.ff.base.utils.StringUtils;
|
import com.ff.base.utils.StringUtils;
|
||||||
|
import com.ff.base.system.domain.TenantSecretKey;
|
||||||
import com.ff.config.KeyConfig;
|
import com.ff.config.KeyConfig;
|
||||||
import com.ff.game.api.IGamesService;
|
import com.ff.game.api.IGamesService;
|
||||||
import com.ff.game.api.request.CreateMemberRequestDTO;
|
import com.ff.game.api.request.*;
|
||||||
import com.ff.game.api.request.MemberInfoRequestDTO;
|
import com.ff.game.domain.GameSecretKey;
|
||||||
import com.ff.game.api.request.MemberInfoResponseDTO;
|
import com.ff.game.dto.GameSecretKeyCurrencyDTO;
|
||||||
import com.ff.game.domain.KeyInfo;
|
import com.ff.game.service.IGameSecretKeyCurrencyService;
|
||||||
import com.ff.game.domain.Platform;
|
import com.ff.game.service.IGameSecretKeyService;
|
||||||
import com.ff.game.service.IPlatformService;
|
import com.ff.game.service.IGameService;
|
||||||
import com.ff.member.domain.Member;
|
import com.ff.member.domain.Member;
|
||||||
import com.ff.member.service.IMemberService;
|
import com.ff.member.service.IMemberService;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -34,12 +32,10 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -62,21 +58,31 @@ import java.util.concurrent.Future;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ApiMemberController extends BaseController {
|
public class ApiMemberController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private Map<String, IGamesService> gamesService;
|
private Map<String, IGamesService> gamesService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGameService gameService;
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private KeyConfig keyConfig;
|
private KeyConfig keyConfig;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGameSecretKeyService gameSecretKeyService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IMemberService memberService;
|
private IMemberService memberService;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@Qualifier("threadPoolTaskExecutor")
|
@Qualifier("threadPoolTaskExecutor")
|
||||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IPlatformService platformService;
|
private IGameSecretKeyCurrencyService gameSecretKeyCurrencyService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建成员
|
* 创建成员
|
||||||
|
|
@ -92,24 +98,13 @@ public class ApiMemberController extends BaseController {
|
||||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||||
|
|
||||||
TenantSecretKey tenantSecretKey = keyConfig.get();
|
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||||
|
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
|
.platformCode(memberCreateApiRequest.getPlatformCode())
|
||||||
|
.systemCurrency(memberCreateApiRequest.getCurrencyCode()).build());
|
||||||
|
|
||||||
Platform platform = platformService.get(memberCreateApiRequest.getPlatformCode());
|
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||||
ApiException.notNull(platform, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(memberCreateApiRequest.getCurrencyCode());
|
|
||||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
KeyInfo keyInfo = null;
|
String gameAccount = StringUtils.addSuffix(memberService.getMemberGameAccount(memberCreateApiRequest.getPlatformCode()), tenantSecretKey.getTenantSn());
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(memberCreateApiRequest.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(memberCreateApiRequest.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
String gameAccount =memberService.getMemberGameAccount(memberCreateApiRequest.getPlatformCode(), tenantSecretKey.getTenantSn());
|
|
||||||
|
|
||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
|
|
@ -119,6 +114,8 @@ public class ApiMemberController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//注册本地账号
|
//注册本地账号
|
||||||
Member member = Member.builder()
|
Member member = Member.builder()
|
||||||
.tenantKey(tenantSecretKey.getTenantKey())
|
.tenantKey(tenantSecretKey.getTenantKey())
|
||||||
|
|
@ -133,21 +130,12 @@ public class ApiMemberController extends BaseController {
|
||||||
//向第三方注册账号
|
//向第三方注册账号
|
||||||
CreateMemberRequestDTO gamesBaseRequestDTO = CreateMemberRequestDTO.builder()
|
CreateMemberRequestDTO gamesBaseRequestDTO = CreateMemberRequestDTO.builder()
|
||||||
.account(gameAccount)
|
.account(gameAccount)
|
||||||
.agentId(keyInfo.getCode())
|
.agentId(gameSecretKey.getCode())
|
||||||
.agentKey(keyInfo.getKey())
|
.agentKey(gameSecretKey.getKey())
|
||||||
.betLimit(memberCreateApiRequest.getBetLimit())
|
.currency(gameSecretKey.getCurrency())
|
||||||
.platformType(memberCreateApiRequest.getPlatformType())
|
|
||||||
.currency(targetCurrency)
|
|
||||||
.vendor(platform)
|
|
||||||
.keyInfo(keyInfo)
|
|
||||||
.systemCurrency(memberCreateApiRequest.getCurrencyCode())
|
|
||||||
.build();
|
.build();
|
||||||
Boolean result = iGamesService.createMember(gamesBaseRequestDTO);
|
Boolean result = iGamesService.createMember(gamesBaseRequestDTO);
|
||||||
Assert.isTrue(result, "建立游戏账号失败");
|
Assert.isTrue(result, "建立游戏账号失败");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return toAjax(Boolean.TRUE);
|
return toAjax(Boolean.TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -156,46 +144,35 @@ public class ApiMemberController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 获取会员信息
|
* 获取会员信息
|
||||||
*
|
*
|
||||||
* @param request 成员信息api请求
|
* @param memberInfoApiRequest 成员信息api请求
|
||||||
* @return {@link AjaxResult }
|
* @return {@link AjaxResult }
|
||||||
*/
|
*/
|
||||||
@PostMapping("/info")
|
@PostMapping("/info")
|
||||||
public AjaxResult getMemberInfo(@Validated @RequestBody MemberInfoApiRequest request) {
|
public AjaxResult getMemberInfo(@Validated @RequestBody MemberInfoApiRequest memberInfoApiRequest) {
|
||||||
IGamesService iGamesService = gamesService.get(request.getPlatformCode() + Constants.SERVICE);
|
IGamesService iGamesService = gamesService.get(memberInfoApiRequest.getPlatformCode() + Constants.SERVICE);
|
||||||
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
|
||||||
Platform platform = platformService.get(request.getPlatformCode());
|
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||||
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
|
.platformCode(memberInfoApiRequest.getPlatformCode())
|
||||||
|
.systemCurrency(memberInfoApiRequest.getCurrencyCode()).build());
|
||||||
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(request.getCurrencyCode());
|
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(request.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(request.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
Member member = memberService.selectMemberByAccount(request.getAccount(), request.getCurrencyCode(), request.getPlatformCode());
|
Member member = memberService.selectMemberByAccount(memberInfoApiRequest.getAccount(), memberInfoApiRequest.getCurrencyCode(), memberInfoApiRequest.getPlatformCode());
|
||||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//向第三方查询账号
|
//向第三方查询账号
|
||||||
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
|
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
|
||||||
.accounts(member.getGameAccount())
|
.accounts(member.getGameAccount())
|
||||||
.agentId(keyInfo.getCode())
|
.agentId(gameSecretKey.getCode())
|
||||||
.currency(targetCurrency)
|
.currency(gameSecretKey.getCurrency())
|
||||||
.agentKey(keyInfo.getKey())
|
.agentKey(gameSecretKey.getKey())
|
||||||
.vendor(platform)
|
|
||||||
.keyInfo(keyInfo)
|
|
||||||
.systemCurrency(request.getCurrencyCode())
|
|
||||||
.build();
|
.build();
|
||||||
MemberInfoResponseDTO memberInfo = iGamesService.getMemberInfo(gamesBaseRequestDTO);
|
MemberInfoResponseDTO memberInfo = iGamesService.getMemberInfo(gamesBaseRequestDTO);
|
||||||
MemberInfoResponse memberInfoResponse = new MemberInfoResponse();
|
MemberInfoResponse memberInfoResponse = new MemberInfoResponse();
|
||||||
|
|
@ -214,50 +191,22 @@ public class ApiMemberController extends BaseController {
|
||||||
public AjaxResult infoAll(@Validated @RequestBody MemberInfoAllApiRequest memberInfoAllApiRequest) {
|
public AjaxResult infoAll(@Validated @RequestBody MemberInfoAllApiRequest memberInfoAllApiRequest) {
|
||||||
|
|
||||||
|
|
||||||
// List<GameSecretKeyCurrencyDTO> gameSecretKeys = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(
|
|
||||||
// GameSecretKeyCurrencyDTO.builder()
|
|
||||||
// .systemCurrency(memberInfoAllApiRequest.getCurrencyCode()).build());
|
|
||||||
List<Key> keys = new ArrayList<>();
|
|
||||||
for (GamePlatforms platformEnum : GamePlatforms.values()) {
|
|
||||||
|
|
||||||
Platform platform = platformService.get(platformEnum.getCode());
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(memberInfoAllApiRequest.getCurrencyCode());
|
|
||||||
if (StringUtils.isEmpty(targetCurrency)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(memberInfoAllApiRequest.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(memberInfoAllApiRequest.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (null == keyInfo) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Key key = new Key();
|
|
||||||
key.setPlatformCode(platform.getPlatformCode());
|
List<GameSecretKeyCurrencyDTO> gameSecretKeys = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder()
|
||||||
key.setCode(keyInfo.getCode());
|
.systemCurrency(memberInfoAllApiRequest.getCurrencyCode()).build());
|
||||||
key.setKey(keyInfo.getKey());
|
|
||||||
key.setCurrency(targetCurrency);
|
|
||||||
key.setSystemCurrency(memberInfoAllApiRequest.getCurrencyCode());
|
|
||||||
keys.add(key);
|
|
||||||
}
|
|
||||||
// 创建线程池
|
// 创建线程池
|
||||||
Map<String, BigDecimal> balanceMap = new LinkedHashMap<>();
|
Map<String, BigDecimal> balanceMap = new LinkedHashMap<>();
|
||||||
CountDownLatch latch = new CountDownLatch(keys.size());
|
CountDownLatch latch = new CountDownLatch(gameSecretKeys.size());
|
||||||
|
|
||||||
// 使用List存储Future对象,用于获取异步执行的结果
|
// 使用List存储Future对象,用于获取异步执行的结果
|
||||||
List<Future<MemberInfoAllResponse>> futures = new ArrayList<>();
|
List<Future<MemberInfoAllResponse>> futures = new ArrayList<>();
|
||||||
|
|
||||||
// 提交异步任务到线程池
|
// 提交异步任务到线程池
|
||||||
for (Key gameSecretKey : keys) {
|
for (GameSecretKeyCurrencyDTO gameSecretKey : gameSecretKeys) {
|
||||||
|
|
||||||
futures.add(threadPoolTaskExecutor.submit(() -> {
|
futures.add(threadPoolTaskExecutor.submit(() -> {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IGamesService iGamesService = gamesService.get(gameSecretKey.getPlatformCode() + Constants.SERVICE);
|
IGamesService iGamesService = gamesService.get(gameSecretKey.getPlatformCode() + Constants.SERVICE);
|
||||||
|
|
||||||
|
|
@ -270,7 +219,6 @@ public class ApiMemberController extends BaseController {
|
||||||
.accounts(member.getGameAccount())
|
.accounts(member.getGameAccount())
|
||||||
.agentId(gameSecretKey.getCode())
|
.agentId(gameSecretKey.getCode())
|
||||||
.currency(gameSecretKey.getCurrency())
|
.currency(gameSecretKey.getCurrency())
|
||||||
.systemCurrency(gameSecretKey.getSystemCurrency())
|
|
||||||
.agentKey(gameSecretKey.getKey())
|
.agentKey(gameSecretKey.getKey())
|
||||||
.build();
|
.build();
|
||||||
//查询余额
|
//查询余额
|
||||||
|
|
@ -306,13 +254,5 @@ public class ApiMemberController extends BaseController {
|
||||||
return AjaxResult.success(balanceMap);
|
return AjaxResult.success(balanceMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
class Key {
|
|
||||||
private String platformCode;
|
|
||||||
private String code;
|
|
||||||
private String currency;
|
|
||||||
private String key;
|
|
||||||
private String systemCurrency;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
package com.ff.api.request;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏登录请求
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/02/11
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class GameDemoLoginRequest implements Serializable {
|
|
||||||
private final static long serialVersionUID = 7699430372422335056L;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 语种id
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "langCode不能为空")
|
|
||||||
@Length(max = 32, message = "langCode长度不能超过32个字符")
|
|
||||||
private String langCode;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏id
|
|
||||||
*/
|
|
||||||
@NotNull(message = "gameId不能为空")
|
|
||||||
private Long gameId;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏回主页功能导向位置
|
|
||||||
*/
|
|
||||||
private String homeUrl;
|
|
||||||
/**
|
|
||||||
* 带入 web 或是 app
|
|
||||||
*/
|
|
||||||
private String platform;
|
|
||||||
/**
|
|
||||||
* 带入 1 即关闭全屏幕模式
|
|
||||||
*/
|
|
||||||
private Integer disableFullScreen;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 币种
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "currencyCode不能为空")
|
|
||||||
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
|
|
||||||
private String currencyCode;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -6,7 +6,6 @@ import org.hibernate.validator.constraints.Length;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 游戏登录请求
|
* 游戏登录请求
|
||||||
|
|
@ -44,8 +43,8 @@ public class GameLoginRequest implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 游戏id
|
* 游戏id
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "gameId不能为空")
|
@NotNull(message = "gameId不能为空")
|
||||||
private String gameId;
|
private Long gameId;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -60,9 +59,4 @@ public class GameLoginRequest implements Serializable {
|
||||||
* 带入 1 即关闭全屏幕模式
|
* 带入 1 即关闭全屏幕模式
|
||||||
*/
|
*/
|
||||||
private Integer disableFullScreen;
|
private Integer disableFullScreen;
|
||||||
|
|
||||||
/**
|
|
||||||
* ae 平台 投注限额
|
|
||||||
*/
|
|
||||||
private Map<String, Map<String, Map<String, Object>>> betLimit;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Pattern;
|
import javax.validation.constraints.Pattern;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建成员请求
|
* 创建成员请求
|
||||||
|
|
@ -35,13 +34,4 @@ public class MemberCreateApiRequest implements Serializable{
|
||||||
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
|
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
|
||||||
private String currencyCode;
|
private String currencyCode;
|
||||||
|
|
||||||
/**
|
|
||||||
* 投注限额
|
|
||||||
*/
|
|
||||||
private Map<String, Map<String, Map<String, Object>>> betLimit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 平台类型 0 桌面 1 移动
|
|
||||||
*/
|
|
||||||
private Integer platformType;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ public class GameBettingDetailsResponse implements Serializable
|
||||||
|
|
||||||
|
|
||||||
/** 游戏id */
|
/** 游戏id */
|
||||||
private String gameId;
|
private Long gameId;
|
||||||
|
|
||||||
/** 游戏类型 ff_game_type 字典 */
|
/** 游戏类型 ff_game_type 字典 */
|
||||||
private Integer gameType;
|
private Integer gameType;
|
||||||
|
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
package com.ff.api.response;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏演示登录响应
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/03
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class GameDemoLoginResponse implements Serializable {
|
|
||||||
private final static long serialVersionUID = 7699430372422335056L;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 网址
|
|
||||||
*/
|
|
||||||
private String url;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.ff.api.response;
|
package com.ff.api.response;
|
||||||
|
|
||||||
import com.ff.game.domain.NameInfo;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -28,7 +27,7 @@ public class GameResponse implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 游戏id
|
* 游戏id
|
||||||
*/
|
*/
|
||||||
private String id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 游戏名称
|
* 游戏名称
|
||||||
|
|
@ -61,8 +60,5 @@ public class GameResponse implements Serializable {
|
||||||
* 支持货币代码
|
* 支持货币代码
|
||||||
*/
|
*/
|
||||||
private List<String> currencyCode;
|
private List<String> currencyCode;
|
||||||
/**
|
|
||||||
* 名称
|
|
||||||
*/
|
|
||||||
private List<NameInfo> nameInfo;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.ff.common.dto;
|
package com.ff.common.dto;
|
||||||
|
|
||||||
import com.ff.game.api.request.GamesBaseRequestDTO;
|
|
||||||
import io.swagger.models.auth.In;
|
import io.swagger.models.auth.In;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
|
|
@ -22,7 +21,7 @@ import java.math.BigDecimal;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
public class GameBalanceExchange extends GamesBaseRequestDTO implements Serializable {
|
public class GameBalanceExchange implements Serializable {
|
||||||
private final static long serialVersionUID = 3452954102791311247L;
|
private final static long serialVersionUID = 3452954102791311247L;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -47,12 +46,6 @@ public class GameBalanceExchange extends GamesBaseRequestDTO implements Serializ
|
||||||
*/
|
*/
|
||||||
private BigDecimal amount;
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private BigDecimal amountActual;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账户
|
* 账户
|
||||||
*/
|
*/
|
||||||
|
|
@ -67,9 +60,4 @@ public class GameBalanceExchange extends GamesBaseRequestDTO implements Serializ
|
||||||
*/
|
*/
|
||||||
private String sourceId;
|
private String sourceId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 就是全部
|
|
||||||
*/
|
|
||||||
private Boolean isAll;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,13 @@ import com.ff.common.service.ITenantQuotaExchangeService;
|
||||||
import com.ff.base.system.service.ITenantSecretKeyService;
|
import com.ff.base.system.service.ITenantSecretKeyService;
|
||||||
import com.ff.game.api.IGamesService;
|
import com.ff.game.api.IGamesService;
|
||||||
import com.ff.game.api.request.MemberInfoRequestDTO;
|
import com.ff.game.api.request.MemberInfoRequestDTO;
|
||||||
|
import com.ff.game.domain.GameSecretKey;
|
||||||
|
import com.ff.game.dto.GameSecretKeyCurrencyDTO;
|
||||||
|
import com.ff.game.service.IGameSecretKeyCurrencyService;
|
||||||
|
import com.ff.game.service.IGameSecretKeyService;
|
||||||
import com.ff.member.domain.Member;
|
import com.ff.member.domain.Member;
|
||||||
import com.ff.member.service.IMemberService;
|
import com.ff.member.service.IMemberService;
|
||||||
|
import nonapi.io.github.classgraph.json.Id;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ff.common.mapper.TenantGameQuotaMapper;
|
import com.ff.common.mapper.TenantGameQuotaMapper;
|
||||||
|
|
@ -56,18 +61,30 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
|
||||||
@Resource
|
@Resource
|
||||||
private ITenantSecretKeyService tenantSecretKeyService;
|
private ITenantSecretKeyService tenantSecretKeyService;
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IMemberService memberService;
|
private IMemberService memberService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGameSecretKeyService gameSecretKeyService;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private Map<String, IGamesService> gamesService;
|
private Map<String, IGamesService> gamesService;
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ITenantQuotaExchangeService tenantQuotaExchangeService;
|
private ITenantQuotaExchangeService tenantQuotaExchangeService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ITenantPlatformService tenantPlatformService;
|
private ITenantPlatformService tenantPlatformService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGameSecretKeyCurrencyService gameSecretKeyCurrencyService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询租户游戏配额
|
* 查询租户游戏配额
|
||||||
*
|
*
|
||||||
|
|
@ -152,7 +169,7 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
|
||||||
BigDecimal balance = balanceChangesDTO.getBalance();
|
BigDecimal balance = balanceChangesDTO.getBalance();
|
||||||
//如果有汇率 则需要计算真实扣除额度
|
//如果有汇率 则需要计算真实扣除额度
|
||||||
if (!ObjectUtils.isEmpty(balanceChangesDTO.getActualBalance())) {
|
if (!ObjectUtils.isEmpty(balanceChangesDTO.getActualBalance())) {
|
||||||
balance = NumberUtil.div(balance, balanceChangesDTO.getActualBalance(), 5, RoundingMode.FLOOR);
|
balance = NumberUtil.div(balance, balanceChangesDTO.getActualBalance(), 2, RoundingMode.FLOOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BigDecimal.ZERO.compareTo(balance) >= 0) {
|
if (BigDecimal.ZERO.compareTo(balance) >= 0) {
|
||||||
|
|
@ -222,7 +239,7 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
|
||||||
BigDecimal balance = balanceRealChangesDTO.getBalance();
|
BigDecimal balance = balanceRealChangesDTO.getBalance();
|
||||||
//如果有汇率 则需要计算真实扣除额度
|
//如果有汇率 则需要计算真实扣除额度
|
||||||
if (!ObjectUtils.isEmpty(balanceRealChangesDTO.getActualBalance())) {
|
if (!ObjectUtils.isEmpty(balanceRealChangesDTO.getActualBalance())) {
|
||||||
balance = NumberUtil.div(balance, balanceRealChangesDTO.getActualBalance(), 5, RoundingMode.FLOOR);
|
balance = NumberUtil.div(balance, balanceRealChangesDTO.getActualBalance(), 2, RoundingMode.FLOOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BigDecimal.ZERO.compareTo(balance) >= 0) {
|
if (BigDecimal.ZERO.compareTo(balance) >= 0) {
|
||||||
|
|
@ -271,6 +288,13 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal gameBalanceExchange(GameBalanceExchange gameBalanceExchange) {
|
public BigDecimal gameBalanceExchange(GameBalanceExchange gameBalanceExchange) {
|
||||||
|
// 获取平台接口密钥
|
||||||
|
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
|
.platformCode(gameBalanceExchange.getPlatformCode())
|
||||||
|
.systemCurrency(gameBalanceExchange.getCurrencyCode()).build());
|
||||||
|
|
||||||
|
// 检查平台密钥是否存在,否则抛出异常
|
||||||
|
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||||
|
|
||||||
TenantQuotaExchange tenantQuotaExchange = tenantQuotaExchangeService.getTenantQuotaExchange(Constants.USDT, gameBalanceExchange.getCurrencyCode());
|
TenantQuotaExchange tenantQuotaExchange = tenantQuotaExchangeService.getTenantQuotaExchange(Constants.USDT, gameBalanceExchange.getCurrencyCode());
|
||||||
ApiException.notNull(tenantQuotaExchange, ErrorCode.CURRENCY_EXCHANGE.getCode());
|
ApiException.notNull(tenantQuotaExchange, ErrorCode.CURRENCY_EXCHANGE.getCode());
|
||||||
|
|
@ -289,11 +313,14 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
|
||||||
ApiException.notNull(tenantPlatform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
ApiException.notNull(tenantPlatform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
Member member = memberService.selectMemberByAccount(gameBalanceExchange.getAccount(), gameBalanceExchange.getCurrencyCode(), gameBalanceExchange.getPlatformCode());
|
Member member = memberService.selectMemberByAccount(gameBalanceExchange.getAccount(), gameBalanceExchange.getCurrencyCode(), gameBalanceExchange.getPlatformCode());
|
||||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 检查用户是否存在,否则抛出异常
|
// 检查用户是否存在,否则抛出异常
|
||||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
|
@ -314,21 +341,14 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
|
||||||
|
|
||||||
// 如果是出账操作
|
// 如果是出账操作
|
||||||
if (isOut) {
|
if (isOut) {
|
||||||
if (ObjectUtils.isEmpty(gameBalanceExchange.getIsAll())||gameBalanceExchange.getIsAll()){
|
|
||||||
// 获取第三方钱包余额
|
// 获取第三方钱包余额
|
||||||
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
|
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
|
||||||
.accounts(member.getGameAccount())
|
.accounts(member.getGameAccount())
|
||||||
.agentId(gameBalanceExchange.getAgentId())
|
.agentId(gameSecretKey.getCode())
|
||||||
.currency(gameBalanceExchange.getCurrency())
|
.currency(gameSecretKey.getCurrency())
|
||||||
.agentKey(gameBalanceExchange.getAgentKey())
|
.agentKey(gameSecretKey.getKey())
|
||||||
.build();
|
.build();
|
||||||
balanceRequestAmount = iGamesService.getMemberInfo(gamesBaseRequestDTO).getBalance();
|
balanceRequestAmount = iGamesService.getMemberInfo(gamesBaseRequestDTO).getBalance();
|
||||||
if (balanceRequestAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
|
||||||
throw new ApiException(ErrorCode.INSUFFICIENT_PLAYER_BALANCE.getCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
balanceRequestAmount = NumberUtil.add(balanceRequestAmount, NumberUtil.mul(balanceRequestAmount, NumberUtil.div(tenantPlatform.getUseCost(), Constants.HUNDRED)));
|
balanceRequestAmount = NumberUtil.add(balanceRequestAmount, NumberUtil.mul(balanceRequestAmount, NumberUtil.div(tenantPlatform.getUseCost(), Constants.HUNDRED)));
|
||||||
|
|
||||||
// 计算累计转入和转出金额
|
// 计算累计转入和转出金额
|
||||||
|
|
@ -394,6 +414,8 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
|
||||||
if (falseTenantQuota.getBalance().compareTo(BigDecimal.ZERO) > 0) {
|
if (falseTenantQuota.getBalance().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BigDecimal falseQuotaBalance = falseTenantQuota.getBalance();
|
BigDecimal falseQuotaBalance = falseTenantQuota.getBalance();
|
||||||
if (falseQuotaBalance.compareTo(balanceRequestAmount) >= 0) {
|
if (falseQuotaBalance.compareTo(balanceRequestAmount) >= 0) {
|
||||||
// 假额度足够扣除本次所需金额
|
// 假额度足够扣除本次所需金额
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import com.ff.base.system.domain.SysDatasource;
|
||||||
import com.ff.base.system.mapper.SysDatasourceMapper;
|
import com.ff.base.system.mapper.SysDatasourceMapper;
|
||||||
import com.ff.base.system.service.ISysConfigService;
|
import com.ff.base.system.service.ISysConfigService;
|
||||||
import com.ff.base.system.service.ISysDictTypeService;
|
import com.ff.base.system.service.ISysDictTypeService;
|
||||||
import com.ff.game.service.IPlatformService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
|
|
@ -35,9 +34,6 @@ public class ContentRefreshedEventListener implements ApplicationListener<Contex
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ISysDictTypeService sysDictTypeService;
|
private ISysDictTypeService sysDictTypeService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IPlatformService platformService;
|
|
||||||
/**
|
/**
|
||||||
* 项目加载时运行
|
* 项目加载时运行
|
||||||
*
|
*
|
||||||
|
|
@ -54,7 +50,5 @@ public class ContentRefreshedEventListener implements ApplicationListener<Contex
|
||||||
}
|
}
|
||||||
sysConfigService.loadingConfigCache();
|
sysConfigService.loadingConfigCache();
|
||||||
sysDictTypeService.loadingDictCache();
|
sysDictTypeService.loadingDictCache();
|
||||||
|
|
||||||
platformService.loadToCache();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
package com.ff.delay;
|
|
||||||
|
|
||||||
import com.ff.base.manager.AsyncManager;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import java.util.concurrent.DelayQueue;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class DelayService {
|
|
||||||
private DelayQueue<DelayTask> delayQueue = new DelayQueue<>();
|
|
||||||
|
|
||||||
private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
|
||||||
|
|
||||||
public void addTask(DelayTask delayTask) {
|
|
||||||
delayQueue.put(delayTask);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 启动延迟队列任务处理
|
|
||||||
@PostConstruct
|
|
||||||
public void startProcessing() {
|
|
||||||
// 每 1 秒钟执行一次任务检查
|
|
||||||
scheduler.scheduleAtFixedRate(this::processTasks, 10, 1, TimeUnit.SECONDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理过期任务
|
|
||||||
private void processTasks() {
|
|
||||||
DelayTask task = null; // 阻塞,直到队列中有任务到期
|
|
||||||
try {
|
|
||||||
task = delayQueue.take();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
log.error("获取过期任务失败", e);
|
|
||||||
}
|
|
||||||
if (null == task) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
AsyncManager.me().execute(new DelayRunnable(task));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DelayRunnable implements Runnable {
|
|
||||||
|
|
||||||
DelayTask delayTask;
|
|
||||||
|
|
||||||
public DelayRunnable(DelayTask delayTask) {
|
|
||||||
this.delayTask = delayTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
delayTask.execute();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("处理过期任务出错", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
package com.ff.delay;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.concurrent.Delayed;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public abstract class DelayTask implements Delayed {
|
|
||||||
private long delayTime;
|
|
||||||
private long expireTime;
|
|
||||||
|
|
||||||
public DelayTask(long delayTime) {
|
|
||||||
this.delayTime = delayTime;
|
|
||||||
this.expireTime = System.currentTimeMillis() + delayTime; // 设置过期时间
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getDelay(TimeUnit unit) {
|
|
||||||
long diff = expireTime - System.currentTimeMillis();
|
|
||||||
return unit.convert(diff, TimeUnit.MILLISECONDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(Delayed o) {
|
|
||||||
if (this.expireTime < ((DelayTask) o).expireTime) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (this.expireTime > ((DelayTask) o).expireTime) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract public void execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -52,14 +52,6 @@ public interface IGamesService {
|
||||||
*/
|
*/
|
||||||
String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO);
|
String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取交易id
|
|
||||||
*
|
|
||||||
* @param transactionIdRequestDTO 事务id请求dto
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按代理id进行交换转账
|
* 按代理id进行交换转账
|
||||||
|
|
@ -74,9 +66,9 @@ public interface IGamesService {
|
||||||
* 汇兑转移状态确认
|
* 汇兑转移状态确认
|
||||||
*
|
*
|
||||||
* @param exchangeTransferMoneyRequestDTO 兑换转账请求dto
|
* @param exchangeTransferMoneyRequestDTO 兑换转账请求dto
|
||||||
* @return {@link ExchangeTransferStatusResponseDTO }
|
* @return {@link Boolean }
|
||||||
*/
|
*/
|
||||||
ExchangeTransferStatusResponseDTO exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO);
|
Boolean exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -104,8 +96,6 @@ public interface IGamesService {
|
||||||
*/
|
*/
|
||||||
Boolean createFreeSpin(CreateFreeSpinRequestDTO createFreeSpinRequest);
|
Boolean createFreeSpin(CreateFreeSpinRequestDTO createFreeSpinRequest);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取游戏详细信息
|
* 获取游戏详细信息
|
||||||
*
|
*
|
||||||
|
|
@ -146,13 +136,6 @@ public interface IGamesService {
|
||||||
*/
|
*/
|
||||||
Boolean cancelFreeSpin(CancelFreeSpinRequestDTO cancelFreeSpinRequestDTO);
|
Boolean cancelFreeSpin(CancelFreeSpinRequestDTO cancelFreeSpinRequestDTO);
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏演示登录
|
|
||||||
*
|
|
||||||
* @param gameDemoLoginRequestDTO 游戏演示登录请求dto
|
|
||||||
* @return {@link GameDemoLoginResponseDTO }
|
|
||||||
*/
|
|
||||||
GameDemoLoginResponseDTO gameDemoLogin(GameDemoLoginRequestDTO gameDemoLoginRequestDTO);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
package com.ff.game.api.ae.address;
|
|
||||||
|
|
||||||
import com.dtflys.forest.callback.AddressSource;
|
|
||||||
import com.dtflys.forest.http.ForestAddress;
|
|
||||||
import com.dtflys.forest.http.ForestRequest;
|
|
||||||
import com.ff.base.enums.GamePlatforms;
|
|
||||||
import com.ff.game.service.IPlatformService;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 我jili address来源
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/02/10
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class MyAEAddressSource implements AddressSource {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IPlatformService platformService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ForestAddress getAddress(ForestRequest request) {
|
|
||||||
String apiBaseUrl = platformService.get(GamePlatforms.AE.getCode())
|
|
||||||
.getUrlInfo().getUrl();
|
|
||||||
return new ForestAddress("https", apiBaseUrl, 443, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,132 +0,0 @@
|
||||||
package com.ff.game.api.ae.client;
|
|
||||||
|
|
||||||
import com.dtflys.forest.annotation.*;
|
|
||||||
import com.ff.game.api.ae.address.MyAEAddressSource;
|
|
||||||
import com.ff.game.api.ae.dto.*;
|
|
||||||
import com.ff.game.api.jili.dto.*;
|
|
||||||
import com.ff.game.api.xk.dto.XKKickMemberAllDTO;
|
|
||||||
import com.ff.game.api.xk.dto.XKKickMemberDTO;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xk 请求
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/02/10
|
|
||||||
*/
|
|
||||||
@Address(source = MyAEAddressSource.class)
|
|
||||||
public interface AEClient {
|
|
||||||
/**
|
|
||||||
* 创建成员
|
|
||||||
*
|
|
||||||
* @param params 参数
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
@Post(url ="/wallet/createMember",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
})
|
|
||||||
AEResponse createMember(@Body Map<String, Object> params);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取会员信息
|
|
||||||
*
|
|
||||||
* @param params 参数
|
|
||||||
* @return {@link AEMemberInfo }
|
|
||||||
*/
|
|
||||||
@Post(url ="/wallet/getBalance",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
})
|
|
||||||
AEMemberInfo getMemberInfo(@Body Map<String, Object> params);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无重定向登录
|
|
||||||
*
|
|
||||||
* @param params 参数
|
|
||||||
* @return {@link AELoginResponse }
|
|
||||||
*/
|
|
||||||
@Post("/wallet/login")
|
|
||||||
AELoginResponse loginWithoutRedirect(@Body Map<String, Object> params);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按代理id进行交换转账
|
|
||||||
*
|
|
||||||
* @param params 参数
|
|
||||||
* @return {@link JILIExchangeMoneyResponseDTO }
|
|
||||||
*/
|
|
||||||
@Post(url ="/wallet/deposit",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
})
|
|
||||||
AETransactionResponse deposit(@Body Map<String, Object> params);
|
|
||||||
|
|
||||||
|
|
||||||
@Post(url ="/wallet/withdraw",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
})
|
|
||||||
AETransactionResponse withdraw(@Body Map<String, Object> params);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 汇兑转移状态
|
|
||||||
*
|
|
||||||
* @param params 参数
|
|
||||||
* @return {@link AEExchangeTransferStatusResponse }
|
|
||||||
*/
|
|
||||||
@Post(url ="/wallet/checkTransferOperation",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
})
|
|
||||||
AEExchangeTransferStatusResponse exchangeTransferStatus(@Body Map<String, Object> params);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按时间获取投注记录
|
|
||||||
*
|
|
||||||
* @param params 参数
|
|
||||||
* @return {@link AEBetRecordResponse }
|
|
||||||
*/
|
|
||||||
@Post(url ="https://tttfetch.apihub55.com/fetch/gzip/getTransactionByUpdateDate",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
})
|
|
||||||
AEBetRecordResponse getBetRecordByTime(@Body Map<String, Object> params);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按时间获取投注历史记录
|
|
||||||
*
|
|
||||||
* @param params 参数
|
|
||||||
* @return {@link AEBetRecordResponse }
|
|
||||||
*/
|
|
||||||
@Post(url ="https://tttfetch.apihub55.com/fetch/gzip/getTransactionByTxTime",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
})
|
|
||||||
AEBetRecordResponse getBetHistoryRecordByTime(@Body Map<String, Object> params);
|
|
||||||
/**
|
|
||||||
* 踢出队员
|
|
||||||
*
|
|
||||||
* @param params 参数
|
|
||||||
* @return {@link JILIKickMemberDTO }
|
|
||||||
*/
|
|
||||||
@Post(url ="/wallet/logout",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
})
|
|
||||||
XKKickMemberDTO kickMember(@Body Map<String, Object> params);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 踢出所有队员
|
|
||||||
*
|
|
||||||
* @param params 参数
|
|
||||||
* @return {@link JILIKickMemberAllDTO }
|
|
||||||
*/
|
|
||||||
@Get("/kickMemberAll")
|
|
||||||
XKKickMemberAllDTO kickMemberAll(@JSONBody Map<String, Object> params);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,186 +0,0 @@
|
||||||
package com.ff.game.api.ae.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* aebet记录响应
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/01
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class AEBetRecordResponse {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态代码
|
|
||||||
*/
|
|
||||||
@JsonProperty("status")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 描述信息 (String类型)
|
|
||||||
* "Success" - 请求成功
|
|
||||||
* 其他 - 错误信息
|
|
||||||
*/
|
|
||||||
private String desc;
|
|
||||||
/**
|
|
||||||
* 交易记录
|
|
||||||
*/
|
|
||||||
@JsonProperty("transactions")
|
|
||||||
private List<Transaction> transactions;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class Transaction {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏类型
|
|
||||||
*/
|
|
||||||
@JsonProperty("gameType")
|
|
||||||
private String gameType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返还金额(包含下注金额)
|
|
||||||
*/
|
|
||||||
@JsonProperty("winAmount")
|
|
||||||
private BigDecimal winAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交易时间
|
|
||||||
*/
|
|
||||||
@JsonProperty("txTime")
|
|
||||||
private Date txTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 结算状态
|
|
||||||
*/
|
|
||||||
@JsonProperty("settleStatus")
|
|
||||||
private Integer settleStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏信息
|
|
||||||
*/
|
|
||||||
@JsonProperty("gameInfo")
|
|
||||||
private String gameInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 真实返还金额
|
|
||||||
*/
|
|
||||||
@JsonProperty("realWinAmount")
|
|
||||||
private BigDecimal realWinAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@JsonProperty("updateTime")
|
|
||||||
private String updateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 真实下注金额
|
|
||||||
*/
|
|
||||||
@JsonProperty("realBetAmount")
|
|
||||||
private BigDecimal realBetAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户ID
|
|
||||||
*/
|
|
||||||
@JsonProperty("userId")
|
|
||||||
private String userId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下注类型
|
|
||||||
*/
|
|
||||||
@JsonProperty("betType")
|
|
||||||
private String betType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 平台名称
|
|
||||||
*/
|
|
||||||
@JsonProperty("platform")
|
|
||||||
private String platform;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交易状态
|
|
||||||
*/
|
|
||||||
@JsonProperty("txStatus")
|
|
||||||
private Integer txStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下注金额
|
|
||||||
*/
|
|
||||||
@JsonProperty("betAmount")
|
|
||||||
private BigDecimal betAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏名称
|
|
||||||
*/
|
|
||||||
@JsonProperty("gameName")
|
|
||||||
private String gameName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 平台注单号
|
|
||||||
*/
|
|
||||||
@JsonProperty("platformTxId")
|
|
||||||
private String platformTxId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下注时间
|
|
||||||
*/
|
|
||||||
@JsonProperty("betTime")
|
|
||||||
private Date betTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 平台游戏代码
|
|
||||||
*/
|
|
||||||
@JsonProperty("gameCode")
|
|
||||||
private String gameCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 玩家货币代码
|
|
||||||
*/
|
|
||||||
@JsonProperty("currency")
|
|
||||||
private String currency;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 累积奖金的获胜金额
|
|
||||||
*/
|
|
||||||
@JsonProperty("jackpotWinAmount")
|
|
||||||
private BigDecimal jackpotWinAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 累积奖金贡献金额
|
|
||||||
*/
|
|
||||||
@JsonProperty("jackpotBetAmount")
|
|
||||||
private BigDecimal jackpotBetAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 平台有效投注
|
|
||||||
*/
|
|
||||||
@JsonProperty("turnover")
|
|
||||||
private BigDecimal turnover;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏商的回合识别码
|
|
||||||
*/
|
|
||||||
@JsonProperty("roundId")
|
|
||||||
private String roundId;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 子注单号
|
|
||||||
*/
|
|
||||||
@JsonProperty("refPlatformTxId")
|
|
||||||
private String refPlatformTxId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否为特殊收费游戏
|
|
||||||
*/
|
|
||||||
@JsonProperty("isPremium")
|
|
||||||
private Boolean isPremium;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
package com.ff.game.api.ae.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* aeexchange传输状态响应
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/01
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class AEExchangeTransferStatusResponse {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 响应状态
|
|
||||||
*/
|
|
||||||
@JsonProperty("status")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 情境 1:响应 status = 0000 & txStatus = 1 表示存款/提款成功
|
|
||||||
* 情境 2:响应 status = 0000 & txStatus = 0 表示存款/提款失败
|
|
||||||
* 情境 3:响应 status = 0000 & txStatus = 2 表示存款/提款处理中,可 3 秒后调用 checkTransferOperation API 确认回覆直到 txStatus = 0 或 1 的回覆
|
|
||||||
* 情境 4:响应 status = 1017 表示交易不存在
|
|
||||||
*/
|
|
||||||
@JsonProperty("txStatus")
|
|
||||||
private String txStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当前余额
|
|
||||||
*/
|
|
||||||
@JsonProperty("balance")
|
|
||||||
private BigDecimal balance;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账金额
|
|
||||||
*/
|
|
||||||
@JsonProperty("transferAmount")
|
|
||||||
private BigDecimal transferAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账类型(如:DEPOSIT 或 WITHDRAW)
|
|
||||||
*/
|
|
||||||
@JsonProperty("transferType")
|
|
||||||
private String transferType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交易代码
|
|
||||||
*/
|
|
||||||
@JsonProperty("txCode")
|
|
||||||
private String txCode;
|
|
||||||
}
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
package com.ff.game.api.ae.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* aelogin回应
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/01
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class AELoginResponse {
|
|
||||||
/**
|
|
||||||
* 响应状态
|
|
||||||
*/
|
|
||||||
@JsonProperty("status")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 描述信息 (String类型)
|
|
||||||
* "Success" - 请求成功
|
|
||||||
* 其他 - 错误信息
|
|
||||||
*/
|
|
||||||
private String desc;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 登录 URL
|
|
||||||
*/
|
|
||||||
@JsonProperty("url")
|
|
||||||
private String url;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 扩展字段,类型为列表,可以存储多项数据
|
|
||||||
*/
|
|
||||||
@JsonProperty("extension")
|
|
||||||
private List<String> extension;
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
package com.ff.game.api.ae.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 注销用户响应
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/01
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class AELogoutUserResponse {
|
|
||||||
/**
|
|
||||||
* 状态代码
|
|
||||||
*/
|
|
||||||
@JsonProperty("status")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 已注销的用户列表
|
|
||||||
*/
|
|
||||||
@JsonProperty("logoutUsers")
|
|
||||||
private List<String> logoutUsers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户数量
|
|
||||||
*/
|
|
||||||
@JsonProperty("count")
|
|
||||||
private Integer count;
|
|
||||||
}
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
package com.ff.game.api.ae.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AEMEMBER信息
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/03/31
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class AEMemberInfo {
|
|
||||||
/**
|
|
||||||
* 响应结果列表,包含用户信息
|
|
||||||
*/
|
|
||||||
@JsonProperty("results")
|
|
||||||
private List<UserInfo> result;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 记录数量
|
|
||||||
*/
|
|
||||||
@JsonProperty("count")
|
|
||||||
private int count;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询时间
|
|
||||||
*/
|
|
||||||
@JsonProperty("querytime")
|
|
||||||
private Date queryTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 响应状态
|
|
||||||
*/
|
|
||||||
@JsonProperty("status")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class UserInfo {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户ID
|
|
||||||
*/
|
|
||||||
@JsonProperty("userId")
|
|
||||||
private String userId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户余额
|
|
||||||
*/
|
|
||||||
@JsonProperty("balance")
|
|
||||||
private BigDecimal balance;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最后修改时间
|
|
||||||
*/
|
|
||||||
@JsonProperty("lastModified")
|
|
||||||
private Date lastModified;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
package com.ff.game.api.ae.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 航空响应
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/03/28
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class AEResponse {
|
|
||||||
/**
|
|
||||||
* 状态码 (String类型)
|
|
||||||
* 0000 - 成功
|
|
||||||
* 其他 - 错误状态码
|
|
||||||
*/
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 描述信息 (String类型)
|
|
||||||
* "Success" - 请求成功
|
|
||||||
* 其他 - 错误信息
|
|
||||||
*/
|
|
||||||
private String desc;
|
|
||||||
}
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
package com.ff.game.api.ae.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 电子交易响应
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/01
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class AETransactionResponse {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 响应状态
|
|
||||||
*/
|
|
||||||
@JsonProperty("status")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 金额
|
|
||||||
*/
|
|
||||||
@JsonProperty("amount")
|
|
||||||
private BigDecimal amount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交易方法(如:DEPOSIT, WITHDRAW)
|
|
||||||
*/
|
|
||||||
@JsonProperty("method")
|
|
||||||
private String method;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据库ID
|
|
||||||
*/
|
|
||||||
@JsonProperty("databaseId")
|
|
||||||
private int databaseId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当前余额
|
|
||||||
*/
|
|
||||||
@JsonProperty("currentBalance")
|
|
||||||
private BigDecimal currentBalance;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最后修改时间
|
|
||||||
*/
|
|
||||||
@JsonProperty("lastModified")
|
|
||||||
private ZonedDateTime lastModified;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交易代码
|
|
||||||
*/
|
|
||||||
@JsonProperty("txCode")
|
|
||||||
private String txCode;
|
|
||||||
}
|
|
||||||
|
|
@ -1,646 +0,0 @@
|
||||||
package com.ff.game.api.ae.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.core.util.NumberUtil;
|
|
||||||
import com.ff.base.constant.CacheConstants;
|
|
||||||
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.DateUtils;
|
|
||||||
import com.ff.base.utils.JsonUtil;
|
|
||||||
import com.ff.base.utils.StringUtils;
|
|
||||||
import com.ff.base.utils.uuid.IdUtils;
|
|
||||||
import com.ff.common.dto.GameBalanceExchange;
|
|
||||||
import com.ff.common.service.ITenantGameQuotaService;
|
|
||||||
import com.ff.config.KeyConfig;
|
|
||||||
import com.ff.delay.DelayService;
|
|
||||||
import com.ff.delay.DelayTask;
|
|
||||||
import com.ff.game.api.IGamesService;
|
|
||||||
import com.ff.game.api.ae.client.AEClient;
|
|
||||||
import com.ff.game.api.ae.dto.*;
|
|
||||||
import com.ff.game.api.request.*;
|
|
||||||
import com.ff.game.api.sv388.impl.SV388GamesServiceImpl;
|
|
||||||
import com.ff.game.api.xk.dto.XKKickMemberDTO;
|
|
||||||
import com.ff.game.domain.*;
|
|
||||||
import com.ff.game.service.IGameBettingDetailsService;
|
|
||||||
import com.ff.game.service.IGameExchangeMoneyService;
|
|
||||||
import com.ff.game.service.IGameService;
|
|
||||||
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.stream.Collectors;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AE 游戏 impl
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2024/11/12
|
|
||||||
*/
|
|
||||||
@Service("AEService")
|
|
||||||
@Slf4j
|
|
||||||
public class GamesAEServiceImpl implements IGamesService {
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private ISysConfigService configService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private RedisCache redisCache;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameService gameService;
|
|
||||||
@Resource
|
|
||||||
private ITenantGameQuotaService tenantGameQuotaService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IMemberService memberService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private AEClient AEClient;
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private KeyConfig keyConfig;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameBettingDetailsService gameBettingDetailsService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private DelayService delayService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏id
|
|
||||||
*/
|
|
||||||
private static final Long GAME_ID = 1904452832756013817L;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得就是成功
|
|
||||||
*
|
|
||||||
* @param errorCode 错误代码
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
private Boolean getIsSuccess(Integer errorCode) {
|
|
||||||
return 0 == errorCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取密钥
|
|
||||||
*
|
|
||||||
* @param gamesBaseRequestDTO 游戏请求dto
|
|
||||||
* @return {@link Map }<{@link String }, {@link Object }>
|
|
||||||
*/
|
|
||||||
private Map<String, Object> getKey(GamesBaseRequestDTO gamesBaseRequestDTO) {
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
|
||||||
params.put("cert", gamesBaseRequestDTO.getAgentKey());
|
|
||||||
params.put("agentId", gamesBaseRequestDTO.getAgentId());
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建成员
|
|
||||||
*
|
|
||||||
* @param createMemberRequestDTO 创建成员请求dto
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean createMember(CreateMemberRequestDTO createMemberRequestDTO) {
|
|
||||||
log.info("GamesAEServiceImpl [createMember] 请求参数 {}", createMemberRequestDTO);
|
|
||||||
|
|
||||||
Map<String, Object> params = this.getKey(createMemberRequestDTO);
|
|
||||||
params.put("userId", createMemberRequestDTO.getAccount());
|
|
||||||
params.put("currency", createMemberRequestDTO.getCurrency());
|
|
||||||
params.put("betLimit", JsonUtil.objToString(createMemberRequestDTO.getBetLimit()));
|
|
||||||
AEResponse aeResponse = AEClient.createMember(params);
|
|
||||||
String errorCode = aeResponse.getStatus();
|
|
||||||
if (this.getIsSuccess(Integer.valueOf(errorCode))) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
//判断是否获取成功
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取会员信息
|
|
||||||
*
|
|
||||||
* @param memberInfoRequestDTO 会员信息请求dto
|
|
||||||
* @return {@link MemberInfoResponseDTO }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MemberInfoResponseDTO getMemberInfo(MemberInfoRequestDTO memberInfoRequestDTO) {
|
|
||||||
log.info("GamesAEServiceImpl [getMemberInfo] 请求参数 {}", memberInfoRequestDTO);
|
|
||||||
Map<String, Object> params = this.getKey(memberInfoRequestDTO);
|
|
||||||
params.put("alluser", 0);
|
|
||||||
params.put("userIds", memberInfoRequestDTO.getAccounts());
|
|
||||||
AEMemberInfo memberInfo = AEClient.getMemberInfo(params);
|
|
||||||
//判断是否获取成功
|
|
||||||
if (this.getIsSuccess(memberInfo.getStatus())) {
|
|
||||||
AEMemberInfo.UserInfo userInfo = memberInfo.getResult().get(0);
|
|
||||||
return MemberInfoResponseDTO.builder()
|
|
||||||
.status(GameMemberStatus.UNKNOWN.getCode())
|
|
||||||
.balance(userInfo.getBalance())
|
|
||||||
.account(memberInfoRequestDTO.getAccounts())
|
|
||||||
.build();
|
|
||||||
} else {
|
|
||||||
throw new ApiException(ErrorCode.ERROR.getCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无重定向登录
|
|
||||||
*
|
|
||||||
* @param gamesLogin 游戏登录
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String loginWithoutRedirect(GamesLogin gamesLogin) {
|
|
||||||
log.info("GamesAEServiceImpl [loginWithoutRedirect] 请求参数 {}", gamesLogin);
|
|
||||||
|
|
||||||
Map<String, Object> params = this.getKey(gamesLogin);
|
|
||||||
params.put("userId", gamesLogin.getAccount());
|
|
||||||
params.put("externalURL", gamesLogin.getHomeUrl());
|
|
||||||
params.put("language", gamesLogin.getLang());
|
|
||||||
params.put("betLimit", gamesLogin.getBetLimit());
|
|
||||||
AELoginResponse aeLoginResponse = AEClient.loginWithoutRedirect(params);
|
|
||||||
//判断是否获取成功
|
|
||||||
if (this.getIsSuccess(aeLoginResponse.getStatus())) {
|
|
||||||
return aeLoginResponse.getUrl();
|
|
||||||
} else {
|
|
||||||
throw new BaseException(aeLoginResponse.getDesc());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取游戏列表
|
|
||||||
*
|
|
||||||
* @param gamesBaseRequestDTO 游戏请求dto
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
@Transactional
|
|
||||||
@Override
|
|
||||||
public String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO) {
|
|
||||||
Platform platform = gamesBaseRequestDTO.getVendor();
|
|
||||||
Game game = gameService.selectGameById(GAME_ID);
|
|
||||||
//不存在这个游戏
|
|
||||||
if (ObjectUtils.isEmpty(game)) {
|
|
||||||
game = new Game();
|
|
||||||
game.setId(GAME_ID);
|
|
||||||
game.setSortNo(gameService.selectMaxSortNo(PlatformType.VIDEO.getCode(), GamePlatforms.AE.getCode()) + 1);
|
|
||||||
game.setPlatformCode(platform.getPlatformCode());
|
|
||||||
game.setPlatformType(PlatformType.VIDEO.getCode());
|
|
||||||
game.setGameCode("1");
|
|
||||||
game.setGameSourceType(String.valueOf(1));
|
|
||||||
game.setGameName("AE大厅");
|
|
||||||
game.setCreateBy(Constants.SYSTEM);
|
|
||||||
NameInfo nameInfo = new NameInfo();
|
|
||||||
nameInfo.setLang("zh-CN");
|
|
||||||
nameInfo.setName("AE大厅");
|
|
||||||
game.setNameInfo(Collections.singletonList(nameInfo));
|
|
||||||
game.setGameId(StringUtils.addSuffix(GamePlatforms.AE.getCode(), 1));
|
|
||||||
gameService.insertGame(game);
|
|
||||||
}else {
|
|
||||||
NameInfo nameInfo = new NameInfo();
|
|
||||||
nameInfo.setLang("zh-CN");
|
|
||||||
nameInfo.setName("AE大厅");
|
|
||||||
game.setNameInfo(Collections.singletonList(nameInfo));
|
|
||||||
gameService.updateGame(game);
|
|
||||||
}
|
|
||||||
return CacheConstants.AE_GAMES;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取交易id
|
|
||||||
*
|
|
||||||
* @param transactionIdRequestDTO 事务id请求dto
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
|
||||||
return GamePlatforms.AE.getCode() + IdUtils.simpleUUID();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按代理id进行交换转账
|
|
||||||
*
|
|
||||||
* @param exchangeTransferMoneyRequestDTO 外汇转账moeny dto
|
|
||||||
* @return {@link Long }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO) {
|
|
||||||
log.info("GamesAEServiceImpl [exchangeTransferByAgentId] 请求参数 {}", exchangeTransferMoneyRequestDTO);
|
|
||||||
|
|
||||||
|
|
||||||
GameExchangeMoney exchangeMoney = gameExchangeMoneyService.selectGameExchangeMoneyById(exchangeTransferMoneyRequestDTO.getGameExchangeId());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> params = this.getKey(exchangeTransferMoneyRequestDTO);
|
|
||||||
AETransactionResponse deposit = null;
|
|
||||||
try {
|
|
||||||
if (TransferType.GAMES.getCode().equals(exchangeTransferMoneyRequestDTO.getTransferType())) {
|
|
||||||
|
|
||||||
params.put("userId", exchangeTransferMoneyRequestDTO.getAccount());
|
|
||||||
params.put("txCode", exchangeTransferMoneyRequestDTO.getTransactionId());
|
|
||||||
params.put("transferAmount", exchangeTransferMoneyRequestDTO.getAmount());
|
|
||||||
deposit = AEClient.deposit(params);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
params.put("userId", exchangeTransferMoneyRequestDTO.getAccount());
|
|
||||||
params.put("txCode", exchangeTransferMoneyRequestDTO.getTransactionId());
|
|
||||||
params.put("withdrawType", 1);
|
|
||||||
deposit = AEClient.withdraw(params);
|
|
||||||
}
|
|
||||||
}finally {
|
|
||||||
BigDecimal coinBefore;
|
|
||||||
if (TransferType.GAMES.getCode().equals(exchangeTransferMoneyRequestDTO.getTransferType())) {
|
|
||||||
coinBefore = NumberUtil.sub(deposit.getCurrentBalance(), deposit.getAmount());
|
|
||||||
} else {
|
|
||||||
coinBefore = NumberUtil.add(deposit.getCurrentBalance(), deposit.getAmount());
|
|
||||||
}
|
|
||||||
//判断是否转移成功
|
|
||||||
if ("0000".equals(deposit.getStatus())) {
|
|
||||||
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
|
||||||
exchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
|
||||||
} else {
|
|
||||||
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
|
||||||
exchangeMoney.setStepStatus(GameExchangeStepStatus.IN_PROGRESS.getCode());
|
|
||||||
}
|
|
||||||
//更新数据
|
|
||||||
exchangeMoney.setBalance(deposit.getAmount());
|
|
||||||
exchangeMoney.setCoinBefore(coinBefore);
|
|
||||||
exchangeMoney.setCoinAfter(deposit.getCurrentBalance());
|
|
||||||
exchangeMoney.setCurrencyBefore(exchangeMoney.getCoinBefore());
|
|
||||||
exchangeMoney.setCurrencyAfter(exchangeMoney.getCoinAfter());
|
|
||||||
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return exchangeMoney.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 汇兑转移状态
|
|
||||||
*
|
|
||||||
* @param exchangeTransferMoneyRequestDTO 兑换转账请求dto
|
|
||||||
* @return {@link ExchangeTransferStatusResponseDTO }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ExchangeTransferStatusResponseDTO exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO) {
|
|
||||||
log.info("GamesAEServiceImpl [exchangeTransferStatus] 请求参数 {}", exchangeTransferMoneyRequestDTO);
|
|
||||||
|
|
||||||
Map<String, Object> paramsMap = this.getKey(exchangeTransferMoneyRequestDTO);
|
|
||||||
paramsMap.put("txCode", exchangeTransferMoneyRequestDTO.getOrderId());
|
|
||||||
|
|
||||||
AEExchangeTransferStatusResponse exchangeTransferStatusResponse = AEClient.exchangeTransferStatus(paramsMap);
|
|
||||||
Integer status = StatusType.IN_PROGRESS.getValue();
|
|
||||||
if ("0000".equals(exchangeTransferStatusResponse.getStatus()) && "1".equals(exchangeTransferStatusResponse.getTxStatus())) {
|
|
||||||
status = StatusType.SUCCESS.getValue();
|
|
||||||
} else if ("0000".equals(exchangeTransferStatusResponse.getStatus()) && "0".equals(exchangeTransferStatusResponse.getTxStatus())) {
|
|
||||||
status = StatusType.FAILURE.getValue();
|
|
||||||
} else if ("1017".equals(exchangeTransferStatusResponse.getStatus())) {
|
|
||||||
status = StatusType.FAILURE.getValue();
|
|
||||||
}
|
|
||||||
GameExchangeMoney exchangeMoney = gameExchangeMoneyService.selectGameExchangeMoneyById(exchangeTransferMoneyRequestDTO.getGameExchangeMoneyId());
|
|
||||||
//更新
|
|
||||||
BigDecimal coinBefore;
|
|
||||||
if (TransferType.GAMES.getCode().equals(exchangeMoney.getExchangeType())) {
|
|
||||||
coinBefore = NumberUtil.sub(exchangeTransferStatusResponse.getBalance(), exchangeTransferStatusResponse.getTransferAmount());
|
|
||||||
} else {
|
|
||||||
coinBefore = NumberUtil.add(exchangeTransferStatusResponse.getBalance(), exchangeTransferStatusResponse.getTransferAmount());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return ExchangeTransferStatusResponseDTO.builder()
|
|
||||||
.statusType(status)
|
|
||||||
.balance(exchangeTransferStatusResponse.getTransferAmount())
|
|
||||||
.coinBefore(coinBefore)
|
|
||||||
.coinAfter(exchangeTransferStatusResponse.getBalance())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
class GetRealtimeRecordTask extends DelayTask {
|
|
||||||
BetRecordByTimeDTO betRecordByTimeDTO;
|
|
||||||
|
|
||||||
public GetRealtimeRecordTask(BetRecordByTimeDTO betRecordByTimeDTO) {
|
|
||||||
this.betRecordByTimeDTO = betRecordByTimeDTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
getRealtimeRecord(betRecordByTimeDTO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void getRealtimeRecord(BetRecordByTimeDTO betRecordByTimeDTO) {
|
|
||||||
//请求参数
|
|
||||||
log.info("GamesAEServiceImpl [getBetRecordByTime] 请求参数 {}", betRecordByTimeDTO);
|
|
||||||
Map<String, Object> params = this.getKey(betRecordByTimeDTO);
|
|
||||||
|
|
||||||
String timeFrom = redisCache.getCacheObject(CacheConstants.AE_TIME_FROM);
|
|
||||||
if (StringUtils.isEmpty(timeFrom)) {
|
|
||||||
timeFrom = DateUtils.convertTimestampToFormattedDate(betRecordByTimeDTO.getEndTime(), DateUtils.ISO_8601_FORMAT, "GMT+8") + "+08:00";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
params.put("timeFrom", timeFrom);
|
|
||||||
params.put("platform", "SEXYBCRT");
|
|
||||||
params.put("delayTime", 10000);
|
|
||||||
AEBetRecordResponse aeBetRecordResponse = AEClient.getBetRecordByTime(params);
|
|
||||||
|
|
||||||
//判断是否获取成功
|
|
||||||
if (this.getIsSuccess(aeBetRecordResponse.getStatus())) {
|
|
||||||
//数据组装
|
|
||||||
this.batchInsert(aeBetRecordResponse, betRecordByTimeDTO);
|
|
||||||
if (aeBetRecordResponse.getTransactions().size() >= 20000) {
|
|
||||||
delayService.addTask(new GetRealtimeRecordTask(betRecordByTimeDTO));
|
|
||||||
}
|
|
||||||
//return Boolean.TRUE;
|
|
||||||
} else {
|
|
||||||
redisCache.deleteObject(CacheConstants.AE_TIME_FROM);
|
|
||||||
log.error("GamesAEServiceImpl [getBetRecordByTime] 获取投注记录失败,错误代码{},错误信息{}", aeBetRecordResponse.getStatus(), aeBetRecordResponse.getDesc());
|
|
||||||
//throw new BaseException(aeBetRecordResponse.getDesc());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class GetHistoryRecordTask extends DelayTask {
|
|
||||||
BetRecordByTimeDTO betRecordByTimeDTO;
|
|
||||||
|
|
||||||
public GetHistoryRecordTask(BetRecordByTimeDTO betRecordByTimeDTO) {
|
|
||||||
this.betRecordByTimeDTO = betRecordByTimeDTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
getHistoryRecord(betRecordByTimeDTO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void getHistoryRecord(BetRecordByTimeDTO betRecordByTimeDTO) {
|
|
||||||
log.info("GamesAEServiceImpl [getBetRecordByHistoryTime] 请求参数 {}", betRecordByTimeDTO);
|
|
||||||
Map<String, Object> params = this.getKey(betRecordByTimeDTO);
|
|
||||||
String startTime = DateUtils.convertTimestampToFormattedDate(betRecordByTimeDTO.getStartTime(), DateUtils.ISO_8601_FORMAT, "GMT+8") + "+08:00";
|
|
||||||
String endTime = DateUtils.convertTimestampToFormattedDate(betRecordByTimeDTO.getEndTime(), DateUtils.ISO_8601_FORMAT, "GMT+8") + "+08:00";
|
|
||||||
|
|
||||||
|
|
||||||
params.put("startTime", startTime);
|
|
||||||
params.put("endTime", endTime);
|
|
||||||
params.put("platform", "SEXYBCRT");
|
|
||||||
AEBetRecordResponse aeBetRecordResponse = AEClient.getBetHistoryRecordByTime(params);
|
|
||||||
|
|
||||||
//判断是否获取成功
|
|
||||||
if (this.getIsSuccess(aeBetRecordResponse.getStatus())) {
|
|
||||||
//数据组装
|
|
||||||
this.batchInsert(aeBetRecordResponse, betRecordByTimeDTO);
|
|
||||||
if (aeBetRecordResponse.getTransactions().size() >= 20000) {
|
|
||||||
delayService.addTask(new GetHistoryRecordTask(betRecordByTimeDTO));
|
|
||||||
}
|
|
||||||
// return Boolean.TRUE;
|
|
||||||
} else {
|
|
||||||
log.error("GamesAEServiceImpl [getBetRecordByHistoryTime] 获取投注记录失败,错误代码{},错误信息{}", aeBetRecordResponse.getStatus(), aeBetRecordResponse.getDesc());
|
|
||||||
// throw new BaseException(aeBetRecordResponse.getDesc());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按时间获取投注记录
|
|
||||||
*
|
|
||||||
* @param betRecordByTimeDTO 按时间dto投注记录
|
|
||||||
* @return {@link List }<{@link GameBettingDetails }>
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean getBetRecordByTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
|
||||||
delayService.addTask(new GetRealtimeRecordTask(betRecordByTimeDTO));
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按历史时间获取投注记录
|
|
||||||
*
|
|
||||||
* @param betRecordByTimeDTO 按时间dto投注记录
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean getBetRecordByHistoryTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
|
||||||
delayService.addTask(new GetHistoryRecordTask(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("GamesAEServiceImpl [kickMember] 请求参数 {}", kickMemberRequestDTO);
|
|
||||||
Map<String, Object> params = this.getKey(kickMemberRequestDTO);
|
|
||||||
params.put("userIds", kickMemberRequestDTO.getAccount());
|
|
||||||
XKKickMemberDTO xkKickMemberDTO = AEClient.kickMember(params);
|
|
||||||
//判断是否获取成功
|
|
||||||
if (this.getIsSuccess(xkKickMemberDTO.getCode())) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
} else {
|
|
||||||
throw new BaseException(xkKickMemberDTO.getMsg());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 踢成员全部
|
|
||||||
*
|
|
||||||
* @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 gameDemoLoginRequestDTO 游戏演示登录请求dto
|
|
||||||
* @return {@link GameDemoLoginResponseDTO }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameDemoLoginResponseDTO gameDemoLogin(GameDemoLoginRequestDTO gameDemoLoginRequestDTO) {
|
|
||||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量插入
|
|
||||||
*
|
|
||||||
* @param aeBetRecordResponse ae下注记录响应dto
|
|
||||||
*/
|
|
||||||
private synchronized void batchInsert(AEBetRecordResponse aeBetRecordResponse, BetRecordByTimeDTO betRecordByTimeDTO) {
|
|
||||||
List<GameBettingDetails> gameBettingDetails = new ArrayList<>();
|
|
||||||
List<String> wagersIds = new ArrayList<>();
|
|
||||||
//数据组装
|
|
||||||
List<AEBetRecordResponse.Transaction> dataBean = aeBetRecordResponse.getTransactions();
|
|
||||||
|
|
||||||
String timeFrom = null;
|
|
||||||
//数据转化
|
|
||||||
for (AEBetRecordResponse.Transaction bean : dataBean) {
|
|
||||||
GameBettingDetails bettingDetails = this.dataBuild(GamesDataBuildDTO.builder()
|
|
||||||
.platform(betRecordByTimeDTO.getVendor())
|
|
||||||
.data(bean).build());
|
|
||||||
if (!ObjectUtils.isEmpty(bettingDetails)) {
|
|
||||||
bettingDetails.setId(IdUtil.getSnowflakeNextId());
|
|
||||||
gameBettingDetails.add(bettingDetails);
|
|
||||||
}
|
|
||||||
wagersIds.add(bean.getPlatform() + bean.getPlatformTxId());
|
|
||||||
timeFrom = bean.getUpdateTime();
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
|
||||||
//查询重复数据id
|
|
||||||
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds, GamePlatforms.AE.getInfo());
|
|
||||||
//用steam流清除list中与wagersIds集合相同的数据
|
|
||||||
gameBettingDetails = gameBettingDetails.stream()
|
|
||||||
.filter(detail -> !removeWagersIds.contains(detail.getWagersId()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
|
||||||
gameBettingDetailsService.batchInsert(gameBettingDetails);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (StringUtils.isEmpty(timeFrom)) {
|
|
||||||
timeFrom = DateUtils.convertTimestampToFormattedDate(DateUtils.getNowDate(), DateUtils.ISO_8601_FORMAT, "UTC+8") + "+08:00";
|
|
||||||
}
|
|
||||||
redisCache.setCacheObject(CacheConstants.AE_TIME_FROM, timeFrom);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据构建
|
|
||||||
*
|
|
||||||
* @param gamesDataBuildDTO 数据
|
|
||||||
* @return {@link GameBettingDetails }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameBettingDetails dataBuild(GamesDataBuildDTO gamesDataBuildDTO) {
|
|
||||||
//转化类
|
|
||||||
AEBetRecordResponse.Transaction resultBean = (AEBetRecordResponse.Transaction) gamesDataBuildDTO.getData();
|
|
||||||
|
|
||||||
|
|
||||||
Member member = memberService.selectMemberByGameAccount(resultBean.getUserId());
|
|
||||||
if (ObjectUtils.isEmpty(member)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 判断输赢
|
|
||||||
Integer gameStatus = GameStatus.FLAT.getCode();
|
|
||||||
BigDecimal payoffAmount = BigDecimal.ZERO;
|
|
||||||
if (resultBean.getRealWinAmount().compareTo(resultBean.getRealBetAmount()) > 0) {
|
|
||||||
gameStatus = GameStatus.WIN.getCode();
|
|
||||||
payoffAmount = resultBean.getRealWinAmount().subtract(resultBean.getRealBetAmount());
|
|
||||||
} else if (resultBean.getRealWinAmount().compareTo(resultBean.getRealBetAmount()) < 0) {
|
|
||||||
gameStatus = GameStatus.FAIL.getCode();
|
|
||||||
payoffAmount = resultBean.getRealWinAmount().subtract(resultBean.getRealBetAmount()).abs();
|
|
||||||
}
|
|
||||||
|
|
||||||
//结算状态
|
|
||||||
int settlementStatus = SettlementStatusEnum.REVOKED.getCode();
|
|
||||||
if (resultBean.getTxStatus() == 1) {
|
|
||||||
settlementStatus = SettlementStatusEnum.COMPLETED.getCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
//数据构造
|
|
||||||
GameBettingDetails gameBettingDetails = GameBettingDetails.builder()
|
|
||||||
.tenantKey(member.getTenantKey())
|
|
||||||
//保存我们的币种id
|
|
||||||
.currencyCode(gamesDataBuildDTO.getPlatform().getOurCurrency(resultBean.getCurrency()))
|
|
||||||
.memberId(member.getId())
|
|
||||||
.gameCode(resultBean.getGameCode())
|
|
||||||
.gameType(PlatformType.GAME_HALL.getCode())
|
|
||||||
.platformCode(GamePlatforms.AE.getCode())
|
|
||||||
.gameId(/*GAME_ID*/ StringUtils.addSuffix(GamePlatforms.AE.getCode(), 1))
|
|
||||||
.gameName(resultBean.getGameName())
|
|
||||||
.gameStatus(gameStatus)
|
|
||||||
.gameStatusType(resultBean.getSettleStatus())
|
|
||||||
.gameCurrencyCode(resultBean.getCurrency())
|
|
||||||
.account(resultBean.getUserId())
|
|
||||||
.wagersId(resultBean.getPlatform() + resultBean.getPlatformTxId())
|
|
||||||
.wagersTime(resultBean.getBetTime().getTime())
|
|
||||||
.betAmount(resultBean.getRealBetAmount())
|
|
||||||
.payoffTime(resultBean.getTxTime().getTime())
|
|
||||||
.payoffAmount(payoffAmount)
|
|
||||||
.betContent(resultBean.getGameInfo())
|
|
||||||
.settlementTime(resultBean.getTxTime().getTime())
|
|
||||||
.turnover(resultBean.getTurnover())
|
|
||||||
.orderNo(String.valueOf(resultBean.getRoundId()))
|
|
||||||
.settlementStatus(settlementStatus)
|
|
||||||
.build();
|
|
||||||
gameBettingDetails.setCreateBy(Constants.SYSTEM);
|
|
||||||
gameBettingDetails.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return gameBettingDetails;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
package com.ff.game.api.db.address;
|
|
||||||
|
|
||||||
import com.dtflys.forest.callback.AddressSource;
|
|
||||||
import com.dtflys.forest.http.ForestAddress;
|
|
||||||
import com.dtflys.forest.http.ForestRequest;
|
|
||||||
import com.ff.base.enums.GamePlatforms;
|
|
||||||
import com.ff.game.service.IPlatformService;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <a href="http://api-doc-2.dbsporxxxw1box.com/#/login">DB体育对接文档</a>
|
|
||||||
* 账号: api
|
|
||||||
* 密码: a12345678
|
|
||||||
*
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class DBSportsAddress implements AddressSource {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IPlatformService platformService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ForestAddress getAddress(ForestRequest request) {
|
|
||||||
String apiBaseUrl = platformService.get(GamePlatforms.DBSports.getCode())
|
|
||||||
.getUrlInfo().getUrl();
|
|
||||||
return new ForestAddress("https", apiBaseUrl, 443, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
||||||
package com.ff.game.api.db.client;
|
|
||||||
|
|
||||||
import com.dtflys.forest.annotation.*;
|
|
||||||
import com.ff.game.api.db.address.DBSportsAddress;
|
|
||||||
import com.ff.game.api.db.dto.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Address(source = DBSportsAddress.class)
|
|
||||||
public interface DBSportsClient {
|
|
||||||
/**
|
|
||||||
* 创建投注用户
|
|
||||||
*
|
|
||||||
* @return {@link CreateUserResponse}
|
|
||||||
*/
|
|
||||||
@Post(url = "/api/user/create",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
CreateUserResponse createMember(@Body CreateUserRequest request,
|
|
||||||
@Header("requestId") @Var("requestId") String requestId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户登录接口(注册和登录合并为一个接口)
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param requestId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Post(url = "/api/user/login",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
LoginResponse login(@Body LoginRequest request,
|
|
||||||
@Header("requestId") String requestId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户金额转入到DB体育平台,支持两位小数,最小0.01,必须是正数
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @return {@link TransferResponse}
|
|
||||||
*/
|
|
||||||
@Post(url = "/api/fund/transfer",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
TransferResponse transferIn(@Body TransferRequest request,
|
|
||||||
@Header("requestId") @Var("requestId") String requestId
|
|
||||||
);
|
|
||||||
|
|
||||||
@Post(url = "/api/fund/transfer",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
TransferResponse transferOut(@Body TransferRequest request,
|
|
||||||
@Header("requestId") String requestId
|
|
||||||
);
|
|
||||||
|
|
||||||
@Post(url = "/api/fund/checkBalance",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
GetMemberInfoResponse getMemberInfo(@Body GetMemberInfoRequest request,
|
|
||||||
@Header("requestId") String requestId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据转账ID查询交易记录接口。
|
|
||||||
*/
|
|
||||||
@Post(url = "/api/fund/getTransferRecord",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
TransferDetailResponse transferDetail(@Body TransferDetailRequest request,
|
|
||||||
@Header("requestId") String requestId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 剔用户
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param requestId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Post(value = "/api/user/kickOutUser",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
KickUserResponse kickUser(@Body KickUserRequest request,
|
|
||||||
@Header("requestId") String requestId);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拉取订单Json数据
|
|
||||||
*/
|
|
||||||
@Post(url = "/api/bet/queryBetListV2",
|
|
||||||
headers = {
|
|
||||||
"Content-type: application/x-www-form-urlencoded"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
GetBetListResponse getBetList(@Body GetBetListRequest request,
|
|
||||||
@Header("requestId") String requestId);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class CreateUserRequest implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String userName; // 用户名(可以包含但是不要等同于特殊字符或者空格,长度控制在30个字符以下)
|
|
||||||
private String merchantCode; // 商户code
|
|
||||||
private String timestamp = System.currentTimeMillis() + ""; // 13位时间戳
|
|
||||||
private String currency; // 币种
|
|
||||||
private String nickname; // N 昵称
|
|
||||||
private String agentId; // N 信用网(代理id)
|
|
||||||
private String signature; // 签名 signature =MD5(MD5(userName +”&”+ merchantCode +”&”+ timestamp) + ”&”+ key)
|
|
||||||
|
|
||||||
public void buildSignature(String key) {
|
|
||||||
String signature = Md5Utils.md5New(Md5Utils.md5New(userName + "&" + merchantCode + "&" + timestamp) + "&" + key);
|
|
||||||
this.signature = signature;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class CreateUserResponse implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Boolean status;
|
|
||||||
private String msg;
|
|
||||||
private String code;
|
|
||||||
private Long serverTime;
|
|
||||||
private UserDTO data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class UserDTO {
|
|
||||||
private String userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
public class Enums {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class GetBetListRequest implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户名(可选)
|
|
||||||
*/
|
|
||||||
private String userName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始时间(13位时间戳,必填)
|
|
||||||
*/
|
|
||||||
private String startTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 结束时间(13位时间戳,必填)
|
|
||||||
*/
|
|
||||||
private String endTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商户编码(必填)
|
|
||||||
*/
|
|
||||||
private String merchantCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 赛种ID(可选)
|
|
||||||
*/
|
|
||||||
private Integer sportId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 联赛ID(可选)
|
|
||||||
*/
|
|
||||||
private Long tournamentId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 结算状态(可选)
|
|
||||||
* 0: 未结算
|
|
||||||
* 1: 已结算
|
|
||||||
* 2: 取消人工
|
|
||||||
* 3: 待确认
|
|
||||||
* 4: 风控拒单
|
|
||||||
* 5: 撤单(赛事取消)
|
|
||||||
*/
|
|
||||||
private Integer settleStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 页面编号,从1开始(可选)
|
|
||||||
*/
|
|
||||||
private Integer pageNum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 每页条数(最大1000,可选)
|
|
||||||
*/
|
|
||||||
private Integer pageSize;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求时间戳(13位,必填)
|
|
||||||
*/
|
|
||||||
private String timestamp = String.valueOf(System.currentTimeMillis());
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 排序方式(可选)
|
|
||||||
* 1: 订单创建时间(投注时间)
|
|
||||||
* 2: 订单更新时间
|
|
||||||
*/
|
|
||||||
private Integer orderBy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 语言(可选,默认中文,传"en"返回英文)
|
|
||||||
*/
|
|
||||||
private String language;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 签名(必填)
|
|
||||||
*/
|
|
||||||
private String signature;
|
|
||||||
|
|
||||||
public void buildSignature(String key) {
|
|
||||||
String signature = Md5Utils.md5New(Md5Utils.md5New(merchantCode + "&" + startTime + "&" + endTime + "&" + timestamp) + "&" + key);
|
|
||||||
this.signature = signature;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,199 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class GetBetListResponse implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Boolean status;
|
|
||||||
private String msg;
|
|
||||||
private String code;
|
|
||||||
private Long serverTime;
|
|
||||||
private DataDTO data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class DataDTO {
|
|
||||||
|
|
||||||
|
|
||||||
// 当前页码
|
|
||||||
private Integer pageNum;
|
|
||||||
// 每页条数
|
|
||||||
private Integer pageSize;
|
|
||||||
// 总条数
|
|
||||||
private Integer totalCount;
|
|
||||||
// 注单列表
|
|
||||||
private List<OrderItemDTO> list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class OrderItemDTO {
|
|
||||||
// 用户名
|
|
||||||
private String userName;
|
|
||||||
|
|
||||||
// 商户编码
|
|
||||||
private String merchantCode;
|
|
||||||
|
|
||||||
// 订单ID
|
|
||||||
private String orderNo;
|
|
||||||
|
|
||||||
// 订单状态,具体见参数字段映射
|
|
||||||
private Integer orderStatus;
|
|
||||||
|
|
||||||
// 投注时间(13位时间戳)
|
|
||||||
private Long createTime;
|
|
||||||
|
|
||||||
// 订单更新时间(13位时间戳)
|
|
||||||
private Long modifyTime;
|
|
||||||
|
|
||||||
// 实际投注金额
|
|
||||||
private String orderAmount;
|
|
||||||
|
|
||||||
// 注单项数量
|
|
||||||
private Integer betCount;
|
|
||||||
|
|
||||||
// 结算时间(13位时间戳)
|
|
||||||
private Long settleTime;
|
|
||||||
|
|
||||||
// 结算金额
|
|
||||||
private Double settleAmount;
|
|
||||||
|
|
||||||
// 提前结算投注金额
|
|
||||||
private Double preBetAmount;
|
|
||||||
|
|
||||||
// 盈利金额
|
|
||||||
private Double profitAmount;
|
|
||||||
|
|
||||||
// 注单结算结果
|
|
||||||
// 2:走水,3:输,4:赢,5:赢半,6:输半,7:赛事取消,8:赛事延期
|
|
||||||
private Integer outcome;
|
|
||||||
|
|
||||||
// 串关类型
|
|
||||||
private Integer seriesType;
|
|
||||||
|
|
||||||
// 串关值
|
|
||||||
private String seriesValue;
|
|
||||||
|
|
||||||
// 结算次数
|
|
||||||
private Integer settleTimes;
|
|
||||||
|
|
||||||
// 设备类型:1-H5,2-PC,3-Android,4-IOS
|
|
||||||
private String deviceType;
|
|
||||||
|
|
||||||
// 移动设备标识
|
|
||||||
private String deviceImei;
|
|
||||||
|
|
||||||
// 用户IP地址
|
|
||||||
private String ip;
|
|
||||||
|
|
||||||
// 币种
|
|
||||||
private String currency;
|
|
||||||
|
|
||||||
// 汇率
|
|
||||||
private BigDecimal exchangeRate;
|
|
||||||
|
|
||||||
// 最大中奖金额
|
|
||||||
private Double maxWinAmount;
|
|
||||||
|
|
||||||
// VIP等级
|
|
||||||
private Integer vipLevel;
|
|
||||||
|
|
||||||
// 投注前余额
|
|
||||||
private BigDecimal beforeTransfer;
|
|
||||||
|
|
||||||
// 投注后余额
|
|
||||||
private BigDecimal afterTransfer;
|
|
||||||
|
|
||||||
// 有效投注金额
|
|
||||||
private BigDecimal validOrderAmount;
|
|
||||||
|
|
||||||
// 注单详情列表
|
|
||||||
private List<DetailItemDTO> detailList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class DetailItemDTO {
|
|
||||||
// 投注项编号
|
|
||||||
private Long betNo;
|
|
||||||
|
|
||||||
// 投注项ID
|
|
||||||
private Long playOptionsId;
|
|
||||||
|
|
||||||
// 赛事ID
|
|
||||||
private Long matchId;
|
|
||||||
|
|
||||||
// 比赛开始时间(13位时间戳)
|
|
||||||
private Long beginTime;
|
|
||||||
|
|
||||||
// 注单金额
|
|
||||||
private Double betAmount;
|
|
||||||
|
|
||||||
// 联赛名称
|
|
||||||
private String matchName;
|
|
||||||
|
|
||||||
// 比赛对阵
|
|
||||||
private String matchInfo;
|
|
||||||
|
|
||||||
// 投注类型:
|
|
||||||
// 1:早盘,2:滚球盘,3:冠军盘,4:虚拟赛事,5:电竞赛事
|
|
||||||
private Integer matchType;
|
|
||||||
|
|
||||||
// 赛种ID
|
|
||||||
private Integer sportId;
|
|
||||||
|
|
||||||
// 玩法ID
|
|
||||||
private Integer playId;
|
|
||||||
|
|
||||||
// 投注项(如主客队)
|
|
||||||
private String playOptions;
|
|
||||||
|
|
||||||
// 游戏名称
|
|
||||||
private String sportName;
|
|
||||||
|
|
||||||
// 联赛ID
|
|
||||||
private Long tournamentId;
|
|
||||||
|
|
||||||
// 投注项名称
|
|
||||||
private String playOptionName;
|
|
||||||
|
|
||||||
// 玩法名称
|
|
||||||
private String playName;
|
|
||||||
|
|
||||||
// 盘口类型
|
|
||||||
private String marketType;
|
|
||||||
|
|
||||||
// 盘口值
|
|
||||||
private String marketValue;
|
|
||||||
|
|
||||||
// 让球值
|
|
||||||
private BigDecimal handicap;
|
|
||||||
|
|
||||||
// 结算比分(我方处理后所得,数据商可能未提供)
|
|
||||||
private String settleScore;
|
|
||||||
|
|
||||||
// 基准分
|
|
||||||
private String scoreBenchmark;
|
|
||||||
|
|
||||||
// 当前赔率(欧洲盘表示)
|
|
||||||
private BigDecimal oddsValue;
|
|
||||||
|
|
||||||
// 注单结算结果:
|
|
||||||
// 0:无结果,2:走水,3:输,4:赢,5:赢一半,6:输一半,
|
|
||||||
// 7:赛事取消,8:赛事延期,11:比赛延迟,12:比赛中断,
|
|
||||||
// 13:未知,15:比赛放弃,16:异常盘口,17:未知状态,
|
|
||||||
// 18:比赛取消,19:比赛延期
|
|
||||||
private String betResult;
|
|
||||||
|
|
||||||
// 最终赔率(按盘口类型)
|
|
||||||
private BigDecimal oddFinally;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class GetMemberInfoRequest implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户名,不能为空
|
|
||||||
*/
|
|
||||||
private String userName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商户编码
|
|
||||||
*/
|
|
||||||
private String merchantCode;
|
|
||||||
/**
|
|
||||||
* Long型时间戳(13位)
|
|
||||||
*/
|
|
||||||
private String timestamp = System.currentTimeMillis() + "";
|
|
||||||
|
|
||||||
private String signature;
|
|
||||||
|
|
||||||
public void buildSignature(String key) {
|
|
||||||
|
|
||||||
String signature = Md5Utils.md5New(Md5Utils.md5New(merchantCode + "&" + userName + "&" + timestamp) + "&" + key);
|
|
||||||
this.signature = signature;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class GetMemberInfoResponse implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Boolean status;
|
|
||||||
private String msg;
|
|
||||||
private String code;
|
|
||||||
private Long serverTime;
|
|
||||||
private MemberInfoDTO data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class MemberInfoDTO {
|
|
||||||
private BigDecimal balance;
|
|
||||||
private String userName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class KickUserRequest implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private String userName;
|
|
||||||
private String merchantCode;
|
|
||||||
private String timestamp = System.currentTimeMillis() + "";
|
|
||||||
private String signature;
|
|
||||||
|
|
||||||
public void buildSignature(String key) {
|
|
||||||
String signature = Md5Utils.md5New(Md5Utils.md5New(merchantCode + "&" + userName + "&" + timestamp) + "&" + key);
|
|
||||||
this.signature = signature;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class KickUserResponse implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Boolean status;
|
|
||||||
private String msg;
|
|
||||||
private String code;
|
|
||||||
private Long serverTime;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class LoginRequest implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private String userName;
|
|
||||||
private String merchantCode;
|
|
||||||
private String timestamp = System.currentTimeMillis() + "";
|
|
||||||
private String signature;
|
|
||||||
|
|
||||||
// 不能传错,用户可能受到设备类型相关风控措施的错误限制,进而影响正常用户货量,并产生客诉
|
|
||||||
private String terminal; // 终端类型:【电脑传值:pc】,【移动设备传值:mobile】 注:这个参数传值必须是pc或者mobile,
|
|
||||||
private BigDecimal balance; // 用户余额,N
|
|
||||||
private String currency; // 币种(见参数映射:支持币种 )会员首次登录,必须填写币种参数,否则注册失败
|
|
||||||
|
|
||||||
private String callbackUrl; // 玩家会话失效跳转的商户地址url(非必传)
|
|
||||||
private String stoken; // 非必传字段(商户方用户会话)
|
|
||||||
|
|
||||||
// 非必传字段(支持体育游戏其他端的跳转) ,
|
|
||||||
// C端⽀持跳转的游戏,如果C端⽀持跳转多个游戏 ,
|
|
||||||
// 则使⽤逗号区分。 具体字段可查看:参数字段映射第6条 参数字段映射
|
|
||||||
private String jumpsupport;
|
|
||||||
private String jumpfrom; // 非必传字段,同上
|
|
||||||
|
|
||||||
private String agentId; // 信用网(代理id),N
|
|
||||||
// 用户语种:
|
|
||||||
//zh:中文
|
|
||||||
//en:英文
|
|
||||||
//vi:越南语
|
|
||||||
//tw:中文繁体
|
|
||||||
//th:泰语
|
|
||||||
//ms:马来语
|
|
||||||
//ad:印尼语
|
|
||||||
//ko:韩语
|
|
||||||
//mya:缅甸语
|
|
||||||
//pt:葡萄牙语
|
|
||||||
//es:西班牙语
|
|
||||||
//非必传字段
|
|
||||||
private String language;
|
|
||||||
private String ip; // 非必传字段 说明:商户端在该字段上传入用户登陆时端ip
|
|
||||||
|
|
||||||
public void buildSignature(String key) {
|
|
||||||
String signature = Md5Utils.md5New(Md5Utils.md5New(merchantCode + "&" + userName + "&" + terminal + "&" + timestamp) + "&" + key);
|
|
||||||
|
|
||||||
this.signature = signature;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class LoginResponse implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Boolean status;
|
|
||||||
private String msg;
|
|
||||||
private String code;
|
|
||||||
private Long serverTime;
|
|
||||||
private LoginRespDTO data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class LoginRespDTO {
|
|
||||||
private String domain; // 体育游戏前端URL
|
|
||||||
private String token; // 带有登录状态的token
|
|
||||||
private String apiDomain;// 赛事API的域名(若没有对接赛事API,为空)
|
|
||||||
private String imgDomain; // 静态资源域名
|
|
||||||
private String loginUrl; // 登录体育URL,可直接跳转
|
|
||||||
private String userId; // 用户id
|
|
||||||
private String url; // 参加活动的商户使用,客户端域名和参数拼接后提供商户使用
|
|
||||||
private List<String> loginUrlArr; // loginUrl数组,多个域名,调试使用
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class TransferDetailRequest implements Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户名,N
|
|
||||||
*/
|
|
||||||
private String userName;
|
|
||||||
/**
|
|
||||||
* 商户code
|
|
||||||
*/
|
|
||||||
private String merchantCode;
|
|
||||||
/**
|
|
||||||
* 交易id(19位数字)
|
|
||||||
*/
|
|
||||||
private String transferId;
|
|
||||||
|
|
||||||
private String timestamp = System.currentTimeMillis() + "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 签名
|
|
||||||
*/
|
|
||||||
private String signature;
|
|
||||||
|
|
||||||
public void buildSignature(String key) {
|
|
||||||
String signature = Md5Utils.md5New(Md5Utils.md5New(merchantCode + "&" + transferId + "&" + timestamp) + "&" + key);
|
|
||||||
this.signature = signature;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class TransferDetailResponse implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private TransferDetailDTO data;
|
|
||||||
private Boolean status;
|
|
||||||
private String msg;
|
|
||||||
private String code;
|
|
||||||
private Long serverTime;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class TransferDetailDTO implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String transferId; // 交易id
|
|
||||||
private String merchantCode; // 商户代码
|
|
||||||
private Long userId; // 用户id
|
|
||||||
private Integer transferType; // 交易类型 1:加款,2:扣款
|
|
||||||
private BigDecimal amount; // 交易金额
|
|
||||||
private BigDecimal beforeTransfer; // 转账前余额
|
|
||||||
private Integer afterTransfer; // 转账后余额
|
|
||||||
private Integer status; // 转账成功与否(0:失败,1:成功)
|
|
||||||
private String mag; // 转账模式 1:免转,2:转账
|
|
||||||
private Integer transferMode; // 转账涉及订单(transferMode为2时,该字段为空)
|
|
||||||
private Long createTime; // 交易时间
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class TransferRequest implements Serializable {
|
|
||||||
|
|
||||||
private String userName;
|
|
||||||
private String merchantCode;
|
|
||||||
private int transferType; // 1:加款 2:扣款
|
|
||||||
|
|
||||||
private String amount; // 金额,小数2位
|
|
||||||
private String transferId; // 交易的讯息号,唯一标示,不可重复,19位长度的字符串
|
|
||||||
private String timestamp = String.valueOf(System.currentTimeMillis());
|
|
||||||
private String signature;
|
|
||||||
|
|
||||||
public void buildSignature(String key) {
|
|
||||||
String signature = Md5Utils.md5New(Md5Utils.md5New(merchantCode + "&" + userName + "&" + transferType + "&" + amount + "&" + transferId + "&" + timestamp) + "&" + key);
|
|
||||||
this.signature = signature;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
package com.ff.game.api.db.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class TransferResponse implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Boolean status;
|
|
||||||
private String msg;
|
|
||||||
private String code;
|
|
||||||
private Long serverTime;
|
|
||||||
private TransferDTO data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class TransferDTO {
|
|
||||||
private String userName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,609 +0,0 @@
|
||||||
package com.ff.game.api.db.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import com.ff.base.constant.CacheConstants;
|
|
||||||
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.utils.DateUtils;
|
|
||||||
import com.ff.base.utils.StringUtils;
|
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
|
||||||
import com.ff.base.utils.uuid.IdUtils;
|
|
||||||
import com.ff.game.api.IGamesService;
|
|
||||||
import com.ff.game.api.db.dto.*;
|
|
||||||
import com.ff.game.api.request.*;
|
|
||||||
import com.ff.game.domain.*;
|
|
||||||
import com.ff.game.service.IGameBettingDetailsService;
|
|
||||||
import com.ff.game.service.IGameExchangeMoneyService;
|
|
||||||
import com.ff.game.service.IGameService;
|
|
||||||
import com.ff.member.domain.Member;
|
|
||||||
import com.ff.member.service.IMemberService;
|
|
||||||
import com.ff.game.api.db.client.DBSportsClient;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
import org.springframework.util.ObjectUtils;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DB体育
|
|
||||||
*
|
|
||||||
* @author cengy
|
|
||||||
* @date 2024/10/21
|
|
||||||
*/
|
|
||||||
@Service("DBSportsService")
|
|
||||||
@Slf4j
|
|
||||||
public class DBSportsServiceImpl implements IGamesService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private RedisCache redisCache;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameService gameService;
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IMemberService memberService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private DBSportsClient dbSportsClient;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameBettingDetailsService gameBettingDetailsService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得就是成功
|
|
||||||
*
|
|
||||||
* @param errorCode 错误代码
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
private Boolean isSuccess(String errorCode) {
|
|
||||||
return "0000".equals(errorCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
String getSign(String bodyJsonString, String merchantId, String merchantApiSecret, long requestTimestamp) {
|
|
||||||
|
|
||||||
String stringThatNeedsToBeSigned = bodyJsonString + "." + merchantId + "." + requestTimestamp + "." + merchantApiSecret;
|
|
||||||
String sign = Md5Utils.md5New(stringThatNeedsToBeSigned);
|
|
||||||
return sign;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建成员
|
|
||||||
*
|
|
||||||
* @param requestDTO 创建成员请求dto
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean createMember(CreateMemberRequestDTO requestDTO) {
|
|
||||||
|
|
||||||
CreateUserRequest request = new CreateUserRequest();
|
|
||||||
request.setUserName(requestDTO.getAccount());
|
|
||||||
request.setMerchantCode(requestDTO.getAgentId());
|
|
||||||
request.setCurrency(requestDTO.getCurrency());
|
|
||||||
request.buildSignature(requestDTO.getAgentKey());
|
|
||||||
|
|
||||||
//String lang = requestDTO.getLan
|
|
||||||
String requestId = IdUtils.fastUUID();
|
|
||||||
CreateUserResponse response = dbSportsClient.createMember(request, requestId);
|
|
||||||
if (isSuccess(response.getCode())) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
log.error("创建会员失败, errorCode:{}, errorMessage:{}", response.getCode(), response.getMsg());
|
|
||||||
throw new ApiException(ErrorCode.Create_Member_Failure.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按代理id进行交换转账
|
|
||||||
*
|
|
||||||
* @param requestDTO 外汇转账
|
|
||||||
* @return {@link Long }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO requestDTO) {
|
|
||||||
|
|
||||||
GameExchangeMoney exchangeMoney = gameExchangeMoneyService.selectGameExchangeMoneyById(requestDTO.getGameExchangeId());
|
|
||||||
// 转入
|
|
||||||
if (requestDTO.getTransferType().equals(TransferType.GAMES.getCode())) {
|
|
||||||
TransferRequest request = new TransferRequest();
|
|
||||||
request.setUserName(requestDTO.getAccount());
|
|
||||||
request.setTransferType(1);
|
|
||||||
request.setTransferId(requestDTO.getTransactionId());
|
|
||||||
request.setMerchantCode(requestDTO.getAgentId());
|
|
||||||
request.setAmount(requestDTO.getAmount().toString());
|
|
||||||
request.buildSignature(requestDTO.getAgentKey());
|
|
||||||
|
|
||||||
TransferResponse response = dbSportsClient.transferIn(
|
|
||||||
request, IdUtils.fastUUID()
|
|
||||||
);
|
|
||||||
if (isSuccess(response.getCode())) {
|
|
||||||
GetMemberInfoRequest queryMemberRequest = new GetMemberInfoRequest();
|
|
||||||
queryMemberRequest.setUserName(requestDTO.getAccount());
|
|
||||||
queryMemberRequest.setMerchantCode(requestDTO.getAgentId());
|
|
||||||
queryMemberRequest.buildSignature(requestDTO.getAgentKey());
|
|
||||||
String requestId = IdUtils.fastUUID();
|
|
||||||
try {
|
|
||||||
GetMemberInfoResponse queryMemberResponse = dbSportsClient.getMemberInfo(queryMemberRequest, requestId);
|
|
||||||
if (this.isSuccess(queryMemberResponse.getCode())) {
|
|
||||||
BigDecimal transAmount = requestDTO.getAmount();
|
|
||||||
BigDecimal afterAmount = queryMemberResponse.getData().getBalance();
|
|
||||||
BigDecimal beforeAmount = afterAmount.subtract(transAmount);
|
|
||||||
exchangeMoney.setBalance(transAmount);
|
|
||||||
exchangeMoney.setCoinBefore(beforeAmount);
|
|
||||||
exchangeMoney.setCoinAfter(afterAmount);
|
|
||||||
exchangeMoney.setCurrencyBefore(beforeAmount);
|
|
||||||
exchangeMoney.setCurrencyAfter(afterAmount);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("查询会员失败, errorCode:{}, errorMessage:{}", response.getCode(), response.getMsg(), e);
|
|
||||||
}
|
|
||||||
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
|
||||||
exchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
|
||||||
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
|
||||||
} else {
|
|
||||||
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
|
||||||
exchangeMoney.setStepStatus(GameExchangeStepStatus.FAILURE.getCode());
|
|
||||||
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
|
||||||
throw new ApiException(ErrorCode.Transfer_In_Failure.getCode());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 获取第三方钱包余额
|
|
||||||
MemberInfoRequestDTO memberInfoRequestDTO = MemberInfoRequestDTO.builder()
|
|
||||||
.accounts(requestDTO.getAccount())
|
|
||||||
.agentId(requestDTO.getAgentId())
|
|
||||||
.agentKey(requestDTO.getAgentKey())
|
|
||||||
.build();
|
|
||||||
BigDecimal balance = this.getMemberInfo(memberInfoRequestDTO).getBalance();
|
|
||||||
if (balance.compareTo(BigDecimal.ZERO) <= 0) {
|
|
||||||
throw new ApiException(ErrorCode.INSUFFICIENT_PLAYER_BALANCE.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
TransferRequest request = new TransferRequest();
|
|
||||||
request.setUserName(requestDTO.getAccount());
|
|
||||||
request.setTransferType(2); // 转出
|
|
||||||
request.setTransferId(requestDTO.getTransactionId());
|
|
||||||
request.setMerchantCode(requestDTO.getAgentId());
|
|
||||||
request.setAmount(/*requestDTO.getAmount().toString()*/ balance.toString());
|
|
||||||
request.buildSignature(requestDTO.getAgentKey());
|
|
||||||
|
|
||||||
TransferResponse response = dbSportsClient
|
|
||||||
.transferOut(
|
|
||||||
request, IdUtils.fastUUID()
|
|
||||||
);
|
|
||||||
|
|
||||||
//判断是否转移成功
|
|
||||||
if (this.isSuccess(response.getCode())) {
|
|
||||||
BigDecimal transAmount = balance;
|
|
||||||
BigDecimal beforeAmount = balance;
|
|
||||||
BigDecimal afterAmount = BigDecimal.ZERO;
|
|
||||||
|
|
||||||
//更新数据
|
|
||||||
exchangeMoney.setBalance(transAmount);
|
|
||||||
exchangeMoney.setCoinBefore(beforeAmount);
|
|
||||||
exchangeMoney.setCoinAfter(afterAmount);
|
|
||||||
exchangeMoney.setCurrencyBefore(beforeAmount);
|
|
||||||
exchangeMoney.setCurrencyAfter(afterAmount);
|
|
||||||
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
|
||||||
exchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
|
||||||
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
|
||||||
} else {
|
|
||||||
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
|
||||||
exchangeMoney.setStepStatus(GameExchangeStepStatus.FAILURE.getCode());
|
|
||||||
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
|
||||||
throw new ApiException(ErrorCode.Transfer_Out_Failure.getCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return exchangeMoney.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取交易id
|
|
||||||
*
|
|
||||||
* @param transactionIdRequestDTO 事务id请求dto
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
|
||||||
return gameExchangeMoneyService.getTransactionId(GamePlatforms.DBSports.getInfo(), 11);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取会员信息
|
|
||||||
*
|
|
||||||
* @param requestDTO 会员信息请求dto
|
|
||||||
* @return {@link MemberInfoResponseDTO }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MemberInfoResponseDTO getMemberInfo(MemberInfoRequestDTO requestDTO) {
|
|
||||||
GetMemberInfoRequest request = new GetMemberInfoRequest();
|
|
||||||
request.setUserName(requestDTO.getAccounts());
|
|
||||||
request.setMerchantCode(requestDTO.getAgentId());
|
|
||||||
request.buildSignature(requestDTO.getAgentKey());
|
|
||||||
String requestId = IdUtils.fastUUID();
|
|
||||||
GetMemberInfoResponse response = dbSportsClient.getMemberInfo(request, requestId);
|
|
||||||
//判断是否获取成功
|
|
||||||
if (this.isSuccess(response.getCode())) {
|
|
||||||
return MemberInfoResponseDTO.builder()
|
|
||||||
.status(GameMemberStatus.UNKNOWN.getCode())
|
|
||||||
.balance(response.getData().getBalance())
|
|
||||||
.account(requestDTO.getAccounts())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
throw new ApiException(ErrorCode.Get_Member_Info_Failure.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无重定向登录
|
|
||||||
*
|
|
||||||
* @param requestDTO 游戏登录
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String loginWithoutRedirect(GamesLogin requestDTO) {
|
|
||||||
LoginRequest request = new LoginRequest();
|
|
||||||
request.setUserName(requestDTO.getAccount());
|
|
||||||
request.setMerchantCode(requestDTO.getAgentId());
|
|
||||||
if (requestDTO.getPlatform().equalsIgnoreCase("web")) {
|
|
||||||
request.setTerminal("pc");
|
|
||||||
} else {
|
|
||||||
request.setTerminal("mobile");
|
|
||||||
}
|
|
||||||
request.setLanguage(requestDTO.getLang());
|
|
||||||
request.setCurrency(requestDTO.getCurrency());
|
|
||||||
|
|
||||||
request.buildSignature(requestDTO.getAgentKey());
|
|
||||||
|
|
||||||
LoginResponse response = dbSportsClient.login(
|
|
||||||
request, IdUtils.fastUUID()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (this.isSuccess(response.getCode())) {
|
|
||||||
LoginResponse.LoginRespDTO respDTO = response.getData();
|
|
||||||
|
|
||||||
String loginURL = respDTO.getLoginUrl();
|
|
||||||
if (StringUtils.isEmpty(loginURL)) {
|
|
||||||
throw new ApiException(ErrorCode.Get_Url_Failure.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
return loginURL;
|
|
||||||
}
|
|
||||||
throw new ApiException(ErrorCode.Get_Url_Failure.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取游戏列表
|
|
||||||
*
|
|
||||||
* @param gamesBaseRequestDTO 游戏请求dto
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
@Transactional
|
|
||||||
@Override
|
|
||||||
public String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO) {
|
|
||||||
|
|
||||||
Platform platform = gamesBaseRequestDTO.getVendor();
|
|
||||||
Game condition = new Game();
|
|
||||||
condition.setPlatformCode(platform.getPlatformCode());
|
|
||||||
condition.setPlatformType(PlatformType.SPORTS.getCode());
|
|
||||||
List<Game> gameList = gameService.selectGameList(condition);
|
|
||||||
//不存在这个游戏
|
|
||||||
if (ObjectUtils.isEmpty(gameList)) {
|
|
||||||
Game game = new Game();
|
|
||||||
game.setId(IdUtil.getSnowflakeNextId());
|
|
||||||
game.setSortNo(1);
|
|
||||||
game.setPlatformCode(platform.getPlatformCode());
|
|
||||||
game.setPlatformType(PlatformType.SPORTS.getCode());
|
|
||||||
game.setGameCode("1");
|
|
||||||
game.setGameSourceType(String.valueOf(1));
|
|
||||||
game.setGameName(GamePlatforms.DBSports.getInfo());
|
|
||||||
game.setCreateBy(Constants.SYSTEM);
|
|
||||||
NameInfo nameInfo = new NameInfo();
|
|
||||||
nameInfo.setLang("zh-CN");
|
|
||||||
nameInfo.setName("DB体育");
|
|
||||||
game.setNameInfo(Collections.singletonList(nameInfo));
|
|
||||||
gameService.insertGame(game);
|
|
||||||
}
|
|
||||||
/*GameName gameName = gameNameService.selectGameNameById(GAME_NAME_ID);
|
|
||||||
if (ObjectUtils.isEmpty(gameName)) {
|
|
||||||
gameNameService.insertGameName(GameName.builder()
|
|
||||||
.id(GAME_NAME_ID)
|
|
||||||
.gameId(game.getId())
|
|
||||||
.gameName(game.getGameName())
|
|
||||||
.langCode("zh-CN")
|
|
||||||
.createBy(Constants.SYSTEM)
|
|
||||||
.build());
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return CacheConstants.DB_Sports;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 汇兑转移状态
|
|
||||||
*
|
|
||||||
* @param requestDTO 兑换转账请求dto
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ExchangeTransferStatusResponseDTO exchangeTransferStatus(ExchangeTransferStatusRequestDTO requestDTO) {
|
|
||||||
|
|
||||||
GameExchangeMoney gameExchangeMoney = gameExchangeMoneyService.selectGameExchangeMoneyById(requestDTO.getGameExchangeMoneyId());
|
|
||||||
if (null == gameExchangeMoney) {
|
|
||||||
throw new ApiException(ErrorCode.Transfer_Not_Exist.getCode());
|
|
||||||
}
|
|
||||||
Integer status = StatusType.IN_PROGRESS.getValue();
|
|
||||||
|
|
||||||
if (!Objects.equals(gameExchangeMoney.getStatus(), StatusType.SUCCESS.getValue())) {
|
|
||||||
TransferDetailRequest request = new TransferDetailRequest();
|
|
||||||
request.setMerchantCode(requestDTO.getAgentId());
|
|
||||||
request.setTransferId(gameExchangeMoney.getOrderId());
|
|
||||||
request.buildSignature(requestDTO.getAgentKey());
|
|
||||||
TransferDetailResponse response = dbSportsClient.transferDetail(
|
|
||||||
request, IdUtils.fastUUID()
|
|
||||||
);
|
|
||||||
if (this.isSuccess(response.getCode()) && response.getData().getStatus() == 1) {
|
|
||||||
status = StatusType.SUCCESS.getValue();
|
|
||||||
} else {
|
|
||||||
status = StatusType.FAILURE.getValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ExchangeTransferStatusResponseDTO.builder()
|
|
||||||
.statusType(status)
|
|
||||||
.balance(gameExchangeMoney.getBalance())
|
|
||||||
.coinBefore(gameExchangeMoney.getCoinBefore())
|
|
||||||
.coinAfter(gameExchangeMoney.getCoinAfter())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按时间获取投注记录
|
|
||||||
*
|
|
||||||
* @param requestDTO 按时间dto投注记录
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean getBetRecordByTime(BetRecordByTimeDTO requestDTO) {
|
|
||||||
|
|
||||||
this.getRealtimeRecord(requestDTO, 1);
|
|
||||||
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void getRealtimeRecord(BetRecordByTimeDTO requestDTO, int pageNum) {
|
|
||||||
|
|
||||||
GetBetListRequest request = new GetBetListRequest();
|
|
||||||
request.setStartTime(String.valueOf(requestDTO.getStartTime()));
|
|
||||||
request.setEndTime(String.valueOf(requestDTO.getEndTime()));
|
|
||||||
request.setMerchantCode(requestDTO.getAgentId());
|
|
||||||
request.setPageNum(pageNum);
|
|
||||||
request.setPageSize(1000);
|
|
||||||
request.buildSignature(requestDTO.getAgentKey());
|
|
||||||
|
|
||||||
GetBetListResponse response = dbSportsClient.getBetList(
|
|
||||||
request, IdUtils.fastUUID()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (this.isSuccess(response.getCode())) {
|
|
||||||
List<GetBetListResponse.OrderItemDTO> list = response.getData().getList();
|
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.batchInsert(list, requestDTO);
|
|
||||||
getRealtimeRecord(requestDTO, ++pageNum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按历史时间获取投注记录
|
|
||||||
*
|
|
||||||
* @param requestDTO 按时间dto投注记录
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean getBetRecordByHistoryTime(BetRecordByTimeDTO requestDTO) {
|
|
||||||
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 赠送免费局数
|
|
||||||
*
|
|
||||||
* @param createFreeSpinRequest 创建自由旋转请求
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean createFreeSpin(CreateFreeSpinRequestDTO createFreeSpinRequest) {
|
|
||||||
throw new BaseException("暂不支持免费局数");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取游戏详细信息
|
|
||||||
*
|
|
||||||
* @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) {
|
|
||||||
|
|
||||||
KickUserRequest request = new KickUserRequest();
|
|
||||||
request.setUserName(kickMemberRequestDTO.getAccount());
|
|
||||||
request.setMerchantCode(kickMemberRequestDTO.getAgentId());
|
|
||||||
request.buildSignature(kickMemberRequestDTO.getAgentKey());
|
|
||||||
KickUserResponse kickUserResponse = dbSportsClient.kickUser(request, IdUtils.fastUUID());
|
|
||||||
if (this.isSuccess(kickUserResponse.getCode())) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 踢成员全部
|
|
||||||
*
|
|
||||||
* @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 gameDemoLoginRequestDTO 游戏演示登录请求dto
|
|
||||||
* @return {@link GameDemoLoginResponseDTO }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameDemoLoginResponseDTO gameDemoLogin(GameDemoLoginRequestDTO gameDemoLoginRequestDTO) {
|
|
||||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量插入
|
|
||||||
*
|
|
||||||
* @param settledOrderList 投注记录
|
|
||||||
*/
|
|
||||||
private void batchInsert(List<GetBetListResponse.OrderItemDTO> settledOrderList, BetRecordByTimeDTO betRecordByTimeDTO) {
|
|
||||||
List<GameBettingDetails> gameBettingDetails = new ArrayList<>();
|
|
||||||
List<String> wagersIds = new ArrayList<>();
|
|
||||||
//数据组装
|
|
||||||
List<GetBetListResponse.OrderItemDTO> dataList = settledOrderList;
|
|
||||||
if (CollectionUtils.isEmpty(dataList)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//数据转化
|
|
||||||
for (GetBetListResponse.OrderItemDTO dataBean : dataList) {
|
|
||||||
if (dataBean.getOrderStatus() != 1) { // 只关心结算的
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
GameBettingDetails bettingDetails = this.dataBuild(GamesDataBuildDTO.builder()
|
|
||||||
.platform(betRecordByTimeDTO.getVendor())
|
|
||||||
.data(dataBean).build());
|
|
||||||
if (!ObjectUtils.isEmpty(bettingDetails)) {
|
|
||||||
bettingDetails.setId(IdUtil.getSnowflakeNextId());
|
|
||||||
gameBettingDetails.add(bettingDetails);
|
|
||||||
}
|
|
||||||
wagersIds.add(dataBean.getOrderNo());
|
|
||||||
}
|
|
||||||
if (CollectionUtils.isEmpty(gameBettingDetails)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//查询重复数据id
|
|
||||||
List<String> removeWagersIds = gameBettingDetailsService
|
|
||||||
.selectGameBettingDetailsByWagersId(wagersIds, GamePlatforms.DBSports.getCode());
|
|
||||||
//用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) {
|
|
||||||
|
|
||||||
//转化类
|
|
||||||
GetBetListResponse.OrderItemDTO dataBean = (GetBetListResponse.OrderItemDTO) gamesDataBuildDTO.getData();
|
|
||||||
Member member = memberService.selectMemberByGameAccount(dataBean.getUserName());
|
|
||||||
if (ObjectUtils.isEmpty(member)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
//List<Game> gameList = redisCache.getCacheList(CacheConstants.DB_Sports);
|
|
||||||
//Game game = gameList.get(0);
|
|
||||||
BigDecimal originPayoffAmount = BigDecimal.valueOf(dataBean.getSettleAmount());
|
|
||||||
BigDecimal betAmount = new BigDecimal(dataBean.getOrderAmount());
|
|
||||||
|
|
||||||
int compareResult = originPayoffAmount.compareTo(betAmount);
|
|
||||||
long payoffTime = dataBean.getSettleTime();
|
|
||||||
long createTime = dataBean.getCreateTime();
|
|
||||||
Platform platform = gamesDataBuildDTO.getPlatform();
|
|
||||||
String systemCurrency = platform.getOurCurrency(dataBean.getCurrency());
|
|
||||||
//数据构造
|
|
||||||
GameBettingDetails gameBettingDetails = GameBettingDetails.builder()
|
|
||||||
.tenantKey(member.getTenantKey())
|
|
||||||
//保存我们的币种id
|
|
||||||
.currencyCode(systemCurrency)
|
|
||||||
.memberId(member.getId())
|
|
||||||
.gameCode("1")
|
|
||||||
.gameType(PlatformType.SPORTS.getCode()) // 体育
|
|
||||||
.platformCode(GamePlatforms.DBSports.getCode())
|
|
||||||
.gameId(GamePlatforms.DBSports.getCode() + "_1")
|
|
||||||
.gameName(GamePlatforms.DBSports.getInfo())
|
|
||||||
.gameStatus(compareResult > 0 ? GameStatus.WIN.getCode() : compareResult < 0 ? GameStatus.FAIL.getCode() : GameStatus.FLAT.getCode())
|
|
||||||
.gameStatusType(1) // 一般下注
|
|
||||||
.gameCurrencyCode(dataBean.getCurrency())
|
|
||||||
.account(dataBean.getUserName())
|
|
||||||
.wagersId(dataBean.getOrderNo())
|
|
||||||
.wagersTime(createTime)
|
|
||||||
.betAmount(betAmount)
|
|
||||||
.payoffTime(payoffTime)
|
|
||||||
.payoffAmount(originPayoffAmount.abs())
|
|
||||||
.settlementTime(payoffTime)
|
|
||||||
.turnover(betAmount)
|
|
||||||
.orderNo(dataBean.getOrderNo())
|
|
||||||
.settlementStatus(SettlementStatusEnum.COMPLETED.getCode())
|
|
||||||
.build();
|
|
||||||
gameBettingDetails.setCreateBy(Constants.SYSTEM);
|
|
||||||
gameBettingDetails.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return gameBettingDetails;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -3,8 +3,8 @@ package com.ff.game.api.dg.address;
|
||||||
import com.dtflys.forest.callback.AddressSource;
|
import com.dtflys.forest.callback.AddressSource;
|
||||||
import com.dtflys.forest.http.ForestAddress;
|
import com.dtflys.forest.http.ForestAddress;
|
||||||
import com.dtflys.forest.http.ForestRequest;
|
import com.dtflys.forest.http.ForestRequest;
|
||||||
import com.ff.base.enums.GamePlatforms;
|
import com.ff.base.constant.Constants;
|
||||||
import com.ff.game.service.IPlatformService;
|
import com.ff.base.system.service.ISysConfigService;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
@ -20,12 +20,12 @@ import javax.annotation.Resource;
|
||||||
public class MyDGAddressSource implements AddressSource {
|
public class MyDGAddressSource implements AddressSource {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IPlatformService platformService;
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ForestAddress getAddress(ForestRequest request) {
|
public ForestAddress getAddress(ForestRequest request) {
|
||||||
String apiBaseUrl = platformService.get(GamePlatforms.DG.getCode())
|
String apiBaseUrl = configService.selectConfigByKey(Constants.DG_API_BASE_URL);
|
||||||
.getUrlInfo().getUrl();
|
|
||||||
return new ForestAddress("http",apiBaseUrl, 80,"");
|
return new ForestAddress("http",apiBaseUrl, 80,"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -55,16 +55,6 @@ public interface DGClient {
|
||||||
@Post(url = "/v2/api/transfer")
|
@Post(url = "/v2/api/transfer")
|
||||||
DGTransactionResponseDTO exchangeTransferByAgentId(@JSONBody Map<String, Object> params, @Header Map<String, Object> header);
|
DGTransactionResponseDTO exchangeTransferByAgentId(@JSONBody Map<String, Object> params, @Header Map<String, Object> header);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 汇兑转移状态
|
|
||||||
*
|
|
||||||
* @param params 参数
|
|
||||||
* @param header 头球
|
|
||||||
* @return {@link DGTransactionResponseDTO }
|
|
||||||
*/
|
|
||||||
@Post(url = "/v2/api/checkTransfer")
|
|
||||||
DGTransactionResponseDTO exchangeTransferStatus(@JSONBody Map<String, Object> params, @Header Map<String, Object> header);
|
|
||||||
/**
|
/**
|
||||||
* 按时间获取投注记录
|
* 按时间获取投注记录
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -4,24 +4,30 @@ import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import com.ff.base.constant.CacheConstants;
|
import com.ff.base.constant.CacheConstants;
|
||||||
import com.ff.base.constant.Constants;
|
import com.ff.base.constant.Constants;
|
||||||
|
import com.ff.base.core.redis.RedisCache;
|
||||||
import com.ff.base.enums.*;
|
import com.ff.base.enums.*;
|
||||||
import com.ff.base.exception.base.ApiException;
|
import com.ff.base.exception.base.ApiException;
|
||||||
import com.ff.base.exception.base.BaseException;
|
import com.ff.base.exception.base.BaseException;
|
||||||
|
import com.ff.base.system.service.ISysConfigService;
|
||||||
import com.ff.base.utils.DateUtils;
|
import com.ff.base.utils.DateUtils;
|
||||||
|
import com.ff.base.utils.JsonUtil;
|
||||||
import com.ff.base.utils.SleepUtil;
|
import com.ff.base.utils.SleepUtil;
|
||||||
import com.ff.base.utils.StringUtils;
|
import com.ff.base.utils.StringUtils;
|
||||||
import com.ff.base.utils.sign.Md5Utils;
|
import com.ff.base.utils.sign.Md5Utils;
|
||||||
import com.ff.base.utils.uuid.IdUtils;
|
import com.ff.base.utils.uuid.IdUtils;
|
||||||
import com.ff.config.KeyConfig;
|
import com.ff.config.KeyConfig;
|
||||||
import com.ff.game.api.IGamesService;
|
import com.ff.game.api.IGamesService;
|
||||||
import com.ff.game.api.ae.dto.AEExchangeTransferStatusResponse;
|
|
||||||
import com.ff.game.api.dg.client.DGClient;
|
import com.ff.game.api.dg.client.DGClient;
|
||||||
import com.ff.game.api.dg.dto.*;
|
import com.ff.game.api.dg.dto.*;
|
||||||
|
import com.ff.game.api.ng.dto.ApiLoginResponseDTO;
|
||||||
|
import com.ff.game.api.ng.dto.ApiMemberInfoResponseDTO;
|
||||||
|
import com.ff.game.api.ng.dto.ApiNGResponseDTO;
|
||||||
import com.ff.game.api.request.*;
|
import com.ff.game.api.request.*;
|
||||||
|
import com.ff.game.api.xk.client.XKClient;
|
||||||
|
import com.ff.game.api.xk.dto.*;
|
||||||
import com.ff.game.domain.*;
|
import com.ff.game.domain.*;
|
||||||
import com.ff.game.service.IGameBettingDetailsService;
|
import com.ff.game.dto.GameSecretKeyCurrencyDTO;
|
||||||
import com.ff.game.service.IGameExchangeMoneyService;
|
import com.ff.game.service.*;
|
||||||
import com.ff.game.service.IGameService;
|
|
||||||
import com.ff.member.domain.Member;
|
import com.ff.member.domain.Member;
|
||||||
import com.ff.member.service.IMemberService;
|
import com.ff.member.service.IMemberService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -34,6 +40,7 @@ import org.springframework.util.ObjectUtils;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -47,9 +54,21 @@ import java.util.stream.Collectors;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class GamesDGServiceImpl implements IGamesService {
|
public class GamesDGServiceImpl implements IGamesService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisCache redisCache;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
private IGameExchangeMoneyService gameExchangeMoneyService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGamePlatformService gamePlatformService;
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IGameService gameService;
|
private IGameService gameService;
|
||||||
|
|
||||||
|
|
@ -57,20 +76,42 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
@Resource
|
@Resource
|
||||||
private IMemberService memberService;
|
private IMemberService memberService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGameFreeRecordService gameFreeRecordService;
|
||||||
|
@Resource
|
||||||
|
private IGameSecretKeyService gameSecretKeyService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGameSecretKeyCurrencyService gameSecretKeyCurrencyService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DGClient DGClient;
|
private DGClient DGClient;
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private KeyConfig keyConfig;
|
private KeyConfig keyConfig;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IGameBettingDetailsService gameBettingDetailsService;
|
private IGameBettingDetailsService gameBettingDetailsService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IGameNameService gameNameService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 游戏id
|
* 游戏id
|
||||||
*/
|
*/
|
||||||
private static final Long GAME_ID = 1904452832756003817L;
|
private static final Long GAME_ID = 1904452832756003817L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台ID
|
||||||
|
*/
|
||||||
|
private static final Long PLATFORM_ID = 1904411420157108325L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏名称id
|
||||||
|
*/
|
||||||
|
private static final Long GAME_NAME_ID = 1904452832756002317L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得就是成功
|
* 获得就是成功
|
||||||
|
|
@ -188,44 +229,41 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO) {
|
public String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO) {
|
||||||
|
GamePlatform gamePlatform = gamePlatformService.selectGamePlatformById(PLATFORM_ID);
|
||||||
|
//没有此平台就新增一个平台
|
||||||
|
if (ObjectUtils.isEmpty(gamePlatform)) {
|
||||||
|
gamePlatform = new GamePlatform();
|
||||||
|
gamePlatform.setPlatformCode(GamePlatforms.DG.getInfo());
|
||||||
|
gamePlatform.setPlatformType(PlatformType.CARD_GAME.getCode());
|
||||||
|
gamePlatform.setPlatformName(GamePlatforms.DG.getInfo() + PlatformType.CARD_GAME.getName());
|
||||||
|
gamePlatform.setSortNo(gamePlatformService.selectMaxSortNo() + 1);
|
||||||
|
gamePlatform.setCreateBy(Constants.SYSTEM);
|
||||||
|
gamePlatformService.insertGamePlatform(gamePlatform);
|
||||||
|
}
|
||||||
Game game = gameService.selectGameById(GAME_ID);
|
Game game = gameService.selectGameById(GAME_ID);
|
||||||
//不存在这个游戏
|
//不存在这个游戏
|
||||||
if (ObjectUtils.isEmpty(game)) {
|
if (ObjectUtils.isEmpty(game)) {
|
||||||
game = new Game();
|
game = new Game();
|
||||||
game.setId(GAME_ID);
|
game.setSortNo(gameService.selectMaxSortNoByPlatformId(gamePlatform.getId()) + 1);
|
||||||
game.setSortNo(1);
|
game.setPlatformId(gamePlatform.getId());
|
||||||
game.setPlatformCode(GamePlatforms.DG.getCode());
|
|
||||||
game.setPlatformType(PlatformType.VIDEO.getCode());
|
|
||||||
game.setGameCode("1");
|
game.setGameCode("1");
|
||||||
game.setGameSourceType(String.valueOf(1));
|
game.setGameSourceType(1);
|
||||||
game.setGameName("真人棋牌");
|
game.setGameName("真人棋牌");
|
||||||
game.setCreateBy(Constants.SYSTEM);
|
game.setCreateBy(Constants.SYSTEM);
|
||||||
game.setNameInfo(Collections.singletonList(new NameInfo("真人棋牌", "zh-CN")));
|
|
||||||
game.setGameId(StringUtils.addSuffix(GamePlatforms.DG.getCode(), 1));
|
|
||||||
gameService.insertGame(game);
|
gameService.insertGame(game);
|
||||||
}else {
|
}
|
||||||
game.setNameInfo(Collections.singletonList(new NameInfo("真人棋牌", "zh-CN")));
|
GameName gameName = gameNameService.selectGameNameById(GAME_NAME_ID);
|
||||||
gameService.updateGame(game);
|
if (ObjectUtils.isEmpty(gameName)) {
|
||||||
|
gameNameService.insertGameName(GameName.builder()
|
||||||
|
.gameId(game.getId())
|
||||||
|
.gameName(game.getGameName())
|
||||||
|
.langCode("zh-CN")
|
||||||
|
.createBy(Constants.SYSTEM)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
return CacheConstants.DG_GAMES;
|
return CacheConstants.DG_GAMES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取交易id
|
|
||||||
*
|
|
||||||
* @param transactionIdRequestDTO 事务id请求dto
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
|
||||||
return GamePlatforms.DG.getInfo() + IdUtils.simpleUUID();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按代理id进行交换转账
|
* 按代理id进行交换转账
|
||||||
*
|
*
|
||||||
|
|
@ -236,16 +274,41 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
@Transactional
|
@Transactional
|
||||||
public Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO) {
|
public Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO) {
|
||||||
log.info("GamesDGServiceImpl [exchangeTransferByAgentId] 请求参数 {}", exchangeTransferMoneyRequestDTO);
|
log.info("GamesDGServiceImpl [exchangeTransferByAgentId] 请求参数 {}", exchangeTransferMoneyRequestDTO);
|
||||||
|
GameSecretKeyCurrency currencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
|
.platformCode(GamePlatforms.DG.getInfo())
|
||||||
|
.code(exchangeTransferMoneyRequestDTO.getAgentId())
|
||||||
|
.build());
|
||||||
|
|
||||||
|
Member member = memberService.selectMemberByGameAccount(exchangeTransferMoneyRequestDTO.getAccount());
|
||||||
|
String transactionId = GamePlatforms.DG.getInfo() + IdUtils.simpleUUID();
|
||||||
|
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(
|
||||||
|
GameExchangeMoney.builder()
|
||||||
|
.tenantKey(exchangeTransferMoneyRequestDTO.getTenantKey())
|
||||||
|
.orderId(exchangeTransferMoneyRequestDTO.getOrderId())
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
Assert.isTrue(CollectionUtils.isEmpty(gameExchangeMonies), "订单号重复");
|
||||||
|
|
||||||
GameExchangeMoney exchangeMoney = gameExchangeMoneyService.selectGameExchangeMoneyById(exchangeTransferMoneyRequestDTO.getGameExchangeId());
|
//获取下一个自增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.DG.getInfo())
|
||||||
|
.build();
|
||||||
|
exchangeMoney.setCreateBy(Constants.SYSTEM);
|
||||||
|
|
||||||
BigDecimal amount = exchangeTransferMoneyRequestDTO.getAmount();
|
BigDecimal amount = exchangeTransferMoneyRequestDTO.getAmount();
|
||||||
if (TransferType.ALL.getCode().equals(exchangeTransferMoneyRequestDTO.getTransferType())) {
|
if (TransferType.ALL.getCode().equals(exchangeTransferMoneyRequestDTO.getTransferType())) {
|
||||||
// 获取第三方钱包余额
|
// 获取第三方钱包余额
|
||||||
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
|
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
|
||||||
.accounts(exchangeTransferMoneyRequestDTO.getAccount())
|
.accounts(member.getGameAccount())
|
||||||
.agentId(exchangeTransferMoneyRequestDTO.getAgentId())
|
.agentId(exchangeTransferMoneyRequestDTO.getAgentId())
|
||||||
.currency(exchangeTransferMoneyRequestDTO.getCurrency())
|
.currency(exchangeTransferMoneyRequestDTO.getCurrency())
|
||||||
.agentKey(exchangeTransferMoneyRequestDTO.getAgentKey())
|
.agentKey(exchangeTransferMoneyRequestDTO.getAgentKey())
|
||||||
|
|
@ -258,7 +321,7 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
Map<String, Object> params = new LinkedHashMap<>();
|
||||||
params.put("username", exchangeTransferMoneyRequestDTO.getAccount());
|
params.put("username", exchangeTransferMoneyRequestDTO.getAccount());
|
||||||
params.put("amount", amount);
|
params.put("amount", amount);
|
||||||
params.put("serial", exchangeTransferMoneyRequestDTO.getTransactionId());
|
params.put("serial", transactionId);
|
||||||
|
|
||||||
Map<String, Object> headerMap = this.getKey(exchangeTransferMoneyRequestDTO);
|
Map<String, Object> headerMap = this.getKey(exchangeTransferMoneyRequestDTO);
|
||||||
DGTransactionResponseDTO dgTransactionResponseDTO = DGClient.exchangeTransferByAgentId(params, headerMap);
|
DGTransactionResponseDTO dgTransactionResponseDTO = DGClient.exchangeTransferByAgentId(params, headerMap);
|
||||||
|
|
@ -271,14 +334,10 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
exchangeMoney.setCoinAfter(dgTransactionResponseDTO.getBalance());
|
exchangeMoney.setCoinAfter(dgTransactionResponseDTO.getBalance());
|
||||||
exchangeMoney.setCurrencyBefore(exchangeMoney.getCoinBefore());
|
exchangeMoney.setCurrencyBefore(exchangeMoney.getCoinBefore());
|
||||||
exchangeMoney.setCurrencyAfter(exchangeMoney.getCoinAfter());
|
exchangeMoney.setCurrencyAfter(exchangeMoney.getCoinAfter());
|
||||||
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
exchangeMoney.setStatus(StatusType.SUCCESS.getValue());
|
||||||
exchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
gameExchangeMoneyService.insertGameExchangeMoney(exchangeMoney);
|
||||||
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
|
||||||
} else {
|
} else {
|
||||||
exchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
log.error("GamesXKServiceImpl [exchangeTransferByAgentId] 金额转移失败,错误代码{},错误信息{}", dgTransactionResponseDTO.getCodeId(), dgTransactionResponseDTO.getMsg());
|
||||||
exchangeMoney.setStepStatus(GameExchangeStepStatus.FAILURE.getCode());
|
|
||||||
gameExchangeMoneyService.updateGameExchangeMoney(exchangeMoney);
|
|
||||||
log.error("GamesDGServiceImpl [exchangeTransferByAgentId] 金额转移失败,错误代码{},错误信息{}", dgTransactionResponseDTO.getCodeId(), dgTransactionResponseDTO.getMsg());
|
|
||||||
throw new ApiException(ErrorCode.BALANCE_TRANSFER_FAILED.getCode());
|
throw new ApiException(ErrorCode.BALANCE_TRANSFER_FAILED.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -289,31 +348,11 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
* 汇兑转移状态
|
* 汇兑转移状态
|
||||||
*
|
*
|
||||||
* @param exchangeTransferMoneyRequestDTO 兑换转账请求dto
|
* @param exchangeTransferMoneyRequestDTO 兑换转账请求dto
|
||||||
* @return {@link ExchangeTransferStatusResponseDTO }
|
* @return {@link Boolean }
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ExchangeTransferStatusResponseDTO exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO) {
|
public Boolean exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO) {
|
||||||
log.info("GamesDGServiceImpl [exchangeTransferStatus] 请求参数 {}", exchangeTransferMoneyRequestDTO);
|
return Boolean.TRUE;
|
||||||
|
|
||||||
Map<String, Object> params = new LinkedHashMap<>();
|
|
||||||
params.put("serial", exchangeTransferMoneyRequestDTO.getOrderId());
|
|
||||||
|
|
||||||
Map<String, Object> headerMap = this.getKey(exchangeTransferMoneyRequestDTO);
|
|
||||||
|
|
||||||
DGTransactionResponseDTO dgTransactionResponseDTO = DGClient.exchangeTransferStatus(params, headerMap);
|
|
||||||
Integer status = StatusType.IN_PROGRESS.getValue();
|
|
||||||
if (this.getIsSuccess(dgTransactionResponseDTO.getCodeId())) {
|
|
||||||
status = StatusType.SUCCESS.getValue();
|
|
||||||
} else {
|
|
||||||
status = StatusType.FAILURE.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ExchangeTransferStatusResponseDTO.builder()
|
|
||||||
.statusType(status)
|
|
||||||
.balance(dgTransactionResponseDTO.getAmount().abs())
|
|
||||||
.coinBefore(NumberUtil.sub(dgTransactionResponseDTO.getBalance(), dgTransactionResponseDTO.getAmount().abs()).abs())
|
|
||||||
.coinAfter(dgTransactionResponseDTO.getBalance())
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -325,7 +364,6 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean getBetRecordByTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
public Boolean getBetRecordByTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
||||||
SleepUtil.sleep(50000);
|
|
||||||
//请求参数
|
//请求参数
|
||||||
log.info("GamesDGServiceImpl [getBetRecordByTime] 请求参数 {}", betRecordByTimeDTO);
|
log.info("GamesDGServiceImpl [getBetRecordByTime] 请求参数 {}", betRecordByTimeDTO);
|
||||||
Map<String, Object> key = this.getKey(betRecordByTimeDTO);
|
Map<String, Object> key = this.getKey(betRecordByTimeDTO);
|
||||||
|
|
@ -333,9 +371,11 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
|
|
||||||
if (this.getIsSuccess(betRecordByTime.getCodeId())) {
|
if (this.getIsSuccess(betRecordByTime.getCodeId())) {
|
||||||
this.batchInsert(betRecordByTime,betRecordByTimeDTO);
|
this.batchInsert(betRecordByTime,betRecordByTimeDTO);
|
||||||
|
|
||||||
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
} else {
|
} else {
|
||||||
log.error("GamesDGServiceImpl [getBetRecordByTime] 获取投注记录失败,错误代码{},错误信息{}", betRecordByTime.getCodeId(), betRecordByTime.getMsg());
|
log.error("GamesXKServiceImpl [getBetRecordByTime] 获取投注记录失败,错误代码{},错误信息{}", betRecordByTime.getCodeId(), betRecordByTime.getMsg());
|
||||||
throw new BaseException(betRecordByTime.getMsg());
|
throw new BaseException(betRecordByTime.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -350,7 +390,7 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean getBetRecordByHistoryTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
public Boolean getBetRecordByHistoryTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
||||||
return Boolean.FALSE;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -458,18 +498,6 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏演示登录
|
|
||||||
*
|
|
||||||
* @param gameDemoLoginRequestDTO 游戏演示登录请求dto
|
|
||||||
* @return {@link GameDemoLoginResponseDTO }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameDemoLoginResponseDTO gameDemoLogin(GameDemoLoginRequestDTO gameDemoLoginRequestDTO) {
|
|
||||||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消赠送免费局数
|
* 取消赠送免费局数
|
||||||
*
|
*
|
||||||
|
|
@ -494,9 +522,7 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
List<DGBetRecordResponseDTO.ReportDTO> report = dgBetRecordResponseDTO.getList();
|
List<DGBetRecordResponseDTO.ReportDTO> report = dgBetRecordResponseDTO.getList();
|
||||||
//数据转化
|
//数据转化
|
||||||
for (DGBetRecordResponseDTO.ReportDTO bean : report) {
|
for (DGBetRecordResponseDTO.ReportDTO bean : report) {
|
||||||
GameBettingDetails bettingDetails = this.dataBuild(GamesDataBuildDTO.builder()
|
GameBettingDetails bettingDetails = this.dataBuild(GamesDataBuildDTO.builder().data(bean).build());
|
||||||
.platform(gamesBaseRequestDTO.getVendor())
|
|
||||||
.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);
|
||||||
|
|
@ -505,7 +531,7 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
}
|
}
|
||||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
||||||
//查询重复数据id
|
//查询重复数据id
|
||||||
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds, GamePlatforms.DG.getInfo());
|
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds);
|
||||||
//用steam流清除list中与wagersIds集合相同的数据
|
//用steam流清除list中与wagersIds集合相同的数据
|
||||||
gameBettingDetails = gameBettingDetails.stream()
|
gameBettingDetails = gameBettingDetails.stream()
|
||||||
.filter(detail -> !removeWagersIds.contains(detail.getWagersId()))
|
.filter(detail -> !removeWagersIds.contains(detail.getWagersId()))
|
||||||
|
|
@ -533,10 +559,10 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
DGBetRecordResponseDTO.ReportDTO resultBean = (DGBetRecordResponseDTO.ReportDTO) gamesDataBuildDTO.getData();
|
DGBetRecordResponseDTO.ReportDTO resultBean = (DGBetRecordResponseDTO.ReportDTO) gamesDataBuildDTO.getData();
|
||||||
|
|
||||||
|
|
||||||
// GameSecretKeyCurrency currencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
GameSecretKeyCurrency currencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
// .platformCode(GamePlatforms.DG.getInfo())
|
.platformCode(GamePlatforms.DG.getInfo())
|
||||||
// .currencyId(String.valueOf(resultBean.getCurrencyId()))
|
.currencyId(String.valueOf(resultBean.getCurrencyId()))
|
||||||
// .build());
|
.build());
|
||||||
|
|
||||||
|
|
||||||
Member member = memberService.selectMemberByGameAccount(resultBean.getUserName());
|
Member member = memberService.selectMemberByGameAccount(resultBean.getUserName());
|
||||||
|
|
@ -566,17 +592,16 @@ public class GamesDGServiceImpl implements IGamesService {
|
||||||
GameBettingDetails gameBettingDetails = GameBettingDetails.builder()
|
GameBettingDetails gameBettingDetails = GameBettingDetails.builder()
|
||||||
.tenantKey(member.getTenantKey())
|
.tenantKey(member.getTenantKey())
|
||||||
//保存我们的币种id
|
//保存我们的币种id
|
||||||
.currencyCode(gamesDataBuildDTO.getPlatform().getExtInfo().getOurCurrency(String.valueOf(resultBean.getCurrencyId())))
|
.currencyCode(currencyDTO.getSystemCurrency())
|
||||||
.memberId(member.getId())
|
.memberId(member.getId())
|
||||||
.gameCode(String.valueOf(resultBean.getGameId()))
|
.gameCode(String.valueOf(resultBean.getGameId()))
|
||||||
.gameType(PlatformType.CARD_GAME.getCode())
|
.gameType(PlatformType.CARD_GAME.getCode())
|
||||||
.platformCode(GamePlatforms.DG.getCode())
|
.platformCode(GamePlatforms.DG.getInfo())
|
||||||
//.gameId(GAME_ID)
|
.gameId(GAME_ID)
|
||||||
.gameId(game.getGameId())
|
|
||||||
.gameName(game.getGameName())
|
.gameName(game.getGameName())
|
||||||
.gameStatus(gameStatus)
|
.gameStatus(gameStatus)
|
||||||
.gameStatusType(resultBean.getGameType())
|
.gameStatusType(resultBean.getGameType())
|
||||||
.gameCurrencyCode(/*gamesDataBuildDTO.getCurrencyCode()*/String.valueOf(resultBean.getCurrencyId()))
|
.gameCurrencyCode(currencyDTO.getCurrency())
|
||||||
.account(String.valueOf(resultBean.getUserName()))
|
.account(String.valueOf(resultBean.getUserName()))
|
||||||
.wagersId(String.valueOf(resultBean.getId()))
|
.wagersId(String.valueOf(resultBean.getId()))
|
||||||
.wagersTime(resultBean.getBetTime().getTime())
|
.wagersTime(resultBean.getBetTime().getTime())
|
||||||
|
|
|
||||||
|
|
@ -1,118 +0,0 @@
|
||||||
package com.ff.game.api.exchange;
|
|
||||||
|
|
||||||
import com.ff.base.enums.GameExchangeStep;
|
|
||||||
import com.ff.base.enums.GameExchangeStepStatus;
|
|
||||||
import com.ff.base.exception.base.BaseException;
|
|
||||||
import com.ff.game.api.exchange.dto.GameExchangeDTO;
|
|
||||||
import com.ff.game.domain.GameExchangeMoney;
|
|
||||||
import com.ff.game.service.IGameExchangeMoneyService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 抽象步进处理机
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/09
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public abstract class AbstractStepProcessor implements StepProcessorService {
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private StepProcessorFactory stepProcessorFactory;
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 过程
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void process(GameExchangeDTO gameExchangeMoney) {
|
|
||||||
boolean processResult = false;
|
|
||||||
try {
|
|
||||||
processResult = doProcess(gameExchangeMoney);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("游戏余额转移{}-步骤任务{}-执行异常", gameExchangeMoney.getId(), stepKey().getDescription(), e);
|
|
||||||
throw new BaseException("游戏余额转移"+gameExchangeMoney.getId()+"-步骤任务"+stepKey().getDescription()+"-执行异常" );
|
|
||||||
}
|
|
||||||
//更新状态
|
|
||||||
if (processResult) {
|
|
||||||
log.info("游戏余额转移{}-步骤任务{}-执行成功", gameExchangeMoney.getId(), stepKey().getDescription());
|
|
||||||
triggerNextStep(gameExchangeMoney);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 降低
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void rollBack(GameExchangeDTO gameExchangeMoney){
|
|
||||||
boolean processResult = false;
|
|
||||||
try {
|
|
||||||
processResult = doRollBack(gameExchangeMoney);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("游戏余额转移{}-步骤任务{}-回滚异常", gameExchangeMoney.getId(), stepKey().getDescription(), e);
|
|
||||||
}
|
|
||||||
if (processResult) {
|
|
||||||
log.info("游戏余额转移{}-步骤任务{}-回滚成功", gameExchangeMoney.getId(), stepKey().getDescription());
|
|
||||||
triggerBackStep(gameExchangeMoney);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 触发后退
|
|
||||||
*
|
|
||||||
* @param exchangeMoney 兑换货币
|
|
||||||
*/
|
|
||||||
private void triggerBackStep(GameExchangeDTO exchangeMoney) {
|
|
||||||
GameExchangeStep nextStep = backStepProcessor();
|
|
||||||
if (nextStep != null) {
|
|
||||||
stepProcessorFactory.getStepProcessor(nextStep).rollBack(exchangeMoney);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 触发下一步
|
|
||||||
*
|
|
||||||
* @param exchangeMoney 兑换货币
|
|
||||||
*/
|
|
||||||
private void triggerNextStep(GameExchangeDTO exchangeMoney) {
|
|
||||||
GameExchangeStep nextStep = nextStepProcessor();
|
|
||||||
if (nextStep != null) {
|
|
||||||
stepProcessorFactory.getStepProcessor(nextStep).process(exchangeMoney);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一定要回滚
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
* @return boolean
|
|
||||||
* @throws Exception 例外
|
|
||||||
*/
|
|
||||||
abstract public boolean doRollBack(GameExchangeDTO gameExchangeMoney) throws Exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* do过程
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
* @return boolean
|
|
||||||
* @throws Exception 例外
|
|
||||||
*/
|
|
||||||
abstract public boolean doProcess(GameExchangeDTO gameExchangeMoney) throws Exception;
|
|
||||||
}
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
package com.ff.game.api.exchange;
|
|
||||||
|
|
||||||
import com.ff.base.enums.GameExchangeStep;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 步进处理机厂
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/09
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class StepProcessorFactory {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
List<StepProcessorService> stepProcessors;
|
|
||||||
|
|
||||||
private Map<GameExchangeStep, StepProcessorService> processorMap;
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void init() {
|
|
||||||
Map<GameExchangeStep, StepProcessorService> map = new HashMap<>();
|
|
||||||
for (StepProcessorService stepProcessor : stepProcessors) {
|
|
||||||
map.put(stepProcessor.stepKey(), stepProcessor);
|
|
||||||
}
|
|
||||||
|
|
||||||
processorMap = Collections.unmodifiableMap(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取步进处理器
|
|
||||||
*
|
|
||||||
* @param stepKey 步进键
|
|
||||||
* @return {@link StepProcessorService }
|
|
||||||
*/
|
|
||||||
public StepProcessorService getStepProcessor(GameExchangeStep stepKey) {
|
|
||||||
return processorMap.get(stepKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
package com.ff.game.api.exchange;
|
|
||||||
|
|
||||||
import com.ff.base.enums.GameExchangeStep;
|
|
||||||
import com.ff.game.api.exchange.dto.GameExchangeDTO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 步进处理机
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/09
|
|
||||||
*/
|
|
||||||
public interface StepProcessorService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回处理器类型
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
GameExchangeStep stepKey();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 过程
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
*/
|
|
||||||
void process(GameExchangeDTO gameExchangeMoney);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 回退
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
*/
|
|
||||||
void rollBack(GameExchangeDTO gameExchangeMoney);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 步骤之间有依赖
|
|
||||||
* 找出下一个步骤处理器进行处理
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
GameExchangeStep nextStepProcessor();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 步骤之间有依赖
|
|
||||||
* 找出上一个步骤处理器进行处理
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
GameExchangeStep backStepProcessor();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
package com.ff.game.api.exchange.dto;
|
|
||||||
|
|
||||||
import com.ff.base.annotation.Excel;
|
|
||||||
import com.ff.game.domain.GameExchangeMoney;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏兑换货币dto
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/09
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@SuperBuilder
|
|
||||||
public class GameExchangeDTO extends GameExchangeMoney {
|
|
||||||
/**
|
|
||||||
* 触发类型 1 用户调用手动触发 2 定时器触发
|
|
||||||
*/
|
|
||||||
private Integer triggerType;
|
|
||||||
|
|
||||||
/** 会员账号 */
|
|
||||||
private String memberAccount;
|
|
||||||
|
|
||||||
/** 游戏账号 */
|
|
||||||
private String gameAccount;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,170 +0,0 @@
|
||||||
package com.ff.game.api.exchange.impl;
|
|
||||||
|
|
||||||
import com.ff.base.constant.Constants;
|
|
||||||
import com.ff.base.enums.*;
|
|
||||||
import com.ff.base.exception.base.ApiException;
|
|
||||||
import com.ff.base.utils.StringUtils;
|
|
||||||
import com.ff.common.domain.TenantGameQuotaFlow;
|
|
||||||
import com.ff.common.dto.BalanceChangesDTO;
|
|
||||||
import com.ff.common.dto.GameBalanceExchange;
|
|
||||||
import com.ff.common.service.ITenantGameQuotaFlowService;
|
|
||||||
import com.ff.common.service.ITenantGameQuotaService;
|
|
||||||
import com.ff.game.api.IGamesService;
|
|
||||||
import com.ff.game.api.exchange.AbstractStepProcessor;
|
|
||||||
import com.ff.game.api.exchange.dto.GameExchangeDTO;
|
|
||||||
import com.ff.game.api.request.ExchangeTransferMoneyRequestDTO;
|
|
||||||
import com.ff.game.api.request.ExchangeTransferStatusRequestDTO;
|
|
||||||
import com.ff.game.api.request.ExchangeTransferStatusResponseDTO;
|
|
||||||
import com.ff.game.domain.KeyInfo;
|
|
||||||
import com.ff.game.domain.Platform;
|
|
||||||
import com.ff.game.service.IGameExchangeMoneyService;
|
|
||||||
import com.ff.game.service.IPlatformService;
|
|
||||||
import com.ff.member.domain.Member;
|
|
||||||
import com.ff.member.service.IMemberService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.core.annotation.Order;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 增加余额
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/09
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Order(4)
|
|
||||||
public class AddBalanceServiceImpl extends AbstractStepProcessor {
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IMemberService memberService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private ITenantGameQuotaService tenantGameQuotaService;
|
|
||||||
@Resource
|
|
||||||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
|
||||||
@Resource
|
|
||||||
private PlatformTransactionManager transactionManager;
|
|
||||||
@Resource
|
|
||||||
private IPlatformService platformService;
|
|
||||||
/**
|
|
||||||
* 步进键
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameExchangeStep stepKey() {
|
|
||||||
return GameExchangeStep.TENANT_QUOTA_DEDUCTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* do过程
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean doProcess(GameExchangeDTO gameExchangeMoney) {
|
|
||||||
//如果不是之前的步骤代码执行过了 或者是转入操作
|
|
||||||
if (!gameExchangeMoney.getStep().equals(GameExchangeStep.PLATFORM_TRANSACTION.getCode()) ) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
if (!gameExchangeMoney.getStepStatus().equals(StatusType.SUCCESS.getValue())){
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager);
|
|
||||||
transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
|
||||||
Boolean result = transactionTemplate.execute(transactionStatus -> {
|
|
||||||
//不是转入操作
|
|
||||||
if (!TransferType.ALL.getCode().equals(gameExchangeMoney.getExchangeType())) {
|
|
||||||
gameExchangeMoney.setStep(GameExchangeStep.DEDUCT_BALANCE.getCode());
|
|
||||||
gameExchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
|
||||||
gameExchangeMoney.setStatus(StatusType.SUCCESS.getValue());
|
|
||||||
return gameExchangeMoneyService.updateGameExchangeMoney(gameExchangeMoney) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Platform platform = platformService.get(gameExchangeMoney.getPlatformCode());
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(gameExchangeMoney.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(gameExchangeMoney.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BigDecimal decimal = tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
|
|
||||||
.platformCode(gameExchangeMoney.getPlatformCode())
|
|
||||||
.sourceId(String.valueOf(gameExchangeMoney.getId()))
|
|
||||||
.currencyCode(gameExchangeMoney.getCurrencyCode())
|
|
||||||
.currency(gameExchangeMoney.getCurrencyCode())
|
|
||||||
.transferType(gameExchangeMoney.getExchangeType())
|
|
||||||
.amount(gameExchangeMoney.getBalance())
|
|
||||||
.isAll(Boolean.FALSE)
|
|
||||||
.account(memberService.selectMemberById(gameExchangeMoney.getMemberId()).getMemberAccount())
|
|
||||||
.tenantKey(gameExchangeMoney.getTenantKey())
|
|
||||||
.systemCurrency(gameExchangeMoney.getCurrencyCode())
|
|
||||||
.agentId(keyInfo.getCode())
|
|
||||||
.agentKey(keyInfo.getKey())
|
|
||||||
.build());
|
|
||||||
|
|
||||||
gameExchangeMoney.setQuota(decimal);
|
|
||||||
gameExchangeMoney.setStep(GameExchangeStep.TENANT_QUOTA_DEDUCTED.getCode());
|
|
||||||
gameExchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
|
||||||
gameExchangeMoney.setStatus(StatusType.SUCCESS.getValue());
|
|
||||||
return gameExchangeMoneyService.updateGameExchangeMoney(gameExchangeMoney) > 0;
|
|
||||||
|
|
||||||
});
|
|
||||||
return Boolean.TRUE.equals(result);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一定要回滚 最后一步成功了就结束了
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean doRollBack(GameExchangeDTO gameExchangeMoney) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下一步处理器
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameExchangeStep nextStepProcessor() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 后级处理器 最后一步无法回滚
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameExchangeStep backStepProcessor() {
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,112 +0,0 @@
|
||||||
package com.ff.game.api.exchange.impl;
|
|
||||||
|
|
||||||
import com.ff.base.constant.Constants;
|
|
||||||
import com.ff.base.enums.*;
|
|
||||||
import com.ff.base.exception.base.ApiException;
|
|
||||||
import com.ff.base.manager.AsyncManager;
|
|
||||||
import com.ff.base.utils.DateUtils;
|
|
||||||
import com.ff.base.utils.uuid.IdUtils;
|
|
||||||
import com.ff.game.api.IGamesService;
|
|
||||||
import com.ff.game.api.exchange.AbstractStepProcessor;
|
|
||||||
import com.ff.game.api.exchange.StepProcessorFactory;
|
|
||||||
import com.ff.game.api.exchange.StepProcessorService;
|
|
||||||
import com.ff.game.api.exchange.dto.GameExchangeDTO;
|
|
||||||
import com.ff.game.api.request.ExchangeTransferStatusRequestDTO;
|
|
||||||
import com.ff.game.api.request.TransactionIdRequestDTO;
|
|
||||||
import com.ff.game.domain.GameExchangeMoney;
|
|
||||||
import com.ff.game.service.IGameExchangeMoneyService;
|
|
||||||
import com.ff.member.domain.Member;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.core.annotation.Order;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
|
||||||
import java.util.Base64;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建订单impl
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/09
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Order(1)
|
|
||||||
public class CreateOrderServiceImpl extends AbstractStepProcessor {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
|
||||||
@Resource
|
|
||||||
private StepProcessorFactory stepProcessorFactory;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private Map<String, IGamesService> gamesService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 步进键
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameExchangeStep stepKey() {
|
|
||||||
return GameExchangeStep.CREATE_ORDER;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* do过程
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean doProcess(GameExchangeDTO gameExchangeMoney) {
|
|
||||||
|
|
||||||
String transactionId = gamesService.get(gameExchangeMoney.getPlatformCode()+Constants.SERVICE).getTransactionId(TransactionIdRequestDTO.builder().exchangeType(gameExchangeMoney.getExchangeType()).gameAccount(gameExchangeMoney.getGameAccount()).build());
|
|
||||||
gameExchangeMoney.setTransactionId(transactionId);
|
|
||||||
gameExchangeMoney.setCreateBy(Constants.SYSTEM);
|
|
||||||
gameExchangeMoney.setStatus(StatusType.IN_PROGRESS.getValue());
|
|
||||||
gameExchangeMoney.setStep(GameExchangeStep.CREATE_ORDER.getCode());
|
|
||||||
gameExchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
|
||||||
return gameExchangeMoneyService.insertGameExchangeMoney(gameExchangeMoney) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一定要回滚
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean doRollBack(GameExchangeDTO gameExchangeMoney) {
|
|
||||||
gameExchangeMoney.setStep(GameExchangeStep.CREATE_ORDER.getCode());
|
|
||||||
gameExchangeMoney.setStepStatus(GameExchangeStepStatus.FAILURE.getCode());
|
|
||||||
gameExchangeMoney.setStatus(StatusType.FAILURE.getValue());
|
|
||||||
gameExchangeMoney.setUpdateBy(Constants.SYSTEM);
|
|
||||||
gameExchangeMoney.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return gameExchangeMoneyService.updateGameExchangeMoney(gameExchangeMoney) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下一步处理器
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameExchangeStep nextStepProcessor() {
|
|
||||||
return GameExchangeStep.DEDUCT_BALANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 后级处理器
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameExchangeStep backStepProcessor() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,207 +0,0 @@
|
||||||
package com.ff.game.api.exchange.impl;
|
|
||||||
|
|
||||||
import com.ff.base.constant.Constants;
|
|
||||||
import com.ff.base.enums.*;
|
|
||||||
import com.ff.base.exception.base.ApiException;
|
|
||||||
import com.ff.base.utils.DateUtils;
|
|
||||||
import com.ff.base.utils.QuotaUtils;
|
|
||||||
import com.ff.base.utils.StringUtils;
|
|
||||||
import com.ff.base.utils.uuid.IdUtils;
|
|
||||||
import com.ff.common.domain.TenantGameQuota;
|
|
||||||
import com.ff.common.domain.TenantGameQuotaFlow;
|
|
||||||
import com.ff.common.dto.BalanceChangesDTO;
|
|
||||||
import com.ff.common.dto.GameBalanceExchange;
|
|
||||||
import com.ff.common.service.ITenantGameQuotaFlowService;
|
|
||||||
import com.ff.common.service.ITenantGameQuotaService;
|
|
||||||
import com.ff.game.api.exchange.AbstractStepProcessor;
|
|
||||||
import com.ff.game.api.exchange.StepProcessorFactory;
|
|
||||||
import com.ff.game.api.exchange.dto.GameExchangeDTO;
|
|
||||||
import com.ff.game.domain.GameExchangeMoney;
|
|
||||||
import com.ff.game.domain.KeyInfo;
|
|
||||||
import com.ff.game.domain.Platform;
|
|
||||||
import com.ff.game.service.IGameExchangeMoneyService;
|
|
||||||
import com.ff.game.service.IPlatformService;
|
|
||||||
import com.ff.member.service.IMemberService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.core.annotation.Order;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
|
||||||
import org.springframework.transaction.TransactionDefinition;
|
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转入提前扣租户余额impl
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/09
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Order(2)
|
|
||||||
public class DeductBalanceServiceImpl extends AbstractStepProcessor {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private ITenantGameQuotaService tenantGameQuotaService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IMemberService memberService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IPlatformService platformService;
|
|
||||||
@Resource
|
|
||||||
private ITenantGameQuotaFlowService tenantGameQuotaFlowService;
|
|
||||||
@Autowired
|
|
||||||
private PlatformTransactionManager transactionManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 步进键
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameExchangeStep stepKey() {
|
|
||||||
return GameExchangeStep.DEDUCT_BALANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* do过程
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean doProcess(GameExchangeDTO gameExchangeMoney) {
|
|
||||||
TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager);
|
|
||||||
transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
|
||||||
Boolean result = transactionTemplate.execute(transactionStatus -> {
|
|
||||||
|
|
||||||
//如果不是之前的步骤代码执行过了
|
|
||||||
if (!gameExchangeMoney.getStep().equals(this.backStepProcessor().getCode())) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
//不是转入操作
|
|
||||||
if (!TransferType.GAMES.getCode().equals(gameExchangeMoney.getExchangeType())) {
|
|
||||||
gameExchangeMoney.setStep(GameExchangeStep.DEDUCT_BALANCE.getCode());
|
|
||||||
gameExchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
|
||||||
return gameExchangeMoneyService.updateGameExchangeMoney(gameExchangeMoney) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Platform platform = platformService.get(gameExchangeMoney.getPlatformCode());
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(gameExchangeMoney.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(gameExchangeMoney.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BigDecimal decimal = tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
|
|
||||||
.platformCode(gameExchangeMoney.getPlatformCode())
|
|
||||||
.sourceId(String.valueOf(gameExchangeMoney.getId()))
|
|
||||||
.currencyCode(gameExchangeMoney.getCurrencyCode())
|
|
||||||
.currency(gameExchangeMoney.getCurrencyCode())
|
|
||||||
.transferType(gameExchangeMoney.getExchangeType())
|
|
||||||
.amount(gameExchangeMoney.getBalance())
|
|
||||||
.account(memberService.selectMemberById(gameExchangeMoney.getMemberId()).getMemberAccount())
|
|
||||||
.tenantKey(gameExchangeMoney.getTenantKey())
|
|
||||||
.systemCurrency(gameExchangeMoney.getCurrencyCode())
|
|
||||||
.agentId(keyInfo.getCode())
|
|
||||||
.isAll(Boolean.TRUE)
|
|
||||||
.agentKey(keyInfo.getKey())
|
|
||||||
.build());
|
|
||||||
|
|
||||||
gameExchangeMoney.setQuota(decimal);
|
|
||||||
|
|
||||||
|
|
||||||
gameExchangeMoney.setStep(GameExchangeStep.DEDUCT_BALANCE.getCode());
|
|
||||||
gameExchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
|
||||||
return gameExchangeMoneyService.updateGameExchangeMoney(gameExchangeMoney) > 0;
|
|
||||||
});
|
|
||||||
return Boolean.TRUE.equals(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一定要回滚
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean doRollBack(GameExchangeDTO gameExchangeMoney) {
|
|
||||||
//如果不是之前的步骤代码执行过了 或者是转入操作
|
|
||||||
if (!gameExchangeMoney.getStep().equals(this.stepKey().getCode())) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager);
|
|
||||||
transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
|
||||||
|
|
||||||
//如果该订单已经回滚过增加余额
|
|
||||||
List<TenantGameQuotaFlow> tenantGameQuotaFlows = tenantGameQuotaFlowService.selectTenantGameQuotaFlowList(
|
|
||||||
TenantGameQuotaFlow.builder()
|
|
||||||
.sourceId(String.valueOf(gameExchangeMoney.getId()))
|
|
||||||
.isOut(Boolean.TRUE)
|
|
||||||
.build());
|
|
||||||
if (!CollectionUtils.isEmpty(tenantGameQuotaFlows)){
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tenantGameQuotaFlows = tenantGameQuotaFlowService.selectTenantGameQuotaFlowList(
|
|
||||||
TenantGameQuotaFlow.builder()
|
|
||||||
.sourceId(String.valueOf(gameExchangeMoney.getId()))
|
|
||||||
.isOut(Boolean.FALSE)
|
|
||||||
.build());
|
|
||||||
if (CollectionUtils.isEmpty(tenantGameQuotaFlows)) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
//取出第一个
|
|
||||||
TenantGameQuotaFlow tenantGameQuotaFlow = tenantGameQuotaFlows.get(0);
|
|
||||||
return tenantGameQuotaService.balanceChanges(BalanceChangesDTO.builder()
|
|
||||||
.isOut(Boolean.TRUE)
|
|
||||||
.platformCode(tenantGameQuotaFlow.getPlatformCode())
|
|
||||||
.currencyCode(tenantGameQuotaFlow.getCurrencyCode())
|
|
||||||
.tenantKey(tenantGameQuotaFlow.getTenantKey())
|
|
||||||
.balance(tenantGameQuotaFlow.getBalance())
|
|
||||||
.sourceId(tenantGameQuotaFlow.getSourceId())
|
|
||||||
.memberId(gameExchangeMoney.getMemberId())
|
|
||||||
.operationType(OperationType.API_BALANCE.getCode())
|
|
||||||
.remark(OperationType.API_BALANCE.getDescription())
|
|
||||||
.quotaType(tenantGameQuotaFlow.getQuotaType()).build());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下一步处理器
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameExchangeStep nextStepProcessor() {
|
|
||||||
return GameExchangeStep.PLATFORM_TRANSACTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 后级处理器
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameExchangeStep backStepProcessor() {
|
|
||||||
{
|
|
||||||
return GameExchangeStep.CREATE_ORDER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,214 +0,0 @@
|
||||||
package com.ff.game.api.exchange.impl;
|
|
||||||
|
|
||||||
import com.ff.base.constant.Constants;
|
|
||||||
import com.ff.base.enums.*;
|
|
||||||
import com.ff.base.exception.base.ApiException;
|
|
||||||
import com.ff.base.utils.StringUtils;
|
|
||||||
import com.ff.common.domain.TenantGameQuotaFlow;
|
|
||||||
import com.ff.common.dto.BalanceChangesDTO;
|
|
||||||
import com.ff.common.dto.GameBalanceExchange;
|
|
||||||
import com.ff.common.service.ITenantGameQuotaFlowService;
|
|
||||||
import com.ff.common.service.ITenantGameQuotaService;
|
|
||||||
import com.ff.game.api.IGamesService;
|
|
||||||
import com.ff.game.api.exchange.AbstractStepProcessor;
|
|
||||||
import com.ff.game.api.exchange.dto.GameExchangeDTO;
|
|
||||||
import com.ff.game.api.request.ExchangeTransferMoneyRequestDTO;
|
|
||||||
import com.ff.game.api.request.ExchangeTransferStatusRequestDTO;
|
|
||||||
import com.ff.game.api.request.ExchangeTransferStatusResponseDTO;
|
|
||||||
import com.ff.game.domain.GameExchangeMoney;
|
|
||||||
import com.ff.game.domain.KeyInfo;
|
|
||||||
import com.ff.game.domain.Platform;
|
|
||||||
import com.ff.game.service.IGameExchangeMoneyService;
|
|
||||||
import com.ff.game.service.IPlatformService;
|
|
||||||
import com.ff.member.domain.Member;
|
|
||||||
import com.ff.member.service.IMemberService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.core.annotation.Order;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 操作第三方扣减
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/04/09
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Order(3)
|
|
||||||
public class PlatformTransactionServiceImpl extends AbstractStepProcessor {
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IMemberService memberService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IPlatformService platformService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private Map<String, IGamesService> gamesService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 步进键
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameExchangeStep stepKey() {
|
|
||||||
return GameExchangeStep.PLATFORM_TRANSACTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* do过程
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean doProcess(GameExchangeDTO gameExchangeMoney) {
|
|
||||||
//如果不是之前的步骤代码执行过了 或者当前步骤成功的
|
|
||||||
if (!gameExchangeMoney.getStep().equals(this.backStepProcessor().getCode())&&
|
|
||||||
(GameExchangeStep.PLATFORM_TRANSACTION.getCode().equals(gameExchangeMoney.getStep())&&
|
|
||||||
gameExchangeMoney.getStepStatus().equals(GameExchangeStepStatus.SUCCESS.getCode()))
|
|
||||||
) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Platform platform = platformService.get(gameExchangeMoney.getPlatformCode());
|
|
||||||
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(gameExchangeMoney.getCurrencyCode());
|
|
||||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(gameExchangeMoney.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(gameExchangeMoney.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Member member = memberService.selectMemberById(gameExchangeMoney.getMemberId());
|
|
||||||
IGamesService iGamesService = gamesService.get(gameExchangeMoney.getPlatformCode() + Constants.SERVICE);
|
|
||||||
|
|
||||||
//查询订单详情
|
|
||||||
if (TriggerType.TIMER.getCode() == gameExchangeMoney.getTriggerType()) {
|
|
||||||
//做二次确认调订单详情接口
|
|
||||||
this.doRollBack(gameExchangeMoney);
|
|
||||||
if (GameExchangeStepStatus.FAILURE.getCode() == gameExchangeMoney.getStepStatus()){
|
|
||||||
throw new ApiException(ErrorCode.BALANCE_TRANSFER_FAILED.getCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
//操作第三方额度接口
|
|
||||||
ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO = ExchangeTransferMoneyRequestDTO.builder()
|
|
||||||
.agentId(keyInfo.getCode())
|
|
||||||
.agentKey(keyInfo.getKey())
|
|
||||||
.account(member.getGameAccount())
|
|
||||||
.currency(targetCurrency)
|
|
||||||
.amount(gameExchangeMoney.getBalance())
|
|
||||||
.transferType(gameExchangeMoney.getExchangeType())
|
|
||||||
.transactionId(gameExchangeMoney.getTransactionId())
|
|
||||||
.gameExchangeId(gameExchangeMoney.getId())
|
|
||||||
.vendor(platform)
|
|
||||||
.keyInfo(keyInfo)
|
|
||||||
.build();
|
|
||||||
Long id = iGamesService.exchangeTransferByAgentId(exchangeTransferMoneyRequestDTO);
|
|
||||||
}catch (Exception e){
|
|
||||||
//做二次确认调订单详情接口
|
|
||||||
this.doRollBack(gameExchangeMoney);
|
|
||||||
if (GameExchangeStepStatus.FAILURE.getCode() == gameExchangeMoney.getStepStatus()){
|
|
||||||
throw new ApiException(ErrorCode.BALANCE_TRANSFER_FAILED.getCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GameExchangeMoney exchangeMoney = gameExchangeMoneyService.selectGameExchangeMoneyById(gameExchangeMoney.getId());
|
|
||||||
gameExchangeMoney.setBalance(exchangeMoney.getBalance());
|
|
||||||
gameExchangeMoney.setStep(exchangeMoney.getStep());
|
|
||||||
gameExchangeMoney.setStepStatus(exchangeMoney.getStepStatus());
|
|
||||||
return gameExchangeMoneyService.updateGameExchangeMoney(gameExchangeMoney) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 一定要回滚
|
|
||||||
*
|
|
||||||
* @param gameExchangeMoney 游戏兑换货币
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean doRollBack(GameExchangeDTO gameExchangeMoney) {
|
|
||||||
|
|
||||||
Platform platform = platformService.get(gameExchangeMoney.getPlatformCode());
|
|
||||||
|
|
||||||
String targetCurrency = platform.getCurrencyInfo().get(gameExchangeMoney.getCurrencyCode());
|
|
||||||
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
|
||||||
|
|
||||||
KeyInfo keyInfo = null;
|
|
||||||
for (KeyInfo keyData : platform.getKeyInfo()) {
|
|
||||||
if (StringUtils.isNotEmpty(gameExchangeMoney.getCurrencyCode())) {
|
|
||||||
if (keyData.getCurrency().equalsIgnoreCase(gameExchangeMoney.getCurrencyCode())) {
|
|
||||||
keyInfo = keyData;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Member member = memberService.selectMemberById(gameExchangeMoney.getMemberId());
|
|
||||||
IGamesService iGamesService = gamesService.get(gameExchangeMoney.getPlatformCode() + Constants.SERVICE);
|
|
||||||
|
|
||||||
ExchangeTransferStatusRequestDTO exchangeTransferStatusRequestDTO = new ExchangeTransferStatusRequestDTO();
|
|
||||||
exchangeTransferStatusRequestDTO.setAccount(member.getGameAccount());
|
|
||||||
exchangeTransferStatusRequestDTO.setCurrency(targetCurrency);
|
|
||||||
exchangeTransferStatusRequestDTO.setOrderId(gameExchangeMoney.getTransactionId());
|
|
||||||
exchangeTransferStatusRequestDTO.setAgentId(keyInfo.getCode());
|
|
||||||
exchangeTransferStatusRequestDTO.setAgentKey(keyInfo.getKey());
|
|
||||||
exchangeTransferStatusRequestDTO.setGameExchangeMoneyId(gameExchangeMoney.getId());
|
|
||||||
exchangeTransferStatusRequestDTO.setVendor(platform);
|
|
||||||
exchangeTransferStatusRequestDTO.setKeyInfo(keyInfo);
|
|
||||||
exchangeTransferStatusRequestDTO.setSystemCurrency(gameExchangeMoney.getCurrencyCode());
|
|
||||||
ExchangeTransferStatusResponseDTO statusResponseDTO = iGamesService.exchangeTransferStatus(exchangeTransferStatusRequestDTO);
|
|
||||||
//订单已成功
|
|
||||||
if (StatusType.SUCCESS.getValue().equals(statusResponseDTO.getStatusType())) {
|
|
||||||
gameExchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
|
||||||
gameExchangeMoney.setStepStatus(GameExchangeStepStatus.SUCCESS.getCode());
|
|
||||||
return gameExchangeMoneyService.updateGameExchangeMoney(gameExchangeMoney) > 0;
|
|
||||||
}
|
|
||||||
gameExchangeMoney.setStep(GameExchangeStep.PLATFORM_TRANSACTION.getCode());
|
|
||||||
gameExchangeMoney.setStepStatus(GameExchangeStepStatus.FAILURE.getCode());
|
|
||||||
return gameExchangeMoneyService.updateGameExchangeMoney(gameExchangeMoney) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下一步处理器
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameExchangeStep nextStepProcessor() {
|
|
||||||
return GameExchangeStep.TENANT_QUOTA_DEDUCTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 后级处理器
|
|
||||||
*
|
|
||||||
* @return {@link GameExchangeStep }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameExchangeStep backStepProcessor() {
|
|
||||||
{
|
|
||||||
return GameExchangeStep.DEDUCT_BALANCE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
package com.ff.game.api.fb.address;
|
|
||||||
|
|
||||||
import com.dtflys.forest.callback.AddressSource;
|
|
||||||
import com.dtflys.forest.http.ForestAddress;
|
|
||||||
import com.dtflys.forest.http.ForestRequest;
|
|
||||||
import com.ff.base.enums.GamePlatforms;
|
|
||||||
import com.ff.game.service.IPlatformService;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <a href="https://doc.newsportspro.com/apidoc_data.html#%E5%85%A5%E5%8F%82">对接文档地址</a>
|
|
||||||
*
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class FBSportsAddress implements AddressSource {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IPlatformService platformService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ForestAddress getAddress(ForestRequest request) {
|
|
||||||
String apiBaseUrl = platformService.get(GamePlatforms.FBSports.getCode())
|
|
||||||
.getUrlInfo().getUrl();
|
|
||||||
return new ForestAddress("https", apiBaseUrl, 443, "fb/data");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,102 +0,0 @@
|
||||||
package com.ff.game.api.fb.client;
|
|
||||||
|
|
||||||
import com.dtflys.forest.annotation.*;
|
|
||||||
import com.ff.game.api.fb.address.FBSportsAddress;
|
|
||||||
import com.ff.game.api.fb.dto.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <a href="https://doc.newsportspro.com/apidoc_data.html">数据接口文档</a><br/>
|
|
||||||
* <a href="https://doc.newsportspro.com/h5_pc_doc.html">网页接入文档</a>
|
|
||||||
*
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Address(source = FBSportsAddress.class)
|
|
||||||
public interface FBSportsClient {
|
|
||||||
/**
|
|
||||||
* 创建投注用户
|
|
||||||
*
|
|
||||||
* @return {@link CreateUserResponse}
|
|
||||||
*/
|
|
||||||
@Post(url = "/api/v2/new/user/create")
|
|
||||||
CreateUserResponse createMember(@JSONBody CreateUserRequest request,
|
|
||||||
@Header("sign") @Var("sign") String sign,
|
|
||||||
@Header("timestamp") @Var("timestamp") long timestamp,
|
|
||||||
@Header("merchantId") @Var("merchantId") String merchantId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户金额转入到FB体育平台,支持两位小数,最小0.01,必须是正数
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param sign
|
|
||||||
* @param timestamp
|
|
||||||
* @param merchantId
|
|
||||||
* @return {@link TransferInResponse}
|
|
||||||
*/
|
|
||||||
@Post(url = "/api/v2/new/transfer/in")
|
|
||||||
TransferInResponse transferIn(@JSONBody TransferInRequest request,
|
|
||||||
@Header("sign") @Var("sign") String sign,
|
|
||||||
@Header("timestamp") @Var("timestamp") long timestamp,
|
|
||||||
@Header("merchantId") @Var("merchantId") String merchantId);
|
|
||||||
|
|
||||||
@Post(url = "/api/v2/new/transfer/out")
|
|
||||||
TransferOutResponse transferOut(@JSONBody TransferOutRequest request,
|
|
||||||
@Header("sign") @Var("sign") String sign,
|
|
||||||
@Header("timestamp") @Var("timestamp") long timestamp,
|
|
||||||
@Header("merchantId") @Var("merchantId") String merchantId);
|
|
||||||
|
|
||||||
@Post(url = "/api/v2/new/user/detail")
|
|
||||||
GetMemberInfoResponse getMemberInfo(@JSONBody GetMemberInfoRequest request,
|
|
||||||
@Header("sign") @Var("sign") String sign,
|
|
||||||
@Header("timestamp") @Var("timestamp") long timestamp,
|
|
||||||
@Header("merchantId") @Var("merchantId") String merchantId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询转账详情,当转入/转出接口遇到异常,可查询某次转账是否成功
|
|
||||||
*/
|
|
||||||
@Post(url = "/api/v2/transfer/detail")
|
|
||||||
TransferDetailResponse transferDetail(@JSONBody TransferDetailRequest request,
|
|
||||||
@Header("sign") @Var("sign") String sign,
|
|
||||||
@Header("timestamp") @Var("timestamp") long timestamp,
|
|
||||||
@Header("merchantId") @Var("merchantId") String merchantId);
|
|
||||||
|
|
||||||
@Post(url = "/api/v2/service/domain/list")
|
|
||||||
GetUrlResponse getUrl(@JSONBody GetUrlRequest request,
|
|
||||||
@Header("sign") @Var("sign") String sign,
|
|
||||||
@Header("timestamp") @Var("timestamp") long timestamp,
|
|
||||||
@Header("merchantId") @Var("merchantId") String merchantId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FB体育用拉取订单文件的方式同步订单数据,FB体育每5分钟生成一次订单文件,
|
|
||||||
* 通过此接口获取某一段时间内的文件ID列表,再通过文件ID获取具体订单数据
|
|
||||||
*/
|
|
||||||
@Post(url = "/api/v2/order/file/ids")
|
|
||||||
OrderFilesResponse orderFiles(@JSONBody OrderFilesRequest request,
|
|
||||||
@Header("sign") @Var("sign") String sign,
|
|
||||||
@Header("timestamp") @Var("timestamp") long timestamp,
|
|
||||||
@Header("merchantId") @Var("merchantId") String merchantId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拉取订单Json数据
|
|
||||||
*/
|
|
||||||
@Post(url = "/api/v2/order/list")
|
|
||||||
OrderInfoResponse getOrderJsonData(@JSONBody OrderInfoRequest request,
|
|
||||||
@Header("sign") @Var("sign") String sign,
|
|
||||||
@Header("timestamp") @Var("timestamp") long timestamp,
|
|
||||||
@Header("merchantId") @Var("merchantId") String merchantId);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户app端鉴权token和相关服务url,获取到的token用于app调用接口鉴权
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @param sign
|
|
||||||
* @param timestamp
|
|
||||||
* @param merchantId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Post(url = "/api/v2/token/get")
|
|
||||||
GetTokenResponse getToken(@JSONBody GetTokenRequest request,
|
|
||||||
@Header("sign") @Var("sign") String sign,
|
|
||||||
@Header("timestamp") @Var("timestamp") long timestamp,
|
|
||||||
@Header("merchantId") @Var("merchantId") String merchantId);
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
package com.ff.game.api.fb.dto;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class CreateUserRequest implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String merchantUserId;// 渠道用户id,支持40位字符串,必须唯一
|
|
||||||
private List<Integer> currencyIds = null; // 币种id集合 , see enum: currency
|
|
||||||
private Integer oddsLevel = null; // 赔率级别,不传则为默认, see enum: user_odds_level_enum
|
|
||||||
|
|
||||||
public String toJSON() {
|
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
|
||||||
map.put("currencyIds", currencyIds);
|
|
||||||
map.put("merchantUserId", merchantUserId);
|
|
||||||
map.put("oddsLevel", oddsLevel);
|
|
||||||
return JSON.toJSONString(map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
package com.ff.game.api.fb.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class CreateUserResponse implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Boolean success;
|
|
||||||
private Integer data;
|
|
||||||
private Integer code;
|
|
||||||
private String message;
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
package com.ff.game.api.fb.dto;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
public class Enums {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
package com.ff.game.api.fb.dto;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class GetMemberInfoRequest implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 渠道用户id,不能为空
|
|
||||||
*/
|
|
||||||
private String merchantUserId;
|
|
||||||
|
|
||||||
public String toJSON() {
|
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
|
||||||
map.put("merchantUserId", merchantUserId);
|
|
||||||
return JSON.toJSONString(map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
package com.ff.game.api.fb.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class GetMemberInfoResponse implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Boolean success;
|
|
||||||
private String message;
|
|
||||||
private MemberInfo data;
|
|
||||||
private Integer code;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class MemberInfo implements Serializable{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private String merchantUserId;
|
|
||||||
private Integer userId; // FB体育用户id
|
|
||||||
private Integer walletType; // 用户钱包类型 , see enum: wallet_type
|
|
||||||
private Integer currencyType; // 用户币种类型 , see enum: currency_type
|
|
||||||
private List<Wallet> wallets; // 钱包集合
|
|
||||||
private Integer oddsLevel;// 赔率级别 , see enum: user_odds_level_enum
|
|
||||||
}
|
|
||||||
@Data
|
|
||||||
public static class Wallet implements Serializable{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private Integer currencyType; // 币种类型 , see enum: currency_type
|
|
||||||
private BigDecimal balance; // 余额
|
|
||||||
private Integer currencyId; // 币种id , see enum: currency
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
package com.ff.game.api.fb.dto;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class GetTokenRequest implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String merchantUserId;
|
|
||||||
// 平台类型,pc,h5, mobile , see enum: plat_form_enum
|
|
||||||
private String platForm;
|
|
||||||
// 客户端用户ip地址,尽可能提供,我们用于风控
|
|
||||||
private String ip; // 可选
|
|
||||||
|
|
||||||
public String toJSON() {
|
|
||||||
Map<String, String> map = new LinkedHashMap<>();
|
|
||||||
map.put("merchantUserId", merchantUserId);
|
|
||||||
map.put("platForm", platForm);
|
|
||||||
return JSON.toJSONString(map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
package com.ff.game.api.fb.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class GetTokenResponse implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Boolean success;
|
|
||||||
private String message;
|
|
||||||
private Integer code;
|
|
||||||
private TokenDTO data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class TokenDTO implements Serializable {
|
|
||||||
private String token; // 用户鉴权token,用于客户端鉴权
|
|
||||||
private ServerInfo serverInfo; // 服务器地址信息
|
|
||||||
private List<Domain> domains; // 全部服务器地址信息
|
|
||||||
private String themeBgColor; // 主题背景色
|
|
||||||
private String themeFgColor; // 主题前景色
|
|
||||||
private Integer userId; // FB用户ID
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class ServerInfo implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private String apiServerAddress; // app接口服务地址
|
|
||||||
private String apiEmbeddedServerAddress; // app内嵌网页地址
|
|
||||||
private String pushServerAddress; // 推送服务地址
|
|
||||||
private String pcAddress; // PC投注网站地址
|
|
||||||
private String h5Address; // h5投注网站地址
|
|
||||||
private String virtualAddress; // 虚拟体育投注网站地址
|
|
||||||
private String virtualMatchVideoAddress; // 虚拟赛事视频地址
|
|
||||||
private String ouH5Address; // 欧版h5地址
|
|
||||||
private String ouPcAddress; // 欧版pc地址
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class Domain {
|
|
||||||
private Integer type; // 域名类型
|
|
||||||
private List<String> domains; // 域名集合
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package com.ff.game.api.fb.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class GetUrlRequest implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public String toJSON() {
|
|
||||||
return "{}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
package com.ff.game.api.fb.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class GetUrlResponse implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Boolean success;
|
|
||||||
private String message;
|
|
||||||
private List<UrlDTO> data;
|
|
||||||
private Integer code;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class UrlDTO implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private int type; //域名类型,1:API,2:PUSH,3:H5,4:PC,5:IMAGE , see enum: domain_type_enum
|
|
||||||
private List<DomainDTO> domainList; // 域名集合
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class DomainDTO implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private String domain; // 域名
|
|
||||||
private int weight; // 权限值
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
package com.ff.game.api.fb.dto;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class OrderFilesRequest implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 开始时间戳,13位数字,不能为null
|
|
||||||
*/
|
|
||||||
private Long startTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 结束时间戳,13位数字,不能为null
|
|
||||||
*/
|
|
||||||
private Long endTime;
|
|
||||||
|
|
||||||
public String toJSON() {
|
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
|
||||||
map.put("endTime", endTime);
|
|
||||||
map.put("startTime", startTime);
|
|
||||||
return JSON.toJSONString(map);
|
|
||||||
// String endTimeStr = endTime ; // 转换为字符串
|
|
||||||
// String startTimeStr = startTime; // 转换为字符串
|
|
||||||
//
|
|
||||||
// String json = "{" +
|
|
||||||
// "\"endTime\": \"" + endTimeStr + "\", " +
|
|
||||||
// "\"startTime\": \"" + startTimeStr + "\"" +
|
|
||||||
// "}";
|
|
||||||
// return json;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
package com.ff.game.api.fb.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class OrderFilesResponse implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Boolean success;
|
|
||||||
private String message;
|
|
||||||
private Integer code;
|
|
||||||
|
|
||||||
private List<FileId> data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class FileId implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private Long fileId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
package com.ff.game.api.fb.dto;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class OrderInfoRequest implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
/**
|
|
||||||
* 文件Id,需要从/order/file/ids接口获取到
|
|
||||||
*/
|
|
||||||
private Long fileId;
|
|
||||||
|
|
||||||
public String toJSON() {
|
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
|
||||||
map.put("fileId", fileId);
|
|
||||||
return JSON.toJSONString(map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,115 +0,0 @@
|
||||||
package com.ff.game.api.fb.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cengy
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class OrderInfoResponse implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Boolean success;
|
|
||||||
private String message;
|
|
||||||
private Integer code;
|
|
||||||
|
|
||||||
private List<OrderDTO> data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class OrderDTO implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private String id; // 订单号
|
|
||||||
private Integer rejectReason; // 拒单原因码 see enum: order_reject_type
|
|
||||||
private String rejectReasonStr; // 拒单原因
|
|
||||||
private String userId; // FB平台用户ID
|
|
||||||
private String merchantId; // 渠道ID
|
|
||||||
private String merchantUserId; // 渠道用户ID
|
|
||||||
private Integer currency; // 币种 see enum: currency
|
|
||||||
private String exchangeRate; // 汇率快照
|
|
||||||
private Integer seriesType; // 关次类型 ,0 单关、1 串关, see enum: series_type
|
|
||||||
private String betType; // 投注类型
|
|
||||||
private Integer allUp; // 总关数
|
|
||||||
private Integer allUpAlive; // 存活关数
|
|
||||||
private String stakeAmount; // 投注额(本金)
|
|
||||||
private String liabilityStake; // 名义投注额(名义本金)
|
|
||||||
private String settleAmount; // 结算派奖金额
|
|
||||||
private Integer orderStatus; // 订单状态 see enum: order_status
|
|
||||||
private Integer payStatus; // 付款状态
|
|
||||||
private Integer oddsChange; // 是否接受赔率变更 0不接受,1 接受更好赔率,2接受任意赔率 , see enum: odds_change_enum
|
|
||||||
private String device; // 设备类型 (pc、h5、mobile) , see enum: plat_form_enum
|
|
||||||
private String ip; // 投注IP地址
|
|
||||||
private String settleTime; // 订单结算时间
|
|
||||||
private String createTime; // 订单创建时间
|
|
||||||
private String modifyTime; // 订单确认时间
|
|
||||||
private String cancelTime; // 订单取消时间
|
|
||||||
private String thirdRemark; // 第三方备注
|
|
||||||
private String relatedId; // 三方关联ID
|
|
||||||
private String maxWinAmount; // 最大可赢金额
|
|
||||||
private String loseAmount; // 最大赔付金额
|
|
||||||
private Integer rollBackCount; // 回滚次数
|
|
||||||
private Integer itemCount; // 选项数
|
|
||||||
private Integer seriesValue; // 串几关
|
|
||||||
private Integer betNum; // 子单数
|
|
||||||
private String cashOutTotalStake; // 提前结算总本金
|
|
||||||
private String liabilityCashoutStake; // 提前结算名义总本金
|
|
||||||
private String cashOutPayoutStake; // 提前结算总派奖额
|
|
||||||
private String reserveId; // 预约订单单号
|
|
||||||
private Integer cashOutCount; // 提前结算次数
|
|
||||||
private String unitStake; // 每单金额
|
|
||||||
private Integer reserveVersion; // 预约订单版本号
|
|
||||||
private List<BetDTO> betList; // 注单集合
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class BetDTO implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String id; // ID
|
|
||||||
private String orderId; // 订单ID
|
|
||||||
private Integer sportId; // 运动ID
|
|
||||||
private String matchId; // 比赛ID
|
|
||||||
private String matchName; // 比赛名称
|
|
||||||
private Integer period; // 阶段ID
|
|
||||||
private String marketId; // 玩法ID
|
|
||||||
private Integer marketType; // 玩法类型
|
|
||||||
private Integer optionType; // 投注项类型
|
|
||||||
private String optionName; // 选项名称
|
|
||||||
private String marketName; // 玩法名称
|
|
||||||
private String tournamentId; // 联赛ID
|
|
||||||
private String tournamentName; // 联赛名称
|
|
||||||
private String odds; // 欧式赔率
|
|
||||||
private Integer oddsFormat; // 投注时赔率类型
|
|
||||||
private String betOdds; // 投注时赔率
|
|
||||||
private Integer settleStatus; // 结算状态
|
|
||||||
private Integer settleResult; // 结算结果
|
|
||||||
private Boolean isInplay; // 是否滚球
|
|
||||||
private String remark; // 备注
|
|
||||||
private Double p1; // 变量1 (例如:让几个球)
|
|
||||||
private Double p2; // 变量2
|
|
||||||
private Double p3; // 变量3
|
|
||||||
private String extendedParameter; // 亚洲让球线
|
|
||||||
private String extraInfo; // 当前比分
|
|
||||||
private String pendingTime; // 延迟等待时间
|
|
||||||
private String betScore; // 下注当时比分
|
|
||||||
private Integer cancelReason; // 取消原因
|
|
||||||
private String cancelReasonName; // 取消原因文本
|
|
||||||
private Integer matchType; // 赛事类型
|
|
||||||
private String matchTime; // 开赛时间
|
|
||||||
private Integer virtualMatchDay; // 轮次
|
|
||||||
private Integer virtualChampId; // 赛季
|
|
||||||
private Integer virtualLegOrder; // 淘汰赛回合
|
|
||||||
private Integer virtualWeekDay; // 小组赛比赛日
|
|
||||||
private Integer virtualBlockId; // 期
|
|
||||||
private Integer leaguePhase; // 联赛阶段
|
|
||||||
private String maxStake; // 最大投注额
|
|
||||||
private String validSettleStakeAmount; // 有效已结算投注额
|
|
||||||
private String validSettleAmount; // 有效返还额
|
|
||||||
private String cashOutCancelStake; // 提前结算取消总额
|
|
||||||
private Integer walletType; // 钱包类型
|
|
||||||
private Integer version; // 数据变更标记
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue