[KC-99] 추론관리 등록 leran, 5k 테이블 저장 기능 추가

This commit is contained in:
2026-01-09 11:29:10 +09:00
parent da9ef16f44
commit 96081de63f
4 changed files with 26 additions and 33 deletions

View File

@@ -13,6 +13,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.UUID;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@@ -71,19 +72,20 @@ public class InferenceResultApiController {
content = content =
@Content( @Content(
mediaType = "application/json", mediaType = "application/json",
schema = @Schema(implementation = Void.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<Void> 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) {
return ApiResponseDto.ok(null); UUID uuid = inferenceResultService.saveInferenceInfo(req);
return ApiResponseDto.ok(uuid);
} }
// @ApiResponses( // @ApiResponses(

View File

@@ -19,9 +19,7 @@ import org.springframework.data.domain.Pageable;
public class InferenceResultDto { public class InferenceResultDto {
/** /** 목록조회 dto */
* 목록조회 dto
*/
@Getter @Getter
@Setter @Setter
@AllArgsConstructor @AllArgsConstructor
@@ -33,20 +31,14 @@ public class InferenceResultDto {
private String status; private String status;
private String mapSheetCnt; private String mapSheetCnt;
private Long detectingCnt; private Long detectingCnt;
@JsonFormatDttm @JsonFormatDttm private ZonedDateTime startTime;
private ZonedDateTime startTime; @JsonFormatDttm private ZonedDateTime endTime;
@JsonFormatDttm @JsonFormatDttm private ZonedDateTime elapsedTime;
private ZonedDateTime endTime;
@JsonFormatDttm
private ZonedDateTime elapsedTime;
private Boolean applyYn; private Boolean applyYn;
@JsonFormatDttm @JsonFormatDttm private ZonedDateTime applyDttm;
private ZonedDateTime applyDttm;
} }
/** /** 목록조회 검색 조건 dto */
* 목록조회 검색 조건 dto
*/
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
@@ -68,9 +60,7 @@ public class InferenceResultDto {
} }
} }
/** /** 탐지 데이터 옵션 dto */
* 탐지 데이터 옵션 dto
*/
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum MapSheetScope implements EnumType { public enum MapSheetScope implements EnumType {
@@ -91,9 +81,7 @@ public class InferenceResultDto {
} }
} }
/** /** 분석대상 도엽 enum */
* 분석대상 도엽 enum
*/
@Getter @Getter
@AllArgsConstructor @AllArgsConstructor
public enum DetectOption implements EnumType { public enum DetectOption implements EnumType {
@@ -113,9 +101,7 @@ public class InferenceResultDto {
} }
} }
/** /** 변화탐지 실행 정보 저장 요청 정보 */
* 변화탐지 실행 정보 저장 요청 정보
*/
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
@@ -148,17 +134,17 @@ public class InferenceResultDto {
@Schema(description = "분석대상 도엽 - 전체(ALL), 부분(PART)", example = "PART") @Schema(description = "분석대상 도엽 - 전체(ALL), 부분(PART)", example = "PART")
@NotBlank @NotBlank
@EnumValid(enumClass = DetectOption.class, message = "분석대상 도엽 옵션은 '전체', '부분' 만 사용 가능합니다.") @EnumValid(enumClass = MapSheetScope.class, message = "분석대상 도엽 옵션은 '전체', '부분' 만 사용 가능합니다.")
private String mapSheetScope; private String mapSheetScope;
@Schema(description = "탐지 데이터 옵션 - 추론제외(EXCL), 이전 년도 도엽 사용(PREV)", example = "EXCL") @Schema(description = "탐지 데이터 옵션 - 추론제외(EXCL), 이전 년도 도엽 사용(PREV)", example = "EXCL")
@NotBlank @NotBlank
@EnumValid( @EnumValid(
enumClass = MapSheetScope.class, enumClass = DetectOption.class,
message = "탐지 데이터 옵션은 '추론제외', '이전 년도 도엽 사용' 만 사용 가능합니다.") message = "탐지 데이터 옵션은 '추론제외', '이전 년도 도엽 사용' 만 사용 가능합니다.")
private String detectOption; private String detectOption;
@Schema(description = "5k 도협 번호 목록", example = "[34607067,34607067]") @Schema(description = "5k 도협 번호 목록", example = "[34607067,35802056]")
@NotNull @NotNull
private List<String> mapSheetNum; private List<String> mapSheetNum;
} }

View File

@@ -9,6 +9,7 @@ import com.kamco.cd.kamcoback.inference.dto.InferenceResultDto.ResultList;
import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService; import com.kamco.cd.kamcoback.postgres.core.InferenceResultCoreService;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import java.util.List; import java.util.List;
import java.util.UUID;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -36,8 +37,9 @@ public class InferenceResultService {
* *
* @param req * @param req
*/ */
public void saveInferenceInfo(InferenceResultDto.RegReq req) { @Transactional
inferenceResultCoreService.saveInferenceInfo(req); public UUID saveInferenceInfo(InferenceResultDto.RegReq req) {
return inferenceResultCoreService.saveInferenceInfo(req);
} }
/** /**

View File

@@ -20,6 +20,7 @@ import jakarta.persistence.EntityNotFoundException;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -53,7 +54,7 @@ public class InferenceResultCoreService {
* *
* @param req * @param req
*/ */
public void saveInferenceInfo(InferenceResultDto.RegReq req) { public UUID saveInferenceInfo(InferenceResultDto.RegReq req) {
MapSheetLearnEntity mapSheetLearnEntity = new MapSheetLearnEntity(); MapSheetLearnEntity mapSheetLearnEntity = new MapSheetLearnEntity();
mapSheetLearnEntity.setTitle(req.getTitle()); mapSheetLearnEntity.setTitle(req.getTitle());
mapSheetLearnEntity.setM1ModelUid(req.getModel1Uid()); mapSheetLearnEntity.setM1ModelUid(req.getModel1Uid());
@@ -93,6 +94,8 @@ public class InferenceResultCoreService {
mapSheetLearn5kRepository.flush(); mapSheetLearn5kRepository.flush();
entityManager.clear(); entityManager.clear();
} }
return savedLearn.getUuid();
} }
/****/ /****/