영상관리 주성

This commit is contained in:
2025-12-26 15:20:16 +09:00
parent 8ff5ac68f0
commit ef4cd48827
6 changed files with 115 additions and 131 deletions

View File

@@ -214,8 +214,9 @@ public class MapSheetMngApiController {
return ApiResponseDto.ok(mapSheetMngService.findByHstUidMapSheetFileList(hstUid)); return ApiResponseDto.ok(mapSheetMngService.findByHstUidMapSheetFileList(hstUid));
} }
@Operation(
@Operation(summary = "영상관리 > 파일사용설정 및 중복제거", description = "영상관리 >파일사용설정 및 중복제거(중복파일제거 및 선택파일사용설정)") summary = "영상관리 > 파일사용설정 및 중복제거",
description = "영상관리 >파일사용설정 및 중복제거(중복파일제거 및 선택파일사용설정)")
@ApiResponses( @ApiResponses(
value = { value = {
@ApiResponse( @ApiResponse(
@@ -235,8 +236,6 @@ public class MapSheetMngApiController {
return ApiResponseDto.ok(mapSheetMngService.setUseByFileUidMngFile(fileUids)); return ApiResponseDto.ok(mapSheetMngService.setUseByFileUidMngFile(fileUids));
} }
@Operation(summary = "폴더 조회", description = "폴더 조회 (ROOT:/app/original-images 이하로 경로입력)") @Operation(summary = "폴더 조회", description = "폴더 조회 (ROOT:/app/original-images 이하로 경로입력)")
@ApiResponses( @ApiResponses(
value = { value = {
@@ -274,6 +273,4 @@ public class MapSheetMngApiController {
return ApiResponseDto.createOK(mapSheetMngService.getFilesAll(srchDto)); return ApiResponseDto.createOK(mapSheetMngService.getFilesAll(srchDto));
} }
} }

View File

@@ -90,8 +90,6 @@ public class MapSheetMngDto {
@JsonFormatDttm private ZonedDateTime rgstStrtDttm; @JsonFormatDttm private ZonedDateTime rgstStrtDttm;
@JsonFormatDttm private ZonedDateTime rgstEndDttm; @JsonFormatDttm private ZonedDateTime rgstEndDttm;
public String getSyncState() { public String getSyncState() {
if (this.syncStateDoneCnt == 0) return "NOTYET"; if (this.syncStateDoneCnt == 0) return "NOTYET";
@@ -130,7 +128,6 @@ public class MapSheetMngDto {
return this.syncNotPaireExecCnt + this.syncDuplicateExecCnt + this.syncFaultExecCnt; return this.syncNotPaireExecCnt + this.syncDuplicateExecCnt + this.syncFaultExecCnt;
} }
public String getMngState() { public String getMngState() {
String mngState = "DONE"; String mngState = "DONE";
@@ -153,7 +150,6 @@ public class MapSheetMngDto {
MngStateType type = Enums.fromId(MngStateType.class, enumId); MngStateType type = Enums.fromId(MngStateType.class, enumId);
return type.getText(); return type.getText();
} }
} }
@Schema(name = "ErrorSearchReq", description = "영상관리 오류데이터 검색 요청") @Schema(name = "ErrorSearchReq", description = "영상관리 오류데이터 검색 요청")

View File

@@ -14,7 +14,6 @@ import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngDto;
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngFilesDto; import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.MngFilesDto;
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService; import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
@@ -75,16 +74,16 @@ public class MapSheetMngService {
@Transactional @Transactional
public DmlReturn mngDataSave(AddReq addReq) { public DmlReturn mngDataSave(AddReq addReq) {
int execCnt = mapSheetMngCoreService.mngDataSave(addReq); int execCnt = mapSheetMngCoreService.mngDataSave(addReq);
return new MapSheetMngDto.DmlReturn("success", addReq.getMngYyyy()+"년, "+execCnt+"건 생성"); return new MapSheetMngDto.DmlReturn("success", addReq.getMngYyyy() + "년, " + execCnt + "건 생성");
} }
public DmlReturn updateExceptUseInference(@Valid List<Long> hstUidList) { public DmlReturn updateExceptUseInference(@Valid List<Long> hstUidList) {
return mapSheetMngCoreService.updateExceptUseInference(hstUidList); return mapSheetMngCoreService.updateExceptUseInference(hstUidList);
} }
@Transactional @Transactional
public DmlReturn uploadPair(MultipartFile tfwFile, MultipartFile tifFile, Long hstUid, Boolean overwrite) { public DmlReturn uploadPair(
MultipartFile tfwFile, MultipartFile tifFile, Long hstUid, Boolean overwrite) {
String rootPath = syncRootDir; String rootPath = syncRootDir;
String tmpPath = syncTmpDir; String tmpPath = syncTmpDir;
@@ -102,26 +101,29 @@ public class MapSheetMngService {
return new DmlReturn("fail", "CREATE TEMP FOLDER ERROR"); return new DmlReturn("fail", "CREATE TEMP FOLDER ERROR");
} }
//업로드 파일 사이즈,확장자명 체크 // 업로드 파일 사이즈,확장자명 체크
dmlReturn = this.validationFile(tfwFile, tifFile); dmlReturn = this.validationFile(tfwFile, tifFile);
if( dmlReturn.getFlag().equals("fail") )return dmlReturn; if (dmlReturn.getFlag().equals("fail")) return dmlReturn;
MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy()); MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy());
String targetYearDir = mngDto.getMngPath(); String targetYearDir = mngDto.getMngPath();
// 중복체크 // 중복체크
if( !overwrite ) { if (!overwrite) {
dmlReturn = this.duplicateFile(errDto.getMngYyyy(), tfwFile.getOriginalFilename(), tifFile.getOriginalFilename()); dmlReturn =
if( dmlReturn.getFlag().equals("duplicate") )return dmlReturn; this.duplicateFile(
errDto.getMngYyyy(), tfwFile.getOriginalFilename(), tifFile.getOriginalFilename());
if (dmlReturn.getFlag().equals("duplicate")) return dmlReturn;
} }
//멀티파트 파일 tmp폴더 저장(파일형식 체크를 위해) // 멀티파트 파일 tmp폴더 저장(파일형식 체크를 위해)
String tfwTmpPath = tmpPath + tfwFile.getOriginalFilename(); String tfwTmpPath = tmpPath + tfwFile.getOriginalFilename();
String tifTmpPath = tmpPath + tifFile.getOriginalFilename(); String tifTmpPath = tmpPath + tifFile.getOriginalFilename();
if(!FIleChecker.multipartSaveTo(tfwFile, tfwTmpPath))return new DmlReturn("fail", "UPLOAD ERROR"); if (!FIleChecker.multipartSaveTo(tfwFile, tfwTmpPath))
if(!FIleChecker.multipartSaveTo(tifFile, tifTmpPath))return new DmlReturn("fail", "UPLOAD ERROR"); return new DmlReturn("fail", "UPLOAD ERROR");
if (!FIleChecker.multipartSaveTo(tifFile, tifTmpPath))
return new DmlReturn("fail", "UPLOAD ERROR");
if (!FIleChecker.cmmndGdalInfo(tifTmpPath)) return new DmlReturn("fail", "TIF TYPE ERROR"); if (!FIleChecker.cmmndGdalInfo(tifTmpPath)) return new DmlReturn("fail", "TIF TYPE ERROR");
if (!FIleChecker.checkTfw(tfwTmpPath)) return new DmlReturn("fail", "TFW TYPE ERROR"); if (!FIleChecker.checkTfw(tfwTmpPath)) return new DmlReturn("fail", "TFW TYPE ERROR");
@@ -134,7 +136,6 @@ public class MapSheetMngService {
break; break;
} }
Path tfwTmpSavePath = Paths.get(tfwTmpPath); Path tfwTmpSavePath = Paths.get(tfwTmpPath);
Path tifTmpSavePath = Paths.get(tifTmpPath); Path tifTmpSavePath = Paths.get(tifTmpPath);
Path tfwTargetPath = null; Path tfwTargetPath = null;
@@ -199,7 +200,6 @@ public class MapSheetMngService {
return mapSheetMngCoreService.findByHstUidMapSheetFileList(hstUid); return mapSheetMngCoreService.findByHstUidMapSheetFileList(hstUid);
} }
@Transactional @Transactional
public DmlReturn setUseByFileUidMngFile(List<Long> fileUids) { public DmlReturn setUseByFileUidMngFile(List<Long> fileUids) {
@@ -207,7 +207,8 @@ public class MapSheetMngService {
DmlReturn dmlReturn = new DmlReturn("success", "정상처리되었습니다."); DmlReturn dmlReturn = new DmlReturn("success", "정상처리되었습니다.");
MapSheetMngDto.SyncCheckStateReqUpdateDto reqDto = new MapSheetMngDto.SyncCheckStateReqUpdateDto(); MapSheetMngDto.SyncCheckStateReqUpdateDto reqDto =
new MapSheetMngDto.SyncCheckStateReqUpdateDto();
for (Long uid : fileUids) { for (Long uid : fileUids) {
MapSheetMngDto.MngFilesDto dto = mapSheetMngCoreService.findByFileUidMapSheetFile(uid); MapSheetMngDto.MngFilesDto dto = mapSheetMngCoreService.findByFileUidMapSheetFile(uid);
@@ -222,39 +223,36 @@ public class MapSheetMngService {
mapSheetMngCoreService.updateByFileUidFileState(uid, "DONE"); mapSheetMngCoreService.updateByFileUidFileState(uid, "DONE");
} }
//선택제외 삭제처리 // 선택제외 삭제처리
mapSheetMngCoreService.deleteByNotInFileUidMngFile(reqDto.getHstUid(), fileUids); mapSheetMngCoreService.deleteByNotInFileUidMngFile(reqDto.getHstUid(), fileUids);
//Hst(내역) 테이블 상태 업데이트 // Hst(내역) 테이블 상태 업데이트
mapSheetMngCoreService.updateByHstUidSyncCheckState(reqDto); mapSheetMngCoreService.updateByHstUidSyncCheckState(reqDto);
return new DmlReturn("success", fileUids.size() + "개 파일이 사용설정되었습니다."); return new DmlReturn("success", fileUids.size() + "개 파일이 사용설정되었습니다.");
} }
public DmlReturn validationFile(MultipartFile tfwFile, MultipartFile tifFile) public DmlReturn validationFile(MultipartFile tfwFile, MultipartFile tifFile) {
{ if (!FIleChecker.validationMultipart(tfwFile)) return new DmlReturn("fail", "TFW SIZE 오류");
if( !FIleChecker.validationMultipart(tfwFile) )return new DmlReturn("fail", "TFW SIZE 오류"); else if (!FIleChecker.validationMultipart(tifFile)) return new DmlReturn("fail", "TFW SIZE 오류");
else if( !FIleChecker.validationMultipart(tifFile) )return new DmlReturn("fail", "TFW SIZE 오류"); else if (!FIleChecker.checkExtensions(tfwFile.getOriginalFilename(), "tfw"))
else if (!FIleChecker.checkExtensions(tfwFile.getOriginalFilename(), "tfw"))return new DmlReturn("fail", "TFW FILENAME ERROR"); return new DmlReturn("fail", "TFW FILENAME ERROR");
else if (!FIleChecker.checkExtensions(tifFile.getOriginalFilename(), "tif"))return new DmlReturn("fail", "TIF FILENAME ERROR"); else if (!FIleChecker.checkExtensions(tifFile.getOriginalFilename(), "tif"))
return new DmlReturn("fail", "TIF FILENAME ERROR");
return new DmlReturn("success", "파일체크"); return new DmlReturn("success", "파일체크");
} }
public DmlReturn duplicateFile(int mngYyyy, String tfwFileName, String tifFileName) public DmlReturn duplicateFile(int mngYyyy, String tfwFileName, String tifFileName) {
{
int tfwCnt = mapSheetMngCoreService.findByYearFileNameFileCount(mngYyyy, tfwFileName); int tfwCnt = mapSheetMngCoreService.findByYearFileNameFileCount(mngYyyy, tfwFileName);
int tifCnt = mapSheetMngCoreService.findByYearFileNameFileCount(mngYyyy, tifFileName); int tifCnt = mapSheetMngCoreService.findByYearFileNameFileCount(mngYyyy, tifFileName);
if (tfwCnt > 0 || tifCnt > 0) { if (tfwCnt > 0 || tifCnt > 0) {
String resMsg = ""; String resMsg = "";
if (tfwCnt > 0) if (tfwCnt > 0) resMsg = tfwFileName;
resMsg = tfwFileName;
if (tifCnt > 0) { if (tifCnt > 0) {
if (tfwCnt > 0) if (tfwCnt > 0) resMsg = resMsg + "," + tifFileName;
resMsg = resMsg + "," + tifFileName; else resMsg = tifFileName;
else
resMsg = tifFileName;
} }
return new DmlReturn("duplicate", resMsg); return new DmlReturn("duplicate", resMsg);
} }

View File

@@ -6,16 +6,9 @@ import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
import com.kamco.cd.kamcoback.postgres.repository.mapsheet.MapSheetMngRepository; import com.kamco.cd.kamcoback.postgres.repository.mapsheet.MapSheetMngRepository;
import jakarta.persistence.EntityNotFoundException; import jakarta.persistence.EntityNotFoundException;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
@@ -50,7 +43,6 @@ 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);
} }
@@ -87,8 +79,6 @@ public class MapSheetMngCoreService {
return mapSheetMngRepository.findByFileUidMapSheetFile(fileUid); return mapSheetMngRepository.findByFileUidMapSheetFile(fileUid);
} }
public MapSheetMngDto.DmlReturn updateExceptUseInference(@Valid List<Long> hstUidList) { public MapSheetMngDto.DmlReturn updateExceptUseInference(@Valid List<Long> hstUidList) {
if (!Objects.isNull(hstUidList) && !hstUidList.isEmpty()) { if (!Objects.isNull(hstUidList) && !hstUidList.isEmpty()) {
for (Long hstUid : hstUidList) { for (Long hstUid : hstUidList) {
@@ -104,8 +94,6 @@ public class MapSheetMngCoreService {
return new MapSheetMngDto.DmlReturn("success", hstUidList.size() + "개 추론제외 업데이트 하였습니다."); return new MapSheetMngDto.DmlReturn("success", hstUidList.size() + "개 추론제외 업데이트 하였습니다.");
} }
public int mngDataSave(@Valid MapSheetMngDto.AddReq addReq) { public int mngDataSave(@Valid MapSheetMngDto.AddReq addReq) {
MapSheetMngEntity entity = new MapSheetMngEntity(); MapSheetMngEntity entity = new MapSheetMngEntity();
@@ -115,7 +103,9 @@ public class MapSheetMngCoreService {
mapSheetMngRepository.deleteByMngYyyyMngAll(addReq.getMngYyyy()); mapSheetMngRepository.deleteByMngYyyyMngAll(addReq.getMngYyyy());
MapSheetMngEntity saved = mapSheetMngRepository.save(entity); MapSheetMngEntity saved = mapSheetMngRepository.save(entity);
int hstCnt = mapSheetMngRepository.insertMapSheetOrgDataToMapSheetMngHst(saved.getMngYyyy(), saved.getMngPath()); int hstCnt =
mapSheetMngRepository.insertMapSheetOrgDataToMapSheetMngHst(
saved.getMngYyyy(), saved.getMngPath());
mapSheetMngRepository.updateYearState(saved.getMngYyyy(), "DONE"); mapSheetMngRepository.updateYearState(saved.getMngYyyy(), "DONE");
return hstCnt; return hstCnt;
@@ -133,14 +123,11 @@ public class MapSheetMngCoreService {
mapSheetMngRepository.updateMapSheetMngHstSyncCheckState(reqDto); mapSheetMngRepository.updateMapSheetMngHstSyncCheckState(reqDto);
} }
public void updateByFileUidFileState(Long fileUid, String fileState) { public void updateByFileUidFileState(Long fileUid, String fileState) {
mapSheetMngRepository.updateByFileUidMngFileState(fileUid, fileState); mapSheetMngRepository.updateByFileUidMngFileState(fileUid, fileState);
} }
public void deleteByNotInFileUidMngFile(Long hstUid, List<Long> fileUids){ public void deleteByNotInFileUidMngFile(Long hstUid, List<Long> fileUids) {
mapSheetMngRepository.deleteByNotInFileUidMngFile(hstUid, fileUids); mapSheetMngRepository.deleteByNotInFileUidMngFile(hstUid, fileUids);
} }
} }

View File

@@ -60,5 +60,4 @@ public class MapSheetMngFileEntity {
@ColumnDefault("false") @ColumnDefault("false")
@Column(name = "file_del", nullable = false) @Column(name = "file_del", nullable = false)
private Boolean fileDel = false; private Boolean fileDel = false;
} }

View File

@@ -665,12 +665,15 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
} }
@Override @Override
public void deleteByNotInFileUidMngFile(Long hstUid, List<Long> fileUids){ public void deleteByNotInFileUidMngFile(Long hstUid, List<Long> fileUids) {
long execCount = long execCount =
queryFactory queryFactory
.update(mapSheetMngFileEntity) .update(mapSheetMngFileEntity)
.set(mapSheetMngFileEntity.fileDel, true) .set(mapSheetMngFileEntity.fileDel, true)
.where(mapSheetMngFileEntity.hstUid.eq(hstUid) .where(
mapSheetMngFileEntity
.hstUid
.eq(hstUid)
.and(mapSheetMngFileEntity.fileUid.notIn(fileUids))) .and(mapSheetMngFileEntity.fileUid.notIn(fileUids)))
.execute(); .execute();
} }
@@ -686,11 +689,15 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
} }
@Override @Override
public int findByYearFileNameFileCount(int mngYyyy, String fileName){ public int findByYearFileNameFileCount(int mngYyyy, String fileName) {
Long execCount = queryFactory Long execCount =
queryFactory
.select(mapSheetMngFileEntity.count()) .select(mapSheetMngFileEntity.count())
.from(mapSheetMngFileEntity) .from(mapSheetMngFileEntity)
.where(mapSheetMngFileEntity.mngYyyy.eq(mngYyyy) .where(
mapSheetMngFileEntity
.mngYyyy
.eq(mngYyyy)
.and(mapSheetMngFileEntity.fileName.eq(fileName))) .and(mapSheetMngFileEntity.fileName.eq(fileName)))
.fetchOne(); .fetchOne();