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