对公修改

This commit is contained in:
wkc
2026-04-15 18:23:58 +08:00
parent 4b1593d249
commit c37456983f
33 changed files with 598 additions and 165 deletions

View File

@@ -19,12 +19,18 @@ public class CorporateLoanPricingCreateDTO implements Serializable {
@NotBlank(message = "客户内码不能为空")
private String custIsn;
private String custType;
private String custName;
private String idType;
private String idNum;
@NotBlank(message = "还款方式不能为空")
@Pattern(regexp = "^(分期|不分期)$", message = "还款方式必须是:分期、不分期之一")
private String repayMethod;
@NotBlank(message = "担保方式不能为空")
@Pattern(regexp = "^(信用|保证|抵押|质押)$", message = "担保方式必须是:信用、保证、抵押、质押之一")
private String guarType;
@@ -32,16 +38,16 @@ public class CorporateLoanPricingCreateDTO implements Serializable {
@NotBlank(message = "申请金额不能为空")
private String applyAmt;
@NotBlank(message = "借款期限不能为空")
@Pattern(regexp = "^[1-6]$", message = "借款期限必须是 1 到 6 年")
private String loanTerm;
private String isAgriGuar;
private String isGreenLoan;
private String isTechEnt;
private String isTradeConstruction;
private String isTradeBuildEnt;
@NotBlank(message = "抵质押类型不能为空")
@Pattern(regexp = "^(一类|二类|三类|四类)$", message = "抵质押类型必须是:一类、二类、三类、四类之一")
private String collType;
private String collThirdParty;

View File

@@ -43,6 +43,12 @@ public class ModelInvokeDTO {
*/
private String guarType;
/**
* 还款方式(必填)
* 可选值:分期/不分期
*/
private String repayMethod;
/**
* 中间业务_个人_快捷支付非必填
* 可选值true/false
@@ -103,6 +109,18 @@ public class ModelInvokeDTO {
*/
private String isAgriGuar;
/**
* 绿色贷款(非必填)
* 可选值0/1
*/
private String isGreenLoan;
/**
* 贸易和建筑业企业(非必填)
* 可选值0/1
*/
private String isTradeBuildEnt;
/**
* 是否纳税信用等级A级非必填
* 可选值true/false
@@ -137,7 +155,7 @@ public class ModelInvokeDTO {
/**
* 抵质押类型(非必填)
* 可选值:一类/二类/三类
* 可选值:一类/二类/三类/四类
*/
private String collType;

View File

@@ -1,6 +1,7 @@
package com.ruoyi.loanpricing.domain.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@@ -48,6 +49,9 @@ public class LoanPricingWorkflow implements Serializable
@NotBlank(message = "担保方式不能为空")
private String guarType;
/** 还款方式: 分期/不分期 */
private String repayMethod;
/** 中间业务_个人_快捷支付: true/false */
private String midPerQuickPay;
@@ -65,7 +69,7 @@ public class LoanPricingWorkflow implements Serializable
private String applyAmt;
/**
* 款期限
* 款期限(年)
*/
private String loanTerm;
@@ -79,13 +83,21 @@ public class LoanPricingWorkflow implements Serializable
private String isManufacturing;
/** 省农担担保贷款: true/false */
@JsonIgnore
private String isAgriGuar;
/**
* 贸易和建筑业企业标识: true/false
*/
@JsonIgnore
private String isTradeConstruction;
/**
* 贸易和建筑业企业标识: 0/1
*/
@TableField(exist = false)
private String isTradeBuildEnt;
/**
* 绿色贷款: true/false
*/
@@ -94,6 +106,7 @@ public class LoanPricingWorkflow implements Serializable
/**
* 科技型企业: true/false
*/
@JsonIgnore
private String isTechEnt;
/** 是否纳税信用等级A级: true/false */
@@ -111,7 +124,7 @@ public class LoanPricingWorkflow implements Serializable
/** 循环功能: true/false */
private String loanLoop;
/** 抵质押类型: 一线/一类/类 */
/** 抵质押类型: 一类/二类/三类/类 */
private String collType;
/** 抵质押物是否三方所有: true/false */

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.util.Date;
@@ -31,6 +32,9 @@ public class ModelCorpOutputFields {
private String idType;
// 证件号码
private String idNum;
// 还款方式
@TableField(exist = false)
private String repayMethod;
// 基准利率
private String baseLoanRate;
// 我行首贷客户
@@ -79,12 +83,14 @@ public class ModelCorpOutputFields {
private String isCleanEnt;
// 开立基本结算账户
private String hasSettleAcct;
// 贸易和建筑业企业
@TableField(exist = false)
private String isTradeBuildEnt;
// 省农担担保贷款
@JsonIgnore
private String isAgriGuar;
// 绿色贷款
private String isGreenLoan;
// 科技型企业
private String isTechEnt;
// BP_企业客户类别
private String bpEntType;
// TOTAL_BP_关联度
@@ -119,6 +125,16 @@ public class ModelCorpOutputFields {
private String totalBp;
// 测算利率
private String calculateRate;
// 历史利率
private String loanRateHistory;
// 产品最低利率下限
private String minRateProduct;
// 平滑幅度
private String smoothRange;
// 最终测算利率
private String finalCalculateRate;
// 参考利率
private String referenceRate;
@TableField(fill = FieldFill.INSERT)
private Date createTime;

View File

@@ -59,10 +59,15 @@ public class LoanPricingModelService {
}
ModelInvokeDTO modelInvokeDTO = new ModelInvokeDTO();
BeanUtils.copyProperties(loanPricingWorkflow, modelInvokeDTO);
modelInvokeDTO.setIsTradeBuildEnt(toZeroOne(loanPricingWorkflow.getIsTradeConstruction()));
if ("个人".equals(loanPricingWorkflow.getCustType()))
{
normalizePersonalModelInvokeDTO(modelInvokeDTO);
}
if ("企业".equals(loanPricingWorkflow.getCustType()))
{
normalizeCorporateModelInvokeDTO(modelInvokeDTO);
}
JSONObject response = modelService.invokeModel(modelInvokeDTO);
if (loanPricingWorkflow.getCustType().equals("个人")){
// 个人模型
@@ -94,6 +99,13 @@ public class LoanPricingModelService {
modelInvokeDTO.setCollThirdParty(toZeroOne(modelInvokeDTO.getCollThirdParty()));
}
private void normalizeCorporateModelInvokeDTO(ModelInvokeDTO modelInvokeDTO)
{
modelInvokeDTO.setIsGreenLoan(toZeroOne(modelInvokeDTO.getIsGreenLoan()));
modelInvokeDTO.setIsTradeBuildEnt(toZeroOne(modelInvokeDTO.getIsTradeBuildEnt()));
modelInvokeDTO.setCollThirdParty(toZeroOne(modelInvokeDTO.getCollThirdParty()));
}
private String toZeroOne(String value)
{
if ("true".equals(value) || "1".equals(value))

View File

@@ -78,6 +78,8 @@ public class LoanPricingWorkflowServiceImpl implements ILoanPricingWorkflowServi
{
loanPricingWorkflow.setRunType("1");
}
loanPricingWorkflow.setCustType("企业".equals(loanPricingWorkflow.getCustType()) ? "企业" : loanPricingWorkflow.getCustType());
loanPricingWorkflow.setIsTradeBuildEnt(loanPricingWorkflow.getIsTradeConstruction());
loanPricingWorkflow.setCustName(sensitiveFieldCryptoService.encrypt(loanPricingWorkflow.getCustName()));
loanPricingWorkflow.setIdNum(sensitiveFieldCryptoService.encrypt(loanPricingWorkflow.getIdNum()));
@@ -163,6 +165,7 @@ public class LoanPricingWorkflowServiceImpl implements ILoanPricingWorkflowServi
String plainIdNum = sensitiveFieldCryptoService.decrypt(loanPricingWorkflow.getIdNum());
loanPricingWorkflow.setCustName(loanPricingSensitiveDisplayService.maskCustName(plainCustName));
loanPricingWorkflow.setIdNum(loanPricingSensitiveDisplayService.maskIdNum(plainIdNum));
loanPricingWorkflow.setIsTradeBuildEnt(loanPricingWorkflow.getIsTradeConstruction());
loanPricingWorkflowVO.setLoanPricingWorkflow(loanPricingWorkflow);
if (Objects.nonNull(loanPricingWorkflow.getModelOutputId())){
@@ -180,6 +183,8 @@ public class LoanPricingWorkflowServiceImpl implements ILoanPricingWorkflowServi
if (Objects.nonNull(modelCorpOutputFields))
{
maskModelCorpOutputBasicInfo(modelCorpOutputFields);
modelCorpOutputFields.setRepayMethod(loanPricingWorkflow.getRepayMethod());
modelCorpOutputFields.setIsTradeBuildEnt(loanPricingWorkflow.getIsTradeBuildEnt());
loanPricingWorkflow.setLoanRate(modelCorpOutputFields.getCalculateRate());
}
loanPricingWorkflowVO.setModelCorpOutputFields(modelCorpOutputFields);

View File

@@ -52,15 +52,15 @@ public class LoanPricingConverter {
entity.setCustName(dto.getCustName());
entity.setIdType(dto.getIdType());
entity.setIdNum(dto.getIdNum());
entity.setRepayMethod(dto.getRepayMethod());
entity.setGuarType(dto.getGuarType());
entity.setApplyAmt(dto.getApplyAmt());
entity.setCollType(dto.getCollType());
entity.setCollThirdParty(dto.getCollThirdParty());
// 映射企业特有字段
entity.setIsAgriGuar(dto.getIsAgriGuar());
entity.setIsGreenLoan(dto.getIsGreenLoan());
entity.setIsTechEnt(dto.getIsTechEnt());
entity.setIsTradeConstruction(dto.getIsTradeConstruction());
entity.setIsTradeConstruction(dto.getIsTradeBuildEnt());
entity.setIsTradeBuildEnt(dto.getIsTradeBuildEnt());
entity.setLoanTerm(dto.getLoanTerm());
return entity;
}

View File

@@ -4,11 +4,12 @@
"tokenId": "17364055486305E7F4722M8IPFWNL8TOBEB",
"mappingOutputFields": {
"custIsn": "CUST20260121001",
"custType": "企业客户",
"guarType": "抵押担保",
"custType": "企业",
"guarType": "抵押",
"custName": "北京智联科技有限公司",
"idType": "营业执照",
"idNum": "91110108MA00XXXXXX",
"repayMethod": "分期",
"baseLoanRate": "3.45",
"isFirstLoan": "N",
"faithDay": "730",
@@ -33,17 +34,16 @@
"bpPayroll": "4.1",
"isCleanEnt": "Y",
"hasSettleAcct": "Y",
"isAgriGuar": "N",
"isGreenLoan": "Y",
"isTechEnt": "Y",
"isGreenLoan": "1",
"isTradeBuildEnt": "0",
"bpEntType": "7.5",
"totoalBpRelevance": "9.2",
"loanTerm": "36",
"loanTerm": "6",
"bpLoanTerm": "3.3",
"applyAmt": "5000000.00",
"applyAmt": "1000000.00",
"bpLoanAmount": "5.8",
"collType": "房产抵押",
"collThirdParty": "N",
"collType": "四类",
"collThirdParty": "1",
"bpCollateral": "4.5",
"greyCust": "N",
"prinOverdue": "N",
@@ -65,4 +65,4 @@
"workflowVersion": 14,
"callTime": 1736405548630,
"status": 1
}
}

View File

@@ -87,4 +87,30 @@ class LoanPricingModelServiceTest
!Objects.equals("张三", entity.getCustName())
&& !Objects.equals("110101199001011234", entity.getIdNum())));
}
@Test
void shouldSendCorporateRepayMethodAndTradeBuildFlagToModel()
{
LoanPricingWorkflow workflow = new LoanPricingWorkflow();
workflow.setId(3L);
workflow.setCustType("企业");
workflow.setCustName("cipher-name");
workflow.setIdNum("cipher-id");
workflow.setRepayMethod("分期");
workflow.setIsTradeConstruction("1");
JSONObject response = new JSONObject();
response.put("calculateRate", "4.10");
when(loanPricingWorkflowMapper.selectById(3L)).thenReturn(workflow);
when(sensitiveFieldCryptoService.decrypt("cipher-name")).thenReturn("上虞测试企业");
when(sensitiveFieldCryptoService.decrypt("cipher-id")).thenReturn("91330000123456789X");
when(modelService.invokeModel(any())).thenReturn(response);
loanPricingModelService.invokeModelAsync(3L);
verify(modelService).invokeModel(argThat((ModelInvokeDTO dto) ->
Objects.equals("分期", dto.getRepayMethod())
&& Objects.equals("1", dto.getIsTradeBuildEnt())));
}
}

View File

@@ -253,4 +253,33 @@ class LoanPricingWorkflowServiceImplTest
assertEquals("测试****公司", result.getModelCorpOutputFields().getCustName());
assertEquals("91*************00X", result.getModelCorpOutputFields().getIdNum());
}
@Test
void shouldReturnCorporateDisplaySheetFieldsInWorkflowDetail()
{
LoanPricingWorkflow workflow = new LoanPricingWorkflow();
workflow.setSerialNum("C20260415001");
workflow.setCustType("企业");
workflow.setCustName("cipher-name");
workflow.setIdNum("cipher-id");
workflow.setRepayMethod("分期");
workflow.setIsTradeConstruction("1");
workflow.setModelOutputId(23L);
ModelCorpOutputFields corpOutputFields = new ModelCorpOutputFields();
corpOutputFields.setCalculateRate("4.95");
when(loanPricingWorkflowMapper.selectOne(any())).thenReturn(workflow);
when(modelCorpOutputFieldsMapper.selectById(23L)).thenReturn(corpOutputFields);
when(sensitiveFieldCryptoService.decrypt("cipher-name")).thenReturn("上虞测试企业");
when(sensitiveFieldCryptoService.decrypt("cipher-id")).thenReturn("91330000123456789X");
when(loanPricingSensitiveDisplayService.maskCustName("上虞测试企业")).thenReturn("上虞***企业");
when(loanPricingSensitiveDisplayService.maskIdNum("91330000123456789X")).thenReturn("91*************89X");
LoanPricingWorkflowVO result = loanPricingWorkflowService.selectLoanPricingBySerialNum("C20260415001");
assertEquals("分期", result.getModelCorpOutputFields().getRepayMethod());
assertEquals("1", result.getModelCorpOutputFields().getIsTradeBuildEnt());
assertEquals("4.95", result.getLoanPricingWorkflow().getLoanRate());
}
}