🐛 修复BFI汇率查询接口参数与响应类型

- IBfiClient: 汇率查询参数改用@SpringQueryMap,返回类型改为BfiPageVO分页结构
- BfiServiceImpl: 从分页结果提取rows列表,修正参数字段名
- BfiExchangeRateQueryDTO: 添加invoiceNo、pageSize字段,effectdate改为effectdateS
- BfiExchangeRateVO: 添加orgcurNumber、orgcurName字段用于币种匹配
- BfiFeignClientConfig: 修复全局Feign拦截器覆盖BFI Authorization header问题
This commit is contained in:
刘泉佳
2026-09-16 14:13:28 +08:00
parent 81c8567fd7
commit 10060e7f0b
5 changed files with 35 additions and 8 deletions
@@ -42,11 +42,21 @@ import java.util.concurrent.TimeUnit;
public class BfiFeignClientConfig {
@Bean
public RequestInterceptor requestInterceptor(BfiProperties properties) {
// 屏蔽全局拦截器 BladeFeignRequestInterceptor,仅注入 BFI 网关认证请求头
public RequestInterceptor bladeFeignRequestInterceptor() {
// 空实现覆盖全局 BladeFeignRequestInterceptor,防止其覆盖 BFI 的 Authorization header
return template -> {};
}
@Bean
public RequestInterceptor bfiRequestInterceptor(BfiProperties properties) {
return new BfiRequestInterceptor(properties);
}
@Bean
public feign.Logger.Level feignLoggerLevel() {
return feign.Logger.Level.FULL;
}
@Bean
public Request.Options options() {
return new Request.Options(10, TimeUnit.SECONDS, 60, TimeUnit.SECONDS, true);
@@ -43,6 +43,7 @@ import org.springblade.thirdparty.bfi.pojo.vo.BfiResultVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiTokenVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiVerifyTokenVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -103,7 +104,7 @@ public interface IBfiClient {
* @return 汇率列表
*/
@GetMapping(FOREX_QUERY_URL)
BfiResultVO<List<BfiExchangeRateVO>> forexQuery(@RequestHeader(BfiConstant.HEADER_ACCESS_TOKEN) String accessToken, @RequestBody BfiExchangeRateQueryDTO param);
BfiResultVO<BfiPageVO<BfiExchangeRateVO>> forexQuery(@RequestHeader(BfiConstant.HEADER_ACCESS_TOKEN) String accessToken, @SpringQueryMap BfiExchangeRateQueryDTO param);
/**
* A103-1 付款申请保存(根据星瀚应付下推付款申请)
@@ -39,12 +39,16 @@ import java.io.Serializable;
public class BfiExchangeRateQueryDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private String invoiceNo;
/**
* 生效日期-开始,格式:yyyy-MM-dd
*/
private String effectdate;
private String effectdateS;
/**
* 生效日期-结束,格式:yyyy-MM-dd
*/
private String effectdateE;
private String pageSize;
}
@@ -151,4 +151,14 @@ public class BfiExchangeRateVO implements Serializable {
* 计算规则
*/
private String computationrules;
/**
* 原币编码
*/
@JsonProperty("orgcur_number")
private String orgcurNumber;
/**
* 原币名称
*/
@JsonProperty("orgcur_name")
private String orgcurName;
}
@@ -29,7 +29,6 @@ import cn.hutool.json.JSONUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.thirdparty.bfi.config.BfiProperties;
import org.springblade.thirdparty.bfi.constant.BfiConstant;
@@ -159,11 +158,14 @@ public class BfiServiceImpl implements IBfiService {
throw new BfiException("查询BFI汇率失败,生效日期不能为空");
}
BfiExchangeRateQueryDTO param = new BfiExchangeRateQueryDTO();
param.setEffectdate(effectdate);
param.setInvoiceNo("25532000000044538098");
param.setEffectdateS(effectdate);
param.setEffectdateE(effectdateE);
param.setPageSize("10");
String accessToken = getAccessToken();
BfiResultVO<List<BfiExchangeRateVO>> result = commonCall("汇率查询", () -> client.forexQuery(accessToken, param));
return result.getData();
BfiResultVO<BfiPageVO<BfiExchangeRateVO>> result = commonCall("汇率查询", () -> client.forexQuery(accessToken, param));
BfiPageVO<BfiExchangeRateVO> page = result.getData();
return page != null && page.getRows() != null ? page.getRows() : List.of();
}
@Override