Rviewer add

This commit is contained in:
DanielLee
2026-01-14 09:42:08 +09:00
parent 56e7866d4f
commit b918ad14c4
16 changed files with 13017 additions and 8 deletions

View File

@@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.kamco.cd.kamcoback.common.utils.geometry.GeometryDeserializer;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -298,8 +299,8 @@ public class TrainingDataLabelDto {
@Schema(description = "도엽 bbox")
private JsonNode mapBox;
@Schema(description = "라벨링 툴에서 그린 폴리곤")
private LearnDataGeometry learnGeometry;
@Schema(description = "라벨링 툴에서 그린 폴리곤들 (여러 개 가능)")
private List<LearnDataGeometry> learnGeometries;
}
@Schema(name = "ChangeDetectionInfo", description = "변화탐지정보")
@@ -394,4 +395,133 @@ public class TrainingDataLabelDto {
private int page;
private UUID assignmentUid;
}
@Schema(name = "NewPolygonRequest", description = "새로운 polygon(들) 추가 저장")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class NewPolygonRequest {
@Schema(description = "assignmentUid", example = "4f9ebc8b-6635-4177-b42f-7efc9c7b4c02")
private String assignmentUid;
@Schema(description = "anal_uid", example = "1")
private Long analUid;
@Schema(description = "map_sheet_num (도엽번호)", example = "NI52-3-13-1")
private String mapSheetNum;
@Schema(description = "compare_yyyy (변화 전 년도)", example = "2022")
private Integer compareYyyy;
@Schema(description = "target_yyyy (변화 후 년도)", example = "2023")
private Integer targetYyyy;
@Schema(description = "새로 그린 polygon 리스트")
private List<PolygonFeature> features;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class PolygonFeature {
@Schema(description = "type", example = "Feature")
private String type;
@JsonDeserialize(using = GeometryDeserializer.class)
@Schema(
description = "polygon geometry",
example =
"""
{
"type": "Polygon",
"coordinates": [
[
[
126.66292461969202,
34.58785236216609
],
[
126.66263801099049,
34.58740117447532
],
[
126.66293668521236,
34.5873904146878
],
[
126.66312820122245,
34.587841464427825
],
[
126.66289124481979,
34.58786048381633
],
[
126.66292461969202,
34.58785236216609
]
]
]
}
""")
private Geometry geometry;
@Schema(description = "polygon properties")
private PolygonProperties properties;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class PolygonProperties {
@Schema(description = "beforeClass", example = "WASTE")
private String beforeClass;
@Schema(description = "afterClass", example = "LAND")
private String afterClass;
}
}
}
@Schema(name = "CogImageRequest", description = "COG 이미지 조회 요청")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class CogImageRequest {
@Schema(description = "map_sheet_num (도엽번호)", example = "NI52-3-13-1", required = true)
private String mapSheetNum;
@Schema(description = "year (년도)", example = "2022", required = true)
private Integer year;
}
@Schema(name = "CogImageResponse", description = "COG 이미지 URL 응답")
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class CogImageResponse {
@Schema(description = "변화 전 COG 이미지 URL")
private String beforeCogUrl;
@Schema(description = "변화 후 COG 이미지 URL")
private String afterCogUrl;
@Schema(description = "변화 전 년도")
private Integer beforeYear;
@Schema(description = "변화 후 년도")
private Integer afterYear;
@Schema(description = "도엽번호")
private String mapSheetNum;
}
}

View File

