추론관리 상세 API 테이블 구조 변경으로 인한 수정

This commit is contained in:
2026-01-16 11:45:05 +09:00
parent fd8807b1d6
commit 78cf943110
7 changed files with 68 additions and 67 deletions

View File

@@ -323,9 +323,9 @@ public class InferenceResultApiController {
}) })
@GetMapping("/infer-result-info") @GetMapping("/infer-result-info")
public ApiResponseDto<InferenceDetailDto.AnalResultInfo> getInferenceResultInfo( public ApiResponseDto<InferenceDetailDto.AnalResultInfo> getInferenceResultInfo(
@Parameter(description = "회차 uuid", example = "932fbd72-2e8e-4a49-b189-09046787f9d1") @Parameter(description = "회차 uuid", example = "f30e8817-9625-4fff-ba43-c1e6ed2067c4")
@RequestParam @RequestParam
String uuid) { UUID uuid) {
return ApiResponseDto.ok(inferenceResultService.getInferenceResultInfo(uuid)); return ApiResponseDto.ok(inferenceResultService.getInferenceResultInfo(uuid));
} }
@@ -344,9 +344,9 @@ public class InferenceResultApiController {
}) })
@GetMapping("/infer-class-count") @GetMapping("/infer-class-count")
public ApiResponseDto<List<InferenceDetailDto.Dashboard>> getInferenceClassCountList( public ApiResponseDto<List<InferenceDetailDto.Dashboard>> getInferenceClassCountList(
@Parameter(description = "회차 uuid", example = "8584e8d4-53b3-4582-bde2-28a81495a626") @Parameter(description = "회차 uuid", example = "242750c5-a627-429b-950a-dce5a87c1c01")
@RequestParam @RequestParam
String uuid) { UUID uuid) {
return ApiResponseDto.ok(inferenceResultService.getInferenceClassCountList(uuid)); return ApiResponseDto.ok(inferenceResultService.getInferenceClassCountList(uuid));
} }
@@ -365,7 +365,7 @@ public class InferenceResultApiController {
}) })
@GetMapping("/geom-list") @GetMapping("/geom-list")
public ApiResponseDto<Page<InferenceDetailDto.Geom>> getInferenceGeomList( public ApiResponseDto<Page<InferenceDetailDto.Geom>> getInferenceGeomList(
@Parameter(description = "회차 uuid", example = "8584e8d4-53b3-4582-bde2-28a81495a626") @Parameter(description = "회차 uuid", example = "242750c5-a627-429b-950a-dce5a87c1c01")
@RequestParam(required = true) @RequestParam(required = true)
UUID uuid, UUID uuid,
@Parameter(description = "기준년도 분류", example = "land") @RequestParam(required = false) @Parameter(description = "기준년도 분류", example = "land") @RequestParam(required = false)

View File

@@ -472,6 +472,7 @@ public class InferenceDetailDto {
? Duration.between(inferStartDttm, inferEndDttm) ? Duration.between(inferStartDttm, inferEndDttm)
: null; : null;
if (elapsed != null) {
long seconds = elapsed.getSeconds(); long seconds = elapsed.getSeconds();
long abs = Math.abs(seconds); long abs = Math.abs(seconds);
@@ -483,3 +484,4 @@ public class InferenceDetailDto {
} }
} }
} }
}

View File

