Skip to content

[fix] 급여명세서 계산 정확도 개선 및 Worker API null 안전성 보완#176

Closed
geunyong16 wants to merge 4 commits into
mainfrom
fix/154-worker-kakao-info
Closed

[fix] 급여명세서 계산 정확도 개선 및 Worker API null 안전성 보완#176
geunyong16 wants to merge 4 commits into
mainfrom
fix/154-worker-kakao-info

Conversation

@geunyong16
Copy link
Copy Markdown
Collaborator

🔖 관련 GitHub Issue

📝 변경 사항

주요 변경 내용

  • Worker/Contract/WorkRecord DTO에 profileImageUrlovertimeSalary 필드 추가
  • Worker user 정보 접근 시 null 안전성 개선 (NPE 방지)
  • N+1 문제 해결 — JPQL 쿼리에 JOIN FETCH w.user 추가
  • 급여 계산 로직 개선: 일일 연장수당 분리 및 이중 계산 방지

상세 설명

1. profileImageUrl 추가 및 null 안전성 개선

Kakao OAuth 계정의 프로필 이미지 URL을 API 응답에 포함하도록 WorkerDto.Response, ContractDto.Response, ContractDto.ListResponseprofileImageUrl 필드를 추가했습니다.
기존 코드에서 contract.getWorker().getUser().getName() 방식으로 접근할 경우 User가 탈퇴/null인 경우 NPE가 발생할 수 있어 null 체크를 추가했습니다.

2. N+1 문제 해결

WorkerContractRepository의 4개 쿼리 및 WorkRecordRepository의 계약 조회 쿼리에 JOIN FETCH w.user를 추가해 User 정보를 즉시 로딩합니다.

3. 급여 계산 로직 개선

  • WorkRecordovertimeHours, overtimeSalary 필드 추가 (일일 8시간 초과분)
  • WorkRecord.calculateSalaryWithAllowanceRules()를 단순화: 기본급(1.0배) + 각 가산분(0.5배씩) 방식으로 통일
  • WeeklyAllowance의 주간 연장수당 계산 시 이미 일일 연장으로 처리된 시간을 차감해 이중 계산 방지
  • SalaryService에서 일일 연장 가산분과 주간 연장 가산분을 별도로 집계 후 합산
  • WorkRecord.calculateTime()에서 totalHours 계산 시 breakMinutes 미반영 버그 수정
  • WorkRecordDtoovertimeSalary 필드 추가
  • API 명세(API_SPECIFICATION.md) 업데이트

📸 스크린샷 (선택사항)

스크린샷 보기

Before

After

✅ 체크리스트

  • PR 제목이 형식에 맞는가? (유형: 작업 요약)
  • 코드가 정상적으로 빌드되는가?
  • 새로운 기능에 대한 테스트 코드를 작성했는가?
  • 모든 테스트가 통과하는가?
  • 코드 스타일 가이드를 따랐는가?
  • 관련 문서를 업데이트했는가?

🔗 관련 PR

  • Related to #

- Add null safety checks for User object in WorkerDto.Response.from()

- Add null safety checks for Worker/User objects in ContractDto

- Update API_SPECIFICATION.md with profileImageUrl field

- Fixes review feedback for fix/154-worker-kakao-info
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

Warning

Rate limit exceeded

@geunyong16 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 37 minutes and 25 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6207553d-f9da-4db0-a865-d9d7650bef0e

📥 Commits

Reviewing files that changed from the base of the PR and between c9f3611 and ebacdb5.

📒 Files selected for processing (9)
  • docs/API_SPECIFICATION.md
  • src/main/java/com/example/paycheck/domain/allowance/entity/WeeklyAllowance.java
  • src/main/java/com/example/paycheck/domain/contract/dto/ContractDto.java
  • src/main/java/com/example/paycheck/domain/contract/repository/WorkerContractRepository.java
  • src/main/java/com/example/paycheck/domain/salary/service/SalaryService.java
  • src/main/java/com/example/paycheck/domain/worker/dto/WorkerDto.java
  • src/main/java/com/example/paycheck/domain/workrecord/dto/WorkRecordDto.java
  • src/main/java/com/example/paycheck/domain/workrecord/entity/WorkRecord.java
  • src/main/java/com/example/paycheck/domain/workrecord/repository/WorkRecordRepository.java
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/154-worker-kakao-info

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 37 minutes and 25 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@geunyong16 geunyong16 changed the title [fix] worker 카카오 유저 정보 null 안전성 및 급여 계산 정확도 개선 [fix] 급여명세서 계산 정확도 개선 및 Worker API null 안전성 보완 May 3, 2026
@geunyong16 geunyong16 closed this May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 급여명세서 값이 제대로 표시되지 않음

1 participant