diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java b/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java index b61086d9..f9f0096b 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java @@ -22,7 +22,6 @@ import org.slf4j.LoggerFactory; import org.springframework.data.domain.Page; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -146,21 +145,22 @@ public class InferenceResultApiController { return ApiResponseDto.ok(geomList); } - @Operation(summary = "학습모델 결과 처리", description = "실제 학습모델 GeoJSON 파일을 처리하여 데이터베이스에 저장합니다.") - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "처리 성공", - content = - @Content( - mediaType = "application/json", - schema = - @Schema(implementation = LearningModelResultDto.ProcessResponse.class))), - @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) - @PostMapping("/learning-model/process") + // @Operation(summary = "학습모델 결과 처리", description = "실제 학습모델 GeoJSON 파일을 처리하여 데이터베이스에 저장합니다.") + // @ApiResponses( + // value = { + // @ApiResponse( + // responseCode = "200", + // description = "처리 성공", + // content = + // @Content( + // mediaType = "application/json", + // schema = + // @Schema(implementation = + // LearningModelResultDto.ProcessResponse.class))), + // @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), + // @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + // }) + // @PostMapping("/learning-model/process") public ApiResponseDto processLearningModelResult( @RequestBody LearningModelResultDto.ProcessRequest request) { try { @@ -198,22 +198,24 @@ public class InferenceResultApiController { } } - @Operation(summary = "학습모델 결과 일괄 처리", description = "여러 학습모델 GeoJSON 파일을 일괄 처리하여 데이터베이스에 저장합니다.") - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "처리 성공", - content = - @Content( - mediaType = "application/json", - schema = - @Schema( - implementation = LearningModelResultDto.BatchProcessResponse.class))), - @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) - @PostMapping("/learning-model/process-batch") + // @Operation(summary = "학습모델 결과 일괄 처리", description = "여러 학습모델 GeoJSON 파일을 일괄 처리하여 데이터베이스에 + // 저장합니다.") + // @ApiResponses( + // value = { + // @ApiResponse( + // responseCode = "200", + // description = "처리 성공", + // content = + // @Content( + // mediaType = "application/json", + // schema = + // @Schema( + // implementation = + // LearningModelResultDto.BatchProcessResponse.class))), + // @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), + // @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + // }) + // @PostMapping("/learning-model/process-batch") public ApiResponseDto processBatchLearningModelResults( @RequestBody LearningModelResultDto.BatchProcessRequest request) { @@ -259,21 +261,22 @@ public class InferenceResultApiController { } } - @Operation(summary = "기본 학습모델 파일 처리", description = "미리 준비된 학습모델 파일을 처리합니다.") - @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "처리 성공", - content = - @Content( - mediaType = "application/json", - schema = - @Schema( - implementation = LearningModelResultDto.BatchProcessResponse.class))), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) - @PostMapping("/learning-model/process-default") + // @Operation(summary = "기본 학습모델 파일 처리", description = "미리 준비된 학습모델 파일을 처리합니다.") + // @ApiResponses( + // value = { + // @ApiResponse( + // responseCode = "200", + // description = "처리 성공", + // content = + // @Content( + // mediaType = "application/json", + // schema = + // @Schema( + // implementation = + // LearningModelResultDto.BatchProcessResponse.class))), + // @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + // }) + // @PostMapping("/learning-model/process-default") public ApiResponseDto processDefaultLearningModelResults() { try { diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryImpl.java index a7e48881..e66e64c9 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/changedetection/ChangeDetectionRepositoryImpl.java @@ -171,6 +171,9 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport ChangeDetectionDto.PolygonFeatureList polygonList = new ChangeDetectionDto.PolygonFeatureList(); polygonList.setType("FeatureCollection"); polygonList.setFeatures(result); + + list.clear(); // List 사용 참조 해제 + return polygonList; } @@ -194,25 +197,30 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport .fetch(); GeoJsonReader reader = new GeoJsonReader(); - return list.stream() - .map( - tuple -> { - String geojson = tuple.get(0, String.class); - Geometry geom; - try { - geom = reader.read(geojson); - } catch (Exception ex) { - throw new RuntimeException("GeoJSON -> Geometry 변환 실패", ex); - } + List result = + list.stream() + .map( + tuple -> { + String geojson = tuple.get(0, String.class); + Geometry geom; + try { + geom = reader.read(geojson); + } catch (Exception ex) { + throw new RuntimeException("GeoJSON -> Geometry 변환 실패", ex); + } - Long geoUid = tuple.get(mapSheetAnalDataGeomEntity.id).longValue(); - String classCd = - tuple.get(mapSheetAnalDataGeomEntity.classAfterCd.toUpperCase()).toString(); + Long geoUid = tuple.get(mapSheetAnalDataGeomEntity.id).longValue(); + String classCd = + tuple.get(mapSheetAnalDataGeomEntity.classAfterCd.toUpperCase()).toString(); - return new ChangeDetectionDto.PointFeature( - "Feature", geom, new ChangeDetectionDto.PointProperties(geoUid, classCd)); - }) - .collect(Collectors.toList()); + return new ChangeDetectionDto.PointFeature( + "Feature", geom, new ChangeDetectionDto.PointProperties(geoUid, classCd)); + }) + .collect(Collectors.toList()); + + list.clear(); // List 사용 참조 해제 + + return result; } @Override