🐛 修复应收账单单价和处理费快照

This commit is contained in:
caojia
2026-09-30 14:47:18 +08:00
parent 90cde8da4a
commit 4475bff243
5 changed files with 37 additions and 41 deletions
@@ -34,6 +34,10 @@ public class ArBillDetail implements Serializable {
private BigDecimal actualWeight;
private BigDecimal volumeWeight;
private BigDecimal chargeWeight;
/** 订单计费时命中的运费单价快照,对应 prc_order_bill.freight_rate。 */
private BigDecimal freightRate;
/** 订单计费时的标准处理费快照,对应 prc_order_bill.registration_fee。 */
private BigDecimal registrationFee;
private BigDecimal pkgLength;
private BigDecimal pkgWidth;
private BigDecimal pkgHeight;
@@ -1142,6 +1142,8 @@ public class ArBillServiceImpl implements IArBillService {
detail.setActualWeight(source.getActualWeight());
detail.setVolumeWeight(source.getVolumeWeight());
detail.setChargeWeight(source.getChargeWeight() == null ? source.getWeight() : source.getChargeWeight());
detail.setFreightRate(source.getFreightRate());
detail.setRegistrationFee(source.getRegistrationFee());
detail.setPkgLength(source.getPkgLength());
detail.setPkgWidth(source.getPkgWidth());
detail.setPkgHeight(source.getPkgHeight());
@@ -1614,42 +1616,11 @@ public class ArBillServiceImpl implements IArBillService {
}
private BigDecimal exportUnitPrice(ArBillDetail detail) {
BigDecimal direct = firstFeeUnitPrice(detail.getFees());
if (direct != null) {
return direct;
}
BigDecimal freight = feeAmount(detail, "BASIC_FREIGHT");
if (freight == null || detail.getChargeWeight() == null || detail.getChargeWeight().compareTo(BigDecimal.ZERO) <= 0) {
return null;
}
return freight.divide(detail.getChargeWeight(), 4, java.math.RoundingMode.HALF_UP);
}
private BigDecimal firstFeeUnitPrice(List<ArBillDetailFee> fees) {
if (fees == null) {
return null;
}
for (ArBillDetailFee fee : fees) {
if (fee.getUnitPrice() != null) {
return fee.getUnitPrice();
}
}
return null;
return detail == null ? null : detail.getFreightRate();
}
private BigDecimal exportProcessingFee(ArBillDetail detail) {
BigDecimal total = BigDecimal.ZERO;
boolean found = false;
if (detail.getFees() != null) {
for (ArBillDetailFee fee : detail.getFees()) {
String name = fee.getFeeName() == null ? "" : fee.getFeeName();
if ("REGISTRATION_FEE".equalsIgnoreCase(fee.getFeeType()) || name.contains("处理费")) {
total = total.add(nvl(fee.getAmount()));
found = true;
}
}
}
return found ? total : null;
return detail == null ? null : detail.getRegistrationFee();
}
private String exportFormula(ArBillDetail detail) {