영상관리 파일 업로드 추가
This commit is contained in:
@@ -2,7 +2,7 @@ package com.kamco.cd.kamcoback.mapsheet.dto;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.enums.MngStateType;
|
||||
import com.kamco.cd.kamcoback.common.enums.SyncStateType;
|
||||
import com.kamco.cd.kamcoback.common.utils.Enums;
|
||||
import com.kamco.cd.kamcoback.common.utils.enums.Enums;
|
||||
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.ZonedDateTime;
|
||||
@@ -44,6 +44,7 @@ public class MapSheetMngDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class AddReq {
|
||||
|
||||
@Schema(description = "관리년도", example = "2022")
|
||||
private int mngYyyy;
|
||||
|
||||
@@ -57,6 +58,7 @@ public class MapSheetMngDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class DeleteFileReq {
|
||||
|
||||
@Schema(description = "파일 경로", example = "/app/original-images/2024/00000001.tif")
|
||||
private String filePath;
|
||||
}
|
||||
@@ -67,6 +69,7 @@ public class MapSheetMngDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class MngDto {
|
||||
|
||||
private int rowNum;
|
||||
private int mngYyyy;
|
||||
private String mngPath;
|
||||
@@ -85,7 +88,6 @@ public class MapSheetMngDto {
|
||||
@JsonFormatDttm private ZonedDateTime rgstStrtDttm;
|
||||
@JsonFormatDttm private ZonedDateTime rgstEndDttm;
|
||||
|
||||
|
||||
public double getSyncStateDoneRate() {
|
||||
if (this.syncTotCnt == null || this.syncTotCnt == 0) {
|
||||
return 0.0;
|
||||
@@ -110,7 +112,9 @@ public class MapSheetMngDto {
|
||||
|
||||
public String getMngStateName() {
|
||||
String enumId = this.mngState;
|
||||
if (enumId == null || enumId.isEmpty()) enumId = "NOTYET";
|
||||
if (enumId == null || enumId.isEmpty()) {
|
||||
enumId = "NOTYET";
|
||||
}
|
||||
|
||||
MngStateType type = Enums.fromId(MngStateType.class, enumId);
|
||||
return type.getText();
|
||||
@@ -162,6 +166,7 @@ public class MapSheetMngDto {
|
||||
@Getter
|
||||
@Setter
|
||||
public static class ErrorDataDto {
|
||||
|
||||
private Long hstUid;
|
||||
private Integer mngYyyy;
|
||||
private String mapSheetNum;
|
||||
@@ -220,19 +225,20 @@ public class MapSheetMngDto {
|
||||
}
|
||||
|
||||
private String getSyncStateName(String enumId) {
|
||||
if (enumId == null || enumId.isEmpty()) enumId = "NOTYET";
|
||||
if (enumId == null || enumId.isEmpty()) {
|
||||
enumId = "NOTYET";
|
||||
}
|
||||
|
||||
SyncStateType type = Enums.fromId(SyncStateType.class, enumId);
|
||||
return type.getText();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Schema(name = "MngFIleDto", description = "관리파일정보")
|
||||
@Getter
|
||||
@Setter
|
||||
public static class MngFIleDto {
|
||||
|
||||
private Long fileUid;
|
||||
private String filePath;
|
||||
private String fileName;
|
||||
@@ -247,6 +253,7 @@ public class MapSheetMngDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class DmlReturn {
|
||||
|
||||
private String flag;
|
||||
private String message;
|
||||
}
|
||||
@@ -257,6 +264,7 @@ public class MapSheetMngDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class MngFileAddReq {
|
||||
|
||||
private int mngYyyy;
|
||||
private String mapSheetNum;
|
||||
private String refMapSheetNum;
|
||||
@@ -274,6 +282,7 @@ public class MapSheetMngDto {
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class MngFilesDto {
|
||||
|
||||
private long fileUid;
|
||||
private int mngYyyy;
|
||||
private String mapSheetNum;
|
||||
@@ -285,12 +294,11 @@ public class MapSheetMngDto {
|
||||
private Long fileSize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Schema(name = "ReqUpdateErrorCheckStateDto", description = "영상관리 오류데이터 체크결과 수정요청")
|
||||
@Getter
|
||||
@Setter
|
||||
public static class ReqUpdateErrorCheckStateDto {
|
||||
|
||||
private Long hstUid;
|
||||
private String errorCheckState;
|
||||
private String errorCheckTfwFileName;
|
||||
|
||||
@@ -4,7 +4,6 @@ import static java.lang.String.CASE_INSENSITIVE_ORDER;
|
||||
|
||||
import com.kamco.cd.kamcoback.common.utils.FIleChecker;
|
||||
import com.kamco.cd.kamcoback.config.FileConfig;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.Basic;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FilesDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFilesDepthDto;
|
||||
@@ -16,7 +15,6 @@ import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.ErrorDataDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.ErrorSearchReq;
|
||||
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.ReqUpdateErrorCheckStateDto;
|
||||
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
|
||||
import jakarta.validation.Valid;
|
||||
import java.io.File;
|
||||
@@ -31,7 +29,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -234,8 +231,6 @@ public class MapSheetMngService {
|
||||
return mapSheetMngCoreService.findMapSheetMngYyyyList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public MngDto findMapSheetMng(int mngYyyy) {
|
||||
return mapSheetMngCoreService.findMapSheetMng(mngYyyy);
|
||||
}
|
||||
@@ -248,8 +243,7 @@ public class MapSheetMngService {
|
||||
return new DmlReturn("success", "작업완료 처리되었습니다.");
|
||||
}
|
||||
|
||||
public Page<ErrorDataDto> findMapSheetErrorList(
|
||||
@Valid ErrorSearchReq searchReq) {
|
||||
public Page<ErrorDataDto> findMapSheetErrorList(@Valid ErrorSearchReq searchReq) {
|
||||
return mapSheetMngCoreService.findMapSheetErrorList(searchReq);
|
||||
}
|
||||
|
||||
@@ -313,39 +307,34 @@ public class MapSheetMngService {
|
||||
}
|
||||
|
||||
ErrorDataDto errDto = mapSheetMngCoreService.findMapSheetError(hstUid);
|
||||
if( errDto == null )
|
||||
{
|
||||
if (errDto == null) {
|
||||
return new DmlReturn("fail", "NO hstUid Data");
|
||||
}
|
||||
MngDto mngDto = mapSheetMngCoreService.findMapSheetMng(errDto.getMngYyyy());
|
||||
|
||||
String targetYearDir = mngDto.getMngPath();
|
||||
|
||||
List<FIleChecker.Basic> basicTfwList = FIleChecker.getFilesFromAllDepth(targetYearDir,
|
||||
tfwFile.getOriginalFilename(),
|
||||
"tfw",
|
||||
100,
|
||||
"name",
|
||||
0, 100);
|
||||
List<FIleChecker.Basic> basicTfwList =
|
||||
FIleChecker.getFilesFromAllDepth(
|
||||
targetYearDir, tfwFile.getOriginalFilename(), "tfw", 100, "name", 0, 100);
|
||||
|
||||
List<FIleChecker.Basic> basicTifList = FIleChecker.getFilesFromAllDepth(targetYearDir,
|
||||
tifFile.getOriginalFilename(),
|
||||
"tif",
|
||||
100,
|
||||
"name",
|
||||
0, 100);
|
||||
List<FIleChecker.Basic> basicTifList =
|
||||
FIleChecker.getFilesFromAllDepth(
|
||||
targetYearDir, tifFile.getOriginalFilename(), "tif", 100, "name", 0, 100);
|
||||
|
||||
int tfwCnt =
|
||||
(int)
|
||||
basicTfwList.stream().filter(dto -> dto.getExtension().toString().equals("tfw")).count();
|
||||
basicTfwList.stream()
|
||||
.filter(dto -> dto.getExtension().toString().equals("tfw"))
|
||||
.count();
|
||||
|
||||
int tifCnt =
|
||||
(int)
|
||||
basicTifList.stream().filter(dto -> dto.getExtension().toString().equals("tif")).count();
|
||||
basicTifList.stream()
|
||||
.filter(dto -> dto.getExtension().toString().equals("tif"))
|
||||
.count();
|
||||
|
||||
|
||||
if( tfwCnt > 0 || tifCnt > 0 )
|
||||
{
|
||||
if (tfwCnt > 0 || tifCnt > 0) {
|
||||
String tfwMsg = "";
|
||||
String tifMsg = "";
|
||||
if (tfwCnt > 0) tfwMsg = tfwFile.getOriginalFilename();
|
||||
@@ -370,8 +359,6 @@ public class MapSheetMngService {
|
||||
if (!FIleChecker.cmmndGdalInfo(tifTmpPath)) return new DmlReturn("fail", "TIF TYPE ERROR");
|
||||
if (!FIleChecker.checkTfw(tfwTmpPath)) return new DmlReturn("fail", "TFW TYPE ERROR");
|
||||
|
||||
|
||||
|
||||
// 싱크파일목록 가저오기
|
||||
List<MngFilesDto> mngFiles = mapSheetMngCoreService.findIdToMapSheetFileList(hstUid);
|
||||
String uploadPath = "";
|
||||
@@ -385,7 +372,8 @@ public class MapSheetMngService {
|
||||
Path uploadTargetPath = null;
|
||||
|
||||
if (uploadPath.isEmpty()) {
|
||||
MngFilesDto filesDto = mapSheetMngCoreService.findYyyyToMapSheetFilePathRefer(errDto.getMngYyyy());
|
||||
MngFilesDto filesDto =
|
||||
mapSheetMngCoreService.findYyyyToMapSheetFilePathRefer(errDto.getMngYyyy());
|
||||
String referPath = filesDto.getFilePath();
|
||||
uploadPath = Paths.get(referPath).getParent().toString() + "/" + errDto.getRefMapSheetNum();
|
||||
tfwTargetPath = Paths.get(uploadPath).resolve(tfwFile.getOriginalFilename());
|
||||
@@ -405,10 +393,7 @@ public class MapSheetMngService {
|
||||
|
||||
// hst업데이트
|
||||
mapSheetMngCoreService.updateMapSheetMngHstSyncCheckState(
|
||||
hstUid,
|
||||
uploadPath,
|
||||
tfwFile.getOriginalFilename(),
|
||||
tifFile.getOriginalFilename());
|
||||
hstUid, uploadPath, tfwFile.getOriginalFilename(), tifFile.getOriginalFilename());
|
||||
// 파일정보 업데이트
|
||||
mapSheetMngCoreService.deleteByHstUidMngFile(hstUid);
|
||||
|
||||
@@ -429,7 +414,6 @@ public class MapSheetMngService {
|
||||
addReq.setFileSize(tifFile.getSize());
|
||||
mapSheetMngCoreService.mngFileSave(addReq);
|
||||
|
||||
|
||||
return new DmlReturn("success", "파일 업로드 완료되었습니다.");
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.kamco.cd.kamcoback.postgres.core;
|
||||
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngFileEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.mapsheet.MapSheetMngRepository;
|
||||
import jakarta.persistence.EntityNotFoundException;
|
||||
@@ -55,20 +54,16 @@ public class MapSheetMngCoreService {
|
||||
|
||||
public MapSheetMngDto.DmlReturn mngFileSave(@Valid MapSheetMngDto.MngFileAddReq addReq) {
|
||||
|
||||
|
||||
mapSheetMngRepository.mngFileSave(addReq);
|
||||
// int hstCnt = mapSheetMngRepository.insertMapSheetOrgDataToMapSheetMngHst(saved.getMngYyyy());
|
||||
|
||||
return new MapSheetMngDto.DmlReturn("success", "파일정보저장되었습니다.");
|
||||
}
|
||||
|
||||
|
||||
public void updateMapSheetMngHstSyncCheckState(
|
||||
Long hstUid,
|
||||
String uploadPath,
|
||||
String syncCheckTfwFileName,
|
||||
String syncCheckTifFileName){
|
||||
mapSheetMngRepository.updateMapSheetMngHstSyncCheckState(hstUid, uploadPath, syncCheckTfwFileName, syncCheckTifFileName);
|
||||
Long hstUid, String uploadPath, String syncCheckTfwFileName, String syncCheckTifFileName) {
|
||||
mapSheetMngRepository.updateMapSheetMngHstSyncCheckState(
|
||||
hstUid, uploadPath, syncCheckTfwFileName, syncCheckTifFileName);
|
||||
}
|
||||
|
||||
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
||||
@@ -80,13 +75,10 @@ public class MapSheetMngCoreService {
|
||||
return mapSheetMngRepository.findMapSheetError(hstUid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<MapSheetMngDto.MngFilesDto> findIdToMapSheetFileList(Long hstUid) {
|
||||
return mapSheetMngRepository.findIdToMapSheetFileList(hstUid);
|
||||
}
|
||||
|
||||
|
||||
public MapSheetMngDto.MngFilesDto findYyyyToMapSheetFilePathRefer(int mngYyyy) {
|
||||
return mapSheetMngRepository.findYyyyToMapSheetFilePathRefer(mngYyyy);
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@ public interface MapSheetMngRepositoryCustom {
|
||||
|
||||
MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy);
|
||||
|
||||
|
||||
|
||||
void MapSheetMngComplete(int mngYyyy);
|
||||
|
||||
Optional<MapSheetMngHstEntity> findMapSheetMngHstInfo(Long hstUid);
|
||||
@@ -42,10 +40,7 @@ public interface MapSheetMngRepositoryCustom {
|
||||
void mngFileSave(@Valid MapSheetMngDto.MngFileAddReq addReq);
|
||||
|
||||
void updateMapSheetMngHstSyncCheckState(
|
||||
Long hstUid,
|
||||
String uploadPath,
|
||||
String syncCheckTfwFileName,
|
||||
String syncCheckTifFileName);
|
||||
Long hstUid, String uploadPath, String syncCheckTfwFileName, String syncCheckTifFileName);
|
||||
|
||||
Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
||||
MapSheetMngDto.@Valid ErrorSearchReq searchReq);
|
||||
@@ -53,6 +48,7 @@ public interface MapSheetMngRepositoryCustom {
|
||||
MapSheetMngDto.ErrorDataDto findMapSheetError(Long hstUid);
|
||||
|
||||
List<MapSheetMngDto.MngFilesDto> findIdToMapSheetFileList(Long hstUid);
|
||||
|
||||
MapSheetMngDto.MngFilesDto findIdToMapSheetFile(Long fileUid);
|
||||
|
||||
void updateHstFileSizes(Long hstUid, long tifSizeBytes, long tfwSizeBytes, long totalSizeBytes);
|
||||
|
||||
@@ -21,7 +21,6 @@ import jakarta.persistence.PersistenceContext;
|
||||
import jakarta.validation.Valid;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import org.hibernate.query.Query;
|
||||
@@ -187,7 +186,6 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
BooleanBuilder whereBuilder = new BooleanBuilder();
|
||||
whereBuilder.and(mapSheetMngEntity.mngYyyy.eq(mngYyyy));
|
||||
|
||||
|
||||
MapSheetMngDto.MngDto foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
@@ -538,7 +536,6 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
return foundContent;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void MapSheetMngComplete(int mngYyyy) {
|
||||
long execCount =
|
||||
@@ -551,10 +548,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
|
||||
@Override
|
||||
public void updateMapSheetMngHstSyncCheckState(
|
||||
Long hstUid,
|
||||
String uploadPath,
|
||||
String syncCheckTfwFileName,
|
||||
String syncCheckTifFileName){
|
||||
Long hstUid, String uploadPath, String syncCheckTfwFileName, String syncCheckTifFileName) {
|
||||
|
||||
long execCount =
|
||||
queryFactory
|
||||
@@ -653,8 +647,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
mapSheetMngFileEntity.fileExt,
|
||||
mapSheetMngFileEntity.hstUid,
|
||||
mapSheetMngFileEntity.fileSize,
|
||||
mapSheetMngFileEntity.fileState
|
||||
)
|
||||
mapSheetMngFileEntity.fileState)
|
||||
.values(
|
||||
addReq.getMngYyyy(),
|
||||
addReq.getMapSheetNum(),
|
||||
@@ -664,8 +657,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
||||
addReq.getFileExt(),
|
||||
addReq.getHstUid(),
|
||||
addReq.getFileSize(),
|
||||
addReq.getFileState()
|
||||
)
|
||||
addReq.getFileState())
|
||||
.execute();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user