package com.kamco.cd.kamcoback.scheduler; import com.kamco.cd.kamcoback.code.dto.CommonCodeDto; import com.kamco.cd.kamcoback.config.api.ApiResponseDto; import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiLabelJobService; import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiPnuJobService; import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiStatusJobService; import com.kamco.cd.kamcoback.scheduler.service.GukYuinApiStbltJobService; import com.kamco.cd.kamcoback.scheduler.service.MemberInactiveJobService; import com.kamco.cd.kamcoback.scheduler.service.TrainingDataLabelJobService; import com.kamco.cd.kamcoback.scheduler.service.TrainingDataReviewJobService; 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 java.time.LocalDate; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PutMapping; 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") @RestController @RequiredArgsConstructor @RequestMapping("/api/schedule") public class SchedulerApiController { private final GukYuinApiPnuJobService gukYuinApiPnuJobService; private final GukYuinApiStatusJobService gukYuinApiStatusJobService; private final GukYuinApiLabelJobService gukYuinApiLabelJobService; private final GukYuinApiStbltJobService gukYuinApiStbltJobService; private final TrainingDataLabelJobService trainingDataLabelJobService; private final TrainingDataReviewJobService trainingDataReviewJobService; private final MemberInactiveJobService memberInactiveJobService; private final MapSheetMngFileJobController mapSheetMngFileJobController; @Operation(summary = "국유인 탐지객체 조회 PNU 업데이트 스케줄링", description = "국유인 탐지객체 조회 PNU 업데이트 스케줄링") @GetMapping("/gukyuin/pnu") public ApiResponseDto findGukYuinContListPnuUpdate() { gukYuinApiPnuJobService.findGukYuinContListPnuUpdate(); return ApiResponseDto.ok(null); } @Operation(summary = "국유인 등록 상태 체크 스케줄링", description = "국유인 등록 상태 체크 스케줄링") @GetMapping("/gukyuin/status") public ApiResponseDto findGukYuinMastCompleteYn() { gukYuinApiStatusJobService.findGukYuinMastCompleteYn(); return ApiResponseDto.ok(null); } @Operation(summary = "국유인 라벨 완료 전송 스케줄링", description = "국유인 라벨 완료 전송 스케줄링") @GetMapping("/gukyuin/label") public ApiResponseDto findLabelingCompleteSend( @RequestParam(required = false) LocalDate baseDate) { gukYuinApiLabelJobService.findLabelingCompleteSend(baseDate); return ApiResponseDto.ok(null); } @Operation(summary = "국유인 실태조사 적합여부 업데이트 스케줄링", description = "국유인 실태조사 적합여부 업데이트 스케줄링") @GetMapping("/gukyuin/stblt") public ApiResponseDto findGukYuinEligibleForSurvey( @RequestParam(required = false) LocalDate baseDate) { gukYuinApiStbltJobService.findGukYuinEligibleForSurvey(baseDate); return ApiResponseDto.ok(null); } @Operation( summary = "라벨완료 -> 검수할당 스케줄링", description = "스케줄링이 실패한 경우 수동 호출하는 API, 어제 라벨링 완료된 것을 해당 검수자들에게 할당함") @GetMapping("/label-to-review") public ApiResponseDto runTrainingReviewSchedule( @RequestParam(required = false) LocalDate baseDate) { trainingDataLabelJobService.assignReviewerYesterdayLabelComplete(baseDate); return ApiResponseDto.ok(null); } @Operation(summary = "검수완료된 라벨링 geojson 생성 스케줄링", description = "검수완료된 라벨링 geojson 생성") @GetMapping("/review-to-geojson") public ApiResponseDto runExportGeojsonLabelingGeom( @RequestParam(required = false) LocalDate baseDate) { trainingDataReviewJobService.exportGeojsonLabelingGeom(baseDate); return ApiResponseDto.ok(0L); } @Operation( summary = "라벨러/검수자 최종로그인 28일 경과 이후 사용중지 스케줄링", description = "라벨러/검수자 최종로그인 28일 경과 이후 사용중지 처리") @GetMapping("/member-inactive-job") public ApiResponseDto memberInactiveJob() { memberInactiveJobService.memberActive28daysToInactive(); return ApiResponseDto.ok(null); } @Operation(summary = "영상관리 파일 싱크 스캐쥴러 Start/Stop", description = "영상관리 파일 싱크 스캐쥴러 Start/Stop API") @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) }) @PutMapping("/mng-sync-job") public ApiResponseDto mngSyncOnOff( @RequestParam boolean jobStart, @RequestParam int pageSize) { mapSheetMngFileJobController.setSchedulerEnabled(jobStart); mapSheetMngFileJobController.setMngSyncPageSize(pageSize); return ApiResponseDto.createOK("OK"); } }