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 99fe158d..a77af312 100644 --- a/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java +++ b/src/main/java/com/kamco/cd/kamcoback/inference/InferenceResultApiController.java @@ -44,53 +44,53 @@ public class InferenceResultApiController { @Operation(summary = "추론관리 목록", description = "어드민 홈 > 추론관리 > 추론관리 > 추론관리 목록") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "검색 성공", - content = - @Content( - mediaType = "application/json", - schema = @Schema(implementation = Page.class))), - @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "검색 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(implementation = Page.class))), + @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @GetMapping("/list") public ApiResponseDto> getInferenceResultList( - @Parameter(description = "국유인 반영 여부", example = "Y") @RequestParam(required = false) - String applyYn, - @Parameter(description = "반영일", example = "2025-01-01") @RequestParam(required = false) - LocalDate strtDttm, - @Parameter(description = "반영일", example = "2026-01-01") @RequestParam(required = false) - LocalDate endDttm, - @Parameter(description = "제목", example = "변화탐지") @RequestParam(required = false) String title, - @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") - int page, - @Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") - int size) { + @Parameter(description = "국유인 반영 여부", example = "Y") @RequestParam(required = false) + String applyYn, + @Parameter(description = "반영일", example = "2025-01-01") @RequestParam(required = false) + LocalDate strtDttm, + @Parameter(description = "반영일", example = "2026-01-01") @RequestParam(required = false) + LocalDate endDttm, + @Parameter(description = "제목", example = "변화탐지") @RequestParam(required = false) String title, + @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") + int page, + @Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") + int size) { InferenceResultDto.SearchListReq req = - new InferenceResultDto.SearchListReq(applyYn, strtDttm, endDttm, title, page, size); + new InferenceResultDto.SearchListReq(applyYn, strtDttm, endDttm, title, page, size); Page analResList = inferenceResultService.getInferenceResultList(req); return ApiResponseDto.ok(analResList); } @Operation(summary = "추론 진행 여부 확인", description = "어드민 홈 > 추론관리 > 추론관리 > 추론관리 목록") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "검색 성공", - content = - @Content( - mediaType = "application/json", - schema = - @Schema( - description = "진행 여부 (UUID 있으면 진행중)", - type = "UUID", - example = "44709877-2e27-4fc5-bacb-8e0328c69b64"))), - @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "검색 성공", + content = + @Content( + mediaType = "application/json", + schema = + @Schema( + description = "진행 여부 (UUID 있으면 진행중)", + type = "UUID", + example = "44709877-2e27-4fc5-bacb-8e0328c69b64"))), + @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @GetMapping("/processing-yn") public ApiResponseDto getProcessing() { return ApiResponseDto.ok(inferenceResultService.getProcessing()); @@ -98,17 +98,17 @@ public class InferenceResultApiController { @Operation(summary = "년도 목록 조회", description = "어드민 홈 > 추론관리 > 추론목록 > 변화탐지 실행 정보 입력 > 년도 목록 조회") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "조회 성공", - content = - @Content( - mediaType = "application/json", - array = @ArraySchema(schema = @Schema(implementation = Integer.class)))), - @ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "조회 성공", + content = + @Content( + mediaType = "application/json", + array = @ArraySchema(schema = @Schema(implementation = Integer.class)))), + @ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @GetMapping("/years") public ApiResponseDto> findMapSheetMngDoneYyyyList() { return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngDoneYyyyList()); @@ -116,57 +116,57 @@ public class InferenceResultApiController { @Operation(summary = "변화탐지 실행 정보 입력", description = "어드민 홈 > 추론관리 > 추론목록 > 변화탐지 실행 정보 입력") @ApiResponses( - value = { - @ApiResponse( - responseCode = "201", - description = "변화탐지 실행 정보 생성 성공", - content = - @Content( - mediaType = "application/json", - schema = @Schema(description = "저장 uuid", implementation = UUID.class))), - @ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "201", + description = "변화탐지 실행 정보 생성 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(description = "저장 uuid", implementation = UUID.class))), + @ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @PostMapping("/reg") public ApiResponseDto saveInferenceInfo( - @io.swagger.v3.oas.annotations.parameters.RequestBody( - description = "변화탐지 실행 정보 저장 요청 정보", - required = true) - @RequestBody - @Valid - InferenceResultDto.RegReq req) { + @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "변화탐지 실행 정보 저장 요청 정보", + required = true) + @RequestBody + @Valid + InferenceResultDto.RegReq req) { UUID uuid = inferenceResultService.saveInferenceInfo(req); return ApiResponseDto.ok(uuid); } @Operation(summary = "분석 모델 선택 조회", description = "변화탐지 실행 정보 입력 모델선택 팝업 ") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "분석 모델 조회 성공", - content = - @Content( - mediaType = "application/json", - schema = @Schema(description = "분석 모델", implementation = Page.class))), - @ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "분석 모델 조회 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(description = "분석 모델", implementation = Page.class))), + @ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @GetMapping("/model") public ApiResponseDto> saveInferenceInfo( - @Parameter(description = "모델 생성일 시작", example = "2025-12-01") @RequestParam(required = false) - LocalDate strtDttm, - @Parameter(description = "모델 생성일 종료", example = "2026-01-09") @RequestParam(required = false) - LocalDate endDttm, - @Parameter(description = "키워드 (모델버전)", example = "M1.H1.E28") @RequestParam(required = false) - String searchVal, - @Parameter(description = "타입", example = "M1") @RequestParam(required = false) - String modelType, - @RequestParam(defaultValue = "0") int page, - @RequestParam(defaultValue = "20") int size) { + @Parameter(description = "모델 생성일 시작", example = "2025-12-01") @RequestParam(required = false) + LocalDate strtDttm, + @Parameter(description = "모델 생성일 종료", example = "2026-01-09") @RequestParam(required = false) + LocalDate endDttm, + @Parameter(description = "키워드 (모델버전)", example = "M1.H1.E28") @RequestParam(required = false) + String searchVal, + @Parameter(description = "타입", example = "M1") @RequestParam(required = false) + String modelType, + @RequestParam(defaultValue = "0") int page, + @RequestParam(defaultValue = "20") int size) { ModelMngDto.searchReq searchReq = new ModelMngDto.searchReq(page, size, null); Page result = - modelMngService.findModelMgmtList(searchReq, strtDttm, endDttm, modelType, searchVal); + modelMngService.findModelMgmtList(searchReq, strtDttm, endDttm, modelType, searchVal); return ApiResponseDto.ok(result); } @@ -246,17 +246,17 @@ public class InferenceResultApiController { @Operation(summary = "추론관리 추론진행 서버 현황", description = "추론관리 추론진행 서버 현황") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "검색 성공", - content = - @Content( - mediaType = "application/json", - schema = @Schema(implementation = Page.class))), - @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "검색 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(implementation = Page.class))), + @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @GetMapping("/serverStatus") public ApiResponseDto> getInferenceServerStatusList() { @@ -265,46 +265,46 @@ public class InferenceResultApiController { @Operation(summary = "추론관리 진행현황 상세", description = "어드민 홈 > 추론관리 > 추론관리 > 진행현황 상세") @ApiResponses( - value = { - @ApiResponse( - responseCode = "200", - description = "검색 성공", - content = - @Content( - mediaType = "application/json", - schema = @Schema(implementation = Page.class))), - @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), - @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) - }) + value = { + @ApiResponse( + responseCode = "200", + description = "검색 성공", + content = + @Content( + mediaType = "application/json", + schema = @Schema(implementation = InferenceStatusDetailDto.class))), + @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), + @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) + }) @GetMapping("/status/{uuid}") public ApiResponseDto getInferenceStatus( - @io.swagger.v3.oas.annotations.parameters.RequestBody( - description = "추론진행현왕 요청 정보", - required = true) - @PathVariable - UUID uuid) { + @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "추론 진행현황 정보", + required = true) + @PathVariable + UUID uuid) { 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) - }) + 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) { + @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/InferenceResultDto.java b/src/main/java/com/kamco/cd/kamcoback/inference/dto/InferenceResultDto.java index cdfc5f0b..0feaef04 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,7 +8,6 @@ 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; @@ -23,7 +22,9 @@ import org.springframework.data.domain.Pageable; public class InferenceResultDto { - /** 탐지 데이터 옵션 dto */ + /** + * 탐지 데이터 옵션 dto + */ @Getter @AllArgsConstructor public enum MapSheetScope implements EnumType { @@ -52,7 +53,9 @@ public class InferenceResultDto { } } - /** 분석대상 도엽 enum */ + /** + * 분석대상 도엽 enum + */ @Getter @AllArgsConstructor public enum DetectOption implements EnumType { @@ -129,7 +132,9 @@ public class InferenceResultDto { } } - /** 목록조회 dto */ + /** + * 목록조회 dto + */ @Getter @Setter @AllArgsConstructor @@ -141,11 +146,15 @@ public class InferenceResultDto { private String status; private String mapSheetCnt; private Long detectingCnt; - @JsonFormatDttm private ZonedDateTime startTime; - @JsonFormatDttm private ZonedDateTime endTime; - @JsonFormatDttm private ZonedDateTime elapsedTime; + @JsonFormatDttm + private ZonedDateTime startTime; + @JsonFormatDttm + private ZonedDateTime endTime; + @JsonFormatDttm + private ZonedDateTime elapsedTime; private Boolean applyYn; - @JsonFormatDttm private ZonedDateTime applyDttm; + @JsonFormatDttm + private ZonedDateTime applyDttm; @JsonProperty("statusName") public String statusName() { @@ -153,7 +162,9 @@ public class InferenceResultDto { } } - /** 목록조회 검색 조건 dto */ + /** + * 목록조회 검색 조건 dto + */ @Getter @Setter @NoArgsConstructor @@ -175,7 +186,9 @@ public class InferenceResultDto { } } - /** 변화탐지 실행 정보 저장 요청 정보 */ + /** + * 변화탐지 실행 정보 저장 요청 정보 + */ @Getter @Setter @NoArgsConstructor @@ -214,8 +227,8 @@ public class InferenceResultDto { @Schema(description = "탐지 데이터 옵션 - 추론제외(EXCL), 이전 년도 도엽 사용(PREV)", example = "EXCL") @NotBlank @EnumValid( - enumClass = DetectOption.class, - message = "탐지 데이터 옵션은 '추론제외', '이전 년도 도엽 사용' 만 사용 가능합니다.") + enumClass = DetectOption.class, + message = "탐지 데이터 옵션은 '추론제외', '이전 년도 도엽 사용' 만 사용 가능합니다.") private String detectOption; @Schema(description = "5k 도협 번호 목록", example = "[33605,33606, 33610, 34802, 35603, 35611]") @@ -234,143 +247,152 @@ public class InferenceResultDto { @Getter @Setter @NoArgsConstructor - @AllArgsConstructor + @Schema(name = "InferenceStatusDetailDto", description = "추론(변화탐지) 진행상태") 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; + @Schema(description = "비교년도") private Integer compareYyyy; + @Schema(description = "기준년도") 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; + @Schema(description = "분석도엽") private String mapSheetScope; - @JsonFormatDttm private ZonedDateTime inferStartDttm; - @JsonFormatDttm private ZonedDateTime inferEndDttm; - 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; - private String usedServerName; - private String model1VerStatus = "PROCCESING"; - private String model1VerStatusName = "진행중"; - private String model2VerStatus = "PROCCESING"; - private String model2VerStatusName = "진행중"; - private String model3VerStatus = "PROCCESING"; - private String model3VerStatusName = "진행중"; + @Schema(description = "모델1 버전") + private String modelVer1; + @Schema(description = "모델2 버전") + private String modelVer2; + @Schema(description = "모델3 버전") + private String modelVer3; public InferenceStatusDetailDto( - String title, - Integer compareYyyy, - Integer targetYyyy, - String detectOption, - String mapSheetScope, - ZonedDateTime inferStartDttm, - ZonedDateTime inferEndDttm, - Long detectingCnt, - Long detectingEndCnt, - ZonedDateTime m1ModelStartDttm, - ZonedDateTime m1ModelEndDttm, - ZonedDateTime m2ModelStartDttm, - ZonedDateTime m2ModelEndDttm, - ZonedDateTime m3ModelStartDttm, - ZonedDateTime m3ModelEndDttm, - String model1Ver, - String model2Ver, - String model3Ver) { + 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, + Integer compareYyyy, + Integer targetYyyy, + Integer stage, + ZonedDateTime inferStartDttm, + ZonedDateTime inferEndDttm, + String detectOption, + String mapSheetScope, + String modelVer1, + String modelVer2, + String modelVer3 + ) { + this.detectingCnt = detectingCnt; + this.m1PendingJobs = m1PendingJobs; + this.m2PendingJobs = m2PendingJobs; + this.m3PendingJobs = m3PendingJobs; + this.m1CompletedJobs = m1CompletedJobs; + 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.compareYyyy = compareYyyy; this.targetYyyy = targetYyyy; - this.detectOption = detectOption; - this.mapSheetScope = mapSheetScope; + this.stage = stage; this.inferStartDttm = inferStartDttm; 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; - - if (this.detectingEndCnt == null) { - this.detectingEndCnt = 0L; - } + this.detectOption = detectOption; + this.mapSheetScope = mapSheetScope; + this.modelVer1 = modelVer1; + this.modelVer2 = modelVer2; + this.modelVer3 = modelVer3; } - public String getDetectOptionName() { - if (this.detectOption.equals("EXCL")) { - return "추론제외"; - } - return "이전 년도 도엽 사용"; + @JsonProperty("progress") + private int getProgress() { + long tiles = this.detectingCnt; // 도엽수 + int models = 3; // 모델 개수 + 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() { - if (this.mapSheetScope.equals("ALL")) { - return "전체"; - } - return "부분"; + @JsonProperty("detectOptionName") + private String getDetectOptionName() { + return DetectOption.getDescByCode(this.detectOption); } - public double getDetectingRate() { - if (this.detectingCnt == null || this.detectingCnt == 0L) { - return 0.0; - } - - 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); + @JsonProperty("mapSheetScopeName") + private String getMapSheetScope() { + return MapSheetScope.getDescByCode(this.mapSheetScope); } } + @Getter @Setter @NoArgsConstructor @@ -378,9 +400,12 @@ public class InferenceResultDto { public static class InferenceServerStatusDto { private String serverName; - @JsonIgnore private float cpu_user; - @JsonIgnore private float cpu_system; - @JsonIgnore private float memused; + @JsonIgnore + private float cpu_user; + @JsonIgnore + private float cpu_system; + @JsonIgnore + private float memused; private Long kbmemused; private float gpuUtil; @@ -453,6 +478,15 @@ public class InferenceResultDto { } } + @Getter + @Setter + @NoArgsConstructor + @AllArgsConstructor + public static class InferenceStatusDetailDto2 { + + InferenceServerStatusDto serverStatus; + } + @Getter @Setter @AllArgsConstructor 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 71307c16..e4faab04 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 @@ -107,7 +107,7 @@ public class InferenceResultService { // 변화탐지 실행 가능 비교년도 조회 List compareList = - mapSheetMngCoreService.getByHstMapSheetCompareList(req.getCompareYyyy(), mapTargetIds); + mapSheetMngCoreService.getByHstMapSheetCompareList(req.getCompareYyyy(), mapTargetIds); if (compareList.isEmpty()) { throw new CustomApiException("NOT_FOUND_COMPARE_YEAR", HttpStatus.NOT_FOUND); @@ -156,20 +156,20 @@ public class InferenceResultService { // 추론에 필요한 geojson 파일 생성 List mapSheetNumList = - targetList.stream() - .filter(t -> Boolean.TRUE.equals(t.getIsSuccess())) - .map(MngListDto::getMapSheetNum) - .toList(); + targetList.stream() + .filter(t -> Boolean.TRUE.equals(t.getIsSuccess())) + .map(MngListDto::getMapSheetNum) + .toList(); // 비교년도 geojson 파일 생성하여 경로 받기 String modelComparePath = - getSceneInference( - String.valueOf(req.getCompareYyyy()), mapSheetNumList, req.getMapSheetScope()); + getSceneInference( + String.valueOf(req.getCompareYyyy()), mapSheetNumList, req.getMapSheetScope()); // 기준년도 geojson 파일 생성하여 경로 받기 String modelTargetPath = - getSceneInference( - String.valueOf(req.getTargetYyyy()), mapSheetNumList, req.getMapSheetScope()); + getSceneInference( + String.valueOf(req.getTargetYyyy()), mapSheetNumList, req.getMapSheetScope()); // ai 서버에 전달할 파라미터 생성 pred_requests_areas predRequestsAreas = new pred_requests_areas(); @@ -201,19 +201,19 @@ public class InferenceResultService { // 비교년도 탐지 제이터 옵션 별로 조회하여 req에 적용 private List createdMngDto( - InferenceResultDto.RegReq req, List targetList) { + InferenceResultDto.RegReq req, List targetList) { List mapTargetIds = new ArrayList<>(); targetList.forEach( - hstMapSheet -> { - // 비교년도는 target 년도 기준으로 가져옴 파라미터 만들기 - mapTargetIds.add(hstMapSheet.getMapSheetNum()); - }); + hstMapSheet -> { + // 비교년도는 target 년도 기준으로 가져옴 파라미터 만들기 + mapTargetIds.add(hstMapSheet.getMapSheetNum()); + }); // 비교년도 조회 List mapCompareIds = new ArrayList<>(); List compareList = - mapSheetMngCoreService.getByHstMapSheetCompareList(req.getCompareYyyy(), mapTargetIds); + mapSheetMngCoreService.getByHstMapSheetCompareList(req.getCompareYyyy(), mapTargetIds); for (MngListCompareDto dto : compareList) { // 추론 제외일때 이전년도 파일이 없으면 제외 @@ -228,35 +228,35 @@ public class InferenceResultService { } Set compareSet = - mapCompareIds.stream() - .filter(Objects::nonNull) - .map(String::trim) // 공백/개행 방지 - .collect(Collectors.toSet()); + mapCompareIds.stream() + .filter(Objects::nonNull) + .map(String::trim) // 공백/개행 방지 + .collect(Collectors.toSet()); // target 기준 compare 비교하여 서로 있는것만 저장 List commonIds = - mapTargetIds.stream() - .filter(Objects::nonNull) - .map(String::trim) - .filter(compareSet::contains) - .toList(); + mapTargetIds.stream() + .filter(Objects::nonNull) + .map(String::trim) + .filter(compareSet::contains) + .toList(); Set commonIdSet = - commonIds.stream().filter(Objects::nonNull).map(String::trim).collect(Collectors.toSet()); + commonIds.stream().filter(Objects::nonNull).map(String::trim).collect(Collectors.toSet()); // 저장하기위해 파라미터 다시 구성 List mapSheetNum = - targetList.stream() - .filter(dto -> dto.getMapSheetNum() != null) - .filter(dto -> commonIdSet.contains(dto.getMapSheetNum().trim())) - .map( - dto -> { - MapSheetNumDto mapSheetNumDto = new MapSheetNumDto(); - mapSheetNumDto.setMapSheetNum(dto.getMapSheetNum()); - mapSheetNumDto.setMapSheetName(dto.getMapSheetName()); - return mapSheetNumDto; - }) - .toList(); + targetList.stream() + .filter(dto -> dto.getMapSheetNum() != null) + .filter(dto -> commonIdSet.contains(dto.getMapSheetNum().trim())) + .map( + dto -> { + MapSheetNumDto mapSheetNumDto = new MapSheetNumDto(); + mapSheetNumDto.setMapSheetNum(dto.getMapSheetNum()); + mapSheetNumDto.setMapSheetName(dto.getMapSheetName()); + return mapSheetNumDto; + }) + .toList(); return mapSheetNum; } @@ -295,7 +295,7 @@ public class InferenceResultService { headers.setAccept(List.of(MediaType.APPLICATION_JSON)); ExternalCallResult result = - externalHttpClient.call(inferenceUrl, HttpMethod.POST, dto, headers, String.class); + externalHttpClient.call(inferenceUrl, HttpMethod.POST, dto, headers, String.class); if (result.statusCode() < 200 || result.statusCode() >= 300) { log.error("Inference API failed. status={}, body={}", result.statusCode(), result.body()); @@ -305,7 +305,8 @@ public class InferenceResultService { // 4) 응답 파싱 try { List> list = - objectMapper.readValue(result.body(), new TypeReference<>() {}); + objectMapper.readValue(result.body(), new TypeReference<>() { + }); if (list.isEmpty()) { throw new IllegalStateException("Inference response is empty"); @@ -374,8 +375,8 @@ public class InferenceResultService { /** * geojson 파일 생성 * - * @param yyyy 영상관리 파일별 년도 - * @param mapSheetNums 5k 도엽 번호 리스트 + * @param yyyy 영상관리 파일별 년도 + * @param mapSheetNums 5k 도엽 번호 리스트 * @param mapSheetScope EXCL : 추론제외, PREV 이전 년도 도엽 사용 * @return */ @@ -410,7 +411,7 @@ public class InferenceResultService { * @return */ public Page getInferenceResultGeomList( - Long id, InferenceDetailDto.SearchGeoReq searchGeoReq) { + Long id, InferenceDetailDto.SearchGeoReq searchGeoReq) { return inferenceResultCoreService.getInferenceResultGeomList(id, searchGeoReq); } @@ -421,7 +422,7 @@ public class InferenceResultService { * @return */ public Page listInferenceResultWithGeom( - @NotNull Long id, InferenceDetailDto.SearchGeoReq searchReq) { + @NotNull Long id, InferenceDetailDto.SearchGeoReq searchReq) { return inferenceResultCoreService.listInferenceResultWithGeom(id, searchReq); } @@ -463,23 +464,14 @@ public class InferenceResultService { return inferenceResultCoreService.getInferenceServerStatusList(); } + /** + * 추론 진행 현황 상세 + * + * @param uuid + * @return + */ public InferenceStatusDetailDto getInferenceStatus(UUID uuid) { - - List 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); - dto.setUsedServerName(serverNames); - return dto; } 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 b77d7afa..5ed2a4be 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 @@ -104,7 +104,7 @@ public class InferenceResultCoreService { mapSheetLearnEntity.setMapSheetCnt(mapSheetName); mapSheetLearnEntity.setDetectingCnt((long) detectingCnt); mapSheetLearnEntity.setStage( - mapSheetLearnRepository.getLearnStage(req.getCompareYyyy(), req.getTargetYyyy())); + mapSheetLearnRepository.getLearnStage(req.getCompareYyyy(), req.getTargetYyyy())); // learn 테이블 저장 MapSheetLearnEntity savedLearn = mapSheetLearnRepository.save(mapSheetLearnEntity); @@ -166,9 +166,9 @@ public class InferenceResultCoreService { */ public InferenceDetailDto.AnalResSummary getInferenceResultSummary(Long id) { InferenceDetailDto.AnalResSummary summary = - mapSheetAnalDataRepository - .getInferenceResultSummary(id) - .orElseThrow(() -> new EntityNotFoundException("요약정보를 찾을 수 없습니다. " + id)); + mapSheetAnalDataRepository + .getInferenceResultSummary(id) + .orElseThrow(() -> new EntityNotFoundException("요약정보를 찾을 수 없습니다. " + id)); return summary; } @@ -189,7 +189,7 @@ public class InferenceResultCoreService { * @return */ public Page getInferenceResultGeomList( - Long id, InferenceDetailDto.SearchGeoReq searchGeoReq) { + Long id, InferenceDetailDto.SearchGeoReq searchGeoReq) { return mapSheetAnalDataRepository.getInferenceGeomList(id, searchGeoReq); } @@ -201,16 +201,16 @@ public class InferenceResultCoreService { */ @Transactional(readOnly = true) public Page listInferenceResultWithGeom( - @NotNull Long analyId, InferenceDetailDto.SearchGeoReq searchReq) { + @NotNull Long analyId, InferenceDetailDto.SearchGeoReq searchReq) { // 분석 ID 에 해당하는 dataids를 가져온다. List dataIds = - mapSheetAnalDataRepository.listAnalyGeom(analyId).stream() - .mapToLong(MapSheetAnalDataInferenceEntity::getId) - .boxed() - .toList(); + mapSheetAnalDataRepository.listAnalyGeom(analyId).stream() + .mapToLong(MapSheetAnalDataInferenceEntity::getId) + .boxed() + .toList(); // 해당데이터의 폴리곤데이터를 가져온다 Page mapSheetAnalDataGeomEntities = - mapSheetAnalDataRepository.listInferenceResultWithGeom(dataIds, searchReq); + mapSheetAnalDataRepository.listInferenceResultWithGeom(dataIds, searchReq); return mapSheetAnalDataGeomEntities.map(MapSheetAnalDataInferenceGeomEntity::toEntity); } @@ -227,14 +227,14 @@ public class InferenceResultCoreService { @Transactional(readOnly = true) public List listGetScenes5k(Long analyId) { List sceneCodes = - mapSheetAnalDataRepository.listAnalyGeom(analyId).stream() - .mapToLong(MapSheetAnalDataInferenceEntity::getMapSheetNum) - .mapToObj(String::valueOf) - .toList(); + mapSheetAnalDataRepository.listAnalyGeom(analyId).stream() + .mapToLong(MapSheetAnalDataInferenceEntity::getMapSheetNum) + .mapToObj(String::valueOf) + .toList(); return mapInkx5kRepository.listGetScenes5k(sceneCodes).stream() - .map(MapInkx5kEntity::toEntity) - .toList(); + .map(MapInkx5kEntity::toEntity) + .toList(); } /** @@ -244,9 +244,9 @@ public class InferenceResultCoreService { */ public void update(SaveInferenceAiDto request) { MapSheetLearnEntity entity = - mapSheetLearnRepository - .getInferenceResultByUuid(request.getUuid()) - .orElseThrow(EntityNotFoundException::new); + mapSheetLearnRepository + .getInferenceResultByUuid(request.getUuid()) + .orElseThrow(EntityNotFoundException::new); // M1/M2/M3 영역 업데이트 if (request.getType() != null) { @@ -268,49 +268,46 @@ public class InferenceResultCoreService { private void applyModelUpdate(MapSheetLearnEntity entity, SaveInferenceAiDto request) { switch (request.getType()) { - case "M1" -> - applyModelFields( - request, - entity::setM1ModelBatchId, - entity::setM1ModelStartDttm, - entity::setM1ModelEndDttm, - entity::setM1PendingJobs, - entity::setM1RunningJobs, - entity::setM1CompletedJobs, - entity::setM1FailedJobs); - case "M2" -> - applyModelFields( - request, - entity::setM2ModelBatchId, - entity::setM2ModelStartDttm, - entity::setM2ModelEndDttm, - entity::setM2PendingJobs, - entity::setM2RunningJobs, - entity::setM2CompletedJobs, - entity::setM2FailedJobs); - case "M3" -> - applyModelFields( - request, - entity::setM3ModelBatchId, - entity::setM3ModelStartDttm, - entity::setM3ModelEndDttm, - entity::setM3PendingJobs, - entity::setM3RunningJobs, - entity::setM3CompletedJobs, - entity::setM3FailedJobs); + case "M1" -> applyModelFields( + request, + entity::setM1ModelBatchId, + entity::setM1ModelStartDttm, + entity::setM1ModelEndDttm, + entity::setM1PendingJobs, + entity::setM1RunningJobs, + entity::setM1CompletedJobs, + entity::setM1FailedJobs); + case "M2" -> applyModelFields( + request, + entity::setM2ModelBatchId, + entity::setM2ModelStartDttm, + entity::setM2ModelEndDttm, + entity::setM2PendingJobs, + entity::setM2RunningJobs, + entity::setM2CompletedJobs, + entity::setM2FailedJobs); + case "M3" -> applyModelFields( + request, + entity::setM3ModelBatchId, + entity::setM3ModelStartDttm, + entity::setM3ModelEndDttm, + entity::setM3PendingJobs, + entity::setM3RunningJobs, + entity::setM3CompletedJobs, + entity::setM3FailedJobs); default -> throw new IllegalArgumentException("Unknown type: " + request.getType()); } } private void applyModelFields( - SaveInferenceAiDto request, - Consumer setBatchId, - Consumer setStart, - Consumer setEnd, - Consumer setPending, - Consumer setRunning, - Consumer setCompleted, - Consumer setFailed) { + SaveInferenceAiDto request, + Consumer setBatchId, + Consumer setStart, + Consumer setEnd, + Consumer setPending, + Consumer setRunning, + Consumer setCompleted, + Consumer setFailed) { applyIfNotNull(request.getBatchId(), setBatchId); applyIfNotNull(request.getModelStartDttm(), setStart); applyIfNotNull(request.getModelEndDttm(), setEnd); @@ -326,13 +323,18 @@ public class InferenceResultCoreService { } } + /** + * 서버 정보 조회 + * + * @return + */ public List getInferenceServerStatusList() { return mapSheetLearnRepository.getInferenceServerStatusList(); } public InferenceBatchSheet getInferenceResultByStatus(String status) { MapSheetLearnEntity entity = - mapSheetLearnRepository.getInferenceResultByStatus(status).orElse(null); + mapSheetLearnRepository.getInferenceResultByStatus(status).orElse(null); if (entity == null) { return null; @@ -378,7 +380,7 @@ public class InferenceResultCoreService { /** * @param compareYear 비교년도 - * @param targetYear 기준년도 + * @param targetYear 기준년도 * @return */ public Integer getLearnStage(Integer compareYear, Integer targetYear) { 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 2c471fee..9694d598 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,13 +143,19 @@ 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()); } + /** + * 추론 실행 진행 현황 + * + * @param uuid + * @return + */ @Override public InferenceStatusDetailDto getInferenceStatus(UUID uuid) { @@ -160,37 +166,46 @@ 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.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.compareYyyy, + mapSheetLearnEntity.targetYyyy, + mapSheetLearnEntity.stage, + mapSheetLearnEntity.inferStartDttm, + mapSheetLearnEntity.inferEndDttm, + mapSheetLearnEntity.detectOption, + mapSheetLearnEntity.mapSheetScope, + 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 +216,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 +250,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 +263,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,27 +285,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(); } }