fix: A301-3 认领推送核心单据编号改传结算单金蝶单据id(星瀚内码),本地结算单id金蝶无法识别;缺id时推送前置拦截

This commit is contained in:
刘泉佳
2026-10-01 20:09:10 +08:00
parent 984fbd07fd
commit ab64d28251
@@ -848,6 +848,12 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
if (allocations.isEmpty()) {
return ReceiptClaimPushResult.fail("该流水无有效认领分摊,无法推送");
}
// 核心单据编号取第一张结算单同步金蝶回写的星瀚内码(应收/应付单金蝶id),TMS本地id金蝶无法识别
FormalSettlement firstSettlement = formalSettlementMapper.selectById(allocations.get(0).getFormalSettlementId());
if (firstSettlement == null || Func.isBlank(firstSettlement.getKingdeeBillId())) {
return ReceiptClaimPushResult.fail("结算单" + allocations.get(0).getFormalSettlementNo()
+ "未同步金蝶(缺少金蝶单据id),不满足推送条件");
}
// 推送来源编码:分摊结算单号下划线拼接(A301-3 契约口径;分摊不变则重试编码不变,
// 金蝶按 awrp_src_sys + awrp_src_code 幂等防重试双单)
String awrpSrcCode = allocations.stream()
@@ -857,7 +863,7 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
.collect(Collectors.joining("_"));
flow.setAwrpSrcCode(awrpSrcCode);
BfiClaimPushDTO param = buildClaimPushDTO(flow, claimedTotal, allocations);
BfiClaimPushDTO param = buildClaimPushDTO(flow, claimedTotal, allocations, firstSettlement.getKingdeeBillId());
log.info("调用BFI接口 收款认领结果推送开始 flowId:{},billId:{},awrpSrcCode:{},分摊明细 {} 行,认领金额 {}",
flow.getId(), flow.getBillId(), flow.getAwrpSrcCode(), allocations.size(), claimedTotal);
try {
@@ -869,10 +875,11 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
}
/**
* A301-3 推送报文组装:billid=公告id,单条分录、金额=全部未推送金额(一笔流水一张金蝶收款单)
* A301-3 推送报文组装:billid=公告id,单条分录、金额=全部未推送金额(一笔流水一张金蝶收款单),
* 核心单据编号=第一张结算单的金蝶单据id(星瀚内码)
*/
private BfiClaimPushDTO buildClaimPushDTO(KingdeeReceiptFlow flow, BigDecimal claimedTotal,
List<ReceiptClaimSettlement> allocations) {
List<ReceiptClaimSettlement> allocations, String coreBillId) {
BfiClaimPushDTO param = new BfiClaimPushDTO();
// 【必填】认领公告id
param.setBillid(flow.getBillId());
@@ -896,8 +903,8 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
entry.setSeq(allocations.get(0).getFormalSettlementId());
// 核心单据类型
// entry.setECorebilltype(KingdeeBfiConstant.BFI_CLAIM_CORE_BILL_TYPE);
// 核心单据编号(第一张结算单id)
entry.setECorebillno(String.valueOf(allocations.get(0).getFormalSettlementId()));
// 核心单据编号(第一张结算单的金蝶单据id,星瀚内码)
entry.setECorebillno(coreBillId);
param.setEntryentity(List.of(entry));
return param;
}