fix: 收款流水收款金额改取A301-1主单入账金额inneraccountamount

This commit is contained in:
刘泉佳
2026-10-29 14:16:44 +08:00
parent 459d818724
commit d2bd36b4f8
4 changed files with 13 additions and 21 deletions
@@ -89,7 +89,7 @@ public class KingdeeReceiptFlow extends TenantEntity {
*/ */
private String payerName; private String payerName;
/** /**
* 收款金额(A301-1 流水分录 bei_creditamount,兜底主单 actrecamt) * 收款金额(A301-1 主单入账金额 inneraccountamount)
*/ */
private BigDecimal receiptAmount; private BigDecimal receiptAmount;
/** /**
@@ -471,13 +471,14 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
if (validRows.containsKey(detailSerialNo)) { if (validRows.containsKey(detailSerialNo)) {
throw new ServiceException("明细流水号" + detailSerialNo + "重复"); throw new ServiceException("明细流水号" + detailSerialNo + "重复");
} }
BigDecimal receiptAmount = parseEntryAmount(flowEntry.getBeiCreditamount(), recBill.getActrecamt()); // 收款金额取主单入账金额 inneraccountamount(金蝶口径,非流水分录 bei_creditamount)
BigDecimal receiptAmount = money(recBill.getInneraccountAmount());
if (receiptAmount.compareTo(BigDecimal.ZERO) <= 0) { if (receiptAmount.compareTo(BigDecimal.ZERO) <= 0) {
log.warn("收款流水同步跳过:收款单[{}]流水分录收款金额为空或小于0", recBill.getBillno()); log.warn("收款流水同步跳过:收款单[{}]收款金额(inneraccountamount)为空或小于0", recBill.getBillno());
skippedCount++; skippedCount++;
continue; continue;
} }
validRows.put(detailSerialNo, new BfiRecBillRow(recBill, flowEntry, detailSerialNo, receiptAmount)); validRows.put(detailSerialNo, new BfiRecBillRow(recBill, detailSerialNo, receiptAmount));
} }
} }
log.info("收款流水数据校验完成:有效 {} 条,跳过 {} 条", validRows.size(), skippedCount); log.info("收款流水数据校验完成:有效 {} 条,跳过 {} 条", validRows.size(), skippedCount);
@@ -579,7 +580,7 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
/** /**
* A301-1 收款单查询返回的收款单 + 流水分录展开行(同步过程传递用) * A301-1 收款单查询返回的收款单 + 流水分录展开行(同步过程传递用)
*/ */
private record BfiRecBillRow(BfiRecBillVO recBill, BfiRecBillFlowVO flowEntry, private record BfiRecBillRow(BfiRecBillVO recBill,
String detailSerialNo, BigDecimal receiptAmount) { String detailSerialNo, BigDecimal receiptAmount) {
} }
@@ -816,7 +817,7 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
target.setPayerName(trimToEmpty(source.getPayername())); target.setPayerName(trimToEmpty(source.getPayername()));
// 收款人(收款公司名称) // 收款人(收款公司名称)
target.setPayeeName(trimToNull(source.getOrgName())); target.setPayeeName(trimToNull(source.getOrgName()));
// 收款金额(流水分录金额) // 收款金额(主单入账金额 inneraccountamount)
target.setReceiptAmount(row.receiptAmount()); target.setReceiptAmount(row.receiptAmount());
// 对方单位名称(取付款人名称) // 对方单位名称(取付款人名称)
target.setCounterpartyName(trimToEmpty(source.getPayername())); target.setCounterpartyName(trimToEmpty(source.getPayername()));
@@ -859,20 +860,6 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
return KingdeeBfiConstant.KINGDEE_STATUS_FAILED; return KingdeeBfiConstant.KINGDEE_STATUS_FAILED;
} }
/**
* 流水分录收款金额解析:bei_creditamount 为字符串,空或非法时回退主单收款金额
*/
private BigDecimal parseEntryAmount(String entryAmount, BigDecimal fallbackAmount) {
if (Func.isNotEmpty(entryAmount)) {
try {
return new BigDecimal(entryAmount.trim());
} catch (NumberFormatException exception) {
log.warn("解析金蝶流水分录收款金额失败,原始值:{},回退主单收款金额", entryAmount);
}
}
return money(fallbackAmount);
}
private String firstNonBlank(String... values) { private String firstNonBlank(String... values) {
for (String value : values) { for (String value : values) {
if (Func.isNotEmpty(value)) { if (Func.isNotEmpty(value)) {
@@ -135,6 +135,11 @@ public class BfiRecBillVO implements Serializable {
*/ */
@JsonProperty("txt_description") @JsonProperty("txt_description")
private String txtDescription; private String txtDescription;
/**
* 收款金额(入账金额,收款流水收款金额取此字段)
*/
@JsonProperty("inneraccountamount")
private BigDecimal inneraccountAmount;
/** /**
* 收款金额 * 收款金额
*/ */
@@ -74,7 +74,7 @@ A301-1 收款单查询(业务日期窗口取 `thirdParty.bfi.recBillSync.days`
| receipt_notice_no / kingdee_bill_no | `billno` | 金蝶收款单号(两处同值) | | receipt_notice_no / kingdee_bill_no | `billno` | 金蝶收款单号(两处同值) |
| kingdee_bill_status | `billstatus` 映射 | A/B已提交→pushed、C已审核→approved、D已收款→received、其余(含G退单)→failed | | kingdee_bill_status | `billstatus` 映射 | A/B已提交→pushed、C已审核→approved、D已收款→received、其余(含G退单)→failed |
| detail_serial_no | `infoentry[].bei_detailid`,兜底 `bei_bankdetailno` | **幂等键**;每条流水分录展开为一行流水 | | detail_serial_no | `infoentry[].bei_detailid`,兜底 `bei_bankdetailno` | **幂等键**;每条流水分录展开为一行流水 |
| receipt_amount | `infoentry[].bei_creditamount`,兜底主单 `actrecamt` | 流水分录收款金额 | | receipt_amount | 主单 `inneraccountamount` | 收款金额(入账金额口径,非流水分录 bei_creditamount) |
| unclaimed_amount | `unmatchamountrec` | 未匹配收款金额,**认领上限口径** | | unclaimed_amount | `unmatchamountrec` | 未匹配收款金额,**认领上限口径** |
| payer_name / counterparty_name | `payername` | 付款人名称 | | payer_name / counterparty_name | `payername` | 付款人名称 |
| payee_name | `org_name` | 收款公司名称 | | payee_name | `org_name` | 收款公司名称 |