新增历史贷款合同查询接口

This commit is contained in:
wkc
2026-04-30 09:12:59 +08:00
parent b8b8d21b09
commit 33365a0d74
6 changed files with 148 additions and 0 deletions

View File

@@ -86,6 +86,9 @@ customer-map:
personal-url: http://localhost:63310/rate/pricing/mock/customer-map/personal
corporate-url: http://localhost:63310/rate/pricing/mock/customer-map/corporate
loan-rate-history:
url: http://localhost:63310/rate/pricing/mock/history-contract
security:
password-transfer:
key: "1234567890abcdef"

View File

@@ -86,6 +86,9 @@ customer-map:
personal-url: http://552f7aff0acd4c09ac3b83dbfee57fa0.apigateway.res.dc-pdt-zj96596.com/shangyu_lilvcesuan_ind_idmapno?appCode=1a89fa84abda480ba93ed73fd01ffd07&cust_id=
corporate-url: http://552f7aff0acd4c09ac3b83dbfee57fa0.apigateway.res.dc-pdt-zj96596.com/shangyu_lilvcesuan_ent_idmapno?appCode=1a89fa84abda480ba93ed73fd01ffd07&cust_id=
loan-rate-history:
url: http://552f7aff0acd4c09ac3b83dbfee57fa0.apigateway.res.dc-pdt-zj96596.com/shangyu_loan_rate_history?appCode=1a89fa84abda480ba93ed73fd01ffd07
security:
password-transfer:
key: "1234567890abcdef"

View File

@@ -86,6 +86,9 @@ customer-map:
personal-url: http://localhost:63310/rate/pricing/mock/customer-map/personal
corporate-url: http://localhost:63310/rate/pricing/mock/customer-map/corporate
loan-rate-history:
url: http://localhost:63310/rate/pricing/mock/history-contract
security:
password-transfer:
key: "1234567890abcdef"

View File

@@ -16,6 +16,7 @@ import com.ruoyi.loanpricing.domain.vo.LoanPricingWorkflowListVO;
import com.ruoyi.loanpricing.domain.vo.LoanPricingWorkflowVO;
import com.ruoyi.loanpricing.service.ILoanPricingWorkflowService;
import com.ruoyi.loanpricing.service.LoanPricingCustomerMapService;
import com.ruoyi.loanpricing.service.LoanRateHistoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -42,6 +43,9 @@ public class LoanPricingWorkflowController extends BaseController
@Autowired
private LoanPricingCustomerMapService customerMapService;
@Autowired
private LoanRateHistoryService loanRateHistoryService;
/**
* 发起个人客户利率定价流程
*/
@@ -85,6 +89,16 @@ public class LoanPricingWorkflowController extends BaseController
return success(customerMapService.queryCorporate(custId));
}
/**
* 查询历史贷款合同
*/
@Operation(summary = "查询历史贷款合同")
@GetMapping("/history-contract")
public AjaxResult queryHistoryContract(@RequestParam("custIsn") String custIsn)
{
return success(loanRateHistoryService.query(custIsn));
}
/**
* 查询利率定价流程列表
*/

View File

