186 lines
9.1 KiB
Java
186 lines
9.1 KiB
Java
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.gukyuin.service.GukYuinApiService;
|
|
import com.kamco.cd.kamcoback.inference.dto.InferenceResultShpDto;
|
|
import com.kamco.cd.kamcoback.inference.service.InferenceResultShpService;
|
|
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.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.time.LocalDate;
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
@Tag(name = "스케줄링 및 jar 수동 호출 테스트", description = "스케줄링 및 jar 수동 호출 테스트 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;
|
|
private final InferenceResultShpService inferenceResultShpService;
|
|
private final GukYuinApiService gukYuinApiService;
|
|
|
|
@Operation(summary = "국유인 탐지객체 조회 PNU 업데이트 스케줄링", description = "국유인 탐지객체 조회 PNU 업데이트 스케줄링")
|
|
@GetMapping("/gukyuin/pnu")
|
|
public ApiResponseDto<Void> findGukYuinContListPnuUpdate() {
|
|
gukYuinApiPnuJobService.findGukYuinContListPnuUpdate();
|
|
return ApiResponseDto.ok(null);
|
|
}
|
|
|
|
@Operation(summary = "국유인 등록 상태 체크 스케줄링", description = "국유인 등록 상태 체크 스케줄링")
|
|
@GetMapping("/gukyuin/status")
|
|
public ApiResponseDto<Void> findGukYuinMastCompleteYn() {
|
|
gukYuinApiStatusJobService.findGukYuinMastCompleteYn();
|
|
return ApiResponseDto.ok(null);
|
|
}
|
|
|
|
@Operation(summary = "국유인 라벨 완료 전송 스케줄링", description = "국유인 라벨 완료 전송 스케줄링")
|
|
@GetMapping("/gukyuin/label")
|
|
public ApiResponseDto<Void> findLabelingCompleteSend(
|
|
@RequestParam(required = false) LocalDate baseDate) {
|
|
gukYuinApiLabelJobService.findLabelingCompleteSend(baseDate);
|
|
return ApiResponseDto.ok(null);
|
|
}
|
|
|
|
@Operation(summary = "국유인 실태조사 적합여부 전송가능한 객체 ids", description = "국유인 실태조사 적합여부 전송가능한 객체 ids")
|
|
@GetMapping("/gukyuin/stblt-object-ids/{uid}/{mapSheetNum}")
|
|
public ApiResponseDto<List<String>> findStbltObjectIds(
|
|
@PathVariable String uid, @PathVariable String mapSheetNum) {
|
|
return ApiResponseDto.ok(gukYuinApiService.findStbltObjectIds(uid, mapSheetNum));
|
|
}
|
|
|
|
@Operation(summary = "국유인 라벨 완료 전송 스케줄링", description = "국유인 라벨 완료 전송 스케줄링")
|
|
@PostMapping("/gukyuin/stblt-update")
|
|
public ApiResponseDto<Void> stbltBulkUpdate(@RequestBody List<String> objectIds) {
|
|
gukYuinApiService.stbltBulkUpdate(objectIds);
|
|
return ApiResponseDto.ok(null);
|
|
}
|
|
|
|
@Operation(summary = "국유인 실태조사 적합여부 조회 스케줄링", description = "국유인 실태조사 적합여부 조회 스케줄링")
|
|
@GetMapping("/gukyuin/stblt")
|
|
public ApiResponseDto<Void> findGukYuinEligibleForSurvey(
|
|
@RequestParam(required = false) LocalDate baseDate) {
|
|
gukYuinApiStbltJobService.findGukYuinEligibleForSurvey(baseDate);
|
|
return ApiResponseDto.ok(null);
|
|
}
|
|
|
|
@Operation(
|
|
summary = "라벨완료 -> 검수할당 스케줄링",
|
|
description = "스케줄링이 실패한 경우 수동 호출하는 API, 어제 라벨링 완료된 것을 해당 검수자들에게 할당함")
|
|
@GetMapping("/label-to-review")
|
|
public ApiResponseDto<Void> runTrainingReviewSchedule(
|
|
@RequestParam(required = false) LocalDate baseDate) {
|
|
trainingDataLabelJobService.assignReviewerYesterdayLabelComplete(baseDate);
|
|
return ApiResponseDto.ok(null);
|
|
}
|
|
|
|
@Operation(summary = "검수완료된 라벨링 geojson 생성 스케줄링", description = "검수완료된 라벨링 geojson 생성")
|
|
@GetMapping("/review-to-geojson")
|
|
public ApiResponseDto<Long> runExportGeojsonLabelingGeom(
|
|
@RequestParam(required = false) LocalDate baseDate) {
|
|
trainingDataReviewJobService.exportGeojsonLabelingGeom(baseDate);
|
|
return ApiResponseDto.ok(0L);
|
|
}
|
|
|
|
@Operation(
|
|
summary = "라벨러/검수자 최종로그인 28일 경과 이후 사용중지 스케줄링",
|
|
description = "라벨러/검수자 최종로그인 28일 경과 이후 사용중지 처리")
|
|
@GetMapping("/member-inactive-job")
|
|
public ApiResponseDto<Void> 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<String> mngSyncOnOff(
|
|
@RequestParam boolean jobStart, @RequestParam int pageSize) {
|
|
|
|
mapSheetMngFileJobController.setSchedulerEnabled(jobStart);
|
|
mapSheetMngFileJobController.setMngSyncPageSize(pageSize);
|
|
|
|
return ApiResponseDto.createOK("OK");
|
|
}
|
|
|
|
@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/inference/{uuid}")
|
|
public ApiResponseDto<InferenceResultShpDto.InferenceCntDto> saveInferenceData(
|
|
@Parameter(example = "feb2ec0b-a0f7-49ca-95e4-98b2231bdaae", description = "추론 uuid")
|
|
@PathVariable
|
|
UUID uuid) {
|
|
return ApiResponseDto.createOK(inferenceResultShpService.saveInferenceResultData(uuid));
|
|
}
|
|
|
|
@Operation(summary = "추론결과 shp 생성", description = "추론결과 shp 생성")
|
|
@PostMapping("/shp/inference/{uuid}")
|
|
public ApiResponseDto<Void> createShp(
|
|
@Parameter(example = "feb2ec0b-a0f7-49ca-95e4-98b2231bdaae", description = "추론 uuid")
|
|
@PathVariable
|
|
UUID uuid) {
|
|
// shp 파일 수동생성
|
|
inferenceResultShpService.createShp(uuid);
|
|
return ApiResponseDto.createOK(null);
|
|
}
|
|
|
|
@Operation(summary = "국유인 실태조사 적합여부 랜덤 업데이트", description = "국유인 실태조사 적합여부 랜덤 업데이트")
|
|
@PutMapping("/gukyuin/random-stblt-update/{uid}/{updateCnt}")
|
|
public ApiResponseDto<Integer> updateStbltRandomData(
|
|
@PathVariable String uid, @PathVariable int updateCnt) {
|
|
return ApiResponseDto.ok(gukYuinApiService.updateStbltRandomData(uid, updateCnt));
|
|
}
|
|
}
|