영상관리 주성
This commit is contained in:
@@ -185,13 +185,13 @@ public class MapSheetMngApiController {
|
|||||||
@Operation(summary = "페어 파일 업로드", description = "TFW/TIF 두 파일을 쌍으로 업로드 및 검증")
|
@Operation(summary = "페어 파일 업로드", description = "TFW/TIF 두 파일을 쌍으로 업로드 및 검증")
|
||||||
@PostMapping(value = "/upload-pair", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = "/upload-pair", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
public ApiResponseDto<MapSheetMngDto.DmlReturn> uploadPair(
|
public ApiResponseDto<MapSheetMngDto.DmlReturn> uploadPair(
|
||||||
@RequestPart("tfw") MultipartFile tfwFile,
|
@RequestPart("tfw") MultipartFile tfwFile,
|
||||||
@RequestPart("tif") MultipartFile tifFile,
|
@RequestPart("tif") MultipartFile tifFile,
|
||||||
@RequestParam(value = "hstUid", required = false) Long hstUid,
|
@RequestParam(value = "hstUid", required = false) Long hstUid,
|
||||||
@RequestParam(value = "overwrite", required = false) boolean overwrite) {
|
@RequestParam(value = "overwrite", required = false) boolean overwrite) {
|
||||||
|
|
||||||
return ApiResponseDto.createOK(
|
return ApiResponseDto.createOK(
|
||||||
mapSheetMngService.uploadPair(tfwFile, tifFile, hstUid, overwrite));
|
mapSheetMngService.uploadPair(tfwFile, tifFile, hstUid, overwrite));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "영상관리 > 파일조회", description = "영상관리 > 파일조회")
|
@Operation(summary = "영상관리 > 파일조회", description = "영상관리 > 파일조회")
|
||||||
@@ -214,42 +214,41 @@ 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(
|
||||||
responseCode = "201",
|
responseCode = "201",
|
||||||
description = "파일사용설정 처리 성공",
|
description = "파일사용설정 처리 성공",
|
||||||
content =
|
content =
|
||||||
@Content(
|
@Content(
|
||||||
mediaType = "application/json",
|
mediaType = "application/json",
|
||||||
schema = @Schema(implementation = Long.class))),
|
schema = @Schema(implementation = Long.class))),
|
||||||
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
|
||||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PutMapping("/update-use-mng-files")
|
@PutMapping("/update-use-mng-files")
|
||||||
public ApiResponseDto<MapSheetMngDto.DmlReturn> updateUseByFileUidMngFile(
|
public ApiResponseDto<MapSheetMngDto.DmlReturn> updateUseByFileUidMngFile(
|
||||||
@RequestParam @Valid List<Long> fileUids) {
|
@RequestParam @Valid List<Long> fileUids) {
|
||||||
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 = {
|
||||||
@ApiResponse(
|
@ApiResponse(
|
||||||
responseCode = "200",
|
responseCode = "200",
|
||||||
description = "조회 성공",
|
description = "조회 성공",
|
||||||
content =
|
content =
|
||||||
@Content(
|
@Content(
|
||||||
mediaType = "application/json",
|
mediaType = "application/json",
|
||||||
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
||||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/folder-list")
|
@PostMapping("/folder-list")
|
||||||
public ApiResponseDto<FoldersDto> getDir(@RequestBody SrchFoldersDto srchDto) {
|
public ApiResponseDto<FoldersDto> getDir(@RequestBody SrchFoldersDto srchDto) {
|
||||||
|
|
||||||
@@ -258,22 +257,20 @@ public class MapSheetMngApiController {
|
|||||||
|
|
||||||
@Operation(summary = "지정폴더내 파일목록 조회", description = "지정폴더내 파일목록 조회")
|
@Operation(summary = "지정폴더내 파일목록 조회", description = "지정폴더내 파일목록 조회")
|
||||||
@ApiResponses(
|
@ApiResponses(
|
||||||
value = {
|
value = {
|
||||||
@ApiResponse(
|
@ApiResponse(
|
||||||
responseCode = "200",
|
responseCode = "200",
|
||||||
description = "조회 성공",
|
description = "조회 성공",
|
||||||
content =
|
content =
|
||||||
@Content(
|
@Content(
|
||||||
mediaType = "application/json",
|
mediaType = "application/json",
|
||||||
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
|
||||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||||
})
|
})
|
||||||
@PostMapping("/file-list")
|
@PostMapping("/file-list")
|
||||||
public ApiResponseDto<FilesDto> getFiles(@RequestBody SrchFilesDto srchDto) {
|
public ApiResponseDto<FilesDto> getFiles(@RequestBody SrchFilesDto srchDto) {
|
||||||
|
|
||||||
return ApiResponseDto.createOK(mapSheetMngService.getFilesAll(srchDto));
|
return ApiResponseDto.createOK(mapSheetMngService.getFilesAll(srchDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 = "영상관리 오류데이터 검색 요청")
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
@@ -272,8 +270,8 @@ public class MapSheetMngService {
|
|||||||
|
|
||||||
int folderTotCnt = folderList.size();
|
int folderTotCnt = folderList.size();
|
||||||
int folderErrTotCnt =
|
int folderErrTotCnt =
|
||||||
(int)
|
(int)
|
||||||
folderList.stream().filter(dto -> dto.getIsValid().toString().equals("false")).count();
|
folderList.stream().filter(dto -> dto.getIsValid().toString().equals("false")).count();
|
||||||
|
|
||||||
return new FoldersDto(dirPath, folderTotCnt, folderErrTotCnt, folderList);
|
return new FoldersDto(dirPath, folderTotCnt, folderErrTotCnt, folderList);
|
||||||
}
|
}
|
||||||
@@ -285,14 +283,14 @@ public class MapSheetMngService {
|
|||||||
int endPos = srchDto.getEndPos();
|
int endPos = srchDto.getEndPos();
|
||||||
|
|
||||||
List<FIleChecker.Basic> files =
|
List<FIleChecker.Basic> files =
|
||||||
FIleChecker.getFilesFromAllDepth(
|
FIleChecker.getFilesFromAllDepth(
|
||||||
srchDto.getDirPath(),
|
srchDto.getDirPath(),
|
||||||
"*",
|
"*",
|
||||||
srchDto.getExtension(),
|
srchDto.getExtension(),
|
||||||
1,
|
1,
|
||||||
srchDto.getSortType(),
|
srchDto.getSortType(),
|
||||||
startPos,
|
startPos,
|
||||||
endPos);
|
endPos);
|
||||||
|
|
||||||
int fileListPos = 0;
|
int fileListPos = 0;
|
||||||
int fileTotCnt = files.size();
|
int fileTotCnt = files.size();
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -648,8 +648,8 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
public void deleteByFileUidMngFile(Long fileUid) {
|
public void deleteByFileUidMngFile(Long fileUid) {
|
||||||
long fileCount =
|
long fileCount =
|
||||||
queryFactory
|
queryFactory
|
||||||
.update(mapSheetMngFileEntity)
|
.update(mapSheetMngFileEntity)
|
||||||
.set(mapSheetMngFileEntity.fileDel, true)
|
.set(mapSheetMngFileEntity.fileDel, true)
|
||||||
.where(mapSheetMngFileEntity.fileUid.eq(fileUid))
|
.where(mapSheetMngFileEntity.fileUid.eq(fileUid))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
@@ -665,34 +665,41 @@ 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(
|
||||||
.and(mapSheetMngFileEntity.fileUid.notIn(fileUids)))
|
mapSheetMngFileEntity
|
||||||
.execute();
|
.hstUid
|
||||||
|
.eq(hstUid)
|
||||||
|
.and(mapSheetMngFileEntity.fileUid.notIn(fileUids)))
|
||||||
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateByFileUidMngFileState(Long fileUid, String fileState) {
|
public void updateByFileUidMngFileState(Long fileUid, String fileState) {
|
||||||
long execCount =
|
long execCount =
|
||||||
queryFactory
|
queryFactory
|
||||||
.update(mapSheetMngFileEntity)
|
.update(mapSheetMngFileEntity)
|
||||||
.set(mapSheetMngFileEntity.fileState, fileState)
|
.set(mapSheetMngFileEntity.fileState, fileState)
|
||||||
.where(mapSheetMngFileEntity.fileUid.eq(fileUid))
|
.where(mapSheetMngFileEntity.fileUid.eq(fileUid))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int findByYearFileNameFileCount(int mngYyyy, String fileName){
|
public int findByYearFileNameFileCount(int mngYyyy, String fileName) {
|
||||||
Long execCount = queryFactory
|
Long execCount =
|
||||||
.select(mapSheetMngFileEntity.count())
|
queryFactory
|
||||||
.from(mapSheetMngFileEntity)
|
.select(mapSheetMngFileEntity.count())
|
||||||
.where(mapSheetMngFileEntity.mngYyyy.eq(mngYyyy)
|
.from(mapSheetMngFileEntity)
|
||||||
.and(mapSheetMngFileEntity.fileName.eq(fileName)))
|
.where(
|
||||||
.fetchOne();
|
mapSheetMngFileEntity
|
||||||
|
.mngYyyy
|
||||||
|
.eq(mngYyyy)
|
||||||
|
.and(mapSheetMngFileEntity.fileName.eq(fileName)))
|
||||||
|
.fetchOne();
|
||||||
|
|
||||||
return Math.toIntExact(execCount);
|
return Math.toIntExact(execCount);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user