Merge branch 'feat/infer_dev_260107' of https://10.100.0.10:3210/dabeeo/kamco-dabeeo-backoffice into feat/infer_dev_260107

This commit is contained in:
2026-01-14 17:26:10 +09:00
5 changed files with 193 additions and 135 deletions

View File

@@ -272,14 +272,14 @@ public class InferenceResultApiController {
content = content =
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
schema = @Schema(implementation = Page.class))), schema = @Schema(implementation = InferenceStatusDetailDto.class))),
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
}) })
@GetMapping("/status/{uuid}") @GetMapping("/status/{uuid}")
public ApiResponseDto<InferenceStatusDetailDto> getInferenceStatus( public ApiResponseDto<InferenceStatusDetailDto> getInferenceStatus(
@io.swagger.v3.oas.annotations.parameters.RequestBody( @io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "추론진행현왕 요청 정보", description = "추론 진행현 정보",
required = true) required = true)
@PathVariable @PathVariable
UUID uuid) { UUID uuid) {

View File

@@ -8,7 +8,6 @@ import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import java.time.Duration;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.Arrays; import java.util.Arrays;
@@ -234,140 +233,179 @@ public class InferenceResultDto {
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @Schema(name = "InferenceStatusDetailDto", description = "추론(변화탐지) 진행상태")
public static class InferenceStatusDetailDto { public static class InferenceStatusDetailDto {
@Schema(description = "탐지대상 도엽수")
private Long detectingCnt;
@Schema(description = "모델1 분석 대기")
private Integer m1PendingJobs;
@Schema(description = "모델2 분석 대기")
private Integer m2PendingJobs;
@Schema(description = "모델3 분석 대기")
private Integer m3PendingJobs;
@Schema(description = "모델1 분석 완료")
private Integer m1CompletedJobs;
@Schema(description = "모델2 분석 완료")
private Integer m2CompletedJobs;
@Schema(description = "모델3 분석 완료")
private Integer m3CompletedJobs;
@Schema(description = "모델1 분석 실패")
private Integer m1FailedJobs;
@Schema(description = "모델2 분석 실패")
private Integer m2FailedJobs;
@Schema(description = "모델3 분석 실패")
private Integer m3FailedJobs;
@Schema(description = "모델1 사용시간 시작일시")
@JsonFormatDttm
ZonedDateTime m1ModelStartDttm;
@Schema(description = "모델2 사용시간 시작일시")
@JsonFormatDttm
ZonedDateTime m2ModelStartDttm;
@Schema(description = "모델3 사용시간 시작일시")
@JsonFormatDttm
ZonedDateTime m3ModelStartDttm;
@Schema(description = "모델1 사용시간 종료일시")
@JsonFormatDttm
ZonedDateTime m1ModelEndDttm;
@Schema(description = "모델2 사용시간 종료일시")
@JsonFormatDttm
ZonedDateTime m2ModelEndDttm;
@Schema(description = "모델3 사용시간 종료일시")
@JsonFormatDttm
ZonedDateTime m3ModelEndDttm;
@Schema(description = "변화탐지 제목")
private String title; private String title;
@Schema(description = "비교년도")
private Integer compareYyyy; private Integer compareYyyy;
@Schema(description = "기준년도")
private Integer targetYyyy; private Integer targetYyyy;
@Schema(description = "회차")
private Integer stage;
@Schema(description = "변화탐지 시작")
@JsonFormatDttm
private ZonedDateTime inferStartDttm;
@Schema(description = "변화탐지 종료")
@JsonFormatDttm
private ZonedDateTime inferEndDttm;
@Schema(description = "변화탐지 옵션")
private String detectOption; private String detectOption;
@Schema(description = "분석도엽")
private String mapSheetScope; private String mapSheetScope;
@JsonFormatDttm private ZonedDateTime inferStartDttm;
@JsonFormatDttm private ZonedDateTime inferEndDttm;
private Long detectingCnt = 0L;
private Long detectingEndCnt = 0L;
@JsonFormatDttm private ZonedDateTime m1ModelStartDttm; @Schema(description = "모델1 버전")
@JsonFormatDttm private ZonedDateTime m1ModelEndDttm; private String modelVer1;
@JsonFormatDttm private ZonedDateTime m2ModelStartDttm;
@JsonFormatDttm private ZonedDateTime m2ModelEndDttm;
@JsonFormatDttm private ZonedDateTime m3ModelStartDttm;
@JsonFormatDttm private ZonedDateTime m3ModelEndDttm;
private String model1Ver; @Schema(description = "모델2 버전")
private String model2Ver; private String modelVer2;
private String model3Ver;
private String usedServerName; @Schema(description = "모델3 버전")
private String model1VerStatus = "PROCCESING"; private String modelVer3;
private String model1VerStatusName = "진행중";
private String model2VerStatus = "PROCCESING";
private String model2VerStatusName = "진행중";
private String model3VerStatus = "PROCCESING";
private String model3VerStatusName = "진행중";
public InferenceStatusDetailDto( public InferenceStatusDetailDto(
Long detectingCnt,
Integer m1PendingJobs,
Integer m2PendingJobs,
Integer m3PendingJobs,
Integer m1CompletedJobs,
Integer m2CompletedJobs,
Integer m3CompletedJobs,
Integer m1FailedJobs,
Integer m2FailedJobs,
Integer m3FailedJobs,
ZonedDateTime m1ModelStartDttm,
ZonedDateTime m2ModelStartDttm,
ZonedDateTime m3ModelStartDttm,
ZonedDateTime m1ModelEndDttm,
ZonedDateTime m2ModelEndDttm,
ZonedDateTime m3ModelEndDttm,
String title, String title,
Integer compareYyyy, Integer compareYyyy,
Integer targetYyyy, Integer targetYyyy,
String detectOption, Integer stage,
String mapSheetScope,
ZonedDateTime inferStartDttm, ZonedDateTime inferStartDttm,
ZonedDateTime inferEndDttm, ZonedDateTime inferEndDttm,
Long detectingCnt, String detectOption,
Long detectingEndCnt, String mapSheetScope,
ZonedDateTime m1ModelStartDttm, String modelVer1,
ZonedDateTime m1ModelEndDttm, String modelVer2,
ZonedDateTime m2ModelStartDttm, String modelVer3) {
ZonedDateTime m2ModelEndDttm, this.detectingCnt = detectingCnt;
ZonedDateTime m3ModelStartDttm, this.m1PendingJobs = m1PendingJobs;
ZonedDateTime m3ModelEndDttm, this.m2PendingJobs = m2PendingJobs;
String model1Ver, this.m3PendingJobs = m3PendingJobs;
String model2Ver, this.m1CompletedJobs = m1CompletedJobs;
String model3Ver) { this.m2CompletedJobs = m2CompletedJobs;
this.m3CompletedJobs = m3CompletedJobs;
this.m1FailedJobs = m1FailedJobs;
this.m2FailedJobs = m2FailedJobs;
this.m3FailedJobs = m3FailedJobs;
this.m1ModelStartDttm = m1ModelStartDttm;
this.m2ModelStartDttm = m2ModelStartDttm;
this.m3ModelStartDttm = m3ModelStartDttm;
this.m1ModelEndDttm = m1ModelEndDttm;
this.m2ModelEndDttm = m2ModelEndDttm;
this.m3ModelEndDttm = m3ModelEndDttm;
this.title = title; this.title = title;
this.compareYyyy = compareYyyy; this.compareYyyy = compareYyyy;
this.targetYyyy = targetYyyy; this.targetYyyy = targetYyyy;
this.detectOption = detectOption; this.stage = stage;
this.mapSheetScope = mapSheetScope;
this.inferStartDttm = inferStartDttm; this.inferStartDttm = inferStartDttm;
this.inferEndDttm = inferEndDttm; this.inferEndDttm = inferEndDttm;
this.detectingCnt = detectingCnt; this.detectOption = detectOption;
this.detectingEndCnt = detectingEndCnt; this.mapSheetScope = mapSheetScope;
this.m1ModelStartDttm = m1ModelStartDttm; this.modelVer1 = modelVer1;
this.m1ModelEndDttm = m1ModelEndDttm; this.modelVer2 = modelVer2;
this.m2ModelStartDttm = m2ModelStartDttm; this.modelVer3 = modelVer3;
this.m2ModelEndDttm = m2ModelEndDttm;
this.m3ModelStartDttm = m3ModelStartDttm;
this.m3ModelEndDttm = m3ModelEndDttm;
this.model1Ver = model1Ver;
this.model2Ver = model2Ver;
this.model3Ver = model3Ver;
if (this.detectingEndCnt == null) {
this.detectingEndCnt = 0L;
}
} }
public String getDetectOptionName() { @JsonProperty("progress")
if (this.detectOption.equals("EXCL")) { private int getProgress() {
return "추론제외"; long tiles = this.detectingCnt; // 도엽수
} int models = 3; // 모델 개수
return "이전 년도 도엽 사용"; int completed =
this.m1CompletedJobs
+ this.m2CompletedJobs
+ this.m3CompletedJobs
+ this.m1FailedJobs
+ this.m2FailedJobs
+ this.m3FailedJobs; // 완료수
long total = tiles * models; // 전체 작업량
return (int) ((completed * 100L) / total);
} }
public String getMapSheetScopeName() { @JsonProperty("detectOptionName")
if (this.mapSheetScope.equals("ALL")) { private String getDetectOptionName() {
return "전체"; return DetectOption.getDescByCode(this.detectOption);
}
return "부분";
} }
public double getDetectingRate() { @JsonProperty("mapSheetScopeName")
if (this.detectingCnt == null || this.detectingCnt == 0L) { private String getMapSheetScope() {
return 0.0; return MapSheetScope.getDescByCode(this.mapSheetScope);
}
if (this.detectingEndCnt == null) {
this.detectingEndCnt = 0L;
}
return (double) (this.detectingEndCnt / this.detectingCnt) * 100.0;
}
public String getM1Duration() {
if (this.m1ModelStartDttm == null || this.m1ModelEndDttm == null) {
return "00:00:00";
}
Duration duration = Duration.between(m1ModelStartDttm, m1ModelEndDttm);
long hours = duration.toHours();
long minutes = duration.toMinutesPart();
long seconds = duration.toSecondsPart();
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
}
public String getM2Duration() {
if (this.m2ModelStartDttm == null || this.m2ModelEndDttm == null) {
return "00:00:00";
}
Duration duration = Duration.between(this.m2ModelStartDttm, this.m2ModelEndDttm);
long hours = duration.toHours();
long minutes = duration.toMinutesPart();
long seconds = duration.toSecondsPart();
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
}
public String getM3Duration() {
if (this.m3ModelStartDttm == null || this.m3ModelEndDttm == null) {
return "00:00:00";
}
Duration duration = Duration.between(this.m3ModelStartDttm, this.m3ModelEndDttm);
long hours = duration.toHours();
long minutes = duration.toMinutesPart();
long seconds = duration.toSecondsPart();
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
} }
} }
@@ -453,6 +491,15 @@ public class InferenceResultDto {
} }
} }
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class InferenceStatusDetailDto2 {
InferenceServerStatusDto serverStatus;
}
@Getter @Getter
@Setter @Setter
@AllArgsConstructor @AllArgsConstructor

