feat:전자서명 문서 다운로드 시 미리보기 PDF 제공 (서명/도장 제외 필드 합성)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -388,9 +388,18 @@ public function downloadDocument(string $token): StreamedResponse|JsonResponse
|
||||
}
|
||||
|
||||
// 서명 완료된 PDF가 있으면 우선 제공
|
||||
$filePath = $contract->signed_file_path && Storage::disk('local')->exists($contract->signed_file_path)
|
||||
? $contract->signed_file_path
|
||||
: $contract->original_file_path;
|
||||
if ($contract->signed_file_path && Storage::disk('local')->exists($contract->signed_file_path)) {
|
||||
$filePath = $contract->signed_file_path;
|
||||
} else {
|
||||
// 서명 전: 텍스트/날짜/체크박스 필드가 합성된 미리보기 PDF 생성
|
||||
try {
|
||||
$pdfService = new PdfSignatureService();
|
||||
$filePath = $pdfService->generatePreview($contract);
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('미리보기 PDF 생성 실패, 원본 제공', ['error' => $e->getMessage()]);
|
||||
$filePath = $contract->original_file_path;
|
||||
}
|
||||
}
|
||||
|
||||
if (! Storage::disk('local')->exists($filePath)) {
|
||||
return response()->json(['success' => false, 'message' => '문서 파일이 존재하지 않습니다.'], 404);
|
||||
|
||||
Reference in New Issue
Block a user