- WalletRequest 유형 검증에 CASH 허용 - netWorth: CASH를 자산으로 합산(기존 else 분기에서 부채로 잡히던 것 방지) - 추이(trend)는 부호있는 openingBalance+흐름이라 CASH 자동 반영(변경 불필요) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,7 @@ import java.time.LocalDate;
|
||||
public class WalletRequest {
|
||||
|
||||
@NotBlank(message = "유형을 선택하세요.")
|
||||
@Pattern(regexp = "BANK|CARD|LOAN|INVEST", message = "유형이 올바르지 않습니다.")
|
||||
@Pattern(regexp = "BANK|CASH|CARD|LOAN|INVEST", message = "유형이 올바르지 않습니다.")
|
||||
private String type;
|
||||
|
||||
@NotBlank(message = "이름을 입력하세요.")
|
||||
|
||||
@@ -390,7 +390,7 @@ public class AccountService {
|
||||
.toList();
|
||||
}
|
||||
|
||||
/** 순자산 = 총자산(BANK) − 총부채(CARD/LOAN) */
|
||||
/** 순자산 = 총자산(BANK/CASH/INVEST) − 총부채(CARD/LOAN) */
|
||||
public NetWorthResponse netWorth(Long memberId) {
|
||||
Map<Long, Long> balances = balanceMap(memberId);
|
||||
Map<Long, InvestService.WalletInvest> inv = investService.valuationByWallet(memberId);
|
||||
@@ -407,7 +407,7 @@ public class AccountService {
|
||||
InvestService.WalletInvest wi = inv.getOrDefault(w.getId(), new InvestService.WalletInvest());
|
||||
assets += bal + wi.cashDelta + wi.stockEval;
|
||||
}
|
||||
} else if ("BANK".equals(w.getType())) {
|
||||
} else if ("BANK".equals(w.getType()) || "CASH".equals(w.getType())) {
|
||||
assets += bal;
|
||||
} else {
|
||||
liabilities += -bal; // 부채는 음수 잔액 → 양수 부채로 표시
|
||||
|
||||
Reference in New Issue
Block a user