fix: 收款流水收款金额改取A301-1主单入账金额inneraccountamount
This commit is contained in:
+6
-19
@@ -471,13 +471,14 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
|
||||
if (validRows.containsKey(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) {
|
||||
log.warn("收款流水同步跳过:收款单[{}]流水分录收款金额为空或小于0", recBill.getBillno());
|
||||
log.warn("收款流水同步跳过:收款单[{}]收款金额(inneraccountamount)为空或小于0", recBill.getBillno());
|
||||
skippedCount++;
|
||||
continue;
|
||||
}
|
||||
validRows.put(detailSerialNo, new BfiRecBillRow(recBill, flowEntry, detailSerialNo, receiptAmount));
|
||||
validRows.put(detailSerialNo, new BfiRecBillRow(recBill, detailSerialNo, receiptAmount));
|
||||
}
|
||||
}
|
||||
log.info("收款流水数据校验完成:有效 {} 条,跳过 {} 条", validRows.size(), skippedCount);
|
||||
@@ -579,7 +580,7 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
|
||||
/**
|
||||
* A301-1 收款单查询返回的收款单 + 流水分录展开行(同步过程传递用)
|
||||
*/
|
||||
private record BfiRecBillRow(BfiRecBillVO recBill, BfiRecBillFlowVO flowEntry,
|
||||
private record BfiRecBillRow(BfiRecBillVO recBill,
|
||||
String detailSerialNo, BigDecimal receiptAmount) {
|
||||
}
|
||||
|
||||
@@ -816,7 +817,7 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
|
||||
target.setPayerName(trimToEmpty(source.getPayername()));
|
||||
// 收款人(收款公司名称)
|
||||
target.setPayeeName(trimToNull(source.getOrgName()));
|
||||
// 收款金额(流水分录金额)
|
||||
// 收款金额(主单入账金额 inneraccountamount)
|
||||
target.setReceiptAmount(row.receiptAmount());
|
||||
// 对方单位名称(取付款人名称)
|
||||
target.setCounterpartyName(trimToEmpty(source.getPayername()));
|
||||
@@ -859,20 +860,6 @@ public class ReceiptFlowServiceImpl extends BaseServiceImpl<KingdeeReceiptFlowMa
|
||||
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) {
|
||||
for (String value : values) {
|
||||
if (Func.isNotEmpty(value)) {
|
||||
|
||||
Reference in New Issue
Block a user