Изменения в основном report
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user