fix: A301-3 报文取数按契约修正——awrp_src_code=分摊结算单号拼接,seq/e_corebillno=结算单id
This commit is contained in:
+14
-20
@@ -792,10 +792,6 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
|
||||
return ReceiptClaimPushResult.fail("累计认领金额(" + claimedTotal + ")与公告未认领金额("
|
||||
+ money(flow.getUnclaimedAmount()) + ")不一致,不满足推送条件");
|
||||
}
|
||||
// 推送来源编码:首次生成落库,重试复用(金蝶按 awrp_src_sys + awrp_src_code 幂等,防重试双单)
|
||||
if (Func.isEmpty(flow.getAwrpSrcCode())) {
|
||||
flow.setAwrpSrcCode(buildAwrpSrcCode(flow.getId()));
|
||||
}
|
||||
// 分录取该流水全部有效分摊行(结算单id升序,跨认领主单归集)
|
||||
List<ReceiptClaimSettlement> allocations = claimSettlementMapper.selectList(
|
||||
Wrappers.<ReceiptClaimSettlement>lambdaQuery()
|
||||
@@ -814,6 +810,14 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
|
||||
: formalSettlementMapper.selectList(Wrappers.<FormalSettlement>lambdaQuery()
|
||||
.in(FormalSettlement::getId, settlementIds)).stream()
|
||||
.collect(Collectors.toMap(FormalSettlement::getId, Function.identity(), (first, second) -> first));
|
||||
// 推送来源编码:分摊结算单号下划线拼接(A301-3 契约口径;分摊不变则重试编码不变,
|
||||
// 金蝶按 awrp_src_sys + awrp_src_code 幂等防重试双单)
|
||||
String awrpSrcCode = allocations.stream()
|
||||
.map(ReceiptClaimSettlement::getFormalSettlementNo)
|
||||
.filter(Func::isNotEmpty)
|
||||
.distinct()
|
||||
.collect(Collectors.joining("_"));
|
||||
flow.setAwrpSrcCode(awrpSrcCode);
|
||||
|
||||
BfiClaimPushDTO param = buildClaimPushDTO(flow, allocations, settlements);
|
||||
log.info("调用BFI接口 收款认领结果推送开始 flowId:{},billId:{},awrpSrcCode:{},分摊明细 {} 行,认领金额 {}",
|
||||
@@ -836,7 +840,7 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
|
||||
param.setBillid(flow.getBillId());
|
||||
// 【必填】来源系统编码
|
||||
param.setAwrpSrcSys(bfiProperties.getSrcSys());
|
||||
// 【必填】来源系统单据编码(按流水生成,重试复用)
|
||||
// 【必填】来源系统单据编码(分摊结算单号下划线拼接)
|
||||
param.setAwrpSrcCode(flow.getAwrpSrcCode());
|
||||
// 【必填】收款类型.编码
|
||||
param.setRecpaytypeNumber(KingdeeBfiConstant.BFI_CLAIM_REC_PAY_TYPE);
|
||||
@@ -847,20 +851,19 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
|
||||
// 【必填】付款人id
|
||||
param.setRecpayer(flow.getPayerId());
|
||||
List<BfiClaimPushEntryDTO> entries = new ArrayList<>();
|
||||
int seq = 1;
|
||||
for (ReceiptClaimSettlement allocation : allocations) {
|
||||
BfiClaimPushEntryDTO entry = new BfiClaimPushEntryDTO();
|
||||
// 【必填】应收金额(分摊金额)
|
||||
entry.setEReceivableamt(money(allocation.getAllocatedReceiptAmount()));
|
||||
// 分录行序号
|
||||
entry.setSeq((long) seq++);
|
||||
// 分录行序号(结算单id)
|
||||
entry.setSeq(allocation.getFormalSettlementId());
|
||||
FormalSettlement settlement = settlements.get(allocation.getFormalSettlementId());
|
||||
if (settlement != null && Func.isNotEmpty(settlement.getKingdeeBillNo())) {
|
||||
// 结算单已同步金蝶应收单时携带核心单据引用,金蝶按应收单号核销认领金额
|
||||
// 结算单已同步金蝶应收单时携带核心单据引用,金蝶按结算单id核销认领金额
|
||||
// 核心单据类型
|
||||
// entry.setECorebilltype(KingdeeBfiConstant.BFI_CLAIM_CORE_BILL_TYPE);
|
||||
// 核心单据编号
|
||||
entry.setECorebillno(settlement.getKingdeeBillNo());
|
||||
// 核心单据编号(结算单id)
|
||||
entry.setECorebillno(String.valueOf(settlement.getId()));
|
||||
}
|
||||
entries.add(entry);
|
||||
}
|
||||
@@ -939,15 +942,6 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
|
||||
return ReceiptClaimPushResult.fail("金蝶认领结果推送失败:" + reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送来源编码:SKCL + 时间戳 + 流水id尾号6位(按流水生成,重试复用)
|
||||
*/
|
||||
private String buildAwrpSrcCode(Long flowId) {
|
||||
String time = DateTimeFormatter.ofPattern("yyyyMMddHHmmss").format(LocalDateTime.now());
|
||||
String suffix = String.valueOf(flowId);
|
||||
return "SKCL" + time + suffix.substring(Math.max(0, suffix.length() - 6));
|
||||
}
|
||||
|
||||
/**
|
||||
* A301-2 收款认领公告查询:按认领人姓名全量翻页,时间窗口取 Nacos 配置(默认近半年)。
|
||||
* 认领公告同步、手动推送对账与定时任务对账共用。
|
||||
|
||||
Reference in New Issue
Block a user