View File

@@ -465,23 +465,14 @@ public class InferenceResultService {
return inferenceResultCoreService.getInferenceServerStatusList(); return inferenceResultCoreService.getInferenceServerStatusList();
} }
/**
* 추론 진행 현황 상세
*
* @param uuid
* @return
*/
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) { public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
List<InferenceServerStatusDto> servers =
inferenceResultCoreService.getInferenceServerStatusList();
String serverNames = "";
for (InferenceServerStatusDto server : servers) {
if (serverNames.equals("")) {
serverNames = server.getServerName();
} else {
serverNames = serverNames + "," + server.getServerName();
}
}
InferenceStatusDetailDto dto = inferenceResultCoreService.getInferenceStatus(uuid); InferenceStatusDetailDto dto = inferenceResultCoreService.getInferenceStatus(uuid);
dto.setUsedServerName(serverNames);
return dto; return dto;
} }

View File

@@ -328,6 +328,11 @@ public class InferenceResultCoreService {
} }
} }
/**
* 서버 정보 조회
*
* @return
*/
public List<InferenceServerStatusDto> getInferenceServerStatusList() { public List<InferenceServerStatusDto> getInferenceServerStatusList() {
return mapSheetLearnRepository.getInferenceServerStatusList(); return mapSheetLearnRepository.getInferenceServerStatusList();
} }

