chunk업로드 공통, 모델관리 수정
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package com.kamco.cd.kamcoback.common.enums;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.CodeExpose;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.EnumType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@CodeExpose
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FileUploadStatus implements EnumType {
|
||||
INIT("초기화"),
|
||||
UPLOADING("업로드중"),
|
||||
DONE("업로드완료"),
|
||||
MERGED("병합완료");
|
||||
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import lombok.Getter;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.geotools.coverage.grid.GridCoverage2D;
|
||||
import org.geotools.gce.geotiff.GeoTiffReader;
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
public class FIleChecker {
|
||||
@@ -489,6 +490,23 @@ public class FIleChecker {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean multipartChunkSaveTo(MultipartFile mfile, String targetPath, int chunkIndex) {
|
||||
File dest = new File(targetPath, String.valueOf(chunkIndex));
|
||||
|
||||
boolean fileUpload = true;
|
||||
try {
|
||||
mfile.transferTo(dest);
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean deleteFolder(String path) {
|
||||
return FileSystemUtils.deleteRecursively(new File(path));
|
||||
}
|
||||
|
||||
public static boolean validationMultipart(MultipartFile mfile) {
|
||||
// 파일 유효성 검증
|
||||
if (mfile == null || mfile.isEmpty() || mfile.getSize() == 0) {
|
||||
|
||||
Reference in New Issue
Block a user