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