영상관리 주성
This commit is contained in:
@@ -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.postgres.core.MapSheetMngCoreService;
|
||||
import jakarta.validation.Valid;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@@ -75,16 +74,16 @@ public class MapSheetMngService {
|
||||
@Transactional
|
||||
public DmlReturn mngDataSave(AddReq 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) {
|
||||
return mapSheetMngCoreService.updateExceptUseInference(hstUidList);
|
||||
}
|
||||
|
||||
@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 tmpPath = syncTmpDir;
|
||||
@@ -102,26 +101,29 @@ public class MapSheetMngService {
|
||||
return new DmlReturn("fail", "CREATE TEMP FOLDER ERROR");
|
||||
}
|
||||
|
||||
//업로드 파일 사이즈,확장자명 체크
|
||||
// 업로드 파일 사이즈,확장자명 체크
|
||||
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());
|
||||
String targetYearDir = mngDto.getMngPath();
|
||||
|
||||
// 중복체크
|
||||
if( !overwrite ) {
|
||||
dmlReturn = this.duplicateFile(errDto.getMngYyyy(), tfwFile.getOriginalFilename(), tifFile.getOriginalFilename());
|
||||
if( dmlReturn.getFlag().equals("duplicate") )return dmlReturn;
|
||||
if (!overwrite) {
|
||||
dmlReturn =
|
||||
this.duplicateFile(
|
||||
errDto.getMngYyyy(), tfwFile.getOriginalFilename(), tifFile.getOriginalFilename());
|
||||
if (dmlReturn.getFlag().equals("duplicate")) return dmlReturn;
|
||||
}
|
||||
|
||||
//멀티파트 파일 tmp폴더 저장(파일형식 체크를 위해)
|
||||
// 멀티파트 파일 tmp폴더 저장(파일형식 체크를 위해)
|
||||
String tfwTmpPath = tmpPath + tfwFile.getOriginalFilename();
|
||||
String tifTmpPath = tmpPath + tifFile.getOriginalFilename();
|
||||
|
||||
if(!FIleChecker.multipartSaveTo(tfwFile, tfwTmpPath))return new DmlReturn("fail", "UPLOAD ERROR");
|
||||
if(!FIleChecker.multipartSaveTo(tifFile, tifTmpPath))return new DmlReturn("fail", "UPLOAD ERROR");
|
||||
if (!FIleChecker.multipartSaveTo(tfwFile, tfwTmpPath))
|
||||
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.checkTfw(tfwTmpPath)) return new DmlReturn("fail", "TFW TYPE ERROR");
|
||||
@@ -134,7 +136,6 @@ public class MapSheetMngService {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Path tfwTmpSavePath = Paths.get(tfwTmpPath);
|
||||
Path tifTmpSavePath = Paths.get(tifTmpPath);
|
||||
Path tfwTargetPath = null;
|
||||
@@ -199,7 +200,6 @@ public class MapSheetMngService {
|
||||
return mapSheetMngCoreService.findByHstUidMapSheetFileList(hstUid);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public DmlReturn setUseByFileUidMngFile(List<Long> fileUids) {
|
||||
|
||||
@@ -207,7 +207,8 @@ public class MapSheetMngService {
|
||||
|
||||
DmlReturn dmlReturn = new DmlReturn("success", "정상처리되었습니다.");
|
||||
|
||||
MapSheetMngDto.SyncCheckStateReqUpdateDto reqDto = new MapSheetMngDto.SyncCheckStateReqUpdateDto();
|
||||
MapSheetMngDto.SyncCheckStateReqUpdateDto reqDto =
|
||||
new MapSheetMngDto.SyncCheckStateReqUpdateDto();
|
||||
|
||||
for (Long uid : fileUids) {
|
||||
MapSheetMngDto.MngFilesDto dto = mapSheetMngCoreService.findByFileUidMapSheetFile(uid);
|
||||
@@ -222,39 +223,36 @@ public class MapSheetMngService {
|
||||
mapSheetMngCoreService.updateByFileUidFileState(uid, "DONE");
|
||||
}
|
||||
|
||||
//선택제외 삭제처리
|
||||
// 선택제외 삭제처리
|
||||
mapSheetMngCoreService.deleteByNotInFileUidMngFile(reqDto.getHstUid(), fileUids);
|
||||
//Hst(내역) 테이블 상태 업데이트
|
||||
// Hst(내역) 테이블 상태 업데이트
|
||||
mapSheetMngCoreService.updateByHstUidSyncCheckState(reqDto);
|
||||
|
||||
return new DmlReturn("success", fileUids.size() + "개 파일이 사용설정되었습니다.");
|
||||
}
|
||||
|
||||
public DmlReturn validationFile(MultipartFile tfwFile, MultipartFile tifFile)
|
||||
{
|
||||
if( !FIleChecker.validationMultipart(tfwFile) )return new DmlReturn("fail", "TFW SIZE 오류");
|
||||
else if( !FIleChecker.validationMultipart(tifFile) )return new DmlReturn("fail", "TFW SIZE 오류");
|
||||
else if (!FIleChecker.checkExtensions(tfwFile.getOriginalFilename(), "tfw"))return new DmlReturn("fail", "TFW FILENAME ERROR");
|
||||
else if (!FIleChecker.checkExtensions(tifFile.getOriginalFilename(), "tif"))return new DmlReturn("fail", "TIF FILENAME ERROR");
|
||||
public DmlReturn validationFile(MultipartFile tfwFile, MultipartFile tifFile) {
|
||||
if (!FIleChecker.validationMultipart(tfwFile)) return new DmlReturn("fail", "TFW SIZE 오류");
|
||||
else if (!FIleChecker.validationMultipart(tifFile)) return new DmlReturn("fail", "TFW SIZE 오류");
|
||||
else if (!FIleChecker.checkExtensions(tfwFile.getOriginalFilename(), "tfw"))
|
||||
return new DmlReturn("fail", "TFW FILENAME ERROR");
|
||||
else if (!FIleChecker.checkExtensions(tifFile.getOriginalFilename(), "tif"))
|
||||
return new DmlReturn("fail", "TIF FILENAME ERROR");
|
||||
|
||||
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 tifCnt = mapSheetMngCoreService.findByYearFileNameFileCount(mngYyyy, tifFileName);
|
||||
|
||||
if (tfwCnt > 0 || tifCnt > 0) {
|
||||
String resMsg = "";
|
||||
if (tfwCnt > 0)
|
||||
resMsg = tfwFileName;
|
||||
if (tfwCnt > 0) resMsg = tfwFileName;
|
||||
|
||||
if (tifCnt > 0) {
|
||||
if (tfwCnt > 0)
|
||||
resMsg = resMsg + "," + tifFileName;
|
||||
else
|
||||
resMsg = tifFileName;
|
||||
if (tfwCnt > 0) resMsg = resMsg + "," + tifFileName;
|
||||
else resMsg = tifFileName;
|
||||
}
|
||||
return new DmlReturn("duplicate", resMsg);
|
||||
}
|
||||
@@ -272,8 +270,8 @@ public class MapSheetMngService {
|
||||
|
||||
int folderTotCnt = folderList.size();
|
||||
int folderErrTotCnt =
|
||||
(int)
|
||||
folderList.stream().filter(dto -> dto.getIsValid().toString().equals("false")).count();
|
||||
(int)
|
||||
folderList.stream().filter(dto -> dto.getIsValid().toString().equals("false")).count();
|
||||
|
||||
return new FoldersDto(dirPath, folderTotCnt, folderErrTotCnt, folderList);
|
||||
}
|
||||
@@ -285,14 +283,14 @@ public class MapSheetMngService {
|
||||
int endPos = srchDto.getEndPos();
|
||||
|
||||
List<FIleChecker.Basic> files =
|
||||
FIleChecker.getFilesFromAllDepth(
|
||||
srchDto.getDirPath(),
|
||||
"*",
|
||||
srchDto.getExtension(),
|
||||
1,
|
||||
srchDto.getSortType(),
|
||||
startPos,
|
||||
endPos);
|
||||
FIleChecker.getFilesFromAllDepth(
|
||||
srchDto.getDirPath(),
|
||||
"*",
|
||||
srchDto.getExtension(),
|
||||
1,
|
||||
srchDto.getSortType(),
|
||||
startPos,
|
||||
endPos);
|
||||
|
||||
int fileListPos = 0;
|
||||
int fileTotCnt = files.size();
|
||||
|
||||
Reference in New Issue
Block a user