From 71f7ff6c62625bc2023aee6d104c9d42ce25c9e1 Mon Sep 17 00:00:00 2001 From: kjungw1025 Date: Wed, 31 Jul 2024 12:52:43 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=EB=A7=8C=EA=B8=B0=EC=83=81?= =?UTF-8?q?=ED=99=98=ED=8F=89=EA=B0=80=EC=9D=BC=20=EB=B0=8F=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EC=A1=B0=ED=9A=8C=EB=A5=BC=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?=EC=84=9C=EB=B9=84=EC=8A=A4=20=EB=A1=9C=EC=A7=81=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nseMaturityRepaymentEvaluationDateDto.java | 23 +++++++++++++++++++ .../RepaymentEvaluationDatesService.java | 15 ++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/main/java/com/wl2c/elswhereproductservice/domain/product/model/dto/response/ResponseMaturityRepaymentEvaluationDateDto.java 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() + ); + } } From 4c1a712842c2b02566aa2f307643ff22fea82b2a Mon Sep 17 00:00:00 2001 From: kjungw1025 Date: Wed, 31 Jul 2024 12:53:15 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=EC=BB=A8=ED=8A=B8=EB=A1=A4?= =?UTF-8?q?=EB=9F=AC=EC=97=90=20=EB=A7=8C=EA=B8=B0=EC=83=81=ED=99=98?= =?UTF-8?q?=ED=8F=89=EA=B0=80=EC=9D=BC=20=EB=B0=8F=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/controller/ProductController.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) 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); + } }