Изменения в основном report

This commit is contained in:
brusnitsyn
2026-05-06 22:32:11 +09:00
parent c5da85763c
commit 723ccee8d3
56 changed files with 1911 additions and 3814 deletions

View File

@@ -2,7 +2,6 @@
namespace App\Services;
use App\Application\Reports\ReportSavePathService;
use App\Models\Department;
use App\Models\MedicalHistorySnapshot;
use App\Models\MetrikaResult;
@@ -19,13 +18,12 @@ class AutoReportService
public function __construct(
mixed $dateRangeService = null,
mixed $reportSavePathService = null,
?ReportSavePathService $legacyReportSavePathService = null,
) {
if ($dateRangeService instanceof ReportService) {
$this->dateRangeService = $reportSavePathService instanceof DateRangeService
? $reportSavePathService
: app(DateRangeService::class);
$this->reportSavePathService = $legacyReportSavePathService ?? app(ReportSavePathService::class);
$this->reportService = $dateRangeService;
return;
}
@@ -33,12 +31,14 @@ class AutoReportService
$this->dateRangeService = $dateRangeService instanceof DateRangeService
? $dateRangeService
: app(DateRangeService::class);
$this->reportSavePathService = $reportSavePathService ?? app(ReportSavePathService::class);
$this->reportService = $reportSavePathService instanceof ReportService
? $reportSavePathService
: app(ReportService::class);
}
protected DateRangeService $dateRangeService;
protected ReportSavePathService $reportSavePathService;
protected ReportService $reportService;
/**
* Заполнить отчеты для пользователя за период
@@ -96,9 +96,8 @@ class AutoReportService
$this->deleteExistingReport($existingReport);
}
DB::transaction(function () use ($scopedUser, $department, $dateRange) {
$this->reportSavePathService->saveAutoFill($scopedUser, $department, $dateRange);
});
$payload = $this->reportService->buildAutoFillReportPayload($scopedUser, $department, $dateRange);
$this->reportService->storeReport($payload, $scopedUser, true);
return true;
}