Merge branch 'feat/dev_251201' of https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice into feat/dev_251201

# Conflicts:
#	src/main/java/com/kamco/cd/kamcoback/mapsheet/MapSheetMngApiController.java
#	src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapSheetMngEntity.java
#	src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryCustom.java
#	src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java
This commit is contained in:
Harry M. You
2025-12-02 18:49:22 +09:00
52 changed files with 1214 additions and 26238 deletions

View File

@@ -2,17 +2,14 @@ package com.kamco.cd.kamcoback.mapsheet.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
public class FileDto {
@Getter
@Setter
@NoArgsConstructor
@@ -45,14 +42,13 @@ public class FileDto {
private final String lastModified;
public FolderDto(
String folderNm,
String parentFolderNm,
String parentPath,
String fullPath,
int depth,
long childCnt,
String lastModified
) {
String folderNm,
String parentFolderNm,
String parentPath,
String fullPath,
int depth,
long childCnt,
String lastModified) {
this.folderNm = folderNm;
this.parentFolderNm = parentFolderNm;
this.parentPath = parentPath;
@@ -61,7 +57,6 @@ public class FileDto {
this.childCnt = childCnt;
this.lastModified = lastModified;
}
}
@Schema(name = "File Basic", description = "파일 기본 정보")
@@ -75,12 +70,7 @@ public class FileDto {
private final String lastModified;
public Basic(
String fileNm,
String filePath,
String extension,
long fileSize,
String lastModified
) {
String fileNm, String filePath, String extension, long fileSize, String lastModified) {
this.fileNm = fileNm;
this.filePath = filePath;
this.extension = extension;
@@ -97,19 +87,12 @@ public class FileDto {
private final long fileTotSize;
private final List<Basic> files;
public FilesDto(
String dirPath,
int fileTotCnt,
long fileTotSize,
List<Basic> files
public FilesDto(String dirPath, int fileTotCnt, long fileTotSize, List<Basic> files) {
) {
this.dirPath = dirPath;
this.fileTotCnt = fileTotCnt;
this.fileTotSize = fileTotSize;
this.files = files;
}
}
}

View File

@@ -10,8 +10,6 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import java.time.ZonedDateTime;
public class MapSheetMngDto {
@Schema(name = "searchReq", description = "영상관리 오류데이터 검색 요청")
@@ -33,7 +31,7 @@ public class MapSheetMngDto {
String[] sortParams = sort.split(",");
String property = sortParams[0];
Sort.Direction direction =
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
return PageRequest.of(page, size, Sort.by(direction, property));
}
return PageRequest.of(page, size);
@@ -45,7 +43,7 @@ public class MapSheetMngDto {
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class ErrorDataDto{
public static class ErrorDataDto {
private Long hstUid;
private Integer rowNum;
private String map50kName;

View File

@@ -5,6 +5,9 @@ import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FilesDto;
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FolderDto;
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFilesDto;
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFoldersDto;
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
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;
@@ -19,10 +22,6 @@ import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
import com.kamco.cd.kamcoback.postgres.core.MapSheetMngCoreService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.apache.commons.io.FilenameUtils;
import org.springframework.data.domain.Page;
@@ -46,68 +45,66 @@ public class MapSheetMngService {
List<FolderDto> folderDtoList = List.of();
SimpleDateFormat dttmFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try (Stream<Path> stream = Files.walk(startPath, maxDepth)) {
folderDtoList = stream
// 1. 디렉토리만 필터링
.filter(Files::isDirectory)
.filter(p -> !p.toString().equals(dirPath))
.map(path -> {
folderDtoList =
stream
// 1. 디렉토리만 필터링
.filter(Files::isDirectory)
.filter(p -> !p.toString().equals(dirPath))
.map(
path -> {
int depth = path.getNameCount();
int depth = path.getNameCount();
String folderNm = path.getFileName().toString();
String parentFolderNm = path.getParent().getFileName().toString();
String parentPath = path.getParent().toString();
String fullPath = path.toAbsolutePath().toString();
String folderNm = path.getFileName().toString();
String parentFolderNm = path.getParent().getFileName().toString();
String parentPath = path.getParent().toString();
String fullPath = path.toAbsolutePath().toString();
File directory = new File(fullPath);
File[] childFolders = directory.listFiles(File::isDirectory);
File directory = new File(fullPath);
File[] childFolders = directory.listFiles(File::isDirectory);
long childCnt = 0;
if (childFolders != null) {
childCnt = childFolders.length;
}
long childCnt = 0;
if (childFolders != null) {
childCnt = childFolders.length;
}
FileTime time = null;
try {
time = Files.getLastModifiedTime(path);
} catch (IOException e) {
throw new RuntimeException(e);
}
FileTime time = null;
try {
time = Files.getLastModifiedTime(path);
} catch (IOException e) {
throw new RuntimeException(e);
}
String lastModified = dttmFormat.format(new Date(time.toMillis()));
String lastModified = dttmFormat.format(new Date(time.toMillis()));
FolderDto folderDto =
new FolderDto(
folderNm,
parentFolderNm,
parentPath,
fullPath,
depth,
childCnt,
lastModified);
return folderDto;
})
.collect(Collectors.toList());
FolderDto folderDto = new FolderDto(
folderNm,
parentFolderNm,
parentPath,
fullPath,
depth,
childCnt,
lastModified
);
return folderDto;
})
.collect(Collectors.toList());
folderDtoList.sort(Comparator.comparing(
FolderDto::getFolderNm,
String.CASE_INSENSITIVE_ORDER // 대소문자 구분 없이
).reversed());
folderDtoList.sort(
Comparator.comparing(
FolderDto::getFolderNm, String.CASE_INSENSITIVE_ORDER // 대소문자 구분 없이
)
.reversed());
} catch (IOException e) {
throw new RuntimeException(e);
}
return folderDtoList;
}
public FilesDto getFilesAll(SrchFilesDto srchDto) {
String dirPath = srchDto.getDirPath();
@@ -125,22 +122,20 @@ public class MapSheetMngService {
int fileTotCnt = 0;
long fileTotSize = 0;
if( fileList != null )
{
if( sortType.equals("name")){
if (fileList != null) {
if (sortType.equals("name")) {
Arrays.sort(fileList);
}
else if( sortType.equals("date")){
} else if (sortType.equals("date")) {
Arrays.sort(fileList, Comparator.comparingLong(File::lastModified));
}
for (File file : fileList) {
if (file.isFile() ) { // 파일인 경우만
if( extension.equals("*") || file.getName().endsWith("."+extension) ) {
if (file.isFile()) { // 파일인 경우만
if (extension.equals("*") || file.getName().endsWith("." + extension)) {
fileListPos = fileListPos + 1;
if( startPos <= fileListPos && endPos >= fileListPos ) {
if (startPos <= fileListPos && endPos >= fileListPos) {
// 생성자를 통해 객체를 만들고 리스트에 추가
String fileName = file.getName();
@@ -153,28 +148,19 @@ public class MapSheetMngService {
fileTotCnt = fileTotCnt + 1;
fileTotSize = fileTotSize + fileSize;
}
}
}
}
}
FilesDto filesDto = new FilesDto(
dirPath,
fileTotCnt,
fileTotSize,
files);
FilesDto filesDto = new FilesDto(dirPath, fileTotCnt, fileTotSize, files);
return filesDto;
}
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(MapSheetMngDto.@Valid searchReq searchReq) {
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
MapSheetMngDto.@Valid searchReq searchReq) {
return mapSheetMngCoreService.findMapSheetErrorList(searchReq);
}