修改去空格

This commit is contained in:
wuweihua
2026-11-06 19:27:31 +08:00
committed by caojia
parent e0dc755ee3
commit 4cb82ec107
6 changed files with 51 additions and 35 deletions
@@ -168,6 +168,35 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
return (str == null ? "" : str.trim());
}
/**
* Normalize destination postcode for zone match / persist.
* Removes all Unicode whitespace (incl. NBSP / U+2005) and ASCII spaces;
* strips Excel-style trailing ".0" on pure digits.
*/
public static String normalizePostcode(String postcode)
{
if (isEmpty(postcode))
{
return postcode;
}
StringBuilder sb = new StringBuilder(postcode.length());
for (int i = 0; i < postcode.length(); )
{
int cp = postcode.codePointAt(i);
if (!Character.isWhitespace(cp))
{
sb.appendCodePoint(cp);
}
i += Character.charCount(cp);
}
String n = sb.toString();
if (n.endsWith(".0") && n.matches("\\d+\\.0"))
{
return n.substring(0, n.length() - 2);
}
return n;
}
/**
* 替换指定字符串的指定区间内字符为"*"
*
@@ -47,7 +47,7 @@ public class OracleOrderBillMapper
req.setCountryCode(firstStr(row, "COUNTRY"));
String countryName = firstStr(row, "COUNTRY_NAME", "COUNTRY_EINGTH_NAME", "COUNTRY");
req.setCountryName(countryName);
req.setDestPostcode(firstStr(row, "CONSIGNEE_POSTCODE"));
req.setDestPostcode(StringUtils.normalizePostcode(firstStr(row, "CONSIGNEE_POSTCODE")));
// Prefer CONFIRM_WEIGHT (customer confirmed); fallback DIMENSIONAL_WEIGHT_FACTOR (charge weight).
BigDecimal weight = firstPositiveDecimal(row, "CONFIRM_WEIGHT", "DIMENSIONAL_WEIGHT_FACTOR");
req.setWeight(weight);
@@ -3324,7 +3324,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
bill.setPkgHeight(request.getPkgHeight());
bill.setShipperName(request.getShipperName());
bill.setConsigneeName(request.getConsigneeName());
bill.setDestPostcode(request.getDestPostcode());
bill.setDestPostcode(StringUtils.normalizePostcode(request.getDestPostcode()));
bill.setWarehouseCode(request.getWarehouseCode());
bill.setOrderTime(request.getOrderTime());
applyUpstreamOrderStatus(bill, request);
@@ -783,15 +783,7 @@ public class PrcZoneServiceImpl implements IPrcZoneService
private static String normalizePostcode(String postcode)
{
if (StringUtils.isEmpty(postcode))
{
return postcode;
}
if (postcode.endsWith(".0") && postcode.matches("\\d+\\.0"))
{
return postcode.substring(0, postcode.length() - 2);
}
return postcode;
return StringUtils.normalizePostcode(postcode);
}
private static String normalizeCell(String text)
@@ -388,7 +388,11 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
}
// Charge weight keeps 3 decimals; freight unit price keeps 2 (see buildFromRates).
BigDecimal weight = request.getWeight().setScale(3, RoundingMode.HALF_UP);
String destPostcode = emptyToNull(request.getDestPostcode());
String destPostcode = emptyToNull(normalizePostcode(request.getDestPostcode()));
if (destPostcode != null)
{
request.setDestPostcode(destPostcode);
}
String productName = null;
if (request instanceof TmsPriceBillRequest)
{
@@ -992,16 +996,7 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
private static String normalizePostcode(String postcode)
{
if (StringUtils.isEmpty(postcode))
{
return postcode;
}
String n = postcode.trim().replace(" ", "");
if (n.endsWith(".0") && n.matches("\\d+\\.0"))
{
return n.substring(0, n.length() - 2);
}
return n;
return StringUtils.normalizePostcode(postcode);
}
private TmsPriceQuoteResult tryFixed(PrcCustomerPriceSet bind, PrcPriceSet set, PrcPriceSetVersion version,
+13 -13
View File
@@ -622,19 +622,6 @@ const searchColumns = [
collapseTagsTooltip: true
}
},
{
label: '\u8ba1\u8d39\u5931\u8d25',
prop: 'billingFailStatuses',
component: 'select',
options: billingFailStatusOptions,
placeholder: '\u8bf7\u9009\u62e9',
props: {
multiple: true,
clearable: true,
collapseTags: true,
collapseTagsTooltip: true
}
},
{
label: '计费时间',
prop: 'bizDateRange',
@@ -655,6 +642,19 @@ const searchColumns = [
clearable: true,
defaultTime: [new Date(2000, 0, 1, 0, 0, 0), new Date(2000, 0, 1, 23, 59, 59)]
}
},
{
label: '\u8ba1\u8d39\u5931\u8d25',
prop: 'billingFailStatuses',
component: 'select',
options: billingFailStatusOptions,
placeholder: '\u8bf7\u9009\u62e9',
props: {
multiple: true,
clearable: true,
collapseTags: true,
collapseTagsTooltip: true
}
}
]