@@ -10,6 +10,7 @@ import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.loanpricing.domain.dto.ModelInvokeDTO;
import com.ruoyi.loanpricing.domain.vo.CustomerMapRecordVO;
import com.ruoyi.loanpricing.domain.vo.HistoryLoanContractVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.core.io.ClassPathResource;
@@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.*;
import java.io.InputStream;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
@@ -63,6 +65,33 @@ public class LoanRatePricingMockController extends BaseController {
return success(randomCustomerMapRecords(custId, "企业客户"));
}
@Anonymous
@Operation(summary = "模拟历史贷款合同查询")
@GetMapping("/history-contract")
public AjaxResult queryHistoryContract(@RequestParam("cust_isn") String custIsn)
{
String normalizedCustIsn = StringUtils.trimWhitespace(custIsn);
if (!StringUtils.hasText(normalizedCustIsn))
{
throw new ServiceException("客户内码不能为空");
}
if ("EMPTY_HISTORY".equals(normalizedCustIsn))
{
return success(Collections.emptyList());
}
List<HistoryLoanContractVO> records = new ArrayList<>();
HistoryLoanContractVO record = new HistoryLoanContractVO();
record.setCustIsn(normalizedCustIsn);
record.setLoanContractHistory("HT" + normalizedCustIsn);
record.setGuarTypeHistory("信用");
record.setProductCodeHistory("P001");
record.setLoanRateHistory("EMPTY_RATE".equals(normalizedCustIsn) ? "" : "3.65");
record.setLoanAmountHistory("100000");
record.setLoanSignDateHistory(LocalDate.now().minusMonths(6).toString());
records.add(record);
return success(records);
}
private ObjectNode loadJsonFromResource(String resourcePath){
ClassPathResource classPathResource = new ClassPathResource(resourcePath);
try (InputStream inputStream = classPathResource.getInputStream();){
@@ -81,6 +110,30 @@ public class LoanRatePricingMockController extends BaseController {
{
throw new ServiceException("客户号不能为空");
}
if ("HISTORY_EMPTY".equals(normalizedCustId))
{
CustomerMapRecordVO record = new CustomerMapRecordVO();
record.setCustId(normalizedCustId);
record.setCustIsn("EMPTY_HISTORY");
record.setCustName(namePrefix + "空历史合同");
record.setFaithDay("0");
record.setBalanceAvg("0");
record.setLoanCountHis("0");
record.setLastLoanDate("");
return Collections.singletonList(record);
}
if ("HISTORY_EMPTY_RATE".equals(normalizedCustId))
{
CustomerMapRecordVO record = new CustomerMapRecordVO();
record.setCustId(normalizedCustId);
record.setCustIsn("EMPTY_RATE");
record.setCustName(namePrefix + "空历史利率");
record.setFaithDay("30");
record.setBalanceAvg("10000");
record.setLoanCountHis("1");
record.setLastLoanDate(LocalDate.now().minusMonths(3).toString());
return Collections.singletonList(record);
}
int count = ThreadLocalRandom.current().nextInt(1, 4);
List<CustomerMapRecordVO> records = new ArrayList<>();
for (int i = 1; i <= count; i++)

View File

@@ -0,0 +1,72 @@
package com.ruoyi.loanpricing.service;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.loanpricing.domain.vo.HistoryLoanContractVO;
import java.net.URI;
import java.util.Collections;
import java.util.List;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
@Service
public class LoanRateHistoryService
{
private final RestTemplate restTemplate;
@Value("${loan-rate-history.url}")
private String historyUrl;
public LoanRateHistoryService()
{
this(new RestTemplate());
}
LoanRateHistoryService(RestTemplate restTemplate)
{
this.restTemplate = restTemplate;
}
LoanRateHistoryService(RestTemplate restTemplate, String historyUrl)
{
this.restTemplate = restTemplate;
this.historyUrl = historyUrl;
}
public List<HistoryLoanContractVO> query(String custIsn)
{
String normalizedCustIsn = StringUtils.trimWhitespace(custIsn);
if (!StringUtils.hasText(normalizedCustIsn))
{
throw new ServiceException("客户内码不能为空");
}
URI uri = UriComponentsBuilder.fromHttpUrl(historyUrl)
.queryParam("cust_isn", normalizedCustIsn)
.build()
.encode()
.toUri();
HistoryLoanContractResponse response = restTemplate.getForObject(uri, HistoryLoanContractResponse.class);
if (response == null)
{
throw new ServiceException("历史贷款合同接口无返回");
}
if (response.getCode() != null && response.getCode() != 200)
{
throw new ServiceException(StringUtils.hasText(response.getMsg()) ? response.getMsg() : "历史贷款合同查询失败");
}
return response.getData() == null ? Collections.emptyList() : response.getData();
}
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
static class HistoryLoanContractResponse
{
private Integer code;
private String msg;
private List<HistoryLoanContractVO> data;
}
}