feat: sam_stat P1 도메인 확장 (Phase 3)

- 차원 테이블: dim_client, dim_product 마이그레이션 + SCD Type 2 동기화 (DimensionSyncService)
- 재고 통계: stat_inventory_daily + InventoryStatService (stocks, stock_transactions, inspections)
- 견적/영업 통계: stat_quote_pipeline_daily + QuoteStatService (quotes, biddings, sales_prospects)
- 인사/근태 통계: stat_hr_attendance_daily + HrStatService (attendances, leaves, user_tenants)
- KPI/알림: stat_kpi_targets, stat_alerts + KpiAlertService + StatCheckKpiAlertsCommand
- StatAggregatorService에 inventory, quote, hr 도메인 추가 (총 6개 도메인)
- 스케줄러: stat:check-kpi-alerts 매일 09:00 등록

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-29 20:19:50 +09:00
parent 6c9735581d
commit 595e3d59b4
22 changed files with 1065 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models\Stats\Daily;
use App\Models\Stats\BaseStatModel;
class StatHrAttendanceDaily extends BaseStatModel
{
protected $table = 'stat_hr_attendance_daily';
protected $casts = [
'stat_date' => 'date',
'attendance_rate' => 'decimal:2',
'overtime_hours' => 'decimal:2',
'total_labor_cost' => 'decimal:2',
];
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Models\Stats\Daily;
use App\Models\Stats\BaseStatModel;
class StatInventoryDaily extends BaseStatModel
{
protected $table = 'stat_inventory_daily';
protected $casts = [
'stat_date' => 'date',
'total_stock_qty' => 'decimal:2',
'total_stock_value' => 'decimal:2',
'receipt_qty' => 'decimal:2',
'receipt_amount' => 'decimal:2',
'issue_qty' => 'decimal:2',
'issue_amount' => 'decimal:2',
'inspection_pass_rate' => 'decimal:2',
'turnover_rate' => 'decimal:2',
];
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models\Stats\Daily;
use App\Models\Stats\BaseStatModel;
class StatQuotePipelineDaily extends BaseStatModel
{
protected $table = 'stat_quote_pipeline_daily';
protected $casts = [
'stat_date' => 'date',
'quote_amount' => 'decimal:2',
'quote_conversion_rate' => 'decimal:2',
'prospect_amount' => 'decimal:2',
'bidding_amount' => 'decimal:2',
];
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models\Stats\Dimensions;
use App\Models\Stats\BaseStatModel;
class DimClient extends BaseStatModel
{
protected $table = 'dim_client';
public $timestamps = false;
protected $casts = [
'valid_from' => 'date',
'valid_to' => 'date',
'is_current' => 'boolean',
];
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models\Stats\Dimensions;
use App\Models\Stats\BaseStatModel;
class DimProduct extends BaseStatModel
{
protected $table = 'dim_product';
public $timestamps = false;
protected $casts = [
'valid_from' => 'date',
'valid_to' => 'date',
'is_current' => 'boolean',
];
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models\Stats;
class StatAlert extends BaseStatModel
{
protected $table = 'stat_alerts';
public $timestamps = false;
protected $casts = [
'current_value' => 'decimal:2',
'threshold_value' => 'decimal:2',
'is_read' => 'boolean',
'is_resolved' => 'boolean',
'resolved_at' => 'datetime',
'created_at' => 'datetime',
];
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models\Stats;
class StatKpiTarget extends BaseStatModel
{
protected $table = 'stat_kpi_targets';
protected $casts = [
'target_value' => 'decimal:2',
];
}