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
*/
public InferenceLearnDto getInferenceUid(UUID uuid) {
MapSheetLearnEntity entity =
inferenceResultRepository
.getInferenceUid(uuid)
.orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND));
MapSheetLearnEntity entity = inferenceResultRepository.getInferenceUid(uuid).orElse(null);
if (entity == null) {
throw new CustomApiException("NOT_FOUND_DATA", HttpStatus.NOT_FOUND);
}
// inferenceResultRepository
// .getInferenceUid(uuid)
// .orElseThrow(() -> new CustomApiException("NOT_FOUND_DATA",
// HttpStatus.NOT_FOUND));
InferenceLearnDto dto = new InferenceLearnDto();
dto.setUid(entity.getUid());
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.QMapSheetAnalInferenceEntity.mapSheetAnalInferenceEntity;
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.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.MapScaleType;
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.QMapSheetAnalDataInferenceEntity;
import com.querydsl.core.types.Projections;
import com.querydsl.core.types.dsl.BooleanExpression;
import com.querydsl.core.types.dsl.CaseBuilder;
@@ -171,18 +174,27 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
@Override
public List<ChangeDetectionDto.AnalYearList> getChangeDetectionYearList() {
QMapSheetAnalDataInferenceEntity d = new QMapSheetAnalDataInferenceEntity("d2");
return queryFactory
.select(
Projections.constructor(
ChangeDetectionDto.AnalYearList.class,
mapSheetAnalInferenceEntity.uuid,
mapSheetAnalInferenceEntity.id,
mapSheetAnalInferenceEntity.analTitle,
mapSheetAnalInferenceEntity.compareYyyy.as("beforeYear"),
mapSheetAnalInferenceEntity.targetYyyy.as("afterYear"),
mapSheetAnalInferenceEntity.baseMapSheetNum))
.from(mapSheetAnalInferenceEntity)
.orderBy(mapSheetAnalInferenceEntity.id.asc())
mapSheetLearnEntity.uuid,
mapSheetLearnEntity.id,
mapSheetLearnEntity.title,
mapSheetLearnEntity.compareYyyy.as("beforeYear"),
mapSheetLearnEntity.targetYyyy.as("afterYear"),
Expressions.stringTemplate(
"cast({0} as string)",
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();
}