fix: align HTTP acceptance fixtures and pallet permissions

This commit is contained in:
2026-09-14 12:40:40 +08:00
parent e55ab73e61
commit a2ea0ba9e6
15 changed files with 205 additions and 50 deletions
@@ -142,7 +142,7 @@ public class PlatformDropshipPalletizationController {
}
@GetMapping("/inbound-orders/{inboundId}/pallets")
@PreAuthorize("hasAuthority('firstleg:inbound:list')")
@PreAuthorize("hasAuthority('platform:firstleg:inbound:list')")
public ApiResponse<List<Pallet>> inboundPallets(@AuthenticationPrincipal AuthenticatedUser user,
@PathVariable @Positive long inboundId,
@RequestParam @Positive long accountId) {
@@ -151,7 +151,7 @@ public class PlatformDropshipPalletizationController {
}
@GetMapping("/inbound-orders/{inboundId}/pallets/{palletId}/print")
@PreAuthorize("hasAuthority('firstleg:inbound:list')")
@PreAuthorize("hasAuthority('platform:firstleg:inbound:list')")
public ResponseEntity<byte[]> printPallet(@AuthenticationPrincipal AuthenticatedUser user,
@PathVariable @Positive long inboundId,
@PathVariable @Positive long palletId,
@@ -87,12 +87,12 @@ paths:
/api/platform/v1/first-leg/pda-dropship/inbound-orders/{inboundId}/pallets:
get:
summary: Admin 查询入仓单权威托盘结果
x-required-authority: firstleg:inbound:list
x-required-authority: platform:firstleg:inbound:list
responses: {'200': {description: OK}}
/api/platform/v1/first-leg/pda-dropship/inbound-orders/{inboundId}/pallets/{palletId}/print:
get:
summary: 获取包含托盘码、入仓码和 SKU 实收汇总的 A4 托盘信息单
x-required-authority: firstleg:inbound:list
x-required-authority: platform:firstleg:inbound:list
responses: {'200': {description: PDF}}
components:
parameters:
@@ -12,6 +12,21 @@ import java.nio.file.Path;
import static org.assertj.core.api.Assertions.assertThat;
class DropshipPalletizationSqlContractTest {
@Test
void inboundPalletReadAndPrintUseTheRegisteredPlatformInboundPermission() throws Exception {
var controller = com.baiyue.firstleg.controller.PlatformDropshipPalletizationController.class;
for (var method : controller.getDeclaredMethods()) {
if (method.getName().equals("inboundPallets") || method.getName().equals("printPallet")) {
assertThat(method.getAnnotation(org.springframework.security.access.prepost.PreAuthorize.class).value())
.isEqualTo("hasAuthority('platform:firstleg:inbound:list')");
}
}
String api = new ClassPathResource("openapi/dropship-palletization-v1.yaml")
.getContentAsString(StandardCharsets.UTF_8);
assertThat(api).contains("x-required-authority: platform:firstleg:inbound:list")
.doesNotContain("x-required-authority: firstleg:inbound:list");
}
@Test
void pendingPdaTasksAreScopedByTheSelectedWarehouse() throws Exception {
String sql = DropshipPalletizationMapper.class