Merge pull request '영상데이터관리 > uploadPair 로직 수정 test' (#352) from feat/infer_dev_260107 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/352
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.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -325,7 +326,8 @@ public class MapSheetMngApiController {
|
||||
@RequestParam("fileSize") long fileSize,
|
||||
@RequestParam("chunkIndex") Integer chunkIndex,
|
||||
@RequestParam("chunkTotalIndex") Integer chunkTotalIndex,
|
||||
@RequestPart("chunkFile") MultipartFile chunkFile) {
|
||||
@RequestPart("chunkFile") MultipartFile chunkFile)
|
||||
throws IOException {
|
||||
|
||||
String uploadDivi = "mapsheet";
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ public class MapSheetMngService {
|
||||
MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy());
|
||||
String targetYearDir = mngDto.getMngPath();
|
||||
|
||||
// 중복체크 -> 도엽/uuid_yyyyMMddhhmmss 경로에 업로드 할 거라 overwrite 되지 않음
|
||||
// 중복체크 -> 도엽/uuid 경로에 업로드 할 거라 overwrite 되지 않음
|
||||
// if (!overwrite) {
|
||||
// dmlReturn =
|
||||
// this.duplicateFile(
|
||||
@@ -151,13 +151,13 @@ public class MapSheetMngService {
|
||||
if (!FIleChecker.multipartSaveTo(tfwFile, tfwTmpPath)) {
|
||||
return new DmlReturn("fail", "UPLOAD ERROR");
|
||||
}
|
||||
if (!FIleChecker.multipartSaveTo(tifFile, tifTmpPath)) {
|
||||
return new DmlReturn("fail", "UPLOAD ERROR");
|
||||
}
|
||||
// if (!FIleChecker.multipartSaveTo(tifFile, tifTmpPath)) {
|
||||
// return new DmlReturn("fail", "UPLOAD ERROR");
|
||||
// }
|
||||
|
||||
if (!FIleChecker.cmmndGdalInfo(tifTmpPath)) {
|
||||
return new DmlReturn("fail", "TIF TYPE ERROR");
|
||||
}
|
||||
// if (!FIleChecker.cmmndGdalInfo(tifTmpPath)) {
|
||||
// return new DmlReturn("fail", "TIF TYPE ERROR");
|
||||
// }
|
||||
if (!FIleChecker.checkTfw(tfwTmpPath)) {
|
||||
return new DmlReturn("fail", "TFW TYPE ERROR");
|
||||
}
|
||||
@@ -166,12 +166,12 @@ public class MapSheetMngService {
|
||||
List<MngFilesDto> mngFiles = mapSheetMngCoreService.findByHstUidMapSheetFileList(hstUid);
|
||||
String uploadPath = "";
|
||||
for (MngFilesDto dto : mngFiles) {
|
||||
uploadPath = dto.getFilePath();
|
||||
uploadPath = dto.getFilePath() + "/" + errDto.getUuid();
|
||||
break;
|
||||
}
|
||||
|
||||
Path tfwTmpSavePath = Paths.get(tfwTmpPath);
|
||||
Path tifTmpSavePath = Paths.get(tifTmpPath);
|
||||
// Path tifTmpSavePath = Paths.get(tifTmpPath);
|
||||
Path tfwTargetPath = null;
|
||||
Path tifTargetPath = null;
|
||||
|
||||
@@ -180,7 +180,12 @@ public class MapSheetMngService {
|
||||
MngFilesDto filesDto =
|
||||
mapSheetMngCoreService.findYyyyToMapSheetFilePathRefer(errDto.getMngYyyy());
|
||||
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());
|
||||
tifTargetPath = Paths.get(uploadPath).resolve(tifFile.getOriginalFilename());
|
||||
|
||||
if (!Files.exists(tifTargetPath)) {
|
||||
return new DmlReturn("fail", "TIF 파일이 정상적으로 업로드 되지 않았습니다. 확인해주세요.");
|
||||
}
|
||||
|
||||
try {
|
||||
Files.move(tfwTmpSavePath, tfwTargetPath, StandardCopyOption.REPLACE_EXISTING);
|
||||
Files.move(tifTmpSavePath, tifTargetPath, StandardCopyOption.REPLACE_EXISTING);
|
||||
// Files.move(tifTmpSavePath, tifTargetPath, StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -365,9 +374,8 @@ public class MapSheetMngService {
|
||||
|
||||
@Transactional
|
||||
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);
|
||||
|
||||
// 싱크파일목록으로 업로드 경로 확인
|
||||
@@ -392,6 +400,18 @@ public class MapSheetMngService {
|
||||
UploadDto.UploadRes upRes = uploadService.uploadChunk(upAddReqDto, chunkFile);
|
||||
|
||||
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.setResMsg(upRes.getResMsg());
|
||||
modelUploadResDto.setUuid(upRes.getUuid());
|
||||
|
||||
Reference in New Issue
Block a user