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