추론 진행 현황 수정

This commit is contained in:
2026-01-14 17:24:53 +09:00
parent 0f636ee7ce
commit cb326527c4
5 changed files with 568 additions and 525 deletions

View File

@@ -44,53 +44,53 @@ public class InferenceResultApiController {
@Operation(summary = "추론관리 목록", description = "어드민 홈 > 추론관리 > 추론관리 > 추론관리 목록") @Operation(summary = "추론관리 목록", description = "어드민 홈 > 추론관리 > 추론관리 > 추론관리 목록")
@ApiResponses( @ApiResponses(
value = { value = {
@ApiResponse( @ApiResponse(
responseCode = "200", responseCode = "200",
description = "검색 성공", description = "검색 성공",
content = content =
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
schema = @Schema(implementation = Page.class))), schema = @Schema(implementation = Page.class))),
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
}) })
@GetMapping("/list") @GetMapping("/list")
public ApiResponseDto<Page<ResultList>> getInferenceResultList( public ApiResponseDto<Page<ResultList>> getInferenceResultList(
@Parameter(description = "국유인 반영 여부", example = "Y") @RequestParam(required = false) @Parameter(description = "국유인 반영 여부", example = "Y") @RequestParam(required = false)
String applyYn, String applyYn,
@Parameter(description = "반영일", example = "2025-01-01") @RequestParam(required = false) @Parameter(description = "반영일", example = "2025-01-01") @RequestParam(required = false)
LocalDate strtDttm, LocalDate strtDttm,
@Parameter(description = "반영일", example = "2026-01-01") @RequestParam(required = false) @Parameter(description = "반영일", example = "2026-01-01") @RequestParam(required = false)
LocalDate endDttm, LocalDate endDttm,
@Parameter(description = "제목", example = "변화탐지") @RequestParam(required = false) String title, @Parameter(description = "제목", example = "변화탐지") @RequestParam(required = false) String title,
@Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0") @Parameter(description = "페이지 번호 (0부터 시작)", example = "0") @RequestParam(defaultValue = "0")
int page, int page,
@Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20") @Parameter(description = "페이지 크기", example = "20") @RequestParam(defaultValue = "20")
int size) { int size) {
InferenceResultDto.SearchListReq req = InferenceResultDto.SearchListReq req =
new InferenceResultDto.SearchListReq(applyYn, strtDttm, endDttm, title, page, size); new InferenceResultDto.SearchListReq(applyYn, strtDttm, endDttm, title, page, size);
Page<ResultList> analResList = inferenceResultService.getInferenceResultList(req); Page<ResultList> analResList = inferenceResultService.getInferenceResultList(req);
return ApiResponseDto.ok(analResList); return ApiResponseDto.ok(analResList);
} }
@Operation(summary = "추론 진행 여부 확인", description = "어드민 홈 > 추론관리 > 추론관리 > 추론관리 목록") @Operation(summary = "추론 진행 여부 확인", description = "어드민 홈 > 추론관리 > 추론관리 > 추론관리 목록")
@ApiResponses( @ApiResponses(
value = { value = {
@ApiResponse( @ApiResponse(
responseCode = "200", responseCode = "200",
description = "검색 성공", description = "검색 성공",
content = content =
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
schema = schema =
@Schema( @Schema(
description = "진행 여부 (UUID 있으면 진행중)", description = "진행 여부 (UUID 있으면 진행중)",
type = "UUID", type = "UUID",
example = "44709877-2e27-4fc5-bacb-8e0328c69b64"))), example = "44709877-2e27-4fc5-bacb-8e0328c69b64"))),
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
}) })
@GetMapping("/processing-yn") @GetMapping("/processing-yn")
public ApiResponseDto<UUID> getProcessing() { public ApiResponseDto<UUID> getProcessing() {
return ApiResponseDto.ok(inferenceResultService.getProcessing()); return ApiResponseDto.ok(inferenceResultService.getProcessing());
@@ -98,17 +98,17 @@ public class InferenceResultApiController {
@Operation(summary = "년도 목록 조회", description = "어드민 홈 > 추론관리 > 추론목록 > 변화탐지 실행 정보 입력 > 년도 목록 조회") @Operation(summary = "년도 목록 조회", description = "어드민 홈 > 추론관리 > 추론목록 > 변화탐지 실행 정보 입력 > 년도 목록 조회")
@ApiResponses( @ApiResponses(
value = { value = {
@ApiResponse( @ApiResponse(
responseCode = "200", responseCode = "200",
description = "조회 성공", description = "조회 성공",
content = content =
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
array = @ArraySchema(schema = @Schema(implementation = Integer.class)))), array = @ArraySchema(schema = @Schema(implementation = Integer.class)))),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content), @ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
}) })
@GetMapping("/years") @GetMapping("/years")
public ApiResponseDto<List<Integer>> findMapSheetMngDoneYyyyList() { public ApiResponseDto<List<Integer>> findMapSheetMngDoneYyyyList() {
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngDoneYyyyList()); return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngDoneYyyyList());
@@ -116,57 +116,57 @@ public class InferenceResultApiController {
@Operation(summary = "변화탐지 실행 정보 입력", description = "어드민 홈 > 추론관리 > 추론목록 > 변화탐지 실행 정보 입력") @Operation(summary = "변화탐지 실행 정보 입력", description = "어드민 홈 > 추론관리 > 추론목록 > 변화탐지 실행 정보 입력")
@ApiResponses( @ApiResponses(
value = { value = {
@ApiResponse( @ApiResponse(
responseCode = "201", responseCode = "201",
description = "변화탐지 실행 정보 생성 성공", description = "변화탐지 실행 정보 생성 성공",
content = content =
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
schema = @Schema(description = "저장 uuid", implementation = UUID.class))), schema = @Schema(description = "저장 uuid", implementation = UUID.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content), @ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
}) })
@PostMapping("/reg") @PostMapping("/reg")
public ApiResponseDto<UUID> saveInferenceInfo( public ApiResponseDto<UUID> saveInferenceInfo(
@io.swagger.v3.oas.annotations.parameters.RequestBody( @io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "변화탐지 실행 정보 저장 요청 정보", description = "변화탐지 실행 정보 저장 요청 정보",
required = true) required = true)
@RequestBody @RequestBody
@Valid @Valid
InferenceResultDto.RegReq req) { InferenceResultDto.RegReq req) {
UUID uuid = inferenceResultService.saveInferenceInfo(req); UUID uuid = inferenceResultService.saveInferenceInfo(req);
return ApiResponseDto.ok(uuid); return ApiResponseDto.ok(uuid);
} }
@Operation(summary = "분석 모델 선택 조회", description = "변화탐지 실행 정보 입력 모델선택 팝업 ") @Operation(summary = "분석 모델 선택 조회", description = "변화탐지 실행 정보 입력 모델선택 팝업 ")
@ApiResponses( @ApiResponses(
value = { value = {
@ApiResponse( @ApiResponse(
responseCode = "200", responseCode = "200",
description = "분석 모델 조회 성공", description = "분석 모델 조회 성공",
content = content =
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
schema = @Schema(description = "분석 모델", implementation = Page.class))), schema = @Schema(description = "분석 모델", implementation = Page.class))),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content), @ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
}) })
@GetMapping("/model") @GetMapping("/model")
public ApiResponseDto<Page<ModelMngDto.ModelList>> saveInferenceInfo( public ApiResponseDto<Page<ModelMngDto.ModelList>> saveInferenceInfo(
@Parameter(description = "모델 생성일 시작", example = "2025-12-01") @RequestParam(required = false) @Parameter(description = "모델 생성일 시작", example = "2025-12-01") @RequestParam(required = false)
LocalDate strtDttm, LocalDate strtDttm,
@Parameter(description = "모델 생성일 종료", example = "2026-01-09") @RequestParam(required = false) @Parameter(description = "모델 생성일 종료", example = "2026-01-09") @RequestParam(required = false)
LocalDate endDttm, LocalDate endDttm,
@Parameter(description = "키워드 (모델버전)", example = "M1.H1.E28") @RequestParam(required = false) @Parameter(description = "키워드 (모델버전)", example = "M1.H1.E28") @RequestParam(required = false)
String searchVal, String searchVal,
@Parameter(description = "타입", example = "M1") @RequestParam(required = false) @Parameter(description = "타입", example = "M1") @RequestParam(required = false)
String modelType, String modelType,
@RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "20") int size) { @RequestParam(defaultValue = "20") int size) {
ModelMngDto.searchReq searchReq = new ModelMngDto.searchReq(page, size, null); ModelMngDto.searchReq searchReq = new ModelMngDto.searchReq(page, size, null);
Page<ModelMngDto.ModelList> result = Page<ModelMngDto.ModelList> result =
modelMngService.findModelMgmtList(searchReq, strtDttm, endDttm, modelType, searchVal); modelMngService.findModelMgmtList(searchReq, strtDttm, endDttm, modelType, searchVal);
return ApiResponseDto.ok(result); return ApiResponseDto.ok(result);
} }
@@ -246,17 +246,17 @@ public class InferenceResultApiController {
@Operation(summary = "추론관리 추론진행 서버 현황", description = "추론관리 추론진행 서버 현황") @Operation(summary = "추론관리 추론진행 서버 현황", description = "추론관리 추론진행 서버 현황")
@ApiResponses( @ApiResponses(
value = { value = {
@ApiResponse( @ApiResponse(
responseCode = "200", responseCode = "200",
description = "검색 성공", description = "검색 성공",
content = content =
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
schema = @Schema(implementation = Page.class))), schema = @Schema(implementation = Page.class))),
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
}) })
@GetMapping("/serverStatus") @GetMapping("/serverStatus")
public ApiResponseDto<List<InferenceServerStatusDto>> getInferenceServerStatusList() { public ApiResponseDto<List<InferenceServerStatusDto>> getInferenceServerStatusList() {
@@ -265,46 +265,46 @@ public class InferenceResultApiController {
@Operation(summary = "추론관리 진행현황 상세", description = "어드민 홈 > 추론관리 > 추론관리 > 진행현황 상세") @Operation(summary = "추론관리 진행현황 상세", description = "어드민 홈 > 추론관리 > 추론관리 > 진행현황 상세")
@ApiResponses( @ApiResponses(
value = { value = {
@ApiResponse( @ApiResponse(
responseCode = "200", responseCode = "200",
description = "검색 성공", description = "검색 성공",
content = content =
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
schema = @Schema(implementation = Page.class))), schema = @Schema(implementation = InferenceStatusDetailDto.class))),
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
}) })
@GetMapping("/status/{uuid}") @GetMapping("/status/{uuid}")
public ApiResponseDto<InferenceStatusDetailDto> getInferenceStatus( public ApiResponseDto<InferenceStatusDetailDto> getInferenceStatus(
@io.swagger.v3.oas.annotations.parameters.RequestBody( @io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "추론진행현왕 요청 정보", description = "추론 진행현 정보",
required = true) required = true)
@PathVariable @PathVariable
UUID uuid) { UUID uuid) {
return ApiResponseDto.ok(inferenceResultService.getInferenceStatus(uuid)); return ApiResponseDto.ok(inferenceResultService.getInferenceStatus(uuid));
} }
@Operation(summary = "추론결과 기본정보", description = "추론결과 기본정보") @Operation(summary = "추론결과 기본정보", description = "추론결과 기본정보")
@ApiResponses( @ApiResponses(
value = { value = {
@ApiResponse( @ApiResponse(
responseCode = "200", responseCode = "200",
description = "검색 성공", description = "검색 성공",
content = content =
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
schema = @Schema(implementation = InferenceDetailDto.AnalResSummary.class))), schema = @Schema(implementation = InferenceDetailDto.AnalResSummary.class))),
@ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content), @ApiResponse(responseCode = "400", description = "잘못된 검색 조건", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content) @ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
}) })
@GetMapping("/infer-result-info") @GetMapping("/infer-result-info")
public ApiResponseDto<InferenceDetailDto.AnalResultInfo> getInferenceResultInfo( public ApiResponseDto<InferenceDetailDto.AnalResultInfo> getInferenceResultInfo(
@Parameter(description = "회차 uuid", example = "932fbd72-2e8e-4a49-b189-09046787f9d1") @Parameter(description = "회차 uuid", example = "932fbd72-2e8e-4a49-b189-09046787f9d1")
@RequestParam @RequestParam
String uuid) { String uuid) {
return ApiResponseDto.ok(inferenceResultService.getInferenceResultInfo(uuid)); return ApiResponseDto.ok(inferenceResultService.getInferenceResultInfo(uuid));
} }
} }

