From 4462646550555e56b07d2cdd2d1ea4702dcce75c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Thu, 26 Feb 2026 21:59:47 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[attendance]=20=EC=A3=BC=EA=B0=84=20?= =?UTF-8?q?=EA=B7=BC=EB=AC=B4=EC=8B=9C=EA=B0=84=20=EA=B3=84=EC=82=B0=20UNS?= =?UTF-8?q?IGNED=20=EC=98=A4=EB=B2=84=ED=94=8C=EB=A1=9C=EC=9A=B0=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CAST(... AS UNSIGNED)에서 음수값 시 2^64-1로 오버플로우되던 버그 - CAST(... AS SIGNED) + COALESCE + GREATEST(0, ...)로 안전하게 변경 - getOvertimeAlerts(), getEmployeeMonthlySummary() 두 곳 수정 --- app/Services/HR/AttendanceService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Services/HR/AttendanceService.php b/app/Services/HR/AttendanceService.php index d5f66d22..cde236a8 100644 --- a/app/Services/HR/AttendanceService.php +++ b/app/Services/HR/AttendanceService.php @@ -357,7 +357,7 @@ public function getEmployeeMonthlySummary(int $year, int $month): array 'user_id', 'status', DB::raw('COUNT(*) as cnt'), - DB::raw("SUM(CAST(JSON_UNQUOTE(JSON_EXTRACT(json_details, '$.work_minutes')) AS UNSIGNED)) as total_minutes") + DB::raw("SUM(GREATEST(0, COALESCE(CAST(JSON_UNQUOTE(JSON_EXTRACT(json_details, '$.work_minutes')) AS SIGNED), 0))) as total_minutes") ) ->groupBy('user_id', 'status') ->get(); @@ -409,7 +409,7 @@ public function getOvertimeAlerts(): array ->betweenDates($weekStart, $weekEnd) ->select( 'user_id', - DB::raw("SUM(CAST(JSON_UNQUOTE(JSON_EXTRACT(json_details, '$.work_minutes')) AS UNSIGNED)) as week_minutes") + DB::raw("SUM(GREATEST(0, COALESCE(CAST(JSON_UNQUOTE(JSON_EXTRACT(json_details, '$.work_minutes')) AS SIGNED), 0))) as week_minutes") ) ->groupBy('user_id') ->having('week_minutes', '>=', 2880) // 48시간 = 2880분