|
|
@@ -29,26 +29,24 @@ class ExcelExportService
|
|
|
{
|
|
|
|
|
|
private $sheet;
|
|
|
-
|
|
|
+ public $download_type = [
|
|
|
+ '1' => 'EngineerBillDownload',
|
|
|
+ '2' => 'MasterWorkerServiceOrderDownload',
|
|
|
+ ];
|
|
|
public function __construct()
|
|
|
{
|
|
|
$this->sheet = new ExcelWriter();
|
|
|
}
|
|
|
-
|
|
|
public function download($id)
|
|
|
{
|
|
|
try{
|
|
|
- Log::info("download-export:{$id}");
|
|
|
$infoExport = Export::findOrEmpty($id);
|
|
|
if(!$infoExport->isEmpty()){
|
|
|
$download_fun = $infoExport['download_fun'];
|
|
|
- $filename = $infoExport['name'];
|
|
|
- $params = $infoExport['params']?:[];
|
|
|
- // 是否存在该函数
|
|
|
if(!method_exists($this,$download_fun)){
|
|
|
- throw new Exception('下载函数不存在');
|
|
|
+ throw new Exception('下载不存在-1001');
|
|
|
}
|
|
|
- $this->$download_fun($infoExport,$filename,$params);
|
|
|
+ $this->$download_fun($infoExport);
|
|
|
}
|
|
|
}catch (\Exception $e){
|
|
|
Log::info("download-error:{$id}:".$e->getMessage());
|
|
|
@@ -56,13 +54,14 @@ class ExcelExportService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* @notes 工程师 -上月最后结算余额 导出
|
|
|
*/
|
|
|
- public function EngineerBillDownload($infoExport,$filename,$params)
|
|
|
+ public function EngineerBillDownload($infoExport)
|
|
|
{
|
|
|
try{
|
|
|
+ $filename = $infoExport['name'];
|
|
|
+ $params = $infoExport['params']?:[];
|
|
|
if($params){ }
|
|
|
$firstDay = date('Y-m-01 00:00:00', strtotime('first day of last month'));
|
|
|
$lastDay = date('Y-m-t 23:59:59', strtotime('last day of last month'));
|
|
|
@@ -95,9 +94,11 @@ class ExcelExportService
|
|
|
/**
|
|
|
* @notes 工程师 -工单统计 导出
|
|
|
*/
|
|
|
- public function MasterWorkerServiceOrderDownload($infoExport,$filename,$params)
|
|
|
+ public function MasterWorkerServiceOrderDownload($infoExport)
|
|
|
{
|
|
|
try{
|
|
|
+ $filename = $infoExport['name'];
|
|
|
+ $params = $infoExport['params']?:[];
|
|
|
$where = [];
|
|
|
$sqlJoin = '';
|
|
|
if($params){
|