Merge pull request '[KC-103] 추론 실패 도엽별저장' (#247) from feat/infer_dev_260107 into develop

Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/247
This commit is contained in:
2026-01-15 19:54:48 +09:00
8 changed files with 101 additions and 2 deletions

View File

@@ -295,6 +295,7 @@ public class InferenceDetailDto {
public static class Geom { public static class Geom {
UUID uuid; UUID uuid;
String uid;
Integer compareYyyy; Integer compareYyyy;
Integer targetYyyy; Integer targetYyyy;
Double cdProb; Double cdProb;
@@ -313,6 +314,7 @@ public class InferenceDetailDto {
public Geom( public Geom(
UUID uuid, UUID uuid,
String uid,
Integer compareYyyy, Integer compareYyyy,
Integer targetYyyy, Integer targetYyyy,
Double cdProb, Double cdProb,
@@ -325,6 +327,7 @@ public class InferenceDetailDto {
String gemoStr, String gemoStr,
String geomCenterStr) { String geomCenterStr) {
this.uuid = uuid; this.uuid = uuid;
this.uid = uid;
this.compareYyyy = compareYyyy; this.compareYyyy = compareYyyy;
this.targetYyyy = targetYyyy; this.targetYyyy = targetYyyy;
this.cdProb = cdProb; this.cdProb = cdProb;

View File

@@ -426,4 +426,15 @@ public class InferenceResultCoreService {
inferenceResultRepository.upsertGeomsFromInferenceResults(analId); inferenceResultRepository.upsertGeomsFromInferenceResults(analId);
inferenceResultRepository.upsertSttcFromInferenceResults(analId); inferenceResultRepository.upsertSttcFromInferenceResults(analId);
} }
/**
* 모델별 도엽별 실패여부 저장
*
* @param uuid learn 테이블 uuid
* @param failMapIds 실패한 도엽 목록
* @param type 모델타입
*/
public void saveFail5k(UUID uuid, List<Long> failMapIds, String type) {
mapSheetLearn5kRepository.saveFail5k(uuid, failMapIds, type);
}
} }

View File

@@ -156,6 +156,9 @@ public class MapSheetAnalDataInferenceGeomEntity {
@Column(name = "pass_yn_dttm") @Column(name = "pass_yn_dttm")
private ZonedDateTime passYnDttm; private ZonedDateTime passYnDttm;
@Column(name = "result_uid")
private String resultUid;
@ManyToOne(fetch = FetchType.EAGER) @ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "map_5k_id", referencedColumnName = "fid") @JoinColumn(name = "map_5k_id", referencedColumnName = "fid")
private MapInkx5kEntity map5k; private MapInkx5kEntity map5k;

View File

@@ -54,4 +54,13 @@ public class MapSheetLearn5kEntity {
@Column(name = "is_success") @Column(name = "is_success")
private Boolean isSuccess = false; private Boolean isSuccess = false;
@Column(name = "is_m1_fail")
private Boolean isM1Fail = false;
@Column(name = "is_m2_fail")
private Boolean isM2Fail = false;
@Column(name = "is_m3_fail")
private Boolean isM3Fail = false;
} }

View File

@@ -1,3 +1,9 @@
package com.kamco.cd.kamcoback.postgres.repository.Inference; package com.kamco.cd.kamcoback.postgres.repository.Inference;
public interface MapSheetLearn5kRepositoryCustom {} import java.util.List;
import java.util.UUID;
public interface MapSheetLearn5kRepositoryCustom {
void saveFail5k(UUID uuid, List<Long> failMapIds, String type);
}

View File

@@ -1,6 +1,62 @@
package com.kamco.cd.kamcoback.postgres.repository.Inference; package com.kamco.cd.kamcoback.postgres.repository.Inference;
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearn5kEntity.mapSheetLearn5kEntity;
import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapSheetLearnEntity;
import com.querydsl.core.types.dsl.BooleanPath;
import com.querydsl.jpa.impl.JPAQueryFactory;
import java.util.List;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryCustom {} @RequiredArgsConstructor
public class MapSheetLearn5kRepositoryImpl implements MapSheetLearn5kRepositoryCustom {
private final JPAQueryFactory queryFactory;
@Override
public void saveFail5k(UUID uuid, List<Long> failMapIds, String type) {
if (failMapIds == null || failMapIds.isEmpty()) {
return;
}
Long id =
queryFactory
.select(mapSheetLearnEntity.id)
.from(mapSheetLearnEntity)
.where(mapSheetLearnEntity.uuid.eq(uuid))
.fetchOne();
if (id == null) {
return;
}
BooleanPath target;
switch (type) {
case "M1":
target = mapSheetLearn5kEntity.isM1Fail;
break;
case "M2":
target = mapSheetLearn5kEntity.isM2Fail;
break;
case "M3":
target = mapSheetLearn5kEntity.isM3Fail;
break;
default:
return;
}
queryFactory
.update(mapSheetLearn5kEntity)
.set(target, true)
.where(
mapSheetLearn5kEntity
.learn
.id
.eq(id)
.and(mapSheetLearn5kEntity.mapSheetNum.in(failMapIds)))
.execute();
}
}

View File

@@ -403,6 +403,7 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
Projections.constructor( Projections.constructor(
Geom.class, Geom.class,
mapSheetAnalDataInferenceGeomEntity.uuid, mapSheetAnalDataInferenceGeomEntity.uuid,
mapSheetAnalDataInferenceGeomEntity.resultUid,
mapSheetAnalDataInferenceGeomEntity.compareYyyy, mapSheetAnalDataInferenceGeomEntity.compareYyyy,
mapSheetAnalDataInferenceGeomEntity.targetYyyy, mapSheetAnalDataInferenceGeomEntity.targetYyyy,
mapSheetAnalDataInferenceGeomEntity.cdProb, mapSheetAnalDataInferenceGeomEntity.cdProb,

View File

@@ -18,6 +18,7 @@ import jakarta.transaction.Transactional;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.UUID; import java.util.UUID;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
@@ -212,6 +213,8 @@ public class MapSheetInferenceJobService {
// 추론 종료일때 geom 데이터 저장 // 추론 종료일때 geom 데이터 저장
inferenceResultCoreService.upsertGeomData(sheet.getId()); inferenceResultCoreService.upsertGeomData(sheet.getId());
// 추론 종료일때 도엽별 실패여부 저장
// TODO jar로 생성하는걸로 변경 // TODO jar로 생성하는걸로 변경
// 추론 종료일때 shp 파일 생성 // 추론 종료일때 shp 파일 생성
// inferenceResultShpService.createShpFile(sheet.getId()); // inferenceResultShpService.createShpFile(sheet.getId());
@@ -426,6 +429,13 @@ public class MapSheetInferenceJobService {
saveInferenceAiDto.setCompletedJobs(dto.getCompletedJobs()); saveInferenceAiDto.setCompletedJobs(dto.getCompletedJobs());
saveInferenceAiDto.setFailedJobs(dto.getFailedJobs()); saveInferenceAiDto.setFailedJobs(dto.getFailedJobs());
inferenceResultCoreService.update(saveInferenceAiDto); inferenceResultCoreService.update(saveInferenceAiDto);
List<Long> failedIds =
Optional.ofNullable(dto.getFailedIds()).orElse(List.of()).stream()
.map(Long::valueOf)
.toList();
inferenceResultCoreService.saveFail5k(uuid, failedIds, type);
} }
/** /**