추론결과 Geometry 가져오는 로직 수정

This commit is contained in:
2026-01-07 16:22:07 +09:00
parent ab9dc72b67
commit 187a51c96a
2 changed files with 30 additions and 9 deletions

View File

@@ -2,6 +2,9 @@ package com.kamco.cd.kamcoback.inference.dto;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.kamco.cd.kamcoback.common.enums.DetectionClassification; import com.kamco.cd.kamcoback.common.enums.DetectionClassification;
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm; import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
@@ -12,7 +15,6 @@ import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import org.locationtech.jts.geom.Geometry;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
@@ -298,8 +300,10 @@ public class InferenceResultDto {
String classAfterName; String classAfterName;
Double classAfterProb; Double classAfterProb;
Long mapSheetNum; Long mapSheetNum;
Geometry gemo; @JsonIgnore String gemoStr;
Geometry geomCenter; @JsonIgnore String geomCenterStr;
JsonNode gemo;
JsonNode geomCenter;
public Geom( public Geom(
Integer compareYyyy, Integer compareYyyy,
@@ -309,8 +313,8 @@ public class InferenceResultDto {
String classAfterCd, String classAfterCd,
Double classAfterProb, Double classAfterProb,
Long mapSheetNum, Long mapSheetNum,
Geometry gemo, String gemoStr,
Geometry geomCenter) { String geomCenterStr) {
this.compareYyyy = compareYyyy; this.compareYyyy = compareYyyy;
this.targetYyyy = targetYyyy; this.targetYyyy = targetYyyy;
this.classBeforeCd = classBeforeCd; this.classBeforeCd = classBeforeCd;
@@ -320,8 +324,20 @@ public class InferenceResultDto {
this.classAfterName = DetectionClassification.fromString(classAfterCd).getDesc(); this.classAfterName = DetectionClassification.fromString(classAfterCd).getDesc();
this.classAfterProb = classAfterProb; this.classAfterProb = classAfterProb;
this.mapSheetNum = mapSheetNum; this.mapSheetNum = mapSheetNum;
this.gemo = gemo; this.gemoStr = gemoStr;
this.geomCenter = geomCenter; this.geomCenterStr = geomCenterStr;
ObjectMapper mapper = new ObjectMapper();
JsonNode geomJson;
JsonNode geomCenterJson;
try {
geomJson = mapper.readTree(gemoStr);
geomCenterJson = mapper.readTree(geomCenterStr);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
this.gemo = geomJson;
this.geomCenter = geomCenterJson;
} }
} }

View File

@@ -269,8 +269,13 @@ public class MapSheetAnalDataInferenceRepositoryImpl
MapSheetAnalDataInferenceGeomEntity.classAfterCd, MapSheetAnalDataInferenceGeomEntity.classAfterCd,
MapSheetAnalDataInferenceGeomEntity.classAfterProb, MapSheetAnalDataInferenceGeomEntity.classAfterProb,
MapSheetAnalDataInferenceGeomEntity.mapSheetNum, MapSheetAnalDataInferenceGeomEntity.mapSheetNum,
MapSheetAnalDataInferenceGeomEntity.geom, Expressions.stringTemplate(
MapSheetAnalDataInferenceGeomEntity.geomCenter)) "ST_AsGeoJSON({0})", MapSheetAnalDataInferenceGeomEntity.geom),
Expressions.stringTemplate(
"ST_AsGeoJSON({0})", MapSheetAnalDataInferenceGeomEntity.geomCenter)
// MapSheetAnalDataInferenceGeomEntity.geom,
// MapSheetAnalDataInferenceGeomEntity.geomCenter)
))
.from(mapSheetAnalInferenceEntity) .from(mapSheetAnalInferenceEntity)
.join(MapSheetAnalDataInferenceEntity) .join(MapSheetAnalDataInferenceEntity)
.on(MapSheetAnalDataInferenceEntity.analUid.eq(mapSheetAnalInferenceEntity.id)) .on(MapSheetAnalDataInferenceEntity.analUid.eq(mapSheetAnalInferenceEntity.id))