Merge pull request '추론결과 저장 result 조회 조건 변경' (#133) from feat/infer_dev_260211 into develop
Reviewed-on: #133
This commit was merged in pull request #133.
This commit is contained in:
@@ -18,6 +18,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -240,6 +241,7 @@ public class InferenceResultDto {
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
public static class RegReq {
|
||||
|
||||
@Schema(description = "제목", example = "2023-2024 변화탐지 테스트")
|
||||
|
||||
@@ -128,6 +128,7 @@ public class InferenceResultService {
|
||||
*/
|
||||
@Transactional
|
||||
public UUID run(InferenceResultDto.RegReq req) {
|
||||
log.info("inference start request = {}", req);
|
||||
if (req.getDetectOption().equals(DetectOption.EXCL.getId())) {
|
||||
// 추론 제외 일때 EXCL
|
||||
return runExcl(req);
|
||||
|
||||
@@ -502,9 +502,13 @@ public class InferenceResultCoreService {
|
||||
*/
|
||||
@Transactional
|
||||
public void upsertGeomData(Long id) {
|
||||
// 추론 결과 목록 저장
|
||||
Long analId = inferenceResultRepository.upsertGroupsFromMapSheetAnal(id);
|
||||
// 추론 결과 상세 저장
|
||||
inferenceResultRepository.upsertGroupsFromInferenceResults(analId);
|
||||
// geom 목록 추론 결과 저장
|
||||
inferenceResultRepository.upsertGeomsFromInferenceResults(analId);
|
||||
// 집계 추론 결과 저장
|
||||
inferenceResultRepository.upsertSttcFromInferenceResults(analId);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,44 @@ import java.util.UUID;
|
||||
|
||||
public interface InferenceResultRepositoryCustom {
|
||||
|
||||
/**
|
||||
* tb_map_sheet_anal_inference 추론 결과 목록 저장
|
||||
*
|
||||
* @param id learn 테이블 id
|
||||
* @return
|
||||
*/
|
||||
Long upsertGroupsFromMapSheetAnal(Long id);
|
||||
|
||||
/**
|
||||
* tb_map_sheet_anal_data_inference 추론 결과 상세 저장
|
||||
*
|
||||
* @param analId
|
||||
* @return
|
||||
*/
|
||||
int upsertGroupsFromInferenceResults(Long analId);
|
||||
|
||||
/**
|
||||
* tb_map_sheet_anal_data_inference_geom geom 목록 추론 결과 저장
|
||||
*
|
||||
* @param analId
|
||||
* @return
|
||||
*/
|
||||
int upsertGeomsFromInferenceResults(Long analId);
|
||||
|
||||
/**
|
||||
* tb_map_sheet_anal_sttc 집계 추론 결과 저장
|
||||
*
|
||||
* @param analId
|
||||
* @return
|
||||
*/
|
||||
int upsertSttcFromInferenceResults(Long analId);
|
||||
|
||||
/**
|
||||
* 추론실행 목록 uuid 조회
|
||||
*
|
||||
* @param uuid 추론 uuid
|
||||
* @return 추론 실행 정보
|
||||
*/
|
||||
Long getInferenceLearnIdByUuid(UUID uuid);
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
|
||||
@Override
|
||||
public Long upsertGroupsFromMapSheetAnal(Long id) {
|
||||
// id = learn 테이블 id
|
||||
String sql =
|
||||
"""
|
||||
INSERT INTO tb_map_sheet_anal_inference (
|
||||
@@ -53,12 +54,12 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
:pendingStateId
|
||||
FROM tb_map_sheet_learn r
|
||||
WHERE r.id = :id
|
||||
ON CONFLICT (stage, compare_yyyy, target_yyyy)
|
||||
ON CONFLICT (learn_id, compare_yyyy, target_yyyy)
|
||||
DO UPDATE SET
|
||||
detecting_cnt = EXCLUDED.detecting_cnt,
|
||||
anal_title = EXCLUDED.anal_title,
|
||||
updated_dttm = now(),
|
||||
learn_id = EXCLUDED.learn_id
|
||||
stage = EXCLUDED.stage,
|
||||
updated_dttm = now()
|
||||
RETURNING anal_uid
|
||||
""";
|
||||
|
||||
@@ -117,7 +118,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
msl.target_yyyy,
|
||||
r.map_id,
|
||||
msl.stage
|
||||
ON CONFLICT (stage, compare_yyyy, target_yyyy, map_sheet_num)
|
||||
ON CONFLICT (anal_uid, compare_yyyy, target_yyyy, map_sheet_num)
|
||||
DO UPDATE SET
|
||||
anal_uid = EXCLUDED.anal_uid,
|
||||
ref_map_sheet_num = EXCLUDED.ref_map_sheet_num,
|
||||
@@ -212,6 +213,9 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
AND r.map_id ~ '^[0-9]+$'
|
||||
AND r.map_id::bigint = msadi.map_sheet_num
|
||||
WHERE msl.anal_uid = :analUid
|
||||
AND r.probability is not null
|
||||
AND r.before_c is not null
|
||||
AND r.before_p is not null
|
||||
AND r.after_c is not null
|
||||
AND r.after_p is not null
|
||||
ORDER BY r.uid, r.created_date DESC NULLS LAST
|
||||
|
||||
Reference in New Issue
Block a user