package com.kamco.cd.kamcoback.mapsheet; import com.kamco.cd.kamcoback.code.dto.CommonCodeDto; import com.kamco.cd.kamcoback.code.service.CommonCodeService; import com.kamco.cd.kamcoback.config.api.ApiResponseDto; import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto; import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngService; import io.swagger.v3.oas.annotations.Operation; 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 jakarta.validation.Valid; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.web.bind.annotation.*; @Tag(name = "영상 관리", description = "영상 관리 API") @RestController @RequiredArgsConstructor @RequestMapping({"/api/mapsheet"}) public class MapSheetMngApiController { private final CommonCodeService commonCodeService; private final MapSheetMngService mapSheetMngService; @Operation(summary = "영상데이터관리목록 조회", description = "영상데이터관리목록 조회") @ApiResponses( value = { @ApiResponse( responseCode = "200", description = "조회 성공", content = @Content( mediaType = "application/json", schema = @Schema(implementation = CommonCodeDto.Basic.class))), @ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content), @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) }) @PostMapping("/mng-list") public ApiResponseDto> findMapSheetMngList() { return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngList()); } @Operation(summary = "영상데이터관리 상세", description = "영상데이터관리 상세") @ApiResponses( value = { @ApiResponse( responseCode = "200", description = "조회 성공", content = @Content( mediaType = "application/json", schema = @Schema(implementation = CommonCodeDto.Basic.class))), @ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content), @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) }) @GetMapping("/mng") public ApiResponseDto findMapSheetMng(@RequestParam int mngYyyy) { return ApiResponseDto.ok(mapSheetMngService.findMapSheetMng(mngYyyy)); } @Operation(summary = "영상관리 > 데이터 등록", description = "영상관리 > 데이터 등록") @ApiResponses( value = { @ApiResponse( responseCode = "201", description = "데이터 등록 성공", content = @Content( mediaType = "application/json", schema = @Schema(implementation = Long.class))), @ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content), @ApiResponse(responseCode = "404", description = "데이터를 찾을 수 없음", content = @Content), @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) }) @PutMapping("/mng-data-save") public ApiResponseDto mngDataSave( @RequestBody @Valid MapSheetMngDto.AddReq AddReq) { return ApiResponseDto.ok(mapSheetMngService.mngDataSave(AddReq)); } /** * 오류데이터 목록 조회 * * @param searchReq * @return */ @PostMapping("/error-list") public ApiResponseDto> findMapSheetErrorList( @RequestBody @Valid MapSheetMngDto.ErrorSearchReq searchReq) { return ApiResponseDto.ok(mapSheetMngService.findMapSheetErrorList(searchReq)); } /** * @param hstUidList * @return */ @Operation(summary = "오류데이터 팝업 > 업로드 처리", description = "오류데이터 팝업 > 업로드 처리") @ApiResponses( value = { @ApiResponse( responseCode = "201", description = "업로드 처리 성공", content = @Content( mediaType = "application/json", schema = @Schema(implementation = Long.class))), @ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content), @ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content), @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) }) @PutMapping("/upload-process") public ApiResponseDto uploadProcess( @RequestBody @Valid List hstUidList) { return ApiResponseDto.ok(mapSheetMngService.uploadProcess(hstUidList)); } /** * @param hstUidList * @return */ @Operation(summary = "오류데이터 팝업 > 추론 제외", description = "오류데이터 팝업 > 추론 제외") @PutMapping("/except-inference") public ApiResponseDto updateExceptUseInference( @RequestBody @Valid List hstUidList) { return ApiResponseDto.ok(mapSheetMngService.updateExceptUseInference(hstUidList)); } }