추론관리 목록 조회 수정, 추론 종료 추가
This commit is contained in:
@@ -24,6 +24,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -139,6 +140,25 @@ public class InferenceResultApiController {
|
||||
return ApiResponseDto.ok(uuid);
|
||||
}
|
||||
|
||||
@Operation(summary = "추론 종료", description = "추론 종료")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "201",
|
||||
description = "종료 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = Page.class))),
|
||||
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@DeleteMapping("/end")
|
||||
public ApiResponseDto<Void> getInferenceGeomList() {
|
||||
inferenceResultService.deleteInferenceEnd();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Operation(summary = "분석 모델 선택 조회", description = "변화탐지 실행 정보 입력 모델선택 팝업 ")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
|
||||
@@ -84,7 +84,11 @@ public class InferenceResultService {
|
||||
* @return
|
||||
*/
|
||||
public UUID getProcessing() {
|
||||
return inferenceResultCoreService.getProcessing();
|
||||
SaveInferenceAiDto dto = inferenceResultCoreService.getProcessing();
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
return dto.getUuid();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,7 +188,7 @@ public class InferenceResultService {
|
||||
m1.setPred_requests_areas(predRequestsAreas);
|
||||
|
||||
// ai 추론 실행 api 호출
|
||||
Long batchId = 0L; // ensureAccepted(m1);
|
||||
Long batchId = ensureAccepted(m1);
|
||||
|
||||
// ai 추론 실행후 응답값 update
|
||||
SaveInferenceAiDto saveInferenceAiDto = new SaveInferenceAiDto();
|
||||
@@ -487,4 +491,27 @@ public class InferenceResultService {
|
||||
public Page<Geom> getInferenceGeomList(String uuid, SearchGeoReq searchGeoReq) {
|
||||
return inferenceResultCoreService.getInferenceGeomList(uuid, searchGeoReq);
|
||||
}
|
||||
|
||||
public void deleteInferenceEnd() {
|
||||
SaveInferenceAiDto dto = inferenceResultCoreService.getProcessing();
|
||||
if (dto == null) {
|
||||
throw new CustomApiException("NOT_FOUND", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
Long batchId = dto.getBatchId();
|
||||
String url = inferenceUrl + "/" + batchId;
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
headers.setAccept(List.of(MediaType.APPLICATION_JSON));
|
||||
|
||||
ExternalCallResult<String> result =
|
||||
externalHttpClient.call(url, HttpMethod.DELETE, dto, headers, String.class);
|
||||
|
||||
System.out.println(result);
|
||||
|
||||
SaveInferenceAiDto request = new SaveInferenceAiDto();
|
||||
request.setStatus(Status.END.getId());
|
||||
request.setUuid(dto.getUuid());
|
||||
inferenceResultCoreService.update(request);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user