From 6c67d80e252c11f21d28a17bcf44017c47f1b409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Fri, 20 Mar 2026 23:04:28 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[workorder]=20=EC=A0=88=EA=B3=A1=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=EC=9D=BC=EC=A7=80=20bending=5Fimages=20R2=20?= =?UTF-8?q?presigned=20URL=20=EB=B0=98=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - getWorkLog()에 bending_images 맵 추가 (22개 정적 이미지) - buildBendingImageUrls() 메서드 추가 - Storage import 추가 - document->data null 체크 추가 - stats에 draft 상태를 reception_count에 포함 --- app/Services/WorkOrderService.php | 35 ++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/app/Services/WorkOrderService.php b/app/Services/WorkOrderService.php index 5e08398d..421b789e 100644 --- a/app/Services/WorkOrderService.php +++ b/app/Services/WorkOrderService.php @@ -3,6 +3,7 @@ namespace App\Services; use App\Models\Documents\Document; +use Illuminate\Support\Facades\Storage; use App\Models\Documents\DocumentTemplate; use App\Models\Orders\Order; use App\Models\Process; @@ -3445,7 +3446,7 @@ public function getWorkLog(int $workOrderId): array 'comment' => $a->comment, 'acted_at' => $a->acted_at, ])->toArray(), - 'data' => $document->data->map(fn ($d) => [ + 'data' => ($document->data ?? collect())->map(fn ($d) => [ 'field_key' => $d->field_key, 'field_value' => $d->field_value, 'section_id' => $d->section_id, @@ -3456,9 +3457,41 @@ public function getWorkLog(int $workOrderId): array 'auto_values' => $this->buildWorkLogAutoValues($workOrder), 'work_order_info' => $this->buildWorkOrderInfo($workOrder), 'work_stats' => $this->calculateWorkStats($workOrder), + 'bending_images' => $this->buildBendingImageUrls(), ]; } + /** + * 절곡 정적 이미지 R2 presigned URL 맵 생성 + */ + private function buildBendingImageUrls(): array + { + $images = []; + $paths = [ + 'guiderail_KSS01_wall_120x70', 'guiderail_KSS01_side_120x120', + 'guiderail_KSS02_wall_120x70', 'guiderail_KSS02_side_120x120', + 'guiderail_KSE01_wall_120x70', 'guiderail_KSE01_side_120x120', + 'guiderail_KWE01_wall_120x70', 'guiderail_KWE01_side_120x120', + 'guiderail_KTE01_wall_130x75', 'guiderail_KTE01_side_130x125', + 'guiderail_KQTS01_wall_130x75', 'guiderail_KQTS01_side_130x125', + 'bottombar_KSS01', 'bottombar_KSS02', 'bottombar_KSE01', + 'bottombar_KWE01', 'bottombar_KTE01', 'bottombar_KQTS01', + 'box_both', 'box_bottom', 'box_rear', + 'smokeban', + ]; + + foreach ($paths as $name) { + $category = str_contains($name, 'guiderail') ? 'guiderail' + : (str_contains($name, 'bottombar') ? 'bottombar' + : (str_contains($name, 'box') ? 'box' : 'part')); + $r2Path = "images/bending/{$category}/{$name}.jpg"; + + $images[$name] = Storage::disk('r2')->temporaryUrl($r2Path, now()->addMinutes(30)); + } + + return $images; + } + /** * 작업일지 생성/수정 (Document 기반) *