feat: [rd] AI 견적 엔진 테이블 생성 + 모듈 카탈로그 시더

- ai_quotation_modules: SAM 모듈 카탈로그 (18개 모듈)
- ai_quotations: AI 견적 요청/결과
- ai_quotation_items: AI 추천 모듈 목록
- AiQuotationModuleSeeder: customer-pricing 기반 초기 데이터
This commit is contained in:
김보곤
2026-03-02 17:43:36 +09:00
parent d7dd6cdbc5
commit d8abc57271
2 changed files with 370 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
// SAM 모듈 카탈로그
Schema::create('ai_quotation_modules', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id');
$table->string('module_code', 50);
$table->string('module_name', 100);
$table->enum('category', ['basic', 'individual', 'addon']);
$table->text('description')->nullable();
$table->json('keywords')->nullable();
$table->decimal('dev_cost', 12, 0)->default(0);
$table->decimal('monthly_fee', 10, 0)->default(0);
$table->boolean('is_active')->default(true);
$table->integer('sort_order')->default(0);
$table->json('options')->nullable();
$table->timestamps();
$table->unique(['tenant_id', 'module_code'], 'uk_tenant_module');
$table->index('tenant_id');
$table->index('category');
});
// AI 견적 요청/결과
Schema::create('ai_quotations', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id');
$table->string('title', 200);
$table->enum('input_type', ['text', 'voice', 'document'])->default('text');
$table->longText('input_text')->nullable();
$table->string('input_file_path', 500)->nullable();
$table->string('ai_provider', 20)->default('gemini');
$table->string('ai_model', 50)->nullable();
$table->json('analysis_result')->nullable();
$table->json('quotation_result')->nullable();
$table->string('status', 20)->default('pending');
$table->unsignedBigInteger('linked_quote_id')->nullable();
$table->decimal('total_dev_cost', 12, 0)->default(0);
$table->decimal('total_monthly_fee', 10, 0)->default(0);
$table->unsignedBigInteger('created_by')->nullable();
$table->json('options')->nullable();
$table->timestamps();
$table->softDeletes();
$table->index('tenant_id');
$table->index('status');
$table->index('created_by');
});
// AI 추천 모듈 목록
Schema::create('ai_quotation_items', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('ai_quotation_id');
$table->unsignedBigInteger('module_id')->nullable();
$table->string('module_code', 50);
$table->string('module_name', 100);
$table->boolean('is_required')->default(false);
$table->text('reason')->nullable();
$table->decimal('dev_cost', 12, 0)->default(0);
$table->decimal('monthly_fee', 10, 0)->default(0);
$table->integer('sort_order')->default(0);
$table->json('options')->nullable();
$table->timestamps();
$table->foreign('ai_quotation_id')
->references('id')
->on('ai_quotations')
->cascadeOnDelete();
$table->index('ai_quotation_id');
$table->index('module_id');
});
}
public function down(): void
{
Schema::dropIfExists('ai_quotation_items');
Schema::dropIfExists('ai_quotations');
Schema::dropIfExists('ai_quotation_modules');
}
};

View File

