From 33365a0d7460a9902f1079cf8c569e1bd5a04425 Mon Sep 17 00:00:00 2001 From: wkc <978997012@qq.com> Date: Thu, 30 Apr 2026 09:12:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8E=86=E5=8F=B2=E8=B4=B7?= =?UTF-8?q?=E6=AC=BE=E5=90=88=E5=90=8C=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-dev.yml | 3 + .../src/main/resources/application-pro.yml | 3 + .../src/main/resources/application-uat.yml | 3 + .../LoanPricingWorkflowController.java | 14 ++++ .../LoanRatePricingMockController.java | 53 ++++++++++++++ .../service/LoanRateHistoryService.java | 72 +++++++++++++++++++ 6 files changed, 148 insertions(+) create mode 100644 ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/service/LoanRateHistoryService.java diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index 2e58238..3d9f46c 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -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" diff --git a/ruoyi-admin/src/main/resources/application-pro.yml b/ruoyi-admin/src/main/resources/application-pro.yml index aace1da..046b6c3 100644 --- a/ruoyi-admin/src/main/resources/application-pro.yml +++ b/ruoyi-admin/src/main/resources/application-pro.yml @@ -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" diff --git a/ruoyi-admin/src/main/resources/application-uat.yml b/ruoyi-admin/src/main/resources/application-uat.yml index 77756e5..f053671 100644 --- a/ruoyi-admin/src/main/resources/application-uat.yml +++ b/ruoyi-admin/src/main/resources/application-uat.yml @@ -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" diff --git a/ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/controller/LoanPricingWorkflowController.java b/ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/controller/LoanPricingWorkflowController.java index fc465ff..c8a03dd 100644 --- a/ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/controller/LoanPricingWorkflowController.java +++ b/ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/controller/LoanPricingWorkflowController.java @@ -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)); + } + /** * 查询利率定价流程列表 */ diff --git a/ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/controller/LoanRatePricingMockController.java b/ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/controller/LoanRatePricingMockController.java index b8d5cc5..576f2ef 100644 --- a/ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/controller/LoanRatePricingMockController.java +++ b/ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/controller/LoanRatePricingMockController.java @@ -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 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 records = new ArrayList<>(); for (int i = 1; i <= count; i++) diff --git a/ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/service/LoanRateHistoryService.java b/ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/service/LoanRateHistoryService.java new file mode 100644 index 0000000..6309614 --- /dev/null +++ b/ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/service/LoanRateHistoryService.java @@ -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 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 data; + } +}