Merge remote-tracking branch 'origin/test' into dev

# Conflicts:
#	firstleg/src/main/java/com/baiyue/firstleg/client/OrderCargoClient.java
#	order/src/main/java/com/baiyue/order/controller/InternalOrderCargoController.java
#	order/src/test/java/com/baiyue/order/controller/InternalOrderCargoControllerTest.java
This commit is contained in:
2026-09-08 17:34:12 +08:00
35 changed files with 621 additions and 79 deletions
@@ -81,7 +81,7 @@ public class InternalOrderCargoController {
.map(cargo -> new CargoLabelBinding(cargo.getId(), orderId, cargo.getItemNo(),
cargo.getCargoName(), cargo.getSkuNo(), cargo.getPackageCount(),
unitsPerCarton(cargo, oneClickDropship), cargo.getLengthCm(), cargo.getWidthCm(),
cargo.getHeightCm()))
cargo.getHeightCm(), cargo.getShipmentId()))
.toList());
}
@@ -171,18 +171,19 @@ public class InternalOrderCargoController {
public record CargoLabelBinding(Long cargoId, Long orderId, Integer itemNo, String cargoName,
String skuNo, Integer packageCount, Integer unitsPerCarton,
java.math.BigDecimal lengthCm,
java.math.BigDecimal widthCm, java.math.BigDecimal heightCm) {
java.math.BigDecimal widthCm, java.math.BigDecimal heightCm,
String shipmentId) {
public CargoLabelBinding(Long cargoId, Long orderId, Integer itemNo, String cargoName,
Integer packageCount, java.math.BigDecimal lengthCm,
java.math.BigDecimal widthCm, java.math.BigDecimal heightCm) {
this(cargoId, orderId, itemNo, cargoName, null, packageCount, null,
lengthCm, widthCm, heightCm);
lengthCm, widthCm, heightCm, null);
}
public CargoLabelBinding(Long cargoId, Long orderId, Integer itemNo, String cargoName,
String skuNo, Integer packageCount, java.math.BigDecimal lengthCm,
java.math.BigDecimal widthCm, java.math.BigDecimal heightCm) {
this(cargoId, orderId, itemNo, cargoName, skuNo, packageCount, null,
lengthCm, widthCm, heightCm);
lengthCm, widthCm, heightCm, null);
}
}
@@ -6,6 +6,28 @@ info:
security:
- bearerAuth: []
paths:
/internal/order/v1/cargoes/{tenantId}/{orderId}:
get:
security: []
summary: Firstleg 批量读取订单货物绑定
description: >-
仅接受内部服务令牌。按 tenantId 与 orderId 严格限定订单范围,并按订单货物顺序一次返回全部货物;
cargoId 是 Firstleg inboundDetailId 的绑定键,shipmentId 仅取对应货物行快照,
不使用订单顶层货件号回退,也不提供逐货物查询替代本批量契约。
parameters:
- name: X-Internal-Service-Token
in: header
required: true
schema: {type: string}
- {name: tenantId, in: path, required: true, schema: {type: string, pattern: '^[1-9][0-9]*$'}}
- {name: orderId, in: path, required: true, schema: {type: string, pattern: '^[1-9][0-9]*$'}}
responses:
'200':
description: 当前订单范围内的货物绑定列表
content:
application/json:
schema: {$ref: '#/components/schemas/CargoLabelBindingListEnvelope'}
'403': {description: 内部服务令牌无效}
/internal/order/v1/pending-review-orders:
get:
security: []
@@ -590,6 +612,29 @@ components:
scheme: bearer
bearerFormat: JWT
schemas:
CargoLabelBindingListEnvelope:
type: object
required: [code, data]
properties:
code: {type: string, example: "200"}
message: {type: string, nullable: true}
data:
type: array
items: {$ref: '#/components/schemas/CargoLabelBinding'}
CargoLabelBinding:
type: object
required: [cargoId, orderId, itemNo, cargoName, packageCount]
properties:
cargoId: {type: string, pattern: '^[1-9][0-9]*$', description: Firstleg inboundDetailId 的绑定键}
orderId: {type: string, pattern: '^[1-9][0-9]*$'}
itemNo: {type: integer, minimum: 1}
cargoName: {type: string}
skuNo: {type: string, nullable: true}
packageCount: {type: integer, minimum: 1}
lengthCm: {type: number, nullable: true}
widthCm: {type: number, nullable: true}
heightCm: {type: number, nullable: true}
shipmentId: {type: string, nullable: true, description: 当前货物行的 FBA 货件号快照,不以订单级字段回退}
DomesticWarehouseOrderExportBatchRequest:
type: object
required: [taskId, tenantId, appCode, requestedBy, dispatchVersion, parameters, limit]
@@ -92,6 +92,8 @@ class InternalOrderCargoControllerTest {
OrderCargoEntity second = cargo(32L, 2, 2, "50", "30", "20");
OrderEntity order = new OrderEntity(); order.setId(21L); order.setFulfillmentType("STANDARD");
when(orders.findOwned(11L, 21L)).thenReturn(order);
first.setShipmentId("FBA-SHIPMENT-31");
second.setShipmentId("FBA-SHIPMENT-32");
when(orders.findCargoInheritedByOrder(11L, 21L)).thenReturn(List.of(first, second));
var response = controller.listForCartonLabels("internal-token", 11L, 21L);
@@ -104,6 +106,8 @@ class InternalOrderCargoControllerTest {
assertThat(response.data().get(1).unitsPerCarton()).isNull();
assertThat(response.data().get(0).lengthCm()).isEqualByComparingTo("60");
verify(orders).findOwned(11L, 21L);
assertThat(response.data()).extracting(InternalOrderCargoController.CargoLabelBinding::shipmentId)
.containsExactly("FBA-SHIPMENT-31", "FBA-SHIPMENT-32");
verify(orders).findCargoInheritedByOrder(11L, 21L);
}