STK10-07 밸류에이션(PER/PBR/배당) 수집·영속화

작업 내용

전종목 PER·PBR·배당수익률 수직 슬라이스를 구현한다. STK10-03과 동일 패턴, 새 파일만 추가.

  • domain: Valuation Entity, ValuationRepository·ValuationGateway interface
  • infrastructure/krx: KrxValuationGatewayImpl — bld 호출·파싱
  • infrastructure/mysql: ValuationRepositoryImpl — 전종목 1회 JDBC 벌크 upsert(INSERT … ON DUPLICATE KEY UPDATE), 행 단위 save 금지

다이어그램

처리 흐름

sequenceDiagram
    participant DS as MarketFlowDomainService
    participant Gw as KrxValuationGatewayImpl
    participant Client as KrxMdcClient
    participant Repo as ValuationRepositoryImpl
    DS->>Gw: fetch(baseDate)
    Gw->>Client: getJsonData(bld, baseDate)
    Client-->>Gw: rows
    Gw-->>DS: List<Valuation>
    DS->>Repo: upsertAll(list)

클래스 의존

flowchart LR
    Impl[KrxValuationGatewayImpl] -.implements.-> Gw[ValuationGateway]
    Impl --> Client[KrxMdcClient]
    RepoImpl[ValuationRepositoryImpl] -.implements.-> Repo[ValuationRepository]

테스트 케이스

  • KRX JSON을 Valuation Entity로 파싱한다 (PER·PBR·배당수익률 매핑)
  • 동일 (symbol, base_date) 재적재 시 멱등 upsert된다
  • 적자종목 등 PER 결측을 null로 graceful 처리한다
  • 전종목을 1회 벌크 upsert로 적재한다 (행 단위 save 미사용)
  • 빈 응답 시 graceful 처리한다