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