fix: print overseas warehouse address on BOL

This commit is contained in:
2026-09-11 11:55:46 +08:00
parent 749d403ed4
commit 69076ea712
4 changed files with 26 additions and 7 deletions
@@ -102,9 +102,12 @@ public class DispatchBolPrintService {
List<String> parts = new ArrayList<>();
add(parts, address.addressLine1());
add(parts, address.addressLine2());
add(parts, address.city());
add(parts, address.stateProvince());
add(parts, address.postalCode());
String city = trimmed(address.city());
String state = trimmed(address.stateProvince());
String postalCode = trimmed(address.postalCode());
String region = city == null ? state : state == null ? city : city + ", " + state;
if (postalCode != null) region = region == null ? postalCode : region + " " + postalCode;
add(parts, region);
add(parts, address.countryCode());
return parts.isEmpty() ? "—" : String.join(", ", parts);
} catch (FeignException exception) {
@@ -116,6 +119,10 @@ public class DispatchBolPrintService {
if (value != null && !value.isBlank()) parts.add(value.strip());
}
private String trimmed(String value) {
return value == null || value.isBlank() ? null : value.strip();
}
static int pageCount(int rowCount) {
if (rowCount <= FIRST_PAGE_ROWS) return 1;
return 1 + (rowCount - FIRST_PAGE_ROWS + CONTINUATION_PAGE_ROWS - 1) / CONTINUATION_PAGE_ROWS;