[KC-99] 추론관리 등록 수정, 모델 조회 추가
This commit is contained in:
@@ -5,6 +5,8 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
|
||||
import com.kamco.cd.kamcoback.inference.service.InferenceResultService;
|
||||
import com.kamco.cd.kamcoback.mapsheet.service.MapSheetMngService;
|
||||
import com.kamco.cd.kamcoback.model.dto.ModelMngDto;
|
||||
import com.kamco.cd.kamcoback.model.service.ModelMngService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
@@ -34,6 +36,7 @@ public class InferenceResultApiController {
|
||||
|
||||
private final InferenceResultService inferenceResultService;
|
||||
private final MapSheetMngService mapSheetMngService;
|
||||
private final ModelMngService modelMngService;
|
||||
|
||||
@Operation(summary = "추론관리 목록", description = "어드민 홈 > 추론관리 > 추론관리 > 추론관리 목록")
|
||||
@ApiResponses(
|
||||
@@ -110,6 +113,35 @@ public class InferenceResultApiController {
|
||||
return ApiResponseDto.ok(uuid);
|
||||
}
|
||||
|
||||
@Operation(summary = "분석 모델 선택 조회", description = "변화탐지 실행 정보 입력 모델선택 팝업 ")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "분석 모델 조회 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(description = "분석 모델", implementation = Page.class))),
|
||||
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@GetMapping("/model")
|
||||
public ApiResponseDto<Page<ModelMngDto.ModelList>> saveInferenceInfo(
|
||||
@Parameter(description = "모델 생성일 시작", example = "2025-12-01") @RequestParam(required = false)
|
||||
LocalDate strtDttm,
|
||||
@Parameter(description = "모델 생성일 종료", example = "2026-01-09") @RequestParam(required = false)
|
||||
LocalDate endDttm,
|
||||
@Parameter(description = "키워드 (모델버전)", example = "M1.H1.E28") @RequestParam(required = false)
|
||||
String searchVal,
|
||||
@RequestParam(defaultValue = "0") int page,
|
||||
@RequestParam(defaultValue = "20") int size) {
|
||||
ModelMngDto.searchReq searchReq = new ModelMngDto.searchReq(page, size, null);
|
||||
Page<ModelMngDto.ModelList> result =
|
||||
modelMngService.findModelMgmtList(searchReq, strtDttm, endDttm, null, searchVal);
|
||||
return ApiResponseDto.ok(result);
|
||||
}
|
||||
|
||||
// @ApiResponses(
|
||||
// value = {
|
||||
// @ApiResponse(
|
||||
|
||||
@@ -61,13 +61,13 @@ public class InferenceResultService {
|
||||
|
||||
// TODO tif 없으면 전년도 파일 조회 쿼리 추가해야함
|
||||
// TODO 도엽 개수를 target 기준으로 맞춰야함
|
||||
this.getSceneInference(String.valueOf(req.getCompareYyyy()), req.getMapSheetNum());
|
||||
this.getSceneInference(String.valueOf(req.getTargetYyyy()), req.getMapSheetNum());
|
||||
|
||||
InferenceSendDto m1 = this.getModelInfo(req.getModel1Uuid());
|
||||
InferenceSendDto m2 = this.getModelInfo(req.getModel2Uuid());
|
||||
InferenceSendDto m3 = this.getModelInfo(req.getModel3Uuid());
|
||||
|
||||
// this.getSceneInference(String.valueOf(req.getCompareYyyy()), req.getMapSheetNum());
|
||||
// this.getSceneInference(String.valueOf(req.getTargetYyyy()), req.getMapSheetNum());
|
||||
//
|
||||
// InferenceSendDto m1 = this.getModelInfo(req.getModel1Uuid());
|
||||
// InferenceSendDto m2 = this.getModelInfo(req.getModel2Uuid());
|
||||
// InferenceSendDto m3 = this.getModelInfo(req.getModel3Uuid());
|
||||
//
|
||||
// ensureAccepted(m1);
|
||||
// ensureAccepted(m2);
|
||||
// ensureAccepted(m3);
|
||||
@@ -93,16 +93,20 @@ public class InferenceResultService {
|
||||
.onErrorReturn(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* api 호출 실패시 예외처리
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
private void ensureAccepted(InferenceSendDto dto) {
|
||||
|
||||
Boolean ok =
|
||||
this.inferenceSend(dto)
|
||||
.timeout(java.time.Duration.ofSeconds(3)) // 접수는 빨리 와야 함
|
||||
.timeout(java.time.Duration.ofSeconds(3))
|
||||
.onErrorReturn(false) // 타임아웃/통신오류도 실패 처리
|
||||
.block(java.time.Duration.ofSeconds(4)); // 최종 안전장치 (짧게!)
|
||||
.block(java.time.Duration.ofSeconds(4));
|
||||
|
||||
if (!Boolean.TRUE.equals(ok)) {
|
||||
// 여기서 예외가 터져야 @Transactional 롤백됨
|
||||
throw new CustomApiException("BAD_GATEWAY", HttpStatus.BAD_GATEWAY);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user