영상데이터관리 > uploadPair 로직 수정 test
This commit is contained in:
@@ -19,6 +19,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
|||||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@@ -325,7 +326,8 @@ public class MapSheetMngApiController {
|
|||||||
@RequestParam("fileSize") long fileSize,
|
@RequestParam("fileSize") long fileSize,
|
||||||
@RequestParam("chunkIndex") Integer chunkIndex,
|
@RequestParam("chunkIndex") Integer chunkIndex,
|
||||||
@RequestParam("chunkTotalIndex") Integer chunkTotalIndex,
|
@RequestParam("chunkTotalIndex") Integer chunkTotalIndex,
|
||||||
@RequestPart("chunkFile") MultipartFile chunkFile) {
|
@RequestPart("chunkFile") MultipartFile chunkFile)
|
||||||
|
throws IOException {
|
||||||
|
|
||||||
String uploadDivi = "mapsheet";
|
String uploadDivi = "mapsheet";
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ public class MapSheetMngService {
|
|||||||
MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy());
|
MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy());
|
||||||
String targetYearDir = mngDto.getMngPath();
|
String targetYearDir = mngDto.getMngPath();
|
||||||
|
|
||||||
// 중복체크 -> 도엽/uuid_yyyyMMddhhmmss 경로에 업로드 할 거라 overwrite 되지 않음
|
// 중복체크 -> 도엽/uuid 경로에 업로드 할 거라 overwrite 되지 않음
|
||||||
// if (!overwrite) {
|
// if (!overwrite) {
|
||||||
// dmlReturn =
|
// dmlReturn =
|
||||||
// this.duplicateFile(
|
// this.duplicateFile(
|
||||||
@@ -151,13 +151,13 @@ public class MapSheetMngService {
|
|||||||
if (!FIleChecker.multipartSaveTo(tfwFile, tfwTmpPath)) {
|
if (!FIleChecker.multipartSaveTo(tfwFile, tfwTmpPath)) {
|
||||||
return new DmlReturn("fail", "UPLOAD ERROR");
|
return new DmlReturn("fail", "UPLOAD ERROR");
|
||||||
}
|
}
|
||||||
if (!FIleChecker.multipartSaveTo(tifFile, tifTmpPath)) {
|
// if (!FIleChecker.multipartSaveTo(tifFile, tifTmpPath)) {
|
||||||
return new DmlReturn("fail", "UPLOAD ERROR");
|
// return new DmlReturn("fail", "UPLOAD ERROR");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (!FIleChecker.cmmndGdalInfo(tifTmpPath)) {
|
// if (!FIleChecker.cmmndGdalInfo(tifTmpPath)) {
|
||||||
return new DmlReturn("fail", "TIF TYPE ERROR");
|
// return new DmlReturn("fail", "TIF TYPE ERROR");
|
||||||
}
|
// }
|
||||||
if (!FIleChecker.checkTfw(tfwTmpPath)) {
|
if (!FIleChecker.checkTfw(tfwTmpPath)) {
|
||||||
return new DmlReturn("fail", "TFW TYPE ERROR");
|
return new DmlReturn("fail", "TFW TYPE ERROR");
|
||||||
}
|
}
|
||||||
@@ -166,12 +166,12 @@ public class MapSheetMngService {
|
|||||||
List<MngFilesDto> mngFiles = mapSheetMngCoreService.findByHstUidMapSheetFileList(hstUid);
|
List<MngFilesDto> mngFiles = mapSheetMngCoreService.findByHstUidMapSheetFileList(hstUid);
|
||||||
String uploadPath = "";
|
String uploadPath = "";
|
||||||
for (MngFilesDto dto : mngFiles) {
|
for (MngFilesDto dto : mngFiles) {
|
||||||
uploadPath = dto.getFilePath();
|
uploadPath = dto.getFilePath() + "/" + errDto.getUuid();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Path tfwTmpSavePath = Paths.get(tfwTmpPath);
|
Path tfwTmpSavePath = Paths.get(tfwTmpPath);
|
||||||
Path tifTmpSavePath = Paths.get(tifTmpPath);
|
// Path tifTmpSavePath = Paths.get(tifTmpPath);
|
||||||
Path tfwTargetPath = null;
|
Path tfwTargetPath = null;
|
||||||
Path tifTargetPath = null;
|
Path tifTargetPath = null;
|
||||||
|
|
||||||
@@ -180,7 +180,12 @@ public class MapSheetMngService {
|
|||||||
MngFilesDto filesDto =
|
MngFilesDto filesDto =
|
||||||
mapSheetMngCoreService.findYyyyToMapSheetFilePathRefer(errDto.getMngYyyy());
|
mapSheetMngCoreService.findYyyyToMapSheetFilePathRefer(errDto.getMngYyyy());
|
||||||
String referPath = filesDto.getFilePath();
|
String referPath = filesDto.getFilePath();
|
||||||
uploadPath = Paths.get(referPath).getParent().toString() + "/" + errDto.getRefMapSheetNum();
|
uploadPath =
|
||||||
|
Paths.get(referPath).getParent().toString()
|
||||||
|
+ "/"
|
||||||
|
+ errDto.getRefMapSheetNum()
|
||||||
|
+ "/"
|
||||||
|
+ errDto.getUuid();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 업로드 경로 확인(없으면 생성)
|
// 업로드 경로 확인(없으면 생성)
|
||||||
@@ -191,9 +196,13 @@ public class MapSheetMngService {
|
|||||||
tfwTargetPath = Paths.get(uploadPath).resolve(tfwFile.getOriginalFilename());
|
tfwTargetPath = Paths.get(uploadPath).resolve(tfwFile.getOriginalFilename());
|
||||||
tifTargetPath = Paths.get(uploadPath).resolve(tifFile.getOriginalFilename());
|
tifTargetPath = Paths.get(uploadPath).resolve(tifFile.getOriginalFilename());
|
||||||
|
|
||||||
|
if (!Files.exists(tifTargetPath)) {
|
||||||
|
return new DmlReturn("fail", "TIF 파일이 정상적으로 업로드 되지 않았습니다. 확인해주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Files.move(tfwTmpSavePath, tfwTargetPath, StandardCopyOption.REPLACE_EXISTING);
|
Files.move(tfwTmpSavePath, tfwTargetPath, StandardCopyOption.REPLACE_EXISTING);
|
||||||
Files.move(tifTmpSavePath, tifTargetPath, StandardCopyOption.REPLACE_EXISTING);
|
// Files.move(tifTmpSavePath, tifTargetPath, StandardCopyOption.REPLACE_EXISTING);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@@ -365,9 +374,8 @@ public class MapSheetMngService {
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public ModelUploadResDto uploadChunkMapSheetFile(
|
public ModelUploadResDto uploadChunkMapSheetFile(
|
||||||
Long hstUid, UploadAddReq upAddReqDto, MultipartFile chunkFile) {
|
Long hstUid, UploadAddReq upAddReqDto, MultipartFile chunkFile) throws IOException {
|
||||||
|
|
||||||
// String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
|
||||||
ErrorDataDto errDto = mapSheetMngCoreService.findMapSheetError(hstUid);
|
ErrorDataDto errDto = mapSheetMngCoreService.findMapSheetError(hstUid);
|
||||||
|
|
||||||
// 싱크파일목록으로 업로드 경로 확인
|
// 싱크파일목록으로 업로드 경로 확인
|
||||||
@@ -392,6 +400,18 @@ public class MapSheetMngService {
|
|||||||
UploadDto.UploadRes upRes = uploadService.uploadChunk(upAddReqDto, chunkFile);
|
UploadDto.UploadRes upRes = uploadService.uploadChunk(upAddReqDto, chunkFile);
|
||||||
|
|
||||||
ModelUploadResDto modelUploadResDto = new ModelUploadResDto();
|
ModelUploadResDto modelUploadResDto = new ModelUploadResDto();
|
||||||
|
|
||||||
|
// 병합 다 했는데 gdalinfo 가 fail 이면 삭제?
|
||||||
|
if (upRes.getRes().equals("MERGED")) {
|
||||||
|
if (!FIleChecker.cmmndGdalInfo(upRes.getFilePath() + "/" + upRes.getFileName())) {
|
||||||
|
Path filePath = Paths.get(upRes.getFilePath());
|
||||||
|
Files.deleteIfExists(filePath);
|
||||||
|
modelUploadResDto.setRes("fail");
|
||||||
|
modelUploadResDto.setResMsg("TIF TYPE ERROR");
|
||||||
|
return modelUploadResDto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
modelUploadResDto.setRes(upRes.getRes());
|
modelUploadResDto.setRes(upRes.getRes());
|
||||||
modelUploadResDto.setResMsg(upRes.getResMsg());
|
modelUploadResDto.setResMsg(upRes.getResMsg());
|
||||||
modelUploadResDto.setUuid(upRes.getUuid());
|
modelUploadResDto.setUuid(upRes.getUuid());
|
||||||
|
|||||||
Reference in New Issue
Block a user