feat: sam_stat P0 도메인 집계 구현 (Phase 2)

- 영업(Sales), 재무(Finance), 생산(Production) 3개 도메인 구현
- 일간/월간 통계 테이블 6개 마이그레이션 생성
- 도메인별 StatService (SalesStatService, FinanceStatService, ProductionStatService)
- Daily/Monthly 6개 Eloquent 모델 생성
- StatAggregatorService에 도메인 서비스 매핑 활성화
- StatJobLog duration_ms abs() 처리
- 스케줄러 등록 (일간 02:00, 월간 1일 03:00)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-29 19:30:30 +09:00
parent c88048db67
commit e882d33de1
18 changed files with 972 additions and 9 deletions

View File

@@ -93,3 +93,29 @@
->onFailure(function () {
\Illuminate\Support\Facades\Log::error('❌ storage:record-usage 스케줄러 실행 실패', ['time' => now()]);
});
// ─── 통계 집계 (sam_stat DB) ───
// 매일 새벽 02:00에 일간 통계 집계 (전일 데이터)
Schedule::command('stat:aggregate-daily')
->dailyAt('02:00')
->withoutOverlapping()
->appendOutputTo(storage_path('logs/scheduler.log'))
->onSuccess(function () {
\Illuminate\Support\Facades\Log::info('✅ stat:aggregate-daily 스케줄러 실행 성공', ['time' => now()]);
})
->onFailure(function () {
\Illuminate\Support\Facades\Log::error('❌ stat:aggregate-daily 스케줄러 실행 실패', ['time' => now()]);
});
// 매월 1일 새벽 03:00에 월간 통계 집계 (전월 데이터)
Schedule::command('stat:aggregate-monthly')
->monthlyOn(1, '03:00')
->withoutOverlapping()
->appendOutputTo(storage_path('logs/scheduler.log'))
->onSuccess(function () {
\Illuminate\Support\Facades\Log::info('✅ stat:aggregate-monthly 스케줄러 실행 성공', ['time' => now()]);
})
->onFailure(function () {
\Illuminate\Support\Facades\Log::error('❌ stat:aggregate-monthly 스케줄러 실행 실패', ['time' => now()]);
});