영상관리 파일중복처리 수정
This commit is contained in:
@@ -147,6 +147,7 @@ public class MapSheetMngApiController {
|
||||
return ApiResponseDto.ok(mapSheetMngService.findMapSheetErrorList(searchReq));
|
||||
}
|
||||
|
||||
/*
|
||||
@Operation(summary = "오류데이터 팝업 > 업로드 처리", description = "오류데이터 팝업 > 업로드 처리")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@@ -167,6 +168,9 @@ public class MapSheetMngApiController {
|
||||
return ApiResponseDto.ok(mapSheetMngService.uploadProcess(hstUidList));
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
@Operation(summary = "오류데이터 팝업 > 추론 제외", description = "오류데이터 팝업 > 추론 제외")
|
||||
@PutMapping("/except-inference")
|
||||
public ApiResponseDto<MapSheetMngDto.DmlReturn> updateExceptUseInference(
|
||||
@@ -186,12 +190,14 @@ public class MapSheetMngApiController {
|
||||
mapSheetMngService.uploadPair(tfwFile, tifFile, hstUid, overwrite));
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
@Operation(summary = "영상관리 > 파일조회", description = "영상관리 > 파일조회")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "201",
|
||||
description = "파일삭제 처리 성공",
|
||||
description = "파일조회 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
@@ -227,6 +233,27 @@ public class MapSheetMngApiController {
|
||||
}
|
||||
|
||||
|
||||
@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("/update-use-mng-files")
|
||||
public ApiResponseDto<MapSheetMngDto.DmlReturn> updateUseByFileUidMngFile(
|
||||
@RequestParam @Valid List<Long> fileUids) {
|
||||
return ApiResponseDto.ok(mapSheetMngService.setUseByFileUidMngFile(fileUids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Operation(summary = "폴더 조회", description = "폴더 조회 (ROOT:/app/original-images 이하로 경로입력)")
|
||||
@ApiResponses(
|
||||
|
||||
@@ -205,33 +205,37 @@ public class MapSheetMngService {
|
||||
public DmlReturn deleteByFileUidMngFile(List<Long> fileUids) {
|
||||
|
||||
long hstUid = 0;
|
||||
// hstUid = 149049;
|
||||
|
||||
for (Long uid : fileUids) {
|
||||
MapSheetMngDto.MngFilesDto dto = mapSheetMngCoreService.findIdToMapSheetFile(uid);
|
||||
hstUid = dto.getHstUid();
|
||||
|
||||
String filePath = dto.getFilePath() + "/" + dto.getFileName();
|
||||
Path path = Paths.get(filePath);
|
||||
try {
|
||||
boolean isDeleted = Files.deleteIfExists(path);
|
||||
if (isDeleted) {
|
||||
System.out.println("파일 삭제 성공: " + filePath);
|
||||
} else {
|
||||
System.out.println("삭제 실패: 파일이 존재하지 않습니다.");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.err.println("파일 삭제 중 오류 발생: " + e.getMessage());
|
||||
}
|
||||
DmlReturn dmlReturn = mapSheetMngCoreService.deleteByFileUidMngFile(uid);
|
||||
mapSheetMngCoreService.deleteByFileUidMngFile(uid);
|
||||
}
|
||||
|
||||
// 중복제거 확인후 처리상태(DONE)변경
|
||||
if (hstUid > 0) mapSheetMngCoreService.updateByHstUidSyncCheckState(hstUid);
|
||||
//if (hstUid > 0) mapSheetMngCoreService.updateByHstUidSyncCheckState(hstUid);
|
||||
|
||||
return new DmlReturn("success", fileUids.size() + "개 파일이 삭제되었습니다.");
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public DmlReturn setUseByFileUidMngFile(List<Long> fileUids) {
|
||||
|
||||
long hstUid = 0;
|
||||
|
||||
DmlReturn dmlReturn = new DmlReturn("success", "정상처리되었습니다.");
|
||||
|
||||
MapSheetMngDto.MngFilesDto dto = mapSheetMngCoreService.findByFileUidMapSheetFile(fileUids.get(0));
|
||||
hstUid = dto.getHstUid();
|
||||
|
||||
mapSheetMngCoreService.deleteByNotInFileUidMngFile(hstUid, fileUids);
|
||||
|
||||
for (Long uid : fileUids) {
|
||||
mapSheetMngCoreService.updateByFileUidFileState(uid, "DONE");
|
||||
}
|
||||
|
||||
return new DmlReturn("success", fileUids.size() + "개 파일이 사용설정되었습니다.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public DmlReturn validationFile(MultipartFile tfwFile, MultipartFile tifFile)
|
||||
|
||||
@@ -52,6 +52,8 @@ public class MapSheetMngCoreService {
|
||||
mapSheetMngRepository.deleteByHstUidMngFile(hstUid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int findByYearFileNameFileCount(int mngYyyy, String fileName) {
|
||||
return mapSheetMngRepository.findByYearFileNameFileCount(mngYyyy, fileName);
|
||||
}
|
||||
@@ -85,8 +87,8 @@ public class MapSheetMngCoreService {
|
||||
return mapSheetMngRepository.findYyyyToMapSheetFilePathRefer(mngYyyy);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.MngFilesDto findIdToMapSheetFile(Long fileUid) {
|
||||
return mapSheetMngRepository.findIdToMapSheetFile(fileUid);
|
||||
public MapSheetMngDto.MngFilesDto findByFileUidMapSheetFile(Long fileUid) {
|
||||
return mapSheetMngRepository.findByFileUidMapSheetFile(fileUid);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn uploadProcess(@Valid List<Long> hstUidList) {
|
||||
@@ -242,11 +244,8 @@ public class MapSheetMngCoreService {
|
||||
return mapSheetMngRepository.findHstUidToMapSheetFileList(hstUid);
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn deleteByFileUidMngFile(Long fileUid) {
|
||||
|
||||
public void deleteByFileUidMngFile(Long fileUid) {
|
||||
mapSheetMngRepository.deleteByFileUidMngFile(fileUid);
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", fileUid + " : 삭제되었습니다.");
|
||||
}
|
||||
|
||||
public MapSheetMngDto.DmlReturn updateByHstUidSyncCheckState(Long hstUid) {
|
||||
@@ -273,4 +272,18 @@ public class MapSheetMngCoreService {
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", hstUid + " : 상태변경되었습니다.");
|
||||
}
|
||||
|
||||
|
||||
public MapSheetMngDto.DmlReturn updateByFileUidFileState(Long fileUid, String fileState) {
|
||||
|
||||
mapSheetMngRepository.updateByFileUidMngFileState(fileUid, fileState);
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", fileUid + " : 상태변경되었습니다.");
|
||||
}
|
||||
|
||||
public void deleteByNotInFileUidMngFile(Long hstUid, List<Long> fileUids){
|
||||
mapSheetMngRepository.deleteByNotInFileUidMngFile(hstUid, fileUids);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -54,4 +55,10 @@ public class MapSheetMngFileEntity {
|
||||
@Size(max = 20)
|
||||
@Column(name = "file_state", length = 20)
|
||||
private String fileState;
|
||||
|
||||
@NotNull
|
||||
@ColumnDefault("false")
|
||||
@Column(name = "file_del", nullable = false)
|
||||
private Boolean fileDel = false;
|
||||
|
||||
}
|
||||
|
||||
@@ -43,6 +43,10 @@ public interface MapSheetMngRepositoryCustom {
|
||||
|
||||
void updateByHstUidMngFileState(Long hstUid, String fileState);
|
||||
|
||||
void updateByFileUidMngFileState(Long fileUid, String fileState);
|
||||
|
||||
void deleteByNotInFileUidMngFile(Long hstUid, List<Long> fileUids);
|
||||
|
||||
void updateYearState(int yyyy, String status);
|
||||
|
||||
Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
||||
@@ -52,7 +56,7 @@ public interface MapSheetMngRepositoryCustom {
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> findIdToMapSheetFileList(Long hstUid);
|
||||
|
||||
MapSheetMngDto.MngFilesDto findIdToMapSheetFile(Long fileUid);
|
||||
MapSheetMngDto.MngFilesDto findByFileUidMapSheetFile(Long fileUid);
|
||||
|
||||
void updateHstFileSizes(Long hstUid, long tifSizeBytes, long tfwSizeBytes, long totalSizeBytes);
|
||||
|
||||
|
||||
@@ -478,6 +478,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
public List<MapSheetMngDto.MngFilesDto> findHstUidToMapSheetFileList(Long hstUid) {
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
whereBuilder.and(mapSheetMngFileEntity.hstUid.eq(hstUid));
|
||||
whereBuilder.and(mapSheetMngFileEntity.fileDel.eq(false));
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> foundContent =
|
||||
queryFactory
|
||||
@@ -531,7 +532,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapSheetMngDto.MngFilesDto findIdToMapSheetFile(Long fileUid) {
|
||||
public MapSheetMngDto.MngFilesDto findByFileUidMapSheetFile(Long fileUid) {
|
||||
|
||||
MapSheetMngDto.MngFilesDto foundContent =
|
||||
queryFactory
|
||||
@@ -636,8 +637,9 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
public void deleteByHstUidMngFile(Long hstUid) {
|
||||
long deletedFileCount =
|
||||
queryFactory
|
||||
.delete(mapSheetMngFileEntity)
|
||||
.where(mapSheetMngFileEntity.fileUid.eq(hstUid))
|
||||
.update(mapSheetMngFileEntity)
|
||||
.set(mapSheetMngFileEntity.fileDel, true)
|
||||
.where(mapSheetMngFileEntity.hstUid.eq(hstUid))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@@ -645,7 +647,8 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
public void deleteByFileUidMngFile(Long fileUid) {
|
||||
long fileCount =
|
||||
queryFactory
|
||||
.delete(mapSheetMngFileEntity)
|
||||
.update(mapSheetMngFileEntity)
|
||||
.set(mapSheetMngFileEntity.fileDel, true)
|
||||
.where(mapSheetMngFileEntity.fileUid.eq(fileUid))
|
||||
.execute();
|
||||
}
|
||||
@@ -660,6 +663,27 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByNotInFileUidMngFile(Long hstUid, List<Long> fileUids){
|
||||
long execCount =
|
||||
queryFactory
|
||||
.update(mapSheetMngFileEntity)
|
||||
.set(mapSheetMngFileEntity.fileDel, true)
|
||||
.where(mapSheetMngFileEntity.hstUid.eq(hstUid)
|
||||
.and(mapSheetMngFileEntity.fileUid.notIn(fileUids)))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByFileUidMngFileState(Long fileUid, String fileState) {
|
||||
long execCount =
|
||||
queryFactory
|
||||
.update(mapSheetMngFileEntity)
|
||||
.set(mapSheetMngFileEntity.fileState, fileState)
|
||||
.where(mapSheetMngFileEntity.fileUid.eq(fileUid))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int findByYearFileNameFileCount(int mngYyyy, String fileName){
|
||||
Long execCount = queryFactory
|
||||
|
||||
Reference in New Issue
Block a user