fix(firstleg): make scanned shipment id optional
This commit is contained in:
@@ -19,7 +19,7 @@ public final class MojiaMeasurementDtos {
|
||||
public record UploadRequest(
|
||||
@NotBlank @Size(max = 128) String boxCode,
|
||||
@JsonProperty("shipment_id") @JsonAlias("shipmentId")
|
||||
@NotBlank @Size(max = 64) String shipmentId,
|
||||
@Size(max = 64) String shipmentId,
|
||||
@NotNull @DecimalMin("0.001") @DecimalMax("999999999.999") BigDecimal length,
|
||||
@NotNull @DecimalMin("0.001") @DecimalMax("999999999.999") BigDecimal width,
|
||||
@NotNull @DecimalMin("0.001") @DecimalMax("999999999.999") BigDecimal height,
|
||||
|
||||
+6
-2
@@ -79,7 +79,7 @@ public class MojiaMeasurementOpenApiService {
|
||||
app.tenantId(), app.subjectId(), new CartonMeasurementCommand(
|
||||
request.boxCode(), request.length(), request.width(), request.height(), request.weight(),
|
||||
request.machineNo(), request.measuredAt() == null ? LocalDateTime.now() : request.measuredAt(),
|
||||
image, request.shipmentId().trim()));
|
||||
image, optionalTrim(request.shipmentId())));
|
||||
} catch (BizException exception) {
|
||||
if (exception.getResultCode() == ResultCode.NOT_FOUND) {
|
||||
return saveUnmatched(app, request, image, exception);
|
||||
@@ -117,7 +117,7 @@ public class MojiaMeasurementOpenApiService {
|
||||
receipt.setTenantId(app.tenantId());
|
||||
receipt.setSubjectId(app.subjectId());
|
||||
receipt.setBoxCode(request.boxCode().trim());
|
||||
receipt.setScannedShipmentId(request.shipmentId().trim());
|
||||
receipt.setScannedShipmentId(optionalTrim(request.shipmentId()));
|
||||
receipt.setLengthCm(request.length());
|
||||
receipt.setWidthCm(request.width());
|
||||
receipt.setHeightCm(request.height());
|
||||
@@ -218,6 +218,10 @@ public class MojiaMeasurementOpenApiService {
|
||||
return normalized.length() <= 160 ? normalized : normalized.substring(0, 160);
|
||||
}
|
||||
|
||||
private String optionalTrim(String value) {
|
||||
return value == null || value.isBlank() ? null : value.trim();
|
||||
}
|
||||
|
||||
private record InMemoryMultipartFile(byte[] content) implements MultipartFile {
|
||||
@Override public String getName() { return "image"; }
|
||||
@Override public String getOriginalFilename() { return "mojia-measurement.jpg"; }
|
||||
|
||||
@@ -239,10 +239,10 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required: [boxCode, shipment_id, length, width, height, machineNo, picture]
|
||||
required: [boxCode, length, width, height, machineNo, picture]
|
||||
properties:
|
||||
boxCode: {type: string, maxLength: 128, example: 'RK-2085911321565003778#4-1'}
|
||||
shipment_id: {type: string, maxLength: 64, example: 'FBA19L5KMY2CU000002', description: '设备从Amazon FBA箱标实际扫描得到;系统只保存,不生成且不覆盖客户下单值'}
|
||||
shipment_id: {type: string, maxLength: 64, example: 'FBA19L5KMY2CU000002', description: '可选;设备从Amazon FBA箱标实际扫描得到,有则原样上传;系统只保存,不生成且不覆盖客户下单值'}
|
||||
length: {type: number, format: decimal, minimum: 0.001}
|
||||
width: {type: number, format: decimal, minimum: 0.001}
|
||||
height: {type: number, format: decimal, minimum: 0.001}
|
||||
|
||||
Reference in New Issue
Block a user