fix: bind overseas receiving to shared warehouse
This commit is contained in:
@@ -29,6 +29,7 @@ class AuthorizationSnapshotServiceTest {
|
||||
.thenReturn(List.of("ADMIN", "OPERATOR"));
|
||||
when(mapper.findPermissions(42L, 7L, 9L, "MERCHANT"))
|
||||
.thenReturn(List.of("order:read", "order:create"));
|
||||
when(mapper.findOverseasWarehouseId(7L, 9L)).thenReturn(900L);
|
||||
|
||||
var result = service
|
||||
.load(new SnapshotRequest(42L, 7L, 9L, "merchant"));
|
||||
@@ -37,6 +38,7 @@ class AuthorizationSnapshotServiceTest {
|
||||
assertThat(result.getClientType()).isEqualTo("MERCHANT");
|
||||
assertThat(result.getRoles()).containsExactlyInAnyOrder("ADMIN", "OPERATOR");
|
||||
assertThat(result.getPermissions()).containsExactlyInAnyOrder("order:read", "order:create");
|
||||
assertThat(result.getOverseasWarehouseId()).isEqualTo(900L);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -57,6 +57,7 @@ class PlatformUserManagementServiceTest {
|
||||
when(auth.summary("internal-token", 10L)).thenReturn(ApiResponse.success(
|
||||
new AuthAccountClient.AccountSummary(10L, "zhangwei", "张伟", "ACTIVE",
|
||||
LocalDateTime.of(2026, 6, 1, 10, 30), 0L, 30L, "PLATFORM")));
|
||||
when(auth.revokeSessions(eq("internal-token"), any())).thenReturn(ApiResponse.success(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -117,6 +118,23 @@ class PlatformUserManagementServiceTest {
|
||||
verify(auth, never()).scope(anyString(), anyLong(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void warehousePickerRequiresAndPersistsSingleOverseasWarehouseBinding() {
|
||||
platformRole.setRoleCode("WAREHOUSE_PICKER");
|
||||
UpdateUserRequest missing = new UpdateUserRequest("张伟", "13800138000", null,
|
||||
0L, List.of(40001L), null);
|
||||
assertThrows(BizException.class,
|
||||
() -> service.update(30L, missing, Set.of("platform:user:grant-role")));
|
||||
|
||||
UpdateUserRequest bound = new UpdateUserRequest("张伟", "13800138000", null,
|
||||
0L, List.of(40001L), 900L);
|
||||
UserResponse response = service.update(30L, bound, Set.of("platform:user:grant-role"));
|
||||
|
||||
assertEquals(900L, membership.getOverseasWarehouseId());
|
||||
assertEquals(900L, response.overseasWarehouseId());
|
||||
verify(auth).revokeSessions(eq("internal-token"), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void currentPlatformOperatorCannotDisableSelf() {
|
||||
assertThrows(BizException.class,
|
||||
|
||||
Reference in New Issue
Block a user