refactor(工程): 调整工程代码结构

upgrade
liaoyong 2025-04-11 19:28:20 +08:00
commit 5774321bea
408 changed files with 4 additions and 42023 deletions

View File

@ -1,15 +1,12 @@
# 引入子配置文件 # 引入子配置文件
spring.config.import=\ spring.config.import=\
classpath:config/test/mybatis.properties,\
classpath:config/test/redis.properties,\ classpath:config/test/redis.properties,\
classpath:config/test/forest.properties,\
classpath:config/test/xxljob.properties,\ classpath:config/test/xxljob.properties,\
classpath:config/test/datasource.properties classpath:config/test/mongo.properties
# 项目相关配置 # 项目相关配置
ff.name=FF ff.name=FF-Fetcher
ff.version=0.0.1 ff.version=0.0.1
ff.copyrightYear=2024 ff.copyrightYear=2024
ff.profile=D:/ff/uploadPath ff.profile=D:/ff/uploadPath
@ -17,7 +14,7 @@ ff.addressEnabled=false
ff.captchaType=math ff.captchaType=math
# 开发环境配置 # 开发环境配置
server.port=9080 server.port=9082
server.servlet.context-path=/ server.servlet.context-path=/
server.tomcat.uri-encoding=UTF-8 server.tomcat.uri-encoding=UTF-8
server.tomcat.accept-count=1000 server.tomcat.accept-count=1000
@ -32,38 +29,13 @@ logging.level.org.springframework=warn
user.password.maxRetryCount=5 user.password.maxRetryCount=5
user.password.lockTime=10 user.password.lockTime=10
# 跑批处理配置
batchProcessing.commissionBatchSize=20
batchProcessing.agentLevelBatchSize=50
batchProcessing.bettingDataBatchSize=1000
# Spring配置 # Spring配置
spring.mvc.pathmatch.matching-strategy=ant_path_matcher spring.mvc.pathmatch.matching-strategy=ant_path_matcher
spring.messages.basename=i18n/messages spring.messages.basename=i18n/messages
spring.servlet.multipart.max-file-size=20MB spring.servlet.multipart.max-file-size=20MB
spring.servlet.multipart.max-request-size=20MB spring.servlet.multipart.max-request-size=20MB
spring.devtools.restart.enabled=false
# token配置 # Token配置
token.header=Authorization token.header=Authorization
token.secret=abcdefghijklmnopqrstuvwxyz token.secret=abcdefghijklmnopqrstuvwxyz
token.expireTime=10080 token.expireTime=10080
# MyBatis配置
mybatis.typeAliasesPackage=com.ff.**.domain
mybatis.mapperLocations=classpath*:mapper/**/*Mapper.xml
mybatis.configLocation=classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper.helperDialect=mysql
pagehelper.supportMethodsArguments=true
pagehelper.params=count=countSql
# Swagger配置
swagger.enabled=true
swagger.pathMapping=/
# 防止XSS攻击
xss.enabled=true
xss.excludes=/system/notice
xss.urlPatterns=/system/*,/monitor/*,/tool/*

View File

@ -1,32 +0,0 @@
package com.ff;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootVersion;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
/**
*
*
* @author ff
*/
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@ComponentScan(excludeFilters = {@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = DaoAuthenticationProvider.class)})
@EnableAsync
public class FFApplication {
public static void main(String[] args) {
// System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(FFApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ FF启动成功 ლ(´ڡ`ლ)゙" + SpringBootVersion.getVersion());
}
}

View File

@ -1,147 +0,0 @@
package com.ff.agent.controller;
import com.ff.agent.dto.AgentCreateTenantDTO;
import com.ff.agent.dto.AgentTenantSecretKeyDTO;
import com.ff.base.constant.Constants;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.core.page.TableDataInfo;
import com.ff.base.enums.OperationType;
import com.ff.base.enums.QuotaType;
import com.ff.base.exception.base.BaseException;
import com.ff.base.system.domain.TenantPlatform;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.base.system.dto.CreateTenantDTO;
import com.ff.base.system.dto.TenantSecretKeyDTO;
import com.ff.base.system.service.ITenantPlatformService;
import com.ff.base.system.service.ITenantSecretKeyService;
import com.ff.base.utils.DateUtils;
import com.ff.base.utils.bean.BeanUtils;
import com.ff.base.utils.ip.IpUtils;
import com.ff.common.domain.TenantAgentPlatform;
import com.ff.common.dto.BalanceChangesDTO;
import com.ff.common.service.ITenantAgentPlatformService;
import com.ff.common.service.ITenantGameQuotaService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* api
*
* @author shi
* @date 2025/02/10
*/
@RestController
@RequestMapping("/agent/tenant")
@Slf4j
public class AgentController extends BaseController {
@Resource
private ITenantSecretKeyService tenantSecretKeyService;
@Resource
private ITenantGameQuotaService tenantGameQuotaService;
@Resource
private ITenantPlatformService tenantPlatformService;
@Resource
private ITenantAgentPlatformService tenantAgentPlatformService;
/**
*
*
* @param tenantSecretKeyDTO
* @return {@link TableDataInfo }
*/
@GetMapping("/list")
@Transactional
@PreAuthorize("@ss.hasPermi('agent:tenant:list')")
public TableDataInfo list(TenantSecretKeyDTO tenantSecretKeyDTO) {
startPage();
tenantSecretKeyDTO.setAgentId(getUserId());
List<TenantSecretKey> tenantSecretKeys = tenantSecretKeyService.selectTenantSecretKeyDTOList(tenantSecretKeyDTO);
TableDataInfo dataTable = getDataTable(tenantSecretKeys);
List<AgentTenantSecretKeyDTO> list = new ArrayList<>();
for (TenantSecretKey row : (List<TenantSecretKey>) dataTable.getRows()) {
AgentTenantSecretKeyDTO agentTenantSecretKeyDTO = new AgentTenantSecretKeyDTO();
BeanUtils.copyProperties(row, agentTenantSecretKeyDTO);
agentTenantSecretKeyDTO.setTenantPlatforms(tenantPlatformService.selectTenantPlatformList(TenantPlatform.builder()
.tenantId(row.getId())
.build()));
list.add(agentTenantSecretKeyDTO);
}
dataTable.setRows(list);
return dataTable;
}
/**
*
*
* @return {@link AjaxResult }
*/
@PostMapping("/create")
@Transactional
@PreAuthorize("@ss.hasPermi('agent:tenant:create')")
public AjaxResult createTenant(@Validated @RequestBody AgentCreateTenantDTO agentCreateTenantDTO) {
//构造租户的充值信息
List<TenantPlatform> tenantPlatforms = new ArrayList<>();
for (TenantAgentPlatform tenantAgentPlatform : agentCreateTenantDTO.getTenantAgentPlatforms()) {
TenantAgentPlatform agentPlatform = tenantAgentPlatformService.selectTenantAgentPlatformById(tenantAgentPlatform.getId());
// 成本比平台成本大
if (agentPlatform.getCost().compareTo(tenantAgentPlatform.getCost()) > 0) {
throw new BaseException("成本比例不允许比最低比例小");
}
TenantPlatform tenantPlatform = new TenantPlatform();
BeanUtils.copyProperties(tenantAgentPlatform, tenantPlatform);
tenantPlatforms.add(tenantPlatform);
}
//创建租户
Integer tenant = tenantSecretKeyService.createTenant(CreateTenantDTO.builder()
.registerTime(DateUtils.getNowDate())
.registerIp(IpUtils.getIpAddr())
.agentId(getUserId())
.account(agentCreateTenantDTO.getAccount())
.password(agentCreateTenantDTO.getPassword())
.scoreRatio(agentCreateTenantDTO.getScoreRatio())
.tenantType(agentCreateTenantDTO.getTenantType())
.depositRatio(agentCreateTenantDTO.getDepositRatio())
.tenantPlatforms(tenantPlatforms)
.build());
if (tenant > 0) {
//信誉额度
if (!ObjectUtils.isEmpty(agentCreateTenantDTO.getRealBalance())) {
tenantGameQuotaService.balanceChanges(BalanceChangesDTO.builder()
.isOut(Boolean.TRUE)
.currencyCode(Constants.USDT)
.tenantKey(agentCreateTenantDTO.getAccount())
.balance(agentCreateTenantDTO.getRealBalance())
.operationType(OperationType.TENANT_RECHARGE.getCode())
.quotaType(QuotaType.REPUTATION.getCode())
.remark(OperationType.TENANT_RECHARGE.getDescription())
.build());
}
}
return toAjax(tenant);
}
}

View File

