Merge pull request 'feat/demo-20251205' (#27) from feat/demo-20251205 into develop

Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/27
This commit is contained in:
2025-12-01 14:25:52 +09:00
2 changed files with 75 additions and 64 deletions

View File

@@ -22,7 +22,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; 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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@@ -146,21 +145,22 @@ public class InferenceResultApiController {
return ApiResponseDto.ok(geomList); return ApiResponseDto.ok(geomList);
} }
@Operation(summary = "학습모델 결과 처리", description = "실제 학습모델 GeoJSON 파일을 처리하여 데이터베이스에 저장합니다.") // @Operation(summary = "학습모델 결과 처리", description = "실제 학습모델 GeoJSON 파일을 처리하여 데이터베이스에 저장합니다.")
@ApiResponses( // @ApiResponses(
value = { // value = {
@ApiResponse( // @ApiResponse(
responseCode = "200", // responseCode = "200",
description = "처리 성공", // description = "처리 성공",
content = // content =
@Content( // @Content(
mediaType = "application/json", // mediaType = "application/json",
schema = // schema =
@Schema(implementation = LearningModelResultDto.ProcessResponse.class))), // @Schema(implementation =
@ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), // LearningModelResultDto.ProcessResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) // @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content),
}) // @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
@PostMapping("/learning-model/process") // })
// @PostMapping("/learning-model/process")
public ApiResponseDto<LearningModelResultDto.ProcessResponse> processLearningModelResult( public ApiResponseDto<LearningModelResultDto.ProcessResponse> processLearningModelResult(
@RequestBody LearningModelResultDto.ProcessRequest request) { @RequestBody LearningModelResultDto.ProcessRequest request) {
try { try {
@@ -198,22 +198,24 @@ public class InferenceResultApiController {
} }
} }
@Operation(summary = "학습모델 결과 일괄 처리", description = "여러 학습모델 GeoJSON 파일을 일괄 처리하여 데이터베이스에 저장합니다.") // @Operation(summary = "학습모델 결과 일괄 처리", description = "여러 학습모델 GeoJSON 파일을 일괄 처리하여 데이터베이스에
@ApiResponses( // 저장합니다.")
value = { // @ApiResponses(
@ApiResponse( // value = {
responseCode = "200", // @ApiResponse(
description = "처리 성공", // responseCode = "200",
content = // description = "처리 성공",
@Content( // content =
mediaType = "application/json", // @Content(
schema = // mediaType = "application/json",
@Schema( // schema =
implementation = LearningModelResultDto.BatchProcessResponse.class))), // @Schema(
@ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content), // implementation =
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) // LearningModelResultDto.BatchProcessResponse.class))),
}) // @ApiResponse(responseCode = "400", description = "잘못된 요청", content = @Content),
@PostMapping("/learning-model/process-batch") // @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
// })
// @PostMapping("/learning-model/process-batch")
public ApiResponseDto<LearningModelResultDto.BatchProcessResponse> public ApiResponseDto<LearningModelResultDto.BatchProcessResponse>
processBatchLearningModelResults( processBatchLearningModelResults(
@RequestBody LearningModelResultDto.BatchProcessRequest request) { @RequestBody LearningModelResultDto.BatchProcessRequest request) {
@@ -259,21 +261,22 @@ public class InferenceResultApiController {
} }
} }
@Operation(summary = "기본 학습모델 파일 처리", description = "미리 준비된 학습모델 파일을 처리합니다.") // @Operation(summary = "기본 학습모델 파일 처리", description = "미리 준비된 학습모델 파일을 처리합니다.")
@ApiResponses( // @ApiResponses(
value = { // value = {
@ApiResponse( // @ApiResponse(
responseCode = "200", // responseCode = "200",
description = "처리 성공", // description = "처리 성공",
content = // content =
@Content( // @Content(
mediaType = "application/json", // mediaType = "application/json",
schema = // schema =
@Schema( // @Schema(
implementation = LearningModelResultDto.BatchProcessResponse.class))), // implementation =
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) // LearningModelResultDto.BatchProcessResponse.class))),
}) // @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
@PostMapping("/learning-model/process-default") // })
// @PostMapping("/learning-model/process-default")
public ApiResponseDto<LearningModelResultDto.BatchProcessResponse> public ApiResponseDto<LearningModelResultDto.BatchProcessResponse>
processDefaultLearningModelResults() { processDefaultLearningModelResults() {
try { try {

View File

@@ -171,6 +171,9 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
ChangeDetectionDto.PolygonFeatureList polygonList = new ChangeDetectionDto.PolygonFeatureList(); ChangeDetectionDto.PolygonFeatureList polygonList = new ChangeDetectionDto.PolygonFeatureList();
polygonList.setType("FeatureCollection"); polygonList.setType("FeatureCollection");
polygonList.setFeatures(result); polygonList.setFeatures(result);
list.clear(); // List<Tuple> 사용 참조 해제
return polygonList; return polygonList;
} }
@@ -194,25 +197,30 @@ public class ChangeDetectionRepositoryImpl extends QuerydslRepositorySupport
.fetch(); .fetch();
GeoJsonReader reader = new GeoJsonReader(); GeoJsonReader reader = new GeoJsonReader();
return list.stream() List<ChangeDetectionDto.PointFeature> result =
.map( list.stream()
tuple -> { .map(
String geojson = tuple.get(0, String.class); tuple -> {
Geometry geom; String geojson = tuple.get(0, String.class);
try { Geometry geom;
geom = reader.read(geojson); try {
} catch (Exception ex) { geom = reader.read(geojson);
throw new RuntimeException("GeoJSON -> Geometry 변환 실패", ex); } catch (Exception ex) {
} throw new RuntimeException("GeoJSON -> Geometry 변환 실패", ex);
}
Long geoUid = tuple.get(mapSheetAnalDataGeomEntity.id).longValue(); Long geoUid = tuple.get(mapSheetAnalDataGeomEntity.id).longValue();
String classCd = String classCd =
tuple.get(mapSheetAnalDataGeomEntity.classAfterCd.toUpperCase()).toString(); tuple.get(mapSheetAnalDataGeomEntity.classAfterCd.toUpperCase()).toString();
return new ChangeDetectionDto.PointFeature( return new ChangeDetectionDto.PointFeature(
"Feature", geom, new ChangeDetectionDto.PointProperties(geoUid, classCd)); "Feature", geom, new ChangeDetectionDto.PointProperties(geoUid, classCd));
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
list.clear(); // List<Tuple> 사용 참조 해제
return result;
} }
@Override @Override