분류데이터셋 업로드 chunk API 추가
This commit is contained in:
@@ -111,4 +111,34 @@ public class UploadApiController {
|
||||
return ApiResponseDto.ok(uploadService.getUploadStatus(statusReq));
|
||||
}
|
||||
*/
|
||||
|
||||
@Operation(summary = "분류 데이터셋 대용량 파일 분할 전송", description = "분류 데이터셋 파일 대용량 파일을 청크 단위로 전송합니다.")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(responseCode = "200", description = "청크 업로드 성공", content = @Content),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||
@ApiResponse(responseCode = "404", description = "업로드 세션을 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@PostMapping(value = "/chunk-upload-cls", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ApiResponseDto<UploadDto.UploadRes> uploadChunkClsDataSetFile(
|
||||
@RequestParam("fileName") String fileName,
|
||||
@RequestParam("fileSize") long fileSize,
|
||||
@RequestParam("chunkIndex") Integer chunkIndex,
|
||||
@RequestParam("chunkTotalIndex") Integer chunkTotalIndex,
|
||||
@RequestPart("chunkFile") MultipartFile chunkFile,
|
||||
@RequestParam("uuid") UUID uuid) {
|
||||
|
||||
String uploadDivi = "cls-dataset";
|
||||
|
||||
UploadDto.UploadAddReq upAddReqDto = new UploadDto.UploadAddReq();
|
||||
upAddReqDto.setFileName(fileName);
|
||||
upAddReqDto.setFileSize(fileSize);
|
||||
upAddReqDto.setChunkIndex(chunkIndex);
|
||||
upAddReqDto.setChunkTotalIndex(chunkTotalIndex);
|
||||
upAddReqDto.setUploadDivi(uploadDivi);
|
||||
upAddReqDto.setUuid(uuid);
|
||||
|
||||
return ApiResponseDto.ok(uploadService.uploadChunk(upAddReqDto, chunkFile));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,12 @@ public class UploadService {
|
||||
@Value("${file.dataset-tmp-dir}")
|
||||
private String datasetTmpDir;
|
||||
|
||||
@Value("${file.dataset-cls-dir}")
|
||||
private String datasetClsDir;
|
||||
|
||||
@Value("${file.dataset-cls-tmp-dir}")
|
||||
private String datasetClsTmpDir;
|
||||
|
||||
// TODO 미사용시작
|
||||
@Transactional
|
||||
public DmlReturn initUpload(UploadDto.InitReq initReq) {
|
||||
@@ -60,9 +66,12 @@ public class UploadService {
|
||||
Integer chunkTotalIndex = upAddReqDto.getChunkTotalIndex();
|
||||
String status = "UPLOADING";
|
||||
|
||||
if (uploadDivi.equals("dataset")) {
|
||||
if (uploadDivi.equals("dataset")) { // 탐지데이터셋
|
||||
tmpDataSetDir = datasetTmpDir;
|
||||
fianlDir = datasetDir;
|
||||
} else if (uploadDivi.equals("cls-dataset")) { // 분류데이터셋
|
||||
tmpDataSetDir = datasetClsTmpDir;
|
||||
fianlDir = datasetClsDir;
|
||||
}
|
||||
|
||||
// 리턴용 파일 값
|
||||
|
||||
Reference in New Issue
Block a user