Merge remote-tracking branch 'origin/feat/infer_dev_260107' into feat/infer_dev_260107

This commit is contained in:
2026-01-14 15:24:22 +09:00
8 changed files with 173 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package com.kamco.cd.kamcoback.inference;
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceStatusDetailDto;
@@ -285,4 +286,25 @@ public class InferenceResultApiController {
return ApiResponseDto.ok(inferenceResultService.getInferenceStatus(uuid));
}
@Operation(summary = "추론결과 기본정보", description = "추론결과 기본정보")
@ApiResponses(
value = {
@ApiResponse(
responseCode = "200",
description = "검색 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = InferenceDetailDto.AnalResSummary.class))),
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@GetMapping("/infer-result-info")
public ApiResponseDto<InferenceDetailDto.AnalResultInfo> getInferenceResultInfo(
@Parameter(description = "회차 uuid", example = "932fbd72-2e8e-4a49-b189-09046787f9d1")
@RequestParam
String uuid) {
return ApiResponseDto.ok(inferenceResultService.getInferenceResultInfo(uuid));
}
}

View File

@@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.kamco.cd.kamcoback.common.enums.DetectionClassification;
import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.Duration;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.UUID;
@@ -409,4 +410,51 @@ public class InferenceDetailDto {
private UUID m2ModelUuid;
private UUID m3ModelUuid;
}
@Schema(name = "AnalResultInfo", description = "추론결과 기본정보")
@Getter
@AllArgsConstructor
@NoArgsConstructor
public static class AnalResultInfo {
private String analTitle;
private String modelVer1;
private String modelVer2;
private String modelVer3;
private Integer compareYyyy;
private Integer targetYyyy;
private String detectOption;
private String mapSheetScope;
@JsonFormatDttm private ZonedDateTime inferStartDttm;
@JsonFormatDttm private ZonedDateTime inferEndDttm;
private Duration elapsedDuration;
public AnalResultInfo(
String analTitle,
String modelVer1,
String modelVer2,
String modelVer3,
Integer compareYyyy,
Integer targetYyyy,
String detectOption,
String mapSheetScope,
ZonedDateTime inferStartDttm,
ZonedDateTime inferEndDttm) {
this.analTitle = analTitle;
this.modelVer1 = modelVer1;
this.modelVer2 = modelVer2;
this.modelVer3 = modelVer3;
this.compareYyyy = compareYyyy;
this.targetYyyy = targetYyyy;
this.detectOption = detectOption;
this.mapSheetScope = mapSheetScope;
this.inferStartDttm = inferStartDttm;
this.inferEndDttm = inferEndDttm;
this.elapsedDuration =
(inferStartDttm != null && inferEndDttm != null)
? Duration.between(inferStartDttm, inferEndDttm)
: null;
}
}
}

View File

@@ -7,6 +7,7 @@ import com.kamco.cd.kamcoback.common.exception.CustomApiException;
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;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.AnalResultInfo;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.Dashboard;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.Detail;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.MapSheet;
@@ -482,4 +483,8 @@ public class InferenceResultService {
return dto;
}
public AnalResultInfo getInferenceResultInfo(String uuid) {
return inferenceResultCoreService.getInferenceResultInfo(uuid);
}
}

View File

@@ -322,17 +322,40 @@ public class LabelAllocateDto {
@AllArgsConstructor
public static class WorkHistoryDto {
@Schema(description = "행 번호")
private Integer rowNum;
@Schema(description = "변화탐지년도", example = "2021-2022")
private String changeDetectionYear;
@Schema(description = "국유IN 회차")
private Long stage;
@Schema(description = "반영일")
private ZonedDateTime gukyuinApplyDttm;
@Schema(description = "할당건수")
private Long assignedCnt;
@Schema(description = "완료건수")
private Long completeCnt;
@Schema(description = "Skip건수")
private Long skipCnt;
@Schema(description = "잔여건수")
private Long remainCnt;
// private String status;
@Schema(description = "상태 (진행중/완료)")
private String status;
@Schema(description = "진행률 (%)")
private Double percent;
@Schema(description = "작업기간 시작일")
private ZonedDateTime createdDttm;
@Schema(description = "작업기간 종료일")
private ZonedDateTime projectCloseDttm;
}
}

View File

@@ -3,6 +3,7 @@ package com.kamco.cd.kamcoback.postgres.core;
import com.kamco.cd.kamcoback.common.exception.CustomApiException;
import com.kamco.cd.kamcoback.common.utils.UserUtil;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.AnalResultInfo;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.Dashboard;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.InferenceBatchSheet;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.MapSheet;
@@ -382,4 +383,8 @@ public class InferenceResultCoreService {
public Integer getLearnStage(Integer compareYear, Integer targetYear) {
return mapSheetLearnRepository.getLearnStage(compareYear, targetYear);
}
public AnalResultInfo getInferenceResultInfo(String uuid) {
return mapSheetLearnRepository.getInferenceResultInfo(uuid);
}
}

View File

