feat/infer_dev_260211 #142

Merged
gina merged 5 commits from feat/infer_dev_260211 into develop 2026-03-06 18:05:00 +09:00
Showing only changes of commit 37f534abff - Show all commits

View File

@@ -17,7 +17,8 @@ import org.springframework.http.HttpStatus;
import org.springframework.web.server.ResponseStatusException; import org.springframework.web.server.ResponseStatusException;
/** /**
* GeoJSON 파일의 "features[].properties.scene_id" 값들이 "요청한 도엽번호 목록(requestedMapSheetNums)"과 정확히 일치하는지 검증하는 유틸. * GeoJSON 파일의 "features[].properties.scene_id" 값들이 "요청한 도엽번호 목록(requestedMapSheetNums)"과 정확히 일치하는지
* 검증하는 유틸.
* *
* <p>핵심 목적: - 요청한 도엽번호를 기반으로 GeoJSON을 생성했는데, 실제 결과 파일에 누락/추가/중복/빈값(scene_id 없음) 등이 발생했는지 빠르게 잡아내기. * <p>핵심 목적: - 요청한 도엽번호를 기반으로 GeoJSON을 생성했는데, 실제 결과 파일에 누락/추가/중복/빈값(scene_id 없음) 등이 발생했는지 빠르게 잡아내기.
* *
@@ -26,22 +27,19 @@ import org.springframework.web.server.ResponseStatusException;
*/ */
public class GeoJsonValidator { public class GeoJsonValidator {
/** /** GeoJSON 파싱용 ObjectMapper (정적 1개로 재사용) */
* GeoJSON 파싱용 ObjectMapper (정적 1개로 재사용)
*/
private static final ObjectMapper om = new ObjectMapper(); private static final ObjectMapper om = new ObjectMapper();
/** /** 로그 출력용 */
* 로그 출력용
*/
private static final Logger log = LogManager.getLogger(GeoJsonValidator.class); private static final Logger log = LogManager.getLogger(GeoJsonValidator.class);
/** /**
* @param geojsonPath GeoJSON 파일 경로(문자열) * @param geojsonPath GeoJSON 파일 경로(문자열)
* @param requestedMapSheetNums "요청한 도엽번호" 리스트 (중복/공백/NULL 포함 가능) * @param requestedMapSheetNums "요청한 도엽번호" 리스트 (중복/공백/NULL 포함 가능)
* <p>동작 개요: 1) 파일 존재/크기 검증 2) 요청 도엽번호 목록 정리(Trim + 공백 제거 + 중복 제거) 3) GeoJSON 파싱 후 features 배열 * <p>동작 개요: 1) 파일 존재/크기 검증 2) 요청 도엽번호 목록 정리(Trim + 공백 제거 + 중복 제거) 3) GeoJSON 파싱 후 features 배열
* 확보 4) features에서 scene_id 추출하여 유니크 set 구성 5) requested vs found 비교: - missing: requested - found - extra : found - requested - duplicates: GeoJSON * 확보 4) features에서 scene_id 추출하여 유니크 set 구성 5) requested vs found 비교: - missing: requested -
* 내부에서 scene_id 중복 등장 - nullIdCount: scene_id가 null/blank 인 feature 개수 6) 이상 있으면 422로 실패 처리 * found - extra : found - requested - duplicates: GeoJSON 내부에서 scene_id 중복 등장 - nullIdCount:
* scene_id가 null/blank 인 feature 개수 6) 이상 있으면 422로 실패 처리
*/ */
public static void validateWithRequested(String geojsonPath, List<String> requestedMapSheetNums) { public static void validateWithRequested(String geojsonPath, List<String> requestedMapSheetNums) {
@@ -176,7 +174,9 @@ public class GeoJsonValidator {
// properties가 있고 scene_id가 null이 아니면 텍스트로 읽음 // properties가 있고 scene_id가 null이 아니면 텍스트로 읽음
// 없으면 null 처리 // 없으면 null 처리
String sceneId = String sceneId =
(props != null && props.hasNonNull("scene_id")) ? props.get("scene_id").asText().trim() : null; (props != null && props.hasNonNull("scene_id"))
? props.get("scene_id").asText().trim()
: null;
// scene_id가 없거나 빈값이면 "정상적으로 도엽번호가 들어오지 않은 feature"로 카운트 // scene_id가 없거나 빈값이면 "정상적으로 도엽번호가 들어오지 않은 feature"로 카운트
if (sceneId == null || sceneId.isBlank()) { if (sceneId == null || sceneId.isBlank()) {