fix: [esign] 로컬 저장 방식 법인도장이 서명 페이지에서 미표시되는 버그 수정
- store(): GCS뿐 아니라 local_path 도장도 signer에 자동 적용 - getContract(): signer에 도장 없어도 tenant_settings에서 확인하여 has_stamp 반환 - submitSignature(): 기존 계약 creator도 tenant_settings에서 도장 가져와 적용
This commit is contained in:
@@ -467,29 +467,36 @@ public function store(Request $request): JsonResponse
|
||||
]);
|
||||
}
|
||||
|
||||
// 법인도장 자동 적용: GCS에서 다운로드 → 로컬 저장 → signer에 설정
|
||||
// 법인도장 자동 적용: 설정에서 도장 이미지를 읽어 signer에 복사
|
||||
$stampSetting = TenantSetting::where('tenant_id', $tenantId)
|
||||
->where('setting_group', 'esign')
|
||||
->where('setting_key', 'company_stamp')
|
||||
->first();
|
||||
|
||||
if ($stampSetting && ! empty($stampSetting->setting_value['gcs_object'])) {
|
||||
if ($stampSetting) {
|
||||
$creatorSigner = EsignSigner::withoutGlobalScopes()
|
||||
->where('contract_id', $contract->id)
|
||||
->where('role', 'creator')
|
||||
->first();
|
||||
|
||||
if ($creatorSigner) {
|
||||
$gcs = app(GoogleCloudStorageService::class);
|
||||
$signedUrl = $gcs->getSignedUrl($stampSetting->setting_value['gcs_object'], 5);
|
||||
$val = $stampSetting->setting_value;
|
||||
$imageData = null;
|
||||
|
||||
if ($signedUrl) {
|
||||
$imageData = @file_get_contents($signedUrl);
|
||||
if ($imageData) {
|
||||
$localPath = "esign/{$tenantId}/signatures/{$contract->id}_{$creatorSigner->id}_stamp.png";
|
||||
Storage::disk('local')->put($localPath, $imageData);
|
||||
$creatorSigner->update(['signature_image_path' => $localPath]);
|
||||
if (! empty($val['gcs_object'])) {
|
||||
$gcs = app(GoogleCloudStorageService::class);
|
||||
$signedUrl = $gcs->getSignedUrl($val['gcs_object'], 5);
|
||||
if ($signedUrl) {
|
||||
$imageData = @file_get_contents($signedUrl);
|
||||
}
|
||||
} elseif (! empty($val['local_path']) && Storage::disk('local')->exists($val['local_path'])) {
|
||||
$imageData = Storage::disk('local')->get($val['local_path']);
|
||||
}
|
||||
|
||||
if ($imageData) {
|
||||
$localPath = "esign/{$tenantId}/signatures/{$contract->id}_{$creatorSigner->id}_stamp.png";
|
||||
Storage::disk('local')->put($localPath, $imageData);
|
||||
$creatorSigner->update(['signature_image_path' => $localPath]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user