View File

@@ -161,6 +161,12 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
.fetchOne()); .fetchOne());
} }
/**
* 추론 실행 진행 현황
*
* @param uuid
* @return
*/
@Override @Override
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) { public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
@@ -175,21 +181,30 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
.select( .select(
Projections.constructor( Projections.constructor(
InferenceStatusDetailDto.class, InferenceStatusDetailDto.class,
mapSheetLearnEntity.detectingCnt,
mapSheetLearnEntity.m1PendingJobs,
mapSheetLearnEntity.m2PendingJobs,
mapSheetLearnEntity.m3PendingJobs,
mapSheetLearnEntity.m1CompletedJobs,
mapSheetLearnEntity.m2CompletedJobs,
mapSheetLearnEntity.m3CompletedJobs,
mapSheetLearnEntity.m1FailedJobs,
mapSheetLearnEntity.m2FailedJobs,
mapSheetLearnEntity.m3FailedJobs,
mapSheetLearnEntity.m1ModelStartDttm,
mapSheetLearnEntity.m2ModelStartDttm,
mapSheetLearnEntity.m3ModelStartDttm,
mapSheetLearnEntity.m1ModelEndDttm,
mapSheetLearnEntity.m2ModelEndDttm,
mapSheetLearnEntity.m3ModelEndDttm,
mapSheetLearnEntity.title, mapSheetLearnEntity.title,
mapSheetLearnEntity.compareYyyy, mapSheetLearnEntity.compareYyyy,
mapSheetLearnEntity.targetYyyy, mapSheetLearnEntity.targetYyyy,
mapSheetLearnEntity.detectOption, mapSheetLearnEntity.stage,
mapSheetLearnEntity.mapSheetScope,
mapSheetLearnEntity.inferStartDttm, mapSheetLearnEntity.inferStartDttm,
mapSheetLearnEntity.inferEndDttm, mapSheetLearnEntity.inferEndDttm,
mapSheetLearnEntity.detectingCnt, mapSheetLearnEntity.detectOption,
mapSheetLearnEntity.detectEndCnt, mapSheetLearnEntity.mapSheetScope,
mapSheetLearnEntity.m1ModelStartDttm,
mapSheetLearnEntity.m1ModelEndDttm,
mapSheetLearnEntity.m2ModelStartDttm,
mapSheetLearnEntity.m2ModelEndDttm,
mapSheetLearnEntity.m3ModelStartDttm,
mapSheetLearnEntity.m3ModelEndDttm,
m1Model.modelVer.as("model1Ver"), m1Model.modelVer.as("model1Ver"),
m2Model.modelVer.as("model2Ver"), m2Model.modelVer.as("model2Ver"),
m3Model.modelVer.as("model3Ver"))) m3Model.modelVer.as("model3Ver")))