fix: A301-3 成功响应 number 为空,金蝶收款单号取回执 keys.awrp_src_code;A301-1 回写命中后以真实收款单号覆盖占位

This commit is contained in:
刘泉佳
2026-09-29 11:25:58 +08:00
parent 15599e894d
commit fe7a940201
3 changed files with 22 additions and 6 deletions
@@ -334,7 +334,9 @@ public class ReceiptClaimRecordServiceImpl extends BaseServiceImpl<ReceiptClaimM
// 窗口内未查到:金蝶回单延迟/状态未同步,不改状态,由下次回写或人工处置兜底
continue;
}
if (Func.isEmpty(flow.getKingdeeBillNo())) {
// 推送成功时金蝶收款单号先以来源编码占位(A301-3 响应 number 为空,取回执 keys.awrp_src_code),
// 回写命中后以金蝶真实收款单号覆盖
if (Func.isNotEmpty(bill.getBillno())) {
flow.setKingdeeBillNo(bill.getBillno());
}
flow.setKingdeeBillStatus(billStatusOf(bill.getBillstatus()));
@@ -856,7 +856,8 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
}
/**
* 解析 A301-3 推送结果:全项成功返回金蝶收款单号,否则抛出汇总错误文本(由失败路径落库)
* 解析 A301-3 推送结果:全项成功返回单据号,否则抛出汇总错误文本(由失败路径落库)。
* 成功响应的 number 为空,金蝶收款单号取回执 keys 中的 awrp_src_code(来源编码)。
*/
private String extractClaimPushBillNo(BfiBillSaveResultVO result) {
if (result == null || result.getResult() == null || result.getResult().isEmpty()) {
@@ -872,8 +873,20 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
throw new ServiceException("金蝶认领结果推送失败"
+ (errorText.isEmpty() ? "" : ":" + errorText));
}
return items.stream().map(BfiBillSaveResultItemVO::getNumber)
.filter(Func::isNotEmpty).findFirst().orElse(null);
return items.stream()
.map(this::claimPushBillNoOf)
.filter(Func::isNotEmpty)
.findFirst().orElse(null);
}
/**
* 单项推送结果 → 单据号:A301-3 成功响应 number 为空,取回执键值中的 awrp_src_code
*/
private String claimPushBillNoOf(BfiBillSaveResultItemVO item) {
if (Func.isNotEmpty(item.getNumber())) {
return item.getNumber();
}
return item.getKeys() == null ? null : item.getKeys().get("awrp_src_code");
}
/**
@@ -122,7 +122,8 @@ claimed 累计有效认领 == unclaimed_amount(且 > 0) ← 「认领
seq / e_corebillno = 第一张结算单id(分摊按结算单id升序,多张取最小)
⑥ 调 pushClaimResult:
成功 → push_status=pushed、push_fail_reason 清空、pushed_time=now、
kingdee_bill_no=响应 number、kingdee_bill_status=pushed;
kingdee_bill_no=响应 number(**A301-3 成功响应 number 为空,取回执 keys.awrp_src_code 即来源编码占位**)、
kingdee_bill_status=pushed;
级联刷新该流水名下全部未作废认领主单的 kingdee_bill_no/kingdee_bill_status
失败 → push_status=failed、push_fail_reason=金蝶错误文本汇总(认领数据不回滚)
⑦ 推送动作留痕(blade_receipt_flow_record,operation=push)
@@ -164,7 +165,7 @@ claimed 累计有效认领 == unclaimed_amount(且 > 0) ← 「认领
- 扫描:`push_status = pushed` 且 `kingdee_bill_status IN (pushed, approved)` 的流水;
- 匹配:金蝶收款单 `sourcebillnumber == 流水.awrp_src_code`(一流水一码,无歧义);
- 回写:`flow.kingdee_bill_no / kingdee_bill_status`(状态映射不变:A/B→pushed、C→approved、D→received、其他→failed),并级联刷新名下未作废认领主单的冗余字段;
- 回写:`flow.kingdee_bill_status` 按状态映射推进(A/B→pushed、C→approved、D→received、其他→failed);`kingdee_bill_no` 以金蝶真实收款单号**覆盖**推送时的来源编码占位,并级联刷新名下未作废认领主单的冗余字段;
- 定时接入复用现有任务风格(`thirdParty.bfi.receiptClaimResult.*`,本期仍可手动触发)。
### 4.6 作废(不变 + 两点明确)