@@ -1,5 +1,6 @@
package com.kamco.cd.kamcoback.postgres.repository.Inference;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.AnalResultInfo;
import com.kamco.cd.kamcoback.inference.dto.InferenceProgressDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto;
@@ -27,4 +28,6 @@ public interface MapSheetLearnRepositoryCustom {
UUID getProcessing();
Integer getLearnStage(Integer compareYear, Integer targetYear);
AnalResultInfo getInferenceResultInfo(String uuid);
}

View File

@@ -5,6 +5,7 @@ import static com.kamco.cd.kamcoback.postgres.entity.QMapSheetLearnEntity.mapShe
import static com.kamco.cd.kamcoback.postgres.entity.QSystemMetricEntity.systemMetricEntity;
import com.kamco.cd.kamcoback.common.utils.DateRange;
import com.kamco.cd.kamcoback.inference.dto.InferenceDetailDto.AnalResultInfo;
import com.kamco.cd.kamcoback.inference.dto.InferenceProgressDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto;
import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.InferenceServerStatusDto;
@@ -261,4 +262,35 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
return stage == null ? 1 : stage + 1;
}
@Override
public AnalResultInfo getInferenceResultInfo(String uuid) {
QModelMngEntity m1 = new QModelMngEntity("m1");
QModelMngEntity m2 = new QModelMngEntity("m2");
QModelMngEntity m3 = new QModelMngEntity("m3");
return queryFactory
.select(
Projections.constructor(
AnalResultInfo.class,
mapSheetLearnEntity.title,
m1.modelVer,
m2.modelVer,
m3.modelVer,
mapSheetLearnEntity.compareYyyy,
mapSheetLearnEntity.targetYyyy,
mapSheetLearnEntity.detectOption,
mapSheetLearnEntity.mapSheetScope,
mapSheetLearnEntity.inferStartDttm,
mapSheetLearnEntity.inferEndDttm))
.from(mapSheetLearnEntity)
.leftJoin(m1)
.on(mapSheetLearnEntity.m1ModelUuid.eq(m1.uuid))
.leftJoin(m2)
.on(mapSheetLearnEntity.m2ModelUuid.eq(m2.uuid))
.leftJoin(m3)
.on(mapSheetLearnEntity.m3ModelUuid.eq(m3.uuid))
.where(mapSheetLearnEntity.uuid.eq(UUID.fromString(uuid)))
.fetchOne();
}
}

View File

@@ -1514,12 +1514,20 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
mapSheetAnalInferenceEntity.createdDttm,
mapSheetAnalInferenceEntity.inspectionClosedYn,
mapSheetAnalInferenceEntity.updatedDttm)
.orderBy(mapSheetAnalInferenceEntity.id.desc())
.orderBy(
// 진행중인 작업이 최상단 (remainCnt > 0)
new CaseBuilder()
.when(totalCnt.subtract(completeCnt).subtract(skipCnt).gt(0L))
.then(0)
.otherwise(1)
.asc(),
// 최신 작업순 (반영일 기준)
mapSheetAnalInferenceEntity.gukyuinApplyDttm.desc())
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.fetch();
// rowNum remainCnt, percent를 Java에서 계산
// rowNum, remainCnt, percent, status를 Java에서 계산
int startRow = (int) pageable.getOffset() + 1;
for (int i = 0; i < list.size(); i++) {
WorkHistoryDto dto = list.get(i);
@@ -1537,6 +1545,13 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
} else {
dto.setPercent(0.0);
}
// status 계산 (잔여건수가 0이고 진행률이 100%면 "완료", 아니면 "진행중")
if (dto.getRemainCnt() == 0 && dto.getPercent() >= 100.0) {
dto.setStatus("완료");
} else {
dto.setStatus("진행중");
}
}
Long countQuery =
@@ -1605,12 +1620,20 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
mapSheetAnalInferenceEntity.createdDttm,
mapSheetAnalInferenceEntity.inspectionClosedYn,
mapSheetAnalInferenceEntity.updatedDttm)
.orderBy(mapSheetAnalInferenceEntity.id.desc())
.orderBy(
// 진행중인 작업이 최상단 (remainCnt > 0)
new CaseBuilder()
.when(totalCnt.subtract(completeCnt).subtract(skipCnt).gt(0L))
.then(0)
.otherwise(1)
.asc(),
// 최신 작업순 (반영일 기준)
mapSheetAnalInferenceEntity.gukyuinApplyDttm.desc())
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.fetch();
// rowNum remainCnt, percent를 Java에서 계산
// rowNum, remainCnt, percent, status를 Java에서 계산
int startRow = (int) pageable.getOffset() + 1;
for (int i = 0; i < list.size(); i++) {
WorkHistoryDto dto = list.get(i);
@@ -1628,6 +1651,13 @@ public class LabelAllocateRepositoryImpl implements LabelAllocateRepositoryCusto
} else {
dto.setPercent(0.0);
}
// status 계산 (잔여건수가 0이고 진행률이 100%면 "완료", 아니면 "진행중")
if (dto.getRemainCnt() == 0 && dto.getPercent() >= 100.0) {
dto.setStatus("완료");
} else {
dto.setStatus("진행중");
}
}
Long countQuery =