新增打单产品明细保存接口,优化附加费管理逻辑

This commit is contained in:
wuweihua
2026-11-12 16:53:40 +08:00
parent 90147ed4e3
commit 8ca5af1ff0
10 changed files with 200 additions and 97 deletions
@@ -73,10 +73,4 @@ public class PaySurcharge
private BigDecimal weightMax;
private Integer sortNo;
/**
* 是否计费并落库:false 不写入 pay_surcharge;null/缺省视为要计费(兼容应付全量保存)。
* 仅作为前端传参,不落库字段。
*/
private Boolean needBill;
}
@@ -461,8 +461,6 @@ public class PayProductServiceImpl implements IPayProductService
{
product.setExtraLines(new ArrayList<>());
}
// 计数前先按「是否计费」过滤,与落库行数一致
retainBillableSurcharges(product);
product.setWeightCount(product.getWeightBands().size());
product.setSurchargeCount(product.getSurcharges().size());
product.setExtraCount(product.getExtraLines().size());
@@ -1531,7 +1529,6 @@ public class PayProductServiceImpl implements IPayProductService
private void insertSurcharges(PayProduct product)
{
retainBillableSurcharges(product);
List<PaySurcharge> rows = product.getSurcharges();
if (rows == null || rows.isEmpty())
{
@@ -1550,27 +1547,6 @@ public class PayProductServiceImpl implements IPayProductService
}
}
/**
* 仅保留需要计费的附加费:needBill=false 不入库;null 视为要计费。
*/
private void retainBillableSurcharges(PayProduct product)
{
List<PaySurcharge> rows = product.getSurcharges();
if (rows == null || rows.isEmpty())
{
return;
}
List<PaySurcharge> kept = new ArrayList<PaySurcharge>();
for (PaySurcharge fee : rows)
{
if (fee != null && !Boolean.FALSE.equals(fee.getNeedBill()))
{
kept.add(fee);
}
}
product.setSurcharges(kept);
}
/**
* 按附加费名称映射 prc_surcharge.sc_id;币种不能为空:附加费 -> 价卡 -> EUR。
*/