暂存提交

This commit is contained in:
2026-08-19 16:24:02 +08:00
parent f5c4bf130a
commit 6acb6178da
354 changed files with 25000 additions and 198 deletions
@@ -0,0 +1,9 @@
package com.baiyue.warehouse.dto;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Positive;
public final class DropshipPalletRequests {
private DropshipPalletRequests() {}
public record Ensure(@Positive long customerId, @Positive long warehouseId, @NotBlank String businessId) {}
}
@@ -0,0 +1,39 @@
package com.baiyue.warehouse.dto;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.math.BigDecimal;
public final class LocationRequests {
private LocationRequests() {
}
public record SaveRequest(
@NotBlank @Size(max = 50) String zoneCode,
@NotBlank @Size(max = 64) String locationCode,
@NotBlank @Size(max = 32) String locationType,
@NotNull @DecimalMin(value = "0.000", inclusive = false) BigDecimal maxLoadKg,
@NotBlank String status,
@Size(max = 500) String remark
) {
}
public record QueryRequest(
@Min(1) long page,
@Min(1) @Max(200) long size,
String zoneCode,
String locationType,
String status,
String keyword
) {
public QueryRequest {
if (page == 0) page = 1;
if (size == 0) size = 20;
}
}
}
@@ -0,0 +1,45 @@
package com.baiyue.warehouse.dto;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import java.math.BigDecimal;
public final class PalletRequests {
private static final BigDecimal DEFAULT_CAPACITY = new BigDecimal("2.0000");
private PalletRequests() {
}
public record SaveRequest(
@Size(max = 128) String palletCode,
@NotBlank @Size(max = 32) String palletType,
@DecimalMin(value = "0.0000", inclusive = false) BigDecimal capacityCbm,
@NotNull @DecimalMin("0.00") BigDecimal unitPrice,
@NotBlank String status,
Long locationId,
@Size(max = 500) String remark
) {
public SaveRequest {
if (capacityCbm == null) capacityCbm = DEFAULT_CAPACITY;
}
}
public record QueryRequest(
@Min(1) long page,
@Min(1) @Max(200) long size,
String palletType,
String status,
Long locationId,
String keyword
) {
public QueryRequest {
if (page == 0) page = 1;
if (size == 0) size = 20;
}
}
}
@@ -0,0 +1,19 @@
package com.baiyue.warehouse.dto;
import com.baiyue.warehouse.entity.ServiceCapabilityEntity;
import com.baiyue.warehouse.entity.WarehouseAddressEntity;
import com.baiyue.warehouse.entity.WarehouseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
/**
* 仓库聚合详情响应,组合仓库主数据、地址列表和服务能力列表。
*/
@Schema(name = "WarehouseDetailResponse", description = "Warehouse aggregate details / 仓库聚合详情")
public record WarehouseDetailResponse(
@Schema(description = "Warehouse master data / 仓库主数据") WarehouseEntity warehouse,
@Schema(description = "Warehouse addresses / 仓库地址列表") List<WarehouseAddressEntity> addresses,
@Schema(description = "Warehouse service capabilities / 仓库服务能力列表") List<ServiceCapabilityEntity> capabilities
) {
}
@@ -0,0 +1,4 @@
package com.baiyue.warehouse.dto;
public record WarehousePalletScrapResponse(long palletId, long warehouseId, Long locationId, String status) {
}
@@ -0,0 +1,117 @@
package com.baiyue.warehouse.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalTime;
import java.util.List;
/**
* 仓库接口请求模型容器,集中定义仓库保存、地址、服务能力、查询和状态变更请求契约。
*/
public final class WarehouseRequests {
private WarehouseRequests() {
}
@Schema(name = "WarehouseSaveRequest", description = "Warehouse create or update request / 仓库新增或更新请求")
public record SaveRequest(
@Schema(description = "Target tenant ID / 目标租户 ID", example = "10001", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull Long customerId,
@Schema(description = "Tenant-unique warehouse code / 租户内唯一仓库编码", example = "US-LAX-01", maxLength = 50, requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank @Size(max = 50) String warehouseCode,
@Schema(description = "Warehouse name / 仓库名称", example = "Los Angeles Main Warehouse / 洛杉矶主仓", maxLength = 120, requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank @Size(max = 120) String warehouseName,
@Schema(description = "Warehouse type / 仓库类型", example = "OVERSEAS", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank String warehouseType,
@Schema(description = "ISO 3166-1 alpha-2 country code / ISO 两位国家代码", example = "US", pattern = "[A-Z]{2}", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank @Pattern(regexp = "[A-Z]{2}") String countryCode,
@Schema(description = "IANA timezone / IANA 时区", example = "America/Los_Angeles", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank String timezone,
@Schema(description = "Contact name / 联系人姓名", example = "Alex Chen", maxLength = 64)
@Size(max = 64) String contactName,
@Schema(description = "Contact phone / 联系电话", example = "+1-213-555-0100", maxLength = 32)
@Size(max = 32) String contactPhone,
@Schema(description = "Contact email / 联系邮箱", example = "warehouse@example.com")
@Email String contactEmail,
@Schema(description = "Warehouse status / 仓库状态", example = "ACTIVE", allowableValues = {"ACTIVE", "INACTIVE"}, requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank String status,
@Schema(description = "Remark / 备注", example = "Supports appointment receiving / 支持预约入库", maxLength = 500)
@Size(max = 500) String remark,
@Schema(description = "Primary warehouse address / 仓库主地址", requiredMode = Schema.RequiredMode.REQUIRED)
@Valid @NotNull AddressRequest address,
@Schema(description = "Supported service capabilities / 支持的服务能力")
@Valid List<CapabilityRequest> capabilities
) {
}
@Schema(name = "WarehouseAddressRequest", description = "Warehouse address / 仓库地址")
public record AddressRequest(
@Schema(description = "Address type / 地址类型", example = "WAREHOUSE", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank String addressType,
@Schema(description = "ISO two-letter country code / ISO 两位国家代码", example = "US", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank @Pattern(regexp = "[A-Z]{2}") String countryCode,
@Schema(description = "State or province / 州或省", example = "California", maxLength = 100)
@Size(max = 100) String stateProvince,
@Schema(description = "City / 城市", example = "Los Angeles", maxLength = 100, requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank @Size(max = 100) String city,
@Schema(description = "District / 区县", example = "Commerce", maxLength = 100)
@Size(max = 100) String district,
@Schema(description = "Postal code / 邮政编码", example = "90040", maxLength = 20)
@Size(max = 20) String postalCode,
@Schema(description = "Address line 1 / 地址第一行", example = "123 Logistics Ave", maxLength = 255, requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank @Size(max = 255) String addressLine1,
@Schema(description = "Address line 2 / 地址第二行", example = "Building A", maxLength = 255)
@Size(max = 255) String addressLine2,
@Schema(description = "Latitude / 纬度", example = "34.052235")
BigDecimal latitude,
@Schema(description = "Longitude / 经度", example = "-118.243683")
BigDecimal longitude
) {
}
@Schema(name = "WarehouseCapabilityRequest", description = "Warehouse service capability / 仓库服务能力")
public record CapabilityRequest(
@Schema(description = "Capability code / 能力编码", example = "STORAGE", maxLength = 50, requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank @Size(max = 50) String capabilityCode,
@Schema(description = "Capability name / 能力名称", example = "Storage / 仓储", maxLength = 100, requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank @Size(max = 100) String capabilityName,
@Schema(description = "Whether enabled / 是否启用", example = "true", defaultValue = "true")
Boolean enabled,
@Schema(description = "Daily cutoff time / 每日截单时间", example = "16:00:00", type = "string", format = "time")
LocalTime cutoffTime,
@Schema(description = "Capability description / 能力说明", example = "Standard pallet storage / 标准托盘仓储", maxLength = 500)
@Size(max = 500) String description
) {
}
@Schema(name = "WarehouseQueryRequest", description = "Warehouse page query / 仓库分页查询条件")
public record QueryRequest(
@Schema(description = "Page number, starting at 1 / 页码,从 1 开始", example = "1", defaultValue = "1", minimum = "1")
@Min(1) long page,
@Schema(description = "Page size / 每页条数", example = "20", defaultValue = "20", minimum = "1", maximum = "200")
@Min(1) @Max(200) long size,
@Schema(description = "Country filter / 国家筛选", example = "US")
String countryCode,
@Schema(description = "Enabled capability code filter / 已启用能力编码筛选", example = "STORAGE")
String capabilityCode,
@Schema(description = "Status filter / 状态筛选", example = "ACTIVE", allowableValues = {"ACTIVE", "INACTIVE"})
String status
) {
public QueryRequest {
if (page == 0) {
page = 1;
}
if (size == 0) {
size = 20;
}
}
}
}
@@ -0,0 +1,25 @@
package com.baiyue.warehouse.dto;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Positive;
public final class WarehouseResourceLockRequests {
private WarehouseResourceLockRequests() {}
public record ReserveRequest(
@Positive long customerId,
@Positive long warehouseId,
@Positive long palletId,
@Positive long locationId,
@NotBlank String businessType,
@NotBlank String businessId,
@NotBlank String reservationKey
) {}
public record CloseRequest(@Positive long customerId) {}
public record DefaultLocationRequest(
@Positive long customerId,
@Positive long warehouseId
) {}
}
@@ -0,0 +1,25 @@
package com.baiyue.warehouse.dto;
import com.baiyue.warehouse.entity.WarehouseResourceLockEntity;
import java.time.LocalDateTime;
public record WarehouseResourceLockResponse(
long lockId,
long customerId,
long warehouseId,
long palletId,
long locationId,
String businessType,
String businessId,
String reservationKey,
String status,
LocalDateTime lockedAt,
LocalDateTime releasedAt
) {
public static WarehouseResourceLockResponse from(WarehouseResourceLockEntity entity) {
return new WarehouseResourceLockResponse(entity.getId(), entity.getCustomerId(), entity.getWarehouseId(),
entity.getPalletId(), entity.getLocationId(), entity.getBusinessType(), entity.getBusinessId(),
entity.getReservationKey(), entity.getStatus(), entity.getLockedAt(), entity.getReleasedAt());
}
}