Files
sb-backend/src/main/java/com/sb/web/account/dto/AccountEntryResponse.java
T
ByungCheolandClaude Opus 4.8 10f51976d9 feat: 외화 결제 입력 — 통화+환율→원화 환산, 원본 보존 + 환율 API
- account_entry에 currency/original_amount/exchange_rate 컬럼 추가(멱등 ALTER)
  amount는 환산 원화(표준값) 유지 → 통계·예산 무변경
- AccountEntry/Request/Response·매퍼·서비스에 외화 필드 전달
- FxService(open.er-api.com 무료·무인증, 통화별 일자 캐시) + FxController
  GET /api/fx/rate?from=USD&to=KRW → { from, to, rate }
- WebConfig: /api/fx/** 인증 보호
- (.gitignore: 로컬 시드 스크립트 제외 규칙)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 21:37:04 +09:00

56 lines
1.7 KiB
Java

package com.sb.web.account.dto;
import com.sb.web.account.domain.AccountEntry;
import lombok.Builder;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
/**
* 가계부 항목 응답 (소유자 ID 제외, 태그 이름 포함).
*/
@Data
@Builder
public class AccountEntryResponse {
private Long id;
private LocalDate entryDate;
private String type;
private String category;
private Long amount;
private String memo;
private Long walletId;
private String walletName;
private Long toWalletId;
private String toWalletName;
private Integer installmentMonths;
private Boolean pending;
private String currency;
private BigDecimal originalAmount;
private BigDecimal exchangeRate;
private List<String> tags;
public static AccountEntryResponse from(AccountEntry e, List<String> tags) {
return AccountEntryResponse.builder()
.id(e.getId())
.entryDate(e.getEntryDate())
.type(e.getType())
.category(e.getCategory())
.amount(e.getAmount())
.memo(e.getMemo())
.walletId(e.getWalletId())
.walletName(e.getWalletName())
.toWalletId(e.getToWalletId())
.toWalletName(e.getToWalletName())
.installmentMonths(e.getInstallmentMonths())
.pending(Boolean.TRUE.equals(e.getPending()))
.currency(e.getCurrency())
.originalAmount(e.getOriginalAmount())
.exchangeRate(e.getExchangeRate())
.tags(tags)
.build();
}
}