- 테이블 3개: bad_debts, bad_debt_documents, bad_debt_memos - 모델 3개: BadDebt, BadDebtDocument, BadDebtMemo - BadDebtService: CRUD, 요약 통계, 서류/메모 관리 - API 엔드포인트 11개 (목록, 등록, 상세, 수정, 삭제, 토글, 서류/메모 CRUD) - Swagger 문서 작성 완료
434 lines
16 KiB
PHP
434 lines
16 KiB
PHP
<?php
|
|
|
|
namespace App\Swagger\v1;
|
|
|
|
/**
|
|
* @OA\Tag(name="BadDebt", description="악성채권 추심관리")
|
|
*
|
|
* @OA\Schema(
|
|
* schema="BadDebt",
|
|
*
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="tenant_id", type="integer", example=1),
|
|
* @OA\Property(property="client_id", type="integer", example=1),
|
|
* @OA\Property(property="debt_amount", type="number", format="decimal", example="10000000.00"),
|
|
* @OA\Property(property="status", type="string", enum={"collecting", "legal_action", "recovered", "bad_debt"}, example="collecting"),
|
|
* @OA\Property(property="overdue_days", type="integer", example=100),
|
|
* @OA\Property(property="assigned_user_id", type="integer", nullable=true, example=1),
|
|
* @OA\Property(property="occurred_at", type="string", format="date", nullable=true, example="2025-12-12"),
|
|
* @OA\Property(property="closed_at", type="string", format="date", nullable=true, example=null),
|
|
* @OA\Property(property="is_active", type="boolean", example=true),
|
|
* @OA\Property(property="options", type="object", nullable=true),
|
|
* @OA\Property(property="created_at", type="string", format="date-time"),
|
|
* @OA\Property(property="updated_at", type="string", format="date-time"),
|
|
* @OA\Property(
|
|
* property="client",
|
|
* type="object",
|
|
* @OA\Property(property="id", type="integer"),
|
|
* @OA\Property(property="name", type="string"),
|
|
* @OA\Property(property="client_code", type="string")
|
|
* ),
|
|
* @OA\Property(
|
|
* property="assigned_user",
|
|
* type="object",
|
|
* nullable=true,
|
|
* @OA\Property(property="id", type="integer"),
|
|
* @OA\Property(property="name", type="string")
|
|
* )
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="BadDebtPagination",
|
|
* allOf={
|
|
* @OA\Schema(ref="#/components/schemas/PaginationMeta"),
|
|
* @OA\Schema(
|
|
*
|
|
* @OA\Property(
|
|
* property="data",
|
|
* type="array",
|
|
*
|
|
* @OA\Items(ref="#/components/schemas/BadDebt")
|
|
* )
|
|
* )
|
|
* }
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="BadDebtSummary",
|
|
*
|
|
* @OA\Property(property="total_amount", type="number", example=50000000),
|
|
* @OA\Property(property="collecting_amount", type="number", example=30000000),
|
|
* @OA\Property(property="legal_action_amount", type="number", example=10000000),
|
|
* @OA\Property(property="recovered_amount", type="number", example=5000000),
|
|
* @OA\Property(property="bad_debt_amount", type="number", example=5000000)
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="BadDebtCreateRequest",
|
|
* required={"client_id", "debt_amount"},
|
|
*
|
|
* @OA\Property(property="client_id", type="integer", example=1),
|
|
* @OA\Property(property="debt_amount", type="number", example=10000000),
|
|
* @OA\Property(property="status", type="string", enum={"collecting", "legal_action", "recovered", "bad_debt"}, example="collecting"),
|
|
* @OA\Property(property="overdue_days", type="integer", example=100),
|
|
* @OA\Property(property="assigned_user_id", type="integer", nullable=true, example=1),
|
|
* @OA\Property(property="occurred_at", type="string", format="date", nullable=true, example="2025-12-12"),
|
|
* @OA\Property(property="closed_at", type="string", format="date", nullable=true),
|
|
* @OA\Property(property="is_active", type="boolean", example=true),
|
|
* @OA\Property(property="options", type="object", nullable=true)
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="BadDebtUpdateRequest",
|
|
*
|
|
* @OA\Property(property="client_id", type="integer", example=1),
|
|
* @OA\Property(property="debt_amount", type="number", example=10000000),
|
|
* @OA\Property(property="status", type="string", enum={"collecting", "legal_action", "recovered", "bad_debt"}, example="legal_action"),
|
|
* @OA\Property(property="overdue_days", type="integer", example=120),
|
|
* @OA\Property(property="assigned_user_id", type="integer", nullable=true, example=2),
|
|
* @OA\Property(property="occurred_at", type="string", format="date", nullable=true),
|
|
* @OA\Property(property="closed_at", type="string", format="date", nullable=true),
|
|
* @OA\Property(property="is_active", type="boolean", example=true),
|
|
* @OA\Property(property="options", type="object", nullable=true)
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="BadDebtDocument",
|
|
*
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="bad_debt_id", type="integer", example=1),
|
|
* @OA\Property(property="document_type", type="string", enum={"business_license", "tax_invoice", "additional"}, example="business_license"),
|
|
* @OA\Property(property="file_id", type="integer", example=1),
|
|
* @OA\Property(property="created_at", type="string", format="date-time"),
|
|
* @OA\Property(
|
|
* property="file",
|
|
* type="object",
|
|
* @OA\Property(property="id", type="integer"),
|
|
* @OA\Property(property="name", type="string"),
|
|
* @OA\Property(property="url", type="string")
|
|
* )
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="BadDebtDocumentCreateRequest",
|
|
* required={"document_type", "file_id"},
|
|
*
|
|
* @OA\Property(property="document_type", type="string", enum={"business_license", "tax_invoice", "additional"}, example="business_license"),
|
|
* @OA\Property(property="file_id", type="integer", example=1)
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="BadDebtMemo",
|
|
*
|
|
* @OA\Property(property="id", type="integer", example=1),
|
|
* @OA\Property(property="bad_debt_id", type="integer", example=1),
|
|
* @OA\Property(property="content", type="string", example="2025-12-12 홍길동 과장님 메모 내용"),
|
|
* @OA\Property(property="created_at", type="string", format="date-time"),
|
|
* @OA\Property(
|
|
* property="creator",
|
|
* type="object",
|
|
* @OA\Property(property="id", type="integer"),
|
|
* @OA\Property(property="name", type="string")
|
|
* )
|
|
* )
|
|
*
|
|
* @OA\Schema(
|
|
* schema="BadDebtMemoCreateRequest",
|
|
* required={"content"},
|
|
*
|
|
* @OA\Property(property="content", type="string", example="메모 내용", maxLength=5000)
|
|
* )
|
|
*/
|
|
class BadDebtApi
|
|
{
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/bad-debts",
|
|
* tags={"BadDebt"},
|
|
* summary="악성채권 목록 조회",
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(name="client_id", in="query", @OA\Schema(type="integer"), description="거래처 ID"),
|
|
* @OA\Parameter(name="status", in="query", @OA\Schema(type="string", enum={"collecting", "legal_action", "recovered", "bad_debt"}), description="상태"),
|
|
* @OA\Parameter(name="is_active", in="query", @OA\Schema(type="boolean"), description="활성화 여부"),
|
|
* @OA\Parameter(name="search", in="query", @OA\Schema(type="string"), description="검색어 (거래처명, 거래처코드)"),
|
|
* @OA\Parameter(name="sort_by", in="query", @OA\Schema(type="string", default="created_at"), description="정렬 기준"),
|
|
* @OA\Parameter(name="sort_dir", in="query", @OA\Schema(type="string", enum={"asc", "desc"}, default="desc"), description="정렬 방향"),
|
|
* @OA\Parameter(name="per_page", in="query", @OA\Schema(type="integer", default=20), description="페이지당 항목 수"),
|
|
* @OA\Parameter(name="page", in="query", @OA\Schema(type="integer", default=1), description="페이지 번호"),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="성공",
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/BadDebtPagination")
|
|
* )
|
|
* )
|
|
*/
|
|
public function index() {}
|
|
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/bad-debts/summary",
|
|
* tags={"BadDebt"},
|
|
* summary="악성채권 요약 통계",
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(name="client_id", in="query", @OA\Schema(type="integer"), description="거래처 ID (선택)"),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string"),
|
|
* @OA\Property(property="data", ref="#/components/schemas/BadDebtSummary")
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function summary() {}
|
|
|
|
/**
|
|
* @OA\Post(
|
|
* path="/api/v1/bad-debts",
|
|
* tags={"BadDebt"},
|
|
* summary="악성채권 등록",
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
*
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/BadDebtCreateRequest")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=201,
|
|
* description="생성 성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string"),
|
|
* @OA\Property(property="data", ref="#/components/schemas/BadDebt")
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function store() {}
|
|
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/v1/bad-debts/{id}",
|
|
* tags={"BadDebt"},
|
|
* summary="악성채권 상세 조회",
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string"),
|
|
* @OA\Property(property="data", ref="#/components/schemas/BadDebt")
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function show() {}
|
|
|
|
/**
|
|
* @OA\Put(
|
|
* path="/api/v1/bad-debts/{id}",
|
|
* tags={"BadDebt"},
|
|
* summary="악성채권 수정",
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
*
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/BadDebtUpdateRequest")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="수정 성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string"),
|
|
* @OA\Property(property="data", ref="#/components/schemas/BadDebt")
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function update() {}
|
|
|
|
/**
|
|
* @OA\Delete(
|
|
* path="/api/v1/bad-debts/{id}",
|
|
* tags={"BadDebt"},
|
|
* summary="악성채권 삭제",
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="삭제 성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string"),
|
|
* @OA\Property(property="data", type="null")
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function destroy() {}
|
|
|
|
/**
|
|
* @OA\Patch(
|
|
* path="/api/v1/bad-debts/{id}/toggle",
|
|
* tags={"BadDebt"},
|
|
* summary="악성채권 설정 ON/OFF 토글",
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="토글 성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string"),
|
|
* @OA\Property(property="data", ref="#/components/schemas/BadDebt")
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function toggle() {}
|
|
|
|
/**
|
|
* @OA\Post(
|
|
* path="/api/v1/bad-debts/{id}/documents",
|
|
* tags={"BadDebt"},
|
|
* summary="서류 첨부",
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
*
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/BadDebtDocumentCreateRequest")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=201,
|
|
* description="첨부 성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string"),
|
|
* @OA\Property(property="data", ref="#/components/schemas/BadDebtDocument")
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function addDocument() {}
|
|
|
|
/**
|
|
* @OA\Delete(
|
|
* path="/api/v1/bad-debts/{id}/documents/{documentId}",
|
|
* tags={"BadDebt"},
|
|
* summary="서류 삭제",
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Parameter(name="documentId", in="path", required=true, @OA\Schema(type="integer")),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="삭제 성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string"),
|
|
* @OA\Property(property="data", type="null")
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function removeDocument() {}
|
|
|
|
/**
|
|
* @OA\Post(
|
|
* path="/api/v1/bad-debts/{id}/memos",
|
|
* tags={"BadDebt"},
|
|
* summary="메모 추가",
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
*
|
|
* @OA\RequestBody(
|
|
* required=true,
|
|
*
|
|
* @OA\JsonContent(ref="#/components/schemas/BadDebtMemoCreateRequest")
|
|
* ),
|
|
*
|
|
* @OA\Response(
|
|
* response=201,
|
|
* description="추가 성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string"),
|
|
* @OA\Property(property="data", ref="#/components/schemas/BadDebtMemo")
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function addMemo() {}
|
|
|
|
/**
|
|
* @OA\Delete(
|
|
* path="/api/v1/bad-debts/{id}/memos/{memoId}",
|
|
* tags={"BadDebt"},
|
|
* summary="메모 삭제",
|
|
* security={{"ApiKeyAuth": {}, "BearerAuth": {}}},
|
|
*
|
|
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
|
|
* @OA\Parameter(name="memoId", in="path", required=true, @OA\Schema(type="integer")),
|
|
*
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="삭제 성공",
|
|
*
|
|
* @OA\JsonContent(
|
|
*
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
* @OA\Property(property="message", type="string"),
|
|
* @OA\Property(property="data", type="null")
|
|
* )
|
|
* )
|
|
* )
|
|
*/
|
|
public function removeMemo() {}
|
|
}
|