shp 파일 생성 추가
This commit is contained in:
@@ -13,25 +13,22 @@ public class InferenceResultShpCoreService {
|
||||
|
||||
private final InferenceResultRepository repo;
|
||||
|
||||
/**
|
||||
* inference_results -> (inference, geom) upsert
|
||||
*/
|
||||
/** inference_results -> (inference, geom) upsert */
|
||||
@Transactional
|
||||
public void buildInferenceData() {
|
||||
repo.upsertGroupsFromInferenceResults();
|
||||
repo.upsertGeomsFromInferenceResults();
|
||||
}
|
||||
|
||||
/**
|
||||
* file_created_yn = false/null 인 data_uid 목록
|
||||
*/
|
||||
/** file_created_yn = false/null 인 data_uid 목록 */
|
||||
@Transactional(readOnly = true)
|
||||
public List<Long> findPendingDataUids(int limit) {
|
||||
return repo.findPendingDataUids(limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 재생성 시작: 덮어쓰기 기준(무조건 처음부터) - inference.file_created_yn = false, file_created_dttm = null - geom(file_created_yn) 전부 false 리셋
|
||||
* 재생성 시작: 덮어쓰기 기준(무조건 처음부터) - inference.file_created_yn = false, file_created_dttm = null -
|
||||
* geom(file_created_yn) 전부 false 리셋
|
||||
*/
|
||||
@Transactional
|
||||
public void resetForRegenerate(Long dataUid) {
|
||||
@@ -39,17 +36,13 @@ public class InferenceResultShpCoreService {
|
||||
repo.resetGeomCreatedByDataUid(dataUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성 대상 geom 엔티티 로드 (file_created_yn=false/null + geom not null)
|
||||
*/
|
||||
/** 생성 대상 geom 엔티티 로드 (file_created_yn=false/null + geom not null) */
|
||||
@Transactional(readOnly = true)
|
||||
public List<MapSheetAnalDataInferenceGeomEntity> loadGeomEntities(Long dataUid, int limit) {
|
||||
return repo.findGeomEntitiesByDataUid(dataUid, limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 성공 마킹: - 성공 geo_uid만 geom.file_created_yn=true - inference.file_created_yn=true
|
||||
*/
|
||||
/** 성공 마킹: - 성공 geo_uid만 geom.file_created_yn=true - inference.file_created_yn=true */
|
||||
@Transactional
|
||||
public void markSuccess(Long dataUid, List<Long> geoUids) {
|
||||
repo.markGeomCreatedByGeoUids(geoUids);
|
||||
|
||||
@@ -17,14 +17,13 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
|
||||
private final JPAQueryFactory queryFactory;
|
||||
|
||||
@PersistenceContext
|
||||
private final EntityManager em;
|
||||
@PersistenceContext private final EntityManager em;
|
||||
|
||||
private final QMapSheetAnalDataInferenceEntity i =
|
||||
QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
||||
QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
||||
|
||||
private final QMapSheetAnalDataInferenceGeomEntity g =
|
||||
QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||
QMapSheetAnalDataInferenceGeomEntity.mapSheetAnalDataInferenceGeomEntity;
|
||||
|
||||
// ===============================
|
||||
// Upsert (Native only)
|
||||
@@ -33,7 +32,8 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
@Override
|
||||
public int upsertGroupsFromInferenceResults() {
|
||||
|
||||
String sql = """
|
||||
String sql =
|
||||
"""
|
||||
INSERT INTO tb_map_sheet_anal_data_inference (
|
||||
stage,
|
||||
compare_yyyy,
|
||||
@@ -68,7 +68,8 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
public int upsertGeomsFromInferenceResults() {
|
||||
|
||||
// class_after_prob 컬럼 매핑 오타 주의(여기 제대로 넣음)
|
||||
String sql = """
|
||||
String sql =
|
||||
"""
|
||||
INSERT INTO tb_map_sheet_anal_data_inference_geom (
|
||||
uuid, stage, cd_prob, compare_yyyy, target_yyyy, map_sheet_num,
|
||||
class_before_cd, class_before_prob, class_after_cd, class_after_prob,
|
||||
@@ -137,12 +138,12 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
@Override
|
||||
public List<Long> findPendingDataUids(int limit) {
|
||||
return queryFactory
|
||||
.select(i.id) // data_uid
|
||||
.from(i)
|
||||
.where(i.fileCreatedYn.isFalse().or(i.fileCreatedYn.isNull()))
|
||||
.orderBy(i.id.asc())
|
||||
.limit(limit)
|
||||
.fetch();
|
||||
.select(i.id) // data_uid
|
||||
.from(i)
|
||||
.where(i.fileCreatedYn.isFalse().or(i.fileCreatedYn.isNull()))
|
||||
.orderBy(i.id.asc())
|
||||
.limit(limit)
|
||||
.fetch();
|
||||
}
|
||||
|
||||
// ===============================
|
||||
@@ -154,13 +155,13 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
|
||||
return (int)
|
||||
queryFactory
|
||||
.update(i)
|
||||
.set(i.fileCreatedYn, false)
|
||||
.set(i.fileCreatedDttm, (ZonedDateTime) null)
|
||||
.set(i.updatedDttm, now)
|
||||
.where(i.id.eq(dataUid))
|
||||
.execute();
|
||||
queryFactory
|
||||
.update(i)
|
||||
.set(i.fileCreatedYn, false)
|
||||
.set(i.fileCreatedDttm, (ZonedDateTime) null)
|
||||
.set(i.updatedDttm, now)
|
||||
.where(i.id.eq(dataUid))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -168,13 +169,13 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
|
||||
return (int)
|
||||
queryFactory
|
||||
.update(i)
|
||||
.set(i.fileCreatedYn, true)
|
||||
.set(i.fileCreatedDttm, now)
|
||||
.set(i.updatedDttm, now)
|
||||
.where(i.id.eq(dataUid))
|
||||
.execute();
|
||||
queryFactory
|
||||
.update(i)
|
||||
.set(i.fileCreatedYn, true)
|
||||
.set(i.fileCreatedDttm, now)
|
||||
.set(i.updatedDttm, now)
|
||||
.where(i.id.eq(dataUid))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -182,13 +183,13 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
|
||||
return (int)
|
||||
queryFactory
|
||||
.update(g)
|
||||
.set(g.fileCreatedYn, false)
|
||||
.set(g.fileCreatedDttm, (ZonedDateTime) null)
|
||||
.set(g.updatedDttm, now) // ✅ 엔티티/Q가 ZonedDateTime이면 정상
|
||||
.where(g.dataUid.eq(dataUid))
|
||||
.execute();
|
||||
queryFactory
|
||||
.update(g)
|
||||
.set(g.fileCreatedYn, false)
|
||||
.set(g.fileCreatedDttm, (ZonedDateTime) null)
|
||||
.set(g.updatedDttm, now) // ✅ 엔티티/Q가 ZonedDateTime이면 정상
|
||||
.where(g.dataUid.eq(dataUid))
|
||||
.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -200,13 +201,13 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
ZonedDateTime now = ZonedDateTime.now();
|
||||
|
||||
return (int)
|
||||
queryFactory
|
||||
.update(g)
|
||||
.set(g.fileCreatedYn, true)
|
||||
.set(g.fileCreatedDttm, now)
|
||||
.set(g.updatedDttm, now)
|
||||
.where(g.geoUid.in(geoUids))
|
||||
.execute();
|
||||
queryFactory
|
||||
.update(g)
|
||||
.set(g.fileCreatedYn, true)
|
||||
.set(g.fileCreatedDttm, now)
|
||||
.set(g.updatedDttm, now)
|
||||
.where(g.geoUid.in(geoUids))
|
||||
.execute();
|
||||
}
|
||||
|
||||
// ===============================
|
||||
@@ -214,15 +215,16 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
||||
// ===============================
|
||||
|
||||
@Override
|
||||
public List<MapSheetAnalDataInferenceGeomEntity> findGeomEntitiesByDataUid(Long dataUid, int limit) {
|
||||
public List<MapSheetAnalDataInferenceGeomEntity> findGeomEntitiesByDataUid(
|
||||
Long dataUid, int limit) {
|
||||
return queryFactory
|
||||
.selectFrom(g)
|
||||
.where(
|
||||
g.dataUid.eq(dataUid),
|
||||
g.geom.isNotNull(),
|
||||
g.fileCreatedYn.isFalse().or(g.fileCreatedYn.isNull()))
|
||||
.orderBy(g.geoUid.asc())
|
||||
.limit(limit)
|
||||
.fetch();
|
||||
.selectFrom(g)
|
||||
.where(
|
||||
g.dataUid.eq(dataUid),
|
||||
g.geom.isNotNull(),
|
||||
g.fileCreatedYn.isFalse().or(g.fileCreatedYn.isNull()))
|
||||
.orderBy(g.geoUid.asc())
|
||||
.limit(limit)
|
||||
.fetch();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user