Build Error Fix - Daniel C No.8
This commit is contained in:
@@ -61,25 +61,8 @@ public class GeometryConversionService {
|
||||
List<Long> geometryIds = new ArrayList<>();
|
||||
|
||||
try {
|
||||
// 기존 geometry 데이터 확인 - 데이터가 이미 존재하고 유효한 경우 재처리 건너뛰기
|
||||
List<MapSheetLearnDataGeomEntity> existingGeoms =
|
||||
mapSheetLearnDataGeomRepository.findByDataUid(learnData.getId());
|
||||
if (!existingGeoms.isEmpty() && isValidGeometryData(existingGeoms)) {
|
||||
log.debug("유효한 geometry 데이터가 이미 존재합니다. 재처리를 건너뜁니다: {}", learnData.getId());
|
||||
return existingGeoms.stream().map(MapSheetLearnDataGeomEntity::getId).toList();
|
||||
}
|
||||
|
||||
// 유효하지 않은 데이터만 조건부 삭제 (null geometry 또는 잘못된 형식)
|
||||
if (!existingGeoms.isEmpty()) {
|
||||
List<MapSheetLearnDataGeomEntity> invalidGeoms =
|
||||
existingGeoms.stream()
|
||||
.filter(g -> g.getGeom() == null || g.getGeom().isEmpty())
|
||||
.toList();
|
||||
if (!invalidGeoms.isEmpty()) {
|
||||
mapSheetLearnDataGeomRepository.deleteAll(invalidGeoms);
|
||||
log.debug("유효하지 않은 geometry 데이터만 삭제했습니다: {}개", invalidGeoms.size());
|
||||
}
|
||||
}
|
||||
// 기존 geometry 데이터 삭제 (재생성)
|
||||
mapSheetLearnDataGeomRepository.deleteByDataUid(learnData.getId());
|
||||
|
||||
// JSON 데이터에서 GeoJSON 추출
|
||||
Map<String, Object> dataJson = learnData.getDataJson();
|
||||
@@ -451,14 +434,4 @@ public class GeometryConversionService {
|
||||
return processedIds;
|
||||
}
|
||||
|
||||
/** Geometry 데이터의 유효성 검사 */
|
||||
private boolean isValidGeometryData(List<MapSheetLearnDataGeomEntity> geometryEntities) {
|
||||
if (geometryEntities == null || geometryEntities.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 모든 geometry가 null이 아니고 유효한지 확인
|
||||
return geometryEntities.stream()
|
||||
.allMatch(entity -> entity.getGeom() != null && !entity.getGeom().isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,13 +26,8 @@ public interface MapSheetLearnDataGeomRepository
|
||||
/** 지오메트리 타입별 조회 */
|
||||
List<MapSheetLearnDataGeomEntity> findByGeoType(String geoType);
|
||||
|
||||
/** 데이터 UID로 유효하지 않은 지오메트리 데이터만 조건부 삭제 (안전성을 위해 직접 사용 금지) */
|
||||
@Deprecated
|
||||
@Query(
|
||||
"DELETE FROM MapSheetLearnDataGeomEntity g WHERE g.dataUid = :dataUid AND (g.geom IS NULL OR g.geom.isEmpty() = true)")
|
||||
@Modifying
|
||||
@Transactional
|
||||
void deleteInvalidGeometryByDataUid(@Param("dataUid") Long dataUid);
|
||||
/** 데이터 UID로 기존 지오메트리 데이터 삭제 (재생성 전에 사용) */
|
||||
void deleteByDataUid(Long dataUid);
|
||||
|
||||
/** PostGIS 함수를 사용하여 geometry 데이터를 직접 삽입 ST_SetSRID(ST_GeomFromGeoJSON(...), 5186) 형식으로 저장 */
|
||||
@Modifying
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile: prod
|
||||
on-profile: dev
|
||||
|
||||
jpa:
|
||||
show-sql: false
|
||||
|
||||
@@ -22,7 +22,7 @@ spring:
|
||||
leak-detection-threshold: 60000
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: validate # 스키마 검증만 수행, 자동 변경하지 않음 (안전)
|
||||
ddl-auto: update # 스키마 검증만 수행, 자동 변경하지 않음 (안전)
|
||||
properties:
|
||||
hibernate:
|
||||
jdbc:
|
||||
|
||||
Reference in New Issue
Block a user