추론관리 목록 조회 수정, 추론 종료 추가
This commit is contained in:
@@ -41,7 +41,6 @@ public class ExternalHttpClient {
|
||||
return new ExternalCallResult<>(code, code >= 200 && code < 300, res.getBody());
|
||||
|
||||
} catch (HttpClientErrorException.NotFound e) {
|
||||
// ⭐ 핵심: 404를 예외가 아닌 결과로 처리
|
||||
log.info("[HTTP-RES] {} {} -> 404 (Not Found)", method, url);
|
||||
log.debug("[HTTP-RES-BODY] {}", e.getResponseBodyAsString());
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
|
||||
import com.kamco.cd.kamcoback.common.utils.UserUtil;
|
||||
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient;
|
||||
import com.kamco.cd.kamcoback.config.resttemplate.ExternalHttpClient.ExternalCallResult;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto;
|
||||
@@ -65,9 +66,14 @@ public class InferenceResultService {
|
||||
@Value("${inference.url}")
|
||||
private String inferenceUrl;
|
||||
|
||||
@Value("${inference.batch-url}")
|
||||
private String batchUrl;
|
||||
|
||||
@Value("${spring.profiles.active}")
|
||||
private String profile;
|
||||
|
||||
private final UserUtil userUtil;
|
||||
|
||||
/**
|
||||
* 추론관리 목록
|
||||
*
|
||||
@@ -492,13 +498,15 @@ public class InferenceResultService {
|
||||
return inferenceResultCoreService.getInferenceGeomList(uuid, searchGeoReq);
|
||||
}
|
||||
|
||||
/** 추론 종료 */
|
||||
@Transactional
|
||||
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;
|
||||
String url = batchUrl + "/" + batchId;
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
@@ -507,11 +515,15 @@ public class InferenceResultService {
|
||||
ExternalCallResult<String> result =
|
||||
externalHttpClient.call(url, HttpMethod.DELETE, dto, headers, String.class);
|
||||
|
||||
if (!result.success()) {
|
||||
throw new CustomApiException("NOT_FOUND", HttpStatus.NOT_FOUND);
|
||||
}
|
||||
System.out.println(result);
|
||||
|
||||
SaveInferenceAiDto request = new SaveInferenceAiDto();
|
||||
request.setStatus(Status.END.getId());
|
||||
request.setUuid(dto.getUuid());
|
||||
request.setUpdateUid(userUtil.getId());
|
||||
inferenceResultCoreService.update(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetAnalDataInferenceGeomEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearn5kEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.MapSheetLearnEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.InferenceResultRepository;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.MapSheetAnalDataInferenceRepository;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.MapSheetLearn5kRepository;
|
||||
import com.kamco.cd.kamcoback.postgres.repository.Inference.MapSheetLearnRepository;
|
||||
@@ -50,6 +51,7 @@ public class InferenceResultCoreService {
|
||||
private final MapSheetLearnRepository mapSheetLearnRepository;
|
||||
private final MapInkx5kRepository mapInkx5kRepository;
|
||||
private final MapSheetLearn5kRepository mapSheetLearn5kRepository;
|
||||
private final InferenceResultRepository inferenceResultRepository;
|
||||
|
||||
private final EntityManager entityManager;
|
||||
private final UserUtil userUtil;
|
||||
@@ -401,15 +403,6 @@ public class InferenceResultCoreService {
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param compareYear 비교년도
|
||||
* @param targetYear 기준년도
|
||||
* @return
|
||||
*/
|
||||
public Integer getLearnStage(Integer compareYear, Integer targetYear) {
|
||||
return mapSheetLearnRepository.getLearnStage(compareYear, targetYear);
|
||||
}
|
||||
|
||||
public AnalResultInfo getInferenceResultInfo(String uuid) {
|
||||
return mapSheetLearnRepository.getInferenceResultInfo(uuid);
|
||||
}
|
||||
@@ -421,4 +414,8 @@ public class InferenceResultCoreService {
|
||||
public Page<Geom> getInferenceGeomList(String uuid, SearchGeoReq searchGeoReq) {
|
||||
return mapSheetLearnRepository.getInferenceGeomList(uuid, searchGeoReq);
|
||||
}
|
||||
|
||||
public void upsertGeomsFromInferenceResults(Long id) {
|
||||
int inferenceGeomCnt = inferenceResultRepository.upsertGeomsFromInferenceResults();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class MapSheetInferenceJobService {
|
||||
@Transactional
|
||||
public void runBatch() {
|
||||
if (isLocalProfile()) {
|
||||
// return;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user