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)