feat:거래처 등록 사업자등록증 OCR 기능 추가

- TradingPartnerOcrService 신규 생성 (Gemini Vision API 사업자등록증 OCR)
- TradingPartnerController에 ocr() 메서드 추가
- partners 라우트 그룹에 OCR 엔드포인트 추가
- 거래처 등록 모달에 이미지 드래그앤드롭 업로드 UI 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-10 15:18:51 +09:00
parent beae44db24
commit bc4322c1f5
4 changed files with 402 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
use App\Http\Controllers\Controller;
use App\Models\Finance\TradingPartner;
use App\Services\TradingPartnerOcrService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -164,6 +165,24 @@ public function update(Request $request, int $id): JsonResponse
]);
}
public function ocr(Request $request, TradingPartnerOcrService $ocrService): JsonResponse
{
$request->validate([
'image' => 'required|string',
]);
try {
$result = $ocrService->extractFromImage($request->input('image'));
return response()->json($result);
} catch (\RuntimeException $e) {
return response()->json([
'ok' => false,
'message' => $e->getMessage(),
], 500);
}
}
public function destroy(int $id): JsonResponse
{
$tenantId = session('selected_tenant_id', 1);