Merge pull request '리스트의 탐지건수와 상세의 탐지건수 불일치 오류 수정' (#343) from feat/infer_dev_260107 into develop

Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/343
This commit is contained in:
2026-01-26 13:56:09 +09:00
2 changed files with 28 additions and 12 deletions

View File

@@ -506,10 +506,14 @@ public class InferenceResultCoreService {
* @return * @return
*/ */
public InferenceLearnDto getInferenceUid(UUID uuid) { public InferenceLearnDto getInferenceUid(UUID uuid) {
MapSheetLearnEntity entity = MapSheetLearnEntity entity = inferenceResultRepository.getInferenceUid(uuid).orElse(null);
inferenceResultRepository if (entity == null) {
.getInferenceUid(uuid) throw new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND);
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND)); }
// inferenceResultRepository
// .getInferenceUid(uuid)
// .orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA",
// HttpStatus.NOT_FOUND));
InferenceLearnDto dto = new InferenceLearnDto(); InferenceLearnDto dto = new InferenceLearnDto();
dto.setUid(entity.getUid()); dto.setUid(entity.getUid());
dto.setM1ModelBatchId(entity.getM1ModelBatchId()); dto.setM1ModelBatchId(entity.getM1ModelBatchId());

View File

@@ -7,6 +7,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceE
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity; import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity; import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity; import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalSttcEntity.mapSheetAnalSttcEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
@@ -15,7 +16,9 @@ import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto;
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearchType; import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.DetectSearchType;
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType; import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType;
import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList; import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapSheetList;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.Status;
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity; import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
import com.kamco.cd.kamcoback.postgres.entity.QMapSheetAnalDataInferenceEntity;
import com.querydsl.core.types.Projections; import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.CaseBuilder; import com.querydsl.core.types.dsl.CaseBuilder;
@@ -171,18 +174,27 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
@Override @Override
public List<ChangeDetectionDto.AnalYearList> getChangeDetectionYearList() { public List<ChangeDetectionDto.AnalYearList> getChangeDetectionYearList() {
QMapSheetAnalDataInferenceEntity d = new QMapSheetAnalDataInferenceEntity("d2");
return queryFactory return queryFactory
.select( .select(
Projections.constructor( Projections.constructor(
ChangeDetectionDto.AnalYearList.class, ChangeDetectionDto.AnalYearList.class,
mapSheetAnalInferenceEntity.uuid, mapSheetLearnEntity.uuid,
mapSheetAnalInferenceEntity.id, mapSheetLearnEntity.id,
mapSheetAnalInferenceEntity.analTitle, mapSheetLearnEntity.title,
mapSheetAnalInferenceEntity.compareYyyy.as("beforeYear"), mapSheetLearnEntity.compareYyyy.as("beforeYear"),
mapSheetAnalInferenceEntity.targetYyyy.as("afterYear"), mapSheetLearnEntity.targetYyyy.as("afterYear"),
mapSheetAnalInferenceEntity.baseMapSheetNum)) Expressions.stringTemplate(
.from(mapSheetAnalInferenceEntity) "cast({0} as string)",
.orderBy(mapSheetAnalInferenceEntity.id.asc()) JPAExpressions.select(d.mapSheetNum.max())
.from(d)
.where(d.analUid.eq(mapSheetAnalInferenceEntity.id)))))
.from(mapSheetLearnEntity)
.leftJoin(mapSheetAnalInferenceEntity)
.on(mapSheetAnalInferenceEntity.learnId.eq(mapSheetLearnEntity.id))
.where(mapSheetLearnEntity.status.eq(Status.END.getId()))
.orderBy(mapSheetLearnEntity.id.asc())
.fetch(); .fetch();
} }