영상관리 수정
This commit is contained in:
@@ -19,13 +19,11 @@ import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(readOnly = true)
|
||||
@@ -76,18 +74,19 @@ public class MapSheetMngService {
|
||||
}
|
||||
|
||||
@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 tmpPath = fileConfig.getTmpSyncDir();
|
||||
|
||||
ErrorDataDto errDto = mapSheetMngCoreService.findMapSheetError(hstUid);
|
||||
|
||||
if (errDto == null) {
|
||||
return new DmlReturn("fail", "NO hstUid Data");
|
||||
}
|
||||
|
||||
// 파일검증용 임시저장 폴더 확인
|
||||
log.info("TmpPath > {}", tmpPath);
|
||||
if (!FIleChecker.mkDir(tmpPath)) {
|
||||
return new DmlReturn("fail", "CREATE TEMP FOLDER ERROR");
|
||||
}
|
||||
@@ -111,36 +110,38 @@ public class MapSheetMngService {
|
||||
|
||||
// 중복체크
|
||||
List<FIleChecker.Basic> basicTfwList =
|
||||
FIleChecker.getFilesFromAllDepth(targetYearDir, tfwFile.getOriginalFilename(), "tfw");
|
||||
FIleChecker.getFilesFromAllDepth(targetYearDir, tfwFile.getOriginalFilename(), "tfw");
|
||||
|
||||
List<FIleChecker.Basic> basicTifList =
|
||||
FIleChecker.getFilesFromAllDepth(targetYearDir, tifFile.getOriginalFilename(), "tif");
|
||||
FIleChecker.getFilesFromAllDepth(targetYearDir, tifFile.getOriginalFilename(), "tif");
|
||||
|
||||
int tfwCnt =
|
||||
(int)
|
||||
basicTfwList.stream()
|
||||
.filter(dto -> dto.getExtension().toString().equals("tfw"))
|
||||
.count();
|
||||
(int)
|
||||
basicTfwList.stream()
|
||||
.filter(dto -> dto.getExtension().toString().equals("tfw"))
|
||||
.count();
|
||||
|
||||
int tifCnt =
|
||||
(int)
|
||||
basicTifList.stream()
|
||||
.filter(dto -> dto.getExtension().toString().equals("tif"))
|
||||
.count();
|
||||
(int)
|
||||
basicTifList.stream()
|
||||
.filter(dto -> dto.getExtension().toString().equals("tif"))
|
||||
.count();
|
||||
|
||||
if (tfwCnt > 0 || tifCnt > 0) {
|
||||
String tfwtifMsg = "";
|
||||
if (tfwCnt > 0) {
|
||||
tfwtifMsg = tfwFile.getOriginalFilename();
|
||||
}
|
||||
if (tifCnt > 0) {
|
||||
if (!overwrite) {
|
||||
if (tfwCnt > 0 || tifCnt > 0) {
|
||||
String tfwtifMsg = "";
|
||||
if (tfwCnt > 0) {
|
||||
tfwtifMsg = "," + tifFile.getOriginalFilename();
|
||||
} else {
|
||||
tfwtifMsg = tifFile.getOriginalFilename();
|
||||
tfwtifMsg = tfwFile.getOriginalFilename();
|
||||
}
|
||||
if (tifCnt > 0) {
|
||||
if (tfwCnt > 0) {
|
||||
tfwtifMsg = "," + tifFile.getOriginalFilename();
|
||||
} else {
|
||||
tfwtifMsg = tifFile.getOriginalFilename();
|
||||
}
|
||||
}
|
||||
return new DmlReturn("duplicate", tfwtifMsg);
|
||||
}
|
||||
return new DmlReturn("duplicate", tfwtifMsg);
|
||||
}
|
||||
|
||||
File directory = new File(tmpPath);
|
||||
@@ -178,7 +179,7 @@ public class MapSheetMngService {
|
||||
// 파일이 존재하지 않을 경우(0개) 해당년도 다른 파일경로로 참조
|
||||
if (uploadPath.isEmpty()) {
|
||||
MngFilesDto filesDto =
|
||||
mapSheetMngCoreService.findYyyyToMapSheetFilePathRefer(errDto.getMngYyyy());
|
||||
mapSheetMngCoreService.findYyyyToMapSheetFilePathRefer(errDto.getMngYyyy());
|
||||
String referPath = filesDto.getFilePath();
|
||||
uploadPath = Paths.get(referPath).getParent().toString() + "/" + errDto.getRefMapSheetNum();
|
||||
}
|
||||
@@ -200,7 +201,7 @@ public class MapSheetMngService {
|
||||
|
||||
// hst업데이트
|
||||
MapSheetMngDto.SyncCheckStateReqUpdateDto updReqSyncCheckState =
|
||||
new MapSheetMngDto.SyncCheckStateReqUpdateDto();
|
||||
new MapSheetMngDto.SyncCheckStateReqUpdateDto();
|
||||
updReqSyncCheckState.setHstUid(hstUid);
|
||||
updReqSyncCheckState.setFilePath(uploadPath);
|
||||
updReqSyncCheckState.setSyncCheckTfwFileName(tfwFile.getOriginalFilename());
|
||||
|
||||
Reference in New Issue
Block a user