feat:기업 기본정보 및 국세청 사업자등록 상태 조회 기능 추가
- CooconService에 OA08 기업기본정보 API 추가 - NtsBusinessService 신규 생성 (국세청 사업자등록 상태조회) - CreditInquiry 모델에 회사정보 및 국세청 상태 필드 추가 - 마이그레이션: 기업정보 및 국세청 상태 컬럼 추가 - UI: 리스트에 업체정보/국세청 상태 컬럼 표시 - 원본 데이터 모달에 회사정보 헤더 추가 - 리포트 모달에 회사정보 및 신용요약 표시 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
use App\Models\Coocon\CooconConfig;
|
||||
use App\Models\Credit\CreditInquiry;
|
||||
use App\Services\Coocon\CooconService;
|
||||
use App\Services\Nts\NtsBusinessService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
@@ -78,31 +79,47 @@ public function search(Request $request): JsonResponse
|
||||
|
||||
$companyKey = preg_replace('/[^0-9]/', '', $request->input('company_key'));
|
||||
|
||||
$service = new CooconService();
|
||||
$cooconService = new CooconService();
|
||||
|
||||
if (!$service->hasConfig()) {
|
||||
if (!$cooconService->hasConfig()) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'error' => '쿠콘 API 설정이 없습니다. 설정을 먼저 등록해주세요.',
|
||||
], 400);
|
||||
}
|
||||
|
||||
// 전체 신용정보 조회
|
||||
$apiResult = $service->getAllCreditInfo($companyKey);
|
||||
// 전체 신용정보 조회 (쿠콘 API)
|
||||
$apiResult = $cooconService->getAllCreditInfo($companyKey);
|
||||
|
||||
// 국세청 사업자등록 상태 조회
|
||||
$ntsService = new NtsBusinessService();
|
||||
$ntsResult = $ntsService->getBusinessStatus($companyKey);
|
||||
|
||||
// DB에 저장
|
||||
$inquiry = CreditInquiry::createFromApiResponse(
|
||||
$companyKey,
|
||||
$apiResult,
|
||||
$ntsResult,
|
||||
auth()->id()
|
||||
);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'data' => $apiResult,
|
||||
'nts' => $ntsResult,
|
||||
'inquiry_key' => $inquiry->inquiry_key,
|
||||
'inquiry_id' => $inquiry->id,
|
||||
'company_key' => $companyKey,
|
||||
'company_info' => [
|
||||
'company_name' => $inquiry->company_name,
|
||||
'ceo_name' => $inquiry->ceo_name,
|
||||
'company_address' => $inquiry->company_address,
|
||||
'business_type' => $inquiry->business_type,
|
||||
'business_item' => $inquiry->business_item,
|
||||
'nts_status' => $inquiry->nts_status,
|
||||
'nts_status_label' => $inquiry->nts_status_label,
|
||||
'nts_tax_type' => $inquiry->nts_tax_type,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -122,6 +139,13 @@ public function getRawData(string $inquiryKey): JsonResponse
|
||||
'company_key' => $inquiry->company_key,
|
||||
'formatted_company_key' => $inquiry->formatted_company_key,
|
||||
'company_name' => $inquiry->company_name,
|
||||
'ceo_name' => $inquiry->ceo_name,
|
||||
'company_address' => $inquiry->company_address,
|
||||
'business_type' => $inquiry->business_type,
|
||||
'business_item' => $inquiry->business_item,
|
||||
'nts_status' => $inquiry->nts_status,
|
||||
'nts_status_label' => $inquiry->nts_status_label,
|
||||
'nts_tax_type' => $inquiry->nts_tax_type,
|
||||
'inquired_at' => $inquiry->inquired_at->format('Y-m-d H:i:s'),
|
||||
'status' => $inquiry->status,
|
||||
'total_issue_count' => $inquiry->total_issue_count,
|
||||
@@ -164,8 +188,20 @@ private function transformToReportFormat(CreditInquiry $inquiry): array
|
||||
'company_info' => [
|
||||
'company_key' => $inquiry->formatted_company_key,
|
||||
'company_name' => $inquiry->company_name ?? '-',
|
||||
'ceo_name' => $inquiry->ceo_name ?? '-',
|
||||
'company_address' => $inquiry->company_address ?? '-',
|
||||
'business_type' => $inquiry->business_type ?? '-',
|
||||
'business_item' => $inquiry->business_item ?? '-',
|
||||
'establishment_date' => $inquiry->establishment_date?->format('Y-m-d') ?? '-',
|
||||
'inquired_at' => $inquiry->inquired_at->format('Y년 m월 d일 H:i'),
|
||||
],
|
||||
'nts_info' => [
|
||||
'status' => $inquiry->nts_status ?? '-',
|
||||
'status_label' => $inquiry->nts_status_label,
|
||||
'tax_type' => $inquiry->nts_tax_type ?? '-',
|
||||
'closure_date' => $inquiry->nts_closure_date?->format('Y-m-d') ?? null,
|
||||
'is_active' => $inquiry->isNtsActive(),
|
||||
],
|
||||
'summary' => [
|
||||
'total_issue_count' => $inquiry->total_issue_count,
|
||||
'has_issue' => $inquiry->has_issue,
|
||||
|
||||
Reference in New Issue
Block a user