Files
sam-api/app/Http/Controllers/Api/V1/EntertainmentController.php
유병철 66da2972fa feat: [entertainment,loan] 접대비 상세 조회 API 및 가지급금 날짜 필터 추가
- EntertainmentController/Service: getDetail() 상세 조회 API 추가 (손금한도, 월별추이, 사용자분포, 거래내역, 분기현황)
- EntertainmentService: 수입금액별 추가한도 계산(세법 기준), 거래건별 리스크 감지
- LoanController/Service: dashboard에 start_date/end_date 파라미터 지원
- LoanService: getCategoryBreakdown 날짜 필터 적용, 목록 limit 10→50 확대
- 라우트: GET /entertainment/detail 엔드포인트 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 15:11:37 +09:00

51 lines
1.7 KiB
PHP

<?php
namespace App\Http\Controllers\Api\V1;
use App\Helpers\ApiResponse;
use App\Http\Controllers\Controller;
use App\Services\EntertainmentService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
/**
* 접대비 현황 컨트롤러
*
* CEO 대시보드용 접대비 현황 데이터를 제공합니다.
*/
class EntertainmentController extends Controller
{
public function __construct(
private readonly EntertainmentService $entertainmentService
) {}
/**
* 접대비 현황 요약 조회
*/
public function summary(Request $request): JsonResponse
{
$limitType = $request->query('limit_type', 'quarterly');
$companyType = $request->query('company_type', 'medium');
$year = $request->query('year') ? (int) $request->query('year') : null;
$quarter = $request->query('quarter') ? (int) $request->query('quarter') : null;
return ApiResponse::handle(function () use ($limitType, $companyType, $year, $quarter) {
return $this->entertainmentService->getSummary($limitType, $companyType, $year, $quarter);
}, __('message.fetched'));
}
/**
* 접대비 상세 조회 (모달용)
*/
public function detail(Request $request): JsonResponse
{
$companyType = $request->query('company_type', 'medium');
$year = $request->query('year') ? (int) $request->query('year') : null;
$quarter = $request->query('quarter') ? (int) $request->query('quarter') : null;
return ApiResponse::handle(function () use ($companyType, $year, $quarter) {
return $this->entertainmentService->getDetail($companyType, $year, $quarter);
}, __('message.fetched'));
}
}