feat: sam_stat P2 도메인 + 통계 API + 대시보드 전환 (Phase 4)

- 4.1: stat_project_monthly + ProjectStatService (건설/프로젝트 월간)
- 4.2: stat_system_daily + SystemStatService (API/감사/FCM/파일/결재)
- 4.3: stat_events, stat_snapshots + StatEventService + StatEventObserver
- 4.4: StatController (summary/daily/monthly/alerts) + StatQueryService + FormRequest 3개 + routes/stats.php
- 4.5: DashboardService sam_stat 우선 조회 + 원본 DB 폴백 패턴

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-29 21:56:53 +09:00
parent 595e3d59b4
commit 4d8dac1091
22 changed files with 1011 additions and 7 deletions

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models\Stats\Daily;
use App\Models\Stats\BaseStatModel;
class StatSystemDaily extends BaseStatModel
{
protected $table = 'stat_system_daily';
protected $casts = [
'stat_date' => 'date',
'file_upload_size_mb' => 'decimal:2',
'approval_avg_hours' => 'decimal:2',
];
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models\Stats\Monthly;
use App\Models\Stats\BaseStatModel;
class StatProjectMonthly extends BaseStatModel
{
protected $table = 'stat_project_monthly';
protected $casts = [
'contract_total_amount' => 'decimal:2',
'expected_expense_total' => 'decimal:2',
'actual_expense_total' => 'decimal:2',
'labor_cost_total' => 'decimal:2',
'material_cost_total' => 'decimal:2',
'gross_profit' => 'decimal:2',
'gross_profit_rate' => 'decimal:2',
];
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models\Stats;
class StatEvent extends BaseStatModel
{
protected $table = 'stat_events';
public $timestamps = false;
protected $casts = [
'payload' => 'array',
'occurred_at' => 'datetime',
];
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models\Stats;
class StatSnapshot extends BaseStatModel
{
protected $table = 'stat_snapshots';
public $timestamps = false;
protected $casts = [
'snapshot_date' => 'date',
'data' => 'array',
'created_at' => 'datetime',
];
}