중복파일삭제 수정

This commit is contained in:
Moon
2025-12-18 10:42:50 +09:00
parent d7ae194d8f
commit 9d1d9aff69
7 changed files with 63 additions and 3 deletions

View File

@@ -178,9 +178,14 @@ public class FIleChecker {
if (isWindows) { if (isWindows) {
// 윈도우용 // 윈도우용
command.add("cmd.exe"); command.add("cmd.exe"); // 윈도우 명령 프롬프트 실행
command.add("/c"); command.add("/c"); // 명령어를 수행하고 종료한다는 옵션
command.add(gdalinfoPath + " \"" + filePath + "\" | findstr /i Geo"); command.add("gdalinfo");
command.add(filePath);
command.add("|");
command.add("findstr");
command.add("/i");
command.add("Geo");
} else if (isMac || isUnix) { } else if (isMac || isUnix) {
// 리눅스, 맥용 // 리눅스, 맥용
command.add("sh"); command.add("sh");

View File

@@ -161,5 +161,26 @@ public class MapSheetMngApiController {
return ApiResponseDto.ok(mapSheetMngService.findHstUidToMapSheetFileList(hstUid)); return ApiResponseDto.ok(mapSheetMngService.findHstUidToMapSheetFileList(hstUid));
} }
@Operation(summary = "영상관리 > 파일삭제", description = "영상관리 > 파일삭제")
@ApiResponses(
value = {
@ApiResponse(
responseCode = "201",
description = "파일삭제 처리 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Long.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@PutMapping("/del-mng-files")
public ApiResponseDto<MapSheetMngDto.DmlReturn> deleteByFileUidMngFile(@RequestParam @Valid List<Long> fileUids) {
return ApiResponseDto.ok(mapSheetMngService.deleteByFileUidMngFile(fileUids));
}
} }

View File

@@ -71,6 +71,7 @@ public class MapSheetMngFileCheckerApiController {
return ApiResponseDto.createOK(mapSheetMngFileCheckerService.getFilesAll(srchDto)); return ApiResponseDto.createOK(mapSheetMngFileCheckerService.getFilesAll(srchDto));
} }
/*
@Operation(summary = "파일 업로드", description = "파일 업로드 및 TIF 검증") @Operation(summary = "파일 업로드", description = "파일 업로드 및 TIF 검증")
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ApiResponseDto<String> uploadFile( public ApiResponseDto<String> uploadFile(
@@ -83,6 +84,9 @@ public class MapSheetMngFileCheckerApiController {
mapSheetMngFileCheckerService.uploadFile(file, targetPath, overwrite, hstUid)); mapSheetMngFileCheckerService.uploadFile(file, targetPath, overwrite, hstUid));
} }
*/
/*
@Operation(summary = "파일 삭제", description = "중복 파일 등 파일 삭제") @Operation(summary = "파일 삭제", description = "중복 파일 등 파일 삭제")
@PostMapping("/delete") @PostMapping("/delete")
public ApiResponseDto<Boolean> deleteFile(@RequestBody SrchFoldersDto dto) { public ApiResponseDto<Boolean> deleteFile(@RequestBody SrchFoldersDto dto) {
@@ -97,6 +101,8 @@ public class MapSheetMngFileCheckerApiController {
mapSheetMngFileCheckerService.deleteDuplicate(filePath, fileName)); mapSheetMngFileCheckerService.deleteDuplicate(filePath, fileName));
} }
*/
/* /*
@Operation(summary = "지정폴더(하위폴더포함) 파일목록 조회", description = "지정폴더(하위폴더포함) 파일목록 조회") @Operation(summary = "지정폴더(하위폴더포함) 파일목록 조회", description = "지정폴더(하위폴더포함) 파일목록 조회")
@ApiResponses( @ApiResponses(

View File

@@ -324,4 +324,15 @@ public class MapSheetMngService {
return mapSheetMngCoreService.findHstUidToMapSheetFileList(hstUid); return mapSheetMngCoreService.findHstUidToMapSheetFileList(hstUid);
} }
@Transactional
public MapSheetMngDto.DmlReturn deleteByFileUidMngFile(List<Long> fileUids) {
for (Long uid : fileUids) {
MapSheetMngDto.DmlReturn dmlReturn = mapSheetMngCoreService.deleteByFileUidMngFile(uid);
}
return new MapSheetMngDto.DmlReturn("success", fileUids.size() + "개 파일이 삭제되었습니다.");
}
} }

View File

@@ -212,4 +212,10 @@ public class MapSheetMngCoreService {
return mapSheetMngRepository.findHstUidToMapSheetFileList(hstUid); return mapSheetMngRepository.findHstUidToMapSheetFileList(hstUid);
} }
public MapSheetMngDto.DmlReturn deleteByFileUidMngFile(Long fileUid) {
mapSheetMngRepository.deleteByFileUidMngFile(fileUid);
return new MapSheetMngDto.DmlReturn("success", fileUid + " : 삭제되었습니다.");
}
} }

View File

@@ -21,6 +21,8 @@ public interface MapSheetMngRepositoryCustom {
List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid); List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid);
void deleteByFileUidMngFile(Long fileUid);
MapSheetMngDto.MngFilesDto findYyyyToMapSheetFilePath(int mngYyyy); MapSheetMngDto.MngFilesDto findYyyyToMapSheetFilePath(int mngYyyy);
void deleteByMngYyyyMngAll(int mngYyyy); void deleteByMngYyyyMngAll(int mngYyyy);

View File

@@ -556,6 +556,15 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
.execute(); .execute();
} }
@Override
public void deleteByFileUidMngFile(Long fileUid){
long deletedFileCount =
queryFactory
.delete(mapSheetMngFileEntity)
.where(mapSheetMngFileEntity.fileUid.eq(fileUid))
.execute();
}
@Override @Override
public int insertMapSheetOrgDataToMapSheetMngHst(int mngYyyy) { public int insertMapSheetOrgDataToMapSheetMngHst(int mngYyyy) {