feat: 增强报表功能,支持新参数和导出类型

- 在 `ReportJobStoreRequest` 中新增 `draw_id`、`draw_no` 和 `normalized_number` 参数的验证规则。
- 更新 `AdminReportJobService` 以支持动态生成输出路径后缀,确保导出文件名包含相关信息。
- 在 `AdminReportQueryService` 中新增多个报表类型的处理逻辑,包括 `draw_profit_summary` 和 `sold_out_number_report`。
- 添加相应的测试用例,确保新功能的正确性和稳定性。
This commit is contained in:
2026-05-26 11:48:40 +08:00
parent c74bec3f64
commit bba084b3c1
5 changed files with 464 additions and 1 deletions

View File

@@ -32,6 +32,8 @@ final class AdminReportJobService
$jobNo = 'RPT'.now()->format('YmdHis').strtoupper(Str::random(4));
$exportFormat = $exportFormat === 'xlsx' ? 'xlsx' : 'csv';
$pathSuffix = $this->queryService->resolveOutputPathSuffix($reportType, $params, $dateFrom, $dateTo);
$job = ReportJob::query()->create([
'job_no' => $jobNo,
'admin_user_id' => (int) $admin->getKey(),
@@ -39,7 +41,7 @@ final class AdminReportJobService
'export_format' => $exportFormat,
'filter_json' => $params,
'status' => 'completed',
'output_path' => 'reports/'.$this->queryService->reportLabel($reportType).'_'.$dateFrom.'_'.$dateTo.'.'.$exportFormat,
'output_path' => 'reports/'.$this->queryService->reportLabel($reportType).'_'.$pathSuffix.'.'.$exportFormat,
'error_message' => null,
'finished_at' => now(),
]);