fix: A301-3 分录按契约改为单条——e_receivableamt=全部未推送金额,seq/e_corebillno=第一张结算单id
This commit is contained in:
+15
-32
@@ -801,15 +801,6 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
|
||||
if (allocations.isEmpty()) {
|
||||
return ReceiptClaimPushResult.fail("该流水无有效认领分摊,无法推送");
|
||||
}
|
||||
List<Long> settlementIds = allocations.stream()
|
||||
.map(ReceiptClaimSettlement::getFormalSettlementId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
Map<Long, FormalSettlement> settlements = settlementIds.isEmpty() ? Map.of()
|
||||
: 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()
|
||||
@@ -819,7 +810,7 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
|
||||
.collect(Collectors.joining("_"));
|
||||
flow.setAwrpSrcCode(awrpSrcCode);
|
||||
|
||||
BfiClaimPushDTO param = buildClaimPushDTO(flow, allocations, settlements);
|
||||
BfiClaimPushDTO param = buildClaimPushDTO(flow, claimedTotal, allocations);
|
||||
log.info("调用BFI接口 收款认领结果推送开始 flowId:{},billId:{},awrpSrcCode:{},分摊明细 {} 行,认领金额 {}",
|
||||
flow.getId(), flow.getBillId(), flow.getAwrpSrcCode(), allocations.size(), claimedTotal);
|
||||
try {
|
||||
@@ -831,10 +822,10 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
|
||||
}
|
||||
|
||||
/**
|
||||
* A301-3 推送报文组装:billid=公告id,分录取各分摊行(一笔流水一张金蝶收款单)
|
||||
* A301-3 推送报文组装:billid=公告id,单条分录、金额=全部未推送金额(一笔流水一张金蝶收款单)
|
||||
*/
|
||||
private BfiClaimPushDTO buildClaimPushDTO(KingdeeReceiptFlow flow, List<ReceiptClaimSettlement> allocations,
|
||||
Map<Long, FormalSettlement> settlements) {
|
||||
private BfiClaimPushDTO buildClaimPushDTO(KingdeeReceiptFlow flow, BigDecimal claimedTotal,
|
||||
List<ReceiptClaimSettlement> allocations) {
|
||||
BfiClaimPushDTO param = new BfiClaimPushDTO();
|
||||
// 【必填】认领公告id
|
||||
param.setBillid(flow.getBillId());
|
||||
@@ -850,25 +841,17 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
|
||||
param.setRecviewpayer(flow.getPayerName());
|
||||
// 【必填】付款人id
|
||||
param.setRecpayer(flow.getPayerId());
|
||||
List<BfiClaimPushEntryDTO> entries = new ArrayList<>();
|
||||
for (ReceiptClaimSettlement allocation : allocations) {
|
||||
BfiClaimPushEntryDTO entry = new BfiClaimPushEntryDTO();
|
||||
// 【必填】应收金额(分摊金额)
|
||||
entry.setEReceivableamt(money(allocation.getAllocatedReceiptAmount()));
|
||||
// 分录行序号(结算单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);
|
||||
// 核心单据编号(结算单id)
|
||||
entry.setECorebillno(String.valueOf(settlement.getId()));
|
||||
}
|
||||
entries.add(entry);
|
||||
}
|
||||
// 【必填】单据体分录
|
||||
param.setEntryentity(entries);
|
||||
// 【必填】单据体分录:仅一条,应收金额=全部未推送金额(累计有效认领)
|
||||
BfiClaimPushEntryDTO entry = new BfiClaimPushEntryDTO();
|
||||
// 【必填】应收金额(全部未推送金额)
|
||||
entry.setEReceivableamt(claimedTotal);
|
||||
// 分录行序号(第一张结算单id,分摊已按结算单id升序,多张取最小)
|
||||
entry.setSeq(allocations.get(0).getFormalSettlementId());
|
||||
// 核心单据类型
|
||||
// entry.setECorebilltype(KingdeeBfiConstant.BFI_CLAIM_CORE_BILL_TYPE);
|
||||
// 核心单据编号(第一张结算单id)
|
||||
entry.setECorebillno(String.valueOf(allocations.get(0).getFormalSettlementId()));
|
||||
param.setEntryentity(List.of(entry));
|
||||
return param;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user