From ded6eead749869f35c309a2fc1ae8473a2b3a9de Mon Sep 17 00:00:00 2001 From: 998998 <998998@qq.com> Date: Mon, 24 Mar 2025 17:52:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TenantSecretKeyServiceImpl.java | 8 +++----- .../java/com/ff/agent/controller/AgentController.java | 11 ++++++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ff-base/src/main/java/com/ff/base/system/service/impl/TenantSecretKeyServiceImpl.java b/ff-base/src/main/java/com/ff/base/system/service/impl/TenantSecretKeyServiceImpl.java index 0d6d20c..9105c0f 100644 --- a/ff-base/src/main/java/com/ff/base/system/service/impl/TenantSecretKeyServiceImpl.java +++ b/ff-base/src/main/java/com/ff/base/system/service/impl/TenantSecretKeyServiceImpl.java @@ -65,6 +65,8 @@ public class TenantSecretKeyServiceImpl implements ITenantSecretKeyService { @Resource private ITenantPlatformService tenantPlatformService; + + /** * 登录 * @@ -220,11 +222,7 @@ public class TenantSecretKeyServiceImpl implements ITenantSecretKeyService { if (insertedTenantSecretKey > 0) { for (TenantPlatform tenantPlatform : createTenantDTO.getTenantPlatforms()) { - TenantPlatform platformById = tenantPlatformService.selectTenantPlatformById(tenantPlatform.getId()); - // 成本比平台成本大 - if (platformById.getCost().compareTo(tenantPlatform.getCost())>0){ - throw new BaseException("成本比例不允许比最低比例小"); - } + tenantPlatform.setTenantId(tenantSecretKey.getId()); tenantPlatform.setCreateBy(createTenantDTO.getAccount()); diff --git a/ff-game/src/main/java/com/ff/agent/controller/AgentController.java b/ff-game/src/main/java/com/ff/agent/controller/AgentController.java index 42697ba..b6bfbc6 100644 --- a/ff-game/src/main/java/com/ff/agent/controller/AgentController.java +++ b/ff-game/src/main/java/com/ff/agent/controller/AgentController.java @@ -10,6 +10,7 @@ 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.dto.CreateTenantDTO; import com.ff.base.system.dto.TenantSecretKeyDTO; @@ -22,10 +23,12 @@ import com.ff.base.utils.ip.IpUtils; import com.ff.base.system.domain.TenantSecretKey; 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 com.ff.base.system.service.ITenantSecretKeyService; import com.ff.base.system.service.ITenantPlatformService; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ObjectUtils; @@ -56,7 +59,8 @@ public class AgentController extends BaseController { @Resource private ITenantPlatformService tenantPlatformService; - + @Resource + private ITenantAgentPlatformService tenantAgentPlatformService; /** * 列表 * @@ -99,6 +103,11 @@ public class AgentController extends BaseController { //构造租户的充值信息 List 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);