@@ -0,0 +1,281 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class AiQuotationModuleSeeder extends Seeder
{
public function run(): void
{
$tenantId = 1;
$modules = [
[
'module_code' => 'BASIC_PKG',
'module_name' => '기본 패키지 (인사+근태+급여+게시판)',
'category' => 'basic',
'description' => '인사관리, 근태관리, 급여관리, 게시판/공지사항을 포함하는 기본 패키지. 모든 기업에 필수적인 기본 관리 모듈을 통합 제공합니다.',
'keywords' => json_encode([
'keywords' => ['기본', '인사', '근태', '급여', '게시판', '공지사항', '직원관리'],
'pain_points' => ['직원 관리 시스템 없음', '출퇴근 기록 수기', '급여 엑셀 관리'],
'business_needs' => ['직원 기본 관리', '출퇴근 관리', '급여 자동화', '사내 공지'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 5000000,
'monthly_fee' => 200000,
'sort_order' => 1,
],
[
'module_code' => 'HR',
'module_name' => '인사관리',
'category' => 'individual',
'description' => '직원 정보, 조직도, 부서 관리, 입퇴사 처리, 인사발령 관리',
'keywords' => json_encode([
'keywords' => ['직원', '사원', '인사', '조직도', '부서', '입퇴사', '인력', '인사발령'],
'pain_points' => ['엑셀로 직원 관리', '입퇴사 관리가 번거로움', '조직도 없음'],
'business_needs' => ['직원 정보 통합', '조직 구조 관리', '인력 현황 파악'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 2000000,
'monthly_fee' => 80000,
'sort_order' => 10,
],
[
'module_code' => 'ATTENDANCE',
'module_name' => '근태관리',
'category' => 'individual',
'description' => '출퇴근 기록, 연차/휴가 관리, 초과근무, 근태 통계',
'keywords' => json_encode([
'keywords' => ['출퇴근', '근태', '연차', '휴가', '초과근무', '야근', '출근부'],
'pain_points' => ['수기 출퇴근 기록', '연차 잔여 파악 어려움', '초과근무 관리 부재'],
'business_needs' => ['자동 출퇴근 기록', '연차 관리', '근태 현황 파악'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 1500000,
'monthly_fee' => 60000,
'sort_order' => 11,
],
[
'module_code' => 'PAYROLL',
'module_name' => '급여관리',
'category' => 'individual',
'description' => '급여 계산, 4대보험, 원천징수, 급여명세서, 퇴직금 산출',
'keywords' => json_encode([
'keywords' => ['급여', '월급', '4대보험', '원천징수', '급여명세서', '퇴직금', '세금'],
'pain_points' => ['엑셀 급여 계산', '4대보험 수동 계산', '급여명세서 수동 발급'],
'business_needs' => ['급여 자동 계산', '세금/보험 자동 처리', '급여명세서 자동 발급'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 2500000,
'monthly_fee' => 100000,
'sort_order' => 12,
],
[
'module_code' => 'BOARD',
'module_name' => '게시판/공지사항',
'category' => 'individual',
'description' => '사내 공지사항, 자유게시판, 부서별 게시판, 파일 첨부',
'keywords' => json_encode([
'keywords' => ['게시판', '공지사항', '사내공지', '알림', '커뮤니케이션'],
'pain_points' => ['공지 전달 어려움', '사내 소통 부재'],
'business_needs' => ['사내 공지 시스템', '부서간 소통'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 500000,
'monthly_fee' => 20000,
'sort_order' => 13,
],
[
'module_code' => 'SALES',
'module_name' => '영업관리 (CRM+견적+수주)',
'category' => 'individual',
'description' => '고객관리(CRM), 견적서 작성/관리, 수주 관리, 영업 현황 대시보드',
'keywords' => json_encode([
'keywords' => ['영업', 'CRM', '고객', '견적', '수주', '거래처', '매출', '영업사원'],
'pain_points' => ['견적서 수동 작성', '고객 이력 관리 안 됨', '영업 현황 파악 어려움'],
'business_needs' => ['고객 DB 관리', '견적 자동화', '수주 관리', '영업 실적 분석'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 5000000,
'monthly_fee' => 150000,
'sort_order' => 20,
],
[
'module_code' => 'PURCHASE',
'module_name' => '구매/자재관리',
'category' => 'individual',
'description' => '발주, 입고, 자재관리, 재고현황, 거래처 관리',
'keywords' => json_encode([
'keywords' => ['구매', '자재', '발주', '입고', '재고', '거래처', '원자재', '부품'],
'pain_points' => ['재고 파악 불가', '발주 관리 수동', '자재 이력 추적 안 됨'],
'business_needs' => ['실시간 재고 관리', '자동 발주', '자재 이력 추적'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 3000000,
'monthly_fee' => 100000,
'sort_order' => 30,
],
[
'module_code' => 'PRODUCTION',
'module_name' => '생산관리 (MES)',
'category' => 'individual',
'description' => '작업지시, 공정관리, LOT 추적, 생산실적, 불량관리',
'keywords' => json_encode([
'keywords' => ['생산', '제조', '작업지시', '공정', 'LOT', '불량', 'MES', '작업일보'],
'pain_points' => ['생산 현황 수기 기록', '불량 추적 불가', '납기 관리 어려움', '작업일보 종이'],
'business_needs' => ['실시간 생산현황', '불량률 관리', '작업지시 자동화', 'LOT 추적'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 8000000,
'monthly_fee' => 250000,
'sort_order' => 40,
],
[
'module_code' => 'QUALITY',
'module_name' => '품질관리',
'category' => 'individual',
'description' => '수입검사, 공정검사, 출하검사, 불량분석, 검사성적서',
'keywords' => json_encode([
'keywords' => ['품질', '검사', '불량', '수입검사', '출하검사', '품질인증', 'ISO'],
'pain_points' => ['검사 기록 수기', '불량 원인 분석 어려움', '검사성적서 수동 발행'],
'business_needs' => ['검사 이력 관리', '불량 분석 자동화', '검사성적서 자동 발행'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 4000000,
'monthly_fee' => 120000,
'sort_order' => 41,
],
[
'module_code' => 'FINANCE',
'module_name' => '재무/회계관리',
'category' => 'individual',
'description' => '매출/매입 관리, 세금계산서, 미수금/미지급금, 재무제표',
'keywords' => json_encode([
'keywords' => ['재무', '회계', '매출', '매입', '세금계산서', '미수금', '미지급금', '장부'],
'pain_points' => ['엑셀 장부 관리', '세금계산서 수동 발행', '미수금 추적 어려움'],
'business_needs' => ['자동 장부 관리', '세금계산서 자동 발행', '미수금 알림'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 5000000,
'monthly_fee' => 150000,
'sort_order' => 50,
],
[
'module_code' => 'LOGISTICS',
'module_name' => '물류/출하관리',
'category' => 'individual',
'description' => '출하 계획, 배송 관리, 운송장 발행, 출하 이력',
'keywords' => json_encode([
'keywords' => ['물류', '출하', '배송', '운송', '택배', '납품', '출고'],
'pain_points' => ['출하 현황 파악 어려움', '배송 추적 불가'],
'business_needs' => ['출하 계획 관리', '배송 추적', '납품서 자동 발행'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 3000000,
'monthly_fee' => 100000,
'sort_order' => 31,
],
[
'module_code' => 'APPROVAL',
'module_name' => '전자결재',
'category' => 'individual',
'description' => '결재 라인 설정, 기안/승인/반려, 결재 양식 관리',
'keywords' => json_encode([
'keywords' => ['결재', '기안', '승인', '품의서', '지출결의', '전자결재', '워크플로우'],
'pain_points' => ['종이 결재', '결재 지연', '결재 이력 관리 안 됨'],
'business_needs' => ['전자결재 도입', '결재 프로세스 자동화', '모바일 결재'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 3000000,
'monthly_fee' => 80000,
'sort_order' => 60,
],
[
'module_code' => 'DOCUMENT',
'module_name' => '문서관리 (전자서명)',
'category' => 'individual',
'description' => '문서 생성/관리, 전자서명, 문서 버전 관리, 계약서 관리',
'keywords' => json_encode([
'keywords' => ['문서', '계약서', '전자서명', '서명', '파일관리', '문서보관'],
'pain_points' => ['종이 계약서', '문서 분실', '서명을 위한 방문'],
'business_needs' => ['전자서명', '문서 중앙관리', '계약서 자동 생성'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 2000000,
'monthly_fee' => 60000,
'sort_order' => 61,
],
[
'module_code' => 'EQUIPMENT',
'module_name' => '설비관리',
'category' => 'individual',
'description' => '설비 대장, 점검/보전 관리, 고장 이력, 예방보전',
'keywords' => json_encode([
'keywords' => ['설비', '기계', '점검', '보전', '고장', '수리', '유지보수'],
'pain_points' => ['설비 이력 관리 안 됨', '고장 대응 늦음', '점검 일정 수동 관리'],
'business_needs' => ['설비 대장 관리', '점검 일정 자동화', '고장 이력 추적'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 3000000,
'monthly_fee' => 100000,
'sort_order' => 42,
],
[
'module_code' => 'INTEGRATED',
'module_name' => '통합 패키지',
'category' => 'basic',
'description' => '모든 개별 모듈을 포함하는 통합 패키지. 개별 구매 대비 할인 적용.',
'keywords' => json_encode([
'keywords' => ['통합', '전사', 'ERP', '올인원', '풀패키지'],
'pain_points' => ['전체 업무 디지털화 필요', '시스템 분산으로 인한 비효율'],
'business_needs' => ['전사 통합 관리', '데이터 일원화', '부서간 연계'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 30000000,
'monthly_fee' => 800000,
'sort_order' => 2,
],
[
'module_code' => 'AI_TOKEN',
'module_name' => 'AI 토큰 추가',
'category' => 'addon',
'description' => 'AI 기능 사용을 위한 추가 토큰. 기본 월 100만 토큰 포함, 초과분 별도.',
'keywords' => json_encode([
'keywords' => ['AI', '인공지능', '자동화', '챗봇', '음성인식'],
'pain_points' => [],
'business_needs' => ['AI 분석', '자동화 강화'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 0,
'monthly_fee' => 0,
'sort_order' => 90,
],
[
'module_code' => 'STORAGE',
'module_name' => '파일 저장공간 추가',
'category' => 'addon',
'description' => '기본 10GB 포함, 추가 저장공간. 문서, 이미지, 첨부파일 등.',
'keywords' => json_encode([
'keywords' => ['저장공간', '파일', '클라우드', '백업', '스토리지'],
'pain_points' => [],
'business_needs' => ['대용량 파일 저장', '클라우드 백업'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 0,
'monthly_fee' => 0,
'sort_order' => 91,
],
[
'module_code' => 'CUSTOM_DEV',
'module_name' => '커스텀 개발',
'category' => 'addon',
'description' => '고객 맞춤형 기능 개발. 별도 협의 필요.',
'keywords' => json_encode([
'keywords' => ['맞춤', '커스텀', '추가개발', '특수기능'],
'pain_points' => [],
'business_needs' => ['업종별 특수 기능', '기존 시스템 연동'],
], JSON_UNESCAPED_UNICODE),
'dev_cost' => 0,
'monthly_fee' => 0,
'sort_order' => 92,
],
];
foreach ($modules as $module) {
DB::table('ai_quotation_modules')->updateOrInsert(
['tenant_id' => $tenantId, 'module_code' => $module['module_code']],
array_merge($module, [
'tenant_id' => $tenantId,
'is_active' => true,
'created_at' => now(),
'updated_at' => now(),
])
);
}
}
}