추론 실행 영구제외 조건 추가
추론 결과 UID 앞 8자리 추가 종료->완료, 종료->강제종료 상태 변경
This commit is contained in:
@@ -13,6 +13,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "추론결과 데이터 생성", description = "추론결과 데이터 생성 API")
|
||||
@@ -42,4 +43,15 @@ public class InferenceResultShpApiController {
|
||||
@PathVariable Long learnId) {
|
||||
return ApiResponseDto.createOK(inferenceResultShpService.saveInferenceResultData(learnId));
|
||||
}
|
||||
|
||||
@Operation(summary = "추론결과 shp 생성", description = "추론결과 shp 생성")
|
||||
@PostMapping("/shp/{uid}")
|
||||
public ApiResponseDto<Void> createShp(
|
||||
@PathVariable String uid,
|
||||
@RequestParam Long m1BatchId,
|
||||
@RequestParam Long m2BatchId,
|
||||
@RequestParam Long m3BatchId) {
|
||||
inferenceResultShpService.createShp(uid, m1BatchId, m2BatchId, m3BatchId);
|
||||
return ApiResponseDto.createOK(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,6 +304,7 @@ public class InferenceDetailDto {
|
||||
Double classAfterProb;
|
||||
Long mapSheetNum;
|
||||
String mapSheetName;
|
||||
String subUid;
|
||||
|
||||
// @JsonIgnore String gemoStr;
|
||||
// @JsonIgnore String geomCenterStr;
|
||||
@@ -321,7 +322,8 @@ public class InferenceDetailDto {
|
||||
String classAfterCd,
|
||||
Double classAfterProb,
|
||||
Long mapSheetNum,
|
||||
String mapSheetName) {
|
||||
String mapSheetName,
|
||||
String subUid) {
|
||||
this.uuid = uuid;
|
||||
this.uid = uid;
|
||||
this.compareYyyy = compareYyyy;
|
||||
@@ -335,6 +337,7 @@ public class InferenceDetailDto {
|
||||
this.classAfterProb = classAfterProb;
|
||||
this.mapSheetNum = mapSheetNum;
|
||||
this.mapSheetName = mapSheetName;
|
||||
this.subUid = subUid;
|
||||
// this.gemoStr = gemoStr;
|
||||
// this.geomCenterStr = geomCenterStr;
|
||||
//
|
||||
@@ -440,6 +443,7 @@ public class InferenceDetailDto {
|
||||
@JsonFormatDttm private ZonedDateTime inferEndDttm;
|
||||
private Integer stage;
|
||||
private String elapsedDuration;
|
||||
private String subUid;
|
||||
|
||||
public AnalResultInfo(
|
||||
String analTitle,
|
||||
@@ -452,7 +456,8 @@ public class InferenceDetailDto {
|
||||
String mapSheetScope,
|
||||
ZonedDateTime inferStartDttm,
|
||||
ZonedDateTime inferEndDttm,
|
||||
Integer stage) {
|
||||
Integer stage,
|
||||
String subUid) {
|
||||
this.analTitle = analTitle;
|
||||
this.modelVer1 = modelVer1;
|
||||
this.modelVer2 = modelVer2;
|
||||
@@ -464,6 +469,7 @@ public class InferenceDetailDto {
|
||||
this.inferStartDttm = inferStartDttm;
|
||||
this.inferEndDttm = inferEndDttm;
|
||||
this.stage = stage;
|
||||
this.subUid = subUid;
|
||||
Duration elapsed =
|
||||
(inferStartDttm != null && inferEndDttm != null)
|
||||
? Duration.between(inferStartDttm, inferEndDttm)
|
||||
|
||||
@@ -85,8 +85,8 @@ public class InferenceResultDto {
|
||||
public enum Status implements EnumType {
|
||||
READY("대기"),
|
||||
IN_PROGRESS("진행중"),
|
||||
END("종료"),
|
||||
;
|
||||
END("완료"),
|
||||
FORCED_END("강제종료");
|
||||
private final String desc;
|
||||
|
||||
public static Status fromCode(String code) {
|
||||
|
||||
@@ -558,11 +558,11 @@ public class InferenceResultService {
|
||||
externalHttpClient.call(url, HttpMethod.DELETE, dto, headers, String.class);
|
||||
|
||||
if (!result.success()) {
|
||||
log.warn("Failed to delete inference result");
|
||||
throw new CustomApiException("BAD_GATEWAY", HttpStatus.BAD_GATEWAY);
|
||||
}
|
||||
|
||||
SaveInferenceAiDto request = new SaveInferenceAiDto();
|
||||
request.setStatus(Status.END.getId());
|
||||
request.setStatus(Status.FORCED_END.getId());
|
||||
request.setUuid(dto.getUuid());
|
||||
request.setUpdateUid(userUtil.getId());
|
||||
request.setInferEndDttm(ZonedDateTime.now());
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.kamco.cd.kamcoback.inference.service;
|
||||
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultShpDto;
|
||||
import com.kamco.cd.kamcoback.inference.dto.InferenceResultsTestingDto;
|
||||
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
|
||||
import com.kamco.cd.kamcoback.postgres.core.InferenceResultShpCoreService;
|
||||
import com.kamco.cd.kamcoback.scheduler.service.ShpPipelineService;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -13,13 +18,49 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
public class InferenceResultShpService {
|
||||
|
||||
private final InferenceResultShpCoreService coreService;
|
||||
private final InferenceResultCoreService inferenceResultCoreService;
|
||||
private final ShpPipelineService shpPipelineService;
|
||||
|
||||
@Value("${mapsheet.shp.baseurl}")
|
||||
private String baseDir;
|
||||
|
||||
@Value("${inference.jar-path}")
|
||||
private String jarPath;
|
||||
|
||||
@Value("${file.dataset-dir}")
|
||||
private String datasetDir;
|
||||
|
||||
/** inference_results 테이블을 기준으로 분석 결과 테이블과 도형 테이블을 최신 상태로 반영한다. */
|
||||
@Transactional
|
||||
public InferenceResultShpDto.InferenceCntDto saveInferenceResultData(Long id) {
|
||||
return coreService.buildInferenceData(id);
|
||||
}
|
||||
|
||||
public void createShp(String uid, Long m1BatchId, Long m2BatchId, Long m3BatchId) {
|
||||
List<Long> batchIds = new ArrayList<>();
|
||||
batchIds.add(m1BatchId);
|
||||
batchIds.add(m2BatchId);
|
||||
batchIds.add(m3BatchId);
|
||||
|
||||
List<InferenceResultsTestingDto.ShpDto> resultList =
|
||||
inferenceResultCoreService.getInferenceResults(batchIds);
|
||||
String inferenceId = "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (InferenceResultsTestingDto.ShpDto dto : resultList) {
|
||||
if (dto.getMapId() == null) {
|
||||
continue;
|
||||
}
|
||||
if (!sb.isEmpty()) {
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append("\"").append(dto.getMapId()).append("\"");
|
||||
}
|
||||
inferenceId = uid;
|
||||
String mapIds = sb.toString();
|
||||
String batchId = m1BatchId + "," + m2BatchId + "," + m3BatchId;
|
||||
|
||||
// shp 파일 비동기 생성
|
||||
shpPipelineService.runPipeline(jarPath, datasetDir, batchId, inferenceId, mapIds);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user