Compare commits
No commits in common. "1fd1e10339d35e5bd082edda5daa69d5787c2846" and "61ebcb15aa9948ec36cc70dba39a23cf79554609" have entirely different histories.
1fd1e10339
...
61ebcb15aa
|
@ -57,13 +57,6 @@ public class CacheConstants
|
||||||
*/
|
*/
|
||||||
public static final String PG_GAMES= "pg_games:";
|
public static final String PG_GAMES= "pg_games:";
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fc游戏
|
|
||||||
*/
|
|
||||||
public static final String FC_GAMES= "fc_games:";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pg游戏投注货币
|
* pg游戏投注货币
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -188,11 +188,6 @@ public class Constants {
|
||||||
*/
|
*/
|
||||||
public static final String NG_API_BASE_URL = "ng.api.base.url";
|
public static final String NG_API_BASE_URL = "ng.api.base.url";
|
||||||
|
|
||||||
/**
|
|
||||||
* fc-api基本url
|
|
||||||
*/
|
|
||||||
public static final String FC_API_BASE_URL = "fc.api.base.url";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 吉利测试地址
|
* 吉利测试地址
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,11 +23,7 @@ public enum ErrorCode {
|
||||||
FREQUENT_INTERFACE_REQUESTS (1007, "接口请求频繁"),
|
FREQUENT_INTERFACE_REQUESTS (1007, "接口请求频繁"),
|
||||||
BALANCE_TRANSFER_FAILED (1008, "余额转移失败"),
|
BALANCE_TRANSFER_FAILED (1008, "余额转移失败"),
|
||||||
LANG_NOT_EXIST(1009, "游戏平台不支持的语言"),
|
LANG_NOT_EXIST(1009, "游戏平台不支持的语言"),
|
||||||
ORDER_NOT_EXIST(1010, "订单不存在"),
|
ORDER_NOT_EXIST(1010, "订单不存在")
|
||||||
PLAYERS_ARE_PLAYING(1011, "玩家游玩中"),
|
|
||||||
INSUFFICIENT_PLAYER_BALANCE(1012, "玩家余额不足"),
|
|
||||||
KICK_OUT_AILED(1013, "玩家踢出失败"),
|
|
||||||
ACCOUNT_NOT_ONLINE(1014, "账号不在线"),
|
|
||||||
;
|
;
|
||||||
|
|
||||||
// 获取错误码
|
// 获取错误码
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* xkgame类型
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2024/11/13
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
public enum FCGameType {
|
|
||||||
|
|
||||||
CATCH_FISH("fishing", 4,"捕鱼"),
|
|
||||||
ARCADE("arcade",1, "电子"),
|
|
||||||
SLOT("slot",1, "电子"),
|
|
||||||
TABLE("table", 1,"电子"),
|
|
||||||
CATCH_FISH_MEMBER("1", 4,"捕鱼"),
|
|
||||||
ARCADE_MEMBER("2", 1,"电子"),
|
|
||||||
SLOT_MEMBER("7", 1,"电子"),
|
|
||||||
TABLE_MEMBER("8", 1,"电子"),
|
|
||||||
;
|
|
||||||
|
|
||||||
private final String code;
|
|
||||||
private final Integer systemCode;
|
|
||||||
private final String info;
|
|
||||||
FCGameType(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(FCGameType.values())
|
|
||||||
.filter(gameType -> gameType.getCode().equals(code))
|
|
||||||
.map(FCGameType::getSystemCode)
|
|
||||||
.findFirst();
|
|
||||||
return system.orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按代码查找信息
|
|
||||||
*
|
|
||||||
* @param code 代码
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
public static String findInfoByCode(String code) {
|
|
||||||
Optional<String> system = Stream.of(FCGameType.values())
|
|
||||||
.filter(gameType -> gameType.getCode().equals(code))
|
|
||||||
.map(FCGameType::getInfo)
|
|
||||||
.findFirst();
|
|
||||||
return system.orElse(null);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 长传输类型
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/03/12
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
public enum FCTransferType {
|
|
||||||
TRANSFER_OUT("0", "不全部提领(默认值)"),
|
|
||||||
TRANSFER_OUT_ALL("1", "全部提领(包含所有小数字金额)");
|
|
||||||
|
|
||||||
private final String value;
|
|
||||||
private final String description;
|
|
||||||
|
|
||||||
FCTransferType(String value, String description) {
|
|
||||||
this.value = value;
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,7 +7,6 @@ public enum GamePlatforms {
|
||||||
JILI("JILI", "JILI"),
|
JILI("JILI", "JILI"),
|
||||||
XK("XK", "XK"),
|
XK("XK", "XK"),
|
||||||
PG("PG", "PG"),
|
PG("PG", "PG"),
|
||||||
FC("FC", "FC"),
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
package com.ff.base.enums;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 平台类型
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/03/25
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum PlatformType {
|
|
||||||
ELECTRONIC(1, "电子"),
|
|
||||||
CARD_GAME(2, "棋牌"),
|
|
||||||
GAME_HALL(3, "游戏大厅"),
|
|
||||||
FISHING(4, "捕鱼"),
|
|
||||||
BETTING_MACHINE(5, "押分机 (含宾果)"),
|
|
||||||
VIDEO(6, "视讯"),
|
|
||||||
LOTTERY(7, "彩票"),
|
|
||||||
SPORTS(8, "体育"),
|
|
||||||
HUNTING(9, "捕猎");
|
|
||||||
|
|
||||||
private final int code;
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -9,7 +9,8 @@ package com.ff.base.enums;
|
||||||
*/
|
*/
|
||||||
public enum TransferType {
|
public enum TransferType {
|
||||||
ALL(1, "从游戏商转移额度到平台商(不看amount值,全部转出"),
|
ALL(1, "从游戏商转移额度到平台商(不看amount值,全部转出"),
|
||||||
GAMES(2, "从平台商转移额度到游戏商");
|
GAMES(2, "从平台商转移额度到游戏商"),
|
||||||
|
SYSTEM(3, "从游戏商转移额度到平台商 无用");
|
||||||
private final Integer code;
|
private final Integer code;
|
||||||
private final String info;
|
private final String info;
|
||||||
|
|
||||||
|
|
|
@ -202,27 +202,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||||
return zdt.format(formatter);
|
return zdt.format(formatter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 将毫秒时间戳转换为指定时区的时间,并按指定格式输出
|
|
||||||
*
|
|
||||||
* @param timestampInMillis 毫秒级时间戳
|
|
||||||
* @param timeZone 时区(例如:America/New_York)
|
|
||||||
* @param format 时间格式(例如:yyyy-MM-dd HH:mm:ss)
|
|
||||||
* @return 格式化后的时间字符串
|
|
||||||
*/
|
|
||||||
public static String convertTimeZone(long timestampInMillis, String timeZone, String format) {
|
|
||||||
// 将毫秒时间戳转换为 Instant
|
|
||||||
Instant instant = Instant.ofEpochMilli(timestampInMillis);
|
|
||||||
|
|
||||||
// 将 UTC 时间转换为指定时区的时间
|
|
||||||
ZonedDateTime zonedDateTime = instant.atZone(ZoneId.of(timeZone));
|
|
||||||
|
|
||||||
// 格式化输出为指定格式的时间字符串
|
|
||||||
return zonedDateTime.format(DateTimeFormatter.ofPattern(format));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加 LocalDate ==> Date
|
* 增加 LocalDate ==> Date
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class ApiGameController extends BaseController {
|
||||||
GameSecretKeyCurrencyDTO secretKeyCurrencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
GameSecretKeyCurrencyDTO secretKeyCurrencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
.platformCode(gamePlatform.getPlatformCode())
|
.platformCode(gamePlatform.getPlatformCode())
|
||||||
.systemCurrency(memberCreateApiRequest.getCurrencyCode()).build());
|
.systemCurrency(memberCreateApiRequest.getCurrencyCode()).build());
|
||||||
ApiException.notNull(secretKeyCurrencyDTO, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
ApiException.notNull(secretKeyCurrencyDTO, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||||
|
|
||||||
GameSecretKeyLangDTO gameSecretKeyLangDTO = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
|
GameSecretKeyLangDTO gameSecretKeyLangDTO = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
|
||||||
.platformCode(gamePlatform.getPlatformCode())
|
.platformCode(gamePlatform.getPlatformCode())
|
||||||
|
@ -161,7 +161,7 @@ public class ApiGameController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
Member member = memberService.selectMemberByAccount(memberCreateApiRequest.getAccount(), memberCreateApiRequest.getCurrencyCode(), gamePlatform.getPlatformCode());
|
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(secretKeyCurrencyDTO.getCode())
|
.agentId(secretKeyCurrencyDTO.getCode())
|
||||||
|
@ -198,7 +198,7 @@ public class ApiGameController extends BaseController {
|
||||||
|
|
||||||
TenantSecretKey tenantSecretKey = keyConfig.get();
|
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||||
|
|
||||||
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
.platformCode(gameExchangeBalanceRequest.getPlatformCode())
|
.platformCode(gameExchangeBalanceRequest.getPlatformCode())
|
||||||
.systemCurrency(gameExchangeBalanceRequest.getCurrencyCode()).build());
|
.systemCurrency(gameExchangeBalanceRequest.getCurrencyCode()).build());
|
||||||
|
|
||||||
|
@ -261,6 +261,7 @@ public class ApiGameController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 赠送免费局数
|
* 赠送免费局数
|
||||||
*
|
*
|
||||||
|
@ -351,6 +352,7 @@ public class ApiGameController extends BaseController {
|
||||||
public AjaxResult getDetail(@Validated @RequestBody GameGetDetailRequest gameGetDetailRequest) {
|
public AjaxResult getDetail(@Validated @RequestBody GameGetDetailRequest gameGetDetailRequest) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||||
.platformCode(gameGetDetailRequest.getPlatformCode())
|
.platformCode(gameGetDetailRequest.getPlatformCode())
|
||||||
.systemCurrency(gameGetDetailRequest.getCurrencyCode()).build());
|
.systemCurrency(gameGetDetailRequest.getCurrencyCode()).build());
|
||||||
|
@ -363,6 +365,7 @@ public class ApiGameController extends BaseController {
|
||||||
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())
|
||||||
|
@ -370,6 +373,7 @@ public class ApiGameController extends BaseController {
|
||||||
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())
|
.lang(gameSecretKeyLang.getLang())
|
||||||
|
@ -393,6 +397,7 @@ public class ApiGameController extends BaseController {
|
||||||
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Member member = memberService.selectMemberByAccount(gameKickMemeberRequest.getAccount(), gameKickMemeberRequest.getCurrencyCode(), gameKickMemeberRequest.getPlatformCode());
|
Member member = memberService.selectMemberByAccount(gameKickMemeberRequest.getAccount(), gameKickMemeberRequest.getCurrencyCode(), gameKickMemeberRequest.getPlatformCode());
|
||||||
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
||||||
|
|
||||||
|
@ -404,7 +409,6 @@ public class ApiGameController extends BaseController {
|
||||||
return AjaxResult.success(iGamesService.kickMember(KickMemberRequestDTO.builder()
|
return AjaxResult.success(iGamesService.kickMember(KickMemberRequestDTO.builder()
|
||||||
.account(member.getGameAccount())
|
.account(member.getGameAccount())
|
||||||
.agentId(gameSecretKey.getCode())
|
.agentId(gameSecretKey.getCode())
|
||||||
.currency(gameSecretKey.getCurrency())
|
|
||||||
.agentKey(gameSecretKey.getKey())
|
.agentKey(gameSecretKey.getKey())
|
||||||
.build()));
|
.build()));
|
||||||
}
|
}
|
||||||
|
@ -420,12 +424,9 @@ public class ApiGameController extends BaseController {
|
||||||
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(gameSecretKey.getCode())
|
.agentId(gameSecretKey.getCode())
|
||||||
.agentKey(gameSecretKey.getKey())
|
.agentKey(gameSecretKey.getKey())
|
||||||
.currency(gameSecretKey.getCurrency())
|
|
||||||
.build();
|
.build();
|
||||||
if (!ObjectUtils.isEmpty(gameKickMemeberAllRequest.getGameId())) {
|
if (!ObjectUtils.isEmpty(gameKickMemeberAllRequest.getGameId())) {
|
||||||
Game game = gameService.selectGameById(gameKickMemeberAllRequest.getGameId());
|
Game game = gameService.selectGameById(gameKickMemeberAllRequest.getGameId());
|
||||||
|
@ -507,6 +508,9 @@ public class ApiGameController extends BaseController {
|
||||||
TenantSecretKey tenantSecretKey = keyConfig.get();
|
TenantSecretKey tenantSecretKey = keyConfig.get();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<GameSecretKeyCurrencyDTO> gameSecretKeys = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder()
|
List<GameSecretKeyCurrencyDTO> gameSecretKeys = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder()
|
||||||
.systemCurrency(gameExchangeBalanceAllRequest.getCurrencyCode()).build());
|
.systemCurrency(gameExchangeBalanceAllRequest.getCurrencyCode()).build());
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ public class GameGetDetailRequest implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 投注id
|
* 投注id
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "wagersId不能为空")
|
@NotNull(message = "wagersId不能为空")
|
||||||
private String wagersId;
|
private Long wagersId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 语言代码
|
* 语言代码
|
||||||
|
|
|
@ -80,14 +80,6 @@ public interface IGamesService {
|
||||||
Boolean getBetRecordByTime(BetRecordByTimeDTO betRecordByTimeDTO);
|
Boolean getBetRecordByTime(BetRecordByTimeDTO betRecordByTimeDTO);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按历史时间获取投注记录 部分平台需要两个接口同时跑投注记录
|
|
||||||
*
|
|
||||||
* @param betRecordByTimeDTO 按时间dto投注记录
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
Boolean getBetRecordByHistoryTime(BetRecordByTimeDTO betRecordByTimeDTO);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 赠送免费局数
|
* 赠送免费局数
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.ff.game.api.fc.address;
|
|
||||||
|
|
||||||
import com.dtflys.forest.callback.AddressSource;
|
|
||||||
import com.dtflys.forest.http.ForestAddress;
|
|
||||||
import com.dtflys.forest.http.ForestRequest;
|
|
||||||
import com.ff.base.constant.Constants;
|
|
||||||
import com.ff.base.system.service.ISysConfigService;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class MyFCAddressSource implements AddressSource {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private ISysConfigService configService;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ForestAddress getAddress(ForestRequest request) {
|
|
||||||
String apiBaseUrl = configService.selectConfigByKey(Constants.FC_API_BASE_URL);
|
|
||||||
return new ForestAddress("https",apiBaseUrl, 443,"");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,113 +0,0 @@
|
||||||
package com.ff.game.api.fc.client;
|
|
||||||
|
|
||||||
|
|
||||||
import com.dtflys.forest.annotation.Address;
|
|
||||||
import com.dtflys.forest.annotation.JSONBody;
|
|
||||||
import com.dtflys.forest.annotation.Post;
|
|
||||||
import com.ff.game.api.fc.dto.*;
|
|
||||||
import com.ff.game.api.fc.address.MyFCAddressSource;
|
|
||||||
import com.ff.game.api.ng.dto.*;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ng客户端
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/03/11
|
|
||||||
*/
|
|
||||||
@Address(source = MyFCAddressSource.class)
|
|
||||||
public interface FCClient {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建成员
|
|
||||||
*
|
|
||||||
* @param parameters 参数
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
@Post("/AddMember")
|
|
||||||
ApiFCResult createMember(@JSONBody Map<String, Object> parameters);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 踢腿队员
|
|
||||||
*
|
|
||||||
* @param parameters 范围
|
|
||||||
* @return {@link ApiFCResult }
|
|
||||||
*/
|
|
||||||
@Post("/KickOut")
|
|
||||||
ApiFCResult kickMember(@JSONBody Map<String, Object> parameters);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 踢成员全部
|
|
||||||
*
|
|
||||||
* @param parameters 范围
|
|
||||||
* @return {@link ApiFCResult }
|
|
||||||
*/
|
|
||||||
@Post("/KickoutAll")
|
|
||||||
ApiFCResult kickMemberAll(@JSONBody Map<String, Object> parameters);
|
|
||||||
/**
|
|
||||||
* 获取会员信息
|
|
||||||
*
|
|
||||||
* @param parameters 范围
|
|
||||||
* @return {@link ApiNGResponseDTO }<{@link String }>
|
|
||||||
*/
|
|
||||||
@Post("/SearchMember")
|
|
||||||
ApiFCUserInfoResponseDTO getMemberInfo(@JSONBody Map<String, Object> parameters);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取游戏列表
|
|
||||||
*
|
|
||||||
* @param parameters 范围
|
|
||||||
* @return {@link ApiFCGameListResponseDTO }
|
|
||||||
*/
|
|
||||||
@Post("/GetGameIconList")
|
|
||||||
ApiFCGameListResponseDTO getGameList(@JSONBody Map<String, Object> parameters);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无重定向登录
|
|
||||||
*
|
|
||||||
* @param parameters 范围
|
|
||||||
* @return {@link ApiFCLoginResponseDTO }
|
|
||||||
*/
|
|
||||||
@Post("/Login")
|
|
||||||
ApiFCLoginResponseDTO loginWithoutRedirect(@JSONBody Map<String, Object> parameters);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按代理id进行交换转账
|
|
||||||
*
|
|
||||||
* @param parameters 范围
|
|
||||||
*/
|
|
||||||
@Post(url = "/SetPoints",connectTimeout = 70000)
|
|
||||||
ApiCFBalanceTransferResponseDTO exchangeTransferByAgentId(@JSONBody Map<String, Object> parameters);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按时间获取投注记录
|
|
||||||
*
|
|
||||||
* @param parameters 范围
|
|
||||||
*/
|
|
||||||
@Post(url = "/GetRecordList")
|
|
||||||
ApiFCBetRecordResponseDTO getBetRecordByTime(@JSONBody Map<String, Object> parameters);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按历史时间获取投注记录
|
|
||||||
*
|
|
||||||
* @param parameters 范围
|
|
||||||
* @return {@link ApiFCBetRecordResponseDTO }
|
|
||||||
*/
|
|
||||||
@Post(url = "/GetHistoryRecordList")
|
|
||||||
ApiFCBetRecordResponseDTO getBetRecordByHistoryTime(@JSONBody Map<String, Object> parameters);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
package com.ff.game.api.fc.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* api余额传输响应dto
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/03/25
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ApiCFBalanceTransferResponseDTO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 操作结果,0 表示成功,其他值表示失败
|
|
||||||
*/
|
|
||||||
@JsonProperty("Result")
|
|
||||||
private int result;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 银行ID
|
|
||||||
*/
|
|
||||||
@JsonProperty("BankID")
|
|
||||||
private int bankID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 交易ID
|
|
||||||
*/
|
|
||||||
@JsonProperty("TrsID")
|
|
||||||
private String trsID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账后余额
|
|
||||||
*/
|
|
||||||
@JsonProperty("AfterPoint")
|
|
||||||
private BigDecimal afterPoint;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转账金额
|
|
||||||
*/
|
|
||||||
@JsonProperty("Points")
|
|
||||||
private BigDecimal points;
|
|
||||||
}
|
|
|
@ -1,166 +0,0 @@
|
||||||
package com.ff.game.api.fc.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import lombok.Data;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 投注记录返回实体类
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ApiFCBetRecordResponseDTO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 操作结果,0 表示成功,其他值表示失败
|
|
||||||
*/
|
|
||||||
@JsonProperty("Result")
|
|
||||||
private int Result;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 投注记录列表
|
|
||||||
*/
|
|
||||||
@JsonProperty("Records")
|
|
||||||
private List<BetRecord> Records;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 投注记录实体类
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public static class BetRecord {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下注点数
|
|
||||||
*/
|
|
||||||
@JsonProperty("bet")
|
|
||||||
private BigDecimal bet;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 有效投注 (除 Lucky9 游戏,其余游戏 Bet = validBet)
|
|
||||||
*/
|
|
||||||
@JsonProperty("validBet")
|
|
||||||
private BigDecimal validBet;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 赢分点数
|
|
||||||
*/
|
|
||||||
@JsonProperty("prize")
|
|
||||||
private BigDecimal prize;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 退还金额 (除 Lucky9 游戏,其余游戏 refund = win)
|
|
||||||
*/
|
|
||||||
@JsonProperty("refund")
|
|
||||||
private BigDecimal refund;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 净输赢点数,等于 prize - validBet
|
|
||||||
*/
|
|
||||||
@JsonProperty("winlose")
|
|
||||||
private BigDecimal winlose;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 抽水金额 (除 Lucky9 游戏,其余游戏为 0)
|
|
||||||
*/
|
|
||||||
@JsonProperty("commission")
|
|
||||||
private BigDecimal commission;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏前点数
|
|
||||||
*/
|
|
||||||
@JsonProperty("before")
|
|
||||||
private BigDecimal before;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏后点数
|
|
||||||
*/
|
|
||||||
@JsonProperty("after")
|
|
||||||
private BigDecimal after;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 彩金抽水 (支持到小数第六位)
|
|
||||||
*/
|
|
||||||
@JsonProperty("jptax")
|
|
||||||
private BigDecimal jptax;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 彩金点数
|
|
||||||
*/
|
|
||||||
@JsonProperty("jppoints")
|
|
||||||
private BigDecimal jppoints;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏内彩金贡献
|
|
||||||
*/
|
|
||||||
@JsonProperty("inGameJptax")
|
|
||||||
private BigDecimal inGameJptax;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏内中奖彩金
|
|
||||||
*/
|
|
||||||
@JsonProperty("inGameJppoints")
|
|
||||||
private BigDecimal inGameJppoints;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏记录编号 (唯一码),24 字符
|
|
||||||
*/
|
|
||||||
@JsonProperty("recordID")
|
|
||||||
private String recordID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 玩家账号
|
|
||||||
*/
|
|
||||||
@JsonProperty("account")
|
|
||||||
private String account;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏编号
|
|
||||||
*/
|
|
||||||
@JsonProperty("gameID")
|
|
||||||
private String gameID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏类型
|
|
||||||
*/
|
|
||||||
@JsonProperty("gametype")
|
|
||||||
private String gametype;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 彩金模式
|
|
||||||
*/
|
|
||||||
@JsonProperty("jpmode")
|
|
||||||
private int jpmode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏内彩金模式
|
|
||||||
*/
|
|
||||||
@JsonProperty("inGameJpmode")
|
|
||||||
private int inGameJpmode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下注时间
|
|
||||||
*/
|
|
||||||
@JsonProperty("bdate")
|
|
||||||
private Date bdate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否购买免费游戏
|
|
||||||
*/
|
|
||||||
@JsonProperty("isBuyFeature")
|
|
||||||
private boolean isBuyFeature;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用于确认此注单是否有获得免费游戏或其他红利游戏
|
|
||||||
*/
|
|
||||||
@JsonProperty("gameMode")
|
|
||||||
private int gameMode;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,67 +0,0 @@
|
||||||
package com.ff.game.api.fc.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏列表 API 响应 DTO
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ApiFCGameListResponseDTO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 操作结果,0 表示成功,其他值表示失败
|
|
||||||
*/
|
|
||||||
@JsonProperty("Result")
|
|
||||||
private int result;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取游戏图标列表
|
|
||||||
*/
|
|
||||||
@JsonProperty("GetGameIconList")
|
|
||||||
private Map<String, Map<String, GameDetails>> getGameIconList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏详情
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public static class GameDetails {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏状态
|
|
||||||
*/
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统游戏id
|
|
||||||
*/
|
|
||||||
private Long systemGameId;
|
|
||||||
/**
|
|
||||||
* 游戏id
|
|
||||||
*/
|
|
||||||
private String gameId;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 中文游戏名称
|
|
||||||
*/
|
|
||||||
private String gameNameOfChinese;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 英文游戏名称
|
|
||||||
*/
|
|
||||||
private String gameNameOfEnglish;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 英文图标URL
|
|
||||||
*/
|
|
||||||
private String enUrl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 中文图标URL
|
|
||||||
*/
|
|
||||||
private String cnUrl;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package com.ff.game.api.fc.dto;
|
|
||||||
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 登录返回信息 API 响应 DTO
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ApiFCLoginResponseDTO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 操作结果,0 表示成功,其他值表示失败
|
|
||||||
*/
|
|
||||||
@JsonProperty("Result")
|
|
||||||
private int result;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 登录跳转 URL
|
|
||||||
*/
|
|
||||||
@JsonProperty("Url")
|
|
||||||
private String url;
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.ff.game.api.fc.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 红蜜蜂
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/03/24
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ApiFCResult {
|
|
||||||
/**
|
|
||||||
* 操作结果,0 表示成功,其他值表示失败
|
|
||||||
*/
|
|
||||||
@JsonProperty("Result")
|
|
||||||
private int result;
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
package com.ff.game.api.fc.dto;
|
|
||||||
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户信息 API 响应 DTO
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2025/03/25
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ApiFCUserInfoResponseDTO {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 操作结果,0 表示成功,其他值表示失败
|
|
||||||
*/
|
|
||||||
@JsonProperty("Result")
|
|
||||||
private int result;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 在线类型
|
|
||||||
*/
|
|
||||||
@JsonProperty("OnlineType")
|
|
||||||
private int onlineType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 积分
|
|
||||||
*/
|
|
||||||
@JsonProperty("Points")
|
|
||||||
private BigDecimal points;
|
|
||||||
}
|
|
|
@ -1,68 +0,0 @@
|
||||||
package com.ff.game.api.fc.dto;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通用 API 请求对象
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ApiKeyRequest {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加密参数
|
|
||||||
*/
|
|
||||||
private String params;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求参数对象,包含多个子字段
|
|
||||||
*/
|
|
||||||
private ReParams reParams;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 签名
|
|
||||||
*/
|
|
||||||
private String sign;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 内部类,表示嵌套的 ReParams 参数
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public static class ReParams {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户账户
|
|
||||||
*/
|
|
||||||
private String memberAccount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏ID
|
|
||||||
*/
|
|
||||||
private int gameID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 语言ID
|
|
||||||
*/
|
|
||||||
private int languageID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 首页链接
|
|
||||||
*/
|
|
||||||
private String homeUrl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 奖池状态
|
|
||||||
*/
|
|
||||||
private boolean jackpotStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否登录游戏大厅
|
|
||||||
*/
|
|
||||||
private boolean loginGameHall;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏大厅的游戏类型列表
|
|
||||||
*/
|
|
||||||
private List<Integer> gameHallGameType;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,721 +0,0 @@
|
||||||
package com.ff.game.api.fc.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.core.util.NumberUtil;
|
|
||||||
import com.alibaba.druid.support.json.JSONUtils;
|
|
||||||
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.sign.Md5Utils;
|
|
||||||
import com.ff.config.KeyConfig;
|
|
||||||
import com.ff.game.api.IGamesService;
|
|
||||||
import com.ff.game.api.fc.dto.*;
|
|
||||||
import com.ff.game.api.fc.client.FCClient;
|
|
||||||
import com.ff.game.api.ng.client.NGClient;
|
|
||||||
import com.ff.game.api.request.*;
|
|
||||||
import com.ff.game.domain.*;
|
|
||||||
import com.ff.game.dto.GameBettingDetailsDTO;
|
|
||||||
import com.ff.game.dto.GameSecretKeyCurrencyDTO;
|
|
||||||
import com.ff.game.service.*;
|
|
||||||
import com.ff.member.domain.Member;
|
|
||||||
import com.ff.member.service.IMemberService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
||||||
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 javax.crypto.Cipher;
|
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 游戏数据解析服务
|
|
||||||
*
|
|
||||||
* @author shi
|
|
||||||
* @date 2024/10/21
|
|
||||||
*/
|
|
||||||
@Service("FCService")
|
|
||||||
@Slf4j
|
|
||||||
public class GamesFCServiceImpl implements IGamesService {
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private ISysConfigService configService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private RedisCache redisCache;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGamePlatformService gamePlatformService;
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameService gameService;
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IMemberService memberService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameFreeRecordService gameFreeRecordService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameSecretKeyService gameSecretKeyService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private FCClient FCClient;
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private KeyConfig keyConfig;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameBettingDetailsService gameBettingDetailsService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameSecretKeyCurrencyService gameSecretKeyCurrencyService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameNameService gameNameService;
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IGameSecretKeyLangService gameSecretKeyLangService;
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
@Qualifier("threadPoolTaskExecutor")
|
|
||||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得就是成功
|
|
||||||
*
|
|
||||||
* @param errorCode 错误代码
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
private Boolean getIsSuccess(Integer errorCode) {
|
|
||||||
ApiException.isTrue(503 != errorCode, ErrorCode.PLAYERS_ARE_PLAYING.getCode());
|
|
||||||
ApiException.isTrue(203 != errorCode, ErrorCode.INSUFFICIENT_PLAYER_BALANCE.getCode());
|
|
||||||
ApiException.isTrue(504 != errorCode, ErrorCode.ACCOUNT_NOT_ONLINE.getCode());
|
|
||||||
return 0 == errorCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取密钥
|
|
||||||
*
|
|
||||||
* @param paramsMap 参数图
|
|
||||||
* @param agentKey 代理密钥
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
private static String getKey(Map<String, Object> paramsMap, String agentKey) {
|
|
||||||
try {
|
|
||||||
Base64.Encoder encoder = Base64.getEncoder();
|
|
||||||
SecretKeySpec keySpec = new SecretKeySpec(agentKey.getBytes(StandardCharsets.UTF_8), "AES");
|
|
||||||
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
|
||||||
cipher.init(Cipher.ENCRYPT_MODE, keySpec);
|
|
||||||
return encoder.encodeToString(cipher.doFinal(JSONUtils.toJSONString(paramsMap).getBytes(StandardCharsets.UTF_8)));
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BaseException("加密失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取密钥映射
|
|
||||||
*
|
|
||||||
* @param paramsMap 参数图
|
|
||||||
* @param agentKey 代理密钥
|
|
||||||
* @param currency 货币
|
|
||||||
* @return {@link Map }<{@link String },{@link Object }>
|
|
||||||
*/
|
|
||||||
private Map<String, Object> getKeyMap(Map<String, Object> paramsMap, String agentKey, String currency, String agentId) {
|
|
||||||
Map<String, Object> keyMap = new HashMap<>();
|
|
||||||
String key = getKey(paramsMap, agentKey);
|
|
||||||
keyMap.put("Sign", Md5Utils.md5New(JSONUtils.toJSONString(paramsMap)));
|
|
||||||
keyMap.put("AgentCode", agentId);
|
|
||||||
keyMap.put("Currency", currency);
|
|
||||||
keyMap.put("Params", key);
|
|
||||||
return keyMap;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解密密钥
|
|
||||||
*
|
|
||||||
* @param gamesBaseRequestDTO 游戏基础请求dto
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
private String decryptKey(GamesBaseRequestDTO gamesBaseRequestDTO) {
|
|
||||||
try {
|
|
||||||
String val = "SBF6G5gFvW5n4aFSFCar9Im0CHgBMyU7OxFTuuB6InmRkm6Qt4K2pfktU=";
|
|
||||||
Base64.Decoder decoder = Base64.getDecoder();
|
|
||||||
SecretKeySpec keySpec = new SecretKeySpec("gamesBaseRequestDTO.getAgentKey()".getBytes(), "AES");
|
|
||||||
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
|
||||||
cipher.init(Cipher.DECRYPT_MODE, keySpec);
|
|
||||||
return new String(cipher.doFinal(decoder.decode(val)));
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BaseException("解密失败");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建成员
|
|
||||||
*
|
|
||||||
* @param createMemberRequestDTO 创建成员请求dto
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean createMember(CreateMemberRequestDTO createMemberRequestDTO) {
|
|
||||||
log.info("GamesFCServiceImpl [createMember] 请求参数 {}", createMemberRequestDTO);
|
|
||||||
Map<String, Object> paramsMap = new HashMap<>();
|
|
||||||
paramsMap.put("MemberAccount", createMemberRequestDTO.getAccount());
|
|
||||||
paramsMap.putAll(getKeyMap(paramsMap, createMemberRequestDTO.getAgentKey(), createMemberRequestDTO.getCurrency(), createMemberRequestDTO.getAgentId()));
|
|
||||||
ApiFCResult apiFCResult = FCClient.createMember(paramsMap);
|
|
||||||
int errorCode = apiFCResult.getResult();
|
|
||||||
if (0 == errorCode) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
//判断是否获取成功
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取会员信息
|
|
||||||
*
|
|
||||||
* @param memberInfoRequestDTO 会员信息请求dto
|
|
||||||
* @return {@link MemberInfoResponseDTO }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MemberInfoResponseDTO getMemberInfo(MemberInfoRequestDTO memberInfoRequestDTO) {
|
|
||||||
log.info("GamesFCServiceImpl [getMemberInfo] 请求参数 {}", memberInfoRequestDTO);
|
|
||||||
Map<String, Object> paramsMap = new HashMap<>();
|
|
||||||
paramsMap.put("MemberAccount", memberInfoRequestDTO.getAccounts());
|
|
||||||
paramsMap.putAll(getKeyMap(paramsMap, memberInfoRequestDTO.getAgentKey(), memberInfoRequestDTO.getCurrency(), memberInfoRequestDTO.getAgentId()));
|
|
||||||
ApiFCUserInfoResponseDTO apiFCUserInfoResponseDTO = FCClient.getMemberInfo(paramsMap);
|
|
||||||
int errorCode = apiFCUserInfoResponseDTO.getResult();
|
|
||||||
if (this.getIsSuccess(errorCode)) {
|
|
||||||
return MemberInfoResponseDTO.builder().account(memberInfoRequestDTO.getAccounts())
|
|
||||||
.balance(apiFCUserInfoResponseDTO.getPoints())
|
|
||||||
.status(apiFCUserInfoResponseDTO.getOnlineType() != 0 ? GameMemberStatus.ONLINE.getCode() : GameMemberStatus.OFFLINE.getCode()).build();
|
|
||||||
} else {
|
|
||||||
throw new ApiException(ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 无重定向登录
|
|
||||||
*
|
|
||||||
* @param gamesLogin 游戏登录
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String loginWithoutRedirect(GamesLogin gamesLogin) {
|
|
||||||
log.info("GamesFCServiceImpl [loginWithoutRedirect] 请求参数 {}", gamesLogin);
|
|
||||||
Map<String, Object> paramsMap = new HashMap<>();
|
|
||||||
paramsMap.put("MemberAccount", gamesLogin.getAccount());
|
|
||||||
paramsMap.put("GameID", gamesLogin.getGameId());
|
|
||||||
paramsMap.put("LanguageID", gamesLogin.getLang());
|
|
||||||
paramsMap.put("HomeUrl", gamesLogin.getHomeUrl());
|
|
||||||
paramsMap.putAll(getKeyMap(paramsMap, gamesLogin.getAgentKey(), gamesLogin.getCurrency(), gamesLogin.getAgentId()));
|
|
||||||
ApiFCLoginResponseDTO apiFCLoginResponseDTO = FCClient.loginWithoutRedirect(paramsMap);
|
|
||||||
if (this.getIsSuccess(apiFCLoginResponseDTO.getResult())) {
|
|
||||||
return apiFCLoginResponseDTO.getUrl();
|
|
||||||
} else {
|
|
||||||
throw new ApiException(ErrorCode.ACCOUNT_NOT_EXIST.getCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取游戏列表
|
|
||||||
*
|
|
||||||
* @param gamesBaseRequestDTO 游戏请求dto
|
|
||||||
* @return {@link String }
|
|
||||||
*/
|
|
||||||
@Transactional
|
|
||||||
@Override
|
|
||||||
public String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO) {
|
|
||||||
List<ApiFCGameListResponseDTO.GameDetails> apiGameInfoResponseDTOS = redisCache.getCacheList(CacheConstants.FC_GAMES);
|
|
||||||
if (!CollectionUtils.isEmpty(apiGameInfoResponseDTOS)) {
|
|
||||||
return CacheConstants.FC_GAMES;
|
|
||||||
}
|
|
||||||
|
|
||||||
gamesBaseRequestDTO.setCurrency("CNY");
|
|
||||||
log.info("GamesFCServiceImpl [getGameList] 请求参数 {}", gamesBaseRequestDTO);
|
|
||||||
Map<String, Object> paramsMap = new HashMap<>();
|
|
||||||
paramsMap.putAll(getKeyMap(paramsMap, gamesBaseRequestDTO.getAgentKey(), gamesBaseRequestDTO.getCurrency(), gamesBaseRequestDTO.getAgentId()));
|
|
||||||
ApiFCGameListResponseDTO gameList = FCClient.getGameList(paramsMap);
|
|
||||||
if (this.getIsSuccess(gameList.getResult())) {
|
|
||||||
|
|
||||||
List<ApiFCGameListResponseDTO.GameDetails> gameDetailsList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (String gameTypeKey : gameList.getGetGameIconList().keySet()) {
|
|
||||||
Map<String, ApiFCGameListResponseDTO.GameDetails> integerGameDetailsMap = gameList.getGetGameIconList().get(gameTypeKey);
|
|
||||||
GamePlatform gamePlatform = GamePlatform.builder()
|
|
||||||
.platformType(FCGameType.findSystemByCode(gameTypeKey))
|
|
||||||
.platformCode(GamePlatforms.FC.getCode())
|
|
||||||
.build();
|
|
||||||
List<GamePlatform> gamePlatforms = gamePlatformService.selectGamePlatformList(gamePlatform);
|
|
||||||
//没有此平台就新增一个平台
|
|
||||||
if (CollectionUtils.isEmpty(gamePlatforms)) {
|
|
||||||
gamePlatform.setPlatformName(GamePlatforms.FC.getInfo() + FCGameType.findInfoByCode(gameTypeKey));
|
|
||||||
gamePlatform.setSortNo(gamePlatformService.selectMaxSortNo() + 1);
|
|
||||||
gamePlatform.setCreateBy(Constants.SYSTEM);
|
|
||||||
gamePlatformService.insertGamePlatform(gamePlatform);
|
|
||||||
} else {
|
|
||||||
gamePlatform = gamePlatforms.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//新增游戏
|
|
||||||
for (String gameIdKey : integerGameDetailsMap.keySet()) {
|
|
||||||
|
|
||||||
ApiFCGameListResponseDTO.GameDetails gameDetails = integerGameDetailsMap.get(gameIdKey);
|
|
||||||
Game game = Game.builder()
|
|
||||||
.platformId(gamePlatform.getId())
|
|
||||||
.gameCode(gameIdKey)
|
|
||||||
.build();
|
|
||||||
List<Game> games = gameService.selectGameList(game);
|
|
||||||
//不存在这个游戏
|
|
||||||
if (CollectionUtils.isEmpty(games)) {
|
|
||||||
game.setGameSourceType(PlatformType.ELECTRONIC.getCode());
|
|
||||||
game.setFreespin(Boolean.FALSE);
|
|
||||||
game.setDemoStatus(Boolean.TRUE);
|
|
||||||
game.setSortNo(gameService.selectMaxSortNoByPlatformId(gamePlatform.getId()) + 1);
|
|
||||||
game.setGameName(gameDetails.getGameNameOfChinese());
|
|
||||||
game.setCreateBy(Constants.SYSTEM);
|
|
||||||
gameService.insertGame(game);
|
|
||||||
} else {
|
|
||||||
game = games.get(0);
|
|
||||||
}
|
|
||||||
gameDetails.setSystemGameId(game.getId());
|
|
||||||
|
|
||||||
List<GameName> gameNames = gameNameService.selectGameNameList(GameName.builder().gameId(game.getId()).gameName(gameDetails.getGameNameOfChinese()).build());
|
|
||||||
if (CollectionUtils.isEmpty(gameNames)) {
|
|
||||||
gameNameService.insertGameName(GameName.builder()
|
|
||||||
.gameId(game.getId())
|
|
||||||
.gameName(gameDetails.getGameNameOfChinese())
|
|
||||||
.langCode("zh-CN")
|
|
||||||
.createBy(Constants.SYSTEM)
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
gameNames = gameNameService.selectGameNameList(GameName.builder().gameId(game.getId()).gameName(gameDetails.getGameNameOfEnglish()).build());
|
|
||||||
if (CollectionUtils.isEmpty(gameNames)) {
|
|
||||||
gameNameService.insertGameName(GameName.builder()
|
|
||||||
.gameId(game.getId())
|
|
||||||
.gameName(gameDetails.getGameNameOfEnglish())
|
|
||||||
.langCode("en-US")
|
|
||||||
.createBy(Constants.SYSTEM)
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
gameDetails.setGameId(gameIdKey);
|
|
||||||
gameDetailsList.add(gameDetails);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
redisCache.deleteObject(CacheConstants.FC_GAMES);
|
|
||||||
redisCache.setCacheList(CacheConstants.FC_GAMES, gameDetailsList);
|
|
||||||
redisCache.expire(CacheConstants.FC_GAMES, 5L, TimeUnit.HOURS);
|
|
||||||
} else {
|
|
||||||
throw new ApiException(ErrorCode.ERROR.getCode());
|
|
||||||
}
|
|
||||||
return CacheConstants.FC_GAMES;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按代理id进行交换转账
|
|
||||||
*
|
|
||||||
* @param exchangeTransferMoneyRequestDTO 外汇转账moeny dto
|
|
||||||
* @return {@link Long }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO) {
|
|
||||||
log.info("GamesFCServiceImpl [exchangeTransferByAgentId] 请求参数 {}", exchangeTransferMoneyRequestDTO);
|
|
||||||
|
|
||||||
GameSecretKeyCurrency currencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
|
||||||
.platformCode(GamePlatforms.FC.getCode())
|
|
||||||
.code(exchangeTransferMoneyRequestDTO.getAgentId())
|
|
||||||
.currency(exchangeTransferMoneyRequestDTO.getCurrency())
|
|
||||||
.build());
|
|
||||||
|
|
||||||
Member member = memberService.selectMemberByGameAccount(exchangeTransferMoneyRequestDTO.getAccount());
|
|
||||||
String transactionId = gameExchangeMoneyService.getTransactionId(GamePlatforms.FC.getCode(), 30);
|
|
||||||
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(
|
|
||||||
GameExchangeMoney.builder()
|
|
||||||
.tenantKey(exchangeTransferMoneyRequestDTO.getTenantKey())
|
|
||||||
.orderId(exchangeTransferMoneyRequestDTO.getOrderId())
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
Assert.isTrue(CollectionUtils.isEmpty(gameExchangeMonies), "订单号重复");
|
|
||||||
|
|
||||||
//获取下一个自增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.FC.getCode())
|
|
||||||
.build();
|
|
||||||
exchangeMoney.setCreateBy(Constants.SYSTEM);
|
|
||||||
|
|
||||||
//获取余额
|
|
||||||
String type = TransferType.ALL.getCode().equals(exchangeTransferMoneyRequestDTO.getTransferType()) ? FCTransferType.TRANSFER_OUT_ALL.getValue() : FCTransferType.TRANSFER_OUT.getValue();
|
|
||||||
|
|
||||||
|
|
||||||
BigDecimal amount = exchangeTransferMoneyRequestDTO.getAmount();
|
|
||||||
|
|
||||||
|
|
||||||
//获取当前游戏币
|
|
||||||
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
|
|
||||||
.accounts(member.getGameAccount())
|
|
||||||
.agentId(exchangeTransferMoneyRequestDTO.getAgentId())
|
|
||||||
.agentKey(exchangeTransferMoneyRequestDTO.getAgentKey())
|
|
||||||
.currency(currencyDTO.getCurrency())
|
|
||||||
.build();
|
|
||||||
MemberInfoResponseDTO memberInfo = this.getMemberInfo(gamesBaseRequestDTO);
|
|
||||||
//判断是不是转出
|
|
||||||
if (NGTransferType.TRANSFER_OUT.getValue().equals(type)) {
|
|
||||||
exchangeTransferMoneyRequestDTO.setAmount(memberInfo.getBalance());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> paramsMap = new HashMap<>();
|
|
||||||
paramsMap.put("MemberAccount", exchangeTransferMoneyRequestDTO.getAccount());
|
|
||||||
paramsMap.put("TrsID", transactionId);
|
|
||||||
paramsMap.put("AllOut", type);
|
|
||||||
paramsMap.put("Points", amount);
|
|
||||||
paramsMap.putAll(getKeyMap(paramsMap, gamesBaseRequestDTO.getAgentKey(), gamesBaseRequestDTO.getCurrency(), gamesBaseRequestDTO.getAgentId()));
|
|
||||||
|
|
||||||
|
|
||||||
ApiCFBalanceTransferResponseDTO transferResponseDTO = FCClient.exchangeTransferByAgentId(paramsMap);
|
|
||||||
if (this.getIsSuccess(transferResponseDTO.getResult())) {
|
|
||||||
//更新数据
|
|
||||||
exchangeMoney.setBalance(transferResponseDTO.getPoints().abs());
|
|
||||||
exchangeMoney.setStatus(StatusType.IN_PROGRESS.getValue());
|
|
||||||
exchangeMoney.setCoinBefore(NumberUtil.sub(transferResponseDTO.getAfterPoint(), exchangeMoney.getBalance()).abs());
|
|
||||||
exchangeMoney.setCoinAfter(transferResponseDTO.getAfterPoint());
|
|
||||||
exchangeMoney.setCurrencyBefore(exchangeMoney.getCoinBefore());
|
|
||||||
exchangeMoney.setCurrencyAfter(exchangeMoney.getCoinAfter());
|
|
||||||
exchangeMoney.setStatus(StatusType.SUCCESS.getValue());
|
|
||||||
|
|
||||||
gameExchangeMoneyService.insertGameExchangeMoney(exchangeMoney);
|
|
||||||
} else {
|
|
||||||
log.error("GamesFCServiceImpl [exchangeTransferByAgentId] 金额转移失败,错误代码{}", transferResponseDTO.getResult());
|
|
||||||
throw new ApiException(ErrorCode.BALANCE_TRANSFER_FAILED.getCode());
|
|
||||||
}
|
|
||||||
return exchangeMoney.getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 汇兑转移状态
|
|
||||||
*
|
|
||||||
* @param exchangeTransferMoneyRequestDTO 兑换转账请求dto
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO) {
|
|
||||||
|
|
||||||
return Boolean.TRUE;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按时间获取投注记录
|
|
||||||
*
|
|
||||||
* @param betRecordByTimeDTO 按时间dto投注记录
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean getBetRecordByTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
|
||||||
|
|
||||||
|
|
||||||
List<GameSecretKeyCurrencyDTO> gameSecretKeyCurrencies = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder()
|
|
||||||
.platformCode(GamePlatforms.FC.getCode())
|
|
||||||
.build());
|
|
||||||
|
|
||||||
for (GameSecretKeyCurrency gameSecretKeyCurrency : gameSecretKeyCurrencies) {
|
|
||||||
String startTime = DateUtils.convertTimeZone(betRecordByTimeDTO.getStartTime(), "America/New_York", DateUtils.YYYY_MM_DD_HH_MM_SS);
|
|
||||||
String endTime = DateUtils.convertTimeZone(betRecordByTimeDTO.getEndTime(), "America/New_York", DateUtils.YYYY_MM_DD_HH_MM_SS);
|
|
||||||
Map<String, Object> paramsMap = new HashMap<>();
|
|
||||||
paramsMap.put("StartDate", startTime);
|
|
||||||
paramsMap.put("EndDate", endTime);
|
|
||||||
paramsMap.putAll(getKeyMap(paramsMap, betRecordByTimeDTO.getAgentKey(), gameSecretKeyCurrency.getCurrency(), betRecordByTimeDTO.getAgentId()));
|
|
||||||
|
|
||||||
ApiFCBetRecordResponseDTO betRecordByTime = FCClient.getBetRecordByTime(paramsMap);
|
|
||||||
|
|
||||||
if (this.getIsSuccess(betRecordByTime.getResult())) {
|
|
||||||
//数据组装
|
|
||||||
this.batchInsert(betRecordByTime, gameSecretKeyCurrency.getSystemCurrency(), gameSecretKeyCurrency.getCurrency());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按历史时间获取投注记录
|
|
||||||
*
|
|
||||||
* @param betRecordByTimeDTO 按时间dto投注记录
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean getBetRecordByHistoryTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
|
||||||
List<GameSecretKeyCurrencyDTO> gameSecretKeyCurrencies = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder()
|
|
||||||
.platformCode(GamePlatforms.FC.getCode())
|
|
||||||
.build());
|
|
||||||
|
|
||||||
for (GameSecretKeyCurrency gameSecretKeyCurrency : gameSecretKeyCurrencies) {
|
|
||||||
//必须两个小时之前的数据
|
|
||||||
long startTimeLong = DateUtils.addOrSubtractMinutes(betRecordByTimeDTO.getStartTime(), -120);
|
|
||||||
long endTimeLong = DateUtils.addOrSubtractMinutes(betRecordByTimeDTO.getEndTime(), -120);
|
|
||||||
|
|
||||||
//查询一个小时内的数据一次最多15分钟
|
|
||||||
int timeWheel = 60;
|
|
||||||
while (timeWheel > 0) {
|
|
||||||
String startTime = DateUtils.convertTimeZone(startTimeLong, "America/New_York", DateUtils.YYYY_MM_DD_HH_MM_SS);
|
|
||||||
String endTime = DateUtils.convertTimeZone(endTimeLong, "America/New_York", DateUtils.YYYY_MM_DD_HH_MM_SS);
|
|
||||||
Map<String, Object> paramsMap = new HashMap<>();
|
|
||||||
paramsMap.put("StartDate", startTime);
|
|
||||||
paramsMap.put("EndDate", endTime);
|
|
||||||
paramsMap.putAll(getKeyMap(paramsMap, betRecordByTimeDTO.getAgentKey(), gameSecretKeyCurrency.getCurrency(), betRecordByTimeDTO.getAgentId()));
|
|
||||||
|
|
||||||
ApiFCBetRecordResponseDTO betRecordByTime = FCClient.getBetRecordByHistoryTime(paramsMap);
|
|
||||||
|
|
||||||
if (this.getIsSuccess(betRecordByTime.getResult())) {
|
|
||||||
//数据组装
|
|
||||||
this.batchInsert(betRecordByTime, gameSecretKeyCurrency.getSystemCurrency(), gameSecretKeyCurrency.getCurrency());
|
|
||||||
}
|
|
||||||
timeWheel -= 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 赠送免费局数
|
|
||||||
*
|
|
||||||
* @param createFreeSpinRequest 创建自由旋转请求
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean createFreeSpin(CreateFreeSpinRequestDTO createFreeSpinRequest) {
|
|
||||||
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取游戏详细信息
|
|
||||||
*
|
|
||||||
* @param getGameDetailRequestDTO 获取游戏详细信息请求dto
|
|
||||||
* @return {@link GetGameDetailResponseDTO }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GetGameDetailResponseDTO getGameDetail(GetGameDetailRequestDTO getGameDetailRequestDTO) {
|
|
||||||
|
|
||||||
List<GameBettingDetails> gameBettingDetails = gameBettingDetailsService.selectGameBettingDetailsList(GameBettingDetailsDTO.builder().wagersId(getGameDetailRequestDTO.getWagersId()).build());
|
|
||||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
|
||||||
GetGameDetailResponseDTO getGameDetailResponseDTO = new GetGameDetailResponseDTO();
|
|
||||||
getGameDetailResponseDTO.setUrl(gameBettingDetails.get(0).getBetContent());
|
|
||||||
return getGameDetailResponseDTO;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 强制会员从游戏注销
|
|
||||||
*
|
|
||||||
* @param kickMemberRequestDTO 踢会员请求dto
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean kickMember(KickMemberRequestDTO kickMemberRequestDTO) {
|
|
||||||
log.info("GamesFCServiceImpl [kickMember] 请求参数 {}", kickMemberRequestDTO);
|
|
||||||
Map<String, Object> paramsMap = new HashMap<>();
|
|
||||||
paramsMap.put("MemberAccount", kickMemberRequestDTO.getAccount());
|
|
||||||
paramsMap.putAll(getKeyMap(paramsMap, kickMemberRequestDTO.getAgentKey(), kickMemberRequestDTO.getCurrency(), kickMemberRequestDTO.getAgentId()));
|
|
||||||
ApiFCResult apiFCResult = FCClient.kickMember(paramsMap);
|
|
||||||
if (this.getIsSuccess(apiFCResult.getResult())) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
} else {
|
|
||||||
throw new ApiException(ErrorCode.KICK_OUT_AILED.getCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 踢成员全部
|
|
||||||
*
|
|
||||||
* @param kickMemberAllDTO 踢成员全部dto
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean kickMemberAll(KickMemberAllDTO kickMemberAllDTO) {
|
|
||||||
log.info("GamesFCServiceImpl [kickMemberAll] 请求参数 {}", kickMemberAllDTO);
|
|
||||||
Map<String, Object> paramsMap = new HashMap<>();
|
|
||||||
paramsMap.putAll(getKeyMap(paramsMap, kickMemberAllDTO.getAgentKey(), kickMemberAllDTO.getCurrency(), kickMemberAllDTO.getAgentId()));
|
|
||||||
ApiFCResult apiFCResult = FCClient.kickMemberAll(paramsMap);
|
|
||||||
if (this.getIsSuccess(apiFCResult.getResult())) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
} else {
|
|
||||||
throw new ApiException(ErrorCode.KICK_OUT_AILED.getCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 免费游戏玩家使用的纪录
|
|
||||||
*
|
|
||||||
* @param getFreeSpinDashflowRequestDTO 获取自由旋转dashflow请求dto
|
|
||||||
* @return {@link List }<{@link GameFreeRecord }>
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<GameFreeRecord> getFreeSpinDashflow(GetFreeSpinDashflowRequestDTO getFreeSpinDashflowRequestDTO) {
|
|
||||||
|
|
||||||
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消赠送免费局数
|
|
||||||
*
|
|
||||||
* @param cancelFreeSpinRequestDTO 取消免费旋转请求
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean cancelFreeSpin(CancelFreeSpinRequestDTO cancelFreeSpinRequestDTO) {
|
|
||||||
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据构建
|
|
||||||
*
|
|
||||||
* @param gamesDataBuildDTO 数据
|
|
||||||
* @return {@link GameBettingDetails }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GameBettingDetails dataBuild(GamesDataBuildDTO gamesDataBuildDTO) {
|
|
||||||
|
|
||||||
//转化类
|
|
||||||
ApiFCBetRecordResponseDTO.BetRecord resultBean = (ApiFCBetRecordResponseDTO.BetRecord) gamesDataBuildDTO.getData();
|
|
||||||
|
|
||||||
|
|
||||||
Member member = memberService.selectMemberByGameAccount(resultBean.getAccount());
|
|
||||||
if (ObjectUtils.isEmpty(member)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
List<ApiFCGameListResponseDTO.GameDetails> gamesDatas = redisCache.getCacheList(CacheConstants.FC_GAMES);
|
|
||||||
Map<String, ApiFCGameListResponseDTO.GameDetails> dataDTOMap = gamesDatas.stream().collect(Collectors.toMap(ApiFCGameListResponseDTO.GameDetails::getGameId, e -> e));
|
|
||||||
ApiFCGameListResponseDTO.GameDetails gamesDataDTO = dataDTOMap.get(resultBean.getGameID());
|
|
||||||
|
|
||||||
// 判断输赢
|
|
||||||
Integer gameStatus = GameStatus.FLAT.getCode();
|
|
||||||
if (BigDecimal.ZERO.compareTo(resultBean.getWinlose()) > 0) {
|
|
||||||
gameStatus = GameStatus.FAIL.getCode();
|
|
||||||
} else if (BigDecimal.ZERO.compareTo(resultBean.getWinlose()) < 0) {
|
|
||||||
gameStatus = GameStatus.WIN.getCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//数据构造
|
|
||||||
GameBettingDetails gameBettingDetails = GameBettingDetails.builder()
|
|
||||||
.tenantKey(member.getTenantKey())
|
|
||||||
//保存我们的币种id
|
|
||||||
.currencyCode(gamesDataBuildDTO.getSystemCurrencyCode())
|
|
||||||
.memberId(member.getId())
|
|
||||||
.gameCode(resultBean.getGameID())
|
|
||||||
.gameType(FCGameType.findSystemByCode(resultBean.getGametype()))
|
|
||||||
.platformCode(GamePlatforms.FC.getCode())
|
|
||||||
.gameId(gamesDataDTO.getSystemGameId())
|
|
||||||
.gameName(gamesDataDTO.getGameNameOfChinese())
|
|
||||||
.gameStatus(gameStatus)
|
|
||||||
.gameStatusType(1)
|
|
||||||
.gameCurrencyCode(gamesDataBuildDTO.getCurrencyCode())
|
|
||||||
.account(resultBean.getAccount())
|
|
||||||
.wagersId(resultBean.getRecordID())
|
|
||||||
.wagersTime(resultBean.getBdate().getTime())
|
|
||||||
.betAmount(resultBean.getBet())
|
|
||||||
.payoffTime(resultBean.getBdate().getTime())
|
|
||||||
.payoffAmount(resultBean.getWinlose().abs())
|
|
||||||
.settlementTime(resultBean.getBdate().getTime())
|
|
||||||
.turnover(resultBean.getValidBet())
|
|
||||||
.settlementStatus(SettlementStatusEnum.COMPLETED.getCode())
|
|
||||||
.build();
|
|
||||||
gameBettingDetails.setCreateBy(Constants.SYSTEM);
|
|
||||||
gameBettingDetails.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return gameBettingDetails;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量插入
|
|
||||||
*
|
|
||||||
* @param data 数据
|
|
||||||
* @param systemCurrencyCode 系统货币代码
|
|
||||||
*/
|
|
||||||
private synchronized void batchInsert(ApiFCBetRecordResponseDTO data, String systemCurrencyCode, String currencyCode) {
|
|
||||||
List<GameBettingDetails> gameBettingDetails = new ArrayList<>();
|
|
||||||
List<String> wagersIds = new ArrayList<>();
|
|
||||||
//数据转化
|
|
||||||
for (ApiFCBetRecordResponseDTO.BetRecord bean : data.getRecords()) {
|
|
||||||
GameBettingDetails bettingDetails = this.dataBuild(GamesDataBuildDTO.builder().data(bean).currencyCode(currencyCode).systemCurrencyCode(systemCurrencyCode).build());
|
|
||||||
if (!ObjectUtils.isEmpty(bettingDetails)) {
|
|
||||||
bettingDetails.setId(IdUtil.getSnowflakeNextId());
|
|
||||||
gameBettingDetails.add(bettingDetails);
|
|
||||||
}
|
|
||||||
wagersIds.add(bean.getRecordID());
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
|
||||||
//查询重复数据id
|
|
||||||
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds);
|
|
||||||
//用steam流清除list中与wagersIds集合相同的数据
|
|
||||||
gameBettingDetails = gameBettingDetails.stream()
|
|
||||||
.filter(detail -> !removeWagersIds.contains(detail.getWagersId()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
|
||||||
gameBettingDetailsService.batchInsert(gameBettingDetails);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -25,7 +25,7 @@ public class JILIBetRecordDataResponseDTO {
|
||||||
* 投注id
|
* 投注id
|
||||||
*/
|
*/
|
||||||
@JsonProperty("WagersId")
|
@JsonProperty("WagersId")
|
||||||
private String wagersId;
|
private long wagersId;
|
||||||
/**
|
/**
|
||||||
* 游戏id
|
* 游戏id
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -436,19 +436,6 @@ public class GamesJILIServiceImpl implements IGamesService {
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按历史时间获取投注记录
|
|
||||||
*
|
|
||||||
* @param betRecordByTimeDTO 按时间dto投注记录
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean getBetRecordByHistoryTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 赠送免费局数
|
* 赠送免费局数
|
||||||
*
|
*
|
||||||
|
@ -701,7 +688,7 @@ public class GamesJILIServiceImpl implements IGamesService {
|
||||||
*/
|
*/
|
||||||
private void batchInsert(JILIBetRecordResponseDTO betRecordJILIResponse) {
|
private void batchInsert(JILIBetRecordResponseDTO betRecordJILIResponse) {
|
||||||
List<GameBettingDetails> gameBettingDetails = new ArrayList<>();
|
List<GameBettingDetails> gameBettingDetails = new ArrayList<>();
|
||||||
List<String> wagersIds = new ArrayList<>();
|
List<Long> wagersIds = new ArrayList<>();
|
||||||
//数据组装
|
//数据组装
|
||||||
JILIBetRecordResponseDTO.DataBean dataBean = betRecordJILIResponse.getData();
|
JILIBetRecordResponseDTO.DataBean dataBean = betRecordJILIResponse.getData();
|
||||||
//数据转化
|
//数据转化
|
||||||
|
@ -715,7 +702,7 @@ public class GamesJILIServiceImpl implements IGamesService {
|
||||||
}
|
}
|
||||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
||||||
//查询重复数据id
|
//查询重复数据id
|
||||||
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds);
|
List<Long> 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()))
|
||||||
|
|
|
@ -637,16 +637,6 @@ public class GamesPGServiceImpl implements IGamesService {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 按历史时间获取投注记录
|
|
||||||
*
|
|
||||||
* @param betRecordByTimeDTO 按时间dto投注记录
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean getBetRecordByHistoryTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -787,7 +777,7 @@ public class GamesPGServiceImpl implements IGamesService {
|
||||||
.gameStatusType(1)
|
.gameStatusType(1)
|
||||||
.gameCurrencyCode(resultBean.getCurrency())
|
.gameCurrencyCode(resultBean.getCurrency())
|
||||||
.account(resultBean.getPlayerId())
|
.account(resultBean.getPlayerId())
|
||||||
.wagersId(String.valueOf(resultBean.getGameOrderId()))
|
.wagersId(resultBean.getGameOrderId())
|
||||||
.wagersTime(resultBean.getBetTime().getTime())
|
.wagersTime(resultBean.getBetTime().getTime())
|
||||||
.betAmount(resultBean.getBetAmount().abs())
|
.betAmount(resultBean.getBetAmount().abs())
|
||||||
.payoffTime(resultBean.getLastUpdateTime().getTime())
|
.payoffTime(resultBean.getLastUpdateTime().getTime())
|
||||||
|
@ -814,7 +804,7 @@ public class GamesPGServiceImpl implements IGamesService {
|
||||||
*/
|
*/
|
||||||
private synchronized void batchInsert(ApiGameBetRecordPageResponseDTO data) {
|
private synchronized void batchInsert(ApiGameBetRecordPageResponseDTO data) {
|
||||||
List<GameBettingDetails> gameBettingDetails = new ArrayList<>();
|
List<GameBettingDetails> gameBettingDetails = new ArrayList<>();
|
||||||
List<String> wagersIds = new ArrayList<>();
|
List<Long> wagersIds = new ArrayList<>();
|
||||||
//数据转化
|
//数据转化
|
||||||
for (ApiGameBetRecordPageResponseDTO.GameBetRecord bean : data.getList()) {
|
for (ApiGameBetRecordPageResponseDTO.GameBetRecord bean : data.getList()) {
|
||||||
GameBettingDetails bettingDetails = this.dataBuild(GamesDataBuildDTO.builder().data(bean).build());
|
GameBettingDetails bettingDetails = this.dataBuild(GamesDataBuildDTO.builder().data(bean).build());
|
||||||
|
@ -822,17 +812,17 @@ public class GamesPGServiceImpl implements IGamesService {
|
||||||
bettingDetails.setId(IdUtil.getSnowflakeNextId());
|
bettingDetails.setId(IdUtil.getSnowflakeNextId());
|
||||||
gameBettingDetails.add(bettingDetails);
|
gameBettingDetails.add(bettingDetails);
|
||||||
}
|
}
|
||||||
wagersIds.add(String.valueOf(bean.getGameOrderId()));
|
wagersIds.add(bean.getGameOrderId());
|
||||||
}
|
}
|
||||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
||||||
//查询重复数据id
|
//查询重复数据id
|
||||||
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds);
|
List<Long> 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()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
||||||
List<String> wagersId = gameBettingDetails.stream().map(GameBettingDetails::getWagersId).collect(Collectors.toList());
|
List<Long> wagersId = gameBettingDetails.stream().map(GameBettingDetails::getWagersId).collect(Collectors.toList());
|
||||||
gameBettingDetailsService.deleteGameBettingDetailsByWagersId(wagersId);
|
gameBettingDetailsService.deleteGameBettingDetailsByWagersId(wagersId);
|
||||||
gameBettingDetailsService.batchInsert(gameBettingDetails);
|
gameBettingDetailsService.batchInsert(gameBettingDetails);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,15 +24,6 @@ public class GamesDataBuildDTO
|
||||||
*/
|
*/
|
||||||
private Object data;
|
private Object data;
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统货币代码
|
|
||||||
*/
|
|
||||||
private String systemCurrencyCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 货币代码
|
|
||||||
*/
|
|
||||||
private String currencyCode;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class GetGameDetailRequestDTO extends GamesBaseRequestDTO {
|
||||||
/**
|
/**
|
||||||
* 投注id
|
* 投注id
|
||||||
*/
|
*/
|
||||||
private String wagersId;
|
private Long wagersId;
|
||||||
/**
|
/**
|
||||||
* 郎
|
* 郎
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -444,17 +444,6 @@ public class GamesXKServiceImpl implements IGamesService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 按历史时间获取投注记录
|
|
||||||
*
|
|
||||||
* @param betRecordByTimeDTO 按时间dto投注记录
|
|
||||||
* @return {@link Boolean }
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Boolean getBetRecordByHistoryTime(BetRecordByTimeDTO betRecordByTimeDTO) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 赠送免费局数
|
* 赠送免费局数
|
||||||
*
|
*
|
||||||
|
@ -543,7 +532,7 @@ public class GamesXKServiceImpl implements IGamesService {
|
||||||
*/
|
*/
|
||||||
private void batchInsert(XKBetRecordResponseDTO xkBetRecordResponseDTO) {
|
private void batchInsert(XKBetRecordResponseDTO xkBetRecordResponseDTO) {
|
||||||
List<GameBettingDetails> gameBettingDetails = new ArrayList<>();
|
List<GameBettingDetails> gameBettingDetails = new ArrayList<>();
|
||||||
List<String> wagersIds = new ArrayList<>();
|
List<Long> wagersIds = new ArrayList<>();
|
||||||
//数据组装
|
//数据组装
|
||||||
XKBetRecordResponseDTO.DataBean dataBean = xkBetRecordResponseDTO.getData();
|
XKBetRecordResponseDTO.DataBean dataBean = xkBetRecordResponseDTO.getData();
|
||||||
//数据转化
|
//数据转化
|
||||||
|
@ -553,11 +542,11 @@ public class GamesXKServiceImpl implements IGamesService {
|
||||||
bettingDetails.setId(IdUtil.getSnowflakeNextId());
|
bettingDetails.setId(IdUtil.getSnowflakeNextId());
|
||||||
gameBettingDetails.add(bettingDetails);
|
gameBettingDetails.add(bettingDetails);
|
||||||
}
|
}
|
||||||
wagersIds.add(String.valueOf(bean.getWagersId()));
|
wagersIds.add(bean.getWagersId());
|
||||||
}
|
}
|
||||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
||||||
//查询重复数据id
|
//查询重复数据id
|
||||||
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds);
|
List<Long> 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()))
|
||||||
|
@ -614,7 +603,7 @@ public class GamesXKServiceImpl implements IGamesService {
|
||||||
.gameStatusType(resultBean.getType())
|
.gameStatusType(resultBean.getType())
|
||||||
.gameCurrencyCode(resultBean.getAgentId())
|
.gameCurrencyCode(resultBean.getAgentId())
|
||||||
.account(String.valueOf(resultBean.getAccount()))
|
.account(String.valueOf(resultBean.getAccount()))
|
||||||
.wagersId(String.valueOf(resultBean.getWagersId()))
|
.wagersId(resultBean.getWagersId())
|
||||||
.wagersTime(resultBean.getWagersTime())
|
.wagersTime(resultBean.getWagersTime())
|
||||||
.betAmount(resultBean.getBetAmount().abs())
|
.betAmount(resultBean.getBetAmount().abs())
|
||||||
.payoffTime(resultBean.getPayoffTime())
|
.payoffTime(resultBean.getPayoffTime())
|
||||||
|
|
|
@ -116,7 +116,8 @@ public class GameBettingDetails extends BaseEntity
|
||||||
|
|
||||||
/** 游戏注单唯一值 */
|
/** 游戏注单唯一值 */
|
||||||
@Excel(name = "游戏注单唯一值")
|
@Excel(name = "游戏注单唯一值")
|
||||||
private String wagersId;
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long wagersId;
|
||||||
|
|
||||||
/** 投注时间 (Unix 时间戳) */
|
/** 投注时间 (Unix 时间戳) */
|
||||||
@Excel(name = "投注时间 (Unix 时间戳)")
|
@Excel(name = "投注时间 (Unix 时间戳)")
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class GamePlatform extends BaseEntity
|
||||||
@Excel(name = "平台编码")
|
@Excel(name = "平台编码")
|
||||||
private String platformCode;
|
private String platformCode;
|
||||||
|
|
||||||
/** 平台类型 ff_game_platform_type 字典 */
|
/** 平台类型 ff_game_type 字典 */
|
||||||
@Excel(name = "平台类型 ff_game_platform_type 字典")
|
@Excel(name = "平台类型 ff_game_platform_type 字典")
|
||||||
private Integer platformType;
|
private Integer platformType;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ public interface GameBettingDetailsMapper
|
||||||
* @param wagersIds 投注ID
|
* @param wagersIds 投注ID
|
||||||
* @return {@link List }<{@link Long }>
|
* @return {@link List }<{@link Long }>
|
||||||
*/
|
*/
|
||||||
List<String> selectGameBettingDetailsByWagersId(@Param("wagersIds") List<String> wagersIds);
|
List<Long> selectGameBettingDetailsByWagersId(@Param("wagersIds") List<Long> wagersIds);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,5 +87,5 @@ public interface GameBettingDetailsMapper
|
||||||
* @param wagersIds 投注id
|
* @param wagersIds 投注id
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
int deleteGameBettingDetailsByWagersId(@Param("wagersIds") List<String> wagersIds);
|
int deleteGameBettingDetailsByWagersId(@Param("wagersIds") List<Long> wagersIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public interface IGameBettingDetailsService
|
||||||
* @param wagersIds 投注ID
|
* @param wagersIds 投注ID
|
||||||
* @return {@link List }<{@link Long }>
|
* @return {@link List }<{@link Long }>
|
||||||
*/
|
*/
|
||||||
List<String> selectGameBettingDetailsByWagersId(List<String> wagersIds);
|
List<Long> selectGameBettingDetailsByWagersId(List<Long> wagersIds);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,5 +89,5 @@ public interface IGameBettingDetailsService
|
||||||
* @param wagersId 投注id
|
* @param wagersId 投注id
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
int deleteGameBettingDetailsByWagersId(List<String> wagersId);
|
int deleteGameBettingDetailsByWagersId(List<Long> wagersId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class GameBettingDetailsServiceImpl implements IGameBettingDetailsService
|
||||||
* @return {@link List }<{@link Long }>
|
* @return {@link List }<{@link Long }>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<String> selectGameBettingDetailsByWagersId(List<String> wagersIds) {
|
public List<Long> selectGameBettingDetailsByWagersId(List<Long> wagersIds) {
|
||||||
return gameBettingDetailsMapper.selectGameBettingDetailsByWagersId(wagersIds);
|
return gameBettingDetailsMapper.selectGameBettingDetailsByWagersId(wagersIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ public class GameBettingDetailsServiceImpl implements IGameBettingDetailsService
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteGameBettingDetailsByWagersId(List<String> wagersId) {
|
public int deleteGameBettingDetailsByWagersId(List<Long> wagersId) {
|
||||||
return gameBettingDetailsMapper.deleteGameBettingDetailsByWagersId(wagersId);
|
return gameBettingDetailsMapper.deleteGameBettingDetailsByWagersId(wagersId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.ff.base.core.redis.RedisCache;
|
||||||
import com.ff.base.datasource.DynamicDataSourceContextHolder;
|
import com.ff.base.datasource.DynamicDataSourceContextHolder;
|
||||||
import com.ff.base.enums.GamePlatforms;
|
import com.ff.base.enums.GamePlatforms;
|
||||||
import com.ff.base.enums.NGPlatforms;
|
import com.ff.base.enums.NGPlatforms;
|
||||||
import com.ff.base.enums.PlatformType;
|
|
||||||
import com.ff.base.enums.StatusType;
|
import com.ff.base.enums.StatusType;
|
||||||
import com.ff.base.utils.DateUtils;
|
import com.ff.base.utils.DateUtils;
|
||||||
import com.ff.game.api.IGamesService;
|
import com.ff.game.api.IGamesService;
|
||||||
|
@ -92,8 +91,7 @@ public class GameTask {
|
||||||
|
|
||||||
for (String gameKey : gamesService.keySet()) {
|
for (String gameKey : gamesService.keySet()) {
|
||||||
String platformCode = gameKey.replace(Constants.SERVICE, "");
|
String platformCode = gameKey.replace(Constants.SERVICE, "");
|
||||||
//特殊的平台跳过
|
if (NGPlatforms.exists(platformCode)) {
|
||||||
if (NGPlatforms.exists(platformCode)|| GamePlatforms.FC.getInfo().equals(platformCode)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,94 +120,6 @@ public class GameTask {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 插入游戏cfbetting详细信息
|
|
||||||
*/
|
|
||||||
public void insertGameCFBettingDetails(Integer backTime) {
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
//捞取指定分钟前的数据
|
|
||||||
Long startTime = DateUtils.addOrSubtractMinutes(DateUtils.getNowDate(), backTime);
|
|
||||||
Long endTime = DateUtils.getNowDate();
|
|
||||||
|
|
||||||
for (String gameKey : gamesService.keySet()) {
|
|
||||||
String platformCode = gameKey.replace(Constants.SERVICE, "");
|
|
||||||
//不是特殊的平台跳过
|
|
||||||
if (!GamePlatforms.FC.getInfo().equals(platformCode)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
List<GameSecretKey> gameSecretKeys = gameSecretKeyService.selectGameSecretKeyList(GameSecretKey.builder().platform(platformCode).build());
|
|
||||||
for (GameSecretKey gameSecretKey : gameSecretKeys) {
|
|
||||||
try {
|
|
||||||
gamesService.get(gameKey).getGameList(GamesBaseRequestDTO.builder()
|
|
||||||
.agentId(gameSecretKey.getCode())
|
|
||||||
.agentKey(gameSecretKey.getKey())
|
|
||||||
.build());
|
|
||||||
BetRecordByTimeDTO betRecordByTimeDTO = new BetRecordByTimeDTO();
|
|
||||||
betRecordByTimeDTO.setGamePlatform(gameSecretKey.getPlatform());
|
|
||||||
betRecordByTimeDTO.setStartTime(startTime);
|
|
||||||
betRecordByTimeDTO.setEndTime(endTime);
|
|
||||||
betRecordByTimeDTO.setPage(1);
|
|
||||||
betRecordByTimeDTO.setPageLimit(1000);
|
|
||||||
betRecordByTimeDTO.setAgentId(gameSecretKey.getCode());
|
|
||||||
betRecordByTimeDTO.setAgentKey(gameSecretKey.getKey());
|
|
||||||
gamesService.get(gameKey).getBetRecordByTime(betRecordByTimeDTO);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("查询 平台 {} 投注记录失败,错误信息 {}", gameSecretKey.getCode(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("查询 FC 投注记录失败,错误信息 {}", e);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 插入历史游戏投注详细信息 部分平台使用
|
|
||||||
*
|
|
||||||
* @param backTime 返回时间
|
|
||||||
*/
|
|
||||||
public void insertHistoryGameBettingDetails(Integer backTime) {
|
|
||||||
|
|
||||||
//捞取指定分钟前的数据
|
|
||||||
Long startTime = DateUtils.addOrSubtractMinutes(DateUtils.getNowDate(), backTime);
|
|
||||||
Long endTime = DateUtils.getNowDate();
|
|
||||||
|
|
||||||
|
|
||||||
for (String gameKey : gamesService.keySet()) {
|
|
||||||
String platformCode = gameKey.replace(Constants.SERVICE, "");
|
|
||||||
|
|
||||||
List<GameSecretKey> gameSecretKeys = gameSecretKeyService.selectGameSecretKeyList(GameSecretKey.builder().platform(platformCode).build());
|
|
||||||
for (GameSecretKey gameSecretKey : gameSecretKeys) {
|
|
||||||
try {
|
|
||||||
gamesService.get(gameKey).getGameList(GamesBaseRequestDTO.builder()
|
|
||||||
.agentId(gameSecretKey.getCode())
|
|
||||||
.agentKey(gameSecretKey.getKey())
|
|
||||||
.build());
|
|
||||||
BetRecordByTimeDTO betRecordByTimeDTO = new BetRecordByTimeDTO();
|
|
||||||
betRecordByTimeDTO.setGamePlatform(gameSecretKey.getPlatform());
|
|
||||||
betRecordByTimeDTO.setStartTime(startTime);
|
|
||||||
betRecordByTimeDTO.setEndTime(endTime);
|
|
||||||
betRecordByTimeDTO.setPage(1);
|
|
||||||
betRecordByTimeDTO.setPageLimit(1000);
|
|
||||||
betRecordByTimeDTO.setAgentId(gameSecretKey.getCode());
|
|
||||||
betRecordByTimeDTO.setAgentKey(gameSecretKey.getKey());
|
|
||||||
gamesService.get(gameKey).getBetRecordByHistoryTime(betRecordByTimeDTO);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("查询 平台 {} 投注记录失败,错误信息 {}", gameSecretKey.getCode(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入游戏ngbetting详细信息
|
* 插入游戏ngbetting详细信息
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -89,7 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="selectGameBettingDetailsByWagersId" resultType="java.lang.String">
|
<select id="selectGameBettingDetailsByWagersId" resultType="java.lang.Long">
|
||||||
select wagers_id from ff_game_betting_details
|
select wagers_id from ff_game_betting_details
|
||||||
|
|
||||||
where wagers_id in
|
where wagers_id in
|
||||||
|
|
Loading…
Reference in New Issue