diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java b/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java index 005b32ff..154fed2d 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java @@ -8,6 +8,7 @@ import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; +import java.time.Duration; import java.time.LocalDate; import java.time.ZonedDateTime; import java.util.Arrays; @@ -210,6 +211,13 @@ public class InferenceResultDto { private Long detectingCnt = 0L; private Long detectingEndCnt = 0L; + @JsonFormatDttm private ZonedDateTime m1ModelStartDttm; + @JsonFormatDttm private ZonedDateTime m1ModelEndDttm; + @JsonFormatDttm private ZonedDateTime m2ModelStartDttm; + @JsonFormatDttm private ZonedDateTime m2ModelEndDttm; + @JsonFormatDttm private ZonedDateTime m3ModelStartDttm; + @JsonFormatDttm private ZonedDateTime m3ModelEndDttm; + private String model1Ver; private String model2Ver; private String model3Ver; @@ -224,6 +232,12 @@ public class InferenceResultDto { ZonedDateTime inferEndDttm, Long detectingCnt, Long detectingEndCnt, + ZonedDateTime m1ModelStartDttm, + ZonedDateTime m1ModelEndDttm, + ZonedDateTime m2ModelStartDttm, + ZonedDateTime m2ModelEndDttm, + ZonedDateTime m3ModelStartDttm, + ZonedDateTime m3ModelEndDttm, String model1Ver, String model2Ver, String model3Ver) { @@ -236,6 +250,12 @@ public class InferenceResultDto { this.inferEndDttm = inferEndDttm; this.detectingCnt = detectingCnt; this.detectingEndCnt = detectingEndCnt; + this.m1ModelStartDttm = m1ModelStartDttm; + this.m1ModelEndDttm = m1ModelEndDttm; + this.m2ModelStartDttm = m2ModelStartDttm; + this.m2ModelEndDttm = m2ModelEndDttm; + this.m3ModelStartDttm = m3ModelStartDttm; + this.m3ModelEndDttm = m3ModelEndDttm; this.model1Ver = model1Ver; this.model2Ver = model2Ver; this.model3Ver = model3Ver; @@ -272,6 +292,42 @@ public class InferenceResultDto { return (double) (this.detectingEndCnt / this.detectingCnt) * 100.0; } + public String getM1DurationFormatted() { + 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 getM2DurationFormatted() { + 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 getM3DurationFormatted() { + 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); + } + } @Getter diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/MapSheetLearnRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/MapSheetLearnRepositoryImpl.java index fe6c21f4..f5b541b2 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/MapSheetLearnRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/MapSheetLearnRepositoryImpl.java @@ -172,9 +172,11 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto mapSheetLearnEntity.inferEndDttm, mapSheetLearnEntity.detectingCnt, mapSheetLearnEntity.detectEndCnt, + m1Model.modelVer.as("model1Ver"), m2Model.modelVer.as("model2Ver"), m3Model.modelVer.as("model3Ver"))) + .from(mapSheetLearnEntity) .leftJoin(m1Model) .on(m1Model.uuid.eq(mapSheetLearnEntity.m1ModelUuid))