✨ 金蝶财务应付单分录送税率编码(taxrateid_number),税率映射Nacos可维护

This commit is contained in:
刘泉佳
2026-11-05 00:16:38 +08:00
parent af3487a7da
commit 8d189eb0d5
5 changed files with 61 additions and 1 deletions
@@ -148,6 +148,20 @@ public class BfiProperties {
*/
private Material material = new Material();
/**
* 金蝶税率编码映射(A102-2 财务应付单分录 taxrateid_number):税率数值 -> 金蝶税率.编码(如 9 -> V9),
* 键为税率数值文本(如 "9"、"6.5"),推送时按分录税率查表;未维护该税率时直接拦截报错;
* 分录无税率(计费方案未配置税率组/残差组/手动结算合计费用行)时税率与税率编码均不送
*/
private Map<String, String> taxrate = new LinkedHashMap<>() {{
put("0", "V0");
put("1", "V1");
put("3", "V3");
put("6", "V6");
put("9", "V9");
put("13", "V13");
}};
/**
* 付款申请推送配置项
*/
@@ -383,6 +383,8 @@ public class KingdeeApBillSyncSupport {
entry.setEAmount(entryGroup.amountNoTax());
// 税率(%):合同计费方案规则税率(按税率拆行维度),未配置税率/结算合计费用项行不送,金蝶按默认带出
entry.setTaxrate(entryGroup.taxRate());
// 税率编码(taxrateid_number):thirdparty.bfi.taxrate 配置 税率数值->编码,未维护该税率拦截报错
entry.setTaxrateidNumber(taxrateCode(entryGroup.taxRate()));
// 【必填】项目.项目编码:开关开启取项目档案真实编码(金蝶档案须已存在且编码一致),未关联项目兜底 999
entry.setProjectNumber(this.kingdeeProjectNumber(settlement.getProjectId(), context));
// 【必填】外部系统来源分录标识(候选键):结算明细行取单据号,结算合计费用项行取结算单号-费用类型-费用项拼接
@@ -655,6 +657,28 @@ public class KingdeeApBillSyncSupport {
return text != null && text.contains("国际");
}
/**
* 金蝶税率编码(taxrateid_number):thirdparty.bfi.taxrate 配置 税率数值 -> 编码(如 9 -> V9),
* 税率为空(无税率组/手动结算合计费用行)返回 null 不送;配置未维护该税率时直接拦截报错
* (与物料映射拦截口径一致),税率数值键去除尾零精确匹配(9.00 按 "9" 匹配)
*
* @param taxRate 分录税率(百分数,来自合同计费方案规则)
* @return 金蝶税率.编码,无税率为 null
*/
private String taxrateCode(BigDecimal taxRate) {
if (taxRate == null) {
return null;
}
String rateKey = taxRate.stripTrailingZeros().toPlainString();
String code = bfiProperties.getTaxrate() == null ? null : bfiProperties.getTaxrate().get(rateKey);
if (Func.isBlank(code)) {
throw new ServiceException("推送金蝶财务应付单失败:税率[" + rateKey + "%]未在配置 thirdparty.bfi.taxrate 中维护税率编码,请补充后重试");
}
// 税率编码映射判定依据(联调排查:税率 -> 金蝶税率档案编码)
log.info("金蝶税率编码映射: 税率[{}%] -> 编码[{}]", rateKey, code);
return code.trim();
}
/**
* 合同计费方案规则税率解析:费用类型/费用项 -> 税率(取首个配置了税率的规则,
* 计费方案 JSON 解析失败按未配置处理,由税率分组处兜底为无税率组)
@@ -98,7 +98,7 @@ public class BfiApBillSaveEntryDTO implements Serializable {
*/
private Boolean ispresent = Boolean.FALSE;
/**
* 税率.编码,城矿传 V13(BfiConstant.TAX_RATE_V13)
* 税率.编码,按 thirdparty.bfi.taxrate 配置的 税率数值-&gt;编码 映射取值(如 9 -&gt; V9),未维护该税率拦截报错
*/
@JsonProperty("taxrateid_number")
private String taxrateidNumber;
+11
View File
@@ -190,6 +190,17 @@ thirdParty:
# 仓储大类、手动添加仓储费用物料编码(仓储)
warehouse: ${BFI_MATERIAL_WAREHOUSE:XDWL11002001}
# 金蝶税率编码映射(A102-2 财务应付单分录 taxrateid_number):税率数值 -> 税率.编码(如 9 -> V9),
# 键为税率数值文本(含小数税率如 "[6.5]"),未维护该税率时推送拦截报错;
# 分录无税率(计费方案未配置税率组/残差组/手动结算合计费用行)时税率与税率编码均不送
taxrate:
"[0]": ${BFI_TAXRATE_0:V0}
"[1]": ${BFI_TAXRATE_1:V1}
"[3]": ${BFI_TAXRATE_3:V3}
"[6]": ${BFI_TAXRATE_6:V6}
"[9]": ${BFI_TAXRATE_9:V9}
"[13]": ${BFI_TAXRATE_13:V13}
# 付款申请推送配置(A103-3 付款申请保存)
payApply:
# 单据类型编码:ap_payapply_BT_S 采购付款申请、ap_payapply_oth_BT_S 其他付款申请
+11
View File
@@ -91,6 +91,17 @@ thirdParty:
loading: ${BFI_MATERIAL_LOADING:XDWL11002004}
# 仓储大类、手动添加仓储费用物料编码(仓储)
warehouse: ${BFI_MATERIAL_WAREHOUSE:XDWL11002001}
# 金蝶税率编码映射(A102-2 财务应付单分录 taxrateid_number):税率数值 -> 税率.编码(如 9 -> V9),
# 键为税率数值文本(含小数税率如 "[6.5]"),未维护该税率时推送拦截报错;
# 分录无税率(计费方案未配置税率组/残差组/手动结算合计费用行)时税率与税率编码均不送
taxrate:
"[0]": ${BFI_TAXRATE_0:V0}
"[1]": ${BFI_TAXRATE_1:V1}
"[3]": ${BFI_TAXRATE_3:V3}
"[6]": ${BFI_TAXRATE_6:V6}
"[9]": ${BFI_TAXRATE_9:V9}
"[13]": ${BFI_TAXRATE_13:V13}
# 付款申请推送配置(A103-3 付款申请保存)
payApply:
# 单据类型编码:ap_payapply_BT_S 采购付款申请、ap_payapply_oth_BT_S 其他付款申请