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.dto.ChangeDetectionDto.DetectSearchType; import com.kamco.cd.kamcoback.changedetection.dto.ChangeDetectionDto.MapScaleType; 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 java.util.UUID; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @Tag(name = "변화탐지", description = "변화탐지 API") @RequiredArgsConstructor @RestController @RequestMapping({"/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 의 uuid", example = "8584e8d4-53b3-4582-bde2-28a81495a626") @RequestParam UUID uuid, @Parameter(description = "도곽/일반(MAPSHEET/ADDRESS) 검색 타입", required = true) @RequestParam(defaultValue = "MAPSHEET") DetectSearchType type, @Parameter(description = "5k/50k 구분(SCALE_5K/SCALE_50K))", required = true) @RequestParam(defaultValue = "SCALE_50K") MapScaleType scale, @Parameter(description = "탐지된 도엽번호", example = "35905") @RequestParam String mapSheetNum) { return ApiResponseDto.ok( changeDetectionService.getChangeDetectionClassCount(type, scale, uuid, mapSheetNum)); } @Operation(summary = "변화탐지 COG Url", description = "변화탐지 COG Url") @GetMapping("/cog-url") public ApiResponseDto getChangeDetectionCogUrl( @Parameter(description = "도곽/일반(MAPSHEET/ADDRESS) 검색 타입", required = true) @RequestParam(defaultValue = "MAPSHEET") DetectSearchType type, @Parameter(description = "5k/50k 구분(SCALE_5K/SCALE_50K))", required = true) @RequestParam(defaultValue = "SCALE_50K") MapScaleType scale, @Parameter( description = "변화탐지 년도(차수) /year-list 의 uuid", example = "8584e8d4-53b3-4582-bde2-28a81495a626") @RequestParam UUID uuid, @Parameter(description = "이전 년도", example = "2023") @RequestParam Integer beforeYear, @Parameter(description = "이후 년도", example = "2024") @RequestParam Integer afterYear, @Parameter(description = "도엽번호(5k)", example = "35905086") @RequestParam String mapSheetNum) { ChangeDetectionDto.CogUrlReq req = new ChangeDetectionDto.CogUrlReq(uuid, beforeYear, afterYear, mapSheetNum, type, scale); 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 = "도곽/일반(MAPSHEET/ADDRESS) 검색 타입", required = true) @RequestParam(defaultValue = "MAPSHEET") DetectSearchType type, @Parameter(description = "5k/50k 구분(SCALE_5K/SCALE_50K))", required = true) @RequestParam(defaultValue = "SCALE_50K") MapScaleType scale, @Parameter( description = "변화탐지 년도(차수) /year-list 의 uuid", example = "8584e8d4-53b3-4582-bde2-28a81495a626") @RequestParam UUID uuid) { return ApiResponseDto.ok( changeDetectionService.getChangeDetectionMapSheetList(type, scale, uuid)); } @Operation(summary = "변화탐지 결과 Polygon", description = "변화탐지 결과 Polygon") @GetMapping("/polygon") public ApiResponseDto getChangeDetectionPolygonList( @Parameter(description = "도곽/일반(MAPSHEET/ADDRESS) 검색 타입", required = true) @RequestParam(defaultValue = "MAPSHEET") DetectSearchType type, @Parameter(description = "5k/50k 구분(SCALE_5K/SCALE_50K))", required = true) @RequestParam(defaultValue = "SCALE_50K") MapScaleType scale, @Parameter( description = "변화탐지 년도(차수) /year-list 의 uuid", example = "8584e8d4-53b3-4582-bde2-28a81495a626") UUID uuid, @Parameter(description = "도엽번호", example = "34607") @RequestParam String mapSheetNum) { return ApiResponseDto.ok( changeDetectionService.getChangeDetectionPolygonList(type, scale, uuid, mapSheetNum)); } @Operation(summary = "변화탐지 결과 Point", description = "변화탐지 결과 Point") @GetMapping("/point") public ApiResponseDto getChangeDetectionPointList( @Parameter(description = "도곽/일반(MAPSHEET/ADDRESS) 검색 타입", required = true) @RequestParam(defaultValue = "MAPSHEET") DetectSearchType type, @Parameter(description = "5k/50k 구분(SCALE_5K/SCALE_50K))", required = true) @RequestParam(defaultValue = "SCALE_50K") MapScaleType scale, @Parameter( description = "변화탐지 년도(차수) /year-list 의 uuid", example = "8584e8d4-53b3-4582-bde2-28a81495a626") UUID uuid, @Parameter(description = "도엽번호", example = "34607") @RequestParam String mapSheetNum) { return ApiResponseDto.ok( changeDetectionService.getChangeDetectionPointList(type, scale, uuid, mapSheetNum)); } @Operation(summary = "선택 변화탐지 결과 uuid 조회", description = "선택 변화탐지 결과 uuid 조회") @GetMapping("/selected/uuid") public ApiResponseDto getChnDtctIdUuid( @Parameter(description = "회차 32자 uid", example = "98ABAA1FC4394F11885C302C19AE5E81") @RequestParam String chnDtctId) { return ApiResponseDto.ok(changeDetectionService.getLearnUuid(chnDtctId)); } @Operation(summary = "선택 변화탐지 결과 Polygon", description = "선택 변화탐지 결과 Polygon") @GetMapping("/selected/polygon") public ApiResponseDto getCdPolygonList( @Parameter(description = "회차 32자 uid", example = "98ABAA1FC4394F11885C302C19AE5E81") @RequestParam String chnDtctId, @Parameter(description = "polygon 32자 uid", example = "3B1A7E5F895A4D9698489540EE1BBE1E") @RequestParam(required = false) String cdObjectId, @Parameter( description = "polygon 32자 uids", example = "3B1A7E5F895A4D9698489540EE1BBE1E,3B221A2AF9614647A0903A972D56C574,3B22686A7ACE44FC9CB20F1B4FA6DEFD,3B376D94A183479BB5FBE3D7166E6E1A") @RequestParam(required = false) List cdObjectIds, @Parameter(description = "pnu") @RequestParam(required = false) String pnu) { return ApiResponseDto.ok( changeDetectionService.getPolygonListByCd(chnDtctId, cdObjectId, cdObjectIds, pnu)); } @Operation(summary = "선택 변화탐지 결과 Point", description = "선택 변화탐지 결과 Point") @GetMapping("/selected/point") public ApiResponseDto getCdPointList( @Parameter(description = "회차 32자 uid", example = "98ABAA1FC4394F11885C302C19AE5E81") @RequestParam String chnDtctId, @Parameter(description = "polygon 32자 uid", example = "3B1A7E5F895A4D9698489540EE1BBE1E") @RequestParam(required = false) String cdObjectId, @Parameter( description = "polygon 32자 uids", example = "3B1A7E5F895A4D9698489540EE1BBE1E,3B221A2AF9614647A0903A972D56C574,3B22686A7ACE44FC9CB20F1B4FA6DEFD,3B376D94A183479BB5FBE3D7166E6E1A") @RequestParam(required = false) List cdObjectIds, @Parameter(description = "pnu") @RequestParam(required = false) String pnu) { return ApiResponseDto.ok( changeDetectionService.getPointListByCd(chnDtctId, cdObjectId, cdObjectIds, pnu)); } }