test(phase4): provision overseas lifecycle fixtures

This commit is contained in:
2026-08-24 15:07:17 +08:00
parent cd97229791
commit e11a528dfe
12 changed files with 248 additions and 48 deletions
@@ -27,7 +27,7 @@ public class RelabelApplicationController {
public ApiResponse<RelabelResponses.Detail> create(@AuthenticationPrincipal AuthenticatedUser user,
@Valid @RequestBody RelabelRequests.Create request) {
requirePlatform(user);
return ApiResponse.success(service.create("0", operator(user), request));
return ApiResponse.success(service.create(requiredCustomer(request.customerId()), operator(user), request));
}
@GetMapping
@PreAuthorize("hasAuthority('" + OverseasPermissions.RELABEL_ORDER_LIST + "')")
@@ -60,5 +60,12 @@ public class RelabelApplicationController {
throw new ResponseStatusException(HttpStatus.FORBIDDEN, "Platform application required");
}
}
private String requiredCustomer(String customerId) {
String value = customerId == null ? null : customerId.trim();
if (value == null || value.isEmpty() || "0".equals(value)) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Target customerId is required");
}
return value;
}
private String operator(AuthenticatedUser user) { return user.userId() == null ? user.username() : String.valueOf(user.userId()); }
}
@@ -16,6 +16,7 @@ public final class RelabelRequests {
private RelabelRequests() {}
public record Create(
@Size(max = 32) String customerId,
@NotBlank @Size(max = 128) String customerOrderNo,
@NotBlank @Size(max = 128) String overseasWarehouseId,
@NotNull LocalDateTime labelDeadline,