shp 파일 생성 추가
This commit is contained in:
@@ -35,9 +35,7 @@ public class InferenceResultShpDto {
|
|||||||
private Geometry geometry;
|
private Geometry geometry;
|
||||||
private Float area;
|
private Float area;
|
||||||
|
|
||||||
/**
|
/** Entity → DTO 변환 */
|
||||||
* Entity → DTO 변환
|
|
||||||
*/
|
|
||||||
public static Basic from(MapSheetAnalDataInferenceGeomEntity e) {
|
public static Basic from(MapSheetAnalDataInferenceGeomEntity e) {
|
||||||
Basic d = new Basic();
|
Basic d = new Basic();
|
||||||
|
|
||||||
|
|||||||
@@ -17,16 +17,15 @@ public class InferenceResultShpService {
|
|||||||
private final InferenceResultShpCoreService coreService;
|
private final InferenceResultShpCoreService coreService;
|
||||||
private final ShpWriter shpWriter;
|
private final ShpWriter shpWriter;
|
||||||
|
|
||||||
/**
|
/** inference_results -> tb_map_sheet_anal_data_inference / geom 업서트 */
|
||||||
* inference_results -> tb_map_sheet_anal_data_inference / geom 업서트
|
|
||||||
*/
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void saveInferenceResultData() {
|
public void saveInferenceResultData() {
|
||||||
coreService.buildInferenceData();
|
coreService.buildInferenceData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dataUid 단위로 재생성(덮어쓰기) - reset(inference false + geom 전부 false) - geom 엔티티 조회 -> dto 변환 - shp/geojson 생성 - 성공 geo_uid만 true - inference true
|
* dataUid 단위로 재생성(덮어쓰기) - reset(inference false + geom 전부 false) - geom 엔티티 조회 -> dto 변환 -
|
||||||
|
* shp/geojson 생성 - 성공 geo_uid만 true - inference true
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public void createShpFile() {
|
public void createShpFile() {
|
||||||
@@ -75,7 +74,8 @@ public class InferenceResultShpService {
|
|||||||
shpWriter.writeGeoJson(geoJsonPath, dtoList);
|
shpWriter.writeGeoJson(geoJsonPath, dtoList);
|
||||||
|
|
||||||
// 6) 성공 마킹: geo_uid만 true
|
// 6) 성공 마킹: geo_uid만 true
|
||||||
List<Long> geoUids = entities.stream().map(MapSheetAnalDataInferenceGeomEntity::getGeoUid).toList();
|
List<Long> geoUids =
|
||||||
|
entities.stream().map(MapSheetAnalDataInferenceGeomEntity::getGeoUid).toList();
|
||||||
coreService.markSuccess(dataUid, geoUids);
|
coreService.markSuccess(dataUid, geoUids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,25 +13,22 @@ public class InferenceResultShpCoreService {
|
|||||||
|
|
||||||
private final InferenceResultRepository repo;
|
private final InferenceResultRepository repo;
|
||||||
|
|
||||||
/**
|
/** inference_results -> (inference, geom) upsert */
|
||||||
* inference_results -> (inference, geom) upsert
|
|
||||||
*/
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void buildInferenceData() {
|
public void buildInferenceData() {
|
||||||
repo.upsertGroupsFromInferenceResults();
|
repo.upsertGroupsFromInferenceResults();
|
||||||
repo.upsertGeomsFromInferenceResults();
|
repo.upsertGeomsFromInferenceResults();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** file_created_yn = false/null 인 data_uid 목록 */
|
||||||
* file_created_yn = false/null 인 data_uid 목록
|
|
||||||
*/
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public List<Long> findPendingDataUids(int limit) {
|
public List<Long> findPendingDataUids(int limit) {
|
||||||
return repo.findPendingDataUids(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
|
@Transactional
|
||||||
public void resetForRegenerate(Long dataUid) {
|
public void resetForRegenerate(Long dataUid) {
|
||||||
@@ -39,17 +36,13 @@ public class InferenceResultShpCoreService {
|
|||||||
repo.resetGeomCreatedByDataUid(dataUid);
|
repo.resetGeomCreatedByDataUid(dataUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** 생성 대상 geom 엔티티 로드 (file_created_yn=false/null + geom not null) */
|
||||||
* 생성 대상 geom 엔티티 로드 (file_created_yn=false/null + geom not null)
|
|
||||||
*/
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public List<MapSheetAnalDataInferenceGeomEntity> loadGeomEntities(Long dataUid, int limit) {
|
public List<MapSheetAnalDataInferenceGeomEntity> loadGeomEntities(Long dataUid, int limit) {
|
||||||
return repo.findGeomEntitiesByDataUid(dataUid, 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
|
@Transactional
|
||||||
public void markSuccess(Long dataUid, List<Long> geoUids) {
|
public void markSuccess(Long dataUid, List<Long> geoUids) {
|
||||||
repo.markGeomCreatedByGeoUids(geoUids);
|
repo.markGeomCreatedByGeoUids(geoUids);
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
|||||||
|
|
||||||
private final JPAQueryFactory queryFactory;
|
private final JPAQueryFactory queryFactory;
|
||||||
|
|
||||||
@PersistenceContext
|
@PersistenceContext private final EntityManager em;
|
||||||
private final EntityManager em;
|
|
||||||
|
|
||||||
private final QMapSheetAnalDataInferenceEntity i =
|
private final QMapSheetAnalDataInferenceEntity i =
|
||||||
QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
QMapSheetAnalDataInferenceEntity.mapSheetAnalDataInferenceEntity;
|
||||||
@@ -33,7 +32,8 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
|||||||
@Override
|
@Override
|
||||||
public int upsertGroupsFromInferenceResults() {
|
public int upsertGroupsFromInferenceResults() {
|
||||||
|
|
||||||
String sql = """
|
String sql =
|
||||||
|
"""
|
||||||
INSERT INTO tb_map_sheet_anal_data_inference (
|
INSERT INTO tb_map_sheet_anal_data_inference (
|
||||||
stage,
|
stage,
|
||||||
compare_yyyy,
|
compare_yyyy,
|
||||||
@@ -68,7 +68,8 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
|||||||
public int upsertGeomsFromInferenceResults() {
|
public int upsertGeomsFromInferenceResults() {
|
||||||
|
|
||||||
// class_after_prob 컬럼 매핑 오타 주의(여기 제대로 넣음)
|
// class_after_prob 컬럼 매핑 오타 주의(여기 제대로 넣음)
|
||||||
String sql = """
|
String sql =
|
||||||
|
"""
|
||||||
INSERT INTO tb_map_sheet_anal_data_inference_geom (
|
INSERT INTO tb_map_sheet_anal_data_inference_geom (
|
||||||
uuid, stage, cd_prob, compare_yyyy, target_yyyy, map_sheet_num,
|
uuid, stage, cd_prob, compare_yyyy, target_yyyy, map_sheet_num,
|
||||||
class_before_cd, class_before_prob, class_after_cd, class_after_prob,
|
class_before_cd, class_before_prob, class_after_cd, class_after_prob,
|
||||||
@@ -214,7 +215,8 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
|
|||||||
// ===============================
|
// ===============================
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MapSheetAnalDataInferenceGeomEntity> findGeomEntitiesByDataUid(Long dataUid, int limit) {
|
public List<MapSheetAnalDataInferenceGeomEntity> findGeomEntitiesByDataUid(
|
||||||
|
Long dataUid, int limit) {
|
||||||
return queryFactory
|
return queryFactory
|
||||||
.selectFrom(g)
|
.selectFrom(g)
|
||||||
.where(
|
.where(
|
||||||
|
|||||||
Reference in New Issue
Block a user