[ Feature ] - 회원·연월별 소득분석 조회 기능 및 SETTLEMENT 테이블 수정 - #97
Merged
Conversation
- SETTLEMENT에 deposit_date/user_id/status/transaction_count 컬럼 추가 - SettlementService가 미매칭 거래도 날짜 단위로 합산해 UNMATCHED 상태로 저장하도록 변경 - IncomeAnalysisQueryClient 및 MonthlyIncomeAnalysisSummary 등 common DTO 추가 - IncomeAnalysisService/LocalIncomeAnalysisQueryClient 구현 (SETTLEMENT 집계 기반 총소득/미매칭소득/잡별 소득/전월대비/변동성/발생-실입금 비교/피로도) - 확정됐지만 아직 정산 완료되지 않은 근무일지 예상소득(pendingSettlementIncome) 필드 추가 - SettlementServiceTest/IncomeAnalysisServiceTest 작성
- 같은 잡·같은 정산기간에 서로 다른 거래가 2건 이상 들어오면 두 번째 거래가 누락되던 문제 수정 (existsByJobIdAndPeriod → existsByAccountTransactionId) - DB UNIQUE 제약도 UK_SETTLEMENT_JOB_PERIOD에서 UK_SETTLEMENT_ACCOUNT_TRANSACTION_ID로 교체 - SettlementServiceTest: 중복 방지 테스트를 accountTransactionId 기준으로 정정, 같은 기간 내 거래 2건이 각각 반영되는지 확인하는 테스트 추가
hanjyoon01
requested review from
KSBoscoKim,
Kimd0ng,
SOOsuhyuncho,
bigwaveBigwave and
shinh09
August 8, 2026 01:21
shinh09
approved these changes
Aug 8, 2026
bigwaveBigwave
approved these changes
Aug 8, 2026
- WorkErrorCode 신설 (defense-service DefenseErrorCode와 동일한 패턴) - JobService/WorkLogService/CategoryService/PlatformService/SavingGoalService/ JobPlatformMappingService의 IllegalArgumentException을 ServiceException으로 교체 - 소유권 검증(JOB_ACCESS_DENIED/WORK_LOG_ACCESS_DENIED)이 GlobalExceptionHandler를 통해 정확한 403으로 응답되도록 개선 - SettlementPeriodCalculator, 정산 방식 default 분기 등 클라이언트 요청과 무관한 내부 불변조건 위반은 IllegalStateException으로 유지 - JobServiceTest/WorkLogServiceTest/JobPlatformMappingServiceTest/SavingGoalServiceTest assertThrows 대상을 ServiceException으로 갱신
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
관련 이슈
작업 사항
소득분석 조회 기능 (SETTLEMENT 기반)
common에IncomeAnalysisQueryClient인터페이스 및MonthlyIncomeAnalysisSummary/JobIncomeSummary/EarnedDepositComparison/JobFatigueSummaryDTO 추가work-service에IncomeAnalysisService/LocalIncomeAnalysisQueryClient구현SETTLEMENT(deposit_date기준)와WORK_LOG를 집계해 총소득/미매칭소득/잡별 소득·비중·주소득원 계산pendingSettlementIncome) 제공null/0L로 구분SETTLEMENT 스키마 확장
deposit_date,user_id,status(MATCHED/UNMATCHED),transaction_count컬럼 추가job_id,account_transaction_idnullable로 변경 (UNMATCHED 행 지원)SettlementService가 매칭되지 않은 거래도 날짜 단위로 합산해UNMATCHED행으로 저장정산 중복 처리 방지 로직 수정
(job_id, period_start, period_end)에서account_transaction_id로 변경UK_SETTLEMENT_JOB_PERIOD→UK_SETTLEMENT_ACCOUNT_TRANSACTION_ID로 DB 제약도 교체테스트
IncomeAnalysisServiceTest,SettlementServiceTest작성/갱신참고 사항
SETTLEMENT을 소득분석의 소스로 채택했지만,UNMATCHED/AMBIGUOUS거래는 기존에 저장하지 않던 것이라 이번에 같이 확장함. 한 플랫폼에 회원 잡이 여러 개 매핑되는 경우(AMBIGUOUS)는 없다고 가정하고 별도로 다루지 않음 (ambiguousTransactionCount는 항상0)SETTLEMENT은job_id로 확정 매칭이 저장되는 구조라, 저장 이후 잡-플랫폼 매핑이 바뀌어도 과거 행은 갱신되지 않음. 이번 배치를 "어제 날짜만, 하루에 한 번" 호출하는 걸 전제로 하면 문제되지 않지만, 실제 스케줄러는 별도 이슈로 진행 예정JobFatigueSummary.latestFatigue필드는 실제로 필요한지 확인 필요n으로 나눔)으로 구현 (표본 기준n-1아님) (임의로 선택)