2026-01-21 15:58:39 +08:00
|
|
|
package com.ruoyi.loanpricing.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
|
|
import com.ruoyi.common.annotation.Anonymous;
|
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.loanpricing.domain.dto.ModelInvokeDTO;
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author 吴凯程
|
|
|
|
|
* @Date 2025/11/10
|
|
|
|
|
**/
|
|
|
|
|
@Tag(name = "测算测试接口")
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/rate/pricing/mock")
|
|
|
|
|
public class LoanRatePricingMockController extends BaseController {
|
|
|
|
|
|
|
|
|
|
@Anonymous
|
2026-04-27 15:22:08 +08:00
|
|
|
@Operation(summary = "调用个人模型获取测算利率")
|
|
|
|
|
@PostMapping("/invokeModel/personal")
|
|
|
|
|
public AjaxResult invokePersonalModel(ModelInvokeDTO modelInvokeDTO) {
|
|
|
|
|
return new AjaxResult(10000, "success", loadJsonFromResource("data/retail_output.json"));
|
|
|
|
|
}
|
2026-01-21 15:58:39 +08:00
|
|
|
|
2026-04-27 15:22:08 +08:00
|
|
|
@Anonymous
|
|
|
|
|
@Operation(summary = "调用企业模型获取测算利率")
|
|
|
|
|
@PostMapping("/invokeModel/corporate")
|
|
|
|
|
public AjaxResult invokeCorporateModel(ModelInvokeDTO modelInvokeDTO) {
|
|
|
|
|
return new AjaxResult(10000, "success", loadJsonFromResource("data/corp_output.json"));
|
2026-01-21 15:58:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ObjectNode loadJsonFromResource(String resourcePath){
|
|
|
|
|
ClassPathResource classPathResource = new ClassPathResource(resourcePath);
|
|
|
|
|
try (InputStream inputStream = classPathResource.getInputStream();){
|
|
|
|
|
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
return objectMapper.readValue(inputStream, ObjectNode.class);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|