This commit is contained in:
2026-08-21 10:38:28 +08:00
parent 361e6be3be
commit d5e9ba6d4c
21 changed files with 1705 additions and 15 deletions
@@ -2,6 +2,7 @@ package com.baiyue.lastleg.inventory.query.dto;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
@@ -10,8 +11,8 @@ public final class InventoryQueryRequests {
}
public record BalanceQuery(
@Min(1) long page,
@Min(1) @Max(200) long size,
@Min(1) @Schema(defaultValue = "1", minimum = "1") Long page,
@Min(1) @Max(200) @Schema(defaultValue = "20", minimum = "1", maximum = "200") Long size,
String customerName,
String overseasWarehouseId,
String overseasWarehouseCode,
@@ -26,8 +27,8 @@ public final class InventoryQueryRequests {
String inventoryStatus
) {
public BalanceQuery {
if (page == 0) page = 1;
if (size == 0) size = 20;
if (page == null || page == 0) page = 1L;
if (size == null || size == 0) size = 20L;
}
}
@@ -35,8 +36,8 @@ public final class InventoryQueryRequests {
}
public record LedgerQuery(
@Min(1) long page,
@Min(1) @Max(200) long size,
@Min(1) @Schema(defaultValue = "1", minimum = "1") Long page,
@Min(1) @Max(200) @Schema(defaultValue = "20", minimum = "1", maximum = "200") Long size,
String overseasWarehouseId,
String destinationWarehouseCode,
String businessType,
@@ -52,8 +53,8 @@ public final class InventoryQueryRequests {
LocalDateTime occurredTo
) {
public LedgerQuery {
if (page == 0) page = 1;
if (size == 0) size = 20;
if (page == null || page == 0) page = 1L;
if (size == null || size == 0) size = 20L;
}
}
}
@@ -40,6 +40,9 @@ public class PartnerWarehouseDirectory {
.map(value -> new OverseasQuoteResponses.PartnerWarehouseOption(value.id().toString(),
value.warehouseCode(), value.warehouseName(), value.countryCode()))
.toList();
// An empty directory can be a short-lived cross-region visibility gap after a partner
// warehouse is created. Do not preserve that absence for the normal 30-minute TTL.
if (options.isEmpty()) return List.of();
snapshot = new Snapshot(options, now.plus(ttl));
return snapshot.options();
}