request = $request; $this->companyReportService = $companyReportService; } /** * 列表. * * @return \Illuminate\Http\Response */ public function index() { $conditions = $this->request->all(); $conditions['type'] = $this->request->ids('type'); $res = $this->companyReportService->index($conditions); return res($res, '企业月报表', 201); } /** * 导出. * * @return \Illuminate\Http\Response */ public function export() { $conditions = $this->request->except(['page', 'limit']); $conditions['limit'] = 0; try { $export = new CompanyReportExport($conditions); $url = ExportService::store($export, $this->disk); } catch (\Exception $e) { throw $e; } return res($url, '导出成功', 201); } /** * 统计明细. * * @return \Illuminate\Http\Response */ public function detail() { $conditions = $this->request->all(); $res = $this->companyReportService->detail($conditions); return res($res, '统计明细', 201); } /** * 统计明细导出. * * @return \Illuminate\Http\Response */ public function detailExport(OrderCardPartitionRepository $repository) { $conditions = $this->request->except(['page', 'limit']); $total = $repository->withConditions($conditions)->applyConditions()->count(); try { $export = new CompanyReportDetailExport($conditions); $queue = $total > CompanyReportDetailExport::$chunkSize * 50; $url = ExportService::store($export, $this->disk, $queue); } catch (\Exception $e) { throw $e; } return res($url, '导出成功', 201); } }