⚡ 付款申请同步金蝶推送成功即时回填付款申请单编号,无需等待定时回写

This commit is contained in:
刘泉佳
2026-09-18 21:35:35 +08:00
parent 0e1334be23
commit ba93a9b0ca
@@ -39,6 +39,7 @@ import org.springblade.thirdparty.bfi.pojo.dto.BfiPayApplyQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiPayApplySaveDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiPayApplySaveEntryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiPayBillQueryDTO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillSaveResultItemVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillSaveResultVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiPayApplyEntryVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiPayApplyVO;
@@ -888,7 +889,7 @@ public class PaymentApplicationServiceImpl extends BaseServiceImpl<PaymentApplic
param.setEntry(List.of(entry));
BfiBillSaveResultVO saveResult = bfiService.savePrePayApply(param);
return kingdeeApBillSyncSupport.requireBfiBillId(saveResult, "推送金蝶付款申请");
return requireBfiBillIdAndFillNo(entity, saveResult, "推送金蝶付款申请");
}
/**
@@ -980,7 +981,27 @@ public class PaymentApplicationServiceImpl extends BaseServiceImpl<PaymentApplic
param.setEntry(entries);
BfiBillSaveResultVO saveResult = bfiService.pushPayApply(param);
return kingdeeApBillSyncSupport.requireBfiBillId(saveResult, "推送金蝶付款申请(应付下推)");
return requireBfiBillIdAndFillNo(entity, saveResult, "推送金蝶付款申请(应付下推)");
}
/**
* 校验金蝶保存/下推返回结果,取星瀚单据id并即时回填付款申请单编号(kingdeeBillNo):
* 推送结果携带金蝶单据编号(number),同步完成列表立即可见,无需等待 A103-2 定时回写;
* 后续付款申请单编号与付款状态仍由 A103-2/A103-4 定时回写任务覆盖校准
*
* @param entity 付款申请实体
* @param saveResult 金蝶返回结果
* @param action 业务动作描述,用于异常提示
* @return 星瀚单据id
*/
private String requireBfiBillIdAndFillNo(PaymentApplication entity, BfiBillSaveResultVO saveResult, String action) {
kingdeeApBillSyncSupport.requireBfiSaveSuccess(saveResult, action);
BfiBillSaveResultItemVO item = saveResult.getResult().get(0);
if (Func.isNotEmpty(item.getNumber())) {
entity.setKingdeeBillNo(item.getNumber());
}
if (item.getId() == null) throw new ServiceException(action + "失败,金蝶未返回单据id");
return String.valueOf(item.getId());
}
/** 结算明细(上下文缓存优先):批量预检加载过的明细推送时直接复用,消除逐单重复查询 */