校验并映射业务种类历史利率

This commit is contained in:
wkc
2026-04-30 09:10:27 +08:00
parent 6a91cd7ea6
commit b8b8d21b09
2 changed files with 22 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package com.ruoyi.loanpricing.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.loanpricing.domain.dto.CorporateLoanPricingCreateDTO;
import com.ruoyi.loanpricing.domain.dto.PersonalLoanPricingCreateDTO;
import com.ruoyi.loanpricing.domain.entity.LoanPricingWorkflow;
@@ -65,6 +66,8 @@ public class LoanPricingWorkflowServiceImpl implements ILoanPricingWorkflowServi
@Transactional(rollbackFor = Exception.class)
public LoanPricingWorkflow createLoanPricing(LoanPricingWorkflow loanPricingWorkflow)
{
validateBusinessTypeAndHistoryRate(loanPricingWorkflow);
// 自动生成业务方流水号(时间戳)
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String serialNum = sdf.format(new Date());
@@ -88,6 +91,21 @@ public class LoanPricingWorkflowServiceImpl implements ILoanPricingWorkflowServi
return loanPricingWorkflow;
}
private void validateBusinessTypeAndHistoryRate(LoanPricingWorkflow workflow) {
if (!StringUtils.hasText(workflow.getBusinessType())) {
throw new ServiceException("业务种类不能为空");
}
if (!"新客".equals(workflow.getBusinessType())
&& !"存量新增".equals(workflow.getBusinessType())
&& !"存量转贷".equals(workflow.getBusinessType())) {
throw new ServiceException("业务种类必须是:新客、存量新增、存量转贷之一");
}
if ("存量转贷".equals(workflow.getBusinessType())
&& !StringUtils.hasText(workflow.getLoanRateHistory())) {
throw new ServiceException("请选择历史贷款合同");
}
}
/**
* 发起个人客户利率定价流程
*

View File

@@ -29,6 +29,8 @@ public class LoanPricingConverter {
entity.setGuarType(dto.getGuarType());
entity.setApplyAmt(dto.getApplyAmt());
entity.setLoanPurpose(dto.getLoanPurpose());
entity.setBusinessType(dto.getBusinessType());
entity.setLoanRateHistory(dto.getLoanRateHistory());
entity.setLoanTerm(dto.getLoanTerm());
entity.setCollType(dto.getCollType());
entity.setCollThirdParty(dto.getCollThirdParty());
@@ -54,6 +56,8 @@ public class LoanPricingConverter {
entity.setIdNum(dto.getIdNum());
entity.setGuarType(dto.getGuarType());
entity.setApplyAmt(dto.getApplyAmt());
entity.setBusinessType(dto.getBusinessType());
entity.setLoanRateHistory(dto.getLoanRateHistory());
entity.setRepayMethod(dto.getRepayMethod());
entity.setCollType(dto.getCollType());
entity.setCollThirdParty(dto.getCollThirdParty());