feat: 시세 자동조회·퇴직연금 평가액·게시판 카테고리·태그 정렬·계좌번호 암호화
- 투자: 종목코드로 현재가 시세 자동조회(StockQuoteService, 투자탭/포트폴리오 진입 시 갱신) - 투자: 퇴직연금 등 평가액 직접입력형 계좌(currentValue 활성화, manualValuation) - 게시판: community/saving/tips 카테고리 분리(post.category + 목록 필터) - 태그: 순서 변경(account_tag.sort_order, /tags/reorder) - 보안: 계좌번호 AES-256-GCM 암호화 저장/복호화(EncryptedStringTypeHandler, account_number VARCHAR(255)) 키는 서버 .env ACCOUNT_CRYPTO_KEY 로 주입(미설정 시 평문 통과) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
8fec057752
commit
fb94df8112
@@ -332,12 +332,24 @@ public class AccountService {
|
||||
if ("INVEST".equals(w.getType())) {
|
||||
InvestService.WalletInvest wi = inv.getOrDefault(w.getId(), new InvestService.WalletInvest());
|
||||
long deposit = cash + wi.cashDelta; // 예수금
|
||||
long total = deposit + wi.stockEval; // 총평가
|
||||
r.setBalance(total);
|
||||
r.setInvestedAmount(cash); // 순입금(투입원금)
|
||||
r.setDeposit(deposit);
|
||||
r.setStockValue(wi.stockEval);
|
||||
r.setValuationGain(total - cash); // 실현+평가 손익
|
||||
if (w.getCurrentValue() != null) {
|
||||
// 평가액 직접입력형(퇴직연금·연금 등): 입력한 평가액을 총평가로 사용
|
||||
long total = w.getCurrentValue();
|
||||
r.setBalance(total);
|
||||
r.setInvestedAmount(cash); // 누적 적립원금(순입금)
|
||||
r.setDeposit(deposit);
|
||||
r.setStockValue(total - deposit);
|
||||
r.setValuationGain(total - cash);
|
||||
r.setManualValuation(true);
|
||||
} else {
|
||||
long total = deposit + wi.stockEval; // 총평가
|
||||
r.setBalance(total);
|
||||
r.setInvestedAmount(cash); // 순입금(투입원금)
|
||||
r.setDeposit(deposit);
|
||||
r.setStockValue(wi.stockEval);
|
||||
r.setValuationGain(total - cash); // 실현+평가 손익
|
||||
r.setManualValuation(false);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
})
|
||||
@@ -353,9 +365,14 @@ public class AccountService {
|
||||
for (Wallet w : walletMapper.findByMember(memberId)) {
|
||||
long bal = balances.getOrDefault(w.getId(), 0L);
|
||||
if ("INVEST".equals(w.getType())) {
|
||||
// 투자: 예수금(현금+매매증감) + 주식 평가금액
|
||||
InvestService.WalletInvest wi = inv.getOrDefault(w.getId(), new InvestService.WalletInvest());
|
||||
assets += bal + wi.cashDelta + wi.stockEval;
|
||||
if (w.getCurrentValue() != null) {
|
||||
// 평가액 직접입력형(퇴직연금·연금 등): 입력한 평가액을 자산으로
|
||||
assets += w.getCurrentValue();
|
||||
} else {
|
||||
// 투자: 예수금(현금+매매증감) + 주식 평가금액
|
||||
InvestService.WalletInvest wi = inv.getOrDefault(w.getId(), new InvestService.WalletInvest());
|
||||
assets += bal + wi.cashDelta + wi.stockEval;
|
||||
}
|
||||
} else if ("BANK".equals(w.getType())) {
|
||||
assets += bal;
|
||||
} else {
|
||||
@@ -490,11 +507,28 @@ public class AccountService {
|
||||
if (tagMapper.countByName(memberId, name, null) > 0) {
|
||||
throw new ApiException(HttpStatus.CONFLICT, "이미 존재하는 태그입니다.");
|
||||
}
|
||||
AccountTag tag = AccountTag.builder().memberId(memberId).name(name).build();
|
||||
Integer max = tagMapper.maxSortOrder(memberId);
|
||||
AccountTag tag = AccountTag.builder()
|
||||
.memberId(memberId)
|
||||
.name(name)
|
||||
.sortOrder(max == null ? 0 : max + 1)
|
||||
.build();
|
||||
tagMapper.insert(tag);
|
||||
return AccountTagResponse.from(tag);
|
||||
}
|
||||
|
||||
/** 태그 순서 변경 — ids 순서대로 sort_order 재설정 */
|
||||
@Transactional
|
||||
public List<AccountTagResponse> reorderTags(Long memberId, List<Long> ids) {
|
||||
int i = 0;
|
||||
for (Long id : ids) {
|
||||
if (tagMapper.findByIdAndMember(id, memberId) != null) {
|
||||
tagMapper.updateSortOrder(id, memberId, i++);
|
||||
}
|
||||
}
|
||||
return listTags(memberId);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public AccountTagResponse updateTag(Long id, AccountTagRequest req, Long memberId) {
|
||||
AccountTag tag = mustFindTag(id, memberId);
|
||||
|
||||
Reference in New Issue
Block a user