From 5599889ac04ec48899ae4c650006044302040a00 Mon Sep 17 00:00:00 2001 From: DanielLee <198891672+sanghyeonhd@users.noreply.github.com> Date: Wed, 14 Jan 2026 15:01:38 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=EB=9D=BC=EB=B2=A8=EB=A7=81=20=EC=9E=91?= =?UTF-8?q?=EC=97=85=EC=9D=B4=EB=A0=A5=20=EC=88=98=EC=A0=95,=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kamcoback/label/dto/LabelAllocateDto.java | 25 +++++++++++- .../label/LabelAllocateRepositoryImpl.java | 38 +++++++++++++++++-- 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/label/dto/LabelAllocateDto.java b/src/main/java/com/kamco/cd/kamcoback/label/dto/LabelAllocateDto.java index be15d446..9f0663e8 100644 --- a/src/main/java/com/kamco/cd/kamcoback/label/dto/LabelAllocateDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/label/dto/LabelAllocateDto.java @@ -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; } } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java index 685a8217..358e9f4f 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java @@ -1515,12 +1515,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); @@ -1538,6 +1546,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 = @@ -1606,12 +1621,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); @@ -1629,6 +1652,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 = From af428423c912e7b8aa87c420a342649d0dde5698 Mon Sep 17 00:00:00 2001 From: "gayoun.park" Date: Wed, 14 Jan 2026 15:14:36 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=EC=B6=94=EB=A1=A0=EA=B2=B0=EA=B3=BC=20>=20?= =?UTF-8?q?=EA=B8=B0=EB=B3=B8=EC=A0=95=EB=B3=B4=20=EC=9E=91=EC=97=85=20?= =?UTF-8?q?=EC=A7=84=ED=96=89=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InferenceResultApiController.java | 22 ++ .../inference/dto/InferenceDetailDto.java | 177 +++++++---- .../service/InferenceResultService.java | 5 + .../core/InferenceResultCoreService.java | 5 + .../MapSheetLearnRepositoryCustom.java | 3 + .../MapSheetLearnRepositoryImpl.java | 289 ++++++++++-------- 6 files changed, 314 insertions(+), 187 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java b/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java index 9f339b70..99fe158d 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java @@ -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 getInferenceResultInfo( + @Parameter(description = "회차 uuid", example = "932fbd72-2e8e-4a49-b189-09046787f9d1") + @RequestParam + String uuid) { + return ApiResponseDto.ok(inferenceResultService.getInferenceResultInfo(uuid)); + } } diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceDetailDto.java b/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceDetailDto.java index 31fedefb..fcffc19c 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceDetailDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceDetailDto.java @@ -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; @@ -29,20 +30,22 @@ public class InferenceDetailDto { private String dataName; private Long mapSheepNum; private Long detectingCnt; - @JsonFormatDttm private ZonedDateTime analStrtDttm; - @JsonFormatDttm private ZonedDateTime analEndDttm; + @JsonFormatDttm + private ZonedDateTime analStrtDttm; + @JsonFormatDttm + private ZonedDateTime analEndDttm; private Long analSec; private String analState; public Basic( - Long id, - String dataName, - Long mapSheepNum, - Long detectingCnt, - ZonedDateTime analStrtDttm, - ZonedDateTime analEndDttm, - Long analSec, - String analState) { + Long id, + String dataName, + Long mapSheepNum, + Long detectingCnt, + ZonedDateTime analStrtDttm, + ZonedDateTime analEndDttm, + Long analSec, + String analState) { this.id = id; this.dataName = dataName; this.mapSheepNum = mapSheepNum; @@ -61,8 +64,10 @@ public class InferenceDetailDto { private Long id; private String analTitle; private Long detectingCnt; - @JsonFormatDttm private ZonedDateTime analStrtDttm; - @JsonFormatDttm private ZonedDateTime analEndDttm; + @JsonFormatDttm + private ZonedDateTime analStrtDttm; + @JsonFormatDttm + private ZonedDateTime analEndDttm; private Long analSec; private Long analPredSec; private String analState; @@ -70,16 +75,16 @@ public class InferenceDetailDto { private String gukyuinUsed; public AnalResList( - Long id, - String analTitle, - Long detectingCnt, - ZonedDateTime analStrtDttm, - ZonedDateTime analEndDttm, - Long analSec, - Long analPredSec, - String analState, - String analStateNm, - String gukyuinUsed) { + Long id, + String analTitle, + Long detectingCnt, + ZonedDateTime analStrtDttm, + ZonedDateTime analEndDttm, + Long analSec, + Long analPredSec, + String analState, + String analStateNm, + String gukyuinUsed) { this.id = id; this.analTitle = analTitle; this.detectingCnt = detectingCnt; @@ -102,8 +107,10 @@ public class InferenceDetailDto { private String modelInfo; private Integer targetYyyy; private Integer compareYyyy; - @JsonFormatDttm private ZonedDateTime analStrtDttm; - @JsonFormatDttm private ZonedDateTime analEndDttm; + @JsonFormatDttm + private ZonedDateTime analStrtDttm; + @JsonFormatDttm + private ZonedDateTime analEndDttm; private Long analSec; private Long analPredSec; private String resultUrl; @@ -113,20 +120,20 @@ public class InferenceDetailDto { private String analStateNm; public AnalResSummary( - Long id, - String analTitle, - String modelInfo, - Integer targetYyyy, - Integer compareYyyy, - ZonedDateTime analStrtDttm, - ZonedDateTime analEndDttm, - Long analSec, - Long analPredSec, - String resultUrl, - Long detectingCnt, - Double accuracy, - String analState, - String analStateNm) { + Long id, + String analTitle, + String modelInfo, + Integer targetYyyy, + Integer compareYyyy, + ZonedDateTime analStrtDttm, + ZonedDateTime analEndDttm, + Long analSec, + Long analPredSec, + String resultUrl, + Long detectingCnt, + Double accuracy, + String analState, + String analStateNm) { this.id = id; this.analTitle = analTitle; this.modelInfo = modelInfo; @@ -183,16 +190,17 @@ public class InferenceDetailDto { private Clazzes target; private MapSheet mapSheet; private Coordinate center; - @JsonFormatDttm private ZonedDateTime updatedDttm; + @JsonFormatDttm + private ZonedDateTime updatedDttm; public DetailListEntity( - UUID uuid, - Double detectionScore, - Clazzes compare, - Clazzes target, - MapSheet mapSheet, - Coordinate center, - ZonedDateTime updatedDttm) { + UUID uuid, + Double detectionScore, + Clazzes compare, + Clazzes target, + MapSheet mapSheet, + Coordinate center, + ZonedDateTime updatedDttm) { this.code = new Uid(uuid); this.detectionScore = detectionScore; this.compare = compare; @@ -233,7 +241,8 @@ public class InferenceDetailDto { private String code; private String name; - @JsonIgnore private Double score; + @JsonIgnore + private Double score; public Clazz(String code, Double score) { this.code = code; @@ -300,21 +309,23 @@ public class InferenceDetailDto { String classAfterName; Double classAfterProb; Long mapSheetNum; - @JsonIgnore String gemoStr; - @JsonIgnore String geomCenterStr; + @JsonIgnore + String gemoStr; + @JsonIgnore + String geomCenterStr; JsonNode gemo; JsonNode geomCenter; public Geom( - Integer compareYyyy, - Integer targetYyyy, - String classBeforeCd, - Double classBeforeProb, - String classAfterCd, - Double classAfterProb, - Long mapSheetNum, - String gemoStr, - String geomCenterStr) { + Integer compareYyyy, + Integer targetYyyy, + String classBeforeCd, + Double classBeforeProb, + String classAfterCd, + Double classAfterProb, + Long mapSheetNum, + String gemoStr, + String geomCenterStr) { this.compareYyyy = compareYyyy; this.targetYyyy = targetYyyy; this.classBeforeCd = classBeforeCd; @@ -385,7 +396,7 @@ public class InferenceDetailDto { String[] sortParams = sort.split(","); String property = sortParams[0]; Sort.Direction direction = - sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC; + sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC; return PageRequest.of(page, size, Sort.by(direction, property)); } return PageRequest.of(page, size); @@ -409,4 +420,52 @@ 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; + } + } } diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/service/InferenceResultService.java b/src/main/java/com/kamco/cd/kamcoback/inference/service/InferenceResultService.java index 617b8bbc..19ba493c 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/service/InferenceResultService.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/service/InferenceResultService.java @@ -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; @@ -480,4 +481,8 @@ public class InferenceResultService { return dto; } + + public AnalResultInfo getInferenceResultInfo(String uuid) { + return inferenceResultCoreService.getInferenceResultInfo(uuid); + } } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/core/InferenceResultCoreService.java b/src/main/java/com/kamco/cd/kamcoback/postgres/core/InferenceResultCoreService.java index a7347cdd..1f1489ba 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/core/InferenceResultCoreService.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/core/InferenceResultCoreService.java @@ -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; @@ -370,4 +371,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); + } } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/MapSheetLearnRepositoryCustom.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/MapSheetLearnRepositoryCustom.java index 3a5e4dd4..5e8ec142 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/MapSheetLearnRepositoryCustom.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/MapSheetLearnRepositoryCustom.java @@ -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); } 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 be97f06e..29945e13 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 @@ -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; @@ -40,7 +41,7 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto BooleanBuilder builder = new BooleanBuilder(); NumberExpression statusOrder = - new CaseBuilder().when(mapSheetLearnEntity.status.eq("Y")).then(0).otherwise(1); + new CaseBuilder().when(mapSheetLearnEntity.status.eq("Y")).then(0).otherwise(1); // 국유인 반영 여부 if (StringUtils.isNotBlank(req.getApplyYn())) { @@ -54,10 +55,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto // 국유인 반영일 if (req.getStrtDttm() != null && req.getEndDttm() != null) { builder.and( - mapSheetLearnEntity - .applyDttm - .goe(DateRange.start(req.getStrtDttm())) - .and(mapSheetLearnEntity.applyDttm.lt(DateRange.end(req.getEndDttm())))); + mapSheetLearnEntity + .applyDttm + .goe(DateRange.start(req.getStrtDttm())) + .and(mapSheetLearnEntity.applyDttm.lt(DateRange.end(req.getEndDttm())))); } // 제목 @@ -66,21 +67,21 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto } List content = - queryFactory - .select(mapSheetLearnEntity) - .from(mapSheetLearnEntity) - .where(builder) - .offset(pageable.getOffset()) - .limit(pageable.getPageSize()) - .orderBy(mapSheetLearnEntity.id.desc()) - .fetch(); + queryFactory + .select(mapSheetLearnEntity) + .from(mapSheetLearnEntity) + .where(builder) + .offset(pageable.getOffset()) + .limit(pageable.getPageSize()) + .orderBy(mapSheetLearnEntity.id.desc()) + .fetch(); Long total = - queryFactory - .select(mapSheetLearnEntity.count()) - .from(mapSheetLearnEntity) - .where(builder) - .fetchOne(); + queryFactory + .select(mapSheetLearnEntity.count()) + .from(mapSheetLearnEntity) + .where(builder) + .fetchOne(); return new PageImpl<>(content, pageable, total == null ? 0L : total); } @@ -88,10 +89,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto @Override public Optional getInferenceResultByUuid(UUID uuid) { return Optional.ofNullable( - queryFactory - .selectFrom(mapSheetLearnEntity) - .where(mapSheetLearnEntity.uuid.eq(uuid)) - .fetchOne()); + queryFactory + .selectFrom(mapSheetLearnEntity) + .where(mapSheetLearnEntity.uuid.eq(uuid)) + .fetchOne()); } @Override @@ -100,41 +101,41 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto BooleanBuilder builder = new BooleanBuilder(); List latestIds = - queryFactory - .select(systemMetricEntity.id1.max()) - .from(systemMetricEntity) - .groupBy(systemMetricEntity.serverName) - .fetch(); + queryFactory + .select(systemMetricEntity.id1.max()) + .from(systemMetricEntity) + .groupBy(systemMetricEntity.serverName) + .fetch(); List latestGpuIds = - queryFactory - .select(gpuMetricEntity.id1.max()) - .from(gpuMetricEntity) - .groupBy(gpuMetricEntity.serverName) - .fetch(); + queryFactory + .select(gpuMetricEntity.id1.max()) + .from(gpuMetricEntity) + .groupBy(gpuMetricEntity.serverName) + .fetch(); List foundContent = - queryFactory - .select( - Projections.constructor( - InferenceServerStatusDto.class, - systemMetricEntity.serverName, - systemMetricEntity.cpuUser, - systemMetricEntity.cpuSystem, - systemMetricEntity.memused, - systemMetricEntity.kbmemused, - gpuMetricEntity.gpuUtil)) - .from(systemMetricEntity) - .leftJoin(gpuMetricEntity) - .on( - gpuMetricEntity - .id1 - .in(latestGpuIds) - .and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName))) - .where(systemMetricEntity.id1.in(latestIds)) // In 절 사용 - .orderBy(systemMetricEntity.serverName.asc()) - .limit(4) - .fetch(); + queryFactory + .select( + Projections.constructor( + InferenceServerStatusDto.class, + systemMetricEntity.serverName, + systemMetricEntity.cpuUser, + systemMetricEntity.cpuSystem, + systemMetricEntity.memused, + systemMetricEntity.kbmemused, + gpuMetricEntity.gpuUtil)) + .from(systemMetricEntity) + .leftJoin(gpuMetricEntity) + .on( + gpuMetricEntity + .id1 + .in(latestGpuIds) + .and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName))) + .where(systemMetricEntity.id1.in(latestIds)) // In 절 사용 + .orderBy(systemMetricEntity.serverName.asc()) + .limit(4) + .fetch(); return foundContent; } @@ -142,11 +143,11 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto @Override public Optional getInferenceResultByStatus(String status) { return Optional.ofNullable( - queryFactory - .selectFrom(mapSheetLearnEntity) - .where(mapSheetLearnEntity.status.eq(status)) - .limit(1) - .fetchOne()); + queryFactory + .selectFrom(mapSheetLearnEntity) + .where(mapSheetLearnEntity.status.eq(status)) + .limit(1) + .fetchOne()); } @Override @@ -159,37 +160,37 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto QModelMngEntity m3Model = new QModelMngEntity("m3Model"); InferenceStatusDetailDto foundContent = - queryFactory - .select( - Projections.constructor( - InferenceStatusDetailDto.class, - mapSheetLearnEntity.title, - mapSheetLearnEntity.compareYyyy, - mapSheetLearnEntity.targetYyyy, - mapSheetLearnEntity.detectOption, - mapSheetLearnEntity.mapSheetScope, - mapSheetLearnEntity.inferStartDttm, - mapSheetLearnEntity.inferEndDttm, - mapSheetLearnEntity.detectingCnt, - mapSheetLearnEntity.detectEndCnt, - mapSheetLearnEntity.m1ModelStartDttm, - mapSheetLearnEntity.m1ModelEndDttm, - mapSheetLearnEntity.m2ModelStartDttm, - mapSheetLearnEntity.m2ModelEndDttm, - mapSheetLearnEntity.m3ModelStartDttm, - mapSheetLearnEntity.m3ModelEndDttm, - m1Model.modelVer.as("model1Ver"), - m2Model.modelVer.as("model2Ver"), - m3Model.modelVer.as("model3Ver"))) - .from(mapSheetLearnEntity) - .leftJoin(m1Model) - .on(m1Model.uuid.eq(mapSheetLearnEntity.m1ModelUuid)) - .leftJoin(m2Model) - .on(m2Model.uuid.eq(mapSheetLearnEntity.m2ModelUuid)) - .leftJoin(m3Model) - .on(m3Model.uuid.eq(mapSheetLearnEntity.m3ModelUuid)) - .where(mapSheetLearnEntity.uuid.eq(uuid)) - .fetchOne(); + queryFactory + .select( + Projections.constructor( + InferenceStatusDetailDto.class, + mapSheetLearnEntity.title, + mapSheetLearnEntity.compareYyyy, + mapSheetLearnEntity.targetYyyy, + mapSheetLearnEntity.detectOption, + mapSheetLearnEntity.mapSheetScope, + mapSheetLearnEntity.inferStartDttm, + mapSheetLearnEntity.inferEndDttm, + mapSheetLearnEntity.detectingCnt, + mapSheetLearnEntity.detectEndCnt, + mapSheetLearnEntity.m1ModelStartDttm, + mapSheetLearnEntity.m1ModelEndDttm, + mapSheetLearnEntity.m2ModelStartDttm, + mapSheetLearnEntity.m2ModelEndDttm, + mapSheetLearnEntity.m3ModelStartDttm, + mapSheetLearnEntity.m3ModelEndDttm, + m1Model.modelVer.as("model1Ver"), + m2Model.modelVer.as("model2Ver"), + m3Model.modelVer.as("model3Ver"))) + .from(mapSheetLearnEntity) + .leftJoin(m1Model) + .on(m1Model.uuid.eq(mapSheetLearnEntity.m1ModelUuid)) + .leftJoin(m2Model) + .on(m2Model.uuid.eq(mapSheetLearnEntity.m2ModelUuid)) + .leftJoin(m3Model) + .on(m3Model.uuid.eq(mapSheetLearnEntity.m3ModelUuid)) + .where(mapSheetLearnEntity.uuid.eq(uuid)) + .fetchOne(); return foundContent; } @@ -200,30 +201,30 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto QModelMngEntity model = new QModelMngEntity("model"); InferenceProgressDto dto = - queryFactory - .select( - Projections.constructor( - InferenceProgressDto.class, - Projections.constructor( - InferenceProgressDto.pred_requests_areas.class, - mapSheetLearnEntity.compareYyyy, - mapSheetLearnEntity.targetYyyy, - mapSheetLearnEntity.modelComparePath, - mapSheetLearnEntity.modelTargetPath), - model.modelVer.as("modelVer"), - model.cdModelPath.as("cdModelPath"), - model.cdModelFileName.as("cdModelFileName"), - model.cdModelConfigPath.as("cdModelConfigPath"), - model.cdModelConfigFileName.as("cdModelConfigFileName"), - model.clsModelPath, - model.clsModelFileName, - model.clsModelVersion, - model.priority)) - .from(mapSheetLearnEntity) - .join(model) - .on(model.uuid.eq(modelUuid)) - .where(mapSheetLearnEntity.id.eq(id)) - .fetchOne(); + queryFactory + .select( + Projections.constructor( + InferenceProgressDto.class, + Projections.constructor( + InferenceProgressDto.pred_requests_areas.class, + mapSheetLearnEntity.compareYyyy, + mapSheetLearnEntity.targetYyyy, + mapSheetLearnEntity.modelComparePath, + mapSheetLearnEntity.modelTargetPath), + model.modelVer.as("modelVer"), + model.cdModelPath.as("cdModelPath"), + model.cdModelFileName.as("cdModelFileName"), + model.cdModelConfigPath.as("cdModelConfigPath"), + model.cdModelConfigFileName.as("cdModelConfigFileName"), + model.clsModelPath, + model.clsModelFileName, + model.clsModelVersion, + model.priority)) + .from(mapSheetLearnEntity) + .join(model) + .on(model.uuid.eq(modelUuid)) + .where(mapSheetLearnEntity.id.eq(id)) + .fetchOne(); return dto; } @@ -234,10 +235,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto */ public UUID getProcessing() { return queryFactory - .select(mapSheetLearnEntity.uuid) - .from(mapSheetLearnEntity) - .where(mapSheetLearnEntity.status.eq("IN_PROGRESS")) - .fetchOne(); + .select(mapSheetLearnEntity.uuid) + .from(mapSheetLearnEntity) + .where(mapSheetLearnEntity.status.eq("IN_PROGRESS")) + .fetchOne(); } @Override @@ -247,18 +248,50 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto entity.setTargetYyyy(targetYear); Integer stage = - queryFactory - .select(mapSheetLearnEntity.stage) - .from(mapSheetLearnEntity) - .where( - mapSheetLearnEntity - .compareYyyy - .eq(compareYear) - .and(mapSheetLearnEntity.targetYyyy.eq(targetYear))) - .orderBy(mapSheetLearnEntity.stage.desc()) - .limit(1) - .fetchOne(); + queryFactory + .select(mapSheetLearnEntity.stage) + .from(mapSheetLearnEntity) + .where( + mapSheetLearnEntity + .compareYyyy + .eq(compareYear) + .and(mapSheetLearnEntity.targetYyyy.eq(targetYear))) + .orderBy(mapSheetLearnEntity.stage.desc()) + .limit(1) + .fetchOne(); 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(); + } } From 50b8585c76c21b3a5bf3b35e46fa4a5e6737024d Mon Sep 17 00:00:00 2001 From: "gayoun.park" Date: Wed, 14 Jan 2026 15:15:11 +0900 Subject: [PATCH 3/3] spotless --- .../inference/dto/InferenceDetailDto.java | 163 +++++----- .../MapSheetLearnRepositoryImpl.java | 301 +++++++++--------- .../label/LabelAllocateRepositoryImpl.java | 1 - 3 files changed, 226 insertions(+), 239 deletions(-) diff --git a/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceDetailDto.java b/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceDetailDto.java index fcffc19c..88a844de 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceDetailDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceDetailDto.java @@ -30,22 +30,20 @@ public class InferenceDetailDto { private String dataName; private Long mapSheepNum; private Long detectingCnt; - @JsonFormatDttm - private ZonedDateTime analStrtDttm; - @JsonFormatDttm - private ZonedDateTime analEndDttm; + @JsonFormatDttm private ZonedDateTime analStrtDttm; + @JsonFormatDttm private ZonedDateTime analEndDttm; private Long analSec; private String analState; public Basic( - Long id, - String dataName, - Long mapSheepNum, - Long detectingCnt, - ZonedDateTime analStrtDttm, - ZonedDateTime analEndDttm, - Long analSec, - String analState) { + Long id, + String dataName, + Long mapSheepNum, + Long detectingCnt, + ZonedDateTime analStrtDttm, + ZonedDateTime analEndDttm, + Long analSec, + String analState) { this.id = id; this.dataName = dataName; this.mapSheepNum = mapSheepNum; @@ -64,10 +62,8 @@ public class InferenceDetailDto { private Long id; private String analTitle; private Long detectingCnt; - @JsonFormatDttm - private ZonedDateTime analStrtDttm; - @JsonFormatDttm - private ZonedDateTime analEndDttm; + @JsonFormatDttm private ZonedDateTime analStrtDttm; + @JsonFormatDttm private ZonedDateTime analEndDttm; private Long analSec; private Long analPredSec; private String analState; @@ -75,16 +71,16 @@ public class InferenceDetailDto { private String gukyuinUsed; public AnalResList( - Long id, - String analTitle, - Long detectingCnt, - ZonedDateTime analStrtDttm, - ZonedDateTime analEndDttm, - Long analSec, - Long analPredSec, - String analState, - String analStateNm, - String gukyuinUsed) { + Long id, + String analTitle, + Long detectingCnt, + ZonedDateTime analStrtDttm, + ZonedDateTime analEndDttm, + Long analSec, + Long analPredSec, + String analState, + String analStateNm, + String gukyuinUsed) { this.id = id; this.analTitle = analTitle; this.detectingCnt = detectingCnt; @@ -107,10 +103,8 @@ public class InferenceDetailDto { private String modelInfo; private Integer targetYyyy; private Integer compareYyyy; - @JsonFormatDttm - private ZonedDateTime analStrtDttm; - @JsonFormatDttm - private ZonedDateTime analEndDttm; + @JsonFormatDttm private ZonedDateTime analStrtDttm; + @JsonFormatDttm private ZonedDateTime analEndDttm; private Long analSec; private Long analPredSec; private String resultUrl; @@ -120,20 +114,20 @@ public class InferenceDetailDto { private String analStateNm; public AnalResSummary( - Long id, - String analTitle, - String modelInfo, - Integer targetYyyy, - Integer compareYyyy, - ZonedDateTime analStrtDttm, - ZonedDateTime analEndDttm, - Long analSec, - Long analPredSec, - String resultUrl, - Long detectingCnt, - Double accuracy, - String analState, - String analStateNm) { + Long id, + String analTitle, + String modelInfo, + Integer targetYyyy, + Integer compareYyyy, + ZonedDateTime analStrtDttm, + ZonedDateTime analEndDttm, + Long analSec, + Long analPredSec, + String resultUrl, + Long detectingCnt, + Double accuracy, + String analState, + String analStateNm) { this.id = id; this.analTitle = analTitle; this.modelInfo = modelInfo; @@ -190,17 +184,16 @@ public class InferenceDetailDto { private Clazzes target; private MapSheet mapSheet; private Coordinate center; - @JsonFormatDttm - private ZonedDateTime updatedDttm; + @JsonFormatDttm private ZonedDateTime updatedDttm; public DetailListEntity( - UUID uuid, - Double detectionScore, - Clazzes compare, - Clazzes target, - MapSheet mapSheet, - Coordinate center, - ZonedDateTime updatedDttm) { + UUID uuid, + Double detectionScore, + Clazzes compare, + Clazzes target, + MapSheet mapSheet, + Coordinate center, + ZonedDateTime updatedDttm) { this.code = new Uid(uuid); this.detectionScore = detectionScore; this.compare = compare; @@ -241,8 +234,7 @@ public class InferenceDetailDto { private String code; private String name; - @JsonIgnore - private Double score; + @JsonIgnore private Double score; public Clazz(String code, Double score) { this.code = code; @@ -309,23 +301,21 @@ public class InferenceDetailDto { String classAfterName; Double classAfterProb; Long mapSheetNum; - @JsonIgnore - String gemoStr; - @JsonIgnore - String geomCenterStr; + @JsonIgnore String gemoStr; + @JsonIgnore String geomCenterStr; JsonNode gemo; JsonNode geomCenter; public Geom( - Integer compareYyyy, - Integer targetYyyy, - String classBeforeCd, - Double classBeforeProb, - String classAfterCd, - Double classAfterProb, - Long mapSheetNum, - String gemoStr, - String geomCenterStr) { + Integer compareYyyy, + Integer targetYyyy, + String classBeforeCd, + Double classBeforeProb, + String classAfterCd, + Double classAfterProb, + Long mapSheetNum, + String gemoStr, + String geomCenterStr) { this.compareYyyy = compareYyyy; this.targetYyyy = targetYyyy; this.classBeforeCd = classBeforeCd; @@ -396,7 +386,7 @@ public class InferenceDetailDto { String[] sortParams = sort.split(","); String property = sortParams[0]; Sort.Direction direction = - sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC; + sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC; return PageRequest.of(page, size, Sort.by(direction, property)); } return PageRequest.of(page, size); @@ -435,24 +425,22 @@ public class InferenceDetailDto { private Integer targetYyyy; private String detectOption; private String mapSheetScope; - @JsonFormatDttm - private ZonedDateTime inferStartDttm; - @JsonFormatDttm - private ZonedDateTime inferEndDttm; + @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 - ) { + 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; @@ -463,9 +451,10 @@ public class InferenceDetailDto { this.mapSheetScope = mapSheetScope; this.inferStartDttm = inferStartDttm; this.inferEndDttm = inferEndDttm; - this.elapsedDuration = (inferStartDttm != null && inferEndDttm != null) - ? Duration.between(inferStartDttm, inferEndDttm) - : null; + this.elapsedDuration = + (inferStartDttm != null && inferEndDttm != null) + ? Duration.between(inferStartDttm, inferEndDttm) + : null; } } } 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 29945e13..2c471fee 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 @@ -41,7 +41,7 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto BooleanBuilder builder = new BooleanBuilder(); NumberExpression statusOrder = - new CaseBuilder().when(mapSheetLearnEntity.status.eq("Y")).then(0).otherwise(1); + new CaseBuilder().when(mapSheetLearnEntity.status.eq("Y")).then(0).otherwise(1); // 국유인 반영 여부 if (StringUtils.isNotBlank(req.getApplyYn())) { @@ -55,10 +55,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto // 국유인 반영일 if (req.getStrtDttm() != null && req.getEndDttm() != null) { builder.and( - mapSheetLearnEntity - .applyDttm - .goe(DateRange.start(req.getStrtDttm())) - .and(mapSheetLearnEntity.applyDttm.lt(DateRange.end(req.getEndDttm())))); + mapSheetLearnEntity + .applyDttm + .goe(DateRange.start(req.getStrtDttm())) + .and(mapSheetLearnEntity.applyDttm.lt(DateRange.end(req.getEndDttm())))); } // 제목 @@ -67,21 +67,21 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto } List content = - queryFactory - .select(mapSheetLearnEntity) - .from(mapSheetLearnEntity) - .where(builder) - .offset(pageable.getOffset()) - .limit(pageable.getPageSize()) - .orderBy(mapSheetLearnEntity.id.desc()) - .fetch(); + queryFactory + .select(mapSheetLearnEntity) + .from(mapSheetLearnEntity) + .where(builder) + .offset(pageable.getOffset()) + .limit(pageable.getPageSize()) + .orderBy(mapSheetLearnEntity.id.desc()) + .fetch(); Long total = - queryFactory - .select(mapSheetLearnEntity.count()) - .from(mapSheetLearnEntity) - .where(builder) - .fetchOne(); + queryFactory + .select(mapSheetLearnEntity.count()) + .from(mapSheetLearnEntity) + .where(builder) + .fetchOne(); return new PageImpl<>(content, pageable, total == null ? 0L : total); } @@ -89,10 +89,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto @Override public Optional getInferenceResultByUuid(UUID uuid) { return Optional.ofNullable( - queryFactory - .selectFrom(mapSheetLearnEntity) - .where(mapSheetLearnEntity.uuid.eq(uuid)) - .fetchOne()); + queryFactory + .selectFrom(mapSheetLearnEntity) + .where(mapSheetLearnEntity.uuid.eq(uuid)) + .fetchOne()); } @Override @@ -101,41 +101,41 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto BooleanBuilder builder = new BooleanBuilder(); List latestIds = - queryFactory - .select(systemMetricEntity.id1.max()) - .from(systemMetricEntity) - .groupBy(systemMetricEntity.serverName) - .fetch(); + queryFactory + .select(systemMetricEntity.id1.max()) + .from(systemMetricEntity) + .groupBy(systemMetricEntity.serverName) + .fetch(); List latestGpuIds = - queryFactory - .select(gpuMetricEntity.id1.max()) - .from(gpuMetricEntity) - .groupBy(gpuMetricEntity.serverName) - .fetch(); + queryFactory + .select(gpuMetricEntity.id1.max()) + .from(gpuMetricEntity) + .groupBy(gpuMetricEntity.serverName) + .fetch(); List foundContent = - queryFactory - .select( - Projections.constructor( - InferenceServerStatusDto.class, - systemMetricEntity.serverName, - systemMetricEntity.cpuUser, - systemMetricEntity.cpuSystem, - systemMetricEntity.memused, - systemMetricEntity.kbmemused, - gpuMetricEntity.gpuUtil)) - .from(systemMetricEntity) - .leftJoin(gpuMetricEntity) - .on( - gpuMetricEntity - .id1 - .in(latestGpuIds) - .and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName))) - .where(systemMetricEntity.id1.in(latestIds)) // In 절 사용 - .orderBy(systemMetricEntity.serverName.asc()) - .limit(4) - .fetch(); + queryFactory + .select( + Projections.constructor( + InferenceServerStatusDto.class, + systemMetricEntity.serverName, + systemMetricEntity.cpuUser, + systemMetricEntity.cpuSystem, + systemMetricEntity.memused, + systemMetricEntity.kbmemused, + gpuMetricEntity.gpuUtil)) + .from(systemMetricEntity) + .leftJoin(gpuMetricEntity) + .on( + gpuMetricEntity + .id1 + .in(latestGpuIds) + .and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName))) + .where(systemMetricEntity.id1.in(latestIds)) // In 절 사용 + .orderBy(systemMetricEntity.serverName.asc()) + .limit(4) + .fetch(); return foundContent; } @@ -143,11 +143,11 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto @Override public Optional getInferenceResultByStatus(String status) { return Optional.ofNullable( - queryFactory - .selectFrom(mapSheetLearnEntity) - .where(mapSheetLearnEntity.status.eq(status)) - .limit(1) - .fetchOne()); + queryFactory + .selectFrom(mapSheetLearnEntity) + .where(mapSheetLearnEntity.status.eq(status)) + .limit(1) + .fetchOne()); } @Override @@ -160,37 +160,37 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto QModelMngEntity m3Model = new QModelMngEntity("m3Model"); InferenceStatusDetailDto foundContent = - queryFactory - .select( - Projections.constructor( - InferenceStatusDetailDto.class, - mapSheetLearnEntity.title, - mapSheetLearnEntity.compareYyyy, - mapSheetLearnEntity.targetYyyy, - mapSheetLearnEntity.detectOption, - mapSheetLearnEntity.mapSheetScope, - mapSheetLearnEntity.inferStartDttm, - mapSheetLearnEntity.inferEndDttm, - mapSheetLearnEntity.detectingCnt, - mapSheetLearnEntity.detectEndCnt, - mapSheetLearnEntity.m1ModelStartDttm, - mapSheetLearnEntity.m1ModelEndDttm, - mapSheetLearnEntity.m2ModelStartDttm, - mapSheetLearnEntity.m2ModelEndDttm, - mapSheetLearnEntity.m3ModelStartDttm, - mapSheetLearnEntity.m3ModelEndDttm, - m1Model.modelVer.as("model1Ver"), - m2Model.modelVer.as("model2Ver"), - m3Model.modelVer.as("model3Ver"))) - .from(mapSheetLearnEntity) - .leftJoin(m1Model) - .on(m1Model.uuid.eq(mapSheetLearnEntity.m1ModelUuid)) - .leftJoin(m2Model) - .on(m2Model.uuid.eq(mapSheetLearnEntity.m2ModelUuid)) - .leftJoin(m3Model) - .on(m3Model.uuid.eq(mapSheetLearnEntity.m3ModelUuid)) - .where(mapSheetLearnEntity.uuid.eq(uuid)) - .fetchOne(); + queryFactory + .select( + Projections.constructor( + InferenceStatusDetailDto.class, + mapSheetLearnEntity.title, + mapSheetLearnEntity.compareYyyy, + mapSheetLearnEntity.targetYyyy, + mapSheetLearnEntity.detectOption, + mapSheetLearnEntity.mapSheetScope, + mapSheetLearnEntity.inferStartDttm, + mapSheetLearnEntity.inferEndDttm, + mapSheetLearnEntity.detectingCnt, + mapSheetLearnEntity.detectEndCnt, + mapSheetLearnEntity.m1ModelStartDttm, + mapSheetLearnEntity.m1ModelEndDttm, + mapSheetLearnEntity.m2ModelStartDttm, + mapSheetLearnEntity.m2ModelEndDttm, + mapSheetLearnEntity.m3ModelStartDttm, + mapSheetLearnEntity.m3ModelEndDttm, + m1Model.modelVer.as("model1Ver"), + m2Model.modelVer.as("model2Ver"), + m3Model.modelVer.as("model3Ver"))) + .from(mapSheetLearnEntity) + .leftJoin(m1Model) + .on(m1Model.uuid.eq(mapSheetLearnEntity.m1ModelUuid)) + .leftJoin(m2Model) + .on(m2Model.uuid.eq(mapSheetLearnEntity.m2ModelUuid)) + .leftJoin(m3Model) + .on(m3Model.uuid.eq(mapSheetLearnEntity.m3ModelUuid)) + .where(mapSheetLearnEntity.uuid.eq(uuid)) + .fetchOne(); return foundContent; } @@ -201,30 +201,30 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto QModelMngEntity model = new QModelMngEntity("model"); InferenceProgressDto dto = - queryFactory - .select( - Projections.constructor( - InferenceProgressDto.class, - Projections.constructor( - InferenceProgressDto.pred_requests_areas.class, - mapSheetLearnEntity.compareYyyy, - mapSheetLearnEntity.targetYyyy, - mapSheetLearnEntity.modelComparePath, - mapSheetLearnEntity.modelTargetPath), - model.modelVer.as("modelVer"), - model.cdModelPath.as("cdModelPath"), - model.cdModelFileName.as("cdModelFileName"), - model.cdModelConfigPath.as("cdModelConfigPath"), - model.cdModelConfigFileName.as("cdModelConfigFileName"), - model.clsModelPath, - model.clsModelFileName, - model.clsModelVersion, - model.priority)) - .from(mapSheetLearnEntity) - .join(model) - .on(model.uuid.eq(modelUuid)) - .where(mapSheetLearnEntity.id.eq(id)) - .fetchOne(); + queryFactory + .select( + Projections.constructor( + InferenceProgressDto.class, + Projections.constructor( + InferenceProgressDto.pred_requests_areas.class, + mapSheetLearnEntity.compareYyyy, + mapSheetLearnEntity.targetYyyy, + mapSheetLearnEntity.modelComparePath, + mapSheetLearnEntity.modelTargetPath), + model.modelVer.as("modelVer"), + model.cdModelPath.as("cdModelPath"), + model.cdModelFileName.as("cdModelFileName"), + model.cdModelConfigPath.as("cdModelConfigPath"), + model.cdModelConfigFileName.as("cdModelConfigFileName"), + model.clsModelPath, + model.clsModelFileName, + model.clsModelVersion, + model.priority)) + .from(mapSheetLearnEntity) + .join(model) + .on(model.uuid.eq(modelUuid)) + .where(mapSheetLearnEntity.id.eq(id)) + .fetchOne(); return dto; } @@ -235,10 +235,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto */ public UUID getProcessing() { return queryFactory - .select(mapSheetLearnEntity.uuid) - .from(mapSheetLearnEntity) - .where(mapSheetLearnEntity.status.eq("IN_PROGRESS")) - .fetchOne(); + .select(mapSheetLearnEntity.uuid) + .from(mapSheetLearnEntity) + .where(mapSheetLearnEntity.status.eq("IN_PROGRESS")) + .fetchOne(); } @Override @@ -248,17 +248,17 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto entity.setTargetYyyy(targetYear); Integer stage = - queryFactory - .select(mapSheetLearnEntity.stage) - .from(mapSheetLearnEntity) - .where( - mapSheetLearnEntity - .compareYyyy - .eq(compareYear) - .and(mapSheetLearnEntity.targetYyyy.eq(targetYear))) - .orderBy(mapSheetLearnEntity.stage.desc()) - .limit(1) - .fetchOne(); + queryFactory + .select(mapSheetLearnEntity.stage) + .from(mapSheetLearnEntity) + .where( + mapSheetLearnEntity + .compareYyyy + .eq(compareYear) + .and(mapSheetLearnEntity.targetYyyy.eq(targetYear))) + .orderBy(mapSheetLearnEntity.stage.desc()) + .limit(1) + .fetchOne(); return stage == null ? 1 : stage + 1; } @@ -270,28 +270,27 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto 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(); + .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(); } } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java index 358e9f4f..97f7e375 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/label/LabelAllocateRepositoryImpl.java @@ -34,7 +34,6 @@ import com.querydsl.core.types.dsl.CaseBuilder; import com.querydsl.core.types.dsl.Expressions; import com.querydsl.core.types.dsl.NumberExpression; import com.querydsl.core.types.dsl.StringExpression; -import com.querydsl.jpa.JPAExpressions; import com.querydsl.jpa.impl.JPAQueryFactory; import jakarta.persistence.EntityManager; import jakarta.persistence.EntityNotFoundException;