feat(项目设置): 文件下载的时候增加“临时缓存文件”功能

This commit is contained in:
song-tianyang 2023-11-08 10:42:01 +08:00 committed by 建国
parent 92cfdfb771
commit 1e7070bce7
1 changed files with 2 additions and 3 deletions

View File

@ -440,7 +440,7 @@ public class FileManagementControllerTests extends BaseTest {
Assertions.assertTrue(uploadedFileTypes.contains(fileType)); Assertions.assertTrue(uploadedFileTypes.contains(fileType));
} }
//上传隐藏文件 .yincangwenjian //上传隐藏文件: .yincangwenjian
filePath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/.yincangwenjian")).getPath(); filePath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/.yincangwenjian")).getPath();
file = new MockMultipartFile("file", ".yincangwenjian", MediaType.APPLICATION_OCTET_STREAM_VALUE, FileManagementBaseUtils.getFileBytes(filePath)); file = new MockMultipartFile("file", ".yincangwenjian", MediaType.APPLICATION_OCTET_STREAM_VALUE, FileManagementBaseUtils.getFileBytes(filePath));
paramMap = new LinkedMultiValueMap<>(); paramMap = new LinkedMultiValueMap<>();
@ -450,7 +450,7 @@ public class FileManagementControllerTests extends BaseTest {
returnId = JSON.parseObject(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData().toString(); returnId = JSON.parseObject(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData().toString();
checkLog(returnId, OperationLogType.ADD, FileManagementRequestUtils.URL_FILE_UPLOAD); checkLog(returnId, OperationLogType.ADD, FileManagementRequestUtils.URL_FILE_UPLOAD);
FILE_ID_PATH.put(returnId, filePath); FILE_ID_PATH.put(returnId, filePath);
uploadedFileTypes.add(""); uploadedFileTypes.add(StringUtils.EMPTY);
//检查文件类型是不是为空 //检查文件类型是不是为空
FileMetadata fileMetadata = fileMetadataMapper.selectByPrimaryKey(returnId); FileMetadata fileMetadata = fileMetadataMapper.selectByPrimaryKey(returnId);
@ -490,7 +490,6 @@ public class FileManagementControllerTests extends BaseTest {
returnId = JSON.parseObject(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData().toString(); returnId = JSON.parseObject(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData().toString();
checkLog(returnId, OperationLogType.ADD, FileManagementRequestUtils.URL_FILE_UPLOAD); checkLog(returnId, OperationLogType.ADD, FileManagementRequestUtils.URL_FILE_UPLOAD);
FILE_ID_PATH.put(returnId, filePath); FILE_ID_PATH.put(returnId, filePath);
uploadedFileTypes.add(StringUtils.EMPTY);
//检查文件类型获取接口有没有获取到数据 //检查文件类型获取接口有没有获取到数据
fileTypes = this.getFileType(); fileTypes = this.getFileType();