package com.kamco.cd.kamcoback.changedetection; import com.fasterxml.jackson.databind.JsonNode; import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto; import com.kamco.cd.kamcoback.changedetection.service.ChangeDetectionService; import com.kamco.cd.kamcoback.config.api.ApiResponseDto; import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.transaction.Transactional; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; @Tag(name = "변화탐지", description = "변화탐지 API") @RequiredArgsConstructor @RestController @RequestMapping({"/api/change-detection", "/demo/api/change-detection"}) @Transactional public class ChangeDetectionApiController { private final ChangeDetectionService changeDetectionService; @Hidden @Deprecated @GetMapping public ApiResponseDto> getPolygonToPoint() { return ApiResponseDto.ok(changeDetectionService.getPolygonToPoint()); } /** * PolygonData -> JsonNode 변환 예제 * * @return */ @Hidden @GetMapping("/json-data") public ApiResponseDto> getPolygonToJson() { return ApiResponseDto.ok(changeDetectionService.getPolygonToJson()); } @Operation(summary = "변화탐지 분류별 건수", description = "변화탐지 분류별 건수") @GetMapping("/class-count") public ApiResponseDto> getChangeDetectionClassCount( @Parameter(description = "변화탐지 년도(차수) /year-list 의 analUid", example = "1") @RequestParam Long id, @Parameter(description = "탐지된 도엽번호", example = "34602060") @RequestParam String mapSheetNum) { return ApiResponseDto.ok(changeDetectionService.getChangeDetectionClassCount(id, mapSheetNum)); } @Operation(summary = "변화탐지 COG Url", description = "변화탐지 COG Url") @GetMapping("/cog-url") public ApiResponseDto getChangeDetectionCogUrl( @Parameter(description = "이전 년도", example = "2023") @RequestParam Integer beforeYear, @Parameter(description = "이후 년도", example = "2024") @RequestParam Integer afterYear, @Parameter(description = "도엽번호(5k)", example = "36809010") @RequestParam String mapSheetNum) { ChangeDetectionDto.CogUrlReq req = new ChangeDetectionDto.CogUrlReq(beforeYear, afterYear, mapSheetNum); return ApiResponseDto.ok(changeDetectionService.getChangeDetectionCogUrl(req)); } @Operation(summary = "변화탐지 년도(차수) 목록", description = "변화탐지 년도(차수) 목록") @GetMapping("/year-list") public ApiResponseDto> getChangeDetectionYearList() { return ApiResponseDto.ok(changeDetectionService.getChangeDetectionYearList()); } @Operation(summary = "변화탐지 탐지된 도엽 목록", description = "변화탐지 탐지된 도엽 목록") @GetMapping("/map-list") public ApiResponseDto> getChangeDetectionMapSheetList( @Parameter(description = "년도목록 id", example = "1") @RequestParam Long analUid) { return ApiResponseDto.ok(changeDetectionService.getChangeDetectionMapSheetList(analUid)); } @Operation(summary = "변화탐지 결과 Polygon", description = "변화탐지 결과 Polygon") @GetMapping("/polygon") public ApiResponseDto> getChangeDetectionPolygonList( @Parameter(description = "년도목록 id", example = "1") @RequestParam Long analUid, @Parameter(description = "도엽번호", example = "34602060") @RequestParam String mapSheetNum) { return ApiResponseDto.ok( changeDetectionService.getChangeDetectionPolygonList(analUid, mapSheetNum)); } @Operation(summary = "변화탐지 결과 Point", description = "변화탐지 결과 Point") @GetMapping("/point") public ApiResponseDto> getChangeDetectionPointList( @Parameter(description = "년도목록 id", example = "1") @RequestParam Long analUid, @Parameter(description = "도엽번호", example = "34602060") @RequestParam String mapSheetNum) { return ApiResponseDto.ok( changeDetectionService.getChangeDetectionPointList(analUid, mapSheetNum)); } }