fix: - 修复BFI单据保存结果反序列化失败导致错误信息丢失。

- 财务应付单保存A102-2,传业务字段。并保存id
- 付款管理批量同步方法优化
This commit is contained in:
刘泉佳
2026-09-18 10:48:43 +08:00
parent d0c5483d8b
commit 20fddf2c60
13 changed files with 470 additions and 139 deletions
@@ -0,0 +1,75 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.thirdparty.bfi.pojo.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* 业财融合(BFI)单据保存返回错误明细
*
* @author Chill
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class BfiBillSaveResultErrorVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 实体键
*/
private String entityKey;
/**
* 分录行号
*/
private Integer entryRowIndex;
/**
* 单据键值,含 awrp_src_code、awrp_src_sys
*/
private Map<String, String> keys;
/**
* 行错误信息
*/
private List<String> rowMsg;
/**
* 子分录行号
*/
private Integer subEntryRowIndex;
/**
* 拼接行错误信息
*
* @return 错误信息文本
*/
public String getRowMsgText() {
return rowMsg == null || rowMsg.isEmpty() ? "" : String.join(";", rowMsg);
}
}
@@ -25,6 +25,7 @@
*/
package org.springblade.thirdparty.bfi.pojo.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
@@ -33,6 +34,7 @@ import java.io.Serial;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 业财融合(BFI)A103-1 / A103-3 付款申请保存返回结果明细
@@ -40,6 +42,7 @@ import java.util.Map;
* @author Chill
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class BfiBillSaveResultItemVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@@ -52,9 +55,13 @@ public class BfiBillSaveResultItemVO implements Serializable {
*/
private Boolean billStatus;
/**
* 错误信息
* 分录id集合
*/
private List<String> errors;
private Map<String, Object> entryIds;
/**
* 错误明细
*/
private List<BfiBillSaveResultErrorVO> errors;
/**
* 单据id
*/
@@ -69,7 +76,19 @@ public class BfiBillSaveResultItemVO implements Serializable {
*/
private String number;
/**
* 操作类型:Add 新增、Push 下推
* 操作类型:Add 新增、Push 下推、Update 修改
*/
private String type;
/**
* 拼接错误明细信息
*
* @return 错误信息文本
*/
public String getErrorText() {
return errors == null || errors.isEmpty() ? "" : errors.stream()
.map(BfiBillSaveResultErrorVO::getRowMsgText)
.filter(text -> !text.isEmpty())
.collect(Collectors.joining(";"));
}
}
@@ -25,6 +25,7 @@
*/
package org.springblade.thirdparty.bfi.pojo.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import java.io.Serial;
@@ -37,6 +38,7 @@ import java.util.List;
* @author Chill
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class BfiBillSaveResultVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@@ -41,7 +41,6 @@ import org.springblade.thirdparty.bfi.pojo.dto.BfiApBillSaveDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiArBillQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiArBillSaveBodyDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiArBillSaveDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiClaimAnnounceQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiClaimPushBodyDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiClaimPushDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiCustomerQueryDTO;
@@ -63,10 +62,10 @@ import org.springblade.thirdparty.bfi.pojo.dto.BfiPayApplyQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiPayApplySaveBodyDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiPayApplySaveDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiPayBillQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiRecBillQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiReceivedInvoiceQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiReceivedInvoiceSaveBodyDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiReceivedInvoiceSaveDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiRecBillQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiTokenDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiVerifyTokenDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiWithdrawTokenDTO;
@@ -82,8 +81,8 @@ import org.springblade.thirdparty.bfi.pojo.vo.BfiOpenApiResultVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiPageVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiPayApplyVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiPayBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiReceivedInvoiceVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiRecBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiReceivedInvoiceVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiResultVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiTokenVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiVerifyTokenVO;
@@ -529,10 +528,13 @@ public class BfiServiceImpl implements IBfiService {
if (result != null && result.isSuccess()) {
return result;
}
log.error("调用BFI接口 {}异常响应参数:{}", type, JSONUtil.toJsonStr(result));
String message = Optional.ofNullable(result).map(BfiResultVO::getMessage).orElse("");
throw new BfiException("调用BFI接口" + type + "异常 " + message);
log.error("调用BFI接口 {}异常响应参数:{}", type, JSONUtil.toJsonStr(result));
String message = Optional.ofNullable(result).map(BfiResultVO::getMessage).filter(StringUtil::isNotBlank)
.orElseGet(() -> Optional.ofNullable(result).map(BfiResultVO::getErrorCode)
.map(errorCode -> "错误码 " + errorCode).orElse("响应为空或解析失败"));
throw new BfiException("调用BFI接口" + type + "异常 " + message);
} catch (BfiException e) {
log.error("调用BFI接口 {},BfiException异常", type, e);
throw e;
} catch (Exception e) {
log.error("调用BFI接口 {}异常", type, e);