diff --git a/src/main/java/com/wl2c/elswhereproductservice/domain/product/controller/ProductController.java b/src/main/java/com/wl2c/elswhereproductservice/domain/product/controller/ProductController.java index 1c0595c..ffc2ad8 100644 --- a/src/main/java/com/wl2c/elswhereproductservice/domain/product/controller/ProductController.java +++ b/src/main/java/com/wl2c/elswhereproductservice/domain/product/controller/ProductController.java @@ -2,6 +2,7 @@ import com.wl2c.elswhereproductservice.domain.product.model.dto.list.SummarizedProductDto; import com.wl2c.elswhereproductservice.domain.product.model.dto.request.RequestProductSearchDto; +import com.wl2c.elswhereproductservice.domain.product.model.dto.response.ResponseMaturityRepaymentEvaluationDateDto; import com.wl2c.elswhereproductservice.domain.product.model.dto.response.ResponseNextRepaymentEvaluationDateDto; import com.wl2c.elswhereproductservice.domain.product.model.dto.response.ResponseProductComparisonTargetDto; import com.wl2c.elswhereproductservice.domain.product.model.dto.response.ResponseSingleProductDto; @@ -75,9 +76,9 @@ public ResponsePage listByEndSale(@RequestParam(name = "ty *

* maturityEvaluationDateType(만기 평가일 개수)을 제공하는 이유
* 발행사에서 만기 평가일의 경우, 예정거래일 중 거래소 또는 관련 거래소가 개장하지 못하거나 시장교란 사유가 발생한 날을 대비하여 여러 만기 평가일을 제공하는 경우가 있습니다.
- * 실제 서버에서는 maturityEvaluationDate는 최초 만기 평가일 날짜만 가져오지만, 발행사가 만기 평가일을 여러 날로 설정했음을 나타내고자 해당 maturityEvaluationDateType을 제공합니다.

+ * 실제 서버에서는 maturityEvaluationDate는 최초 만기 평가일 날짜만 가져오지만, 발행사가 만기 평가일을 여러 날로 설정했음을 나타내고자 해당 maturityRepaymentEvaluationDateType을 제공합니다.

* - * maturityEvaluationDateType(만기 평가일 개수)의 각 값들의 의미는 아래와 같습니다. + * maturityRepaymentEvaluationDateType(만기상환평가일 타입)의 각 값들의 의미는 아래와 같습니다. * * 한 개의 만기 평가일 : SINGLE * 여러 개의 만기 평가일 : MULTIPLE @@ -138,4 +139,21 @@ public ResponseNextRepaymentEvaluationDateDto findNextRepaymentEvaluationDate(@P return repaymentEvaluationDatesService.findNextRepaymentEvaluationDate(id); } + /** + * 특정 상품의 만기상환평가일 및 만기상환평가일 타입 조회 + *

+ * maturityRepaymentEvaluationDateType(만기상환평가일 타입)의 각 값들의 의미는 아래와 같습니다. + * + * 한 개의 만기 평가일 : SINGLE + * 여러 개의 만기 평가일 : MULTIPLE + * 파악되지 않음(서버에서 추가 파싱 필요 혹은 투자 설명서 오류) : UNKNOWN + *

+ * + * @param id 상품 id + * @return 만기상환평가일 및 만기상환평가일 타입 dto + */ + @GetMapping("/maturity/evaluation/{id}") + public ResponseMaturityRepaymentEvaluationDateDto findMaturityRepaymentEvaluationDate(@PathVariable Long id) { + return repaymentEvaluationDatesService.findMaturityRepaymentEvaluationDate(id); + } } diff --git a/src/main/java/com/wl2c/elswhereproductservice/domain/product/model/dto/response/ResponseMaturityRepaymentEvaluationDateDto.java b/src/main/java/com/wl2c/elswhereproductservice/domain/product/model/dto/response/ResponseMaturityRepaymentEvaluationDateDto.java new file mode 100644 index 0000000..cd9732f --- /dev/null +++ b/src/main/java/com/wl2c/elswhereproductservice/domain/product/model/dto/response/ResponseMaturityRepaymentEvaluationDateDto.java @@ -0,0 +1,23 @@ +package com.wl2c.elswhereproductservice.domain.product.model.dto.response; + +import com.wl2c.elswhereproductservice.domain.product.model.MaturityEvaluationDateType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; + +import java.time.LocalDate; + +@Getter +public class ResponseMaturityRepaymentEvaluationDateDto { + + @Schema(description = "만기상환평가일", example = "2027-07-13") + private final LocalDate maturityRepaymentEvaluationDate; + + @Schema(description = "만기상환평가일 개수", example = "SINGLE or MULTIPLE or UNKNOWN") + private final MaturityEvaluationDateType maturityRepaymentEvaluationDateType; + + public ResponseMaturityRepaymentEvaluationDateDto(LocalDate maturityRepaymentEvaluationDate, + MaturityEvaluationDateType maturityRepaymentEvaluationDateType) { + this.maturityRepaymentEvaluationDate = maturityRepaymentEvaluationDate; + this.maturityRepaymentEvaluationDateType = maturityRepaymentEvaluationDateType; + } +} diff --git a/src/main/java/com/wl2c/elswhereproductservice/domain/product/service/RepaymentEvaluationDatesService.java b/src/main/java/com/wl2c/elswhereproductservice/domain/product/service/RepaymentEvaluationDatesService.java index bfa25e2..c6161fd 100644 --- a/src/main/java/com/wl2c/elswhereproductservice/domain/product/service/RepaymentEvaluationDatesService.java +++ b/src/main/java/com/wl2c/elswhereproductservice/domain/product/service/RepaymentEvaluationDatesService.java @@ -3,8 +3,10 @@ import com.wl2c.elswhereproductservice.domain.product.exception.ProductEarlyRepaymentEvaluationDateFoundException; import com.wl2c.elswhereproductservice.domain.product.exception.ProductMaturityEvaluationDateNotFoundException; import com.wl2c.elswhereproductservice.domain.product.exception.ProductNotFoundException; +import com.wl2c.elswhereproductservice.domain.product.model.dto.response.ResponseMaturityRepaymentEvaluationDateDto; import com.wl2c.elswhereproductservice.domain.product.model.dto.response.ResponseNextRepaymentEvaluationDateDto; import com.wl2c.elswhereproductservice.domain.product.model.entity.EarlyRepaymentEvaluationDates; +import com.wl2c.elswhereproductservice.domain.product.model.entity.Product; import com.wl2c.elswhereproductservice.domain.product.repository.EarlyRepaymentEvaluationDatesRepository; import com.wl2c.elswhereproductservice.domain.product.repository.ProductRepository; import lombok.RequiredArgsConstructor; @@ -42,4 +44,17 @@ public ResponseNextRepaymentEvaluationDateDto findNextRepaymentEvaluationDate(Lo } return new ResponseNextRepaymentEvaluationDateDto(nextDate); } + + public ResponseMaturityRepaymentEvaluationDateDto findMaturityRepaymentEvaluationDate(Long productId) { + + Product product = productRepository.findOne(productId).orElseThrow(ProductNotFoundException::new); + if (product.getMaturityEvaluationDate() == null) { + throw new ProductMaturityEvaluationDateNotFoundException(); + } + + return new ResponseMaturityRepaymentEvaluationDateDto( + product.getMaturityEvaluationDate(), + product.getMaturityEvaluationDateType() + ); + } }