추론결과 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.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.utils.interfaces.JsonFormatDttm;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -12,7 +15,6 @@ import lombok.AllArgsConstructor;
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;
@@ -298,8 +300,10 @@ public class InferenceResultDto {
String classAfterName;
Double classAfterProb;
Long mapSheetNum;
Geometry gemo;
Geometry geomCenter;
@JsonIgnore String gemoStr;
@JsonIgnore String geomCenterStr;
JsonNode gemo;
JsonNode geomCenter;
public Geom(
Integer compareYyyy,
@@ -309,8 +313,8 @@ public class InferenceResultDto {
String classAfterCd,
Double classAfterProb,
Long mapSheetNum,
Geometry gemo,
Geometry geomCenter) {
String gemoStr,
String geomCenterStr) {
this.compareYyyy = compareYyyy;
this.targetYyyy = targetYyyy;
this.classBeforeCd = classBeforeCd;
@@ -320,8 +324,20 @@ public class InferenceResultDto {
this.classAfterName = DetectionClassification.fromString(classAfterCd).getDesc();
this.classAfterProb = classAfterProb;
this.mapSheetNum = mapSheetNum;
this.gemo = gemo;
this.geomCenter = geomCenter;
this.gemoStr = gemoStr;
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.classAfterProb,
MapSheetAnalDataInferenceGeomEntity.mapSheetNum,
MapSheetAnalDataInferenceGeomEntity.geom,
MapSheetAnalDataInferenceGeomEntity.geomCenter))
Expressions.stringTemplate(
"ST_AsGeoJSON({0})", MapSheetAnalDataInferenceGeomEntity.geom),
Expressions.stringTemplate(
"ST_AsGeoJSON({0})", MapSheetAnalDataInferenceGeomEntity.geomCenter)
// MapSheetAnalDataInferenceGeomEntity.geom,
// MapSheetAnalDataInferenceGeomEntity.geomCenter)
))
.from(mapSheetAnalInferenceEntity)
.join(MapSheetAnalDataInferenceEntity)
.on(MapSheetAnalDataInferenceEntity.analUid.eq(mapSheetAnalInferenceEntity.id))