폴더, 파일찾기 수정
This commit is contained in:
@@ -306,14 +306,16 @@ public class FIleChecker {
|
||||
// int fileTotCnt = 0;
|
||||
// long fileTotSize = 0;
|
||||
|
||||
Predicate<Path> isTarget = p -> {
|
||||
if (targetFileNm == null || targetFileNm.trim().isEmpty() || targetFileNm.trim().equals("*") ) {
|
||||
Predicate<Path> isTarget =
|
||||
p -> {
|
||||
if (targetFileNm == null
|
||||
|| targetFileNm.trim().isEmpty()
|
||||
|| targetFileNm.trim().equals("*")) {
|
||||
return true; // 전체 파일 허용
|
||||
}
|
||||
return p.getFileName().toString().contains(targetFileNm);
|
||||
};
|
||||
|
||||
|
||||
try (Stream<Path> stream = Files.walk(startPath, maxDepth)) {
|
||||
|
||||
fileList =
|
||||
@@ -358,7 +360,7 @@ public class FIleChecker {
|
||||
public static Long getFileTotSize(List<FIleChecker.Basic> files) {
|
||||
|
||||
Long fileTotSize = 0L;
|
||||
if( files != null || files.size() > 0 ) {
|
||||
if (files != null || files.size() > 0) {
|
||||
fileTotSize = files.stream().mapToLong(FIleChecker.Basic::getFileSize).sum();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,11 +12,11 @@ import org.springframework.stereotype.Component;
|
||||
@Setter
|
||||
public class FileConfig {
|
||||
|
||||
//private String rootSyncDir = "D:\\app\\original-images\\";
|
||||
//private String tmpSyncDir = rootSyncDir+"tmp\\";
|
||||
// private String rootSyncDir = "D:\\app\\original-images\\";
|
||||
// private String tmpSyncDir = rootSyncDir+"tmp\\";
|
||||
|
||||
private String rootSyncDir = "/app/original-images/";
|
||||
private String tmpSyncDir = rootSyncDir+"tmp/";
|
||||
private String tmpSyncDir = rootSyncDir + "tmp/";
|
||||
|
||||
private String syncFileExt = "tfw,tif";
|
||||
}
|
||||
|
||||
@@ -145,7 +145,8 @@ public class FileDto {
|
||||
private final long fileTotSize;
|
||||
private final List<FIleChecker.Basic> files;
|
||||
|
||||
public FilesDto(String dirPath, int fileTotCnt, long fileTotSize, List<FIleChecker.Basic> files) {
|
||||
public FilesDto(
|
||||
String dirPath, int fileTotCnt, long fileTotSize, List<FIleChecker.Basic> files) {
|
||||
|
||||
this.dirPath = dirPath;
|
||||
this.fileTotCnt = fileTotCnt;
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.kamco.cd.kamcoback.common.exception.ValidationException;
|
||||
import com.kamco.cd.kamcoback.common.utils.FIleChecker;
|
||||
import com.kamco.cd.kamcoback.common.utils.NameValidator;
|
||||
import com.kamco.cd.kamcoback.config.FileConfig;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto;
|
||||
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.FoldersDto;
|
||||
@@ -144,7 +143,8 @@ public class MapSheetMngFileCheckerService {
|
||||
int startPos = srchDto.getStartPos();
|
||||
int endPos = srchDto.getEndPos();
|
||||
|
||||
List<FIleChecker.Basic> files = FIleChecker.getFilesFromAllDepth(
|
||||
List<FIleChecker.Basic> files =
|
||||
FIleChecker.getFilesFromAllDepth(
|
||||
srchDto.getDirPath(),
|
||||
"*",
|
||||
srchDto.getExtension(),
|
||||
@@ -166,7 +166,8 @@ public class MapSheetMngFileCheckerService {
|
||||
int startPos = srchDto.getStartPos();
|
||||
int endPos = srchDto.getEndPos();
|
||||
|
||||
List<FIleChecker.Basic> files = FIleChecker.getFilesFromAllDepth(
|
||||
List<FIleChecker.Basic> files =
|
||||
FIleChecker.getFilesFromAllDepth(
|
||||
srchDto.getDirPath(),
|
||||
"*",
|
||||
srchDto.getExtension(),
|
||||
@@ -179,7 +180,6 @@ public class MapSheetMngFileCheckerService {
|
||||
int fileTotCnt = files.size();
|
||||
long fileTotSize = FIleChecker.getFileTotSize(files);
|
||||
|
||||
|
||||
return new FilesDto(dirPath, fileTotCnt, fileTotSize, files);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
package com.kamco.cd.kamcoback.mapsheet.service;
|
||||
|
||||
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.Basic;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.FilesDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFilesDepthDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.FileDto.SrchFilesDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.AddReq;
|
||||
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto.DmlReturn;
|
||||
@@ -23,18 +17,8 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.nio.file.attribute.FileTime;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -48,7 +32,6 @@ public class MapSheetMngService {
|
||||
private final MapSheetMngCoreService mapSheetMngCoreService;
|
||||
private final FileConfig fileConfig;
|
||||
|
||||
|
||||
public List<MngDto> findMapSheetMngList() {
|
||||
return mapSheetMngCoreService.findMapSheetMngList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user