From 595b88d6e7281e53c5d840ca196685ca6a3b877c Mon Sep 17 00:00:00 2001 From: Sejin Park <95167215+sejineer@users.noreply.github.com> Date: Thu, 18 Jan 2024 03:17:47 +0900 Subject: [PATCH] =?UTF-8?q?[FIX]:=20=EC=98=88=EA=B8=88=20=EA=B3=84?= =?UTF-8?q?=EC=82=B0=EA=B8=B0=2012=EA=B0=9C=EC=9B=94=20=EC=98=B5=EC=85=98?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EA=B3=A0=EC=A0=95=20(#203)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [FEAT] BankUpload API 구현 * [FIX]: 배열 쿼리 적용 * [FIX]: 이미지 URL 안나가는 현상 수정 * [FIX]: HomePage URL도 포함 * [FIX]: 이율타입 별 데이터 조회, 정렬 수정 * [FIX]: 은행 이름으로 조회 조건 수정 * [FIX]: 대규모 패치 * [FIX]: Terms 조회 안되는 현상 수정 * [FIX]: Term 정렬 조건 FIX + 최대 금액 조건 추가 * [FIX]: Term 정렬 조건 FIX + 최대 금액 조건 추가 * [FIX]: 최대 금액 조건 오류 FIX * [FEAT]: 예금 계산기 API 구현 * [FIX]: 예금 계산기 loe -> goe 변경 * [FIX]: maxLimit null 값 0으로 대체 * [FIX]: policy detail 토큰 없이 조회로 변경 * [FIX]: 예금 계산기 12개월로 수정 --- .../application/FinancialProductServiceImpl.java | 15 ++++++--------- .../product/dto/response/DepositCalculateRes.java | 6 +++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/finfellows/domain/product/application/FinancialProductServiceImpl.java b/src/main/java/com/finfellows/domain/product/application/FinancialProductServiceImpl.java index b1b27b4..d44dd20 100644 --- a/src/main/java/com/finfellows/domain/product/application/FinancialProductServiceImpl.java +++ b/src/main/java/com/finfellows/domain/product/application/FinancialProductServiceImpl.java @@ -159,17 +159,14 @@ public DepositCalculateRes depositCalculate(Long depositId, Double amount) { .orElseThrow(InvalidFinancialProductException::new); List depositOptions = financialProductOptionRepository.findFinancialProductOptionsByFinancialProduct(deposit); - FinancialProductOption maxOption = depositOptions.stream() - .max(Comparator.comparing(FinancialProductOption::getMaximumPreferredInterestRate)) - .orElse(null); - FinancialProductOption defaultOption = depositOptions.stream() - .max(Comparator.comparing(FinancialProductOption::getInterestRate)) - .orElseThrow(RuntimeException::new); + FinancialProductOption financialOption = depositOptions.stream() + .filter(option -> option.getSavingsTerm().equals(12)) + .toList().get(0); - Double maxInterestRate = amount + (amount * (Double.parseDouble(maxOption.getMaximumPreferredInterestRate()) / 100) * 0.846); - Double interestRate = amount + (amount * (Double.parseDouble(defaultOption.getInterestRate()) / 100) * 0.846); + Double maxInterestRate = amount + (amount * (Double.parseDouble(financialOption.getMaximumPreferredInterestRate()) / 100) * 0.846); + Double interestRate = amount + (amount * (Double.parseDouble(financialOption.getInterestRate()) / 100) * 0.846); - return DepositCalculateRes.toDto(maxInterestRate, interestRate); + return DepositCalculateRes.toDto(String.format("%.0f", maxInterestRate), String.format("%.0f", interestRate)); } } \ No newline at end of file diff --git a/src/main/java/com/finfellows/domain/product/dto/response/DepositCalculateRes.java b/src/main/java/com/finfellows/domain/product/dto/response/DepositCalculateRes.java index f315cad..80610ca 100644 --- a/src/main/java/com/finfellows/domain/product/dto/response/DepositCalculateRes.java +++ b/src/main/java/com/finfellows/domain/product/dto/response/DepositCalculateRes.java @@ -9,11 +9,11 @@ @Builder public class DepositCalculateRes { - private Double defaultInterestCalculation; + private String defaultInterestCalculation; - private Double maxInterestCalculation; + private String maxInterestCalculation; - public static DepositCalculateRes toDto(Double maxInterestRate, Double interestRate) { + public static DepositCalculateRes toDto(String maxInterestRate, String interestRate) { return DepositCalculateRes.builder() .defaultInterestCalculation(interestRate) .maxInterestCalculation(maxInterestRate)