package com.kamco.cd.kamcoback.inference; import com.kamco.cd.kamcoback.config.api.ApiResponseDto; import com.kamco.cd.kamcoback.inference.dto.InferenceResultShpDto; import com.kamco.cd.kamcoback.inference.service.InferenceResultShpService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import java.util.UUID; import lombok.RequiredArgsConstructor; import lombok.extern.log4j.Log4j2; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @Tag(name = "추론결과 데이터 생성", description = "추론결과 데이터 생성 API") @Log4j2 @RestController @RequiredArgsConstructor @RequestMapping("/api/inference/shp") public class InferenceResultShpApiController { private final InferenceResultShpService inferenceResultShpService; public static final String MAP_ID = "{ \"mapIds\": [\"37716096\",\"37716095\",\"37716094\",\"37716091\",\"37716086\",\"37716085\",\"37716084\",\"37716083\",\"37716076\",\"37716066\",\"37716065\",\"37716064\",\"37716063\",\"37716061\",\"37716051\",\"37716011\"] }"; @Operation(summary = "추론결과 데이터 저장", description = "추론결과 데이터 저장") @ApiResponses( value = { @ApiResponse( responseCode = "201", description = "데이터 저장 성공", content = @Content( mediaType = "application/json", schema = @Schema(implementation = InferenceResultShpDto.InferenceCntDto.class))), @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) }) @PostMapping("/save/{learnId}") public ApiResponseDto saveInferenceData( @PathVariable Long learnId) { return ApiResponseDto.createOK(inferenceResultShpService.saveInferenceResultData(learnId)); } @Operation(summary = "추론결과 shp 생성", description = "추론결과 shp 생성") @PostMapping("/shp/{uuid}") public ApiResponseDto createShp( @Parameter(example = "feb2ec0b-a0f7-49ca-95e4-98b2231bdaae") @PathVariable UUID uuid) { inferenceResultShpService.createShp(uuid); return ApiResponseDto.createOK(null); } }