@ -1,150 +0,0 @@
package com.ff.agent.controller;
import java.math.BigDecimal;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.NumberUtil;
import com.ff.agent.domain.TenantAgentWithdrawal;
import com.ff.agent.service.ITenantAgentInviteService;
import com.ff.agent.service.ITenantAgentWithdrawalService;
import com.ff.base.annotation.Excel;
import com.ff.base.constant.Constants;
import com.ff.base.enums.CommissionApprovalStatus;
import com.ff.base.enums.CommissionSourceType;
import com.ff.base.enums.CommissionType;
import com.ff.base.system.domain.TenantAgent;
import com.ff.base.system.service.ITenantAgentService;
import com.github.pagehelper.util.StringUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
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.agent.domain.TenantAgentCommission;
import com.ff.agent.service.ITenantAgentCommissionService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-26
*/
@RestController
@RequestMapping("/agent/commission")
public class TenantAgentCommissionController extends BaseController {
@Autowired
private ITenantAgentCommissionService tenantAgentCommissionService;
@Resource
private ITenantAgentWithdrawalService tenantAgentWithdrawalService;
@Resource
private ITenantAgentService tenantAgentService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:commission:list')")
@GetMapping("/list")
public AjaxResult list(TenantAgentCommission tenantAgentCommission) {
startPage();
tenantAgentCommission.setAgentId(getUserId());
List<TenantAgentCommission> list = tenantAgentCommissionService.selectTenantAgentCommissionList(tenantAgentCommission);
//未提现佣金
tenantAgentCommission.setApprovalStatus(CommissionApprovalStatus.UNWITHDRAWN.getValue());
BigDecimal unwithdrawn = tenantAgentCommissionService.getAgentCommissionSum(tenantAgentCommission);
//已提现佣金
tenantAgentCommission.setApprovalStatus(CommissionApprovalStatus.WITHDRAWN.getValue());
BigDecimal withdrawn = tenantAgentCommissionService.getAgentCommissionSum(tenantAgentCommission);
//总佣金
tenantAgentCommission.setApprovalStatus(null);
BigDecimal total = tenantAgentCommissionService.getAgentCommissionSum(tenantAgentCommission);
// 邀请佣金
tenantAgentCommission.setCommissionType(CommissionType.INVITE.getValue());
BigDecimal invite = tenantAgentCommissionService.getAgentCommissionSum(tenantAgentCommission);
//抽成佣金
tenantAgentCommission.setCommissionType(CommissionType.TAKE.getValue());
BigDecimal take = tenantAgentCommissionService.getAgentCommissionSum(tenantAgentCommission);
TableDataInfo dataTable = getDataTable(list);
AjaxResult ajaxResult = success(dataTable);
ajaxResult.put("unwithdrawn", unwithdrawn);
ajaxResult.put("withdrawn", withdrawn);
ajaxResult.put("total", total);
ajaxResult.put("invite", invite);
ajaxResult.put("take", take);
return ajaxResult;
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:commission:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tenantAgentCommissionService.selectTenantAgentCommissionById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:commission:edit')")
@Log(title = "代理佣金管理 ", businessType = BusinessType.UPDATE)
@PutMapping
@Transactional
public synchronized AjaxResult edit() {
//查询钱包
TenantAgent tenantAgent = tenantAgentService.selectTenantAgentById(getUserId());
Assert.isTrue(tenantAgent.getTenantStatus(), "当前租户已被停用");
Assert.isTrue(!StringUtil.isEmpty(tenantAgent.getWalletAddress()) &&
!StringUtil.isEmpty(tenantAgent.getCurrencyAgreement()), "钱包地址为空");
//查询代理佣金信息
TenantAgentCommission agentCommission = new TenantAgentCommission();
agentCommission.setAgentId(getUserId());
agentCommission.setApprovalStatus(CommissionApprovalStatus.UNWITHDRAWN.getValue());
List<TenantAgentCommission> list = tenantAgentCommissionService.selectTenantAgentCommissionList(agentCommission);
BigDecimal usdtBalance = list.stream().map(TenantAgentCommission::getUsdtBalance).reduce(NumberUtil::add).get();
Assert.isTrue(usdtBalance.compareTo(BigDecimal.ZERO) > 0, "佣金待提现余额为0");
TenantAgentWithdrawal tenantAgentWithdrawal = TenantAgentWithdrawal.builder()
.agentId(getUserId())
.commissionBalance(usdtBalance)
.currencyAgreement(tenantAgent.getWalletAddress())
.walletAddress(tenantAgent.getWalletAddress())
.build();
tenantAgentWithdrawalService.insertTenantAgentWithdrawal(tenantAgentWithdrawal);
for (TenantAgentCommission commission : list) {
commission.setAgentWithdrawalId(tenantAgentWithdrawal.getId());
commission.setUpdateBy(getUsername());
commission.setApprovalStatus(CommissionApprovalStatus.WITHDRAWING.getValue());
tenantAgentCommissionService.updateTenantAgentCommission(commission);
}
return toAjax(1);
}
}

View File

@ -1,114 +0,0 @@
package com.ff.agent.controller;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import com.ff.agent.domain.TenantAgentInvitePlatform;
import com.ff.agent.dto.TenantAgentInviteDTO;
import com.ff.agent.service.ITenantAgentInvitePlatformService;
import com.ff.base.annotation.Anonymous;
import com.ff.base.constant.ConfigConstants;
import com.ff.base.enums.InviteType;
import com.ff.base.system.domain.TenantPlatform;
import com.ff.base.system.service.ISysConfigService;
import com.ff.base.utils.bean.BeanUtils;
import com.ff.common.domain.TenantAgentPlatform;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
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.agent.domain.TenantAgentInvite;
import com.ff.agent.service.ITenantAgentInviteService;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-25
*/
@RestController
@RequestMapping("/agent/invite")
public class TenantAgentInviteController extends BaseController {
@Autowired
private ITenantAgentInviteService tenantAgentInviteService;
@Resource
private ISysConfigService sysConfigService;
@Resource
private ITenantAgentInvitePlatformService tenantAgentInvitePlatformService;
/**
*
*/
@Anonymous
@GetMapping(value = "/code/{inviteCode}")
public AjaxResult getInfo(@PathVariable("inviteCode") String inviteCode) {
return success(tenantAgentInviteService.selectTenantAgentInviteByInviteCode(inviteCode));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:invite:list')")
@GetMapping("/list")
public TableDataInfo list(TenantAgentInvite tenantAgentInvite) {
startPage();
tenantAgentInvite.setAgentId(getUserId());
List<TenantAgentInvite> list = tenantAgentInviteService.selectTenantAgentInviteList(tenantAgentInvite);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:invite:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tenantAgentInviteService.selectTenantAgentInviteById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:invite:add')")
@Log(title = "代理邀请链接", businessType = BusinessType.INSERT)
@PostMapping
@Transactional
public AjaxResult add(@Validated @RequestBody TenantAgentInviteDTO tenantAgentInvite) {
tenantAgentInvite.setAgentId(getUserId());
String inviteUrl = sysConfigService.selectConfigByKey(ConfigConstants.INVITE_URL);
tenantAgentInvite.setInviteCode(tenantAgentInviteService.getInviteCode());
tenantAgentInvite.setInviteUrl(inviteUrl + "?code=" + tenantAgentInvite.getInviteCode());
tenantAgentInvite.setCreateBy(getUsername());
int result = tenantAgentInviteService.insertTenantAgentInvite(tenantAgentInvite);
if (result > 0 && InviteType.TENANT.getValue().equals(tenantAgentInvite.getInviteType())) {
// 保存平台注册利润信息
List<TenantAgentInvitePlatform> tenantAgentInvitePlatforms = tenantAgentInvite.getTenantAgentInvitePlatforms();
for (TenantAgentInvitePlatform tenantAgentInvitePlatform : tenantAgentInvitePlatforms) {
tenantAgentInvitePlatform.setInviteId(tenantAgentInvite.getId());
tenantAgentInvitePlatform.setCreateBy(getUsername());
tenantAgentInvitePlatformService.insertTenantAgentInvitePlatform(tenantAgentInvitePlatform);
}
}
return toAjax(result);
}
}

View File

@ -1,48 +0,0 @@
package com.ff.agent.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.agent.domain.TenantAgentInvitePlatform;
import com.ff.agent.service.ITenantAgentInvitePlatformService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-27
*/
@RestController
@RequestMapping("/agent/invite/platform")
public class TenantAgentInvitePlatformController extends BaseController
{
@Autowired
private ITenantAgentInvitePlatformService tenantAgentInvitePlatformService;
/**
*
*/
@GetMapping("/select")
public AjaxResult select(TenantAgentInvitePlatform tenantAgentInvitePlatform)
{
List<TenantAgentInvitePlatform> list = tenantAgentInvitePlatformService.selectTenantAgentInvitePlatformList(tenantAgentInvitePlatform);
return AjaxResult.success(list);
}
}

View File

@ -1,236 +0,0 @@
package com.ff.agent.controller;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.IdUtil;
import com.ff.agent.domain.TenantAgentCommission;
import com.ff.agent.domain.TenantAgentInvite;
import com.ff.agent.domain.TenantAgentInvitePlatform;
import com.ff.agent.domain.TenantAgentInviteRegister;
import com.ff.agent.dto.TenantAgentInviteRegisterAddDTO;
import com.ff.agent.dto.TenantAgentInviteRegisterDTO;
import com.ff.agent.service.ITenantAgentCommissionService;
import com.ff.agent.service.ITenantAgentInvitePlatformService;
import com.ff.agent.service.ITenantAgentInviteRegisterService;
import com.ff.agent.service.ITenantAgentInviteService;
import com.ff.base.annotation.Anonymous;
import com.ff.base.annotation.Excel;
import com.ff.base.constant.Constants;
import com.ff.base.enums.*;
import com.ff.base.system.domain.TenantAgent;
import com.ff.base.system.domain.TenantPlatform;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.base.system.dto.CreateTenantDTO;
import com.ff.base.system.dto.TenantSecretKeyDTO;
import com.ff.base.system.service.ITenantAgentService;
import com.ff.base.system.service.ITenantSecretKeyService;
import com.ff.base.utils.DateUtils;
import com.ff.base.utils.MessageUtils;
import com.ff.base.utils.SecurityUtils;
import com.ff.base.utils.bean.BeanUtils;
import com.ff.base.utils.ip.IpUtils;
import com.ff.base.utils.uuid.IdUtils;
import com.ff.common.dto.BalanceChangesDTO;
import com.ff.common.service.ITenantGameQuotaService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
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.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-25
*/
@RestController
@RequestMapping("/agent/invite/register")
public class TenantAgentInviteRegisterController extends BaseController {
@Autowired
private ITenantAgentInviteRegisterService tenantAgentInviteRegisterService;
@Resource
private ITenantAgentInviteService tenantAgentInviteService;
@Resource
private ITenantSecretKeyService tenantSecretKeyService;
@Resource
private ITenantGameQuotaService tenantGameQuotaService;
@Resource
private ITenantAgentCommissionService tenantAgentCommissionService;
@Resource
private ITenantAgentService tenantAgentService;
@Resource
private ITenantAgentInvitePlatformService tenantAgentInvitePlatformService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('operation:register:list')")
@GetMapping("/list")
public TableDataInfo list(TenantAgentInviteRegisterDTO tenantAgentInviteRegisterDTO) {
startPage();
tenantAgentInviteRegisterDTO.setAgentId(getUserId());
List<TenantAgentInviteRegisterDTO> list = tenantAgentInviteRegisterService.selectTenantAgentInviteRegisterListDTO(tenantAgentInviteRegisterDTO);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('operation:register:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(tenantAgentInviteRegisterService.selectTenantAgentInviteRegisterById(id));
}
/**
*
*/
@Anonymous
@PostMapping
public AjaxResult add(@RequestBody TenantAgentInviteRegisterAddDTO tenantAgentInviteRegisterAddDTO) {
Assert.isTrue(tenantAgentInviteRegisterAddDTO.getPassword().equals(tenantAgentInviteRegisterAddDTO.getConfirmPassword()), "两次密码不一致");
List<TenantAgentInvite> tenantAgentInvites = tenantAgentInviteService.selectTenantAgentInviteList(TenantAgentInvite.builder()
.inviteCode(tenantAgentInviteRegisterAddDTO.getInviteCode())
.build());
Assert.isTrue(!CollectionUtils.isEmpty(tenantAgentInvites), "邀请码错误");
TenantSecretKey tenantSecretKey = tenantSecretKeyService.selectTenantSecretKeyByTenantKey(tenantAgentInviteRegisterAddDTO.getAccount());
Assert.isTrue(ObjectUtils.isEmpty(tenantSecretKey), MessageUtils.message("operation.tenant.account.already.used"));
List<TenantAgentInviteRegister> tenantAgentInviteRegisters = tenantAgentInviteRegisterService.selectTenantAgentInviteRegisterList(TenantAgentInviteRegister.builder()
.account(tenantAgentInviteRegisterAddDTO.getAccount())
.build());
Assert.isTrue(CollectionUtils.isEmpty(tenantAgentInviteRegisters), MessageUtils.message("operation.tenant.account.already.used"));
TenantAgentInviteRegister tenantAgentInviteRegister = new TenantAgentInviteRegister();
tenantAgentInviteRegister.setAgentId(tenantAgentInvites.get(0).getAgentId());
tenantAgentInviteRegister.setRegisterTime(DateUtils.getNowDate());
tenantAgentInviteRegister.setRegisterIp(IpUtils.getIpAddr());
tenantAgentInviteRegister.setAccount(tenantAgentInviteRegisterAddDTO.getAccount());
tenantAgentInviteRegister.setPassword(tenantAgentInviteRegisterAddDTO.getPassword());
tenantAgentInviteRegister.setBalance(tenantAgentInvites.get(0).getBalance());
tenantAgentInviteRegister.setInviteCode(tenantAgentInviteRegisterAddDTO.getInviteCode());
tenantAgentInviteRegister.setOrderId(IdUtil.getSnowflakeNextIdStr());
return toAjax(tenantAgentInviteRegisterService.insertTenantAgentInviteRegister(tenantAgentInviteRegister));
}
/**
*
*
* @param dto
*/
@Anonymous
@PutMapping
@Transactional
public void edit(@RequestBody TenantAgentInviteRegisterAddDTO dto) {
TenantAgentInviteRegister tenantAgentInviteRegister = tenantAgentInviteRegisterService.selectTenantAgentInviteRegisterById(dto.getId());
Assert.isTrue(tenantAgentInviteRegister.getStatus().equals(InviterRegisterStatus.PENDING.getValue()), "该账号已激活");
//查询注册配置信息
TenantAgentInvite tenantAgentInvite = tenantAgentInviteService.selectTenantAgentInviteByInviteCode(tenantAgentInviteRegister.getInviteCode());
List<TenantAgentInvitePlatform> tenantAgentInvitePlatforms = tenantAgentInvitePlatformService.selectTenantAgentInvitePlatformList(TenantAgentInvitePlatform.builder()
.inviteId(tenantAgentInvite.getId())
.build());
Integer result = 0;
if (tenantAgentInvite.getInviteType().equals(InviteType.TENANT.getValue())) {
List<TenantPlatform> tenantPlatforms = new ArrayList<>();
for (TenantAgentInvitePlatform tenantAgentInvitePlatform : tenantAgentInvitePlatforms) {
TenantPlatform tenantPlatform = new TenantPlatform();
BeanUtils.copyProperties(tenantAgentInvitePlatform, tenantPlatform);
tenantPlatforms.add(tenantPlatform);
}
//创建租户
result = tenantSecretKeyService.createTenant(CreateTenantDTO.builder()
.registerTime(tenantAgentInviteRegister.getRegisterTime())
.registerIp(tenantAgentInviteRegister.getRegisterIp())
.agentId(tenantAgentInvite.getAgentId())
.account(tenantAgentInviteRegister.getAccount())
.password(tenantAgentInviteRegister.getPassword())
.scoreRatio(tenantAgentInvite.getScoreRatio())
.tenantType(tenantAgentInvite.getTenantType())
.depositRatio(tenantAgentInvite.getDepositRatio())
.tenantPlatforms(tenantPlatforms)
.build());
//信誉额度
if (result > 0 & !ObjectUtils.isEmpty(tenantAgentInvite.getRealBalance())) {
tenantGameQuotaService.balanceChanges(BalanceChangesDTO.builder()
.isOut(Boolean.TRUE)
.currencyCode(Constants.USDT)
.tenantKey(tenantAgentInviteRegister.getAccount())
.balance(tenantAgentInvite.getRealBalance())
.operationType(OperationType.TENANT_RECHARGE.getCode())
.quotaType(QuotaType.REPUTATION.getCode())
.remark(OperationType.TENANT_RECHARGE.getDescription())
.build());
}
} else {
result = tenantAgentService.createTenantAgent(TenantAgent.builder()
.account(tenantAgentInviteRegister.getAccount())
.password(tenantAgentInviteRegister.getPassword())
.registerTime(tenantAgentInviteRegister.getRegisterTime())
.registerIp(tenantAgentInviteRegister.getRegisterIp())
.registerIpCity(tenantAgentInviteRegister.getRegisterIpCity())
.tenantStatus(Boolean.TRUE)
.build());
}
if (result > 0) {
//添加佣金信息
TenantAgentCommission tenantAgentCommission = TenantAgentCommission.builder()
.agentId(tenantAgentInvite.getAgentId())
.sourceId(tenantAgentInviteRegister.getId())
.sourceType(CommissionSourceType.AGENT_TENANT_REGISTER.getValue())
.commissionType(CommissionType.INVITE.getValue())
.currencyCode(Constants.USDT)
.balance(tenantAgentInviteRegister.getBalance())
.costBalance(BigDecimal.ZERO)
.merchantBalance(BigDecimal.ZERO)
.commissionBalance(tenantAgentInviteRegister.getBalance())
.usdtBalance(tenantAgentInviteRegister.getBalance())
.build();
tenantAgentCommission.setCreateBy(tenantAgentInviteRegister.getAccount());
tenantAgentCommissionService.insertTenantAgentCommission(tenantAgentCommission);
//更新激活状态
tenantAgentInviteRegister.setStatus(InviterRegisterStatus.ACTIVATED.getValue());
tenantAgentInviteRegisterService.updateTenantAgentInviteRegister(tenantAgentInviteRegister);
}
}
}

View File

@ -1,42 +0,0 @@
package com.ff.agent.controller;
import java.util.List;
import com.ff.base.core.page.PageDomain;
import com.ff.common.domain.TenantAgentPlatform;
import com.ff.common.service.ITenantAgentPlatformService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.agent.domain.TenantAgentInvitePlatform;
import com.ff.agent.service.ITenantAgentInvitePlatformService;
/**
* Controller
*
* @author shi
* @date 2025-02-27
*/
@RestController
@RequestMapping("/agent/platform")
public class TenantAgentPlatformController extends BaseController
{
@Autowired
private ITenantAgentPlatformService tenantAgentPlatformService;
/**
*
*/
@GetMapping("/select")
public AjaxResult select( )
{
PageHelper.orderBy("platform_code desc,currency_code desc");
List<TenantAgentPlatform> list = tenantAgentPlatformService.selectTenantAgentPlatformList(TenantAgentPlatform.builder().build());
return AjaxResult.success(list);
}
}

View File

@ -1,73 +0,0 @@
package com.ff.agent.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.agent.domain.TenantAgentWithdrawal;
import com.ff.agent.service.ITenantAgentWithdrawalService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-26
*/
@RestController
@RequestMapping("/agent/withdrawal")
public class TenantAgentWithdrawalController extends BaseController
{
@Autowired
private ITenantAgentWithdrawalService tenantAgentWithdrawalService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:withdrawal:list')")
@GetMapping("/list")
public TableDataInfo list(TenantAgentWithdrawal tenantAgentWithdrawal)
{
startPage();
tenantAgentWithdrawal.setAgentId(getUserId());
List<TenantAgentWithdrawal> list = tenantAgentWithdrawalService.selectTenantAgentWithdrawalList(tenantAgentWithdrawal);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:withdrawal:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tenantAgentWithdrawalService.selectTenantAgentWithdrawalById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('agent:withdrawal:edit')")
@Log(title = "代理申请提现审批管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TenantAgentWithdrawal tenantAgentWithdrawal)
{
return toAjax(tenantAgentWithdrawalService.updateTenantAgentWithdrawal(tenantAgentWithdrawal));
}
}

View File

@ -1,67 +0,0 @@
package com.ff.agent.dto;
import com.ff.base.xss.Xss;
import com.ff.common.domain.TenantAgentPlatform;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
*
*
* @author shi
* @date 2025/02/20
*/
@Data
public class AgentCreateTenantDTO implements Serializable {
private static final long serialVersionUID = -5561068216486978354L;
/**
*
*/
@Xss(message = "用户账号不能包含脚本字符")
@NotBlank(message = "用户账号不能为空")
@Size(min = 2, max = 30, message = "用户账号长度不能超过30个字符")
private String account;
/**
*
*/
@NotBlank(message = "密码不能为空")
@Size(min = 5, max = 20, message = "密码长度不能超过25个字符")
private String password;
/** 买分比例 */
@NotNull(message = "买分比例不能为空")
private BigDecimal scoreRatio;
/** 租户类型 TenantType 枚举 */
@NotNull(message = "租户类型不能为空")
private Integer tenantType;
/** 信誉额度*/
private BigDecimal realBalance;
/** 透支比例 */
private BigDecimal depositRatio;
/**
*
*/
@NotNull(message = "租户代理平台列表不能为空")
@Size(min = 1, message = "租户代理平台列表必须包含至少一个元素")
private List<TenantAgentPlatform> tenantAgentPlatforms;
}

View File

@ -1,102 +0,0 @@
package com.ff.agent.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import com.ff.base.system.domain.TenantPlatform;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.math.BigDecimal;
import java.util.List;
/**
* ff_tenant_secret_key
*
* @author shi
* @date 2025-02-20
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class AgentTenantSecretKeyDTO extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键id */
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/** 密码 */
@Excel(name = "密码")
@JsonIgnore
private String password;
/** 最后登录ip */
@Excel(name = "最后登录ip")
private String loginIp;
/** 最后登录时间 */
@Excel(name = "最后登录时间")
@JsonSerialize(using = ToStringSerializer.class)
private Long loginData;
/** 租户key */
@Excel(name = "租户key")
private String tenantKey;
/** 代理id */
@Excel(name = "代理id")
@JsonSerialize(using = ToStringSerializer.class)
private Long agentId;
/** 商户后缀 */
@Excel(name = "商户后缀")
private String tenantSn;
/** 租户密钥 */
@Excel(name = "租户密钥")
@JsonIgnore
private String tenantSecret;
/** 租户状态 1正常 0停用 */
@Excel(name = "租户状态 1正常 0停用")
private Boolean tenantStatus;
/** 额度类型 TenantQuotaType 枚举 */
@Excel(name = "额度类型 TenantQuotaType 枚举")
private Integer quotaType;
/** 买分比例 */
@Excel(name = "买分比例")
private BigDecimal scoreRatio;
/** 租户类型 TenantType 枚举 */
@Excel(name = "租户类型 TenantType 枚举")
private Integer tenantType;
/** 透支比例 */
@Excel(name = "透支比例")
private BigDecimal depositRatio;
/**
*
*/
private List<TenantPlatform> tenantPlatforms;
}

View File

@ -1,28 +0,0 @@
package com.ff.agent.dto;
import com.ff.agent.domain.TenantAgentInvite;
import com.ff.agent.domain.TenantAgentInvitePlatform;
import com.ff.common.domain.TenantAgentPlatform;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
/**
* dto
*
* @author shi
* @date 2025/02/27
*/
@Data
public class TenantAgentInviteDTO extends TenantAgentInvite {
/**
*
*/
@NotNull(message = "租户代理平台列表不能为空")
@Size(min = 1, message = "租户代理平台列表必须包含至少一个元素")
private List<TenantAgentInvitePlatform> tenantAgentInvitePlatforms;
}

View File

@ -1,34 +0,0 @@
package com.ff.agent.dto;
import com.ff.base.annotation.Excel;
import com.ff.base.core.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
/**
*
*
* @author shi
* @date 2025/02/25
*/
@Data
public class TenantAgentInviteRegisterAddDTO extends BaseEntity {
/** 邀请码 */
private String inviteCode;
/** 账号 */
private String account;
/** 密码 */
private String password;
/**
*
*/
private String confirmPassword;
}

View File

@ -1,19 +0,0 @@
package com.ff.agent.dto;
import com.ff.agent.domain.TenantAgentInviteRegister;
import com.ff.base.core.domain.BaseEntity;
import lombok.Data;
/**
* dto
*
* @author shi
* @date 2025/02/26
*/
@Data
public class TenantAgentInviteRegisterDTO extends TenantAgentInviteRegister {
/**
*
*/
private Integer inviteType;
}

View File

@ -1,72 +0,0 @@
package com.ff.agent.mapper;
import java.math.BigDecimal;
import java.util.List;
import com.ff.agent.domain.TenantAgentCommission;
/**
* Mapper
*
* @author shi
* @date 2025-02-26
*/
public interface TenantAgentCommissionMapper
{
/**
*
*
* @param id
* @return
*/
TenantAgentCommission selectTenantAgentCommissionById(Long id);
/**
*
*
* @param tenantAgentCommission
* @return
*/
List<TenantAgentCommission> selectTenantAgentCommissionList(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param tenantAgentCommission
* @return
*/
int insertTenantAgentCommission(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param tenantAgentCommission
* @return
*/
int updateTenantAgentCommission(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentCommissionById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentCommissionByIds(Long[] ids);
/**
*
*
* @param tenantAgentCommission
* @return {@link BigDecimal }
*/
BigDecimal getAgentCommissionSum(TenantAgentCommission tenantAgentCommission);
}

View File

@ -1,70 +0,0 @@
package com.ff.agent.mapper;
import java.util.List;
import com.ff.agent.domain.TenantAgentInvite;
/**
* Mapper
*
* @author shi
* @date 2025-02-25
*/
public interface TenantAgentInviteMapper
{
/**
*
*
* @param id
* @return
*/
TenantAgentInvite selectTenantAgentInviteById(Long id);
/**
*
*
* @param inviteCode
* @return {@link TenantAgentInvite }
*/
TenantAgentInvite selectTenantAgentInviteByInviteCode(String inviteCode);
/**
*
*
* @param tenantAgentInvite
* @return
*/
List<TenantAgentInvite> selectTenantAgentInviteList(TenantAgentInvite tenantAgentInvite);
/**
*
*
* @param tenantAgentInvite
* @return
*/
int insertTenantAgentInvite(TenantAgentInvite tenantAgentInvite);
/**
*
*
* @param tenantAgentInvite
* @return
*/
int updateTenantAgentInvite(TenantAgentInvite tenantAgentInvite);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentInviteById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentInviteByIds(Long[] ids);
}

View File

@ -1,61 +0,0 @@
package com.ff.agent.mapper;
import java.util.List;
import com.ff.agent.domain.TenantAgentInvitePlatform;
/**
* Mapper
*
* @author shi
* @date 2025-02-27
*/
public interface TenantAgentInvitePlatformMapper
{
/**
*
*
* @param id
* @return
*/
TenantAgentInvitePlatform selectTenantAgentInvitePlatformById(Long id);
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
List<TenantAgentInvitePlatform> selectTenantAgentInvitePlatformList(TenantAgentInvitePlatform tenantAgentInvitePlatform);
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
int insertTenantAgentInvitePlatform(TenantAgentInvitePlatform tenantAgentInvitePlatform);
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
int updateTenantAgentInvitePlatform(TenantAgentInvitePlatform tenantAgentInvitePlatform);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentInvitePlatformById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentInvitePlatformByIds(Long[] ids);
}

View File

@ -1,72 +0,0 @@
package com.ff.agent.mapper;
import com.ff.agent.domain.TenantAgentInviteRegister;
import com.ff.agent.dto.TenantAgentInviteRegisterDTO;
import java.util.List;
/**
* Mapper
*
* @author shi
* @date 2025-02-25
*/
public interface TenantAgentInviteRegisterMapper
{
/**
*
*
* @param id
* @return
*/
TenantAgentInviteRegister selectTenantAgentInviteRegisterById(Long id);
/**
* dto
*
* @param tenantAgentInviteRegisterDTO dto
* @return {@link List }<{@link TenantAgentInviteRegisterDTO }>
*/
List<TenantAgentInviteRegisterDTO> selectTenantAgentInviteRegisterListDTO(TenantAgentInviteRegisterDTO tenantAgentInviteRegisterDTO);
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
List<TenantAgentInviteRegister> selectTenantAgentInviteRegisterList(TenantAgentInviteRegister tenantAgentInviteRegister);
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
int insertTenantAgentInviteRegister(TenantAgentInviteRegister tenantAgentInviteRegister);
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
int updateTenantAgentInviteRegister(TenantAgentInviteRegister tenantAgentInviteRegister);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentInviteRegisterById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentInviteRegisterByIds(Long[] ids);
}

View File

@ -1,61 +0,0 @@
package com.ff.agent.mapper;
import java.util.List;
import com.ff.agent.domain.TenantAgentWithdrawal;
/**
* Mapper
*
* @author shi
* @date 2025-02-26
*/
public interface TenantAgentWithdrawalMapper
{
/**
*
*
* @param id
* @return
*/
TenantAgentWithdrawal selectTenantAgentWithdrawalById(Long id);
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
List<TenantAgentWithdrawal> selectTenantAgentWithdrawalList(TenantAgentWithdrawal tenantAgentWithdrawal);
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
int insertTenantAgentWithdrawal(TenantAgentWithdrawal tenantAgentWithdrawal);
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
int updateTenantAgentWithdrawal(TenantAgentWithdrawal tenantAgentWithdrawal);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentWithdrawalById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentWithdrawalByIds(Long[] ids);
}

View File

@ -1,71 +0,0 @@
package com.ff.agent.service;
import java.math.BigDecimal;
import java.util.List;
import com.ff.agent.domain.TenantAgentCommission;
/**
* Service
*
* @author shi
* @date 2025-02-26
*/
public interface ITenantAgentCommissionService
{
/**
*
*
* @param id
* @return
*/
TenantAgentCommission selectTenantAgentCommissionById(Long id);
/**
*
*
* @param tenantAgentCommission
* @return
*/
List<TenantAgentCommission> selectTenantAgentCommissionList(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param tenantAgentCommission
* @return {@link BigDecimal }
*/
BigDecimal getAgentCommissionSum(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param tenantAgentCommission
* @return
*/
int insertTenantAgentCommission(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param tenantAgentCommission
* @return
*/
int updateTenantAgentCommission(TenantAgentCommission tenantAgentCommission);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentCommissionByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentCommissionById(Long id);
}

View File

@ -1,61 +0,0 @@
package com.ff.agent.service;
import java.util.List;
import com.ff.agent.domain.TenantAgentInvitePlatform;
/**
* Service
*
* @author shi
* @date 2025-02-27
*/
public interface ITenantAgentInvitePlatformService
{
/**
*
*
* @param id
* @return
*/
TenantAgentInvitePlatform selectTenantAgentInvitePlatformById(Long id);
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
List<TenantAgentInvitePlatform> selectTenantAgentInvitePlatformList(TenantAgentInvitePlatform tenantAgentInvitePlatform);
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
int insertTenantAgentInvitePlatform(TenantAgentInvitePlatform tenantAgentInvitePlatform);
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
int updateTenantAgentInvitePlatform(TenantAgentInvitePlatform tenantAgentInvitePlatform);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentInvitePlatformByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentInvitePlatformById(Long id);
}

View File

@ -1,73 +0,0 @@
package com.ff.agent.service;
import com.ff.agent.domain.TenantAgentInviteRegister;
import com.ff.agent.dto.TenantAgentInviteRegisterDTO;
import java.util.List;
/**
* Service
*
* @author shi
* @date 2025-02-25
*/
public interface ITenantAgentInviteRegisterService
{
/**
*
*
* @param id
* @return
*/
TenantAgentInviteRegister selectTenantAgentInviteRegisterById(Long id);
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
List<TenantAgentInviteRegister> selectTenantAgentInviteRegisterList(TenantAgentInviteRegister tenantAgentInviteRegister);
/**
* dto
*
* @param tenantAgentInviteRegisterDTO dto
* @return {@link List }<{@link TenantAgentInviteRegisterDTO }>
*/
List<TenantAgentInviteRegisterDTO> selectTenantAgentInviteRegisterListDTO(TenantAgentInviteRegisterDTO tenantAgentInviteRegisterDTO);
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
int insertTenantAgentInviteRegister(TenantAgentInviteRegister tenantAgentInviteRegister);
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
int updateTenantAgentInviteRegister(TenantAgentInviteRegister tenantAgentInviteRegister);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentInviteRegisterByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentInviteRegisterById(Long id);
}

View File

@ -1,77 +0,0 @@
package com.ff.agent.service;
import java.util.List;
import com.ff.agent.domain.TenantAgentInvite;
/**
* Service
*
* @author shi
* @date 2025-02-25
*/
public interface ITenantAgentInviteService
{
/**
*
*
* @param id
* @return
*/
TenantAgentInvite selectTenantAgentInviteById(Long id);
/**
*
*
* @param inviteCode
* @return {@link TenantAgentInvite }
*/
TenantAgentInvite selectTenantAgentInviteByInviteCode(String inviteCode);
/**
*
*
* @param tenantAgentInvite
* @return
*/
List<TenantAgentInvite> selectTenantAgentInviteList(TenantAgentInvite tenantAgentInvite);
/**
*
*
* @param tenantAgentInvite
* @return
*/
int insertTenantAgentInvite(TenantAgentInvite tenantAgentInvite);
/**
*
*
* @return {@link String }
*/
String getInviteCode();
/**
*
*
* @param tenantAgentInvite
* @return
*/
int updateTenantAgentInvite(TenantAgentInvite tenantAgentInvite);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentInviteByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentInviteById(Long id);
}

View File

@ -1,61 +0,0 @@
package com.ff.agent.service;
import java.util.List;
import com.ff.agent.domain.TenantAgentWithdrawal;
/**
* Service
*
* @author shi
* @date 2025-02-26
*/
public interface ITenantAgentWithdrawalService
{
/**
*
*
* @param id
* @return
*/
TenantAgentWithdrawal selectTenantAgentWithdrawalById(Long id);
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
List<TenantAgentWithdrawal> selectTenantAgentWithdrawalList(TenantAgentWithdrawal tenantAgentWithdrawal);
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
int insertTenantAgentWithdrawal(TenantAgentWithdrawal tenantAgentWithdrawal);
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
int updateTenantAgentWithdrawal(TenantAgentWithdrawal tenantAgentWithdrawal);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentWithdrawalByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentWithdrawalById(Long id);
}

View File

@ -1,111 +0,0 @@
package com.ff.agent.service.impl;
import java.math.BigDecimal;
import java.util.List;
import cn.hutool.core.util.IdUtil;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.agent.mapper.TenantAgentCommissionMapper;
import com.ff.agent.domain.TenantAgentCommission;
import com.ff.agent.service.ITenantAgentCommissionService;
/**
* Service
*
* @author shi
* @date 2025-02-26
*/
@Service
public class TenantAgentCommissionServiceImpl implements ITenantAgentCommissionService
{
@Autowired
private TenantAgentCommissionMapper tenantAgentCommissionMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantAgentCommission selectTenantAgentCommissionById(Long id)
{
return tenantAgentCommissionMapper.selectTenantAgentCommissionById(id);
}
/**
*
*
* @param tenantAgentCommission
* @return
*/
@Override
public List<TenantAgentCommission> selectTenantAgentCommissionList(TenantAgentCommission tenantAgentCommission)
{
return tenantAgentCommissionMapper.selectTenantAgentCommissionList(tenantAgentCommission);
}
/**
*
*
* @param tenantAgentCommission
* @return {@link BigDecimal }
*/
@Override
public BigDecimal getAgentCommissionSum(TenantAgentCommission tenantAgentCommission) {
return tenantAgentCommissionMapper.getAgentCommissionSum(tenantAgentCommission);
}
/**
*
*
* @param tenantAgentCommission
* @return
*/
@Override
public int insertTenantAgentCommission(TenantAgentCommission tenantAgentCommission)
{
tenantAgentCommission.setCreateTime(DateUtils.getNowDate());
tenantAgentCommission.setId(IdUtil.getSnowflakeNextId());
return tenantAgentCommissionMapper.insertTenantAgentCommission(tenantAgentCommission);
}
/**
*
*
* @param tenantAgentCommission
* @return
*/
@Override
public int updateTenantAgentCommission(TenantAgentCommission tenantAgentCommission)
{
tenantAgentCommission.setUpdateTime(DateUtils.getNowDate());
return tenantAgentCommissionMapper.updateTenantAgentCommission(tenantAgentCommission);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantAgentCommissionByIds(Long[] ids)
{
return tenantAgentCommissionMapper.deleteTenantAgentCommissionByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantAgentCommissionById(Long id)
{
return tenantAgentCommissionMapper.deleteTenantAgentCommissionById(id);
}
}

View File

@ -1,99 +0,0 @@
package com.ff.agent.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.agent.mapper.TenantAgentInvitePlatformMapper;
import com.ff.agent.domain.TenantAgentInvitePlatform;
import com.ff.agent.service.ITenantAgentInvitePlatformService;
import cn.hutool.core.util.IdUtil;
/**
* Service
*
* @author shi
* @date 2025-02-27
*/
@Service
public class TenantAgentInvitePlatformServiceImpl implements ITenantAgentInvitePlatformService
{
@Autowired
private TenantAgentInvitePlatformMapper tenantAgentInvitePlatformMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantAgentInvitePlatform selectTenantAgentInvitePlatformById(Long id)
{
return tenantAgentInvitePlatformMapper.selectTenantAgentInvitePlatformById(id);
}
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
@Override
public List<TenantAgentInvitePlatform> selectTenantAgentInvitePlatformList(TenantAgentInvitePlatform tenantAgentInvitePlatform)
{
return tenantAgentInvitePlatformMapper.selectTenantAgentInvitePlatformList(tenantAgentInvitePlatform);
}
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
@Override
public int insertTenantAgentInvitePlatform(TenantAgentInvitePlatform tenantAgentInvitePlatform)
{
tenantAgentInvitePlatform.setId(IdUtil.getSnowflakeNextId());
tenantAgentInvitePlatform.setCreateTime(DateUtils.getNowDate());
return tenantAgentInvitePlatformMapper.insertTenantAgentInvitePlatform(tenantAgentInvitePlatform);
}
/**
*
*
* @param tenantAgentInvitePlatform
* @return
*/
@Override
public int updateTenantAgentInvitePlatform(TenantAgentInvitePlatform tenantAgentInvitePlatform)
{
tenantAgentInvitePlatform.setUpdateTime(DateUtils.getNowDate());
return tenantAgentInvitePlatformMapper.updateTenantAgentInvitePlatform(tenantAgentInvitePlatform);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantAgentInvitePlatformByIds(Long[] ids)
{
return tenantAgentInvitePlatformMapper.deleteTenantAgentInvitePlatformByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantAgentInvitePlatformById(Long id)
{
return tenantAgentInvitePlatformMapper.deleteTenantAgentInvitePlatformById(id);
}
}

View File

@ -1,113 +0,0 @@
package com.ff.agent.service.impl;
import java.util.Collections;
import java.util.List;
import cn.hutool.core.util.IdUtil;
import com.ff.agent.domain.TenantAgentInviteRegister;
import com.ff.agent.dto.TenantAgentInviteRegisterDTO;
import com.ff.agent.mapper.TenantAgentInviteRegisterMapper;
import com.ff.agent.service.ITenantAgentInviteRegisterService;
import com.ff.base.utils.DateUtils;
import com.ff.base.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Service
*
* @author shi
* @date 2025-02-25
*/
@Service
public class TenantAgentInviteRegisterServiceImpl implements ITenantAgentInviteRegisterService
{
@Autowired
private TenantAgentInviteRegisterMapper tenantAgentInviteRegisterMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantAgentInviteRegister selectTenantAgentInviteRegisterById(Long id)
{
return tenantAgentInviteRegisterMapper.selectTenantAgentInviteRegisterById(id);
}
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
@Override
public List<TenantAgentInviteRegister> selectTenantAgentInviteRegisterList(TenantAgentInviteRegister tenantAgentInviteRegister)
{
return tenantAgentInviteRegisterMapper.selectTenantAgentInviteRegisterList(tenantAgentInviteRegister);
}
/**
* dto
*
* @param tenantAgentInviteRegisterDTO dto
* @return {@link List }<{@link TenantAgentInviteRegisterDTO }>
*/
@Override
public List<TenantAgentInviteRegisterDTO> selectTenantAgentInviteRegisterListDTO(TenantAgentInviteRegisterDTO tenantAgentInviteRegisterDTO) {
return tenantAgentInviteRegisterMapper.selectTenantAgentInviteRegisterListDTO(tenantAgentInviteRegisterDTO);
}
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
@Override
public int insertTenantAgentInviteRegister(TenantAgentInviteRegister tenantAgentInviteRegister)
{
tenantAgentInviteRegister.setId(IdUtil.getSnowflakeNextId());
tenantAgentInviteRegister.setCreateTime(DateUtils.getNowDate());
return tenantAgentInviteRegisterMapper.insertTenantAgentInviteRegister(tenantAgentInviteRegister);
}
/**
*
*
* @param tenantAgentInviteRegister
* @return
*/
@Override
public int updateTenantAgentInviteRegister(TenantAgentInviteRegister tenantAgentInviteRegister)
{
tenantAgentInviteRegister.setUpdateTime(DateUtils.getNowDate());
return tenantAgentInviteRegisterMapper.updateTenantAgentInviteRegister(tenantAgentInviteRegister);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantAgentInviteRegisterByIds(Long[] ids)
{
return tenantAgentInviteRegisterMapper.deleteTenantAgentInviteRegisterByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantAgentInviteRegisterById(Long id)
{
return tenantAgentInviteRegisterMapper.deleteTenantAgentInviteRegisterById(id);
}
}

View File

@ -1,128 +0,0 @@
package com.ff.agent.service.impl;
import java.util.List;
import cn.hutool.core.util.IdUtil;
import com.ff.base.utils.DateUtils;
import com.ff.base.utils.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.agent.mapper.TenantAgentInviteMapper;
import com.ff.agent.domain.TenantAgentInvite;
import com.ff.agent.service.ITenantAgentInviteService;
import org.springframework.util.CollectionUtils;
/**
* Service
*
* @author shi
* @date 2025-02-25
*/
@Service
public class TenantAgentInviteServiceImpl implements ITenantAgentInviteService
{
@Autowired
private TenantAgentInviteMapper tenantAgentInviteMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantAgentInvite selectTenantAgentInviteById(Long id)
{
return tenantAgentInviteMapper.selectTenantAgentInviteById(id);
}
/**
*
*
* @param inviteCode
* @return {@link TenantAgentInvite }
*/
@Override
public TenantAgentInvite selectTenantAgentInviteByInviteCode(String inviteCode) {
return tenantAgentInviteMapper.selectTenantAgentInviteByInviteCode( inviteCode);
}
/**
*
*
* @param tenantAgentInvite
* @return
*/
@Override
public List<TenantAgentInvite> selectTenantAgentInviteList(TenantAgentInvite tenantAgentInvite)
{
return tenantAgentInviteMapper.selectTenantAgentInviteList(tenantAgentInvite);
}
/**
*
*
* @param tenantAgentInvite
* @return
*/
@Override
public int insertTenantAgentInvite(TenantAgentInvite tenantAgentInvite)
{
tenantAgentInvite.setId(IdUtil.getSnowflakeNextId());
tenantAgentInvite.setCreateTime(DateUtils.getNowDate());
return tenantAgentInviteMapper.insertTenantAgentInvite(tenantAgentInvite);
}
/**
*
*
* @return {@link String }
*/
@Override
public synchronized String getInviteCode() {
String inviteCode = NumberUtils.generateRandomCode(12);
while (!CollectionUtils.isEmpty(tenantAgentInviteMapper.selectTenantAgentInviteList(TenantAgentInvite.builder()
.inviteCode(inviteCode)
.build()))) {
inviteCode = NumberUtils.generateRandomCode(12);
}
return inviteCode;
}
/**3
*
*
* @param tenantAgentInvite
* @return
*/
@Override
public int updateTenantAgentInvite(TenantAgentInvite tenantAgentInvite)
{
tenantAgentInvite.setUpdateTime(DateUtils.getNowDate());
return tenantAgentInviteMapper.updateTenantAgentInvite(tenantAgentInvite);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantAgentInviteByIds(Long[] ids)
{
return tenantAgentInviteMapper.deleteTenantAgentInviteByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantAgentInviteById(Long id)
{
return tenantAgentInviteMapper.deleteTenantAgentInviteById(id);
}
}

View File

@ -1,99 +0,0 @@
package com.ff.agent.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.agent.mapper.TenantAgentWithdrawalMapper;
import com.ff.agent.domain.TenantAgentWithdrawal;
import com.ff.agent.service.ITenantAgentWithdrawalService;
import cn.hutool.core.util.IdUtil;
/**
* Service
*
* @author shi
* @date 2025-02-26
*/
@Service
public class TenantAgentWithdrawalServiceImpl implements ITenantAgentWithdrawalService
{
@Autowired
private TenantAgentWithdrawalMapper tenantAgentWithdrawalMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantAgentWithdrawal selectTenantAgentWithdrawalById(Long id)
{
return tenantAgentWithdrawalMapper.selectTenantAgentWithdrawalById(id);
}
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
@Override
public List<TenantAgentWithdrawal> selectTenantAgentWithdrawalList(TenantAgentWithdrawal tenantAgentWithdrawal)
{
return tenantAgentWithdrawalMapper.selectTenantAgentWithdrawalList(tenantAgentWithdrawal);
}
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
@Override
public int insertTenantAgentWithdrawal(TenantAgentWithdrawal tenantAgentWithdrawal)
{
tenantAgentWithdrawal.setId(IdUtil.getSnowflakeNextId());
tenantAgentWithdrawal.setCreateTime(DateUtils.getNowDate());
return tenantAgentWithdrawalMapper.insertTenantAgentWithdrawal(tenantAgentWithdrawal);
}
/**
*
*
* @param tenantAgentWithdrawal
* @return
*/
@Override
public int updateTenantAgentWithdrawal(TenantAgentWithdrawal tenantAgentWithdrawal)
{
tenantAgentWithdrawal.setUpdateTime(DateUtils.getNowDate());
return tenantAgentWithdrawalMapper.updateTenantAgentWithdrawal(tenantAgentWithdrawal);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantAgentWithdrawalByIds(Long[] ids)
{
return tenantAgentWithdrawalMapper.deleteTenantAgentWithdrawalByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantAgentWithdrawalById(Long id)
{
return tenantAgentWithdrawalMapper.deleteTenantAgentWithdrawalById(id);
}
}

View File

@ -1,20 +0,0 @@
package com.ff.annotation;
import lombok.Data;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
*
* @author shi
* @date 2025/02/10
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface CheckHeader {
// 该注解没有参数,直接标识类需要进行头部验证
}

View File

@ -1,86 +0,0 @@
package com.ff.annotation;
import cn.hutool.core.util.IdUtil;
import com.ff.base.constant.Constants;
import com.ff.base.system.domain.TenantWhite;
import com.ff.base.system.service.ITenantWhiteService;
import com.ff.base.utils.ip.IpUtils;
import com.ff.base.utils.uuid.IdUtils;
import com.ff.config.KeyConfig;
import com.ff.base.utils.sign.Md5Utils;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.base.system.service.ITenantSecretKeyService;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
*
*
* @author shi
* @date 2025/02/10
*/
@Aspect
@Component
public class HeaderCheckAspect {
@Resource
private ITenantSecretKeyService tenantSecretKeyService;
@Resource
private ITenantWhiteService tenantWhiteService;
@Resource
private KeyConfig keyUtils;
// 定义切点: 所有带 @CheckHeader 注解的类中的所有方法
@Pointcut("@within(CheckHeader)")
public void checkHeaderPointcut() {
}
// 在方法执行前进行处理
@Before("checkHeaderPointcut()")
public void beforeMethod() throws Exception {
// 获取当前请求的 HTTP 请求对象
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
// 32 位小写 md5(random+key+tenantSecret)
String sign = request.getHeader(Constants.SIGN);
Assert.notNull(sign, "签名不能为空");
// 随机数
String random = request.getHeader(Constants.RANDOM);
Assert.notNull(random, "随机数不能为空");
Assert.isTrue( random.length() == 32, "随机数长度错误");
//key值
String key = request.getHeader(Constants.KEY);
Assert.notNull(key, "key不能为空");
TenantSecretKey tenantSecretKey = tenantSecretKeyService.selectTenantSecretKeyByTenantKey(key);
Assert.notNull(tenantSecretKey, key+"key不存在");
Assert.isTrue(tenantSecretKey.getTenantStatus(), "当前租户已停用");
List<TenantWhite> tenantWhites = tenantWhiteService.selectTenantWhiteList(TenantWhite.builder()
.tenantId(tenantSecretKey.getId())
.whiteIp(IpUtils.getIpAddr())
.build());
Assert.isTrue(!tenantWhites.isEmpty(), "当前"+IpUtils.getIpAddr()+"不在白名单内");
String keyG = Md5Utils.md5New(random + key + tenantSecretKey.getTenantSecret());
Assert.isTrue(keyG.equals(sign), "签名错误");
//保存
keyUtils.set(tenantSecretKey);
}
}

View File

@ -1,814 +0,0 @@
package com.ff.api.controller;
import com.ff.annotation.CheckHeader;
import com.ff.api.request.*;
import com.ff.api.response.*;
import com.ff.base.constant.Constants;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.core.page.TableDataInfo;
import com.ff.base.enums.ErrorCode;
import com.ff.base.enums.TransferType;
import com.ff.base.exception.base.ApiException;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.base.utils.StringUtils;
import com.ff.base.utils.bean.BeanUtils;
import com.ff.common.dto.GameBalanceExchange;
import com.ff.common.service.ITenantGameQuotaFlowService;
import com.ff.common.service.ITenantGameQuotaService;
import com.ff.config.KeyConfig;
import com.ff.game.api.IGamesService;
import com.ff.game.api.request.*;
import com.ff.game.domain.*;
import com.ff.game.dto.GameBettingDetailsDTO;
import com.ff.game.service.*;
import com.ff.member.domain.Member;
import com.ff.member.service.IMemberService;
import com.github.pagehelper.PageHelper;
import lombok.Data;
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.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* api
*
* @author shi
* @date 2025/02/10
*/
@RestController
@CheckHeader
@RequestMapping("/api/game")
@Slf4j
public class ApiGameController extends BaseController {
@Autowired
private Map<String, IGamesService> gamesService;
@Resource
private IGameService gameService;
@Resource
private KeyConfig keyConfig;
@Resource
private IMemberService memberService;
@Resource
private ITenantGameQuotaService tenantGameQuotaService;
@Resource
private IGameBettingDetailsService gameBettingDetailsService;
@Resource
private IGameFreeRecordService gameFreeRecordService;
@Resource
private IGameExchangeMoneyService gameExchangeMoneyService;
@Autowired
@Qualifier("threadPoolTaskExecutor")
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
@Resource
private IPlatformService platformService;
/**
*
*
* @return {@link AjaxResult }
*/
@PostMapping("/list")
public AjaxResult list() {
List<GameResponse> gameResponses = gameService.selectGameResponseList();
for (GameResponse gameResponse : gameResponses) {
Platform platform = platformService.get(gameResponse.getPlatformCode());
if (null == platform) {
continue;
}
List<String> currencyCode = new ArrayList<>(platform.getCurrencyInfo().keySet());
gameResponse.setCurrencyCode(currencyCode);
}
return AjaxResult.success(gameResponses);
}
/**
*
*
* @param loginRequest
* @return {@link AjaxResult }
*/
@PostMapping("/login")
public AjaxResult login(@Validated @RequestBody GameLoginRequest loginRequest) {
Game game = gameService.selectGameByGameId(loginRequest.getGameId());
ApiException.notNull(game, ErrorCode.GAME_NOT_EXIST.getCode());
Platform platform = platformService.get(game.getPlatformCode());
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
IGamesService iGamesService = gamesService.get(platform.getPlatformCode() + Constants.SERVICE);
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
String targetCurrency = platform.getCurrencyInfo().get(loginRequest.getCurrencyCode());
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
KeyInfo keyInfo = null;
for (KeyInfo keyData : platform.getKeyInfo()) {
if (StringUtils.isNotEmpty(loginRequest.getCurrencyCode())) {
if (keyData.getCurrency().equalsIgnoreCase(loginRequest.getCurrencyCode())) {
keyInfo = keyData;
break;
}
}
}
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
String targetLang = platform.getLangInfo().get(loginRequest.getLangCode());
ApiException.notNull(targetLang, ErrorCode.LANG_NOT_EXIST.getCode());
Member member = memberService.selectMemberByAccount(loginRequest.getAccount(), loginRequest.getCurrencyCode(), platform.getPlatformCode());
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
GamesLogin gamesLogin = GamesLogin.builder()
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.account(member.getGameAccount())
.gameType(game.getGameSourceType())
.currency(/*secretKeyCurrencyDTO.getCurrency()*/targetCurrency)
.gameId(game.getGameCode())
.homeUrl(loginRequest.getHomeUrl())
.betLimit(loginRequest.getBetLimit())
.platform(loginRequest.getPlatform())
.disableFullScreen(loginRequest.getDisableFullScreen())
.lang(/*gameSecretKeyLangDTO.getLang()*/ targetLang)
.vendor(platform)
.keyInfo(keyInfo)
.systemCurrency(loginRequest.getCurrencyCode())
.build();
String login = iGamesService.loginWithoutRedirect(gamesLogin);
return AjaxResult.success("操作成功", login);
}
/**
*
*
* @param gameExchangeBalanceRequest
* @return {@link AjaxResult }
*/
@PostMapping("/exchange/balance")
@Transactional
public AjaxResult exchangeBalance(@Validated @RequestBody GameExchangeBalanceRequest gameExchangeBalanceRequest) {
IGamesService iGamesService = gamesService.get(gameExchangeBalanceRequest.getPlatformCode() + Constants.SERVICE);
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
TenantSecretKey tenantSecretKey = keyConfig.get();
Platform platform = platformService.get(gameExchangeBalanceRequest.getPlatformCode());
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
String targetCurrency = platform.getCurrencyInfo().get(gameExchangeBalanceRequest.getCurrencyCode());
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
KeyInfo keyInfo = null;
for (KeyInfo keyData : platform.getKeyInfo()) {
if (StringUtils.isNotEmpty(gameExchangeBalanceRequest.getCurrencyCode())) {
if (keyData.getCurrency().equalsIgnoreCase(gameExchangeBalanceRequest.getCurrencyCode())) {
keyInfo = keyData;
break;
}
}
}
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
BigDecimal quota = BigDecimal.ZERO;
//如果是扣钱提前扣
if (TransferType.GAMES.getCode().equals(gameExchangeBalanceRequest.getTransferType())) {
quota = tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
.platformCode(gameExchangeBalanceRequest.getPlatformCode())
.sourceId(gameExchangeBalanceRequest.getOrderId())
.currencyCode(gameExchangeBalanceRequest.getCurrencyCode())
.currency(targetCurrency)
.transferType(gameExchangeBalanceRequest.getTransferType())
.amount(gameExchangeBalanceRequest.getAmount())
.account(gameExchangeBalanceRequest.getAccount())
.tenantKey(tenantSecretKey.getTenantKey())
.systemCurrency(gameExchangeBalanceRequest.getCurrencyCode())
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.build());
}
// 获取用户信息
Member member = memberService.selectMemberByAccount(gameExchangeBalanceRequest.getAccount(), gameExchangeBalanceRequest.getCurrencyCode(), gameExchangeBalanceRequest.getPlatformCode());
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
//操作第三方额度接口
ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO = ExchangeTransferMoneyRequestDTO.builder()
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.orderId(gameExchangeBalanceRequest.getOrderId())
.account(member.getGameAccount())
.currency(targetCurrency)
.tenantKey(tenantSecretKey.getTenantKey())
.quota(quota)
.amount(gameExchangeBalanceRequest.getAmount())
.transferType(gameExchangeBalanceRequest.getTransferType())
.vendor(platform)
.keyInfo(keyInfo)
.systemCurrency(gameExchangeBalanceRequest.getCurrencyCode())
.build();
Long exchangeTransferId = iGamesService.exchangeTransferByAgentId(exchangeTransferMoneyRequestDTO);
GameExchangeMoney gameExchangeMoney = gameExchangeMoneyService.selectGameExchangeMoneyById(exchangeTransferId);
GameExchangeBalanceResponse gameExchangeBalanceResponse = new GameExchangeBalanceResponse();
BeanUtils.copyProperties(gameExchangeMoney, gameExchangeBalanceResponse);
return AjaxResult.success(gameExchangeBalanceResponse);
}
/**
*
*
* @param gameExchangeStateRequest
* @return {@link AjaxResult }
*/
@PostMapping("/exchange/state")
@Transactional
public AjaxResult exchangeState(@Validated @RequestBody GameExchangeStateRequest gameExchangeStateRequest) {
TenantSecretKey tenantSecretKey = keyConfig.get();
GameExchangeMoney gameExchangeMoney = GameExchangeMoney.builder()
.tenantKey(tenantSecretKey.getTenantKey())
.orderId(gameExchangeStateRequest.getOrderId())
.build();
List<GameExchangeMoney> gameExchangeMonies = gameExchangeMoneyService.selectGameExchangeMoneyList(gameExchangeMoney);
ApiException.isTrue(!CollectionUtils.isEmpty(gameExchangeMonies), ErrorCode.ORDER_NOT_EXIST.getCode());
GameExchangeBalanceResponse gameExchangeBalanceResponse = new GameExchangeBalanceResponse();
BeanUtils.copyProperties(gameExchangeMonies.get(0), gameExchangeBalanceResponse);
return AjaxResult.success(gameExchangeBalanceResponse);
}
/**
*
*
* @param gameCreateFreeSpinRequest
* @return {@link AjaxResult }
*/
@PostMapping("/create/free/spin")
public AjaxResult createFreeSpin(@Validated @RequestBody GameCreateFreeSpinRequest gameCreateFreeSpinRequest) {
IGamesService iGamesService = gamesService.get(gameCreateFreeSpinRequest.getPlatformCode() + Constants.SERVICE);
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
// TenantSecretKey tenantSecretKey = keyConfig.get();
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
// .platformCode(gameCreateFreeSpinRequest.getPlatformCode())
// .systemCurrency(gameCreateFreeSpinRequest.getCurrencyCode()).build());
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
Platform platform = platformService.get(gameCreateFreeSpinRequest.getPlatformCode());
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
String targetCurrency = platform.getCurrencyInfo().get(gameCreateFreeSpinRequest.getCurrencyCode());
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
KeyInfo keyInfo = null;
for (KeyInfo keyData : platform.getKeyInfo()) {
if (StringUtils.isNotEmpty(gameCreateFreeSpinRequest.getCurrencyCode())) {
if (keyData.getCurrency().equalsIgnoreCase(gameCreateFreeSpinRequest.getCurrencyCode())) {
keyInfo = keyData;
break;
}
}
}
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
Member member = memberService.selectMemberByAccount(gameCreateFreeSpinRequest.getAccount(), gameCreateFreeSpinRequest.getCurrencyCode(), gameCreateFreeSpinRequest.getPlatformCode());
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
CreateFreeSpinRequestDTO createFreeSpinRequestDTO = CreateFreeSpinRequestDTO.builder()
.account(member.getGameAccount())
.currency(/*gameCreateFreeSpinRequest.getCurrencyCode()*/targetCurrency)
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.referenceId(gameCreateFreeSpinRequest.getReferenceId())
.freeSpinValidity(gameCreateFreeSpinRequest.getFreeSpinValidity())
.numberOfRounds(gameCreateFreeSpinRequest.getNumberOfRounds())
.gameIds(gameCreateFreeSpinRequest.getGameIds())
.betValue(gameCreateFreeSpinRequest.getBetValue())
.startTime(gameCreateFreeSpinRequest.getStartTime())
.vendor(platform)
.keyInfo(keyInfo)
.systemCurrency(gameCreateFreeSpinRequest.getCurrencyCode())
.build();
return AjaxResult.success(iGamesService.createFreeSpin(createFreeSpinRequestDTO));
}
/**
*
*
* @param gameCreateFreeSpinRequest
* @return {@link AjaxResult }
*/
@PostMapping("/get/bet/record")
public TableDataInfo getBetRecord(@Validated @RequestBody GameGetBetRecordRequest gameCreateFreeSpinRequest) {
TenantSecretKey tenantSecretKey = keyConfig.get();
startPage();
PageHelper.startPage(gameCreateFreeSpinRequest.getPageNo(), gameCreateFreeSpinRequest.getPageSize(), "wagers_time desc");
GameBettingDetailsDTO gameBettingDetails = GameBettingDetailsDTO.builder()
.platformCode(gameCreateFreeSpinRequest.getPlatformCode())
.currencyCode(gameCreateFreeSpinRequest.getCurrencyCode())
.tenantKey(tenantSecretKey.getTenantKey())
.timeType(gameCreateFreeSpinRequest.getTimeType())
.build();
Map<String, Object> params = gameBettingDetails.getParams();
params.put("beginTime", gameCreateFreeSpinRequest.getBeginTime());
params.put("endTime", gameCreateFreeSpinRequest.getEndTime());
List<GameBettingDetails> bettingDetails = gameBettingDetailsService.selectGameBettingDetailsList(gameBettingDetails);
TableDataInfo dataTable = getDataTable(bettingDetails);
List<GameBettingDetailsResponse> result = new ArrayList<>();
for (GameBettingDetails row : (List<GameBettingDetails>) dataTable.getRows()) {
GameBettingDetailsResponse gameBettingDetailsResponse = new GameBettingDetailsResponse();
BeanUtils.copyProperties(row, gameBettingDetailsResponse);
Member member = memberService.selectMemberById(row.getMemberId());
gameBettingDetailsResponse.setAccount(member.getMemberAccount());
result.add(gameBettingDetailsResponse);
}
dataTable.setRows(result);
return dataTable;
}
/**
*
*
* @param gameGetDetailRequest
* @return {@link AjaxResult }
*/
@PostMapping("/get/detail")
public AjaxResult getDetail(@Validated @RequestBody GameGetDetailRequest gameGetDetailRequest) {
Platform platform = platformService.get(gameGetDetailRequest.getPlatformCode());
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
String targetCurrency = platform.getCurrencyInfo().get(gameGetDetailRequest.getCurrencyCode());
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
KeyInfo keyInfo = null;
for (KeyInfo keyData : platform.getKeyInfo()) {
if (StringUtils.isNotEmpty(gameGetDetailRequest.getCurrencyCode())) {
if (keyData.getCurrency().equalsIgnoreCase(gameGetDetailRequest.getCurrencyCode())) {
keyInfo = keyData;
break;
}
}
}
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
String targetLang = platform.getLangInfo().get(gameGetDetailRequest.getLangCode());
ApiException.notNull(targetLang, ErrorCode.LANG_NOT_EXIST.getCode());
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
// .platformCode(gameGetDetailRequest.getPlatformCode())
// .systemCurrency(gameGetDetailRequest.getCurrencyCode()).build());
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
IGamesService iGamesService = gamesService.get(gameGetDetailRequest.getPlatformCode() + Constants.SERVICE);
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
// GameSecretKeyLangDTO gameSecretKeyLang = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
// .platformCode(gameGetDetailRequest.getPlatformCode())
// .systemLangCode(gameGetDetailRequest.getLangCode())
// .build());
// ApiException.notNull(gameSecretKeyLang, ErrorCode.LANG_NOT_EXIST.getCode());
GetGameDetailResponseDTO gameDetail = iGamesService.getGameDetail(GetGameDetailRequestDTO.builder()
.wagersId(gameGetDetailRequest.getWagersId())
.lang(/*gameSecretKeyLang.getLang()*/targetLang)
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.vendor(platform)
.keyInfo(keyInfo)
.systemCurrency(gameGetDetailRequest.getCurrencyCode())
.build());
return AjaxResult.success(gameDetail);
}
/**
*
*
* @param gameKickMemeberRequest
* @return {@link AjaxResult }
*/
@PostMapping("/kick/member")
public AjaxResult kickMember(@Validated @RequestBody GameKickMemeberRequest gameKickMemeberRequest) {
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
// .platformCode(gameKickMemeberRequest.getPlatformCode())
// .systemCurrency(gameKickMemeberRequest.getCurrencyCode()).build());
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
Platform platform = platformService.get(gameKickMemeberRequest.getPlatformCode());
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
String targetCurrency = platform.getCurrencyInfo().get(gameKickMemeberRequest.getCurrencyCode());
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
KeyInfo keyInfo = null;
for (KeyInfo keyData : platform.getKeyInfo()) {
if (StringUtils.isNotEmpty(gameKickMemeberRequest.getCurrencyCode())) {
if (keyData.getCurrency().equalsIgnoreCase(gameKickMemeberRequest.getCurrencyCode())) {
keyInfo = keyData;
break;
}
}
}
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
IGamesService iGamesService = gamesService.get(gameKickMemeberRequest.getPlatformCode() + Constants.SERVICE);
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
Member member = memberService.selectMemberByAccount(gameKickMemeberRequest.getAccount(), gameKickMemeberRequest.getCurrencyCode(), gameKickMemeberRequest.getPlatformCode());
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
return AjaxResult.success(iGamesService.kickMember(KickMemberRequestDTO.builder()
.account(member.getGameAccount())
.agentId(keyInfo.getCode())
.currency(targetCurrency)
.agentKey(keyInfo.getKey())
.vendor(platform)
.keyInfo(keyInfo)
.systemCurrency(gameKickMemeberRequest.getCurrencyCode())
.build()));
}
@PostMapping("/kick/member/all")
public AjaxResult kickMemberAll(@Validated @RequestBody GameKickMemeberAllRequest gameKickMemeberAllRequest) {
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
// .platformCode(gameKickMemeberAllRequest.getPlatformCode())
// .systemCurrency(gameKickMemeberAllRequest.getCurrencyCode()).build());
//
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
Platform platform = platformService.get(gameKickMemeberAllRequest.getPlatformCode());
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
String targetCurrency = platform.getCurrencyInfo().get(gameKickMemeberAllRequest.getCurrencyCode());
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
KeyInfo keyInfo = null;
for (KeyInfo keyData : platform.getKeyInfo()) {
if (StringUtils.isNotEmpty(gameKickMemeberAllRequest.getCurrencyCode())) {
if (keyData.getCurrency().equalsIgnoreCase(gameKickMemeberAllRequest.getCurrencyCode())) {
keyInfo = keyData;
break;
}
}
}
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
IGamesService iGamesService = gamesService.get(gameKickMemeberAllRequest.getPlatformCode() + Constants.SERVICE);
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
KickMemberAllDTO kickMemberAllDTO = KickMemberAllDTO.builder()
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.currency(/*gameSecretKey.getCurrency()*/targetCurrency)
.vendor(platform)
.keyInfo(keyInfo)
.systemCurrency(gameKickMemeberAllRequest.getCurrencyCode())
.build();
if (!ObjectUtils.isEmpty(gameKickMemeberAllRequest.getGameId())) {
Game game = gameService.selectGameById(gameKickMemeberAllRequest.getGameId());
ApiException.notNull(game, ErrorCode.GAME_NOT_EXIST.getCode());
kickMemberAllDTO.setGameId(game.getGameCode());
}
return AjaxResult.success(iGamesService.kickMemberAll(kickMemberAllDTO));
}
/**
*
*
* @param gameGetFreeSpinDashflowRequest dashflow
* @return {@link TableDataInfo }
*/
@PostMapping("/get/free/spin/dashflow")
public TableDataInfo getFreeSpinDashflow(@Validated @RequestBody GameGetFreeSpinDashflowRequest gameGetFreeSpinDashflowRequest) {
PageHelper.startPage(gameGetFreeSpinDashflowRequest.getPageNo(), gameGetFreeSpinDashflowRequest.getPageSize(), "free_update_time desc");
GameFreeRecord gameFreeRecord = GameFreeRecord.builder()
.gameId(gameGetFreeSpinDashflowRequest.getGameId())
.platformCode(gameGetFreeSpinDashflowRequest.getPlatformCode())
.currencyCode(gameGetFreeSpinDashflowRequest.getCurrencyCode())
.build();
Map<String, Object> params = gameFreeRecord.getParams();
params.put("beginTime", gameGetFreeSpinDashflowRequest.getBeginTime());
params.put("endTime", gameGetFreeSpinDashflowRequest.getEndTime());
List<GameFreeRecord> gameFreeRecords = gameFreeRecordService.selectGameFreeRecordList(gameFreeRecord);
TableDataInfo dataTable = getDataTable(gameFreeRecords);
List<GameFreeRecordResponse> result = new ArrayList<>();
for (GameFreeRecord row : (List<GameFreeRecord>) dataTable.getRows()) {
GameFreeRecordResponse gameFreeRecordResponse = new GameFreeRecordResponse();
BeanUtils.copyProperties(row, gameFreeRecordResponse);
Member member = memberService.selectMemberById(row.getMemberId());
gameFreeRecordResponse.setMemberAccount(member.getMemberAccount());
result.add(gameFreeRecordResponse);
}
dataTable.setRows(result);
return dataTable;
}
/**
*
*
* @param request dashflow
* @return {@link TableDataInfo }
*/
@PostMapping("/cancel/free/spin")
public AjaxResult cancelFreeSpin(@Validated @RequestBody GameCancelFreeSpinRequest request) {
// GameSecretKeyCurrencyDTO gameSecretKey = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
// .platformCode(gameGetFreeSpinDashflowRequest.getPlatformCode())
// .systemCurrency(gameGetFreeSpinDashflowRequest.getCurrencyCode()).build());
// ApiException.notNull(gameSecretKey, ErrorCode.CURRENCY_NOT_EXIST.getCode());
Platform platform = platformService.get(request.getPlatformCode());
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
String targetCurrency = platform.getCurrencyInfo().get(request.getCurrencyCode());
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
KeyInfo keyInfo = null;
for (KeyInfo keyData : platform.getKeyInfo()) {
if (StringUtils.isNotEmpty(request.getCurrencyCode())) {
if (keyData.getCurrency().equalsIgnoreCase(request.getCurrencyCode())) {
keyInfo = keyData;
break;
}
}
}
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
IGamesService iGamesService = gamesService.get(request.getPlatformCode() + Constants.SERVICE);
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
Boolean cancelFreeSpin = iGamesService.cancelFreeSpin(CancelFreeSpinRequestDTO.builder()
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.referenceId(request.getReferenceId())
.vendor(platform)
.keyInfo(keyInfo)
.systemCurrency(request.getCurrencyCode())
.build());
return AjaxResult.success(cancelFreeSpin);
}
/**
*
*
* @param request api
* @return {@link AjaxResult }
*//*
@PostMapping("/exchange/balance/all")
public AjaxResult exchangeBalanceAll(@Validated @RequestBody GameExchangeBalanceAllRequest request) {
TenantSecretKey tenantSecretKey = keyConfig.get();
// List<GameSecretKeyCurrencyDTO> gameSecretKeys = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(GameSecretKeyCurrencyDTO.builder()
// .systemCurrency(gameExchangeBalanceAllRequest.getCurrencyCode()).build());
List<Key> keys = new ArrayList<>();
for (GamePlatforms platformEnum : GamePlatforms.values()) {
Platform platform = platformService.get(platformEnum.getCode());
String targetCurrency = platform.getCurrencyInfo().get(request.getCurrencyCode());
if (StringUtils.isEmpty(targetCurrency)) {
continue;
}
KeyInfo keyInfo = null;
for (KeyInfo keyData : platform.getKeyInfo()) {
if (StringUtils.isNotEmpty(request.getCurrencyCode())) {
if (keyData.getCurrency().equalsIgnoreCase(request.getCurrencyCode())) {
keyInfo = keyData;
break;
}
}
}
if (null == keyInfo) {
continue;
}
Key key = new Key();
key.setPlatformCode(platform.getPlatformCode());
key.setCode(keyInfo.getCode());
key.setKey(keyInfo.getKey());
key.setCurrency(targetCurrency);
key.setPlatform(platform);
key.setKeyInfo(keyInfo);
key.setSystemCurrency(request.getCurrencyCode());
keys.add(key);
}
// 创建线程池
Map<String, BigDecimal> balanceMap = new LinkedHashMap<>();
CountDownLatch latch = new CountDownLatch(keys.size());
// 使用List存储Future对象用于获取异步执行的结果
List<Future<Long>> futures = new ArrayList<>();
// 提交异步任务到线程池
// for (GameSecretKeyCurrencyDTO gameSecretKeyCurrencyDTO : gameSecretKeys) {
for (Key key : keys) {
futures.add(threadPoolTaskExecutor.submit(() -> {
try {
IGamesService iGamesService = gamesService.get(key.getPlatformCode() + Constants.SERVICE);
Member member = memberService.selectMemberByAccount(request.getAccount(), request.getCurrencyCode(), key.getPlatformCode());
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
//操作第三方钱包
ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO = ExchangeTransferMoneyRequestDTO.builder()
.agentId(key.getCode())
.agentKey(key.getKey())
.orderId(request.getOrderId())
.amount(BigDecimal.ONE)
.currency(*//*gameSecretKeyCurrencyDTO.getCurrency()*//*key.currency)
.tenantKey(tenantSecretKey.getTenantKey())
.account(member.getGameAccount())
.vendor(key.getPlatform())
.keyInfo(key.getKeyInfo())
.systemCurrency(key.systemCurrency)
.transferType(TransferType.ALL.getCode())
.build();
return iGamesService.exchangeTransferByAgentId(exchangeTransferMoneyRequestDTO);
} catch (Exception e) {
return 0L;
} finally {
latch.countDown(); // 任务完成后减少计数
}
}));
}
BigDecimal balanceAll = BigDecimal.ZERO;
try {
// 等待所有线程执行完毕
latch.await();
// 获取每个Future的结果
for (Future<Long> future : futures) {
// 汇总结果
Long id = future.get();
GameExchangeMoney gameExchangeMoney = gameExchangeMoneyService.selectGameExchangeMoneyById(id);
if (ObjectUtils.isEmpty(gameExchangeMoney)) {
continue;
}
Member member = memberService.selectMemberById(gameExchangeMoney.getMemberId());
balanceMap.put(gameExchangeMoney.getPlatformCode(), gameExchangeMoney.getBalance());
BigDecimal balance = gameExchangeMoney.getBalance();
balanceAll = NumberUtil.add(balanceAll, balance);
//操作租户额度
tenantGameQuotaService.gameBalanceExchange(GameBalanceExchange.builder()
.platformCode(gameExchangeMoney.getPlatformCode())
.currencyCode(gameExchangeMoney.getCurrencyCode())
.sourceId(request.getOrderId())
.transferType(TransferType.ALL.getCode())
.amount(gameExchangeMoney.getBalance())
.account(member.getMemberAccount())
.tenantKey(tenantSecretKey.getTenantKey())
.currency()
.systemCurrency(gameExchangeMoney.getCurrencyCode())
.agentId()
.agentKey()
.build());
}
} catch (Exception e) {
log.error("拉回用户余额失败", e);
throw new BaseException("拉回用户余额失败");
}
balanceMap.put("balanceAll", balanceAll);
return AjaxResult.success(balanceMap);
}*/
/**
*
*
* @param request
* @return {@link AjaxResult }
*/
@PostMapping("/demo/login")
public AjaxResult demoLogin(@Validated @RequestBody GameDemoLoginRequest request) {
Game game = gameService.selectGameById(request.getGameId());
ApiException.notNull(game, ErrorCode.GAME_NOT_EXIST.getCode());
//GamePlatform gamePlatform = gamePlatformService.selectGamePlatformById(game.getPlatformId());
//ApiException.notNull(gamePlatform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
Platform platform = platformService.get(game.getPlatformCode());
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
IGamesService iGamesService = gamesService.get(platform.getPlatformCode() + Constants.SERVICE);
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
String targetCurrency = platform.getCurrencyInfo().get(request.getCurrencyCode());
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
KeyInfo keyInfo = null;
for (KeyInfo keyData : platform.getKeyInfo()) {
if (StringUtils.isNotEmpty(request.getCurrencyCode())) {
if (keyData.getCurrency().equalsIgnoreCase(request.getCurrencyCode())) {
keyInfo = keyData;
break;
}
}
}
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
String targetLang = platform.getLangInfo().get(request.getLangCode());
ApiException.notNull(targetLang, ErrorCode.LANG_NOT_EXIST.getCode());
// GameSecretKeyLangDTO gameSecretKeyLangDTO = gameSecretKeyLangService.findGameSecretKeyLangDTO(GameSecretKeyLangDTO.builder()
// .platformCode(gamePlatform.getPlatformCode())
// .systemLangCode(gameDemoLoginRequest.getLangCode())
// .build());
// ApiException.notNull(gameSecretKeyLangDTO, ErrorCode.LANG_NOT_EXIST.getCode());
GameDemoLoginRequestDTO gamesLogin = GameDemoLoginRequestDTO.builder()
.gameId(game.getGameCode())
.gameType(game.getGameSourceType())
.lang(/*gameSecretKeyLangDTO.getLang()*/targetLang)
.vendor(platform)
.keyInfo(keyInfo)
.systemCurrency(request.getCurrencyCode())
.build();
GameDemoLoginResponseDTO gameDemoLoginResponseDTO = iGamesService.gameDemoLogin(gamesLogin);
GameDemoLoginResponse gameDemoLoginResponse = new GameDemoLoginResponse();
BeanUtils.copyProperties(gameDemoLoginResponseDTO, gameDemoLoginResponse);
return AjaxResult.success(gameDemoLoginResponse);
}
@Data
class Key {
private String platformCode;
private String code;
private String currency;
private String key;
private Platform platform;
private KeyInfo keyInfo;
private String systemCurrency;
}
}

View File

@ -1,318 +0,0 @@
package com.ff.api.controller;
import com.ff.annotation.CheckHeader;
import com.ff.api.request.MemberCreateApiRequest;
import com.ff.api.request.MemberInfoAllApiRequest;
import com.ff.api.request.MemberInfoApiRequest;
import com.ff.api.response.MemberInfoAllResponse;
import com.ff.api.response.MemberInfoResponse;
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.ErrorCode;
import com.ff.base.enums.GamePlatforms;
import com.ff.base.exception.base.ApiException;
import com.ff.base.exception.base.BaseException;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.base.utils.StringUtils;
import com.ff.config.KeyConfig;
import com.ff.game.api.IGamesService;
import com.ff.game.api.request.CreateMemberRequestDTO;
import com.ff.game.api.request.MemberInfoRequestDTO;
import com.ff.game.api.request.MemberInfoResponseDTO;
import com.ff.game.domain.KeyInfo;
import com.ff.game.domain.Platform;
import com.ff.game.service.IPlatformService;
import com.ff.member.domain.Member;
import com.ff.member.service.IMemberService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
/**
* api
*
* @author shi
* @date 2025/02/10
*/
@RestController
@CheckHeader
@RequestMapping("/api/member")
@Slf4j
public class ApiMemberController extends BaseController {
@Autowired
private Map<String, IGamesService> gamesService;
@Resource
private KeyConfig keyConfig;
@Resource
private IMemberService memberService;
@Autowired
@Qualifier("threadPoolTaskExecutor")
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
@Resource
private IPlatformService platformService;
/**
*
*
* @param memberCreateApiRequest api
* @return {@link AjaxResult }
*/
@PostMapping("/create")
@Transactional
public synchronized AjaxResult createMember(@Validated @RequestBody MemberCreateApiRequest memberCreateApiRequest) {
IGamesService iGamesService = gamesService.get(memberCreateApiRequest.getPlatformCode() + Constants.SERVICE);
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
TenantSecretKey tenantSecretKey = keyConfig.get();
Platform platform = platformService.get(memberCreateApiRequest.getPlatformCode());
ApiException.notNull(platform, ErrorCode.CURRENCY_NOT_EXIST.getCode());
String targetCurrency = platform.getCurrencyInfo().get(memberCreateApiRequest.getCurrencyCode());
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
KeyInfo keyInfo = null;
for (KeyInfo keyData : platform.getKeyInfo()) {
if (StringUtils.isNotEmpty(memberCreateApiRequest.getCurrencyCode())) {
if (keyData.getCurrency().equalsIgnoreCase(memberCreateApiRequest.getCurrencyCode())) {
keyInfo = keyData;
break;
}
}
}
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
String gameAccount =memberService.getMemberGameAccount(memberCreateApiRequest.getPlatformCode(), tenantSecretKey.getTenantSn());
// 获取用户信息
Member gameMember = memberService.selectMemberByAccount(memberCreateApiRequest.getAccount(), memberCreateApiRequest.getCurrencyCode(), memberCreateApiRequest.getPlatformCode());
if (!ObjectUtils.isEmpty(gameMember)) {
throw new ApiException(ErrorCode.GAME_ACCOUNT_CREATION_FAILED.getCode());
}
//注册本地账号
Member member = Member.builder()
.tenantKey(tenantSecretKey.getTenantKey())
.memberAccount(memberCreateApiRequest.getAccount())
.gameAccount(gameAccount)
.platformCode(memberCreateApiRequest.getPlatformCode())
.currencyCode(memberCreateApiRequest.getCurrencyCode())
.build();
int insertMember = memberService.insertMember(member);
Assert.isTrue(insertMember > 0, "建立游戏账号失败");
//向第三方注册账号
CreateMemberRequestDTO gamesBaseRequestDTO = CreateMemberRequestDTO.builder()
.account(gameAccount)
.agentId(keyInfo.getCode())
.agentKey(keyInfo.getKey())
.betLimit(memberCreateApiRequest.getBetLimit())
.platformType(memberCreateApiRequest.getPlatformType())
.currency(targetCurrency)
.vendor(platform)
.keyInfo(keyInfo)
.systemCurrency(memberCreateApiRequest.getCurrencyCode())
.build();
Boolean result = iGamesService.createMember(gamesBaseRequestDTO);
Assert.isTrue(result, "建立游戏账号失败");
return toAjax(Boolean.TRUE);
}
/**
*
*
* @param request api
* @return {@link AjaxResult }
*/
@PostMapping("/info")
public AjaxResult getMemberInfo(@Validated @RequestBody MemberInfoApiRequest request) {
IGamesService iGamesService = gamesService.get(request.getPlatformCode() + Constants.SERVICE);
ApiException.notNull(iGamesService, ErrorCode.PLATFORM_NOT_EXIST.getCode());
Platform platform = platformService.get(request.getPlatformCode());
ApiException.notNull(platform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
String targetCurrency = platform.getCurrencyInfo().get(request.getCurrencyCode());
ApiException.notNull(targetCurrency, ErrorCode.CURRENCY_NOT_EXIST.getCode());
KeyInfo keyInfo = null;
for (KeyInfo keyData : platform.getKeyInfo()) {
if (StringUtils.isNotEmpty(request.getCurrencyCode())) {
if (keyData.getCurrency().equalsIgnoreCase(request.getCurrencyCode())) {
keyInfo = keyData;
break;
}
}
}
ApiException.notNull(keyInfo, ErrorCode.CURRENCY_NOT_EXIST.getCode());
// 获取用户信息
Member member = memberService.selectMemberByAccount(request.getAccount(), request.getCurrencyCode(), request.getPlatformCode());
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
//向第三方查询账号
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
.accounts(member.getGameAccount())
.agentId(keyInfo.getCode())
.currency(targetCurrency)
.agentKey(keyInfo.getKey())
.vendor(platform)
.keyInfo(keyInfo)
.systemCurrency(request.getCurrencyCode())
.build();
MemberInfoResponseDTO memberInfo = iGamesService.getMemberInfo(gamesBaseRequestDTO);
MemberInfoResponse memberInfoResponse = new MemberInfoResponse();
BeanUtils.copyProperties(memberInfo, memberInfoResponse);
return AjaxResult.success(memberInfoResponse);
}
/**
*
*
* @param memberInfoAllApiRequest api
* @return {@link AjaxResult }
*/
@PostMapping("/info/all")
public AjaxResult infoAll(@Validated @RequestBody MemberInfoAllApiRequest memberInfoAllApiRequest) {
// List<GameSecretKeyCurrencyDTO> gameSecretKeys = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTOList(
// GameSecretKeyCurrencyDTO.builder()
// .systemCurrency(memberInfoAllApiRequest.getCurrencyCode()).build());
List<Key> keys = new ArrayList<>();
for (GamePlatforms platformEnum : GamePlatforms.values()) {
Platform platform = platformService.get(platformEnum.getCode());
String targetCurrency = platform.getCurrencyInfo().get(memberInfoAllApiRequest.getCurrencyCode());
if (StringUtils.isEmpty(targetCurrency)) {
continue;
}
KeyInfo keyInfo = null;
for (KeyInfo keyData : platform.getKeyInfo()) {
if (StringUtils.isNotEmpty(memberInfoAllApiRequest.getCurrencyCode())) {
if (keyData.getCurrency().equalsIgnoreCase(memberInfoAllApiRequest.getCurrencyCode())) {
keyInfo = keyData;
break;
}
}
}
if (null == keyInfo) {
continue;
}
Key key = new Key();
key.setPlatformCode(platform.getPlatformCode());
key.setCode(keyInfo.getCode());
key.setKey(keyInfo.getKey());
key.setCurrency(targetCurrency);
key.setSystemCurrency(memberInfoAllApiRequest.getCurrencyCode());
keys.add(key);
}
// 创建线程池
Map<String, BigDecimal> balanceMap = new LinkedHashMap<>();
CountDownLatch latch = new CountDownLatch(keys.size());
// 使用List存储Future对象用于获取异步执行的结果
List<Future<MemberInfoAllResponse>> futures = new ArrayList<>();
// 提交异步任务到线程池
for (Key gameSecretKey : keys) {
futures.add(threadPoolTaskExecutor.submit(() -> {
try {
IGamesService iGamesService = gamesService.get(gameSecretKey.getPlatformCode() + Constants.SERVICE);
// 获取用户信息
Member member = memberService.selectMemberByAccount(memberInfoAllApiRequest.getAccount(), memberInfoAllApiRequest.getCurrencyCode(), gameSecretKey.getPlatformCode());
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
.accounts(member.getGameAccount())
.agentId(gameSecretKey.getCode())
.currency(gameSecretKey.getCurrency())
.systemCurrency(gameSecretKey.getSystemCurrency())
.agentKey(gameSecretKey.getKey())
.build();
//查询余额
MemberInfoResponseDTO memberInfo = iGamesService.getMemberInfo(gamesBaseRequestDTO);
return MemberInfoAllResponse.builder()
.account(member.getGameAccount())
.balance(memberInfo.getBalance())
.status(memberInfo.getStatus())
.platformCode(gameSecretKey.getPlatformCode())
.build();
} finally {
latch.countDown(); // 任务完成后减少计数
}
}));
}
// 等待所有线程执行完毕
try {
latch.await();
// 获取每个Future的结果
for (Future<MemberInfoAllResponse> future : futures) {
// 汇总结果
MemberInfoAllResponse memberInfoAllResponse = future.get();
balanceMap.put(memberInfoAllResponse.getPlatformCode(), memberInfoAllResponse.getBalance());
}
} catch (Exception e) {
log.error("获取会员信息失败", e);
throw new BaseException("获取会员信息失败");
}
return AjaxResult.success(balanceMap);
}
@Data
class Key {
private String platformCode;
private String code;
private String currency;
private String key;
private String systemCurrency;
}
}

View File

@ -1,53 +0,0 @@
package com.ff.api.controller;
import com.ff.annotation.CheckHeader;
import com.ff.api.response.TenantInfoResponse;
import com.ff.base.core.controller.BaseController;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.enums.QuotaType;
import com.ff.base.utils.bean.BeanUtils;
import com.ff.common.domain.TenantGameQuota;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.common.service.ITenantGameQuotaService;
import com.ff.config.KeyConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* api
*
* @author shi
* @date 2025/02/10
*/
@RestController
@CheckHeader
@RequestMapping("/api/tenant")
@Slf4j
public class ApiTenantController extends BaseController {
@Resource
private ITenantGameQuotaService tenantGameQuotaService;
@Resource
private KeyConfig keyConfig;
/**
*
*
* @return {@link AjaxResult }
*/
@PostMapping("/info")
public AjaxResult info() {
TenantSecretKey tenantSecretKey = keyConfig.get();
TenantGameQuota tenantGameQuota = tenantGameQuotaService.selectTenantGameQuotaByTenantKey(tenantSecretKey.getTenantKey(), QuotaType.BALANCE.getCode());
TenantInfoResponse tenantInfoResponse= new TenantInfoResponse();
BeanUtils.copyProperties(tenantGameQuota,tenantInfoResponse);
return AjaxResult.success(tenantInfoResponse);
}
}

View File

@ -1,44 +0,0 @@
package com.ff.api.request;
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 java.io.Serializable;
/**
*
*
* @author shi
* @date 2025/02/13
*/
@Data
public class GameCancelFreeSpinRequest implements Serializable {
private static final long serialVersionUID = 1871368632132480179L;
/**
*
*/
@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

@ -1,89 +0,0 @@
package com.ff.api.request;
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;
import java.math.BigDecimal;
import java.util.List;
/**
*
*
* @author shi
* @date 2025/02/12
*/
@Data
public class GameCreateFreeSpinRequest implements Serializable {
private final static long serialVersionUID = -8079805496329012394L;
/**
* (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;
/**
* , 40
*/
@NotBlank(message = "referenceId不能为空")
@Length(min = 1, max = 40, message = "referenceId长度不能超过40")
private String referenceId;
/**
*
*
*
*/
@NotNull(message = "freeSpinValidity不能为空")
@Min(value = 1, message = "freeSpinValidity最小值为1")
private Long freeSpinValidity;
/**
*
*/
@NotNull(message = "numberOfRounds不能为空")
private Integer numberOfRounds;
/**
* 使 ID,
* 200
*/
@NotNull(message = "gameIds不能为空")
@ListSizeCheck(message = "gameIds不得超过200", maxSize = 200)
private List<Long> gameIds;
/**
* ;
* , 使
*/
private BigDecimal betValue;
/**
* 使
* , 使
*/
private Long startTime;
}

View File

@ -1,59 +0,0 @@
package com.ff.api.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Map;
/**
*
*
* @author shi
* @date 2025/02/11
*/
@Data
public class GameDemoLoginRequest implements Serializable {
private final static long serialVersionUID = 7699430372422335056L;
/**
* id
*/
@NotBlank(message = "langCode不能为空")
@Length(max = 32, message = "langCode长度不能超过32个字符")
private String langCode;
/**
* id
*/
@NotNull(message = "gameId不能为空")
private Long gameId;
/**
*
*/
private String homeUrl;
/**
* web app
*/
private String platform;
/**
* 1
*/
private Integer disableFullScreen;
/**
*
*/
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
}

View File

@ -1,46 +0,0 @@
package com.ff.api.request;
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;
import java.math.BigDecimal;
/**
*
*
* @author shi
* @date 2025/02/11
*/
@Data
public class GameExchangeBalanceAllRequest implements Serializable {
private final static long serialVersionUID = -881298930995538038L;
/**
*
*/
@NotBlank(message = "account不能为空")
private String account;
/**
* id
*/
@NotBlank(message = "orderId不能为空")
private String orderId;
/** 币种编码 */
@NotBlank(message = "currencyCode不能为空")
private String currencyCode;
}

View File

@ -1,69 +0,0 @@
package com.ff.api.request;
import com.ff.base.annotation.Excel;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
/**
*
*
* @author shi
* @date 2025/02/11
*/
@Data
public class GameExchangeBalanceRequest implements Serializable {
private final static long serialVersionUID = -881298930995538038L;
/**
*
*/
@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 = 1, message = "amount最小值为1")
@Max(value = 999999999, message = "amount最大值为999999999")
private BigDecimal amount;
/** 币种编码 */
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
/**
*
* 1: ( amount
* )
* 2:
*/
@NotNull(message = "transferType不能为空")
@Min(value = 1, message = "transferType最小值为1")
@Max(value = 2, message = "transferType最大值为2")
private Integer transferType;
}

View File

@ -1,21 +0,0 @@
package com.ff.api.request;
import lombok.Data;
import java.io.Serializable;
/**
*
*
* @author shi
* @date 2025/03/14
*/
@Data
public class GameExchangeStateRequest implements Serializable {
private final static long serialVersionUID = 5862750025968209889L;
/**
*
*/
private String orderId;
}

View File

@ -1,75 +0,0 @@
package com.ff.api.request;
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;
/**
*
*
* @author shi
* @date 2025/02/12
*/
@Data
public class GameGetBetRecordRequest implements Serializable {
private final static long serialVersionUID = -8079805496329012394L;
/**
*
*/
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
/**
*
*/
@NotBlank(message = "platformCode不能为空")
@Length(max = 64, message = "platformCode长度不能超过64个字符")
private String platformCode;
/**
*
*/
@NotNull(message = "beginTime不能为空")
private Long beginTime;
/**
*
*/
@NotNull(message = "endTime不能为空")
private Long endTime;
/**
* 1 2
*/
private Integer timeType=1;
/**
* 1
*/
@Min(value = 1, message = "pageNo最小值为1")
private Integer pageNo=1;
/**
* 2002000
*/
@Min(value = 1, message = "pageSize最小值为1")
@Max(value = 2000, message = "pageSize最大值为2000")
private Integer pageSize=200;
}

View File

@ -1,51 +0,0 @@
package com.ff.api.request;
import com.ff.validation.ListSizeCheck;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
*
*
* @author shi
* @date 2025/02/12
*/
@Data
public class GameGetDetailRequest implements Serializable {
private final static long serialVersionUID = -8079805496329012394L;
/**
*
*/
@NotBlank(message = "platformCode不能为空")
@Length(max = 64, message = "platformCode长度不能超过64个字符")
private String platformCode;
/**
*
*/
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
/**
* id
*/
@NotBlank(message = "wagersId不能为空")
private String wagersId;
/**
*
*/
@NotBlank(message = "langCode不能为空")
private String langCode;
}

View File

@ -1,72 +0,0 @@
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;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
*
*
* @author shi
* @date 2025/02/13
*/
@Data
public class GameGetFreeSpinDashflowRequest implements Serializable {
private static final long serialVersionUID = 1871368632132480179L;
/**
*
*/
@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
*/
private Long gameId;
/**
*
*/
@NotNull(message = "beginTime不能为空")
private Long beginTime;
/**
*
*/
@NotNull(message = "endTime不能为空")
private Long endTime;
/**
* 1
*/
@Min(value = 1, message = "pageNo最小值为1")
private Integer pageNo=1;
/**
* 2002000
*/
@Min(value = 1, message = "pageSize最小值为1")
@Max(value = 2000, message = "pageSize最大值为2000")
private Integer pageSize=200;
}

View File

@ -1,38 +0,0 @@
package com.ff.api.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
*
*
* @author shi
* @date 2025/02/12
*/
@Data
public class GameKickMemeberAllRequest implements Serializable {
private static final long serialVersionUID = -5550133375734112801L;
/**
*
*/
@NotBlank(message = "platformCode不能为空")
@Length(max = 64, message = "platformCode长度不能超过64个字符")
private String platformCode;
/**
* 使
*/
@NotBlank(message = "currencyCode不能为空")
@Length(max = 32, message = "currencyCode长度不能超过32个字符")
private String currencyCode;
/**
* id
*/
private Long gameId;
}

View File

@ -1,47 +0,0 @@
package com.ff.api.request;
import com.ff.validation.ListSizeCheck;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
*
*
* @author shi
* @date 2025/02/12
*/
@Data
public class GameKickMemeberRequest implements Serializable {
private final static long serialVersionUID = 7977843394391031014L;
/**
*
*/
@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,68 +0,0 @@
package com.ff.api.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Map;
/**
*
*
* @author shi
* @date 2025/02/11
*/
@Data
public class GameLoginRequest implements Serializable {
private final static long serialVersionUID = 7699430372422335056L;
/**
*
*/
@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;
/**
* id
*/
@NotBlank(message = "gameId不能为空")
private String gameId;
/**
*
*/
private String homeUrl;
/**
* web app
*/
private String platform;
/**
* 1
*/
private Integer disableFullScreen;
/**
* ae
*/
private Map<String, Map<String, Map<String, Object>>> betLimit;
}

View File

@ -1,47 +0,0 @@
package com.ff.api.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Map;
/**
*
*
* @author shi
* @date 2025/02/10
*/
@Data
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;
/**
*
*/
private Map<String, Map<String, Map<String, Object>>> betLimit;
/**
* 0 1
*/
private Integer platformType;
}

View File

@ -1,36 +0,0 @@
package com.ff.api.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
*
*
* @author shi
* @date 2025/02/10
*/
@Data
public class MemberInfoAllApiRequest implements Serializable{
private static final long serialVersionUID = 8071608271351542925L;
/**
*
*/
@NotBlank(message = "account不能为空")
@Length(max = 64, message = "account长度不能超过64个字符")
private String account;
/**
*
*/
@NotBlank(message = "currencyCode不能为空")
private String currencyCode;
}

View File

@ -1,36 +0,0 @@
package com.ff.api.request;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
*
*
* @author shi
* @date 2025/02/10
*/
@Data
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

@ -1,92 +0,0 @@
package com.ff.api.response;
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;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* ff_game_betting_details
*
* @author shi
* @date 2025-02-10
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class GameBettingDetailsResponse implements Serializable
{
private static final long serialVersionUID = -988976119749917266L;
/**
* key
*/
private String tenantKey;
/** 币种编码 */
private String currencyCode;
/** 游戏id */
private Long gameId;
/** 游戏类型 ff_game_type 字典 */
private Integer gameType;
/** 游戏平台 */
private String platformCode;
/** 游戏名称 */
private String gameName;
/** 注单状态 1: 赢 2: 输 3: 平局 */
private Integer gameStatus;
/** 注单类型 */
private Integer gameStatusType;
/** 游戏币种类型 */
private String gameCurrencyCode;
/** 系统账号 */
private String account;
/** 游戏注单唯一值 */
private String wagersId;
/** 投注时间 (Unix 时间戳) */
private Long wagersTime;
/** 投注金额 */
private BigDecimal betAmount;
/** 派彩时间 (Unix 时间戳) */
private Long payoffTime;
/** 派彩金额 */
private BigDecimal payoffAmount;
/** 对帐时间 (Unix 时间戳) */
private Long settlementTime;
/** 有效投注金额 ※注 1 */
private BigDecimal turnover;
/** 订单id */
private String orderNo;
/** 结算状态 1 未结算 2已结算 3 已撤单 */
private Integer settlementStatus;
}

View File

@ -1,28 +0,0 @@
package com.ff.api.response;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
*
*
* @author shi
* @date 2025/04/03
*/
@Data
public class GameDemoLoginResponse implements Serializable {
private final static long serialVersionUID = 7699430372422335056L;
/**
*
*/
private String url;
}

View File

@ -1,70 +0,0 @@
package com.ff.api.response;
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;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* ff_game_exchange_money
*
* @author shi
* @date 2025-02-12
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class GameExchangeBalanceResponse implements Serializable
{
private static final long serialVersionUID = 1L;
/** 租户key */
private String tenantKey;
/** 币种编码 */
private String currencyCode;
/** 第三方交易id */
private String transactionId;
/** 游戏平台 */
private String platformCode;
/** 操作金额 */
private BigDecimal balance;
/** 转账前金额(游戏币) */
private BigDecimal coinBefore;
/** 转账后金额(游戏币) */
private BigDecimal coinAfter;
/** 转账前金额(指定货币) */
private BigDecimal currencyBefore;
/** 转账后金额(指定货币) */
private BigDecimal currencyAfter;
/** 系统订单id */
private String orderId;
/** 转出类型 1游戏商转入到用户全部转出 2 用户转移到游戏商 */
private Integer exchangeType;
/** 状态0:进行中、1:成功、2:失败 */
private Integer status;
}

View File

@ -1,70 +0,0 @@
package com.ff.api.response;
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;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
/**
* ff_game_free_record
*
* @author shi
* @date 2025-02-13
*/
@Data
@AllArgsConstructor
@SuperBuilder
@NoArgsConstructor
public class GameFreeRecordResponse implements Serializable
{
private static final long serialVersionUID = -6742890807638586336L;
/** 币种编码 */
private String currencyCode;
/** 平台代码 */
private String platformCode;
/** 免费局数序号(唯一标识符) */
private String referenceId;
/** 系统用户账号 */
private String memberAccount;
/** 游戏id */
private Long gameId;
/** 免费游戏局数可使用的开始时间 */
private Long sendTime;
/** 免费局数过期时间 */
private Long expiredTime;
/** 免费局数记录更新时间 */
private Long freeUpdateTime;
/** 免费局数赠送的游戏名称 */
private String sendGame;
/** 免费局数赠送的数量 */
private Integer sendAmount;
/** 已使用的免费局数数量 */
private Integer usedAmount;
/** 未使用的免费局数数量 */
private Integer unusedAmount;
/** 免费状态 1正常 0 取消 */
private Integer freeStatus;
}

View File

@ -1,68 +0,0 @@
package com.ff.api.response;
import com.ff.game.domain.NameInfo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* ff_game_exchange_money
*
* @author shi
* @date 2025-02-12
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class GameResponse implements Serializable {
private static final long serialVersionUID = 7932597077733961820L;
/**
* id
*/
private String id;
/**
*
*/
private String gameName;
/**
*
*/
private Boolean freeSpin;
/**
*
*/
private Boolean demoStatus;
/**
*
*/
private String platformCode;
/**
*
*/
private Integer platformType;
/**
* 1:2:3:/
*/
private Integer ingress;
/**
*
*/
private List<String> currencyCode;
/**
*
*/
private List<NameInfo> nameInfo;
}

View File

@ -1,51 +0,0 @@
package com.ff.api.response;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* ff_game_exchange_money
*
* @author shi
* @date 2025-02-12
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class MemberInfoAllResponse implements Serializable
{
private static final long serialVersionUID = 1L;
/**
*
*/
private String account;
/**
*
*/
private BigDecimal balance;
/**
*
* 1: 线
* 2:
* 3:
*/
private Integer status;
/**
*
*/
private String platformCode;
}

View File

@ -1,43 +0,0 @@
package com.ff.api.response;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* ff_game_exchange_money
*
* @author shi
* @date 2025-02-12
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class MemberInfoResponse implements Serializable
{
private static final long serialVersionUID = 1L;
/**
*
*/
private BigDecimal balance;
/**
*
* 1: 线
* 2:
* 3:
*/
private Integer status;
}

View File

@ -1,30 +0,0 @@
package com.ff.api.response;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
/**
*
*
* @author shi
* @date 2025/02/14
*/
@Data
public class TenantInfoResponse implements Serializable {
/**
*
*/
private String tenantKey;
/**
*
*/
private BigDecimal balance;
}

View File

@ -1,95 +0,0 @@
package com.ff.common.controller;
import com.ff.base.config.FFConfig;
import com.ff.base.constant.CacheConstants;
import com.ff.base.constant.Constants;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.core.redis.RedisCache;
import com.ff.base.system.service.ISysConfigService;
import com.ff.base.utils.sign.Base64;
import com.ff.base.utils.uuid.IdUtils;
import com.google.code.kaptcha.Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
/**
*
*
* @author ff
*/
@RestController
public class CaptchaController
{
@Resource(name = "captchaProducer")
private Producer captchaProducer;
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache;
@Autowired
private ISysConfigService configService;
/**
*
*/
@GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException
{
AjaxResult ajax = AjaxResult.success();
boolean captchaEnabled = configService.selectCaptchaEnabled();
ajax.put("captchaEnabled", captchaEnabled);
if (!captchaEnabled)
{
return ajax;
}
// 保存验证码信息
String uuid = IdUtils.simpleUUID();
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid;
String capStr = null, code = null;
BufferedImage image = null;
// 生成验证码
String captchaType = FFConfig.getCaptchaType();
if ("math".equals(captchaType))
{
String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1);
image = captchaProducerMath.createImage(capStr);
}
else if ("char".equals(captchaType))
{
capStr = code = captchaProducer.createText();
image = captchaProducer.createImage(capStr);
}
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try
{
ImageIO.write(image, "jpg", os);
}
catch (IOException e)
{
return AjaxResult.error(e.getMessage());
}
ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray()));
return ajax;
}
}

View File

@ -1,116 +0,0 @@
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.Currency;
import com.ff.common.service.ICurrencyService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-10
*/
@RestController
@RequestMapping("/common/currency")
public class CurrencyController extends BaseController
{
@Autowired
private ICurrencyService currencyService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:currency:list')")
@GetMapping("/list")
public TableDataInfo list(Currency currency)
{
startPage();
List<Currency> list = currencyService.selectCurrencyList(currency);
return getDataTable(list);
}
/**
*
*
* @param currency
* @return {@link AjaxResult }
*/
@GetMapping("/select")
public AjaxResult select(Currency currency)
{
List<Currency> list = currencyService.selectCurrencyList(currency);
return AjaxResult.success(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:currency:export')")
@Log(title = "币种", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Currency currency)
{
List<Currency> list = currencyService.selectCurrencyList(currency);
ExcelUtil<Currency> util = new ExcelUtil<Currency>(Currency.class);
util.exportExcel(response, list, "币种数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:currency:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(currencyService.selectCurrencyById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:currency:add')")
@Log(title = "币种", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Currency currency)
{
return toAjax(currencyService.insertCurrency(currency));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:currency:edit')")
@Log(title = "币种", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Currency currency)
{
return toAjax(currencyService.updateCurrency(currency));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:currency:remove')")
@Log(title = "币种", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(currencyService.deleteCurrencyByIds(ids));
}
}

View File

@ -1,104 +0,0 @@
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.Lang;
import com.ff.common.service.ILangService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-10
*/
@RestController
@RequestMapping("/common/lang")
public class LangController extends BaseController
{
@Autowired
private ILangService langService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:lang:list')")
@GetMapping("/list")
public TableDataInfo list(Lang lang)
{
startPage();
List<Lang> list = langService.selectLangList(lang);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:lang:export')")
@Log(title = "系统语种管理 ", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Lang lang)
{
List<Lang> list = langService.selectLangList(lang);
ExcelUtil<Lang> util = new ExcelUtil<Lang>(Lang.class);
util.exportExcel(response, list, "系统语种管理 数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:lang:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(langService.selectLangById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:lang:add')")
@Log(title = "系统语种管理 ", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Lang lang)
{
return toAjax(langService.insertLang(lang));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:lang:edit')")
@Log(title = "系统语种管理 ", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Lang lang)
{
return toAjax(langService.updateLang(lang));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:lang:remove')")
@Log(title = "系统语种管理 ", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(langService.deleteLangByIds(ids));
}
}

View File

@ -1,104 +0,0 @@
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.TenantGameQuota;
import com.ff.common.service.ITenantGameQuotaService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-12
*/
@RestController
@RequestMapping("/common/quota")
public class TenantGameQuotaController extends BaseController
{
@Autowired
private ITenantGameQuotaService tenantGameQuotaService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:quota:list')")
@GetMapping("/list")
public TableDataInfo list(TenantGameQuota tenantGameQuota)
{
startPage();
List<TenantGameQuota> list = tenantGameQuotaService.selectTenantGameQuotaList(tenantGameQuota);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:quota:export')")
@Log(title = "租户游戏配额", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TenantGameQuota tenantGameQuota)
{
List<TenantGameQuota> list = tenantGameQuotaService.selectTenantGameQuotaList(tenantGameQuota);
ExcelUtil<TenantGameQuota> util = new ExcelUtil<TenantGameQuota>(TenantGameQuota.class);
util.exportExcel(response, list, "租户游戏配额数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:quota:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tenantGameQuotaService.selectTenantGameQuotaById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:quota:add')")
@Log(title = "租户游戏配额", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TenantGameQuota tenantGameQuota)
{
return toAjax(tenantGameQuotaService.insertTenantGameQuota(tenantGameQuota));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:quota:edit')")
@Log(title = "租户游戏配额", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TenantGameQuota tenantGameQuota)
{
return toAjax(tenantGameQuotaService.updateTenantGameQuota(tenantGameQuota));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:quota:remove')")
@Log(title = "租户游戏配额", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tenantGameQuotaService.deleteTenantGameQuotaByIds(ids));
}
}

View File

@ -1,104 +0,0 @@
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.TenantGameQuotaFlow;
import com.ff.common.service.ITenantGameQuotaFlowService;
import com.ff.base.utils.poi.ExcelUtil;
import com.ff.base.core.page.TableDataInfo;
/**
* Controller
*
* @author shi
* @date 2025-02-12
*/
@RestController
@RequestMapping("/common/flow")
public class TenantGameQuotaFlowController extends BaseController
{
@Autowired
private ITenantGameQuotaFlowService tenantGameQuotaFlowService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:flow:list')")
@GetMapping("/list")
public TableDataInfo list(TenantGameQuotaFlow tenantGameQuotaFlow)
{
startPage();
List<TenantGameQuotaFlow> list = tenantGameQuotaFlowService.selectTenantGameQuotaFlowList(tenantGameQuotaFlow);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:flow:export')")
@Log(title = "租户游戏额度流水", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TenantGameQuotaFlow tenantGameQuotaFlow)
{
List<TenantGameQuotaFlow> list = tenantGameQuotaFlowService.selectTenantGameQuotaFlowList(tenantGameQuotaFlow);
ExcelUtil<TenantGameQuotaFlow> util = new ExcelUtil<TenantGameQuotaFlow>(TenantGameQuotaFlow.class);
util.exportExcel(response, list, "租户游戏额度流水数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:flow:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(tenantGameQuotaFlowService.selectTenantGameQuotaFlowById(id));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:flow:add')")
@Log(title = "租户游戏额度流水", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TenantGameQuotaFlow tenantGameQuotaFlow)
{
return toAjax(tenantGameQuotaFlowService.insertTenantGameQuotaFlow(tenantGameQuotaFlow));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:flow:edit')")
@Log(title = "租户游戏额度流水", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TenantGameQuotaFlow tenantGameQuotaFlow)
{
return toAjax(tenantGameQuotaFlowService.updateTenantGameQuotaFlow(tenantGameQuotaFlow));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('common:flow:remove')")
@Log(title = "租户游戏额度流水", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tenantGameQuotaFlowService.deleteTenantGameQuotaFlowByIds(ids));
}
}

View File

@ -1,104 +0,0 @@
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

@ -1,71 +0,0 @@
package com.ff.common.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ff.base.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
import java.math.BigDecimal;
/**
*
*
* @author shi
* @date 2025/02/12
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class BalanceChangesDTO implements Serializable {
private static final long serialVersionUID = -7479292236485670076L;
/** 充值类型 false 扣除 true 充值 */
private Boolean isOut;
/**
*
*/
private String quotaType;
/** 租户key */
private String tenantKey;
/** 游戏额度 */
private BigDecimal balance;
/** 备注 */
private String remark;
/**
* id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long memberId;
/** 操作类型 OperationType枚举 */
private Integer operationType;
/**
*
*/
private BigDecimal actualBalance;
/** 平台 */
private String platformCode;
/** 币种代码 */
private String currencyCode;
/**
* ID
*/
private String sourceId;
}

View File

@ -1,53 +0,0 @@
package com.ff.common.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
import java.math.BigDecimal;
/**
*
*
* @author shi
* @date 2025/02/12
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class BalanceRealChangesDTO implements Serializable {
private static final long serialVersionUID = -4864053711644163092L;
/** 充值类型 false 扣除 true 充值 */
private Boolean isOut;
/** 租户key */
private String tenantKey;
/** 游戏额度 */
private BigDecimal balance;
/** 备注 */
private String remark;
/** 操作类型 OperationType枚举 */
private Integer operationType;
/**
*
*/
private BigDecimal actualBalance;
/** 币种代码 */
private String currencyCode;
}

View File

@ -1,68 +0,0 @@
package com.ff.common.dto;
import com.ff.game.api.request.GamesBaseRequestDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
import java.math.BigDecimal;
/**
*
*
* @author shi
* @date 2025/02/21
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class GameBalanceExchange extends GamesBaseRequestDTO implements Serializable {
private final static long serialVersionUID = 3452954102791311247L;
/**
*
*/
private String platformCode;
/**
*
*/
private String currencyCode;
/**
* TransferType
*/
private Integer transferType;
/**
*
*/
private BigDecimal amount;
/**
*
*/
private BigDecimal amountActual;
/**
*
*/
private String account;
/**
* key
*/
private String tenantKey;
/**
* ID
*/
private String sourceId;
}

View File

@ -1,61 +0,0 @@
package com.ff.common.mapper;
import java.util.List;
import com.ff.common.domain.Currency;
/**
* Mapper
*
* @author shi
* @date 2025-02-10
*/
public interface CurrencyMapper
{
/**
*
*
* @param id
* @return
*/
Currency selectCurrencyById(Long id);
/**
*
*
* @param currency
* @return
*/
List<Currency> selectCurrencyList(Currency currency);
/**
*
*
* @param currency
* @return
*/
int insertCurrency(Currency currency);
/**
*
*
* @param currency
* @return
*/
int updateCurrency(Currency currency);
/**
*
*
* @param id
* @return
*/
int deleteCurrencyById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteCurrencyByIds(Long[] ids);
}

View File

@ -1,61 +0,0 @@
package com.ff.common.mapper;
import java.util.List;
import com.ff.common.domain.Lang;
/**
* Mapper
*
* @author shi
* @date 2025-02-10
*/
public interface LangMapper
{
/**
*
*
* @param id
* @return
*/
Lang selectLangById(Long id);
/**
*
*
* @param lang
* @return
*/
List<Lang> selectLangList(Lang lang);
/**
*
*
* @param lang
* @return
*/
int insertLang(Lang lang);
/**
*
*
* @param lang
* @return
*/
int updateLang(Lang lang);
/**
*
*
* @param id
* @return
*/
int deleteLangById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteLangByIds(Long[] ids);
}

View File

@ -1,61 +0,0 @@
package com.ff.common.mapper;
import java.util.List;
import com.ff.common.domain.TenantAgentPlatform;
/**
* Mapper
*
* @author shi
* @date 2025-02-27
*/
public interface TenantAgentPlatformMapper
{
/**
*
*
* @param id
* @return
*/
TenantAgentPlatform selectTenantAgentPlatformById(Long id);
/**
*
*
* @param tenantAgentPlatform
* @return
*/
List<TenantAgentPlatform> selectTenantAgentPlatformList(TenantAgentPlatform tenantAgentPlatform);
/**
*
*
* @param tenantAgentPlatform
* @return
*/
int insertTenantAgentPlatform(TenantAgentPlatform tenantAgentPlatform);
/**
*
*
* @param tenantAgentPlatform
* @return
*/
int updateTenantAgentPlatform(TenantAgentPlatform tenantAgentPlatform);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentPlatformById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentPlatformByIds(Long[] ids);
}

View File

@ -1,83 +0,0 @@
package com.ff.common.mapper;
import java.math.BigDecimal;
import java.util.List;
import com.ff.common.domain.TenantGameQuotaFlow;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author shi
* @date 2025-02-12
*/
public interface TenantGameQuotaFlowMapper
{
/**
*
*
* @param id
* @return
*/
TenantGameQuotaFlow selectTenantGameQuotaFlowById(Long id);
/**
*
*
* @param tenantGameQuotaFlow
* @return
*/
List<TenantGameQuotaFlow> selectTenantGameQuotaFlowList(TenantGameQuotaFlow tenantGameQuotaFlow);
/**
*
*
* @param tenantGameQuotaFlow
* @return
*/
int insertTenantGameQuotaFlow(TenantGameQuotaFlow tenantGameQuotaFlow);
/**
*
*
* @param tenantGameQuotaFlow
* @return
*/
int updateTenantGameQuotaFlow(TenantGameQuotaFlow tenantGameQuotaFlow);
/**
*
*
* @param id
* @return
*/
int deleteTenantGameQuotaFlowById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantGameQuotaFlowByIds(Long[] ids);
/**
* id
*
* @param tenantGameQuotaFlow
* @return {@link BigDecimal }
*/
BigDecimal getExchangeMoneyByMemberId(TenantGameQuotaFlow tenantGameQuotaFlow);
/**
*
*
* @param tenantGameQuotaFlow
* @return {@link List }<{@link TenantGameQuotaFlow }>
*/
List<TenantGameQuotaFlow> getBalanceByTenantKey(TenantGameQuotaFlow tenantGameQuotaFlow);
}

View File

@ -1,80 +0,0 @@
package com.ff.common.mapper;
import java.util.List;
import com.ff.common.domain.TenantGameQuota;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author shi
* @date 2025-02-12
*/
public interface TenantGameQuotaMapper {
/**
*
*
* @param id
* @return
*/
TenantGameQuota selectTenantGameQuotaById(Long id);
/**
*
*
* @param tenantKey
* @return
*/
TenantGameQuota selectTenantGameQuotaByTenantKey(@Param("tenantKey") String tenantKey,@Param("quotaType") String quotaType);
/**
*
*
* @param tenantGameQuota
* @return
*/
List<TenantGameQuota> selectTenantGameQuotaList(TenantGameQuota tenantGameQuota);
/**
*
*
* @param tenantGameQuota
* @return
*/
int insertTenantGameQuota(TenantGameQuota tenantGameQuota);
/**
*
*
* @param tenantGameQuota
* @return
*/
int updateTenantGameQuota(TenantGameQuota tenantGameQuota);
/**
*
*
* @param tenantGameQuota sys
* @return {@link Boolean }
*/
Boolean changeBalance(TenantGameQuota tenantGameQuota);
/**
*
*
* @param id
* @return
*/
int deleteTenantGameQuotaById(Long id);
/**
*
*
* @param ids
* @return
*/
int deleteTenantGameQuotaByIds(Long[] ids);
}

View File

@ -1,72 +0,0 @@
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

@ -1,61 +0,0 @@
package com.ff.common.service;
import java.util.List;
import com.ff.common.domain.Currency;
/**
* Service
*
* @author shi
* @date 2025-02-10
*/
public interface ICurrencyService
{
/**
*
*
* @param id
* @return
*/
Currency selectCurrencyById(Long id);
/**
*
*
* @param currency
* @return
*/
List<Currency> selectCurrencyList(Currency currency);
/**
*
*
* @param currency
* @return
*/
int insertCurrency(Currency currency);
/**
*
*
* @param currency
* @return
*/
int updateCurrency(Currency currency);
/**
*
*
* @param ids
* @return
*/
int deleteCurrencyByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteCurrencyById(Long id);
}

View File

@ -1,61 +0,0 @@
package com.ff.common.service;
import java.util.List;
import com.ff.common.domain.Lang;
/**
* Service
*
* @author shi
* @date 2025-02-10
*/
public interface ILangService
{
/**
*
*
* @param id
* @return
*/
Lang selectLangById(Long id);
/**
*
*
* @param lang
* @return
*/
List<Lang> selectLangList(Lang lang);
/**
*
*
* @param lang
* @return
*/
int insertLang(Lang lang);
/**
*
*
* @param lang
* @return
*/
int updateLang(Lang lang);
/**
*
*
* @param ids
* @return
*/
int deleteLangByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteLangById(Long id);
}

View File

@ -1,61 +0,0 @@
package com.ff.common.service;
import java.util.List;
import com.ff.common.domain.TenantAgentPlatform;
/**
* Service
*
* @author shi
* @date 2025-02-27
*/
public interface ITenantAgentPlatformService
{
/**
*
*
* @param id
* @return
*/
TenantAgentPlatform selectTenantAgentPlatformById(Long id);
/**
*
*
* @param tenantAgentPlatform
* @return
*/
List<TenantAgentPlatform> selectTenantAgentPlatformList(TenantAgentPlatform tenantAgentPlatform);
/**
*
*
* @param tenantAgentPlatform
* @return
*/
int insertTenantAgentPlatform(TenantAgentPlatform tenantAgentPlatform);
/**
*
*
* @param tenantAgentPlatform
* @return
*/
int updateTenantAgentPlatform(TenantAgentPlatform tenantAgentPlatform);
/**
*
*
* @param ids
* @return
*/
int deleteTenantAgentPlatformByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantAgentPlatformById(Long id);
}

View File

@ -1,79 +0,0 @@
package com.ff.common.service;
import java.math.BigDecimal;
import java.util.List;
import com.ff.common.domain.TenantGameQuotaFlow;
/**
* Service
*
* @author shi
* @date 2025-02-12
*/
public interface ITenantGameQuotaFlowService
{
/**
*
*
* @param id
* @return
*/
TenantGameQuotaFlow selectTenantGameQuotaFlowById(Long id);
/**
*
*
* @param tenantGameQuotaFlow
* @return
*/
List<TenantGameQuotaFlow> selectTenantGameQuotaFlowList(TenantGameQuotaFlow tenantGameQuotaFlow);
/**
*
*
* @param tenantGameQuotaFlow
* @return
*/
int insertTenantGameQuotaFlow(TenantGameQuotaFlow tenantGameQuotaFlow);
/**
*
*
* @param tenantGameQuotaFlow
* @return
*/
int updateTenantGameQuotaFlow(TenantGameQuotaFlow tenantGameQuotaFlow);
/**
*
*
* @param ids
* @return
*/
int deleteTenantGameQuotaFlowByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantGameQuotaFlowById(Long id);
/**
* id
*
* @param tenantGameQuotaFlow
* @return {@link BigDecimal }
*/
BigDecimal getExchangeMoneyByMemberId(TenantGameQuotaFlow tenantGameQuotaFlow);
/**
*
*
* @param tenantGameQuotaFlow
* @return {@link List }<{@link TenantGameQuotaFlow }>
*/
List<TenantGameQuotaFlow> getBalanceByTenantKey(TenantGameQuotaFlow tenantGameQuotaFlow);
}

View File

@ -1,104 +0,0 @@
package com.ff.common.service;
import java.math.BigDecimal;
import java.util.List;
import com.ff.agent.dto.AgentCreateTenantDTO;
import com.ff.common.domain.TenantGameQuota;
import com.ff.common.dto.BalanceChangesDTO;
import com.ff.common.dto.BalanceRealChangesDTO;
import com.ff.common.dto.GameBalanceExchange;
import org.apache.ibatis.annotations.Param;
/**
* Service
*
* @author shi
* @date 2025-02-12
*/
public interface ITenantGameQuotaService
{
/**
*
*
* @param id
* @return
*/
TenantGameQuota selectTenantGameQuotaById(Long id);
/**
*
*
* @param tenantGameQuota
* @return
*/
List<TenantGameQuota> selectTenantGameQuotaList(TenantGameQuota tenantGameQuota);
/**
*
*
* @param tenantGameQuota
* @return
*/
int insertTenantGameQuota(TenantGameQuota tenantGameQuota);
/**
*
*
* @param tenantGameQuota
* @return
*/
int updateTenantGameQuota(TenantGameQuota tenantGameQuota);
/**
*
*
* @param ids
* @return
*/
int deleteTenantGameQuotaByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
int deleteTenantGameQuotaById(Long id);
/**
*
*
* @param balanceChangesDTO
* @return {@link Boolean }
*/
Boolean balanceChanges(BalanceChangesDTO balanceChangesDTO);
/**
*
*
* @param balanceRealChangesDTO
* @return {@link Boolean }
*/
Boolean balanceRealChanges(BalanceRealChangesDTO balanceRealChangesDTO);
/**
*
*
* @param gameBalanceExchange
* @return {@link BigDecimal }
*/
BigDecimal gameBalanceExchange(GameBalanceExchange gameBalanceExchange);
/**
*
*
* @param tenantKey
* @return
*/
TenantGameQuota selectTenantGameQuotaByTenantKey(String tenantKey, String quotaType);
}

View File

@ -1,72 +0,0 @@
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

@ -1,99 +0,0 @@
package com.ff.common.service.impl;
import java.util.List;
import cn.hutool.core.util.IdUtil;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.common.mapper.CurrencyMapper;
import com.ff.common.domain.Currency;
import com.ff.common.service.ICurrencyService;
/**
* Service
*
* @author shi
* @date 2025-02-10
*/
@Service
public class CurrencyServiceImpl implements ICurrencyService
{
@Autowired
private CurrencyMapper currencyMapper;
/**
*
*
* @param id
* @return
*/
@Override
public Currency selectCurrencyById(Long id)
{
return currencyMapper.selectCurrencyById(id);
}
/**
*
*
* @param currency
* @return
*/
@Override
public List<Currency> selectCurrencyList(Currency currency)
{
return currencyMapper.selectCurrencyList(currency);
}
/**
*
*
* @param currency
* @return
*/
@Override
public int insertCurrency(Currency currency)
{
currency.setId(IdUtil.getSnowflakeNextId());
currency.setCreateTime(DateUtils.getNowDate());
return currencyMapper.insertCurrency(currency);
}
/**
*
*
* @param currency
* @return
*/
@Override
public int updateCurrency(Currency currency)
{
currency.setUpdateTime(DateUtils.getNowDate());
return currencyMapper.updateCurrency(currency);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteCurrencyByIds(Long[] ids)
{
return currencyMapper.deleteCurrencyByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteCurrencyById(Long id)
{
return currencyMapper.deleteCurrencyById(id);
}
}

View File

@ -1,99 +0,0 @@
package com.ff.common.service.impl;
import java.util.List;
import cn.hutool.core.util.IdUtil;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.common.mapper.LangMapper;
import com.ff.common.domain.Lang;
import com.ff.common.service.ILangService;
/**
* Service
*
* @author shi
* @date 2025-02-10
*/
@Service
public class LangServiceImpl implements ILangService
{
@Autowired
private LangMapper langMapper;
/**
*
*
* @param id
* @return
*/
@Override
public Lang selectLangById(Long id)
{
return langMapper.selectLangById(id);
}
/**
*
*
* @param lang
* @return
*/
@Override
public List<Lang> selectLangList(Lang lang)
{
return langMapper.selectLangList(lang);
}
/**
*
*
* @param lang
* @return
*/
@Override
public int insertLang(Lang lang)
{
lang.setId(IdUtil.getSnowflakeNextId());
lang.setCreateTime(DateUtils.getNowDate());
return langMapper.insertLang(lang);
}
/**
*
*
* @param lang
* @return
*/
@Override
public int updateLang(Lang lang)
{
lang.setUpdateTime(DateUtils.getNowDate());
return langMapper.updateLang(lang);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteLangByIds(Long[] ids)
{
return langMapper.deleteLangByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteLangById(Long id)
{
return langMapper.deleteLangById(id);
}
}

View File

@ -1,99 +0,0 @@
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.TenantAgentPlatformMapper;
import com.ff.common.domain.TenantAgentPlatform;
import com.ff.common.service.ITenantAgentPlatformService;
import cn.hutool.core.util.IdUtil;
/**
* Service
*
* @author shi
* @date 2025-02-27
*/
@Service
public class TenantAgentPlatformServiceImpl implements ITenantAgentPlatformService
{
@Autowired
private TenantAgentPlatformMapper tenantAgentPlatformMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantAgentPlatform selectTenantAgentPlatformById(Long id)
{
return tenantAgentPlatformMapper.selectTenantAgentPlatformById(id);
}
/**
*
*
* @param tenantAgentPlatform
* @return
*/
@Override
public List<TenantAgentPlatform> selectTenantAgentPlatformList(TenantAgentPlatform tenantAgentPlatform)
{
return tenantAgentPlatformMapper.selectTenantAgentPlatformList(tenantAgentPlatform);
}
/**
*
*
* @param tenantAgentPlatform
* @return
*/
@Override
public int insertTenantAgentPlatform(TenantAgentPlatform tenantAgentPlatform)
{
tenantAgentPlatform.setId(IdUtil.getSnowflakeNextId());
tenantAgentPlatform.setCreateTime(DateUtils.getNowDate());
return tenantAgentPlatformMapper.insertTenantAgentPlatform(tenantAgentPlatform);
}
/**
*
*
* @param tenantAgentPlatform
* @return
*/
@Override
public int updateTenantAgentPlatform(TenantAgentPlatform tenantAgentPlatform)
{
tenantAgentPlatform.setUpdateTime(DateUtils.getNowDate());
return tenantAgentPlatformMapper.updateTenantAgentPlatform(tenantAgentPlatform);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantAgentPlatformByIds(Long[] ids)
{
return tenantAgentPlatformMapper.deleteTenantAgentPlatformByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantAgentPlatformById(Long id)
{
return tenantAgentPlatformMapper.deleteTenantAgentPlatformById(id);
}
}

View File

@ -1,116 +0,0 @@
package com.ff.common.service.impl;
import java.math.BigDecimal;
import java.util.List;
import cn.hutool.core.util.IdUtil;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.common.mapper.TenantGameQuotaFlowMapper;
import com.ff.common.domain.TenantGameQuotaFlow;
import com.ff.common.service.ITenantGameQuotaFlowService;
/**
* Service
*
* @author shi
* @date 2025-02-12
*/
@Service
public class TenantGameQuotaFlowServiceImpl implements ITenantGameQuotaFlowService {
@Autowired
private TenantGameQuotaFlowMapper tenantGameQuotaFlowMapper;
/**
*
*
* @param id
* @return
*/
@Override
public TenantGameQuotaFlow selectTenantGameQuotaFlowById(Long id) {
return tenantGameQuotaFlowMapper.selectTenantGameQuotaFlowById(id);
}
/**
*
*
* @param tenantGameQuotaFlow
* @return
*/
@Override
public List<TenantGameQuotaFlow> selectTenantGameQuotaFlowList(TenantGameQuotaFlow tenantGameQuotaFlow) {
return tenantGameQuotaFlowMapper.selectTenantGameQuotaFlowList(tenantGameQuotaFlow);
}
/**
*
*
* @param tenantGameQuotaFlow
* @return
*/
@Override
public int insertTenantGameQuotaFlow(TenantGameQuotaFlow tenantGameQuotaFlow) {
tenantGameQuotaFlow.setId(IdUtil.getSnowflakeNextId());
tenantGameQuotaFlow.setCreateTime(DateUtils.getNowDate());
return tenantGameQuotaFlowMapper.insertTenantGameQuotaFlow(tenantGameQuotaFlow);
}
/**
*
*
* @param tenantGameQuotaFlow
* @return
*/
@Override
public int updateTenantGameQuotaFlow(TenantGameQuotaFlow tenantGameQuotaFlow) {
tenantGameQuotaFlow.setUpdateTime(DateUtils.getNowDate());
return tenantGameQuotaFlowMapper.updateTenantGameQuotaFlow(tenantGameQuotaFlow);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantGameQuotaFlowByIds(Long[] ids) {
return tenantGameQuotaFlowMapper.deleteTenantGameQuotaFlowByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantGameQuotaFlowById(Long id) {
return tenantGameQuotaFlowMapper.deleteTenantGameQuotaFlowById(id);
}
/**
* id
*
* @param tenantGameQuotaFlow
* @return {@link BigDecimal }
*/
@Override
public BigDecimal getExchangeMoneyByMemberId(TenantGameQuotaFlow tenantGameQuotaFlow) {
return tenantGameQuotaFlowMapper.getExchangeMoneyByMemberId(tenantGameQuotaFlow);
}
/**
*
*
* @param tenantGameQuotaFlow
* @return {@link List }<{@link TenantGameQuotaFlow }>
*/
@Override
public List<TenantGameQuotaFlow> getBalanceByTenantKey(TenantGameQuotaFlow tenantGameQuotaFlow) {
return tenantGameQuotaFlowMapper.getBalanceByTenantKey(tenantGameQuotaFlow);
}
}

View File

@ -1,473 +0,0 @@
package com.ff.common.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import com.ff.base.constant.Constants;
import com.ff.base.enums.*;
import com.ff.base.exception.base.ApiException;
import com.ff.base.system.domain.TenantPlatform;
import com.ff.base.system.domain.TenantSecretKey;
import com.ff.base.system.service.ITenantPlatformService;
import com.ff.base.system.service.ITenantSecretKeyService;
import com.ff.base.utils.DateUtils;
import com.ff.base.utils.QuotaUtils;
import com.ff.common.domain.TenantGameQuota;
import com.ff.common.domain.TenantGameQuotaFlow;
import com.ff.common.domain.TenantQuotaExchange;
import com.ff.common.dto.BalanceChangesDTO;
import com.ff.common.dto.BalanceRealChangesDTO;
import com.ff.common.dto.GameBalanceExchange;
import com.ff.common.mapper.TenantGameQuotaMapper;
import com.ff.common.service.ITenantGameQuotaFlowService;
import com.ff.common.service.ITenantGameQuotaService;
import com.ff.common.service.ITenantQuotaExchangeService;
import com.ff.game.api.IGamesService;
import com.ff.game.api.request.MemberInfoRequestDTO;
import com.ff.member.domain.Member;
import com.ff.member.service.IMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
import java.util.Map;
/**
* Service
*
* @author shi
* @date 2025-02-12
*/
@Service
public class TenantGameQuotaServiceImpl implements ITenantGameQuotaService {
@Autowired
private TenantGameQuotaMapper tenantGameQuotaMapper;
@Resource
private ITenantGameQuotaFlowService tenantGameQuotaFlowService;
@Resource
private ITenantSecretKeyService tenantSecretKeyService;
@Resource
private IMemberService memberService;
@Autowired
private Map<String, IGamesService> gamesService;
@Resource
private ITenantQuotaExchangeService tenantQuotaExchangeService;
@Resource
private ITenantPlatformService tenantPlatformService;
/**
*
*
* @param id
* @return
*/
@Override
public TenantGameQuota selectTenantGameQuotaById(Long id) {
return tenantGameQuotaMapper.selectTenantGameQuotaById(id);
}
/**
*
*
* @param tenantGameQuota
* @return
*/
@Override
public List<TenantGameQuota> selectTenantGameQuotaList(TenantGameQuota tenantGameQuota) {
return tenantGameQuotaMapper.selectTenantGameQuotaList(tenantGameQuota);
}
/**
*
*
* @param tenantGameQuota
* @return
*/
@Override
public int insertTenantGameQuota(TenantGameQuota tenantGameQuota) {
tenantGameQuota.setId(IdUtil.getSnowflakeNextId());
tenantGameQuota.setCreateTime(DateUtils.getNowDate());
return tenantGameQuotaMapper.insertTenantGameQuota(tenantGameQuota);
}
/**
*
*
* @param tenantGameQuota
* @return
*/
@Override
public int updateTenantGameQuota(TenantGameQuota tenantGameQuota) {
tenantGameQuota.setUpdateTime(DateUtils.getNowDate());
return tenantGameQuotaMapper.updateTenantGameQuota(tenantGameQuota);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteTenantGameQuotaByIds(Long[] ids) {
return tenantGameQuotaMapper.deleteTenantGameQuotaByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteTenantGameQuotaById(Long id) {
return tenantGameQuotaMapper.deleteTenantGameQuotaById(id);
}
/**
*
*
* @param balanceChangesDTO
* @return {@link Boolean }
*/
@Override
public Boolean balanceChanges(BalanceChangesDTO balanceChangesDTO) {
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;
//判断是充值还是扣除
if (balanceChangesDTO.getIsOut()) {
balanceAfter = NumberUtil.add(balanceBefore, balance);
} else {
balanceAfter = NumberUtil.sub(balanceBefore, balance);
}
//判断剩余额度是否大于0
TenantSecretKey tenantSecretKey = tenantSecretKeyService.selectTenantSecretKeyByTenantKey(balanceChangesDTO.getTenantKey());
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 {
//判断剩余额度是否大于0
Assert.isTrue(balanceAfter.compareTo(BigDecimal.ZERO) >= 0, "余额额度不足");
}
//修改余额
Boolean changedBalanceResult = tenantGameQuotaMapper.changeBalance(TenantGameQuota.builder()
.tenantKey(balanceChangesDTO.getTenantKey())
.balance(balanceAfter)
.quotaType(balanceChangesDTO.getQuotaType())
.version(tenantGameQuota.getVersion())
.build());
Assert.isTrue(changedBalanceResult, "租户游戏额度操作失败");
//插入流水
TenantGameQuotaFlow tenantGameQuotaFlow = TenantGameQuotaFlow.builder()
.quotaType(balanceChangesDTO.getQuotaType())
.tenantKey(balanceChangesDTO.getTenantKey())
.sourceId(balanceChangesDTO.getSourceId())
.isOut(balanceChangesDTO.getIsOut())
.platformCode(balanceChangesDTO.getPlatformCode())
.currencyCode(balanceChangesDTO.getCurrencyCode())
.balanceAfter(balanceAfter)
.exchangeRatio(balanceChangesDTO.getActualBalance())
.exchangeMoney(balanceChangesDTO.getBalance())
.memberId(balanceChangesDTO.getMemberId())
.balance(balance)
.balanceBefore(balanceBefore)
.operationType(balanceChangesDTO.getOperationType())
.build();
tenantGameQuotaFlow.setRemark(balanceChangesDTO.getRemark());
tenantGameQuotaFlow.setCreateTime(DateUtils.getNowDate());
tenantGameQuotaFlow.setCreateBy(Constants.SYSTEM);
tenantGameQuotaFlowService.insertTenantGameQuotaFlow(tenantGameQuotaFlow);
return changedBalanceResult;
}
/**
*
*
* @param balanceRealChangesDTO
* @return {@link Boolean }
*/
@Override
public Boolean balanceRealChanges(BalanceRealChangesDTO balanceRealChangesDTO) {
TenantGameQuota tenantGameQuota = this.selectTenantGameQuotaByTenantKey(balanceRealChangesDTO.getTenantKey(), QuotaType.REAL_BALANCE.getCode());
BigDecimal balanceBefore = tenantGameQuota.getBalance();
BigDecimal balance = balanceRealChangesDTO.getBalance();
//如果有汇率 则需要计算真实扣除额度
if (!ObjectUtils.isEmpty(balanceRealChangesDTO.getActualBalance())) {
balance = NumberUtil.div(balance, balanceRealChangesDTO.getActualBalance(), 2, RoundingMode.FLOOR);
}
if (BigDecimal.ZERO.compareTo(balance) >= 0) {
return Boolean.TRUE;
}
BigDecimal balanceAfter;
//判断是充值还是扣除
if (balanceRealChangesDTO.getIsOut()) {
balanceAfter = NumberUtil.add(balanceBefore, balance);
} else {
balanceAfter = NumberUtil.sub(balanceBefore, balance);
}
//修改余额
Boolean changedBalanceResult = tenantGameQuotaMapper.changeBalance(TenantGameQuota.builder()
.tenantKey(balanceRealChangesDTO.getTenantKey())
.balance(balanceAfter)
.quotaType(QuotaType.REAL_BALANCE.getCode())
.version(tenantGameQuota.getVersion())
.build());
//插入流水
TenantGameQuotaFlow tenantGameQuotaFlow = TenantGameQuotaFlow.builder()
.quotaType(QuotaType.REAL_BALANCE.getCode())
.tenantKey(balanceRealChangesDTO.getTenantKey())
.isOut(balanceRealChangesDTO.getIsOut())
.currencyCode(balanceRealChangesDTO.getCurrencyCode())
.balanceAfter(balanceAfter)
.exchangeRatio(balanceRealChangesDTO.getActualBalance())
.exchangeMoney(balanceRealChangesDTO.getBalance())
.balance(balance)
.balanceBefore(balanceBefore)
.operationType(balanceRealChangesDTO.getOperationType())
.build();
tenantGameQuotaFlow.setRemark(balanceRealChangesDTO.getRemark());
tenantGameQuotaFlow.setCreateTime(DateUtils.getNowDate());
tenantGameQuotaFlow.setCreateBy(Constants.SYSTEM);
tenantGameQuotaFlowService.insertTenantGameQuotaFlow(tenantGameQuotaFlow);
return changedBalanceResult;
}
/**
*
*
* @param gameBalanceExchange
* @return {@link BigDecimal }
*/
@Override
public BigDecimal gameBalanceExchange(GameBalanceExchange gameBalanceExchange) {
TenantQuotaExchange tenantQuotaExchange = tenantQuotaExchangeService.getTenantQuotaExchange(Constants.USDT, gameBalanceExchange.getCurrencyCode());
ApiException.notNull(tenantQuotaExchange, ErrorCode.CURRENCY_EXCHANGE.getCode());
// 获取租户信息
TenantSecretKey tenantSecretKey = tenantSecretKeyService.selectTenantSecretKeyByTenantKey(gameBalanceExchange.getTenantKey());
// 获取平台币种格外成本
TenantPlatform tenantPlatform = tenantPlatformService.findTenantPlatform(TenantPlatform.builder()
.tenantId(tenantSecretKey.getId())
.currencyCode(gameBalanceExchange.getCurrencyCode())
.platformCode(gameBalanceExchange.getPlatformCode())
.build());
// 检查获取平台币种格外成本是否存在,否则抛出异常
ApiException.notNull(tenantPlatform, ErrorCode.PLATFORM_NOT_EXIST.getCode());
// 获取用户信息
Member member = memberService.selectMemberByAccount(gameBalanceExchange.getAccount(), gameBalanceExchange.getCurrencyCode(), gameBalanceExchange.getPlatformCode());
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
// 检查用户是否存在,否则抛出异常
ApiException.notNull(member, ErrorCode.ACCOUNT_NOT_EXIST.getCode());
// 根据平台代码获取平台接口
IGamesService iGamesService = gamesService.get(gameBalanceExchange.getPlatformCode() + Constants.SERVICE);
// 初始化额度类型为余额
String quotaType = QuotaType.BALANCE.getCode();
// 根据租户额度类型调整额度类型
if (TenantQuotaType.SINGLE.getCode().equals(tenantSecretKey.getQuotaType())) {
quotaType = QuotaUtils.getPlatformQuota(gameBalanceExchange.getPlatformCode(), gameBalanceExchange.getCurrencyCode());
}
// 判断操作类型(出账/入账)
boolean isOut = gameBalanceExchange.getTransferType().equals(TransferType.ALL.getCode());
// 初始化操作金额
BigDecimal balanceRequestAmount = gameBalanceExchange.getAmount();
// 如果是出账操作
if (isOut) {
// 获取第三方钱包余额
MemberInfoRequestDTO gamesBaseRequestDTO = MemberInfoRequestDTO.builder()
.accounts(member.getGameAccount())
.agentId(gameBalanceExchange.getAgentId())
.currency(gameBalanceExchange.getCurrency())
.agentKey(gameBalanceExchange.getAgentKey())
.build();
balanceRequestAmount = iGamesService.getMemberInfo(gamesBaseRequestDTO).getBalance();
if (balanceRequestAmount.compareTo(BigDecimal.ZERO) <= 0) {
throw new ApiException(ErrorCode.INSUFFICIENT_PLAYER_BALANCE.getCode());
}
balanceRequestAmount = NumberUtil.add(balanceRequestAmount, NumberUtil.mul(balanceRequestAmount, NumberUtil.div(tenantPlatform.getUseCost(), Constants.HUNDRED)));
// 计算累计转入和转出金额
BigDecimal balanceInto = tenantGameQuotaFlowService.getExchangeMoneyByMemberId(TenantGameQuotaFlow.builder()
.isOut(Boolean.TRUE)
.quotaType(quotaType)
.tenantKey(gameBalanceExchange.getTenantKey())
.memberId(member.getId())
.build());
BigDecimal balanceOut = NumberUtil.add(tenantGameQuotaFlowService.getExchangeMoneyByMemberId(TenantGameQuotaFlow.builder()
.isOut(Boolean.FALSE)
.quotaType(quotaType)
.tenantKey(gameBalanceExchange.getTenantKey())
.memberId(member.getId())
.build()), BigDecimal.ZERO);
// 初始化平台额度
BigDecimal platformBalance = BigDecimal.ZERO;
// 确保转入金额不超过转出额度
if (NumberUtil.add(balanceInto, balanceRequestAmount).compareTo(balanceOut) > 0) {
BigDecimal difference = NumberUtil.sub(balanceOut, balanceInto);
platformBalance = NumberUtil.sub(balanceRequestAmount, difference);
balanceRequestAmount = difference;
}
// 如果有平台额度变化,进行余额调整
if (platformBalance.compareTo(BigDecimal.ZERO) > 0) {
this.balanceChanges(BalanceChangesDTO.builder()
.isOut(Boolean.TRUE)
.platformCode(gameBalanceExchange.getPlatformCode())
.currencyCode(gameBalanceExchange.getCurrencyCode())
.tenantKey(gameBalanceExchange.getTenantKey())
.balance(platformBalance)
.sourceId(gameBalanceExchange.getSourceId())
.memberId(member.getId())
.operationType(OperationType.API_BALANCE.getCode())
.remark(OperationType.API_BALANCE.getDescription())
.quotaType(QuotaUtils.getFalseTenantQuota(gameBalanceExchange.getPlatformCode(), gameBalanceExchange.getCurrencyCode()))
.build());
}
// 进行租户余额调整
this.balanceChanges(BalanceChangesDTO.builder()
.isOut(Boolean.TRUE)
.sourceId(gameBalanceExchange.getSourceId())
.platformCode(gameBalanceExchange.getPlatformCode())
.currencyCode(gameBalanceExchange.getCurrencyCode())
.actualBalance(tenantQuotaExchange.getActualBalance())
.tenantKey(gameBalanceExchange.getTenantKey())
.balance(balanceRequestAmount)
.memberId(member.getId())
.operationType(OperationType.API_BALANCE.getCode())
.quotaType(quotaType)
.remark(OperationType.API_BALANCE.getDescription())
.build());
} else {
// 如果是扣账操作,首先处理假额度
String falseTenantQuotaType = QuotaUtils.getFalseTenantQuota(gameBalanceExchange.getPlatformCode(), gameBalanceExchange.getCurrencyCode());
TenantGameQuota falseTenantQuota = selectTenantGameQuotaByTenantKey(tenantSecretKey.getTenantKey(), falseTenantQuotaType);
balanceRequestAmount = NumberUtil.add(gameBalanceExchange.getAmount(), NumberUtil.mul(gameBalanceExchange.getAmount(), NumberUtil.div(tenantPlatform.getUseCost(), Constants.HUNDRED)));
if (falseTenantQuota.getBalance().compareTo(BigDecimal.ZERO) > 0) {
BigDecimal falseQuotaBalance = falseTenantQuota.getBalance();
if (falseQuotaBalance.compareTo(balanceRequestAmount) >= 0) {
// 假额度足够扣除本次所需金额
this.balanceChanges(BalanceChangesDTO.builder()
.isOut(Boolean.FALSE)
.sourceId(gameBalanceExchange.getSourceId())
.platformCode(gameBalanceExchange.getPlatformCode())
.currencyCode(gameBalanceExchange.getCurrencyCode())
.tenantKey(tenantSecretKey.getTenantKey())
.balance(balanceRequestAmount)
.memberId(member.getId())
.operationType(OperationType.API_BALANCE.getCode())
.quotaType(falseTenantQuotaType)
.remark(OperationType.API_BALANCE.getDescription())
.build());
balanceRequestAmount = BigDecimal.ZERO;
} else {
// 假额度不足以扣除本次所需金额,扣除全部假额度
balanceRequestAmount = balanceRequestAmount.subtract(falseQuotaBalance);
this.balanceChanges(BalanceChangesDTO.builder()
.isOut(Boolean.FALSE)
.sourceId(gameBalanceExchange.getSourceId())
.platformCode(gameBalanceExchange.getPlatformCode())
.currencyCode(gameBalanceExchange.getCurrencyCode())
.tenantKey(tenantSecretKey.getTenantKey())
.balance(falseQuotaBalance)
.memberId(member.getId())
.operationType(OperationType.API_BALANCE.getCode())
.quotaType(falseTenantQuotaType)
.remark(OperationType.API_BALANCE.getDescription())
.build());
}
}
// 处理剩余的入账金额
if (balanceRequestAmount.compareTo(BigDecimal.ZERO) > 0) {
this.balanceChanges(BalanceChangesDTO.builder()
.isOut(Boolean.FALSE)
.sourceId(gameBalanceExchange.getSourceId())
.platformCode(gameBalanceExchange.getPlatformCode())
.currencyCode(gameBalanceExchange.getCurrencyCode())
.actualBalance(tenantQuotaExchange.getActualBalance())
.tenantKey(tenantSecretKey.getTenantKey())
.balance(balanceRequestAmount)
.memberId(member.getId())
.operationType(OperationType.API_BALANCE.getCode())
.quotaType(quotaType)
.remark(OperationType.API_BALANCE.getDescription())
.build());
}
}
TenantGameQuota tenantGameQuota = this.selectTenantGameQuotaByTenantKey(gameBalanceExchange.getTenantKey(), QuotaType.BALANCE.getCode());
return tenantGameQuota.getBalance();
}
/**
*
*
* @param tenantKey
* @param quotaType
* @return {@link TenantGameQuota }
*/
@Override
public TenantGameQuota selectTenantGameQuotaByTenantKey(String tenantKey, String quotaType) {
TenantGameQuota tenantGameQuota = tenantGameQuotaMapper.selectTenantGameQuotaByTenantKey(tenantKey, quotaType);
//如果当前钱包不存在
if (ObjectUtils.isEmpty(tenantGameQuota)) {
tenantGameQuota = TenantGameQuota.builder()
.tenantKey(tenantKey)
.id(IdUtil.getSnowflakeNextId())
.balance(BigDecimal.ZERO)
.quotaType(quotaType)
.version(0)
.build();
tenantGameQuotaMapper.insertTenantGameQuota(tenantGameQuota);
}
return tenantGameQuota;
}
}

View File

@ -1,111 +0,0 @@
package com.ff.common.service.impl;
import java.util.List;
import cn.hutool.core.util.IdUtil;
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.setId(IdUtil.getSnowflakeNextId());
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

@ -1,60 +0,0 @@
package com.ff.config;
import com.ff.base.datasource.DynamicDataSource;
import com.ff.base.system.domain.SysDatasource;
import com.ff.base.system.mapper.SysDatasourceMapper;
import com.ff.base.system.service.ISysConfigService;
import com.ff.base.system.service.ISysDictTypeService;
import com.ff.game.service.IPlatformService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
/**
*
*
* @author liukang
*/
@Slf4j
@Component
public class ContentRefreshedEventListener implements ApplicationListener<ContextRefreshedEvent> {
@Resource
private DynamicDataSource dynamicDataSource;
@Resource
private SysDatasourceMapper dataSourceMapper;
@Resource
private ISysConfigService sysConfigService;
@Resource
private ISysDictTypeService sysDictTypeService;
@Resource
private IPlatformService platformService;
/**
*
*
* @param event
*/
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
// 创建所有数据源
SysDatasource sysDatasource = new SysDatasource();
sysDatasource.setStatus("1");
List<SysDatasource> dataourceList = dataSourceMapper.selectSysDatasourceList(sysDatasource);
if (!CollectionUtils.isEmpty(dataourceList)) {
dynamicDataSource.createDataSource(dataourceList);
}
sysConfigService.loadingConfigCache();
sysDictTypeService.loadingDictCache();
platformService.loadToCache();
}
}

View File

@ -1,44 +0,0 @@
package com.ff.config;
import com.ff.base.system.domain.TenantSecretKey;
import org.springframework.stereotype.Component;
/**
*
*
* @author shi
* @date 2025/02/11
*/
@Component
public class KeyConfig {
// 定义一个 ThreadLocal 变量,持有当前线程的全局变量
private ThreadLocal<TenantSecretKey> threadLocalVariable = new ThreadLocal<>();
/**
*
*
* @param value
*/
public void set(TenantSecretKey value) {
threadLocalVariable.set(value);
}
/**
*
*
* @return {@link String }
*/
public TenantSecretKey get() {
return threadLocalVariable.get();
}
/**
*
*/
public void clear() {
threadLocalVariable.remove();
}
}

View File

@ -1,65 +0,0 @@
package com.ff.delay;
import com.ff.base.manager.AsyncManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* @author cengy
*/
@Service
@Slf4j
public class DelayService {
private DelayQueue<DelayTask> delayQueue = new DelayQueue<>();
private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
public void addTask(DelayTask delayTask) {
delayQueue.put(delayTask);
}
// 启动延迟队列任务处理
@PostConstruct
public void startProcessing() {
// 每 1 秒钟执行一次任务检查
scheduler.scheduleAtFixedRate(this::processTasks, 10, 1, TimeUnit.SECONDS);
}
// 处理过期任务
private void processTasks() {
DelayTask task = null; // 阻塞,直到队列中有任务到期
try {
task = delayQueue.take();
} catch (InterruptedException e) {
log.error("获取过期任务失败", e);
}
if (null == task) {
return;
}
AsyncManager.me().execute(new DelayRunnable(task));
}
public static class DelayRunnable implements Runnable {
DelayTask delayTask;
public DelayRunnable(DelayTask delayTask) {
this.delayTask = delayTask;
}
@Override
public void run() {
try {
delayTask.execute();
} catch (Exception e) {
log.error("处理过期任务出错", e);
}
}
}
}

View File

@ -1,44 +0,0 @@
package com.ff.delay;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;
/**
* @author cengy
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public abstract class DelayTask implements Delayed {
private long delayTime;
private long expireTime;
public DelayTask(long delayTime) {
this.delayTime = delayTime;
this.expireTime = System.currentTimeMillis() + delayTime; // 设置过期时间
}
@Override
public long getDelay(TimeUnit unit) {
long diff = expireTime - System.currentTimeMillis();
return unit.convert(diff, TimeUnit.MILLISECONDS);
}
@Override
public int compareTo(Delayed o) {
if (this.expireTime < ((DelayTask) o).expireTime) {
return -1;
}
if (this.expireTime > ((DelayTask) o).expireTime) {
return 1;
}
return 0;
}
abstract public void execute();
}

View File

@ -1,45 +0,0 @@
package com.ff.file.controller;
import com.ff.base.annotation.Anonymous;
import com.ff.base.constant.Constants;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.exception.base.BaseException;
import com.ff.base.utils.MessageUtils;
import com.ff.file.service.ISysFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.Map;
/**
*
*
* @author ff
*/
@RestController
@RequestMapping("/file")
public class FileController {
@Autowired
private Map<String, ISysFileService> fileServiceMap;
/**
*
*/
@PostMapping("/upload/{service}")
@Anonymous
public AjaxResult uploadFile(MultipartFile file, @PathVariable String service) {
ISysFileService sysFileService = fileServiceMap.get(service + Constants.SERVICE);
if (sysFileService == null) {
throw new BaseException(MessageUtils.message("upload.file.server.not.exist"));
}
return sysFileService.uploadFile(file);
}
}

View File

@ -1,21 +0,0 @@
package com.ff.file.service;
import com.ff.base.core.domain.AjaxResult;
import org.springframework.web.multipart.MultipartFile;
/**
*
*
* @author ruoyi
*/
public interface ISysFileService
{
/**
*
*
* @param file
* @return 访
* @throws Exception
*/
public AjaxResult uploadFile(MultipartFile file) ;
}

View File

@ -1,48 +0,0 @@
package com.ff.file.service.impl;
import com.ff.base.config.FFConfig;
import com.ff.base.core.domain.AjaxResult;
import com.ff.base.exception.base.BaseException;
import com.ff.base.utils.MessageUtils;
import com.ff.base.utils.file.FileUploadUtils;
import com.ff.base.utils.file.FileUtils;
import com.ff.file.service.ISysFileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
/**
*
*
* @author ruoyi
*/
@Service("localSysFileService")
@Slf4j
public class LocalSysFileServiceImpl implements ISysFileService {
/**
*
*
* @param file
* @return 访
* @throws Exception
*/
@Override
public AjaxResult uploadFile(MultipartFile file) {
try {
// 上传文件路径
String filePath = FFConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
AjaxResult ajax = AjaxResult.success();
ajax.put("url", fileName);
ajax.put("fileName", FileUtils.getName(fileName));
ajax.put("originalFilename", file.getOriginalFilename());
return ajax;
} catch (IOException e) {
log.error("本地文件上传异常,{}", e);
throw new BaseException(MessageUtils.message("upload.file.exception"), e.getMessage());
}
}
}

View File

@ -1,158 +0,0 @@
package com.ff.game.api;
import com.ff.game.api.request.*;
import com.ff.game.domain.GameBettingDetails;
import com.ff.game.domain.GameFreeRecord;
import java.util.List;
/**
*
*
* @author shi
* @date 2024/10/21
*/
public interface IGamesService {
/**
*
*
* @param createMemberRequestDTO dto
* @return {@link Boolean }
*/
Boolean createMember(CreateMemberRequestDTO createMemberRequestDTO);
/**
*
*
* @param memberInfoRequestDTO dto
* @return {@link MemberInfoResponseDTO }
*/
MemberInfoResponseDTO getMemberInfo(MemberInfoRequestDTO memberInfoRequestDTO);
/**
*
*
* @param gamesLogin
* @return {@link String }
*/
String loginWithoutRedirect(GamesLogin gamesLogin);
/**
*
*
* @param gamesBaseRequestDTO dto
* @return {@link String }
*/
String getGameList(GamesBaseRequestDTO gamesBaseRequestDTO);
/**
* id
*
* @param exchangeTransferMoneyRequestDTO moeny dto
* @return {@link Long }
*/
Long exchangeTransferByAgentId(ExchangeTransferMoneyRequestDTO exchangeTransferMoneyRequestDTO);
/**
*
*
* @param exchangeTransferMoneyRequestDTO dto
* @return {@link ExchangeTransferStatusResponseDTO }
*/
ExchangeTransferStatusResponseDTO exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO);
/**
*
*
* @param betRecordByTimeDTO dto
* @return {@link Boolean }
*/
Boolean getBetRecordByTime(BetRecordByTimeDTO betRecordByTimeDTO);
/**
*
*
* @param betRecordByTimeDTO dto
* @return {@link Boolean }
*/
Boolean getBetRecordByHistoryTime(BetRecordByTimeDTO betRecordByTimeDTO);
/**
*
*
* @param createFreeSpinRequest
* @return {@link Boolean }
*/
Boolean createFreeSpin(CreateFreeSpinRequestDTO createFreeSpinRequest);
/**
*
*
* @param getGameDetailRequestDTO dto
* @return {@link GetGameDetailResponseDTO }
*/
GetGameDetailResponseDTO getGameDetail(GetGameDetailRequestDTO getGameDetailRequestDTO);
/**
*
*
* @param kickMemberRequestDTO dto
* @return {@link Boolean }
*/
Boolean kickMember(KickMemberRequestDTO kickMemberRequestDTO);
/**
*
*
* @param kickMemberAllDTO dto
* @return {@link Boolean }
*/
Boolean kickMemberAll(KickMemberAllDTO kickMemberAllDTO);
/**
* 使
*
* @param getFreeSpinDashflowRequestDTO dashflowdto
* @return {@link List }<{@link GameFreeRecord }>
*/
List<GameFreeRecord> getFreeSpinDashflow(GetFreeSpinDashflowRequestDTO getFreeSpinDashflowRequestDTO);
/**
*
*
* @param cancelFreeSpinRequestDTO
* @return {@link Boolean }
*/
Boolean cancelFreeSpin(CancelFreeSpinRequestDTO cancelFreeSpinRequestDTO);
/**
*
*
* @param gameDemoLoginRequestDTO dto
* @return {@link GameDemoLoginResponseDTO }
*/
GameDemoLoginResponseDTO gameDemoLogin(GameDemoLoginRequestDTO gameDemoLoginRequestDTO);
/**
*
*
* @param gamesDataBuildDTO
* @return {@link GameBettingDetails }
*/
GameBettingDetails dataBuild(GamesDataBuildDTO gamesDataBuildDTO);
}

View File

@ -1,31 +0,0 @@
package com.ff.game.api.ae.address;
import com.dtflys.forest.callback.AddressSource;
import com.dtflys.forest.http.ForestAddress;
import com.dtflys.forest.http.ForestRequest;
import com.ff.base.enums.GamePlatforms;
import com.ff.game.service.IPlatformService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* jili address
*
* @author shi
* @date 2025/02/10
*/
@Component
public class MyAEAddressSource implements AddressSource {
@Resource
private IPlatformService platformService;
@Override
public ForestAddress getAddress(ForestRequest request) {
String apiBaseUrl = platformService.get(GamePlatforms.AE.getCode())
.getUrlInfo().getUrl();
return new ForestAddress("https", apiBaseUrl, 443, "");
}
}

View File

@ -1,132 +0,0 @@
package com.ff.game.api.ae.client;
import com.dtflys.forest.annotation.*;
import com.ff.game.api.ae.address.MyAEAddressSource;
import com.ff.game.api.ae.dto.*;
import com.ff.game.api.jili.dto.*;
import com.ff.game.api.xk.dto.XKKickMemberAllDTO;
import com.ff.game.api.xk.dto.XKKickMemberDTO;
import java.util.Map;
/**
* xk
*
* @author shi
* @date 2025/02/10
*/
@Address(source = MyAEAddressSource.class)
public interface AEClient {
/**
*
*
* @param params
* @return {@link String }
*/
@Post(url ="/wallet/createMember",
headers = {
"Content-type: application/x-www-form-urlencoded"
})
AEResponse createMember(@Body Map<String, Object> params);
/**
*
*
* @param params
* @return {@link AEMemberInfo }
*/
@Post(url ="/wallet/getBalance",
headers = {
"Content-type: application/x-www-form-urlencoded"
})
AEMemberInfo getMemberInfo(@Body Map<String, Object> params);
/**
*
*
* @param params
* @return {@link AELoginResponse }
*/
@Post("/wallet/login")
AELoginResponse loginWithoutRedirect(@Body Map<String, Object> params);
/**
* id
*
* @param params
* @return {@link JILIExchangeMoneyResponseDTO }
*/
@Post(url ="/wallet/deposit",
headers = {
"Content-type: application/x-www-form-urlencoded"
})
AETransactionResponse deposit(@Body Map<String, Object> params);
@Post(url ="/wallet/withdraw",
headers = {
"Content-type: application/x-www-form-urlencoded"
})
AETransactionResponse withdraw(@Body Map<String, Object> params);
/**
*
*
* @param params
* @return {@link AEExchangeTransferStatusResponse }
*/
@Post(url ="/wallet/checkTransferOperation",
headers = {
"Content-type: application/x-www-form-urlencoded"
})
AEExchangeTransferStatusResponse exchangeTransferStatus(@Body Map<String, Object> params);
/**
*
*
* @param params
* @return {@link AEBetRecordResponse }
*/
@Post(url ="https://tttfetch.apihub55.com/fetch/gzip/getTransactionByUpdateDate",
headers = {
"Content-type: application/x-www-form-urlencoded"
})
AEBetRecordResponse getBetRecordByTime(@Body Map<String, Object> params);
/**
*
*
* @param params
* @return {@link AEBetRecordResponse }
*/
@Post(url ="https://tttfetch.apihub55.com/fetch/gzip/getTransactionByTxTime",
headers = {
"Content-type: application/x-www-form-urlencoded"
})
AEBetRecordResponse getBetHistoryRecordByTime(@Body Map<String, Object> params);
/**
*
*
* @param params
* @return {@link JILIKickMemberDTO }
*/
@Post(url ="/wallet/logout",
headers = {
"Content-type: application/x-www-form-urlencoded"
})
XKKickMemberDTO kickMember(@Body Map<String, Object> params);
/**
*
*
* @param params
* @return {@link JILIKickMemberAllDTO }
*/
@Get("/kickMemberAll")
XKKickMemberAllDTO kickMemberAll(@JSONBody Map<String, Object> params);
}

View File

@ -1,186 +0,0 @@
package com.ff.game.api.ae.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* aebet
*
* @author shi
* @date 2025/04/01
*/
@Data
public class AEBetRecordResponse {
/**
*
*/
@JsonProperty("status")
private Integer status;
/**
* (String)
* "Success" -
* -
*/
private String desc;
/**
*
*/
@JsonProperty("transactions")
private List<Transaction> transactions;
@Data
public static class Transaction {
/**
*
*/
@JsonProperty("gameType")
private String gameType;
/**
*
*/
@JsonProperty("winAmount")
private BigDecimal winAmount;
/**
*
*/
@JsonProperty("txTime")
private Date txTime;
/**
*
*/
@JsonProperty("settleStatus")
private Integer settleStatus;
/**
*
*/
@JsonProperty("gameInfo")
private String gameInfo;
/**
*
*/
@JsonProperty("realWinAmount")
private BigDecimal realWinAmount;
/**
*
*/
@JsonProperty("updateTime")
private String updateTime;
/**
*
*/
@JsonProperty("realBetAmount")
private BigDecimal realBetAmount;
/**
* ID
*/
@JsonProperty("userId")
private String userId;
/**
*
*/
@JsonProperty("betType")
private String betType;
/**
*
*/
@JsonProperty("platform")
private String platform;
/**
*
*/
@JsonProperty("txStatus")
private Integer txStatus;
/**
*
*/
@JsonProperty("betAmount")
private BigDecimal betAmount;
/**
*
*/
@JsonProperty("gameName")
private String gameName;
/**
*
*/
@JsonProperty("platformTxId")
private String platformTxId;
/**
*
*/
@JsonProperty("betTime")
private Date betTime;
/**
*
*/
@JsonProperty("gameCode")
private String gameCode;
/**
*
*/
@JsonProperty("currency")
private String currency;
/**
*
*/
@JsonProperty("jackpotWinAmount")
private BigDecimal jackpotWinAmount;
/**
*
*/
@JsonProperty("jackpotBetAmount")
private BigDecimal jackpotBetAmount;
/**
*
*/
@JsonProperty("turnover")
private BigDecimal turnover;
/**
*
*/
@JsonProperty("roundId")
private String roundId;
/**
*
*/
@JsonProperty("refPlatformTxId")
private String refPlatformTxId;
/**
*
*/
@JsonProperty("isPremium")
private Boolean isPremium;
}
}

View File

@ -1,56 +0,0 @@
package com.ff.game.api.ae.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* aeexchange
*
* @author shi
* @date 2025/04/01
*/
@Data
public class AEExchangeTransferStatusResponse {
/**
*
*/
@JsonProperty("status")
private String status;
/**
* 1 status = 0000 & txStatus = 1 /
* 2 status = 0000 & txStatus = 0 /
* 3 status = 0000 & txStatus = 2 / 3 checkTransferOperation API txStatus = 0 1
* 4 status = 1017
*/
@JsonProperty("txStatus")
private String txStatus;
/**
*
*/
@JsonProperty("balance")
private BigDecimal balance;
/**
*
*/
@JsonProperty("transferAmount")
private BigDecimal transferAmount;
/**
* DEPOSIT WITHDRAW
*/
@JsonProperty("transferType")
private String transferType;
/**
*
*/
@JsonProperty("txCode")
private String txCode;
}

View File

@ -1,41 +0,0 @@
package com.ff.game.api.ae.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
/**
* aelogin
*
* @author shi
* @date 2025/04/01
*/
@Data
public class AELoginResponse {
/**
*
*/
@JsonProperty("status")
private Integer status;
/**
* (String)
* "Success" -
* -
*/
private String desc;
/**
* URL
*/
@JsonProperty("url")
private String url;
/**
*
*/
@JsonProperty("extension")
private List<String> extension;
}

View File

@ -1,33 +0,0 @@
package com.ff.game.api.ae.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
/**
*
*
* @author shi
* @date 2025/04/01
*/
@Data
public class AELogoutUserResponse {
/**
*
*/
@JsonProperty("status")
private String status;
/**
*
*/
@JsonProperty("logoutUsers")
private List<String> logoutUsers;
/**
*
*/
@JsonProperty("count")
private Integer count;
}

View File

@ -1,65 +0,0 @@
package com.ff.game.api.ae.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.ZonedDateTime;
import java.util.Date;
import java.util.List;
/**
* AEMEMBER
*
* @author shi
* @date 2025/03/31
*/
@Data
public class AEMemberInfo {
/**
*
*/
@JsonProperty("results")
private List<UserInfo> result;
/**
*
*/
@JsonProperty("count")
private int count;
/**
*
*/
@JsonProperty("querytime")
private Date queryTime;
/**
*
*/
@JsonProperty("status")
private Integer status;
@Data
public static class UserInfo {
/**
* ID
*/
@JsonProperty("userId")
private String userId;
/**
*
*/
@JsonProperty("balance")
private BigDecimal balance;
/**
*
*/
@JsonProperty("lastModified")
private Date lastModified;
}
}

View File

@ -1,26 +0,0 @@
package com.ff.game.api.ae.dto;
import lombok.Data;
/**
*
*
* @author shi
* @date 2025/03/28
*/
@Data
public class AEResponse {
/**
* (String)
* 0000 -
* -
*/
private String status;
/**
* (String)
* "Success" -
* -
*/
private String desc;
}

Some files were not shown because too many files have changed in this diff Show More