회원가입 추가, 역할 추가, spotlessApply 실행

This commit is contained in:
2025-12-02 18:27:12 +09:00
parent 2377f471d2
commit 7153497016
35 changed files with 1293 additions and 259 deletions

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);
}
}