영상관리 수정

This commit is contained in:
2025-12-24 11:23:29 +09:00
parent c874cb036c
commit 540e11a40b

View File

@@ -19,13 +19,11 @@ import java.nio.file.Paths;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.util.List; import java.util.List;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@Slf4j
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Transactional(readOnly = true) @Transactional(readOnly = true)
@@ -76,18 +74,19 @@ public class MapSheetMngService {
} }
@Transactional @Transactional
public DmlReturn uploadPair(MultipartFile tfwFile, MultipartFile tifFile, Long hstUid) { public DmlReturn uploadPair(
MultipartFile tfwFile, MultipartFile tifFile, Long hstUid, Boolean overwrite) {
String rootPath = fileConfig.getRootSyncDir(); String rootPath = fileConfig.getRootSyncDir();
String tmpPath = fileConfig.getTmpSyncDir(); String tmpPath = fileConfig.getTmpSyncDir();
ErrorDataDto errDto = mapSheetMngCoreService.findMapSheetError(hstUid); ErrorDataDto errDto = mapSheetMngCoreService.findMapSheetError(hstUid);
if (errDto == null) { if (errDto == null) {
return new DmlReturn("fail", "NO hstUid Data"); return new DmlReturn("fail", "NO hstUid Data");
} }
// 파일검증용 임시저장 폴더 확인 // 파일검증용 임시저장 폴더 확인
log.info("TmpPath > {}", tmpPath);
if (!FIleChecker.mkDir(tmpPath)) { if (!FIleChecker.mkDir(tmpPath)) {
return new DmlReturn("fail", "CREATE TEMP FOLDER ERROR"); return new DmlReturn("fail", "CREATE TEMP FOLDER ERROR");
} }
@@ -128,6 +127,7 @@ public class MapSheetMngService {
.filter(dto -> dto.getExtension().toString().equals("tif")) .filter(dto -> dto.getExtension().toString().equals("tif"))
.count(); .count();
if (!overwrite) {
if (tfwCnt > 0 || tifCnt > 0) { if (tfwCnt > 0 || tifCnt > 0) {
String tfwtifMsg = ""; String tfwtifMsg = "";
if (tfwCnt > 0) { if (tfwCnt > 0) {
@@ -142,6 +142,7 @@ public class MapSheetMngService {
} }
return new DmlReturn("duplicate", tfwtifMsg); return new DmlReturn("duplicate", tfwtifMsg);
} }
}
File directory = new File(tmpPath); File directory = new File(tmpPath);
String tfwTmpPath = tmpPath + tfwFile.getOriginalFilename(); String tfwTmpPath = tmpPath + tfwFile.getOriginalFilename();