feat(game): 添加游戏兑换功能并优化相关数据结构

- 在 GameExchangeMoney 和 TenantGameQuotaFlow 表中添加订单号字段- 更新相关接口和实现类以支持订单号查询
- 添加币种汇率相关接口
- 优化成员信息请求结构
- 更新游戏配额类型枚举
main-p
shi 2025-02-22 10:58:23 +08:00
parent 3c2b86e64f
commit d717350e61
38 changed files with 758 additions and 28 deletions

View File

@ -3,9 +3,14 @@ package com.ff.api.controller;
import com.ff.annotation.CheckHeader;
import com.ff.api.response.TenantInfoResponse;
import com.ff.base.constant.Constants;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.enums.QuotaType;
import com.ff.base.system.service.ISysDeptService;
import com.ff.base.system.service.ISysRoleService;
import com.ff.base.utils.SecurityUtils;
import com.ff.base.utils.StringUtils;
import com.ff.base.utils.bean.BeanUtils;
import com.ff.common.domain.TenantGameQuota;
import com.ff.common.domain.TenantSecretKey;
@ -13,6 +18,7 @@ import com.ff.common.service.ITenantGameQuotaService;
import com.ff.common.service.ITenantSecretKeyService;
import com.ff.config.KeyConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -34,16 +40,39 @@ public class ApiAgentController extends BaseController {
@Resource
private ITenantSecretKeyService tenantSecretKeyService;
@Resource
private KeyConfig keyConfig;
@Resource
private ISysRoleService roleService;
@Resource
private ISysDeptService deptService;
//
// /**
// * 信息
// *
// * @return {@link AjaxResult }
// */
// @PostMapping("/create/tenant")
// public AjaxResult info(TenantSecretKey tenantSecretKey) {
// public AjaxResult createTenant(TenantSecretKey tenantSecretKey) {
// roleService.selectRoleList(tenantSecretKey)
// if (!userService.checkUserNameUnique(user))
// {
// return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
// }
// else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
// {
// return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
// }
// else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
// {
// return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
// }
// user.setCreateBy(getUsername());
// user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
// return toAjax(userService.insertUser(user));
//
// tenantSecretKey.setAgentId(getUserId());
// tenantSecretKeyService.insertTenantSecretKey(tenantSecretKey);
// return AjaxResult.success(tenantInfoResponse);

View File

@ -203,6 +203,7 @@ public class ApiGameController extends BaseController {
ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO = ExchangeTransferMoneyRequestDTO.builder()
.agentId(gameSecretKey.getCode())
.agentKey(gameSecretKey.getKey())
.orderId(gameExchangeBalanceRequest.getOrderId())
.account(member.getGameAccount())
.tenantKey(tenantSecretKey.getTenantKey())
.quota(quota)
@ -459,6 +460,7 @@ public class ApiGameController extends BaseController {
ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO = ExchangeTransferMoneyRequestDTO.builder()
.agentId(gameSecretKey.getCode())
.agentKey(gameSecretKey.getKey())
.orderId(gameExchangeBalanceAllRequest.getOrderId())
.amount(BigDecimal.ONE)
.tenantKey(tenantSecretKey.getTenantKey())
.account(member.getGameAccount())

View File

@ -1,9 +1,11 @@
package com.ff.api.request;
import com.ff.base.annotation.Excel;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
*
@ -16,4 +18,29 @@ public class AgentCreateTenant implements Serializable {
private static final long serialVersionUID = -5561068216486978354L;
/**
*
*/
private String account;
/**
*
*/
private String password;
/**
*
*/
private String confirmPassword;
/** 额度类型 TenantQuotaType 枚举 */
private Integer quotaType;
/** 买分比例 */
@Excel(name = "买分比例")
private BigDecimal scoreRatio;
/** 租户类型 TenantType 枚举 */
private Integer tenantType;
/** 透支比例 */
private BigDecimal depositRatio;
}

View File

@ -1,6 +1,7 @@
package com.ff.api.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
@ -21,18 +22,21 @@ public class GameCancelFreeSpinRequest implements Serializable {
*
*/
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
/**
*
*/
@NotBlank(message = "platformCode不能为空")
@Length(max = 64, message = "platformCode长度不能超过64个字符")
private String platformCode;
/**
* id
*/
@NotBlank(message = "referenceId不能为空")
@Length(max = 40, message = "referenceId长度不能超过40个字符")
private String referenceId;

View File

@ -5,6 +5,8 @@ import com.ff.validation.ListSizeCheck;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@ -26,18 +28,21 @@ public class GameCreateFreeSpinRequest implements Serializable {
* (JILI )
*/
@NotBlank(message = "account不能为空")
@Length(max = 64, message = "account长度不能超过64个字符")
private String account;
/**
*
*/
@NotBlank(message = "platformCode不能为空")
@Length(max = 64, message = "platformCode长度不能超过64个字符")
private String platformCode;
/**
* 使
*/
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
/**
@ -53,6 +58,7 @@ public class GameCreateFreeSpinRequest implements Serializable {
*
*/
@NotNull(message = "freeSpinValidity不能为空")
@Min(value = 1, message = "freeSpinValidity最小值为1")
private Long freeSpinValidity;
/**

View File

@ -29,7 +29,11 @@ public class GameExchangeBalanceAllRequest implements Serializable {
private String account;
/**
* id
*/
@NotBlank(message = "orderId不能为空")
private String orderId;
/** 币种编码 */

View File

@ -27,23 +27,33 @@ public class GameExchangeBalanceRequest implements Serializable {
*
*/
@NotBlank(message = "account不能为空")
@Length(max = 64, message = "account长度不能超过64个字符")
private String account;
/** 平台编码 */
@NotBlank(message = "platformCode不能为空")
@Length(max = 64, message = "platformCode长度不能超过64个字符")
private String platformCode;
/**
* id
*/
@NotBlank(message = "orderId不能为空")
@Length(max = 124, message = "orderId长度不能超过124个字符")
private String orderId;
/**
*
*/
@NotNull(message = "amount不能为空")
@Min(value = 0, message = "amount最小值为0")
@Max(value = 999999999, message = "amount最大值为999999999")
private BigDecimal amount;
/** 币种编码 */
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
/**

View File

@ -2,6 +2,7 @@ package com.ff.api.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
@ -25,12 +26,14 @@ public class GameGetBetRecordRequest implements Serializable {
*
*/
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
/**
*
*/
@NotBlank(message = "platformCode不能为空")
@Length(max = 64, message = "platformCode长度不能超过64个字符")
private String platformCode;
/**

View File

@ -26,12 +26,14 @@ public class GameGetDetailRequest implements Serializable {
*
*/
@NotBlank(message = "platformCode不能为空")
@Length(max = 64, message = "platformCode长度不能超过64个字符")
private String platformCode;
/**
*
*/
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
/**

View File

@ -3,6 +3,7 @@ package com.ff.api.request;
import com.dtflys.forest.annotation.BaseRequest;
import com.ff.base.core.domain.BaseEntity;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
@ -24,12 +25,14 @@ public class GameGetFreeSpinDashflowRequest implements Serializable {
*
*/
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
/**
*
*/
@NotBlank(message = "platformCode不能为空")
@Length(max = 64, message = "platformCode长度不能超过64个字符")
private String platformCode;

View File

@ -1,6 +1,7 @@
package com.ff.api.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@ -20,12 +21,14 @@ public class GameKickMemeberAllRequest implements Serializable {
*
*/
@NotBlank(message = "platformCode不能为空")
@Length(max = 64, message = "platformCode长度不能超过64个字符")
private String platformCode;
/**
* 使
*/
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
/**

View File

@ -26,18 +26,21 @@ public class GameKickMemeberRequest implements Serializable {
*
*/
@NotBlank(message = "account不能为空")
@Length(max = 64, message = "account长度不能超过64个字符")
private String account;
/**
*
*/
@NotBlank(message = "platformCode不能为空")
@Length(max = 64, message = "platformCode长度不能超过64个字符")
private String platformCode;
/**
* 使
*/
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;

View File

@ -1,6 +1,7 @@
package com.ff.api.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@ -22,18 +23,21 @@ public class GameLoginRequest implements Serializable {
*
*/
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
/**
* id
*/
@NotBlank(message = "langCode不能为空")
@Length(max = 32, message = "langCode长度不能超过32个字符")
private String langCode;
/**
*
*/
@NotBlank(message = "account不能为空")
@Length(max = 64, message = "account长度不能超过64个字符")
private String account;
/**

View File

@ -2,6 +2,7 @@ package com.ff.api.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@ -19,14 +20,17 @@ public class MemberCreateApiRequest implements Serializable{
private static final long serialVersionUID = 8071608271351542925L;
@NotBlank(message = "account不能为空")
@Length(max = 64, message = "account长度不能超过64个字符")
private String account;
/** 平台编码 */
@NotBlank(message = "platformCode不能为空")
@Length(max = 64, message = "platformCode长度不能超过64个字符")
private String platformCode;
/** 币种编码 */
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
}

View File

@ -2,6 +2,7 @@ package com.ff.api.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@ -21,6 +22,7 @@ public class MemberInfoAllApiRequest implements Serializable{
*
*/
@NotBlank(message = "account不能为空")
@Length(max = 64, message = "account长度不能超过64个字符")
private String account;
/**

View File

@ -2,6 +2,7 @@ package com.ff.api.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@ -19,14 +20,17 @@ public class MemberInfoApiRequest implements Serializable{
private static final long serialVersionUID = 8071608271351542925L;
@NotBlank(message = "account不能为空")
@Length(max = 64, message = "account长度不能超过64个字符")
private String account;
/** 平台编码 */
@NotBlank(message = "platformCode不能为空")
@Length(max = 64, message = "platformCode长度不能超过64个字符")
private String platformCode;
/** 币种编码 */
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
}

View File

@ -0,0 +1,104 @@
package com.ff.common.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ff.base.annotation.Log;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.enums.BusinessType;
import com.ff.common.domain.TenantQuotaExchange;
import com.ff.common.service.ITenantQuotaExchangeService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-21
*/
@RestController
@RequestMapping("/common/exchange")
public class TenantQuotaExchangeController extends BaseController
{
@Autowired
private ITenantQuotaExchangeService tenantQuotaExchangeService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:exchange:list')")
@GetMapping("/list")
public TableDataInfo list(TenantQuotaExchange tenantQuotaExchange)
{
startPage();
List<TenantQuotaExchange> list = tenantQuotaExchangeService.selectTenantQuotaExchangeList(tenantQuotaExchange);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:exchange:export')")
@Log(title = "币种汇率", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TenantQuotaExchange tenantQuotaExchange)
{
List<TenantQuotaExchange> list = tenantQuotaExchangeService.selectTenantQuotaExchangeList(tenantQuotaExchange);
ExcelUtil<TenantQuotaExchange> util = new ExcelUtil<TenantQuotaExchange>(TenantQuotaExchange.class);
util.exportExcel(response, list, "币种汇率数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:exchange:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tenantQuotaExchangeService.selectTenantQuotaExchangeById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:exchange:add')")
@Log(title = "币种汇率", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TenantQuotaExchange tenantQuotaExchange)
{
return toAjax(tenantQuotaExchangeService.insertTenantQuotaExchange(tenantQuotaExchange));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:exchange:edit')")
@Log(title = "币种汇率", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TenantQuotaExchange tenantQuotaExchange)
{
return toAjax(tenantQuotaExchangeService.updateTenantQuotaExchange(tenantQuotaExchange));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:exchange:remove')")
@Log(title = "币种汇率", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tenantQuotaExchangeService.deleteTenantQuotaExchangeByIds(ids));
}
}

View File

@ -37,6 +37,17 @@ public class TenantGameQuotaFlow extends BaseEntity
@Excel(name = "用户账号id")
private Long memberId;
/** 平台 */
@Excel(name = "平台")
private String platformCode;
/** 币种代码 */
@Excel(name = "币种代码")
private String currencyCode;
/** 充值类型 false 扣除 true 充值 */
@Excel(name = "充值类型 false 扣除 true 充值")
private Boolean isOut;
@ -53,6 +64,15 @@ public class TenantGameQuotaFlow extends BaseEntity
@Excel(name = "游戏额度")
private BigDecimal balance;
/** 兑换比例 */
@Excel(name = "兑换比例")
private BigDecimal exchangeRatio;
/** 兑换金额 */
@Excel(name = "兑换金额")
private BigDecimal exchangeMoney;
/** 游戏额度之后 */
@Excel(name = "游戏额度之后")
private BigDecimal balanceAfter;

View File

@ -0,0 +1,53 @@
package com.ff.common.domain;
import java.math.BigDecimal;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* ff_tenant_quota_exchange
*
* @author shi
* @date 2025-02-21
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class TenantQuotaExchange extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
private Long id;
/** 币种编码 */
@Excel(name = "币种编码")
private String currencyCode;
/** 兑换币种编码 */
@Excel(name = "兑换币种编码")
private String exchangeCurrencyCode;
/** 市场兑换金额 */
@Excel(name = "市场兑换金额")
private BigDecimal exchangeRate;
/** 汇率差 1百分比 2 固定值 */
@Excel(name = "汇率差 1百分比 2 固定值")
private Integer differenceType;
/** 汇率差值 */
@Excel(name = "汇率差值")
private BigDecimal differenceValue;
/** 实际兑换金额 */
@Excel(name = "实际兑换金额")
private BigDecimal actualBalance;
}

View File

@ -48,4 +48,9 @@ public class BalanceChangesDTO implements Serializable {
/** 操作类型 OperationType枚举 */
private Integer operationType;
/**
*
*/
private BigDecimal actualBalance;
}

View File

@ -67,5 +67,5 @@ public interface TenantGameQuotaFlowMapper
* @param tenantGameQuotaFlow
* @return {@link BigDecimal }
*/
BigDecimal getBalanceByMemberId(TenantGameQuotaFlow tenantGameQuotaFlow);
BigDecimal getExchangeMoneyByMemberId(TenantGameQuotaFlow tenantGameQuotaFlow);
}

View File

@ -0,0 +1,72 @@
package com.ff.common.mapper;
import java.util.List;
import com.ff.common.domain.TenantQuotaExchange;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author shi
* @date 2025-02-21
*/
public interface TenantQuotaExchangeMapper
{
/**
*
*
* @param id
* @return
*/
TenantQuotaExchange selectTenantQuotaExchangeById(Long id);
/**
*
*
* @param tenantQuotaExchange
* @return
*/
List<TenantQuotaExchange> selectTenantQuotaExchangeList(TenantQuotaExchange tenantQuotaExchange);
/**
*
*
* @param tenantQuotaExchange
* @return
*/
int insertTenantQuotaExchange(TenantQuotaExchange tenantQuotaExchange);
/**
*
*
* @param tenantQuotaExchange
* @return
*/
int updateTenantQuotaExchange(TenantQuotaExchange tenantQuotaExchange);
/**
*
*
* @param id
* @return
*/
int deleteTenantQuotaExchangeById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantQuotaExchangeByIds(Long[] ids);
/**
*
*
* @param currencyCode
* @param exchangeCurrencyCode
* @return {@link TenantQuotaExchange }
*/
TenantQuotaExchange getTenantQuotaExchange(@Param("currencyCode") String currencyCode, @Param("exchangeCurrencyCode") String exchangeCurrencyCode);
}

View File

@ -66,5 +66,5 @@ public interface ITenantGameQuotaFlowService
* @param tenantGameQuotaFlow
* @return {@link BigDecimal }
*/
BigDecimal getBalanceByMemberId(TenantGameQuotaFlow tenantGameQuotaFlow);
BigDecimal getExchangeMoneyByMemberId(TenantGameQuotaFlow tenantGameQuotaFlow);
}

View File

@ -0,0 +1,72 @@
package com.ff.common.service;
import java.util.List;
import com.ff.common.domain.TenantQuotaExchange;
import org.apache.poi.ss.formula.functions.T;
/**
* Service
*
* @author shi
* @date 2025-02-21
*/
public interface ITenantQuotaExchangeService
{
/**
*
*
* @param id
* @return
*/
TenantQuotaExchange selectTenantQuotaExchangeById(Long id);
/**
*
*
* @param tenantQuotaExchange
* @return
*/
List<TenantQuotaExchange> selectTenantQuotaExchangeList(TenantQuotaExchange tenantQuotaExchange);
/**
*
*
* @param currencyCode
* @param exchangeCurrencyCode
* @return {@link TenantQuotaExchange }
*/
TenantQuotaExchange getTenantQuotaExchange(String currencyCode,String exchangeCurrencyCode);
/**
*
*
* @param tenantQuotaExchange
* @return
*/
int insertTenantQuotaExchange(TenantQuotaExchange tenantQuotaExchange);
/**
*
*
* @param tenantQuotaExchange
* @return
*/
int updateTenantQuotaExchange(TenantQuotaExchange tenantQuotaExchange);
/**
*
*
* @param ids
* @return
*/
int deleteTenantQuotaExchangeByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantQuotaExchangeById(Long id);
}

View File

@ -102,7 +102,7 @@ public class TenantGameQuotaFlowServiceImpl implements ITenantGameQuotaFlowServi
* @return {@link BigDecimal }
*/
@Override
public BigDecimal getBalanceByMemberId(TenantGameQuotaFlow tenantGameQuotaFlow) {
return tenantGameQuotaFlowMapper.getBalanceByMemberId(tenantGameQuotaFlow);
public BigDecimal getExchangeMoneyByMemberId(TenantGameQuotaFlow tenantGameQuotaFlow) {
return tenantGameQuotaFlowMapper.getExchangeMoneyByMemberId(tenantGameQuotaFlow);
}
}

View File

@ -1,6 +1,7 @@
package com.ff.common.service.impl;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Map;
@ -13,10 +14,12 @@ import com.ff.base.utils.NumberUtils;
import com.ff.base.utils.QuotaUtils;
import com.ff.base.utils.StringUtils;
import com.ff.common.domain.TenantGameQuotaFlow;
import com.ff.common.domain.TenantQuotaExchange;
import com.ff.common.domain.TenantSecretKey;
import com.ff.common.dto.BalanceChangesDTO;
import com.ff.common.dto.GameBalanceExchange;
import com.ff.common.service.ITenantGameQuotaFlowService;
import com.ff.common.service.ITenantQuotaExchangeService;
import com.ff.common.service.ITenantSecretKeyService;
import com.ff.game.api.IGamesService;
import com.ff.game.api.request.MemberInfoRequestDTO;
@ -65,6 +68,11 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
@Autowired
private Map<String, IGamesService> gamesService;
@Resource
private ITenantQuotaExchangeService tenantQuotaExchangeService;
/**
*
*
@ -77,7 +85,6 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
}
/**
*
*
@ -147,10 +154,15 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
TenantGameQuota tenantGameQuota = this.selectTenantGameQuotaByTenantKey(balanceChangesDTO.getTenantKey(), balanceChangesDTO.getQuotaType());
BigDecimal balanceBefore = tenantGameQuota.getBalance();
BigDecimal balance = balanceChangesDTO.getBalance();
//如果有汇率 则需要计算真实扣除额度
if (!ObjectUtils.isEmpty(balanceChangesDTO.getActualBalance())){
balance=NumberUtil.div(balance,balanceChangesDTO.getActualBalance(),2, RoundingMode.FLOOR);
}
if (BigDecimal.ZERO.compareTo(balance) >= 0) {
return Boolean.TRUE;
}
BigDecimal balanceAfter = tenantGameQuota.getBalance();
BigDecimal balanceAfter;
//判断是充值还是扣除
if (balanceChangesDTO.getIsOut()) {
balanceAfter = NumberUtil.add(balanceBefore, balance);
@ -159,8 +171,8 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
}
//判断剩余额度是否大于0
TenantSecretKey tenantSecretKey = tenantSecretKeyService.selectTenantSecretKeyByTenantKey(balanceChangesDTO.getTenantKey());
if (TenantType.DEPOSIT.getCode().equals(tenantSecretKey.getTenantType())) {
TenantGameQuota depositQuota = tenantGameQuotaMapper.selectTenantGameQuotaByTenantKey(balanceChangesDTO.getTenantKey(), QuotaUtils.getReputationQuota(balanceChangesDTO.getQuotaType()));
if (TenantType.DEPOSIT.getCode().equals(tenantSecretKey.getTenantType()) && balanceAfter.compareTo(BigDecimal.ZERO) < 0) {
TenantGameQuota depositQuota = this.selectTenantGameQuotaByTenantKey(balanceChangesDTO.getTenantKey(), QuotaUtils.getReputationQuota(balanceChangesDTO.getQuotaType()));
//判断剩余额度是否大于0
Assert.isTrue(balanceAfter.compareTo(depositQuota.getBalance().negate()) >= 0, "余额额度不足");
} else {
@ -184,6 +196,8 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
.tenantKey(balanceChangesDTO.getTenantKey())
.isOut(balanceChangesDTO.getIsOut())
.balanceAfter(balanceAfter)
.exchangeRatio(balanceChangesDTO.getActualBalance())
.exchangeMoney(balanceChangesDTO.getBalance())
.memberId(balanceChangesDTO.getMemberId())
.balance(balance)
.balanceBefore(balanceBefore)
@ -209,6 +223,10 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
// 检查平台密钥是否存在,否则抛出异常
ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
TenantQuotaExchange tenantQuotaExchange = tenantQuotaExchangeService.getTenantQuotaExchange(Constants.USDT, gameBalanceExchange.getCurrencyCode());
ApiException.notNull(tenantQuotaExchange, ErrorCode.CURRENCY_EXCHANGE.getCode());
// 获取租户信息
TenantSecretKey tenantSecretKey = tenantSecretKeyService.selectTenantSecretKeyByTenantKey(gameBalanceExchange.getTenantKey());
// 获取用户信息
@ -242,13 +260,13 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
balanceRequestAmount = iGamesService.getMemberInfo(gamesBaseRequestDTO).getBalance();
// 计算累计转入和转出金额
BigDecimal balanceInto = tenantGameQuotaFlowService.getBalanceByMemberId(TenantGameQuotaFlow.builder()
BigDecimal balanceInto = tenantGameQuotaFlowService.getExchangeMoneyByMemberId(TenantGameQuotaFlow.builder()
.isOut(Boolean.TRUE)
.quotaType(quotaType)
.tenantKey(gameBalanceExchange.getTenantKey())
.memberId(member.getId())
.build());
BigDecimal balanceOut = tenantGameQuotaFlowService.getBalanceByMemberId(TenantGameQuotaFlow.builder()
BigDecimal balanceOut = tenantGameQuotaFlowService.getExchangeMoneyByMemberId(TenantGameQuotaFlow.builder()
.isOut(Boolean.FALSE)
.quotaType(quotaType)
.tenantKey(gameBalanceExchange.getTenantKey())
@ -280,6 +298,7 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
// 进行租户余额调整
this.balanceChanges(BalanceChangesDTO.builder()
.isOut(isOut)
.actualBalance(tenantQuotaExchange.getActualBalance())
.tenantKey(gameBalanceExchange.getTenantKey())
.balance(balanceRequestAmount)
.memberId(member.getId())
@ -325,6 +344,7 @@ public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
if (balanceRequestAmount.compareTo(BigDecimal.ZERO) > 0) {
this.balanceChanges(BalanceChangesDTO.builder()
.isOut(Boolean.FALSE)
.actualBalance(tenantQuotaExchange.getActualBalance())
.tenantKey(tenantSecretKey.getTenantKey())
.balance(balanceRequestAmount)
.memberId(member.getId())

View File

@ -0,0 +1,108 @@
package com.ff.common.service.impl;
import java.util.List;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.common.mapper.TenantQuotaExchangeMapper;
import com.ff.common.domain.TenantQuotaExchange;
import com.ff.common.service.ITenantQuotaExchangeService;
/**
* Service
*
* @author shi
* @date 2025-02-21
*/
@Service
public class TenantQuotaExchangeServiceImpl implements ITenantQuotaExchangeService
{
@Autowired
private TenantQuotaExchangeMapper tenantQuotaExchangeMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantQuotaExchange selectTenantQuotaExchangeById(Long id)
{
return tenantQuotaExchangeMapper.selectTenantQuotaExchangeById(id);
}
/**
*
*
* @param tenantQuotaExchange
* @return
*/
@Override
public List<TenantQuotaExchange> selectTenantQuotaExchangeList(TenantQuotaExchange tenantQuotaExchange)
{
return tenantQuotaExchangeMapper.selectTenantQuotaExchangeList(tenantQuotaExchange);
}
/**
*
*
* @param currencyCode
* @param exchangeCurrencyCode
* @return {@link TenantQuotaExchange }
*/
@Override
public TenantQuotaExchange getTenantQuotaExchange(String currencyCode, String exchangeCurrencyCode) {
return tenantQuotaExchangeMapper.getTenantQuotaExchange(currencyCode, exchangeCurrencyCode);
}
/**
*
*
* @param tenantQuotaExchange
* @return
*/
@Override
public int insertTenantQuotaExchange(TenantQuotaExchange tenantQuotaExchange)
{
tenantQuotaExchange.setCreateTime(DateUtils.getNowDate());
return tenantQuotaExchangeMapper.insertTenantQuotaExchange(tenantQuotaExchange);
}
/**
*
*
* @param tenantQuotaExchange
* @return
*/
@Override
public int updateTenantQuotaExchange(TenantQuotaExchange tenantQuotaExchange)
{
tenantQuotaExchange.setUpdateTime(DateUtils.getNowDate());
return tenantQuotaExchangeMapper.updateTenantQuotaExchange(tenantQuotaExchange);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantQuotaExchangeByIds(Long[] ids)
{
return tenantQuotaExchangeMapper.deleteTenantQuotaExchangeByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantQuotaExchangeById(Long id)
{
return tenantQuotaExchangeMapper.deleteTenantQuotaExchangeById(id);
}
}

View File

@ -298,12 +298,19 @@ public class GamesJILIServiceImpl implements IGamesService {
Member member = memberService.selectMemberByGameAccount(exchangeTransferMoneyRequestDTO.getAccount());
String transactionId = GamePlatforms.JILI.getCode() + IdUtils.simpleUUID();
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(
GameExchangeMoney.builder()
.tenantKey(exchangeTransferMoneyRequestDTO.getTenantKey())
.orderId(exchangeTransferMoneyRequestDTO.getOrderId())
.build()
);
Assert.isTrue(CollectionUtils.isEmpty(gameExchangeMonies), "订单号重复");
//获取下一个自增id
GameExchangeMoney exchangeMoney = GameExchangeMoney
.builder()
.orderId(exchangeTransferMoneyRequestDTO.getOrderId())
.tenantKey(exchangeTransferMoneyRequestDTO.getTenantKey())
.quota(exchangeTransferMoneyRequestDTO.getQuota())
.balance(exchangeTransferMoneyRequestDTO.getAmount())

View File

@ -32,7 +32,10 @@ public class ExchangeTransferMoneyRequestDTO extends GamesBaseRequestDTO {
*/
private String tenantKey;
/**
* id
*/
private String orderId;
/**
*
*/

View File

@ -308,10 +308,19 @@ public class GamesXKServiceImpl implements IGamesService {
String systemByCode = gameSecretKeyService.findSystemByCode(exchangeTransferMoneyRequestDTO.getAgentId(), GamePlatforms.XK.getInfo());
Member member = memberService.selectMemberByGameAccount(exchangeTransferMoneyRequestDTO.getAccount());
String transactionId = GamePlatforms.XK.getCode() + IdUtils.simpleUUID();
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())

View File

@ -37,6 +37,11 @@ public class GameExchangeMoney extends BaseEntity
@Excel(name = "第三方交易id")
private String transactionId;
/**
* id
*/
private String orderId;
/** 会员id */
@Excel(name = "会员id")
private Long memberId;

View File

@ -3,16 +3,20 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ff.common.mapper.TenantGameQuotaFlowMapper">
<resultMap type="TenantGameQuotaFlow" id="TenantGameQuotaFlowResult">
<result property="id" column="id" />
<result property="tenantKey" column="tenant_key" />
<result property="quotaType" column="quota_type" />
<result property="memberId" column="member_id" />
<result property="platformCode" column="platform_code" />
<result property="currencyCode" column="currency_code" />
<result property="isOut" column="is_out" />
<result property="operationType" column="operation_type" />
<result property="balanceBefore" column="balance_before" />
<result property="balance" column="balance" />
<result property="exchangeRatio" column="exchange_ratio" />
<result property="exchangeMoney" column="exchange_money" />
<result property="balanceAfter" column="balance_after" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
@ -22,23 +26,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectTenantGameQuotaFlowVo">
select id, tenant_key, quota_type, member_id, is_out, operation_type, balance_before, balance, balance_after, remark, create_by, create_time, update_by, update_time from ff_tenant_game_quota_flow
select id, tenant_key, quota_type, member_id, platform_code, currency_code, is_out, operation_type, balance_before, balance, exchange_ratio, exchange_money, balance_after, remark, create_by, create_time, update_by, update_time from ff_tenant_game_quota_flow
</sql>
<select id="selectTenantGameQuotaFlowList" parameterType="TenantGameQuotaFlow" resultMap="TenantGameQuotaFlowResult">
<include refid="selectTenantGameQuotaFlowVo"/>
<where>
<where>
<if test="tenantKey != null and tenantKey != ''"> and tenant_key = #{tenantKey}</if>
<if test="quotaType != null and quotaType != ''"> and quota_type = #{quotaType}</if>
<if test="memberId != null "> and member_id = #{memberId}</if>
<if test="platformCode != null and platformCode != ''"> and platform_code = #{platformCode}</if>
<if test="currencyCode != null and currencyCode != ''"> and currency_code = #{currencyCode}</if>
<if test="isOut != null "> and is_out = #{isOut}</if>
<if test="operationType != null "> and operation_type = #{operationType}</if>
<if test="balanceBefore != null "> and balance_before = #{balanceBefore}</if>
<if test="balance != null "> and balance = #{balance}</if>
<if test="exchangeRatio != null "> and exchange_ratio = #{exchangeRatio}</if>
<if test="exchangeMoney != null "> and exchange_money = #{exchangeMoney}</if>
<if test="balanceAfter != null "> and balance_after = #{balanceAfter}</if>
</where>
</select>
<select id="selectTenantGameQuotaFlowById" parameterType="Long" resultMap="TenantGameQuotaFlowResult">
<include refid="selectTenantGameQuotaFlowVo"/>
where id = #{id}
@ -50,32 +58,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="tenantKey != null and tenantKey != ''">tenant_key,</if>
<if test="quotaType != null">quota_type,</if>
<if test="memberId != null">member_id,</if>
<if test="platformCode != null">platform_code,</if>
<if test="currencyCode != null">currency_code,</if>
<if test="isOut != null">is_out,</if>
<if test="operationType != null">operation_type,</if>
<if test="balanceBefore != null">balance_before,</if>
<if test="balance != null">balance,</if>
<if test="exchangeRatio != null">exchange_ratio,</if>
<if test="exchangeMoney != null">exchange_money,</if>
<if test="balanceAfter != null">balance_after,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tenantKey != null and tenantKey != ''">#{tenantKey},</if>
<if test="quotaType != null">#{quotaType},</if>
<if test="memberId != null">#{memberId},</if>
<if test="platformCode != null">#{platformCode},</if>
<if test="currencyCode != null">#{currencyCode},</if>
<if test="isOut != null">#{isOut},</if>
<if test="operationType != null">#{operationType},</if>
<if test="balanceBefore != null">#{balanceBefore},</if>
<if test="balance != null">#{balance},</if>
<if test="exchangeRatio != null">#{exchangeRatio},</if>
<if test="exchangeMoney != null">#{exchangeMoney},</if>
<if test="balanceAfter != null">#{balanceAfter},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</trim>
</insert>
<update id="updateTenantGameQuotaFlow" parameterType="TenantGameQuotaFlow">
@ -84,10 +100,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="tenantKey != null and tenantKey != ''">tenant_key = #{tenantKey},</if>
<if test="quotaType != null">quota_type = #{quotaType},</if>
<if test="memberId != null">member_id = #{memberId},</if>
<if test="platformCode != null">platform_code = #{platformCode},</if>
<if test="currencyCode != null">currency_code = #{currencyCode},</if>
<if test="isOut != null">is_out = #{isOut},</if>
<if test="operationType != null">operation_type = #{operationType},</if>
<if test="balanceBefore != null">balance_before = #{balanceBefore},</if>
<if test="balance != null">balance = #{balance},</if>
<if test="exchangeRatio != null">exchange_ratio = #{exchangeRatio},</if>
<if test="exchangeMoney != null">exchange_money = #{exchangeMoney},</if>
<if test="balanceAfter != null">balance_after = #{balanceAfter},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
@ -103,14 +123,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteTenantGameQuotaFlowByIds" parameterType="String">
delete from ff_tenant_game_quota_flow where id in
delete from ff_tenant_game_quota_flow where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getBalanceByMemberId" parameterType="TenantGameQuotaFlow" resultType="java.math.BigDecimal">
select ifnull(sum(balance),0) from ff_tenant_game_quota_flow
<select id="getExchangeMoneyByMemberId" parameterType="TenantGameQuotaFlow" resultType="java.math.BigDecimal">
select ifnull(sum(exchange_money),0) from ff_tenant_game_quota_flow
<where>
<if test="tenantKey != null and tenantKey != ''"> and tenant_key = #{tenantKey}</if>
<if test="quotaType != null and quotaType != ''"> and quota_type = #{quotaType}</if>

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ff.common.mapper.TenantQuotaExchangeMapper">
<resultMap type="TenantQuotaExchange" id="TenantQuotaExchangeResult">
<result property="id" column="id" />
<result property="currencyCode" column="currency_code" />
<result property="exchangeCurrencyCode" column="exchange_currency_code" />
<result property="exchangeRate" column="exchange_rate" />
<result property="differenceType" column="difference_type" />
<result property="differenceValue" column="difference_value" />
<result property="actualBalance" column="actual_balance" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTenantQuotaExchangeVo">
select id, currency_code, exchange_currency_code, exchange_rate, difference_type, difference_value, actual_balance, create_by, create_time, update_by, update_time from ff_tenant_quota_exchange
</sql>
<select id="selectTenantQuotaExchangeList" parameterType="TenantQuotaExchange" resultMap="TenantQuotaExchangeResult">
<include refid="selectTenantQuotaExchangeVo"/>
<where>
<if test="currencyCode != null and currencyCode != ''"> and currency_code = #{currencyCode}</if>
<if test="exchangeCurrencyCode != null and exchangeCurrencyCode != ''"> and exchange_currency_code = #{exchangeCurrencyCode}</if>
<if test="exchangeRate != null "> and exchange_rate = #{exchangeRate}</if>
<if test="differenceType != null "> and difference_type = #{differenceType}</if>
<if test="differenceValue != null "> and difference_value = #{differenceValue}</if>
<if test="actualBalance != null "> and actual_balance = #{actualBalance}</if>
</where>
</select>
<select id="selectTenantQuotaExchangeById" parameterType="Long" resultMap="TenantQuotaExchangeResult">
<include refid="selectTenantQuotaExchangeVo"/>
where id = #{id}
</select>
<insert id="insertTenantQuotaExchange" parameterType="TenantQuotaExchange" useGeneratedKeys="true" keyProperty="id">
insert into ff_tenant_quota_exchange
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="currencyCode != null">currency_code,</if>
<if test="exchangeCurrencyCode != null">exchange_currency_code,</if>
<if test="exchangeRate != null">exchange_rate,</if>
<if test="differenceType != null">difference_type,</if>
<if test="differenceValue != null">difference_value,</if>
<if test="actualBalance != null">actual_balance,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="currencyCode != null">#{currencyCode},</if>
<if test="exchangeCurrencyCode != null">#{exchangeCurrencyCode},</if>
<if test="exchangeRate != null">#{exchangeRate},</if>
<if test="differenceType != null">#{differenceType},</if>
<if test="differenceValue != null">#{differenceValue},</if>
<if test="actualBalance != null">#{actualBalance},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTenantQuotaExchange" parameterType="TenantQuotaExchange">
update ff_tenant_quota_exchange
<trim prefix="SET" suffixOverrides=",">
<if test="currencyCode != null">currency_code = #{currencyCode},</if>
<if test="exchangeCurrencyCode != null">exchange_currency_code = #{exchangeCurrencyCode},</if>
<if test="exchangeRate != null">exchange_rate = #{exchangeRate},</if>
<if test="differenceType != null">difference_type = #{differenceType},</if>
<if test="differenceValue != null">difference_value = #{differenceValue},</if>
<if test="actualBalance != null">actual_balance = #{actualBalance},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<select id="getTenantQuotaExchange" resultMap="TenantQuotaExchangeResult">
<include refid="selectTenantQuotaExchangeVo"/>
where currency_code = #{currencyCode} and exchange_currency_code = #{exchangeCurrencyCode}
</select>
<delete id="deleteTenantQuotaExchangeById" parameterType="Long">
delete from ff_tenant_quota_exchange where id = #{id}
</delete>
<delete id="deleteTenantQuotaExchangeByIds" parameterType="String">
delete from ff_tenant_quota_exchange where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -7,6 +7,7 @@
<resultMap type="GameExchangeMoney" id="GameExchangeMoneyResult">
<result property="id" column="id" />
<result property="tenantKey" column="tenant_key" />
<result property="orderId" column="order_id" />
<result property="currencyCode" column="currency_code" />
<result property="transactionId" column="transaction_id" />
<result property="memberId" column="member_id" />
@ -26,13 +27,14 @@
</resultMap>
<sql id="selectGameExchangeMoneyVo">
select id, tenant_key, currency_code, transaction_id, member_id, platform_code, balance, quota, coin_before, coin_after, currency_before, currency_after, exchange_type, status, create_by, create_time, update_by, update_time from ff_game_exchange_money
select id, tenant_key,order_id, currency_code, transaction_id, member_id, platform_code, balance, quota, coin_before, coin_after, currency_before, currency_after, exchange_type, status, create_by, create_time, update_by, update_time from ff_game_exchange_money
</sql>
<select id="selectGameExchangeMoneyList" parameterType="GameExchangeMoney" resultMap="GameExchangeMoneyResult">
<include refid="selectGameExchangeMoneyVo"/>
<where>
<if test="tenantKey != null and tenantKey != ''"> and tenant_key = #{tenantKey}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="currencyCode != null and currencyCode != ''"> and currency_code = #{currencyCode}</if>
<if test="transactionId != null and transactionId != ''"> and transaction_id = #{transactionId}</if>
<if test="memberId != null "> and member_id = #{memberId}</if>
@ -58,6 +60,7 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tenantKey != null">tenant_key,</if>
<if test="currencyCode != null">currency_code,</if>
<if test="orderId != null">order_id,</if>
<if test="transactionId != null">transaction_id,</if>
<if test="memberId != null">member_id,</if>
<if test="platformCode != null">platform_code,</if>
@ -77,6 +80,7 @@
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tenantKey != null">#{tenantKey},</if>
<if test="currencyCode != null">#{currencyCode},</if>
<if test="orderId != null">#{orderId},</if>
<if test="transactionId != null">#{transactionId},</if>
<if test="memberId != null">#{memberId},</if>
<if test="platformCode != null">#{platformCode},</if>
@ -100,6 +104,7 @@
<trim prefix="SET" suffixOverrides=",">
<if test="tenantKey != null">tenant_key = #{tenantKey},</if>
<if test="currencyCode != null">currency_code = #{currencyCode},</if>
<if test="orderId != null">order_id = #{orderId},</if>
<if test="transactionId != null">transaction_id = #{transactionId},</if>
<if test="memberId != null">member_id = #{memberId},</if>
<if test="platformCode != null">platform_code = #{platformCode},</if>

View File

@ -240,4 +240,15 @@ public class Constants {
public static final String FALSE = "FALSE";
/**
*
*/
public static final String TENANT = "tenant";
/**
* usdt
*/
public static final String USDT = "USDT";
}

View File

@ -19,6 +19,7 @@ public enum ErrorCode {
PLATFORM_NOT_EXIST(1003, "游戏平台不存在"),
CURRENCY_NOT_EXIST(1004, "游戏平台不支持的货币"),
GAME_NOT_EXIST(1005, "游戏不存在"),
CURRENCY_EXCHANGE(1006, "不支持币种的汇率"),
;
// 获取错误码

View File

@ -7,7 +7,8 @@ package com.ff.base.enums;
* @date 2025/02/14
*/
public enum QuotaType {
BALANCE("BALANCE", "余额"),
BALANCE("BALANCE", "可用额度"),
REAL_BALANCE("REAL_BALANCE", "真实额度"),
DEPOSIT("DEPOSIT", "押金"),
REPUTATION("REPUTATION", "信誉额度")
;

View File

@ -44,4 +44,5 @@ public class QuotaUtils {
return quotaType + "_" + QuotaType.REPUTATION.getCode();
}
}