feat: [CEO 대시보드] 섹션별 API + 일일보고서 엑셀
- DashboardCeo 리스크 감지형 서비스 리팩토링 - 일일보고서 어음/외상매출채권 현황 섹션 추가 - 엑셀 내보내기 화면 데이터 기반 리팩토링 - 공정명 컬럼 및 근태 부서 조인 수정 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,11 +2,14 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Exports\DailyReportExport;
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\DailyReportService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
/**
|
||||
* 일일 보고서 컨트롤러
|
||||
@@ -58,4 +61,19 @@ public function summary(Request $request): JsonResponse
|
||||
return $this->service->summary($params);
|
||||
}, __('message.fetched'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 일일 보고서 엑셀 다운로드
|
||||
*/
|
||||
public function export(Request $request): BinaryFileResponse
|
||||
{
|
||||
$params = $request->validate([
|
||||
'date' => 'nullable|date',
|
||||
]);
|
||||
|
||||
$reportData = $this->service->exportData($params);
|
||||
$filename = '일일일보_'.$reportData['date'].'.xlsx';
|
||||
|
||||
return Excel::download(new DailyReportExport($reportData), $filename);
|
||||
}
|
||||
}
|
||||
|
||||
92
app/Http/Controllers/Api/V1/DashboardCeoController.php
Normal file
92
app/Http/Controllers/Api/V1/DashboardCeoController.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Helpers\ApiResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\DashboardCeoService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
* CEO 대시보드 섹션별 API 컨트롤러
|
||||
*
|
||||
* 6개 섹션: 매출, 매입, 생산, 미출고, 시공, 근태
|
||||
*/
|
||||
class DashboardCeoController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly DashboardCeoService $service
|
||||
) {}
|
||||
|
||||
/**
|
||||
* 매출 현황 요약
|
||||
* GET /api/v1/dashboard/sales/summary
|
||||
*/
|
||||
public function salesSummary(): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->service->salesSummary(),
|
||||
__('message.fetched')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 매입 현황 요약
|
||||
* GET /api/v1/dashboard/purchases/summary
|
||||
*/
|
||||
public function purchasesSummary(): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->service->purchasesSummary(),
|
||||
__('message.fetched')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 생산 현황 요약
|
||||
* GET /api/v1/dashboard/production/summary
|
||||
*/
|
||||
public function productionSummary(): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->service->productionSummary(),
|
||||
__('message.fetched')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 미출고 내역 요약
|
||||
* GET /api/v1/dashboard/unshipped/summary
|
||||
*/
|
||||
public function unshippedSummary(): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->service->unshippedSummary(),
|
||||
__('message.fetched')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 시공 현황 요약
|
||||
* GET /api/v1/dashboard/construction/summary
|
||||
*/
|
||||
public function constructionSummary(): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->service->constructionSummary(),
|
||||
__('message.fetched')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 근태 현황 요약
|
||||
* GET /api/v1/dashboard/attendance/summary
|
||||
*/
|
||||
public function attendanceSummary(): JsonResponse
|
||||
{
|
||||
return ApiResponse::handle(
|
||||
fn () => $this->service->attendanceSummary(),
|
||||
__('message.fetched')
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user