修复问题

main-sa
998998 2025-03-24 17:52:01 +08:00
parent b043fa6c2d
commit ded6eead74
2 changed files with 13 additions and 6 deletions

View File

@ -65,6 +65,8 @@ public class TenantSecretKeyServiceImpl implements ITenantSecretKeyService {
@Resource @Resource
private ITenantPlatformService tenantPlatformService; private ITenantPlatformService tenantPlatformService;
/** /**
* *
* *
@ -220,11 +222,7 @@ public class TenantSecretKeyServiceImpl implements ITenantSecretKeyService {
if (insertedTenantSecretKey > 0) { if (insertedTenantSecretKey > 0) {
for (TenantPlatform tenantPlatform : createTenantDTO.getTenantPlatforms()) { 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.setTenantId(tenantSecretKey.getId());
tenantPlatform.setCreateBy(createTenantDTO.getAccount()); tenantPlatform.setCreateBy(createTenantDTO.getAccount());

View File

@ -10,6 +10,7 @@ import com.ff.base.core.domain.AjaxResult;
import com.ff.base.core.page.TableDataInfo; import com.ff.base.core.page.TableDataInfo;
import com.ff.base.enums.OperationType; import com.ff.base.enums.OperationType;
import com.ff.base.enums.QuotaType; 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.TenantPlatform;
import com.ff.base.system.dto.CreateTenantDTO; import com.ff.base.system.dto.CreateTenantDTO;
import com.ff.base.system.dto.TenantSecretKeyDTO; 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.base.system.domain.TenantSecretKey;
import com.ff.common.domain.TenantAgentPlatform; import com.ff.common.domain.TenantAgentPlatform;
import com.ff.common.dto.BalanceChangesDTO; import com.ff.common.dto.BalanceChangesDTO;
import com.ff.common.service.ITenantAgentPlatformService;
import com.ff.common.service.ITenantGameQuotaService; import com.ff.common.service.ITenantGameQuotaService;
import com.ff.base.system.service.ITenantSecretKeyService; import com.ff.base.system.service.ITenantSecretKeyService;
import com.ff.base.system.service.ITenantPlatformService; import com.ff.base.system.service.ITenantPlatformService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
@ -56,7 +59,8 @@ public class AgentController extends BaseController {
@Resource @Resource
private ITenantPlatformService tenantPlatformService; private ITenantPlatformService tenantPlatformService;
@Resource
private ITenantAgentPlatformService tenantAgentPlatformService;
/** /**
* *
* *
@ -99,6 +103,11 @@ public class AgentController extends BaseController {
//构造租户的充值信息 //构造租户的充值信息
List<TenantPlatform> tenantPlatforms = new ArrayList<>(); List<TenantPlatform> tenantPlatforms = new ArrayList<>();
for (TenantAgentPlatform tenantAgentPlatform : agentCreateTenantDTO.getTenantAgentPlatforms()) { 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(); TenantPlatform tenantPlatform = new TenantPlatform();
BeanUtils.copyProperties(tenantAgentPlatform, tenantPlatform); BeanUtils.copyProperties(tenantAgentPlatform, tenantPlatform);
tenantPlatforms.add(tenantPlatform); tenantPlatforms.add(tenantPlatform);