추론 결과 bbox, bbox point 추가

This commit is contained in:
2026-01-22 15:24:10 +09:00
parent 2cbd2626b9
commit fd2ff5b9ac
6 changed files with 85 additions and 2 deletions

View File

@@ -262,7 +262,7 @@ public class InferenceResultApiController {
})
@GetMapping("/infer-result-info")
public ApiResponseDto<InferenceDetailDto.AnalResultInfo> getInferenceResultInfo(
@Parameter(description = "회차 uuid", example = "f30e8817-9625-4fff-ba43-c1e6ed2067c4")
@Parameter(description = "회차 uuid", example = "5799eb21-4780-48b0-a82e-e58dcbb8806b")
@RequestParam
UUID uuid) {
return ApiResponseDto.ok(inferenceResultService.getInferenceResultInfo(uuid));

View File

@@ -3,6 +3,9 @@ package com.kamco.cd.kamcoback.inference.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
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.ImageryFitStatus;
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
@@ -431,6 +434,7 @@ public class InferenceDetailDto {
@Schema(name = "AnalResultInfo", description = "추론결과 기본정보")
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public static class AnalResultInfo {
@@ -449,6 +453,29 @@ public class InferenceDetailDto {
private String elapsedDuration;
private String subUid;
private String bboxGeom;
private String bboxCenterPoint;
@JsonProperty("bboxGeom")
public JsonNode getBboxGeom() {
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.readTree(this.bboxGeom);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
@JsonProperty("bboxCenterPoint")
public JsonNode getBboxCenterPoint() {
ObjectMapper mapper = new ObjectMapper();
try {
return mapper.readTree(this.bboxCenterPoint);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
public AnalResultInfo(
String analTitle,
String modelVer1,
@@ -492,6 +519,16 @@ public class InferenceDetailDto {
}
}
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class BboxPointDto {
private String bboxGeom;
private String bboxCenterPoint;
}
@Getter
@Setter
@NoArgsConstructor

View File

@@ -574,6 +574,12 @@ public class InferenceResultService {
return dto;
}
/**
* 추론결과 기본정보
*
* @param uuid uuid
* @return
*/
public AnalResultInfo getInferenceResultInfo(UUID uuid) {
return inferenceResultCoreService.getInferenceResultInfo(uuid);
}

View File

@@ -4,6 +4,7 @@ import com.kamco.cd.kamcoback.common.exception.CustomApiException;
import com.kamco.cd.kamcoback.common.utils.UserUtil;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.AnalResultInfo;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.BboxPointDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.Dashboard;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.Geom;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.InferenceBatchSheet;
@@ -409,8 +410,18 @@ public class InferenceResultCoreService {
return dto;
}
/**
* 추론결과 기본정보
*
* @param uuid uuid
* @return
*/
public AnalResultInfo getInferenceResultInfo(UUID uuid) {
return mapSheetLearnRepository.getInferenceResultInfo(uuid);
AnalResultInfo resultInfo = mapSheetLearnRepository.getInferenceResultInfo(uuid);
BboxPointDto bboxPointDto = mapSheetLearnRepository.getBboxPoint(uuid);
resultInfo.setBboxGeom(bboxPointDto.getBboxGeom());
resultInfo.setBboxCenterPoint(bboxPointDto.getBboxCenterPoint());
return resultInfo;
}
public List<Dashboard> getInferenceClassCountList(UUID uuid) {

View File

@@ -1,6 +1,7 @@
package com.kamco.cd.kamcoback.postgres.repository.Inference;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.AnalResultInfo;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.BboxPointDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.Dashboard;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.Geom;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.SearchGeoReq;
@@ -34,6 +35,8 @@ public interface MapSheetLearnRepositoryCustom {
AnalResultInfo getInferenceResultInfo(UUID uuid);
BboxPointDto getBboxPoint(UUID uuid);
List<Dashboard> getInferenceClassCountList(UUID uuid);
Page<Geom> getInferenceGeomList(UUID uuid, SearchGeoReq searchGeoReq);

View File

@@ -13,6 +13,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QSystemMetricEntity.systemM
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
import com.kamco.cd.kamcoback.common.utils.DateRange;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.AnalResultInfo;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.BboxPointDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.Dashboard;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.Geom;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.SearchGeoReq;
@@ -24,6 +25,7 @@ import com.kamco.cd.kamcoback.model.service.ModelMngService;
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
import com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Expression;
import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.CaseBuilder;
@@ -331,6 +333,30 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
.fetchOne();
}
@Override
public BboxPointDto getBboxPoint(UUID uuid) {
Expression<String> bboxGeom =
Expressions.stringTemplate(
"ST_AsGeoJSON(ST_Envelope(ST_Collect({0})))", mapSheetAnalDataInferenceGeomEntity.geom);
Expression<String> bboxCenterPoint =
Expressions.stringTemplate(
"ST_AsGeoJSON(ST_Centroid(ST_Envelope(ST_Collect({0}))))",
mapSheetAnalDataInferenceGeomEntity.geom);
return queryFactory
.select(Projections.constructor(BboxPointDto.class, bboxGeom, bboxCenterPoint))
.from(mapSheetLearnEntity)
.join(mapSheetAnalInferenceEntity)
.on(mapSheetAnalInferenceEntity.learnId.eq(mapSheetLearnEntity.id))
.join(mapSheetAnalDataInferenceEntity)
.on(mapSheetAnalDataInferenceEntity.analUid.eq(mapSheetAnalInferenceEntity.id))
.join(mapSheetAnalDataInferenceGeomEntity)
.on(mapSheetAnalDataInferenceGeomEntity.dataUid.eq(mapSheetAnalDataInferenceEntity.id))
.where(mapSheetLearnEntity.uuid.eq(uuid))
.fetchOne();
}
@Override
public List<Dashboard> getInferenceClassCountList(UUID uuid) {