리스트의 탐지건수와 상세의 탐지건수 불일치 오류 수정

This commit is contained in:
2026-01-26 11:20:46 +09:00
parent 71b835d37f
commit 4373237cc1
3 changed files with 44 additions and 4 deletions

View File

@@ -58,7 +58,7 @@ public class InferenceResultCoreService {
private final MapInkx5kRepository mapInkx5kRepository; private final MapInkx5kRepository mapInkx5kRepository;
private final MapSheetLearn5kRepository mapSheetLearn5kRepository; private final MapSheetLearn5kRepository mapSheetLearn5kRepository;
private final InferenceResultRepository inferenceResultRepository; private final InferenceResultRepository inferenceResultRepository;
private final InferenceResultsTestingRepository inferenceResultsTetingRepository; private final InferenceResultsTestingRepository inferenceResultsTestingRepository;
private final EntityManager entityManager; private final EntityManager entityManager;
private final UserUtil userUtil; private final UserUtil userUtil;
@@ -110,7 +110,8 @@ public class InferenceResultCoreService {
mapSheetLearnEntity.setDetectOption(req.getDetectOption()); mapSheetLearnEntity.setDetectOption(req.getDetectOption());
mapSheetLearnEntity.setCreatedUid(userUtil.getId()); mapSheetLearnEntity.setCreatedUid(userUtil.getId());
mapSheetLearnEntity.setMapSheetCnt(mapSheetName); mapSheetLearnEntity.setMapSheetCnt(mapSheetName);
mapSheetLearnEntity.setDetectingCnt((long) detectingCnt); // 도엽건수가 아니라 실제 탐지건수(polygon), 추론 1분 배치에서 업데이트
mapSheetLearnEntity.setDetectingCnt(0L);
// 회차는 국유인 반영할때 update로 변경됨 // 회차는 국유인 반영할때 update로 변경됨
// mapSheetLearnEntity.setStage( // mapSheetLearnEntity.setStage(
// mapSheetLearnRepository.getLearnStage(req.getCompareYyyy(), req.getTargetYyyy())); // mapSheetLearnRepository.getLearnStage(req.getCompareYyyy(), req.getTargetYyyy()));
@@ -263,6 +264,14 @@ public class InferenceResultCoreService {
applyModelUpdate(entity, request); applyModelUpdate(entity, request);
} }
List<Long> batchIds = new ArrayList<>();
batchIds.add(entity.getM1ModelBatchId());
batchIds.add(entity.getM2ModelBatchId());
batchIds.add(entity.getM3ModelBatchId());
// testing 추론결과 테이블 조회하여 탐지 개수 업데이트
Long testing = getInferenceResultCnt(batchIds);
// 공통 영역 업데이트 // 공통 영역 업데이트
applyIfNotNull(request.getRunningModelType(), entity::setRunningModelType); applyIfNotNull(request.getRunningModelType(), entity::setRunningModelType);
applyIfNotNull(request.getInferStartDttm(), entity::setInferStartDttm); applyIfNotNull(request.getInferStartDttm(), entity::setInferStartDttm);
@@ -272,6 +281,7 @@ public class InferenceResultCoreService {
applyIfNotNull(request.getDetectEndCnt(), entity::setDetectEndCnt); applyIfNotNull(request.getDetectEndCnt(), entity::setDetectEndCnt);
applyIfNotNull(request.getStatus(), entity::setStatus); applyIfNotNull(request.getStatus(), entity::setStatus);
applyIfNotNull(request.getUpdateUid(), entity::setUpdatedUid); applyIfNotNull(request.getUpdateUid(), entity::setUpdatedUid);
applyIfNotNull(testing, entity::setDetectingCnt);
entity.setUpdatedDttm(ZonedDateTime.now()); entity.setUpdatedDttm(ZonedDateTime.now());
} }
@@ -481,10 +491,14 @@ public class InferenceResultCoreService {
*/ */
public List<InferenceResultsTestingDto.ShpDto> getInferenceResults(List<Long> batchIds) { public List<InferenceResultsTestingDto.ShpDto> getInferenceResults(List<Long> batchIds) {
List<InferenceResultsTestingEntity> list = List<InferenceResultsTestingEntity> list =
inferenceResultsTetingRepository.getInferenceResultList(batchIds); inferenceResultsTestingRepository.getInferenceResultList(batchIds);
return list.stream().map(InferenceResultsTestingDto.ShpDto::fromEntity).toList(); return list.stream().map(InferenceResultsTestingDto.ShpDto::fromEntity).toList();
} }
public Long getInferenceResultCnt(List<Long> batchIds) {
return inferenceResultsTestingRepository.getInferenceResultCnt(batchIds);
}
/** /**
* uid 조회 * uid 조회
* *

View File

@@ -6,4 +6,6 @@ import java.util.List;
public interface InferenceResultsTestingRepositoryCustom { public interface InferenceResultsTestingRepositoryCustom {
List<InferenceResultsTestingEntity> getInferenceResultList(List<Long> batchIds); List<InferenceResultsTestingEntity> getInferenceResultList(List<Long> batchIds);
Long getInferenceResultCnt(List<Long> batchIds);
} }

View File

@@ -20,7 +20,31 @@ public class InferenceResultsTestingRepositoryImpl
return queryFactory return queryFactory
.select(inferenceResultsTestingEntity) .select(inferenceResultsTestingEntity)
.from(inferenceResultsTestingEntity) .from(inferenceResultsTestingEntity)
.where(inferenceResultsTestingEntity.batchId.in(batchIds)) .where(
inferenceResultsTestingEntity
.batchId
.in(batchIds)
.and(inferenceResultsTestingEntity.afterC.isNotNull())
.and(inferenceResultsTestingEntity.afterP.isNotNull()))
.fetch(); .fetch();
} }
@Override
public Long getInferenceResultCnt(List<Long> batchIds) {
if (batchIds == null || batchIds.isEmpty()) {
return 0L;
}
Long cnt =
queryFactory
.select(inferenceResultsTestingEntity.count())
.from(inferenceResultsTestingEntity)
.where(
inferenceResultsTestingEntity.batchId.in(batchIds),
inferenceResultsTestingEntity.afterC.isNotNull(),
inferenceResultsTestingEntity.afterP.isNotNull())
.fetchOne();
return cnt == null ? 0L : cnt;
}
} }