fix(tkuser): 장기근속 5년 정확 경과 체크 + 수동부여 연도 입력

- autoGrantLongServiceLeave: 연도 차이 → 정확한 기념일 경과 확인
  (today < anniversaryDate이면 스킵)
- 수동 배정 모달에 "배정 연도" 필드 추가 (탭 연도 의존 제거)
- 장기근속 만료일 = null 유지 (기존 동작 그대로)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-31 08:26:43 +09:00
parent a30482ec34
commit b2ce691ef9
3 changed files with 25 additions and 17 deletions

View File

@@ -264,15 +264,17 @@ async function autoGrantLongServiceLeave(users, year, createdBy, settings) {
if (!u.hire_date) continue;
const hire = new Date(u.hire_date);
const yearsWorked = year - hire.getFullYear();
// 해당 연도 내 threshold 도래 건만 (소급 없음)
if (yearsWorked !== thresholdYears) continue;
// 기념일이 해당 연도인지 확인
// 정확한 5년 기념일 계산
const anniversaryDate = new Date(hire);
anniversaryDate.setFullYear(hire.getFullYear() + thresholdYears);
// 기념일이 해당 연도가 아니면 스킵
if (anniversaryDate.getFullYear() !== year) continue;
// 기념일이 아직 도래하지 않았으면 스킵 (정확히 5년 경과 필요)
const today = new Date();
if (today < anniversaryDate) continue;
// long_service_excluded 체크
const [userRows] = await db.query(
'SELECT long_service_excluded FROM sso_users WHERE user_id = ?',