@@ -62,6 +62,7 @@ public class InferenceResultService {
private final ModelMngCoreService modelMngCoreService; private final ModelMngCoreService modelMngCoreService;
private final ExternalHttpClient externalHttpClient; private final ExternalHttpClient externalHttpClient;
private final ObjectMapper objectMapper; private final ObjectMapper objectMapper;
private final UserUtil userUtil;
@Value("${inference.url}") @Value("${inference.url}")
private String inferenceUrl; private String inferenceUrl;
@@ -72,8 +73,6 @@ public class InferenceResultService {
@Value("${spring.profiles.active}") @Value("${spring.profiles.active}")
private String profile; private String profile;
private final UserUtil userUtil;
/** /**
* 추론관리 목록 * 추론관리 목록
* *
@@ -494,11 +493,11 @@ public class InferenceResultService {
return dto; return dto;
} }
public AnalResultInfo getInferenceResultInfo(String uuid) { public AnalResultInfo getInferenceResultInfo(UUID uuid) {
return inferenceResultCoreService.getInferenceResultInfo(uuid); return inferenceResultCoreService.getInferenceResultInfo(uuid);
} }
public List<Dashboard> getInferenceClassCountList(String uuid) { public List<Dashboard> getInferenceClassCountList(UUID uuid) {
return inferenceResultCoreService.getInferenceClassCountList(uuid); return inferenceResultCoreService.getInferenceClassCountList(uuid);
} }

View File

@@ -403,11 +403,11 @@ public class InferenceResultCoreService {
return dto; return dto;
} }
public AnalResultInfo getInferenceResultInfo(String uuid) { public AnalResultInfo getInferenceResultInfo(UUID uuid) {
return mapSheetLearnRepository.getInferenceResultInfo(uuid); return mapSheetLearnRepository.getInferenceResultInfo(uuid);
} }
public List<Dashboard> getInferenceClassCountList(String uuid) { public List<Dashboard> getInferenceClassCountList(UUID uuid) {
return mapSheetLearnRepository.getInferenceClassCountList(uuid); return mapSheetLearnRepository.getInferenceClassCountList(uuid);
} }

View File

@@ -53,7 +53,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
r.stage, r.stage,
r.compare_yyyy, r.compare_yyyy,
r.target_yyyy, r.target_yyyy,
CONCAT(r.stage, '_', r.compare_yyyy, '_', r.target_yyyy) AS anal_title, r.title,
r.detecting_cnt, r.detecting_cnt,
now(), now(),
r.m1_model_batch_id, r.m1_model_batch_id,

View File

@@ -32,9 +32,9 @@ public interface MapSheetLearnRepositoryCustom {
Integer getLearnStage(Integer compareYear, Integer targetYear); Integer getLearnStage(Integer compareYear, Integer targetYear);
AnalResultInfo getInferenceResultInfo(String uuid); AnalResultInfo getInferenceResultInfo(UUID uuid);
List<Dashboard> getInferenceClassCountList(String uuid); List<Dashboard> getInferenceClassCountList(UUID uuid);
Page<Geom> getInferenceGeomList(UUID uuid, SearchGeoReq searchGeoReq); Page<Geom> getInferenceGeomList(UUID uuid, SearchGeoReq searchGeoReq);
} }

View File

@@ -19,7 +19,6 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto; import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceStatusDetailDto; import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceStatusDetailDto;
import com.kamco.cd.kamcoback.model.service.ModelMngService; import com.kamco.cd.kamcoback.model.service.ModelMngService;
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalInferenceEntity;
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity; import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
import com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity; import com.kamco.cd.kamcoback.postgres.entity.QModelMngEntity;
import com.querydsl.core.BooleanBuilder; import com.querydsl.core.BooleanBuilder;
@@ -28,7 +27,6 @@ import com.querydsl.core.types.dsl.CaseBuilder;
import com.querydsl.core.types.dsl.Expressions; import com.querydsl.core.types.dsl.Expressions;
import com.querydsl.core.types.dsl.NumberExpression; import com.querydsl.core.types.dsl.NumberExpression;
import com.querydsl.jpa.impl.JPAQueryFactory; import com.querydsl.jpa.impl.JPAQueryFactory;
import jakarta.persistence.EntityNotFoundException;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@@ -292,7 +290,7 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
} }
@Override @Override
public AnalResultInfo getInferenceResultInfo(String uuid) { public AnalResultInfo getInferenceResultInfo(UUID uuid) {
QModelMngEntity m1 = new QModelMngEntity("m1"); QModelMngEntity m1 = new QModelMngEntity("m1");
QModelMngEntity m2 = new QModelMngEntity("m2"); QModelMngEntity m2 = new QModelMngEntity("m2");
QModelMngEntity m3 = new QModelMngEntity("m3"); QModelMngEntity m3 = new QModelMngEntity("m3");
@@ -319,22 +317,22 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
.on(mapSheetLearnEntity.m2ModelUuid.eq(m2.uuid)) .on(mapSheetLearnEntity.m2ModelUuid.eq(m2.uuid))
.leftJoin(m3) .leftJoin(m3)
.on(mapSheetLearnEntity.m3ModelUuid.eq(m3.uuid)) .on(mapSheetLearnEntity.m3ModelUuid.eq(m3.uuid))
.where(mapSheetLearnEntity.uuid.eq(UUID.fromString(uuid))) .where(mapSheetLearnEntity.uuid.eq(uuid))
.fetchOne(); .fetchOne();
} }
@Override @Override
public List<Dashboard> getInferenceClassCountList(String uuid) { public List<Dashboard> getInferenceClassCountList(UUID uuid) {
// analUid로 분석 정보 조회 // analUid로 분석 정보 조회
MapSheetAnalInferenceEntity analEntity = MapSheetLearnEntity learnEntity =
queryFactory queryFactory
.selectFrom(mapSheetAnalInferenceEntity) .selectFrom(mapSheetLearnEntity)
.where(mapSheetAnalInferenceEntity.uuid.eq(UUID.fromString(uuid))) .where(mapSheetLearnEntity.uuid.eq(uuid))
.fetchOne(); .fetchOne();
if (Objects.isNull(analEntity)) { if (Objects.isNull(learnEntity)) {
throw new EntityNotFoundException("MapSheetAnalInferenceEntity not found for analUid: "); throw new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND);
} }
return queryFactory return queryFactory
@@ -343,8 +341,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
Dashboard.class, Dashboard.class,
mapSheetAnalSttcEntity.id.classAfterCd, mapSheetAnalSttcEntity.id.classAfterCd,
mapSheetAnalSttcEntity.classAfterCnt.sum())) mapSheetAnalSttcEntity.classAfterCnt.sum()))
.from(mapSheetAnalSttcEntity) .from(mapSheetAnalInferenceEntity)
.where(mapSheetAnalSttcEntity.id.analUid.eq(analEntity.getId())) .innerJoin(mapSheetAnalSttcEntity)
.on(mapSheetAnalInferenceEntity.id.eq(mapSheetAnalSttcEntity.id.analUid))
.where(mapSheetAnalInferenceEntity.learnId.eq(learnEntity.getId()))
.groupBy(mapSheetAnalSttcEntity.id.classAfterCd) .groupBy(mapSheetAnalSttcEntity.id.classAfterCd)
.orderBy(mapSheetAnalSttcEntity.id.classAfterCd.asc()) .orderBy(mapSheetAnalSttcEntity.id.classAfterCd.asc())
.fetch(); .fetch();
@@ -362,10 +362,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
BooleanBuilder builder = new BooleanBuilder(); BooleanBuilder builder = new BooleanBuilder();
// analUid로 분석 정보 조회 // analUid로 분석 정보 조회
MapSheetAnalInferenceEntity analEntity = MapSheetLearnEntity analEntity =
queryFactory queryFactory
.selectFrom(mapSheetAnalInferenceEntity) .selectFrom(mapSheetLearnEntity)
.where(mapSheetAnalInferenceEntity.uuid.eq(uuid)) .where(mapSheetLearnEntity.uuid.eq(uuid))
.fetchOne(); .fetchOne();
if (Objects.isNull(analEntity)) { if (Objects.isNull(analEntity)) {
@@ -373,7 +373,7 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
} }
// 추론결과 id // 추론결과 id
builder.and(mapSheetAnalInferenceEntity.id.eq(analEntity.getId())); builder.and(mapSheetAnalInferenceEntity.learnId.eq(analEntity.getId()));
// 기준년도 분류 // 기준년도 분류
if (searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().equals("")) { if (searchGeoReq.getTargetClass() != null && !searchGeoReq.getTargetClass().equals("")) {