feat: BFI新增单据锁定接口lockBusiData(批量逗号拼接传参,updateCount/updateResultList应答结构)

This commit is contained in:
刘泉佳
2026-10-09 19:51:59 +08:00
parent 22b0b07ae2
commit 92a975b5e4
5 changed files with 222 additions and 0 deletions
@@ -30,6 +30,7 @@ import org.springblade.thirdparty.bfi.config.BfiFeignClientConfig;
import org.springblade.thirdparty.bfi.constant.BfiConstant;
import org.springblade.thirdparty.bfi.pojo.dto.BfiApBillSaveBodyDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiArBillSaveBodyDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiBillLockDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiBlacklistQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiClaimPushBodyDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiCustomerSaveBodyDTO;
@@ -51,6 +52,7 @@ import org.springblade.thirdparty.bfi.pojo.vo.BfiApBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiArBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiBlacklistVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiAttachmentUploadVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillLockResultVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillSaveResultVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiClaimAnnounceVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiCustomerVO;
@@ -114,6 +116,7 @@ public interface IBfiClient {
String INVOICE_DOWNLOAD_URL = "${thirdParty.bfi.invoiceDownloadUrl:/ierp/kapi/v2/awrp/bosext/attachment/download}";
String ATTACHMENT_UPLOAD_URL = "${thirdParty.bfi.attachmentUploadUrl:/ierp/kapi/v2/frame/attachment/uploadFile}";
String BLACKLIST_QUERY_URL = "${thirdParty.bfi.blacklistQueryUrl:/ierp/kapi/v2/awrp/bdm/bdm_blacklist_config/blacklistquery}";
String LOCK_BILL_URL = "${thirdParty.bfi.billLockUrl:/ierp/kapi/app/billLock/lockBusiData}";
/**
* A100-1 获取令牌
@@ -488,4 +491,17 @@ public interface IBfiClient {
BfiResultVO<BfiAttachmentUploadVO> uploadAttachment(@RequestHeader(BfiConstant.HEADER_ACCESS_TOKEN) String accessToken,
@RequestPart("file") MultipartFile file,
@RequestPart("attachmentUploadFileArgs") String attachmentUploadFileArgs);
/**
* 单据锁定(lockBusiData):推送金蝶成功后 WLTMS 调用锁定目标单据;
* 多张单据编号逗号拼接批量传参(sourceBillNo 与 targetBillNo 顺序一一对应),
* 应答为 {updateCount, updateResultList} 裸结构(非 BfiResultVO 包装);
* 解锁结果由金蝶经 unLockNotifyBusiData 回调 WLTMS 通知(见 transport 侧公开端点)
*
* @param accessToken 访问令牌,通过 getToken 获取
* @param param 锁单参数
* @return 锁单处理结果
*/
@PostMapping(LOCK_BILL_URL)
BfiBillLockResultVO lockBusiData(@RequestHeader(BfiConstant.HEADER_ACCESS_TOKEN) String accessToken, @RequestBody BfiBillLockDTO param);
}
@@ -0,0 +1,90 @@
/**
* 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
* of 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.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 业财融合(BFI)单据锁定/解锁通知参数(lockBusiData 与 unLockNotifyBusiData 出入参共用)。
* <p>lockBusiData:WLTMS 调金蝶,sourceSystem=WLTMS、targetSystem=XH、lockAction=LOCK;
* unLockNotifyBusiData:金蝶调 WLTMS,sourceSystem=XH、targetSystem=WLTMS、lockAction=UNLOCK,
* operationType=DELETE 时 WLTMS 侧需废除源单并还原关联数据。
* 批量传参约定:多张单据编号以英文逗号拼接(sourceBillNo 与 targetBillNo 按顺序一一对应),
* time/operator 按接口文档为选传字段(示例报文未携带),非空时才送</p>
*
* @author Chill
*/
@Data
@EqualsAndHashCode(callSuper = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BfiBillLockDTO extends BfiBaseDTO {
@Serial
private static final long serialVersionUID = 1L;
/**
* 【必填】操作类型:LOCK-锁定,UNLOCK-解锁
*/
private String lockAction;
/**
* 【必填】源系统标识,即接口调用方:WLTMS / XH
*/
private String sourceSystem;
/**
* 【必填】目标系统标识,即接口目标接收方:WLTMS / XH
*/
private String targetSystem;
/**
* 【必填】来源操作类型:SAVE-单据新增,DELETE-单据删除
*/
private String operationType;
/**
* 【必填】源单据类型:调用方单据类型(WLTMS 自定义:SETTLEMENT/INVOICE_APPLY,金蝶固定:ApFin_other_BT_S 等),多张同类型
*/
private String sourceBillType;
/**
* 【必填】源单据编号,多张英文逗号拼接
*/
private String sourceBillNo;
/**
* 【必填】目标单据类型:接收方单据类型(金蝶固定:ApFin_other_BT_S 等,WLTMS 自定义:SETTLEMENT 等),多张同类型
*/
private String targetBillType;
/**
* 【必填】目标单据编号,多张英文逗号拼接,与 sourceBillNo 顺序一一对应
*/
private String targetBillNo;
/**
* 操作时间,格式:yyyy-MM-dd HH:mm:ss(非空才送)
*/
private String time;
/**
* 操作人名字:推单用发起人,删除用操作人(非空才送)
*/
private String operator;
}
@@ -0,0 +1,78 @@
/**
* 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
* of 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.JsonInclude;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
/**
* 业财融合(BFI)单据锁定/解锁通知处理结果。
* <p>lockBusiData(金蝶返回)与 unLockNotifyBusiData(WLTMS 回调应答)同构:
* updateCount 为处理单据数,updateResultList 为逐单处理结果(1-成功,0-失败/未匹配),
* 批量传参时单据编号逗号拼接、结果列表与传参顺序对应</p>
*
* @author Chill
*/
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BfiBillLockResultVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 处理单据数量
*/
private Integer updateCount;
/**
* 逐单处理结果:1-成功,0-失败/未匹配
*/
private List<Integer> updateResultList;
/**
* 组装成功应答
*
* @param count 处理单据数
* @return 应答结果
*/
public static BfiBillLockResultVO of(int count) {
BfiBillLockResultVO result = new BfiBillLockResultVO();
result.setUpdateCount(count);
result.setUpdateResultList(count > 0 ? List.of(1) : List.of(0));
return result;
}
/**
* 是否全部处理成功
*
* @return true-更新数量大于0
*/
public boolean isSuccess() {
return updateCount != null && updateCount > 0;
}
}
@@ -30,6 +30,7 @@ import org.springblade.thirdparty.bfi.pojo.dto.BfiApBillQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiApBillSaveDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiArBillQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiArBillSaveDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiBillLockDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiClaimAnnounceQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiClaimPushDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiCustomerQueryDTO;
@@ -314,4 +315,13 @@ public interface IBfiService {
* @return 上传结果,path 即金蝶侧文件路径
*/
BfiAttachmentUploadVO uploadAttachment(String entityNumber, String billPkId, String controlKey, String fileName, byte[] fileContent);
/**
* 单据锁定(lockBusiData):推送金蝶成功后锁定目标单据,多张单据编号逗号拼接批量传参,
* 解锁结果由金蝶回调 unLockNotifyBusiData 通知
*
* @param param 锁单参数,操作类型固定 LOCK,源系统 WLTMS、目标系统 XH
* @return true-锁定成功(updateCount 大于 0)
*/
boolean lockBusiData(BfiBillLockDTO param);
}
@@ -43,6 +43,7 @@ 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.BfiBillLockDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiBlacklistQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiClaimAnnounceQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiClaimPushBodyDTO;
@@ -77,6 +78,7 @@ import org.springblade.thirdparty.bfi.pojo.dto.BfiWithdrawTokenDTO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiApBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiArBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiAttachmentUploadVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillLockResultVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillSaveResultVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiBlacklistVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiClaimAnnounceVO;
@@ -370,6 +372,32 @@ public class BfiServiceImpl implements IBfiService {
return result.getData();
}
@Override
public boolean lockBusiData(BfiBillLockDTO param) {
if (param == null || StringUtil.isBlank(param.getLockAction()) || StringUtil.isBlank(param.getSourceSystem())
|| StringUtil.isBlank(param.getTargetSystem()) || StringUtil.isBlank(param.getOperationType())
|| StringUtil.isBlank(param.getSourceBillType()) || StringUtil.isBlank(param.getSourceBillNo())
|| StringUtil.isBlank(param.getTargetBillType()) || StringUtil.isBlank(param.getTargetBillNo())) {
throw new BfiException("BFI单据锁定失败,操作类型/源目标系统/操作类型/单据类型与编号不能为空");
}
// 锁单应答为 {updateCount, updateResultList} 裸结构(非 BfiResultVO 包装),独立校验
try {
String accessToken = getAccessToken();
BfiBillLockResultVO result = client.lockBusiData(accessToken, param);
if (result != null && result.isSuccess()) {
return true;
}
log.error("调用BFI接口单据锁定异常响应参数:{}", JSONUtil.toJsonStr(result));
throw new BfiException("调用BFI接口单据锁定异常 " + (result == null ? "响应为空或解析失败" : "updateCount=" + result.getUpdateCount()));
} catch (BfiException e) {
log.error("调用BFI接口单据锁定,BfiException异常", e);
throw e;
} catch (Exception e) {
log.error("调用BFI接口单据锁定异常", e);
throw new BfiException("调用BFI接口单据锁定异常", e);
}
}
@Override
public BfiPageVO<BfiArBillVO> queryArBill(BfiArBillQueryDTO param) {
if (param == null || param.getPageNo() == null || param.getPageSize() == null) {