[KC-103] 결과 테이블 적용
This commit is contained in:
@@ -414,8 +414,4 @@ public class InferenceResultCoreService {
|
||||
public Page<Geom> getInferenceGeomList(String uuid, SearchGeoReq searchGeoReq) {
|
||||
return mapSheetLearnRepository.getInferenceGeomList(uuid, searchGeoReq);
|
||||
}
|
||||
|
||||
public void upsertGeomsFromInferenceResults(Long id) {
|
||||
int inferenceGeomCnt = inferenceResultRepository.upsertGeomsFromInferenceResults();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,14 @@ public class InferenceResultShpCoreService {
|
||||
* tb_map_sheet_anal_data_inference_geom 테이블을 최신 상태로 구성한다.
|
||||
*/
|
||||
@Transactional
|
||||
public InferenceResultShpDto.InferenceCntDto buildInferenceData() {
|
||||
int sheetAnalDataCnt = repo.upsertGroupsFromMapSheetAnal();
|
||||
int inferenceCnt = repo.upsertGroupsFromInferenceResults();
|
||||
int inferenceGeomCnt = repo.upsertGeomsFromInferenceResults();
|
||||
public InferenceResultShpDto.InferenceCntDto buildInferenceData(Long id) {
|
||||
// int sheetAnalDataCnt = repo.upsertGroupsFromMapSheetAnal();
|
||||
// int inferenceCnt = repo.upsertGroupsFromInferenceResults();
|
||||
int inferenceGeomCnt = repo.upsertGeomsFromInferenceResults(id);
|
||||
|
||||
InferenceResultShpDto.InferenceCntDto cntDto = new InferenceResultShpDto.InferenceCntDto();
|
||||
cntDto.setSheetAnalDataCnt(sheetAnalDataCnt);
|
||||
cntDto.setInferenceCnt(inferenceCnt);
|
||||
// cntDto.setSheetAnalDataCnt(sheetAnalDataCnt);
|
||||
// cntDto.setInferenceCnt(inferenceCnt);
|
||||
cntDto.setInferenceGeomCnt(inferenceGeomCnt);
|
||||
|
||||
return cntDto;
|
||||
|
||||
@@ -9,7 +9,7 @@ public interface InferenceResultRepositoryCustom {
|
||||
|
||||
int upsertGroupsFromInferenceResults();
|
||||
|
||||
int upsertGeomsFromInferenceResults();
|
||||
int upsertGeomsFromInferenceResults(Long id);
|
||||
|
||||
List<Long> findPendingDataUids(int limit);
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
* @return 반영된 행 수
|
||||
*/
|
||||
@Override
|
||||
public int upsertGeomsFromInferenceResults() {
|
||||
public int upsertGeomsFromInferenceResults(Long id) {
|
||||
|
||||
String sql =
|
||||
"""
|
||||
@@ -145,9 +145,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
geom_center,
|
||||
area,
|
||||
data_uid,
|
||||
file_created_yn,
|
||||
created_dttm,
|
||||
updated_dttm
|
||||
created_dttm
|
||||
)
|
||||
SELECT
|
||||
x.uuid,
|
||||
@@ -164,38 +162,40 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
ST_Centroid(x.geom),
|
||||
x.area,
|
||||
x.data_uid,
|
||||
false,
|
||||
x.created_dttm,
|
||||
x.updated_dttm
|
||||
x.created_dttm
|
||||
FROM (
|
||||
SELECT DISTINCT ON (r.uuid)
|
||||
r.uuid,
|
||||
r.stage,
|
||||
r.cd_prob,
|
||||
r.input1 AS compare_yyyy,
|
||||
r.input2 AS target_yyyy,
|
||||
r.map_id AS map_sheet_num,
|
||||
r.before_class AS class_before_cd,
|
||||
r.before_probability AS class_before_prob,
|
||||
r.after_class AS class_after_cd,
|
||||
r.after_probability AS class_after_prob,
|
||||
CASE
|
||||
WHEN r.geometry IS NULL THEN NULL
|
||||
WHEN LEFT(r.geometry, 2) = '01'
|
||||
THEN ST_SetSRID(ST_GeomFromWKB(decode(r.geometry, 'hex')), 5186)
|
||||
ELSE ST_GeomFromText(r.geometry, 5186)
|
||||
END AS geom,
|
||||
r.area,
|
||||
di.data_uid,
|
||||
r.created_dttm,
|
||||
r.updated_dttm
|
||||
FROM inference_results r
|
||||
JOIN tb_map_sheet_anal_data_inference di
|
||||
ON di.stage = r.stage
|
||||
AND di.compare_yyyy = r.input1
|
||||
AND di.target_yyyy = r.input2
|
||||
AND di.map_sheet_num = r.map_id
|
||||
ORDER BY r.uuid, r.updated_dttm DESC NULLS LAST, r.uid DESC
|
||||
SELECT DISTINCT ON (r.uid)
|
||||
r.uid AS uuid,
|
||||
di.stage AS stage,
|
||||
r.cd_prob,
|
||||
r.input1 AS compare_yyyy,
|
||||
r.input2 AS target_yyyy,
|
||||
CASE
|
||||
WHEN r.map_id ~ '^[0-9]+$' THEN r.map_id::bigint
|
||||
ELSE NULL
|
||||
END AS map_sheet_num,
|
||||
r.before_c AS class_before_cd,
|
||||
r.before_p AS class_before_prob,
|
||||
r.after_c AS class_after_cd,
|
||||
r.after_p AS class_after_prob,
|
||||
CASE
|
||||
WHEN r.geometry IS NULL THEN NULL
|
||||
WHEN LEFT(r.geometry, 2) = '01'
|
||||
THEN ST_SetSRID(ST_GeomFromWKB(decode(r.geometry, 'hex')), 5186)
|
||||
ELSE ST_SetSRID(ST_GeomFromText(r.geometry), 5186)
|
||||
END AS geom,
|
||||
r.area,
|
||||
di.id AS data_uid,
|
||||
r.created_date AS created_dttm
|
||||
FROM inference_results_testing r
|
||||
JOIN tb_map_sheet_learn di
|
||||
ON r.batch_id IN (
|
||||
di.m1_model_batch_id,
|
||||
di.m2_model_batch_id,
|
||||
di.m3_model_batch_id
|
||||
)
|
||||
where di.id = :id
|
||||
ORDER BY r.uid, r.created_date DESC NULLS LAST
|
||||
) x
|
||||
ON CONFLICT (uuid)
|
||||
DO UPDATE SET
|
||||
@@ -214,7 +214,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
updated_dttm = now()
|
||||
""";
|
||||
|
||||
return em.createNativeQuery(sql).executeUpdate();
|
||||
return em.createNativeQuery(sql).setParameter("id", id).executeUpdate();
|
||||
}
|
||||
|
||||
// ===============================
|
||||
|
||||
Reference in New Issue
Block a user