영상관리 folder-list 수정
This commit is contained in:
@@ -30,12 +30,14 @@ import java.util.stream.Stream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.geotools.coverage.grid.GridCoverage2D;
|
||||
import org.geotools.gce.geotiff.GeoTiffReader;
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Slf4j
|
||||
public class FIleChecker {
|
||||
|
||||
static SimpleDateFormat dttmFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@@ -138,7 +140,9 @@ public class FIleChecker {
|
||||
// null을 넣으면 전체 영역을 읽지 않고 메타데이터 위주로 체크하여 빠름
|
||||
GridCoverage2D coverage = reader.read(null);
|
||||
|
||||
if (coverage == null) return false;
|
||||
if (coverage == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 3. GIS 필수 정보(좌표계)가 있는지 확인
|
||||
// if (coverage.getCoordinateReferenceSystem() == null) {
|
||||
@@ -152,7 +156,9 @@ public class FIleChecker {
|
||||
return false;
|
||||
} finally {
|
||||
// 리소스 해제 (필수)
|
||||
if (reader != null) reader.dispose();
|
||||
if (reader != null) {
|
||||
reader.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,7 +302,8 @@ public class FIleChecker {
|
||||
|
||||
boolean isValid =
|
||||
!NameValidator.containsKorean(folderNm)
|
||||
&& !NameValidator.containsWhitespaceRegex(folderNm);
|
||||
&& !NameValidator.containsWhitespaceRegex(folderNm)
|
||||
&& !parentFolderNm.equals("kamco-nfs");
|
||||
|
||||
File file = new File(fullPath);
|
||||
int childCnt = getChildFolderCount(file);
|
||||
@@ -586,7 +593,9 @@ public class FIleChecker {
|
||||
}
|
||||
|
||||
public static boolean checkExtensions(String fileName, String ext) {
|
||||
if (fileName == null) return false;
|
||||
if (fileName == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase().equals(ext)) {
|
||||
return false;
|
||||
@@ -690,6 +699,7 @@ public class FIleChecker {
|
||||
@Schema(name = "Folder", description = "폴더 정보")
|
||||
@Getter
|
||||
public static class Folder {
|
||||
|
||||
private final String folderNm;
|
||||
private final String parentFolderNm;
|
||||
private final String parentPath;
|
||||
|
||||
@@ -341,12 +341,14 @@ public class MapSheetMngService {
|
||||
String dirPath = syncRootDir + srchDto.getDirPath();
|
||||
String sortType = "name desc";
|
||||
|
||||
List<FIleChecker.Folder> folderList = FIleChecker.getFolderAll(dirPath);
|
||||
List<FIleChecker.Folder> folderList =
|
||||
FIleChecker.getFolderAll(dirPath).stream()
|
||||
.filter(dir -> dir.getIsValid().equals(true))
|
||||
.toList();
|
||||
|
||||
int folderTotCnt = folderList.size();
|
||||
int folderErrTotCnt =
|
||||
(int)
|
||||
folderList.stream().filter(dto -> dto.getIsValid().toString().equals("false")).count();
|
||||
(int) folderList.stream().filter(dto -> dto.getIsValid().equals(false)).count();
|
||||
|
||||
return new FoldersDto(dirPath, folderTotCnt, folderErrTotCnt, folderList);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user