Files
loan-pricing/ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/util/LoanPricingConverter.java
2026-08-24 12:31:08 +08:00

76 lines
2.8 KiB
Java

package com.ruoyi.loanpricing.util;
import com.ruoyi.loanpricing.domain.dto.CorporateLoanPricingCreateDTO;
import com.ruoyi.loanpricing.domain.dto.PersonalLoanPricingCreateDTO;
import com.ruoyi.loanpricing.domain.entity.LoanPricingWorkflow;
/**
* 利率定价转换器
*
* @author ruoyi
* @date 2025-01-19
*/
public class LoanPricingConverter {
/**
* 个人客户DTO转Entity
*
* @param dto 个人客户发起DTO
* @return 利率定价流程实体
*/
public static LoanPricingWorkflow toEntity(PersonalLoanPricingCreateDTO dto) {
LoanPricingWorkflow entity = new LoanPricingWorkflow();
// 映射共同字段
entity.setCustIsn(dto.getCustIsn());
entity.setCustType("个人");
entity.setCustName(dto.getCustName());
entity.setIdType(dto.getIdType());
entity.setIdNum(dto.getIdNum());
entity.setGuarType(dto.getGuarType());
entity.setApplyAmt(dto.getApplyAmt());
entity.setBusinessType(dto.getBusinessType());
entity.setLoanRateHistory(dto.getLoanRateHistory());
entity.setCouponRate(dto.getCouponRate());
entity.setLoanTerm(dto.getLoanTerm());
entity.setCollateralNature(dto.getCollateralNature());
entity.setIsNineArea(dto.getIsNineArea());
entity.setCollType(dto.getCollType());
entity.setCollThirdParty(dto.getCollThirdParty());
// 映射个人特有字段
entity.setBizProof(dto.getBizProof());
entity.setLoanLoop(dto.getLoanLoop());
return entity;
}
/**
* 企业客户DTO转Entity
*
* @param dto 企业客户发起DTO
* @return 利率定价流程实体
*/
public static LoanPricingWorkflow toEntity(CorporateLoanPricingCreateDTO dto) {
LoanPricingWorkflow entity = new LoanPricingWorkflow();
// 映射共同字段
entity.setCustIsn(dto.getCustIsn());
entity.setCustType("企业");
entity.setCustName(dto.getCustName());
entity.setIdType(dto.getIdType());
entity.setIdNum(dto.getIdNum());
entity.setGuarType(dto.getGuarType());
entity.setApplyAmt(dto.getApplyAmt());
entity.setBusinessType(dto.getBusinessType());
entity.setLoanRateHistory(dto.getLoanRateHistory());
entity.setCouponRate(dto.getCouponRate());
entity.setResCover(dto.getResCover());
entity.setRepayMethod(dto.getRepayMethod());
entity.setCollateralNature(dto.getCollateralNature());
entity.setIsNineArea(dto.getIsNineArea());
entity.setCollType(dto.getCollType());
entity.setCollThirdParty(dto.getCollThirdParty());
entity.setIsGreenLoan(dto.getIsGreenLoan());
entity.setIsTradeBuildEnt(dto.getIsTradeBuildEnt());
entity.setLoanTerm(dto.getLoanTerm());
return entity;
}
}