feat/infer_dev_260107 #5
@@ -30,12 +30,14 @@ import java.util.stream.Stream;
|
|||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.geotools.coverage.grid.GridCoverage2D;
|
import org.geotools.coverage.grid.GridCoverage2D;
|
||||||
import org.geotools.gce.geotiff.GeoTiffReader;
|
import org.geotools.gce.geotiff.GeoTiffReader;
|
||||||
import org.springframework.util.FileSystemUtils;
|
import org.springframework.util.FileSystemUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
public class FIleChecker {
|
public class FIleChecker {
|
||||||
|
|
||||||
static SimpleDateFormat dttmFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
static SimpleDateFormat dttmFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
@@ -138,7 +140,9 @@ public class FIleChecker {
|
|||||||
// null을 넣으면 전체 영역을 읽지 않고 메타데이터 위주로 체크하여 빠름
|
// null을 넣으면 전체 영역을 읽지 않고 메타데이터 위주로 체크하여 빠름
|
||||||
GridCoverage2D coverage = reader.read(null);
|
GridCoverage2D coverage = reader.read(null);
|
||||||
|
|
||||||
if (coverage == null) return false;
|
if (coverage == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// 3. GIS 필수 정보(좌표계)가 있는지 확인
|
// 3. GIS 필수 정보(좌표계)가 있는지 확인
|
||||||
// if (coverage.getCoordinateReferenceSystem() == null) {
|
// if (coverage.getCoordinateReferenceSystem() == null) {
|
||||||
@@ -152,7 +156,9 @@ public class FIleChecker {
|
|||||||
return false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
// 리소스 해제 (필수)
|
// 리소스 해제 (필수)
|
||||||
if (reader != null) reader.dispose();
|
if (reader != null) {
|
||||||
|
reader.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +302,8 @@ public class FIleChecker {
|
|||||||
|
|
||||||
boolean isValid =
|
boolean isValid =
|
||||||
!NameValidator.containsKorean(folderNm)
|
!NameValidator.containsKorean(folderNm)
|
||||||
&& !NameValidator.containsWhitespaceRegex(folderNm);
|
&& !NameValidator.containsWhitespaceRegex(folderNm)
|
||||||
|
&& !parentFolderNm.equals("kamco-nfs");
|
||||||
|
|
||||||
File file = new File(fullPath);
|
File file = new File(fullPath);
|
||||||
int childCnt = getChildFolderCount(file);
|
int childCnt = getChildFolderCount(file);
|
||||||
@@ -586,7 +593,9 @@ public class FIleChecker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkExtensions(String fileName, String ext) {
|
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)) {
|
if (!fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase().equals(ext)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -690,6 +699,7 @@ public class FIleChecker {
|
|||||||
@Schema(name = "Folder", description = "폴더 정보")
|
@Schema(name = "Folder", description = "폴더 정보")
|
||||||
@Getter
|
@Getter
|
||||||
public static class Folder {
|
public static class Folder {
|
||||||
|
|
||||||
private final String folderNm;
|
private final String folderNm;
|
||||||
private final String parentFolderNm;
|
private final String parentFolderNm;
|
||||||
private final String parentPath;
|
private final String parentPath;
|
||||||
|
|||||||
@@ -341,12 +341,14 @@ public class MapSheetMngService {
|
|||||||
String dirPath = syncRootDir + srchDto.getDirPath();
|
String dirPath = syncRootDir + srchDto.getDirPath();
|
||||||
String sortType = "name desc";
|
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 folderTotCnt = folderList.size();
|
||||||
int folderErrTotCnt =
|
int folderErrTotCnt =
|
||||||
(int)
|
(int) folderList.stream().filter(dto -> dto.getIsValid().equals(false)).count();
|
||||||
folderList.stream().filter(dto -> dto.getIsValid().toString().equals("false")).count();
|
|
||||||
|
|
||||||
return new FoldersDto(dirPath, folderTotCnt, folderErrTotCnt, folderList);
|
return new FoldersDto(dirPath, folderTotCnt, folderErrTotCnt, folderList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,8 +243,6 @@ public class ModelMngService {
|
|||||||
List<Basic> files =
|
List<Basic> files =
|
||||||
FIleChecker.getFilesFromAllDepth(dirPath, "*", "pth,py,json", 10, "name", startPos, endPos);
|
FIleChecker.getFilesFromAllDepth(dirPath, "*", "pth,py,json", 10, "name", startPos, endPos);
|
||||||
|
|
||||||
boolean hasPt = false; // pt 파일 존재 여부
|
|
||||||
|
|
||||||
for (Basic dto : files) {
|
for (Basic dto : files) {
|
||||||
// 예: 파일명 출력 및 추가 작업
|
// 예: 파일명 출력 및 추가 작업
|
||||||
String foldNm = dto.getFullPath().replace(dto.getFileNm(), "");
|
String foldNm = dto.getFullPath().replace(dto.getFileNm(), "");
|
||||||
@@ -265,17 +263,15 @@ public class ModelMngService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasPt) {
|
// cls model 적용
|
||||||
|
String defaultPath = ptPath;
|
||||||
|
String defaultFileName = ptFileName;
|
||||||
|
|
||||||
String defaultPath = ptPath;
|
Path ptPath = Paths.get(defaultPath, defaultFileName);
|
||||||
String defaultFileName = ptFileName;
|
|
||||||
|
|
||||||
Path ptPath = Paths.get(defaultPath, defaultFileName);
|
if (Files.exists(ptPath)) {
|
||||||
|
modelUploadResDto.setClsModelPath(defaultPath);
|
||||||
if (Files.exists(ptPath)) {
|
modelUploadResDto.setClsModelFileName(defaultFileName);
|
||||||
modelUploadResDto.setClsModelPath(defaultPath);
|
|
||||||
modelUploadResDto.setClsModelFileName(defaultFileName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// int fileListPos = 0;
|
// int fileListPos = 0;
|
||||||
|
|||||||
@@ -123,5 +123,5 @@ training-data:
|
|||||||
geojson-dir: /kamco-nfs/model_output/labeling/
|
geojson-dir: /kamco-nfs/model_output/labeling/
|
||||||
|
|
||||||
layer:
|
layer:
|
||||||
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
|
geoserver-url: https://label-tile.gs.dabeeo.com
|
||||||
workspace: cd
|
workspace: cd
|
||||||
|
|||||||
@@ -78,5 +78,5 @@ training-data:
|
|||||||
geojson-dir: /kamco-nfs/model_output/labeling/
|
geojson-dir: /kamco-nfs/model_output/labeling/
|
||||||
|
|
||||||
layer:
|
layer:
|
||||||
geoserver-url: https://kamco.geo-dev.gs.dabeeo.com
|
geoserver-url: https://label-tile.gs.dabeeo.com
|
||||||
workspace: cd
|
workspace: cd
|
||||||
|
|||||||
Reference in New Issue
Block a user