chunk업로드 공통, 모델관리 수정
This commit is contained in:
224
src/main/java/com/kamco/cd/kamcoback/upload/dto/UploadDto.java
Normal file
224
src/main/java/com/kamco/cd/kamcoback/upload/dto/UploadDto.java
Normal file
@@ -0,0 +1,224 @@
|
||||
package com.kamco.cd.kamcoback.upload.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
public class UploadDto {
|
||||
|
||||
@Schema(name = "InitReq", description = "업로드(Chunk) 세션 초기화")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class InitReq {
|
||||
|
||||
@Schema(description = "파일명", example = "data.zip")
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "파일 크기 (bytes)", example = "10737418240")
|
||||
private Long fileSize;
|
||||
|
||||
@Schema(description = "총 청크 수", example = "100")
|
||||
private Integer chunkTotalIndex;
|
||||
|
||||
/*
|
||||
@Schema(
|
||||
description = "파일해쉬",
|
||||
example = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
|
||||
private String fileHash;
|
||||
*/
|
||||
|
||||
@Schema(description = "업로드구분", example = "model")
|
||||
private String uploadDivi;
|
||||
}
|
||||
|
||||
@Schema(name = "UploadAddReq", description = "업로드 요청")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class UploadAddReq {
|
||||
@Schema(description = "업로드 ID", example = "각데이터의 식별키")
|
||||
private String uploadId;
|
||||
|
||||
@Schema(description = "데이터식별키", example = "129227333")
|
||||
private Long datasetId;
|
||||
|
||||
@Schema(description = "파일명", example = "data.zip")
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "파일 크기 (bytes)", example = "10737418240")
|
||||
private Long fileSize;
|
||||
|
||||
@Schema(description = "파일명", example = "data.zip")
|
||||
private String finalPath;
|
||||
|
||||
@Schema(description = "업로드구분", example = "dataset")
|
||||
private String uploadDivi;
|
||||
|
||||
@Schema(description = "상태", example = "UPLOADING")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "임시저장경로")
|
||||
private String tempPath;
|
||||
|
||||
@Schema(description = "업로드 청크 Index", example = "50")
|
||||
private Integer chunkIndex;
|
||||
|
||||
@Schema(description = "총 청크 수", example = "100")
|
||||
private Integer chunkTotalIndex;
|
||||
|
||||
@Schema(
|
||||
description = "파일해쉬",
|
||||
example = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
|
||||
private String fileHash;
|
||||
|
||||
@Schema(description = "uuid", example = "303d4e24-1726-4272-bbc7-01ab85692b80")
|
||||
private UUID uuid;
|
||||
}
|
||||
|
||||
@Schema(name = "UploadCompleteReq", description = "업로드 완료 요청")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class CompleteReq {
|
||||
|
||||
@NotBlank(message = "업로드 ID는 필수입니다")
|
||||
@Schema(description = "업로드 ID", example = "upload_20241218_123456_abc123")
|
||||
private String uploadId;
|
||||
}
|
||||
|
||||
@Schema(name = "UploadStatusReq", description = "업로드 상태 조회 요청")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class StatusReq {
|
||||
|
||||
@NotBlank(message = "업로드 ID는 필수입니다")
|
||||
@Schema(description = "업로드 ID", example = "upload_20241218_123456_abc123")
|
||||
private String uploadId;
|
||||
}
|
||||
|
||||
@Schema(name = "UploadStatus", description = "업로드 상태 정보")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class Status {
|
||||
|
||||
@Schema(description = "업로드 ID", example = "upload_20241218_123456_abc123")
|
||||
private String uploadId;
|
||||
|
||||
@Schema(description = "파일명", example = "data.zip")
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "파일 크기 (bytes)", example = "10737418240")
|
||||
private Long fileSize;
|
||||
|
||||
@Schema(description = "상태", example = "UPLOADING")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "총 청크 수", example = "100")
|
||||
private Integer totalChunks;
|
||||
|
||||
@Schema(description = "업로드된 청크 수", example = "50")
|
||||
private Integer uploadedChunks;
|
||||
|
||||
@Schema(description = "진행률 (%)", example = "50.0")
|
||||
private Double progress;
|
||||
|
||||
@Schema(description = "에러 메시지", example = "")
|
||||
private String errorMessage;
|
||||
}
|
||||
|
||||
@Schema(name = "UploadAddReq", description = "업로드 요청")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class uploadDto {
|
||||
@Schema(description = "업로드 ID", example = "각데이터의 식별키")
|
||||
private String uploadId;
|
||||
|
||||
@Schema(description = "데이터식별키", example = "129227333")
|
||||
private Long datasetId;
|
||||
|
||||
@Schema(description = "파일명", example = "data.zip")
|
||||
private String fileName;
|
||||
|
||||
|
||||
@Schema(description = "파일 크기 (bytes)", example = "10737418240")
|
||||
private Long fileSize;
|
||||
|
||||
@Schema(description = "파일명", example = "data.zip")
|
||||
private String finalPath;
|
||||
|
||||
@Schema(description = "업로드구분", example = "dataset")
|
||||
private String uploadDivi;
|
||||
|
||||
@Schema(description = "상태", example = "UPLOADING")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "임시저장경로")
|
||||
private String tempPath;
|
||||
|
||||
@Schema(description = "업로드 청크 Index", example = "50")
|
||||
private Integer chunkIndex;
|
||||
|
||||
@Schema(description = "총 청크 Index", example = "100")
|
||||
private Integer chunkTotalIndex;
|
||||
|
||||
|
||||
@Schema(
|
||||
description = "파일해쉬",
|
||||
example = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
|
||||
private String fileHash;
|
||||
|
||||
@Schema(description = "uuid")
|
||||
private UUID uuid;
|
||||
|
||||
}
|
||||
|
||||
@Schema(name = "UploadRes", description = "업로드 수행 후 리턴")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class UploadRes {
|
||||
private String res;
|
||||
private String resMsg;
|
||||
private UUID uuid;
|
||||
private String filePath;
|
||||
private String fileName;
|
||||
private int chunkIndex;
|
||||
private int chunkTotalIndex;
|
||||
|
||||
public double getUploadRate() {
|
||||
if (this.chunkTotalIndex == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
return (double) (this.chunkIndex+1) / (this.chunkTotalIndex+1) * 100.0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Schema(name = "DmlReturn", description = "수행 후 리턴")
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class DmlReturn {
|
||||
|
||||
private String flag;
|
||||
private String message;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user