This commit is contained in:
luojiaquan
2026-09-30 16:00:12 +08:00
7 changed files with 51 additions and 47 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) {
@@ -1586,10 +1586,17 @@ public class BmsProductServiceImpl implements IBmsProductService
{
return null;
}
s = s.trim();
// Excel NA markers: / 、- 、— 、N/A
if ("/".equals(s) || "-".equals(s) || "\u2014".equals(s) || "\uff0d".equals(s)
|| "N/A".equalsIgnoreCase(s) || "NA".equalsIgnoreCase(s))
{
return null;
}
// strip currency / unit suffixes: 56、56元、56 RMB
s = s.replace(",", "").replace("\uffe5", "").replace("\u5143", "")
.replace("RMB", "").replace("rmb", "").trim();
if (s.isEmpty())
if (s.isEmpty() || "/".equals(s))
{
return null;
}
@@ -1031,7 +1031,12 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
}
continue;
}
// New band: always insert weight/country row (fees may be null; editable later).
// New band: skip when Excel has no usable fee (blank / slash = no service).
if (freight == null && registration == null)
{
skippedFee++;
continue;
}
PrcPriceSetDetail created = buildDetailFromImportRow(
priceSetId, psvId, productCode, productName, row, freight, registration);
created.setPspId(pspId);
@@ -1041,10 +1046,6 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
{
touched.add(created.getPsdId());
}
if (freight == null && registration == null)
{
skippedFee++;
}
inserted++;
}
}