@@ -0,0 +1,533 @@
package com.kamco.cd.kamcoback.trainingdata.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.kamco.cd.kamcoback.common.utils.geometry.GeometryDeserializer;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.locationtech.jts.geom.Geometry;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
public class TrainingDataReviewDto {
@Schema(name = "ReviewListDto", description = "ReviewListDto")
@Getter
@Setter
@NoArgsConstructor
public static class ReviewListDto {
private UUID operatorUid;
private Long inferenceGeomUid;
private String inspectorUid;
private String inspectState;
private String mapSheetNum;
private String mapIdNm;
private Long pnu;
public ReviewListDto(
UUID operatorUid,
Long inferenceGeomUid,
String inspectorUid,
String inspectState,
String mapSheetNum,
String mapIdNm,
Long pnu) {
this.operatorUid = operatorUid;
this.inferenceGeomUid = inferenceGeomUid;
this.inspectorUid = inspectorUid;
this.inspectState = inspectState;
this.mapSheetNum = mapSheetNum;
this.mapIdNm = mapIdNm;
this.pnu = pnu;
}
}
@Schema(name = "ReviewGeometryInfo", description = "ReviewGeometryInfo")
@Getter
@Setter
@NoArgsConstructor
public static class ReviewGeometryInfo {
private UUID operatorUid;
private Long inferenceGeomUid;
@JsonIgnore private String geomData; // json string
private JsonNode geom;
private String beforeCogUrl;
private String afterCogUrl;
@JsonIgnore private String mapBboxString; // json string
private JsonNode mapBbox;
public ReviewGeometryInfo(
UUID operatorUid,
Long inferenceGeomUid,
String geomData,
String beforeCogUrl,
String afterCogUrl,
String mapBboxString) {
this.operatorUid = operatorUid;
this.inferenceGeomUid = inferenceGeomUid;
this.beforeCogUrl = beforeCogUrl;
this.afterCogUrl = afterCogUrl;
ObjectMapper mapper = new ObjectMapper();
JsonNode geomJson;
JsonNode mapBboxJson;
try {
geomJson = mapper.readTree(geomData);
mapBboxJson = mapper.readTree(mapBboxString);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
this.geom = geomJson;
this.mapBbox = mapBboxJson;
}
}
@Schema(name = "GeoFeatureRequest", description = "검수 결과 저장")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class GeoFeatureRequest {
@Schema(description = "operatorUid", example = "4f9ebc8b-6635-4177-b42f-7efc9c7b4c02")
private String operatorUid;
@Schema(description = "type", example = "Feature")
private String type;
@JsonDeserialize(using = GeometryDeserializer.class)
@Schema(
description = "검수 결과 polygon",
example =
"""
{
"type": "Polygon",
"coordinates": [
[
[
126.66292461969202,
34.58785236216609
],
[
126.66263801099049,
34.58740117447532
],
[
126.66293668521236,
34.5873904146878
],
[
126.66312820122245,
34.587841464427825
],
[
126.66289124481979,
34.58786048381633
],
[
126.66292461969202,
34.58785236216609
]
]
]
}
""")
private Geometry geometry;
private Properties properties;
@Getter
public static class Properties {
@Schema(description = "beforeClass", example = "WASTE")
private String beforeClass;
@Schema(description = "afterClass", example = "LAND")
private String afterClass;
@Schema(description = "inspectState", example = "COMPLETE")
private String inspectState;
@Schema(description = "inspectMemo", example = "검수 완료")
private String inspectMemo;
}
}
@Schema(name = "InferenceDataGeometry", description = "InferenceDataGeometry")
@Getter
@Setter
@NoArgsConstructor
public static class InferenceDataGeometry {
private String type;
@JsonIgnore private String learnGeomString;
private JsonNode geometry;
private InferenceProperties properties;
public InferenceDataGeometry(
String type, String learnGeomString, InferenceProperties properties) {
this.type = type;
this.properties = properties;
ObjectMapper mapper = new ObjectMapper();
JsonNode inferenceJson;
try {
inferenceJson = mapper.readTree(learnGeomString);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
this.geometry = inferenceJson;
if (inferenceJson.isObject()) {
((ObjectNode) inferenceJson).remove("crs");
}
}
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class InferenceProperties {
@Schema(description = "beforeClass", example = "WASTE")
private String beforeClass;
@Schema(description = "afterClass", example = "LAND")
private String afterClass;
}
}
@Schema(name = "LearnDataGeometry", description = "LearnDataGeometry")
@Getter
@Setter
@NoArgsConstructor
public static class LearnDataGeometry {
private String type;
@JsonIgnore private String learnGeomString;
private JsonNode geometry;
private LearnProperties properties;
public LearnDataGeometry(String type, String learnGeomString, LearnProperties properties) {
this.type = type;
this.properties = properties;
ObjectMapper mapper = new ObjectMapper();
JsonNode learnJson;
try {
learnJson = mapper.readTree(learnGeomString);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
this.geometry = learnJson;
if (learnJson.isObject()) {
((ObjectNode) learnJson).remove("crs");
}
}
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class LearnProperties {
@Schema(description = "beforeClass", example = "WASTE")
private String beforeClass;
@Schema(description = "afterClass", example = "LAND")
private String afterClass;
}
}
@Schema(name = "searchReq", description = "검색 요청")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class searchReq {
// 페이징 파라미터
private int page = 0;
private int size = 20;
private String sort;
public Pageable toPageable() {
if (sort != null && !sort.isEmpty()) {
String[] sortParams = sort.split(",");
String property = sortParams[0];
Sort.Direction direction =
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
return PageRequest.of(page, size, Sort.by(direction, property));
}
return PageRequest.of(page, size);
}
}
@Schema(name = "DetailRes", description = "객체 상세 정보 응답")
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class DetailRes {
@Schema(description = "검수 작업 ID")
private UUID operatorUid;
@Schema(description = "변화탐지정보")
private ChangeDetectionInfo changeDetectionInfo;
@Schema(description = "실태조사결과정보")
private InspectionResultInfo inspectionResultInfo;
@Schema(description = "Geometry (GeoJSON)")
private InferenceDataGeometry geom;
@Schema(description = "변화 전 COG 이미지 URL")
private String beforeCogUrl;
@Schema(description = "변화 후 COG 이미지 URL")
private String afterCogUrl;
@Schema(description = "도엽 bbox")
private JsonNode mapBox;
@Schema(description = "검수 시 추가/수정한 폴리곤들 (여러 개 가능)")
private List<LearnDataGeometry> learnGeometries;
}
@Schema(name = "ChangeDetectionInfo", description = "변화탐지정보")
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ChangeDetectionInfo {
@Schema(description = "도엽번호정보", example = "남해")
private String mapSheetInfo;
@Schema(description = "변화탐지연도", example = "2022-2023")
private String detectionYear;
@Schema(description = "변화 전 분류 정보")
private ClassificationInfo beforeClass;
@Schema(description = "변화 후 분류 정보")
private ClassificationInfo afterClass;
@Schema(description = "면적 (㎡)", example = "179.52")
private Double area;
@Schema(description = "탐지정확도 (%)", example = "84.8")
private Double detectionAccuracy;
@Schema(description = "PNU (필지고유번호)", example = "36221202306020")
private Long pnu;
}
@Schema(name = "ClassificationInfo", description = "분류정보")
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class ClassificationInfo {
@Schema(description = "분류", example = "일반토지")
private String classification;
@Schema(description = "확률", example = "80.0")
private Double probability;
}
@Schema(name = "InspectionResultInfo", description = "실태조사결과정보")
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class InspectionResultInfo {
@Schema(description = "검증결과 (미확인/제외/완료)", example = "미확인")
private String verificationResult;
@Schema(description = "부적합사유")
private String inappropriateReason;
@Schema(description = "메모")
private String memo;
}
@Schema(name = "SummaryRes", description = "작업 통계 응답")
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class SummaryRes {
@Schema(description = "전체 배정 건수", example = "8901")
private Long totalCnt;
@Schema(description = "미작업 건수 (UNCONFIRM 상태)", example = "7211")
private Long undoneCnt;
@Schema(description = "오늘 완료 건수", example = "0")
private Long todayCnt;
}
@Schema(name = "DefaultPaging", description = "페이징 기본 number, uuid 전달")
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class DefaultPaging {
private int page;
private UUID operatorUid;
}
@Schema(name = "NewPolygonRequest", description = "새로운 polygon(들) 추가 저장")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class NewPolygonRequest {
@Schema(description = "operatorUid", example = "4f9ebc8b-6635-4177-b42f-7efc9c7b4c02")
private String operatorUid;
@Schema(description = "anal_uid", example = "53")
private Long analUid;
@Schema(description = "map_sheet_num (도엽번호)", example = "35905086")
private String mapSheetNum;
@Schema(description = "compare_yyyy (변화 전 년도)", example = "2023")
private Integer compareYyyy;
@Schema(description = "target_yyyy (변화 후 년도)", example = "2024")
private Integer targetYyyy;
@Schema(description = "새로 그린 polygon 리스트")
private List<PolygonFeature> features;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class PolygonFeature {
@Schema(description = "type", example = "Feature")
private String type;
@JsonDeserialize(using = GeometryDeserializer.class)
@Schema(
description = "polygon geometry",
example =
"""
{
"type": "Polygon",
"coordinates": [
[
[
126.66292461969202,
34.58785236216609
],
[
126.66263801099049,
34.58740117447532
],
[
126.66293668521236,
34.5873904146878
],
[
126.66312820122245,
34.587841464427825
],
[
126.66289124481979,
34.58786048381633
],
[
126.66292461969202,
34.58785236216609
]
]
]
}
""")
private Geometry geometry;
@Schema(description = "polygon properties")
private PolygonProperties properties;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class PolygonProperties {
@Schema(description = "beforeClass", example = "WASTE")
private String beforeClass;
@Schema(description = "afterClass", example = "LAND")
private String afterClass;
}
}
}
@Schema(name = "CogImageRequest", description = "COG 이미지 조회 요청")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class CogImageRequest {
@Schema(description = "map_sheet_num (도엽번호)", example = "NI52-3-13-1", required = true)
private String mapSheetNum;
@Schema(description = "year (년도)", example = "2022", required = true)
private Integer year;
}
@Schema(name = "CogImageResponse", description = "COG 이미지 URL 응답")
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class CogImageResponse {
@Schema(description = "변화 전 COG 이미지 URL")
private String beforeCogUrl;
@Schema(description = "변화 후 COG 이미지 URL")
private String afterCogUrl;
@Schema(description = "변화 전 년도")
private Integer beforeYear;
@Schema(description = "변화 후 년도")
private Integer afterYear;
@Schema(description = "도엽번호")
private String mapSheetNum;
}
}