Skip to content

Commit

Permalink
refactor: exchange_rate icon 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ny2060 committed May 30, 2024
1 parent 53ea38f commit 1acce69
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public class ExchangeRate {
@Column(nullable = false, length = 10)
private String curName;

@Column(nullable = false, length = 10)
private String curIcon;

@Column(nullable = false, precision = 20, scale = 2)
private BigDecimal rate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ public class ExchangeDto {
private String kftc_deal_bas_r; // 서울외국환중개장부가격


public ExchangeRateResponse toDto() {
public ExchangeRateResponse toDto(String cur_icon) {
return ExchangeRateResponse.builder()
.cur_unit(cur_unit)
.cur_name(cur_nm)
.cur_icon(cur_icon)
.deal_bas_r(deal_bas_r)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
public class ExchangeRateResponse {
private String cur_unit; // 통화코드
private String cur_name; //국가 이름
private String cur_icon;
private String deal_bas_r; // 매매 기준율
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public ExchangeRateInfoResponseDto getExchangeRate(){
List<ExchangeDto> exchangeDtoList = exchangeUtils.getExchangeDataAsDtoList();
List<ExchangeRateResponse> exchangeRateResponseDtos = new ArrayList<>();
for(ExchangeDto exchangeDto: exchangeDtoList){
exchangeRateResponseDtos.add(exchangeDto.toDto());
ExchangeRate exchangeRate = exchangeRateRepository.findExchangeRateByCurCd(exchangeDto.getCur_unit());
exchangeRateResponseDtos.add(exchangeDto.toDto(exchangeRate.getCurIcon()));

}
return ExchangeRateInfoResponseDto.builder().exchangeRateTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))).exchangeRates(exchangeRateResponseDtos).build();
Expand Down

0 comments on commit 1acce69

Please sign in to comment.