Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
[FIX]: 예금 계산기 12개월 옵션으로 고정 (#203)
Browse files Browse the repository at this point in the history
* [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개월로 수정
  • Loading branch information
sejineer authored Jan 17, 2024
1 parent 8bd241f commit 595b88d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,14 @@ public DepositCalculateRes depositCalculate(Long depositId, Double amount) {
.orElseThrow(InvalidFinancialProductException::new);

List<FinancialProductOption> 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));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 595b88d

Please sign in to comment.