View File

@@ -8,7 +8,6 @@ import com.kamco.cd.kamcoback.common.utils.interfaces.JsonFormatDttm;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import java.time.Duration;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.Arrays; import java.util.Arrays;
@@ -23,7 +22,9 @@ import org.springframework.data.domain.Pageable;
public class InferenceResultDto { public class InferenceResultDto {
/** 탐지 데이터 옵션 dto */ /**
* 탐지 데이터 옵션 dto
*/
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum MapSheetScope implements EnumType { public enum MapSheetScope implements EnumType {
@@ -52,7 +53,9 @@ public class InferenceResultDto {
} }
} }
/** 분석대상 도엽 enum */ /**
* 분석대상 도엽 enum
*/
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum DetectOption implements EnumType { public enum DetectOption implements EnumType {
@@ -129,7 +132,9 @@ public class InferenceResultDto {
} }
} }
/** 목록조회 dto */ /**
* 목록조회 dto
*/
@Getter @Getter
@Setter @Setter
@AllArgsConstructor @AllArgsConstructor
@@ -141,11 +146,15 @@ public class InferenceResultDto {
private String status; private String status;
private String mapSheetCnt; private String mapSheetCnt;
private Long detectingCnt; private Long detectingCnt;
@JsonFormatDttm private ZonedDateTime startTime; @JsonFormatDttm
@JsonFormatDttm private ZonedDateTime endTime; private ZonedDateTime startTime;
@JsonFormatDttm private ZonedDateTime elapsedTime; @JsonFormatDttm
private ZonedDateTime endTime;
@JsonFormatDttm
private ZonedDateTime elapsedTime;
private Boolean applyYn; private Boolean applyYn;
@JsonFormatDttm private ZonedDateTime applyDttm; @JsonFormatDttm
private ZonedDateTime applyDttm;
@JsonProperty("statusName") @JsonProperty("statusName")
public String statusName() { public String statusName() {
@@ -153,7 +162,9 @@ public class InferenceResultDto {
} }
} }
/** 목록조회 검색 조건 dto */ /**
* 목록조회 검색 조건 dto
*/
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
@@ -175,7 +186,9 @@ public class InferenceResultDto {
} }
} }
/** 변화탐지 실행 정보 저장 요청 정보 */ /**
* 변화탐지 실행 정보 저장 요청 정보
*/
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
@@ -214,8 +227,8 @@ public class InferenceResultDto {
@Schema(description = "탐지 데이터 옵션 - 추론제외(EXCL), 이전 년도 도엽 사용(PREV)", example = "EXCL") @Schema(description = "탐지 데이터 옵션 - 추론제외(EXCL), 이전 년도 도엽 사용(PREV)", example = "EXCL")
@NotBlank @NotBlank
@EnumValid( @EnumValid(
enumClass = DetectOption.class, enumClass = DetectOption.class,
message = "탐지 데이터 옵션은 '추론제외', '이전 년도 도엽 사용' 만 사용 가능합니다.") message = "탐지 데이터 옵션은 '추론제외', '이전 년도 도엽 사용' 만 사용 가능합니다.")
private String detectOption; private String detectOption;
@Schema(description = "5k 도협 번호 목록", example = "[33605,33606, 33610, 34802, 35603, 35611]") @Schema(description = "5k 도협 번호 목록", example = "[33605,33606, 33610, 34802, 35603, 35611]")
@@ -234,143 +247,152 @@ public class InferenceResultDto {
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @Schema(name = "InferenceStatusDetailDto", description = "추론(변화탐지) 진행상태")
public static class InferenceStatusDetailDto { public static class InferenceStatusDetailDto {
@Schema(description = "탐지대상 도엽수")
private Long detectingCnt;
@Schema(description = "모델1 분석 대기")
private Integer m1PendingJobs;
@Schema(description = "모델2 분석 대기")
private Integer m2PendingJobs;
@Schema(description = "모델3 분석 대기")
private Integer m3PendingJobs;
@Schema(description = "모델1 분석 완료")
private Integer m1CompletedJobs;
@Schema(description = "모델2 분석 완료")
private Integer m2CompletedJobs;
@Schema(description = "모델3 분석 완료")
private Integer m3CompletedJobs;
@Schema(description = "모델1 분석 실패")
private Integer m1FailedJobs;
@Schema(description = "모델2 분석 실패")
private Integer m2FailedJobs;
@Schema(description = "모델3 분석 실패")
private Integer m3FailedJobs;
@Schema(description = "모델1 사용시간 시작일시")
@JsonFormatDttm
ZonedDateTime m1ModelStartDttm;
@Schema(description = "모델2 사용시간 시작일시")
@JsonFormatDttm
ZonedDateTime m2ModelStartDttm;
@Schema(description = "모델3 사용시간 시작일시")
@JsonFormatDttm
ZonedDateTime m3ModelStartDttm;
@Schema(description = "모델1 사용시간 종료일시")
@JsonFormatDttm
ZonedDateTime m1ModelEndDttm;
@Schema(description = "모델2 사용시간 종료일시")
@JsonFormatDttm
ZonedDateTime m2ModelEndDttm;
@Schema(description = "모델3 사용시간 종료일시")
@JsonFormatDttm
ZonedDateTime m3ModelEndDttm;
@Schema(description = "변화탐지 제목")
private String title; private String title;
@Schema(description = "비교년도")
private Integer compareYyyy; private Integer compareYyyy;
@Schema(description = "기준년도")
private Integer targetYyyy; private Integer targetYyyy;
@Schema(description = "회차")
private Integer stage;
@Schema(description = "변화탐지 시작")
@JsonFormatDttm
private ZonedDateTime inferStartDttm;
@Schema(description = "변화탐지 종료")
@JsonFormatDttm
private ZonedDateTime inferEndDttm;
@Schema(description = "변화탐지 옵션")
private String detectOption; private String detectOption;
@Schema(description = "분석도엽")
private String mapSheetScope; private String mapSheetScope;
@JsonFormatDttm private ZonedDateTime inferStartDttm; @Schema(description = "모델1 버전")
@JsonFormatDttm private ZonedDateTime inferEndDttm; private String modelVer1;
private Long detectingCnt = 0L; @Schema(description = "모델2 버전")
private Long detectingEndCnt = 0L; private String modelVer2;
@Schema(description = "모델3 버전")
@JsonFormatDttm private ZonedDateTime m1ModelStartDttm; private String modelVer3;
@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 = "진행중";
public InferenceStatusDetailDto( public InferenceStatusDetailDto(
String title, Long detectingCnt,
Integer compareYyyy, Integer m1PendingJobs,
Integer targetYyyy, Integer m2PendingJobs,
String detectOption, Integer m3PendingJobs,
String mapSheetScope, Integer m1CompletedJobs,
ZonedDateTime inferStartDttm, Integer m2CompletedJobs,
ZonedDateTime inferEndDttm, Integer m3CompletedJobs,
Long detectingCnt, Integer m1FailedJobs,
Long detectingEndCnt, Integer m2FailedJobs,
ZonedDateTime m1ModelStartDttm, Integer m3FailedJobs,
ZonedDateTime m1ModelEndDttm, ZonedDateTime m1ModelStartDttm,
ZonedDateTime m2ModelStartDttm, ZonedDateTime m2ModelStartDttm,
ZonedDateTime m2ModelEndDttm, ZonedDateTime m3ModelStartDttm,
ZonedDateTime m3ModelStartDttm, ZonedDateTime m1ModelEndDttm,
ZonedDateTime m3ModelEndDttm, ZonedDateTime m2ModelEndDttm,
String model1Ver, ZonedDateTime m3ModelEndDttm,
String model2Ver, String title,
String model3Ver) { 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.title = title;
this.compareYyyy = compareYyyy; this.compareYyyy = compareYyyy;
this.targetYyyy = targetYyyy; this.targetYyyy = targetYyyy;
this.detectOption = detectOption; this.stage = stage;
this.mapSheetScope = mapSheetScope;
this.inferStartDttm = inferStartDttm; this.inferStartDttm = inferStartDttm;
this.inferEndDttm = inferEndDttm; this.inferEndDttm = inferEndDttm;
this.detectingCnt = detectingCnt; this.detectOption = detectOption;
this.detectingEndCnt = detectingEndCnt; this.mapSheetScope = mapSheetScope;
this.m1ModelStartDttm = m1ModelStartDttm; this.modelVer1 = modelVer1;
this.m1ModelEndDttm = m1ModelEndDttm; this.modelVer2 = modelVer2;
this.m2ModelStartDttm = m2ModelStartDttm; this.modelVer3 = modelVer3;
this.m2ModelEndDttm = m2ModelEndDttm;
this.m3ModelStartDttm = m3ModelStartDttm;
this.m3ModelEndDttm = m3ModelEndDttm;
this.model1Ver = model1Ver;
this.model2Ver = model2Ver;
this.model3Ver = model3Ver;
if (this.detectingEndCnt == null) {
this.detectingEndCnt = 0L;
}
} }
public String getDetectOptionName() { @JsonProperty("progress")
if (this.detectOption.equals("EXCL")) { private int getProgress() {
return "추론제외"; long tiles = this.detectingCnt; // 도엽수
} int models = 3; // 모델 개수
return "이전 년도 도엽 사용"; int completed = this.m1CompletedJobs + this.m2CompletedJobs + this.m3CompletedJobs + this.m1FailedJobs + this.m2FailedJobs + this.m3FailedJobs; // 완료수
long total = tiles * models; // 전체 작업량
return (int) ((completed * 100L) / total);
} }
public String getMapSheetScopeName() { @JsonProperty("detectOptionName")
if (this.mapSheetScope.equals("ALL")) { private String getDetectOptionName() {
return "전체"; return DetectOption.getDescByCode(this.detectOption);
}
return "부분";
} }
public double getDetectingRate() { @JsonProperty("mapSheetScopeName")
if (this.detectingCnt == null || this.detectingCnt == 0L) { private String getMapSheetScope() {
return 0.0; return MapSheetScope.getDescByCode(this.mapSheetScope);
}
if (this.detectingEndCnt == null) {
this.detectingEndCnt = 0L;
}
return (double) (this.detectingEndCnt / this.detectingCnt) * 100.0;
}
public String getM1Duration() {
if (this.m1ModelStartDttm == null || this.m1ModelEndDttm == null) {
return "00:00:00";
}
Duration duration = Duration.between(m1ModelStartDttm, m1ModelEndDttm);
long hours = duration.toHours();
long minutes = duration.toMinutesPart();
long seconds = duration.toSecondsPart();
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
}
public String getM2Duration() {
if (this.m2ModelStartDttm == null || this.m2ModelEndDttm == null) {
return "00:00:00";
}
Duration duration = Duration.between(this.m2ModelStartDttm, this.m2ModelEndDttm);
long hours = duration.toHours();
long minutes = duration.toMinutesPart();
long seconds = duration.toSecondsPart();
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
}
public String getM3Duration() {
if (this.m3ModelStartDttm == null || this.m3ModelEndDttm == null) {
return "00:00:00";
}
Duration duration = Duration.between(this.m3ModelStartDttm, this.m3ModelEndDttm);
long hours = duration.toHours();
long minutes = duration.toMinutesPart();
long seconds = duration.toSecondsPart();
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
} }
} }
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
@@ -378,9 +400,12 @@ public class InferenceResultDto {
public static class InferenceServerStatusDto { public static class InferenceServerStatusDto {
private String serverName; private String serverName;
@JsonIgnore private float cpu_user; @JsonIgnore
@JsonIgnore private float cpu_system; private float cpu_user;
@JsonIgnore private float memused; @JsonIgnore
private float cpu_system;
@JsonIgnore
private float memused;
private Long kbmemused; private Long kbmemused;
private float gpuUtil; private float gpuUtil;
@@ -453,6 +478,15 @@ public class InferenceResultDto {
} }
} }
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public static class InferenceStatusDetailDto2 {
InferenceServerStatusDto serverStatus;
}
@Getter @Getter
@Setter @Setter
@AllArgsConstructor @AllArgsConstructor

View File

@@ -107,7 +107,7 @@ public class InferenceResultService {
// 변화탐지 실행 가능 비교년도 조회 // 변화탐지 실행 가능 비교년도 조회
List<MngListCompareDto> compareList = List<MngListCompareDto> compareList =
mapSheetMngCoreService.getByHstMapSheetCompareList(req.getCompareYyyy(), mapTargetIds); mapSheetMngCoreService.getByHstMapSheetCompareList(req.getCompareYyyy(), mapTargetIds);
if (compareList.isEmpty()) { if (compareList.isEmpty()) {
throw new CustomApiException("NOT_FOUND_COMPARE_YEAR", HttpStatus.NOT_FOUND); throw new CustomApiException("NOT_FOUND_COMPARE_YEAR", HttpStatus.NOT_FOUND);
@@ -156,20 +156,20 @@ public class InferenceResultService {
// 추론에 필요한 geojson 파일 생성 // 추론에 필요한 geojson 파일 생성
List<String> mapSheetNumList = List<String> mapSheetNumList =
targetList.stream() targetList.stream()
.filter(t -> Boolean.TRUE.equals(t.getIsSuccess())) .filter(t -> Boolean.TRUE.equals(t.getIsSuccess()))
.map(MngListDto::getMapSheetNum) .map(MngListDto::getMapSheetNum)
.toList(); .toList();
// 비교년도 geojson 파일 생성하여 경로 받기 // 비교년도 geojson 파일 생성하여 경로 받기
String modelComparePath = String modelComparePath =
getSceneInference( getSceneInference(
String.valueOf(req.getCompareYyyy()), mapSheetNumList, req.getMapSheetScope()); String.valueOf(req.getCompareYyyy()), mapSheetNumList, req.getMapSheetScope());
// 기준년도 geojson 파일 생성하여 경로 받기 // 기준년도 geojson 파일 생성하여 경로 받기
String modelTargetPath = String modelTargetPath =
getSceneInference( getSceneInference(
String.valueOf(req.getTargetYyyy()), mapSheetNumList, req.getMapSheetScope()); String.valueOf(req.getTargetYyyy()), mapSheetNumList, req.getMapSheetScope());
// ai 서버에 전달할 파라미터 생성 // ai 서버에 전달할 파라미터 생성
pred_requests_areas predRequestsAreas = new pred_requests_areas(); pred_requests_areas predRequestsAreas = new pred_requests_areas();
@@ -201,19 +201,19 @@ public class InferenceResultService {
// 비교년도 탐지 제이터 옵션 별로 조회하여 req에 적용 // 비교년도 탐지 제이터 옵션 별로 조회하여 req에 적용
private List<MapSheetNumDto> createdMngDto( private List<MapSheetNumDto> createdMngDto(
InferenceResultDto.RegReq req, List<MngListDto> targetList) { InferenceResultDto.RegReq req, List<MngListDto> targetList) {
List<String> mapTargetIds = new ArrayList<>(); List<String> mapTargetIds = new ArrayList<>();
targetList.forEach( targetList.forEach(
hstMapSheet -> { hstMapSheet -> {
// 비교년도는 target 년도 기준으로 가져옴 파라미터 만들기 // 비교년도는 target 년도 기준으로 가져옴 파라미터 만들기
mapTargetIds.add(hstMapSheet.getMapSheetNum()); mapTargetIds.add(hstMapSheet.getMapSheetNum());
}); });
// 비교년도 조회 // 비교년도 조회
List<String> mapCompareIds = new ArrayList<>(); List<String> mapCompareIds = new ArrayList<>();
List<MngListCompareDto> compareList = List<MngListCompareDto> compareList =
mapSheetMngCoreService.getByHstMapSheetCompareList(req.getCompareYyyy(), mapTargetIds); mapSheetMngCoreService.getByHstMapSheetCompareList(req.getCompareYyyy(), mapTargetIds);
for (MngListCompareDto dto : compareList) { for (MngListCompareDto dto : compareList) {
// 추론 제외일때 이전년도 파일이 없으면 제외 // 추론 제외일때 이전년도 파일이 없으면 제외
@@ -228,35 +228,35 @@ public class InferenceResultService {
} }
Set<String> compareSet = Set<String> compareSet =
mapCompareIds.stream() mapCompareIds.stream()
.filter(Objects::nonNull) .filter(Objects::nonNull)
.map(String::trim) // 공백/개행 방지 .map(String::trim) // 공백/개행 방지
.collect(Collectors.toSet()); .collect(Collectors.toSet());
// target 기준 compare 비교하여 서로 있는것만 저장 // target 기준 compare 비교하여 서로 있는것만 저장
List<String> commonIds = List<String> commonIds =
mapTargetIds.stream() mapTargetIds.stream()
.filter(Objects::nonNull) .filter(Objects::nonNull)
.map(String::trim) .map(String::trim)
.filter(compareSet::contains) .filter(compareSet::contains)
.toList(); .toList();
Set<String> commonIdSet = Set<String> commonIdSet =
commonIds.stream().filter(Objects::nonNull).map(String::trim).collect(Collectors.toSet()); commonIds.stream().filter(Objects::nonNull).map(String::trim).collect(Collectors.toSet());
// 저장하기위해 파라미터 다시 구성 // 저장하기위해 파라미터 다시 구성
List<MapSheetNumDto> mapSheetNum = List<MapSheetNumDto> mapSheetNum =
targetList.stream() targetList.stream()
.filter(dto -> dto.getMapSheetNum() != null) .filter(dto -> dto.getMapSheetNum() != null)
.filter(dto -> commonIdSet.contains(dto.getMapSheetNum().trim())) .filter(dto -> commonIdSet.contains(dto.getMapSheetNum().trim()))
.map( .map(
dto -> { dto -> {
MapSheetNumDto mapSheetNumDto = new MapSheetNumDto(); MapSheetNumDto mapSheetNumDto = new MapSheetNumDto();
mapSheetNumDto.setMapSheetNum(dto.getMapSheetNum()); mapSheetNumDto.setMapSheetNum(dto.getMapSheetNum());
mapSheetNumDto.setMapSheetName(dto.getMapSheetName()); mapSheetNumDto.setMapSheetName(dto.getMapSheetName());
return mapSheetNumDto; return mapSheetNumDto;
}) })
.toList(); .toList();
return mapSheetNum; return mapSheetNum;
} }
@@ -295,7 +295,7 @@ public class InferenceResultService {
headers.setAccept(List.of(MediaType.APPLICATION_JSON)); headers.setAccept(List.of(MediaType.APPLICATION_JSON));
ExternalCallResult<String> result = ExternalCallResult<String> 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) { if (result.statusCode() < 200 || result.statusCode() >= 300) {
log.error("Inference API failed. status={}, body={}", result.statusCode(), result.body()); log.error("Inference API failed. status={}, body={}", result.statusCode(), result.body());
@@ -305,7 +305,8 @@ public class InferenceResultService {
// 4) 응답 파싱 // 4) 응답 파싱
try { try {
List<Map<String, Object>> list = List<Map<String, Object>> list =
objectMapper.readValue(result.body(), new TypeReference<>() {}); objectMapper.readValue(result.body(), new TypeReference<>() {
});
if (list.isEmpty()) { if (list.isEmpty()) {
throw new IllegalStateException("Inference response is empty"); throw new IllegalStateException("Inference response is empty");
@@ -374,8 +375,8 @@ public class InferenceResultService {
/** /**
* geojson 파일 생성 * geojson 파일 생성
* *
* @param yyyy 영상관리 파일별 년도 * @param yyyy 영상관리 파일별 년도
* @param mapSheetNums 5k 도엽 번호 리스트 * @param mapSheetNums 5k 도엽 번호 리스트
* @param mapSheetScope EXCL : 추론제외, PREV 이전 년도 도엽 사용 * @param mapSheetScope EXCL : 추론제외, PREV 이전 년도 도엽 사용
* @return * @return
*/ */
@@ -410,7 +411,7 @@ public class InferenceResultService {
* @return * @return
*/ */
public Page<InferenceDetailDto.Geom> getInferenceResultGeomList( public Page<InferenceDetailDto.Geom> getInferenceResultGeomList(
Long id, InferenceDetailDto.SearchGeoReq searchGeoReq) { Long id, InferenceDetailDto.SearchGeoReq searchGeoReq) {
return inferenceResultCoreService.getInferenceResultGeomList(id, searchGeoReq); return inferenceResultCoreService.getInferenceResultGeomList(id, searchGeoReq);
} }
@@ -421,7 +422,7 @@ public class InferenceResultService {
* @return * @return
*/ */
public Page<InferenceDetailDto.DetailListEntity> listInferenceResultWithGeom( public Page<InferenceDetailDto.DetailListEntity> listInferenceResultWithGeom(
@NotNull Long id, InferenceDetailDto.SearchGeoReq searchReq) { @NotNull Long id, InferenceDetailDto.SearchGeoReq searchReq) {
return inferenceResultCoreService.listInferenceResultWithGeom(id, searchReq); return inferenceResultCoreService.listInferenceResultWithGeom(id, searchReq);
} }
@@ -463,23 +464,14 @@ public class InferenceResultService {
return inferenceResultCoreService.getInferenceServerStatusList(); return inferenceResultCoreService.getInferenceServerStatusList();
} }
/**
* 추론 진행 현황 상세
*
* @param uuid
* @return
*/
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) { public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
List<InferenceServerStatusDto> servers =
inferenceResultCoreService.getInferenceServerStatusList();
String serverNames = "";
for (InferenceServerStatusDto server : servers) {
if (serverNames.equals("")) {
serverNames = server.getServerName();
} else {
serverNames = serverNames + "," + server.getServerName();
}
}
InferenceStatusDetailDto dto = inferenceResultCoreService.getInferenceStatus(uuid); InferenceStatusDetailDto dto = inferenceResultCoreService.getInferenceStatus(uuid);
dto.setUsedServerName(serverNames);
return dto; return dto;
} }

View File

@@ -104,7 +104,7 @@ public class InferenceResultCoreService {
mapSheetLearnEntity.setMapSheetCnt(mapSheetName); mapSheetLearnEntity.setMapSheetCnt(mapSheetName);
mapSheetLearnEntity.setDetectingCnt((long) detectingCnt); mapSheetLearnEntity.setDetectingCnt((long) detectingCnt);
mapSheetLearnEntity.setStage( mapSheetLearnEntity.setStage(
mapSheetLearnRepository.getLearnStage(req.getCompareYyyy(), req.getTargetYyyy())); mapSheetLearnRepository.getLearnStage(req.getCompareYyyy(), req.getTargetYyyy()));
// learn 테이블 저장 // learn 테이블 저장
MapSheetLearnEntity savedLearn = mapSheetLearnRepository.save(mapSheetLearnEntity); MapSheetLearnEntity savedLearn = mapSheetLearnRepository.save(mapSheetLearnEntity);
@@ -166,9 +166,9 @@ public class InferenceResultCoreService {
*/ */
public InferenceDetailDto.AnalResSummary getInferenceResultSummary(Long id) { public InferenceDetailDto.AnalResSummary getInferenceResultSummary(Long id) {
InferenceDetailDto.AnalResSummary summary = InferenceDetailDto.AnalResSummary summary =
mapSheetAnalDataRepository mapSheetAnalDataRepository
.getInferenceResultSummary(id) .getInferenceResultSummary(id)
.orElseThrow(() -> new EntityNotFoundException("요약정보를 찾을 수 없습니다. " + id)); .orElseThrow(() -> new EntityNotFoundException("요약정보를 찾을 수 없습니다. " + id));
return summary; return summary;
} }
@@ -189,7 +189,7 @@ public class InferenceResultCoreService {
* @return * @return
*/ */
public Page<InferenceDetailDto.Geom> getInferenceResultGeomList( public Page<InferenceDetailDto.Geom> getInferenceResultGeomList(
Long id, InferenceDetailDto.SearchGeoReq searchGeoReq) { Long id, InferenceDetailDto.SearchGeoReq searchGeoReq) {
return mapSheetAnalDataRepository.getInferenceGeomList(id, searchGeoReq); return mapSheetAnalDataRepository.getInferenceGeomList(id, searchGeoReq);
} }
@@ -201,16 +201,16 @@ public class InferenceResultCoreService {
*/ */
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Page<InferenceDetailDto.DetailListEntity> listInferenceResultWithGeom( public Page<InferenceDetailDto.DetailListEntity> listInferenceResultWithGeom(
@NotNull Long analyId, InferenceDetailDto.SearchGeoReq searchReq) { @NotNull Long analyId, InferenceDetailDto.SearchGeoReq searchReq) {
// 분석 ID 에 해당하는 dataids를 가져온다. // 분석 ID 에 해당하는 dataids를 가져온다.
List<Long> dataIds = List<Long> dataIds =
mapSheetAnalDataRepository.listAnalyGeom(analyId).stream() mapSheetAnalDataRepository.listAnalyGeom(analyId).stream()
.mapToLong(MapSheetAnalDataInferenceEntity::getId) .mapToLong(MapSheetAnalDataInferenceEntity::getId)
.boxed() .boxed()
.toList(); .toList();
// 해당데이터의 폴리곤데이터를 가져온다 // 해당데이터의 폴리곤데이터를 가져온다
Page<MapSheetAnalDataInferenceGeomEntity> mapSheetAnalDataGeomEntities = Page<MapSheetAnalDataInferenceGeomEntity> mapSheetAnalDataGeomEntities =
mapSheetAnalDataRepository.listInferenceResultWithGeom(dataIds, searchReq); mapSheetAnalDataRepository.listInferenceResultWithGeom(dataIds, searchReq);
return mapSheetAnalDataGeomEntities.map(MapSheetAnalDataInferenceGeomEntity::toEntity); return mapSheetAnalDataGeomEntities.map(MapSheetAnalDataInferenceGeomEntity::toEntity);
} }
@@ -227,14 +227,14 @@ public class InferenceResultCoreService {
@Transactional(readOnly = true) @Transactional(readOnly = true)
public List<MapSheet> listGetScenes5k(Long analyId) { public List<MapSheet> listGetScenes5k(Long analyId) {
List<String> sceneCodes = List<String> sceneCodes =
mapSheetAnalDataRepository.listAnalyGeom(analyId).stream() mapSheetAnalDataRepository.listAnalyGeom(analyId).stream()
.mapToLong(MapSheetAnalDataInferenceEntity::getMapSheetNum) .mapToLong(MapSheetAnalDataInferenceEntity::getMapSheetNum)
.mapToObj(String::valueOf) .mapToObj(String::valueOf)
.toList(); .toList();
return mapInkx5kRepository.listGetScenes5k(sceneCodes).stream() return mapInkx5kRepository.listGetScenes5k(sceneCodes).stream()
.map(MapInkx5kEntity::toEntity) .map(MapInkx5kEntity::toEntity)
.toList(); .toList();
} }
/** /**
@@ -244,9 +244,9 @@ public class InferenceResultCoreService {
*/ */
public void update(SaveInferenceAiDto request) { public void update(SaveInferenceAiDto request) {
MapSheetLearnEntity entity = MapSheetLearnEntity entity =
mapSheetLearnRepository mapSheetLearnRepository
.getInferenceResultByUuid(request.getUuid()) .getInferenceResultByUuid(request.getUuid())
.orElseThrow(EntityNotFoundException::new); .orElseThrow(EntityNotFoundException::new);
// M1/M2/M3 영역 업데이트 // M1/M2/M3 영역 업데이트
if (request.getType() != null) { if (request.getType() != null) {
@@ -268,49 +268,46 @@ public class InferenceResultCoreService {
private void applyModelUpdate(MapSheetLearnEntity entity, SaveInferenceAiDto request) { private void applyModelUpdate(MapSheetLearnEntity entity, SaveInferenceAiDto request) {
switch (request.getType()) { switch (request.getType()) {
case "M1" -> case "M1" -> applyModelFields(
applyModelFields( request,
request, entity::setM1ModelBatchId,
entity::setM1ModelBatchId, entity::setM1ModelStartDttm,
entity::setM1ModelStartDttm, entity::setM1ModelEndDttm,
entity::setM1ModelEndDttm, entity::setM1PendingJobs,
entity::setM1PendingJobs, entity::setM1RunningJobs,
entity::setM1RunningJobs, entity::setM1CompletedJobs,
entity::setM1CompletedJobs, entity::setM1FailedJobs);
entity::setM1FailedJobs); case "M2" -> applyModelFields(
case "M2" -> request,
applyModelFields( entity::setM2ModelBatchId,
request, entity::setM2ModelStartDttm,
entity::setM2ModelBatchId, entity::setM2ModelEndDttm,
entity::setM2ModelStartDttm, entity::setM2PendingJobs,
entity::setM2ModelEndDttm, entity::setM2RunningJobs,
entity::setM2PendingJobs, entity::setM2CompletedJobs,
entity::setM2RunningJobs, entity::setM2FailedJobs);
entity::setM2CompletedJobs, case "M3" -> applyModelFields(
entity::setM2FailedJobs); request,
case "M3" -> entity::setM3ModelBatchId,
applyModelFields( entity::setM3ModelStartDttm,
request, entity::setM3ModelEndDttm,
entity::setM3ModelBatchId, entity::setM3PendingJobs,
entity::setM3ModelStartDttm, entity::setM3RunningJobs,
entity::setM3ModelEndDttm, entity::setM3CompletedJobs,
entity::setM3PendingJobs, entity::setM3FailedJobs);
entity::setM3RunningJobs,
entity::setM3CompletedJobs,
entity::setM3FailedJobs);
default -> throw new IllegalArgumentException("Unknown type: " + request.getType()); default -> throw new IllegalArgumentException("Unknown type: " + request.getType());
} }
} }
private void applyModelFields( private void applyModelFields(
SaveInferenceAiDto request, SaveInferenceAiDto request,
Consumer<Long> setBatchId, Consumer<Long> setBatchId,
Consumer<ZonedDateTime> setStart, Consumer<ZonedDateTime> setStart,
Consumer<ZonedDateTime> setEnd, Consumer<ZonedDateTime> setEnd,
Consumer<Integer> setPending, Consumer<Integer> setPending,
Consumer<Integer> setRunning, Consumer<Integer> setRunning,
Consumer<Integer> setCompleted, Consumer<Integer> setCompleted,
Consumer<Integer> setFailed) { Consumer<Integer> setFailed) {
applyIfNotNull(request.getBatchId(), setBatchId); applyIfNotNull(request.getBatchId(), setBatchId);
applyIfNotNull(request.getModelStartDttm(), setStart); applyIfNotNull(request.getModelStartDttm(), setStart);
applyIfNotNull(request.getModelEndDttm(), setEnd); applyIfNotNull(request.getModelEndDttm(), setEnd);
@@ -326,13 +323,18 @@ public class InferenceResultCoreService {
} }
} }
/**
* 서버 정보 조회
*
* @return
*/
public List<InferenceServerStatusDto> getInferenceServerStatusList() { public List<InferenceServerStatusDto> getInferenceServerStatusList() {
return mapSheetLearnRepository.getInferenceServerStatusList(); return mapSheetLearnRepository.getInferenceServerStatusList();
} }
public InferenceBatchSheet getInferenceResultByStatus(String status) { public InferenceBatchSheet getInferenceResultByStatus(String status) {
MapSheetLearnEntity entity = MapSheetLearnEntity entity =
mapSheetLearnRepository.getInferenceResultByStatus(status).orElse(null); mapSheetLearnRepository.getInferenceResultByStatus(status).orElse(null);
if (entity == null) { if (entity == null) {
return null; return null;
@@ -378,7 +380,7 @@ public class InferenceResultCoreService {
/** /**
* @param compareYear 비교년도 * @param compareYear 비교년도
* @param targetYear 기준년도 * @param targetYear 기준년도
* @return * @return
*/ */
public Integer getLearnStage(Integer compareYear, Integer targetYear) { public Integer getLearnStage(Integer compareYear, Integer targetYear) {

View File

@@ -41,7 +41,7 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
BooleanBuilder builder = new BooleanBuilder(); BooleanBuilder builder = new BooleanBuilder();
NumberExpression<Integer> statusOrder = NumberExpression<Integer> 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())) { if (StringUtils.isNotBlank(req.getApplyYn())) {
@@ -55,10 +55,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
// 국유인 반영일 // 국유인 반영일
if (req.getStrtDttm() != null && req.getEndDttm() != null) { if (req.getStrtDttm() != null && req.getEndDttm() != null) {
builder.and( builder.and(
mapSheetLearnEntity mapSheetLearnEntity
.applyDttm .applyDttm
.goe(DateRange.start(req.getStrtDttm())) .goe(DateRange.start(req.getStrtDttm()))
.and(mapSheetLearnEntity.applyDttm.lt(DateRange.end(req.getEndDttm())))); .and(mapSheetLearnEntity.applyDttm.lt(DateRange.end(req.getEndDttm()))));
} }
// 제목 // 제목
@@ -67,21 +67,21 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
} }
List<MapSheetLearnEntity> content = List<MapSheetLearnEntity> content =
queryFactory queryFactory
.select(mapSheetLearnEntity) .select(mapSheetLearnEntity)
.from(mapSheetLearnEntity) .from(mapSheetLearnEntity)
.where(builder) .where(builder)
.offset(pageable.getOffset()) .offset(pageable.getOffset())
.limit(pageable.getPageSize()) .limit(pageable.getPageSize())
.orderBy(mapSheetLearnEntity.id.desc()) .orderBy(mapSheetLearnEntity.id.desc())
.fetch(); .fetch();
Long total = Long total =
queryFactory queryFactory
.select(mapSheetLearnEntity.count()) .select(mapSheetLearnEntity.count())
.from(mapSheetLearnEntity) .from(mapSheetLearnEntity)
.where(builder) .where(builder)
.fetchOne(); .fetchOne();
return new PageImpl<>(content, pageable, total == null ? 0L : total); return new PageImpl<>(content, pageable, total == null ? 0L : total);
} }
@@ -89,10 +89,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
@Override @Override
public Optional<MapSheetLearnEntity> getInferenceResultByUuid(UUID uuid) { public Optional<MapSheetLearnEntity> getInferenceResultByUuid(UUID uuid) {
return Optional.ofNullable( return Optional.ofNullable(
queryFactory queryFactory
.selectFrom(mapSheetLearnEntity) .selectFrom(mapSheetLearnEntity)
.where(mapSheetLearnEntity.uuid.eq(uuid)) .where(mapSheetLearnEntity.uuid.eq(uuid))
.fetchOne()); .fetchOne());
} }
@Override @Override
@@ -101,41 +101,41 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
BooleanBuilder builder = new BooleanBuilder(); BooleanBuilder builder = new BooleanBuilder();
List<Integer> latestIds = List<Integer> latestIds =
queryFactory queryFactory
.select(systemMetricEntity.id1.max()) .select(systemMetricEntity.id1.max())
.from(systemMetricEntity) .from(systemMetricEntity)
.groupBy(systemMetricEntity.serverName) .groupBy(systemMetricEntity.serverName)
.fetch(); .fetch();
List<Integer> latestGpuIds = List<Integer> latestGpuIds =
queryFactory queryFactory
.select(gpuMetricEntity.id1.max()) .select(gpuMetricEntity.id1.max())
.from(gpuMetricEntity) .from(gpuMetricEntity)
.groupBy(gpuMetricEntity.serverName) .groupBy(gpuMetricEntity.serverName)
.fetch(); .fetch();
List<InferenceServerStatusDto> foundContent = List<InferenceServerStatusDto> foundContent =
queryFactory queryFactory
.select( .select(
Projections.constructor( Projections.constructor(
InferenceServerStatusDto.class, InferenceServerStatusDto.class,
systemMetricEntity.serverName, systemMetricEntity.serverName,
systemMetricEntity.cpuUser, systemMetricEntity.cpuUser,
systemMetricEntity.cpuSystem, systemMetricEntity.cpuSystem,
systemMetricEntity.memused, systemMetricEntity.memused,
systemMetricEntity.kbmemused, systemMetricEntity.kbmemused,
gpuMetricEntity.gpuUtil)) gpuMetricEntity.gpuUtil))
.from(systemMetricEntity) .from(systemMetricEntity)
.leftJoin(gpuMetricEntity) .leftJoin(gpuMetricEntity)
.on( .on(
gpuMetricEntity gpuMetricEntity
.id1 .id1
.in(latestGpuIds) .in(latestGpuIds)
.and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName))) .and(gpuMetricEntity.serverName.eq(systemMetricEntity.serverName)))
.where(systemMetricEntity.id1.in(latestIds)) // In 절 사용 .where(systemMetricEntity.id1.in(latestIds)) // In 절 사용
.orderBy(systemMetricEntity.serverName.asc()) .orderBy(systemMetricEntity.serverName.asc())
.limit(4) .limit(4)
.fetch(); .fetch();
return foundContent; return foundContent;
} }
@@ -143,13 +143,19 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
@Override @Override
public Optional<MapSheetLearnEntity> getInferenceResultByStatus(String status) { public Optional<MapSheetLearnEntity> getInferenceResultByStatus(String status) {
return Optional.ofNullable( return Optional.ofNullable(
queryFactory queryFactory
.selectFrom(mapSheetLearnEntity) .selectFrom(mapSheetLearnEntity)
.where(mapSheetLearnEntity.status.eq(status)) .where(mapSheetLearnEntity.status.eq(status))
.limit(1) .limit(1)
.fetchOne()); .fetchOne());
} }
/**
* 추론 실행 진행 현황
*
* @param uuid
* @return
*/
@Override @Override
public InferenceStatusDetailDto getInferenceStatus(UUID uuid) { public InferenceStatusDetailDto getInferenceStatus(UUID uuid) {
@@ -160,37 +166,46 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
QModelMngEntity m3Model = new QModelMngEntity("m3Model"); QModelMngEntity m3Model = new QModelMngEntity("m3Model");
InferenceStatusDetailDto foundContent = InferenceStatusDetailDto foundContent =
queryFactory queryFactory
.select( .select(
Projections.constructor( Projections.constructor(
InferenceStatusDetailDto.class, InferenceStatusDetailDto.class,
mapSheetLearnEntity.title, mapSheetLearnEntity.detectingCnt,
mapSheetLearnEntity.compareYyyy, mapSheetLearnEntity.m1PendingJobs,
mapSheetLearnEntity.targetYyyy, mapSheetLearnEntity.m2PendingJobs,
mapSheetLearnEntity.detectOption, mapSheetLearnEntity.m3PendingJobs,
mapSheetLearnEntity.mapSheetScope, mapSheetLearnEntity.m1CompletedJobs,
mapSheetLearnEntity.inferStartDttm, mapSheetLearnEntity.m2CompletedJobs,
mapSheetLearnEntity.inferEndDttm, mapSheetLearnEntity.m3CompletedJobs,
mapSheetLearnEntity.detectingCnt, mapSheetLearnEntity.m1FailedJobs,
mapSheetLearnEntity.detectEndCnt, mapSheetLearnEntity.m2FailedJobs,
mapSheetLearnEntity.m1ModelStartDttm, mapSheetLearnEntity.m3FailedJobs,
mapSheetLearnEntity.m1ModelEndDttm, mapSheetLearnEntity.m1ModelStartDttm,
mapSheetLearnEntity.m2ModelStartDttm, mapSheetLearnEntity.m2ModelStartDttm,
mapSheetLearnEntity.m2ModelEndDttm, mapSheetLearnEntity.m3ModelStartDttm,
mapSheetLearnEntity.m3ModelStartDttm, mapSheetLearnEntity.m1ModelEndDttm,
mapSheetLearnEntity.m3ModelEndDttm, mapSheetLearnEntity.m2ModelEndDttm,
m1Model.modelVer.as("model1Ver"), mapSheetLearnEntity.m3ModelEndDttm,
m2Model.modelVer.as("model2Ver"), mapSheetLearnEntity.title,
m3Model.modelVer.as("model3Ver"))) mapSheetLearnEntity.compareYyyy,
.from(mapSheetLearnEntity) mapSheetLearnEntity.targetYyyy,
.leftJoin(m1Model) mapSheetLearnEntity.stage,
.on(m1Model.uuid.eq(mapSheetLearnEntity.m1ModelUuid)) mapSheetLearnEntity.inferStartDttm,
.leftJoin(m2Model) mapSheetLearnEntity.inferEndDttm,
.on(m2Model.uuid.eq(mapSheetLearnEntity.m2ModelUuid)) mapSheetLearnEntity.detectOption,
.leftJoin(m3Model) mapSheetLearnEntity.mapSheetScope,
.on(m3Model.uuid.eq(mapSheetLearnEntity.m3ModelUuid)) m1Model.modelVer.as("model1Ver"),
.where(mapSheetLearnEntity.uuid.eq(uuid)) m2Model.modelVer.as("model2Ver"),
.fetchOne(); 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; return foundContent;
} }
@@ -201,30 +216,30 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
QModelMngEntity model = new QModelMngEntity("model"); QModelMngEntity model = new QModelMngEntity("model");
InferenceProgressDto dto = InferenceProgressDto dto =
queryFactory queryFactory
.select( .select(
Projections.constructor( Projections.constructor(
InferenceProgressDto.class, InferenceProgressDto.class,
Projections.constructor( Projections.constructor(
InferenceProgressDto.pred_requests_areas.class, InferenceProgressDto.pred_requests_areas.class,
mapSheetLearnEntity.compareYyyy, mapSheetLearnEntity.compareYyyy,
mapSheetLearnEntity.targetYyyy, mapSheetLearnEntity.targetYyyy,
mapSheetLearnEntity.modelComparePath, mapSheetLearnEntity.modelComparePath,
mapSheetLearnEntity.modelTargetPath), mapSheetLearnEntity.modelTargetPath),
model.modelVer.as("modelVer"), model.modelVer.as("modelVer"),
model.cdModelPath.as("cdModelPath"), model.cdModelPath.as("cdModelPath"),
model.cdModelFileName.as("cdModelFileName"), model.cdModelFileName.as("cdModelFileName"),
model.cdModelConfigPath.as("cdModelConfigPath"), model.cdModelConfigPath.as("cdModelConfigPath"),
model.cdModelConfigFileName.as("cdModelConfigFileName"), model.cdModelConfigFileName.as("cdModelConfigFileName"),
model.clsModelPath, model.clsModelPath,
model.clsModelFileName, model.clsModelFileName,
model.clsModelVersion, model.clsModelVersion,
model.priority)) model.priority))
.from(mapSheetLearnEntity) .from(mapSheetLearnEntity)
.join(model) .join(model)
.on(model.uuid.eq(modelUuid)) .on(model.uuid.eq(modelUuid))
.where(mapSheetLearnEntity.id.eq(id)) .where(mapSheetLearnEntity.id.eq(id))
.fetchOne(); .fetchOne();
return dto; return dto;
} }
@@ -235,10 +250,10 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
*/ */
public UUID getProcessing() { public UUID getProcessing() {
return queryFactory return queryFactory
.select(mapSheetLearnEntity.uuid) .select(mapSheetLearnEntity.uuid)
.from(mapSheetLearnEntity) .from(mapSheetLearnEntity)
.where(mapSheetLearnEntity.status.eq("IN_PROGRESS")) .where(mapSheetLearnEntity.status.eq("IN_PROGRESS"))
.fetchOne(); .fetchOne();
} }
@Override @Override
@@ -248,17 +263,17 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
entity.setTargetYyyy(targetYear); entity.setTargetYyyy(targetYear);
Integer stage = Integer stage =
queryFactory queryFactory
.select(mapSheetLearnEntity.stage) .select(mapSheetLearnEntity.stage)
.from(mapSheetLearnEntity) .from(mapSheetLearnEntity)
.where( .where(
mapSheetLearnEntity mapSheetLearnEntity
.compareYyyy .compareYyyy
.eq(compareYear) .eq(compareYear)
.and(mapSheetLearnEntity.targetYyyy.eq(targetYear))) .and(mapSheetLearnEntity.targetYyyy.eq(targetYear)))
.orderBy(mapSheetLearnEntity.stage.desc()) .orderBy(mapSheetLearnEntity.stage.desc())
.limit(1) .limit(1)
.fetchOne(); .fetchOne();
return stage == null ? 1 : stage + 1; return stage == null ? 1 : stage + 1;
} }
@@ -270,27 +285,27 @@ public class MapSheetLearnRepositoryImpl implements MapSheetLearnRepositoryCusto
QModelMngEntity m3 = new QModelMngEntity("m3"); QModelMngEntity m3 = new QModelMngEntity("m3");
return queryFactory return queryFactory
.select( .select(
Projections.constructor( Projections.constructor(
AnalResultInfo.class, AnalResultInfo.class,
mapSheetLearnEntity.title, mapSheetLearnEntity.title,
m1.modelVer, m1.modelVer,
m2.modelVer, m2.modelVer,
m3.modelVer, m3.modelVer,
mapSheetLearnEntity.compareYyyy, mapSheetLearnEntity.compareYyyy,
mapSheetLearnEntity.targetYyyy, mapSheetLearnEntity.targetYyyy,
mapSheetLearnEntity.detectOption, mapSheetLearnEntity.detectOption,
mapSheetLearnEntity.mapSheetScope, mapSheetLearnEntity.mapSheetScope,
mapSheetLearnEntity.inferStartDttm, mapSheetLearnEntity.inferStartDttm,
mapSheetLearnEntity.inferEndDttm)) mapSheetLearnEntity.inferEndDttm))
.from(mapSheetLearnEntity) .from(mapSheetLearnEntity)
.leftJoin(m1) .leftJoin(m1)
.on(mapSheetLearnEntity.m1ModelUuid.eq(m1.uuid)) .on(mapSheetLearnEntity.m1ModelUuid.eq(m1.uuid))
.leftJoin(m2) .leftJoin(m2)
.on(mapSheetLearnEntity.m2ModelUuid.eq(m2.uuid)) .on(mapSheetLearnEntity.m2ModelUuid.eq(m2.uuid))
.leftJoin(m3) .leftJoin(m3)
.on(mapSheetLearnEntity.m3ModelUuid.eq(m3.uuid)) .on(mapSheetLearnEntity.m3ModelUuid.eq(m3.uuid))
.where(mapSheetLearnEntity.uuid.eq(UUID.fromString(uuid))) .where(mapSheetLearnEntity.uuid.eq(UUID.fromString(uuid)))
.fetchOne(); .fetchOne();
} }
} }