fix: close inbound hold bypass paths

This commit is contained in:
2026-09-07 12:10:11 +08:00
parent 6b479d1a68
commit 41582fe17b
28 changed files with 899 additions and 11 deletions
@@ -296,4 +296,23 @@ class InternalBusinessFileServiceTest {
}
}
@Test void inboundHoldEvidenceIsCustomerOwnedAndScopedToInboundId() {
MockMultipartFile file = new MockMultipartFile("file", "hold.pdf", "application/pdf", new byte[]{1, 2});
when(storage.store(10001L, "61", file, BusinessFileCategory.INBOUND_HOLD_EVIDENCE))
.thenReturn(new BusinessFileStorage.Stored("business-files/10001/61/hold.pdf",
"application/pdf", 2, "a".repeat(64), "hold.pdf"));
when(files.insert(any(FileObjectEntity.class))).thenAnswer(invocation -> {
((FileObjectEntity) invocation.getArgument(0)).setId(301L);
return 1;
});
var result = service.upload(10001L, "INBOUND_HOLD_EVIDENCE", "61", 7L, file);
assertThat(result.fileId()).isEqualTo(301L);
assertThat(result.ownerScope()).isEqualTo("CUSTOMER");
assertThat(result.businessId()).isEqualTo("61");
assertThatThrownBy(() -> service.upload(0L, "INBOUND_HOLD_EVIDENCE", "61", 7L, file))
.isInstanceOf(BizException.class).hasMessageContaining("明确客户");
}
}