오버라이트업로드 수정
This commit is contained in:
@@ -175,8 +175,9 @@ public class MapSheetMngApiController {
|
|||||||
public ApiResponseDto<MapSheetMngDto.DmlReturn> uploadPair(
|
public ApiResponseDto<MapSheetMngDto.DmlReturn> uploadPair(
|
||||||
@RequestPart("tfw") MultipartFile tfwFile,
|
@RequestPart("tfw") MultipartFile tfwFile,
|
||||||
@RequestPart("tif") MultipartFile tifFile,
|
@RequestPart("tif") MultipartFile tifFile,
|
||||||
@RequestParam(value = "hstUid", required = false) Long hstUid) {
|
@RequestParam(value = "hstUid", required = false) Long hstUid,
|
||||||
return ApiResponseDto.createOK(mapSheetMngService.uploadPair(tfwFile, tifFile, hstUid));
|
@RequestParam(value = "overwrite", required = false) boolean overwrite) {
|
||||||
|
return ApiResponseDto.createOK(mapSheetMngService.uploadPair(tfwFile, tifFile, hstUid, overwrite));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "영상관리 > 파일조회", description = "영상관리 > 파일조회")
|
@Operation(summary = "영상관리 > 파일조회", description = "영상관리 > 파일조회")
|
||||||
|
|||||||
@@ -74,12 +74,13 @@ 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");
|
||||||
}
|
}
|
||||||
@@ -125,14 +126,19 @@ public class MapSheetMngService {
|
|||||||
.filter(dto -> dto.getExtension().toString().equals("tif"))
|
.filter(dto -> dto.getExtension().toString().equals("tif"))
|
||||||
.count();
|
.count();
|
||||||
|
|
||||||
if (tfwCnt > 0 || tifCnt > 0) {
|
if( !overwrite ) {
|
||||||
String tfwtifMsg = "";
|
if (tfwCnt > 0 || tifCnt > 0) {
|
||||||
if (tfwCnt > 0) tfwtifMsg = tfwFile.getOriginalFilename();
|
String tfwtifMsg = "";
|
||||||
if (tifCnt > 0) {
|
if (tfwCnt > 0)
|
||||||
if (tfwCnt > 0) tfwtifMsg = "," + tifFile.getOriginalFilename();
|
tfwtifMsg = tfwFile.getOriginalFilename();
|
||||||
else tfwtifMsg = tifFile.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);
|
File directory = new File(tmpPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user