|
@@ -3,14 +3,7 @@
|
|
|
namespace App\Service;
|
|
|
|
|
|
use App\Exports\ExportOrder;
|
|
|
-use App\Model\Freight;
|
|
|
-use App\Model\FreightFee;
|
|
|
-use App\Model\GiveOut;
|
|
|
-use App\Model\Product;
|
|
|
use App\Model\RevenueCost;
|
|
|
-use App\Model\RevenueCostTotal;
|
|
|
-use App\Model\SalaryEmployee;
|
|
|
-use Illuminate\Support\Facades\DB;
|
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
|
|
|
|
class ExportFileService extends Service
|
|
@@ -33,21 +26,19 @@ class ExportFileService extends Service
|
|
|
if(! isset(self::$export_type[$export_type])) return [false,'导出文件方式错误或者不存在'];
|
|
|
if(empty($export_type)){
|
|
|
if(empty($data['id'])) return [false,'请选择导出数据'];
|
|
|
+ $search = $data;
|
|
|
}else{
|
|
|
- $search_func = $function . "Search";
|
|
|
- if (! method_exists(self::class, $search_func)) return [false, "导出方法(子方法)不存在,请联系开发"];
|
|
|
if(empty($data['order_search'])) return [false,'搜索条件不能为空'];
|
|
|
$search = $data['order_search'];
|
|
|
if(empty($search['page_index'])) return [false,'请选择导出数据的开始页码'];
|
|
|
if(empty($search['page_size'])) return [false,'请选择导出数据的条数'];
|
|
|
if($search['page_size'] > 5000) return [false,'请选择导出数据的条数每次最多5000条'];
|
|
|
$data['order_search']['menu_id'] = $data['menu_id'];
|
|
|
- list($status,$id) = $this->$search_func($data, $user);
|
|
|
- if(! $status) return [false, $id];
|
|
|
- $data['id'] = $id;
|
|
|
+ $search = $data['order_search'];
|
|
|
}
|
|
|
|
|
|
- $return = $this->$function($data,$user);
|
|
|
+ list($status, $return) = $this->$function($search,$user);
|
|
|
+ if(! $status) return [false, $return];
|
|
|
|
|
|
return [true, $return];
|
|
|
}
|
|
@@ -82,7 +73,8 @@ class ExportFileService extends Service
|
|
|
}
|
|
|
|
|
|
public function one($ergs, $user){
|
|
|
- $id = $ergs['id'];
|
|
|
+ $service = new ProductService();
|
|
|
+ $model = $service->productCommon($ergs, $user);
|
|
|
|
|
|
// 导出数据
|
|
|
$return = [];
|
|
@@ -90,453 +82,258 @@ class ExportFileService extends Service
|
|
|
$header_default = $user['e_header_default'];
|
|
|
$column = array_column($header_default,'key');
|
|
|
$header = array_column($header_default,'value');
|
|
|
- DB::table('product')
|
|
|
- ->where('del_time',0)
|
|
|
- ->whereIn('id', $id)
|
|
|
- ->select(Product::$field)
|
|
|
- ->orderBy('id','desc')
|
|
|
- ->chunk(500,function ($data) use(&$return,$column){
|
|
|
- $data = Collect($data)->map(function ($object) {
|
|
|
- return (array)$object;
|
|
|
- })->toArray();
|
|
|
-
|
|
|
- $this->fillData($data, $column, $return);
|
|
|
- });
|
|
|
-
|
|
|
- return $this->saveExportData($return,$header);
|
|
|
- }
|
|
|
+ $model->chunk(500,function ($data) use(&$return,$column){
|
|
|
+ $data = $data->toArray();
|
|
|
+ $this->fillData($data, $column, $return);
|
|
|
+ });
|
|
|
|
|
|
- public function oneSearch($ergs, $user){
|
|
|
- $data = $ergs['order_search'];
|
|
|
- $service = new ProductService();
|
|
|
- $model = $service->productCommon($data, $user, ['id']);
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
-
|
|
|
- return [true, $id];
|
|
|
+ return [true, $this->saveExportData($return,$header)];
|
|
|
}
|
|
|
|
|
|
public function two($ergs,$user){
|
|
|
- $id = $ergs['id'];
|
|
|
-
|
|
|
// 导出数据
|
|
|
$return = [];
|
|
|
|
|
|
$header_default = $user['e_header_default'];
|
|
|
$column = array_column($header_default,'key');
|
|
|
$header = array_column($header_default,'value');
|
|
|
- DB::table('freight')
|
|
|
- ->where('del_time',0)
|
|
|
- ->whereIn('id', $id)
|
|
|
- ->select(Freight::$field)
|
|
|
- ->orderBy('id','desc')
|
|
|
- ->chunk(500,function ($data) use(&$return,$column){
|
|
|
- $data = Collect($data)->map(function ($object) {
|
|
|
- return (array)$object;
|
|
|
- })->toArray();
|
|
|
-
|
|
|
- $this->fillData($data, $column, $return);
|
|
|
- });
|
|
|
-
|
|
|
- return $this->saveExportData($return,$header);
|
|
|
- }
|
|
|
|
|
|
- public function twoSearch($ergs, $user){
|
|
|
- $data = $ergs['order_search'];
|
|
|
$service = new FreightService();
|
|
|
- $model = $service->freightCommon($data, $user, ['id']);
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
+ $model = $service->freightCommon($ergs, $user);
|
|
|
+ $model->chunk(500,function ($data) use(&$return,$column){
|
|
|
+ $data = $data->toArray();
|
|
|
+ $this->fillData($data, $column, $return);
|
|
|
+ });
|
|
|
|
|
|
- return [true, $id];
|
|
|
+ return [true, $this->saveExportData($return,$header)];
|
|
|
}
|
|
|
|
|
|
public function three($ergs,$user){
|
|
|
- $id = $ergs['id'];
|
|
|
-
|
|
|
// 导出数据
|
|
|
$return = [];
|
|
|
- $service = new StatisticsService();
|
|
|
$header_default = $user['e_header_default'];
|
|
|
$column = array_column($header_default,'key');
|
|
|
$header = array_column($header_default,'value');
|
|
|
- DB::table('revenue_cost_total')
|
|
|
- ->where('del_time',0)
|
|
|
- ->whereIn('id', $id)
|
|
|
- ->select(RevenueCostTotal::$field)
|
|
|
- ->orderBy('id','desc')
|
|
|
- ->chunk(500,function ($data) use(&$return, $service, $column){
|
|
|
- $data = Collect($data)->map(function ($object) {
|
|
|
- return (array)$object;
|
|
|
- })->toArray();
|
|
|
- $list['data'] = $data;
|
|
|
-
|
|
|
- //订单数据
|
|
|
- $list = $service->statisticsRevenueCostFillData($list);
|
|
|
- //返回数据
|
|
|
- $this->fillData($list['data'], $column, $return);
|
|
|
- });
|
|
|
+
|
|
|
+ $service = new StatisticsService();
|
|
|
+ list($status, $model) = $service->statisticsRevenueCostCommon($ergs, $user);
|
|
|
+ if(! $status) return [false, $model];
|
|
|
+ $model->chunk(500,function ($data) use(&$return, $service, $column){
|
|
|
+ $data = $data->toArray();
|
|
|
+ $list['data'] = $data;
|
|
|
+
|
|
|
+ //订单数据
|
|
|
+ $list = $service->statisticsRevenueCostFillData($list);
|
|
|
+ //返回数据
|
|
|
+ $this->fillData($list['data'], $column, $return);
|
|
|
+ });
|
|
|
|
|
|
//合计
|
|
|
$total = $this->countTotal($return, $header_default);
|
|
|
//填充合计
|
|
|
$this->fillTotalData($total, $header_default, $return);
|
|
|
|
|
|
- return $this->saveExportData($return,$header);
|
|
|
- }
|
|
|
-
|
|
|
- public function threeSearch($ergs, $user){
|
|
|
- $data = $ergs['order_search'];
|
|
|
- $service = new StatisticsService();
|
|
|
- list($status, $model) = $service->statisticsRevenueCostCommon($data, $user, ['id']);
|
|
|
- if(! $status) return [false, $model];
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
-
|
|
|
- return [true, $id];
|
|
|
+ return [true, $this->saveExportData($return,$header)];
|
|
|
}
|
|
|
|
|
|
public function four($ergs,$user){
|
|
|
- $id = $ergs['id'];
|
|
|
-
|
|
|
// 导出数据
|
|
|
$return = [];
|
|
|
- $service = new StatisticsService();
|
|
|
$header_default = $user['e_header_default'];
|
|
|
$column = array_column($header_default,'key');
|
|
|
$header = array_column($header_default,'value');
|
|
|
- DB::table('revenue_cost')
|
|
|
- ->where('del_time',0)
|
|
|
- ->whereIn('id', $id)
|
|
|
- ->select(RevenueCost::$field_xhd)
|
|
|
- ->orderBy('id','desc')
|
|
|
- ->chunk(500,function ($data) use(&$return, $column, $service){
|
|
|
- $data = Collect($data)->map(function ($object) {
|
|
|
- return (array)$object;
|
|
|
- })->toArray();
|
|
|
- $list['data'] = $data;
|
|
|
-
|
|
|
- //订单数据
|
|
|
- $list = $service->statisticsRevenueCostOneAndTwoFillData($list);
|
|
|
-
|
|
|
- $this->fillData($list['data'], $column, $return);
|
|
|
- });
|
|
|
+
|
|
|
+ $ergs['order_type'] = RevenueCost::ORDER_ONE;
|
|
|
+ $service = new StatisticsService();
|
|
|
+ list($status, $model) = $service->statisticsRevenueCostOneAndTwoCommon($ergs, $user);
|
|
|
+ if(! $status) return [false, $model];
|
|
|
+
|
|
|
+ $model->chunk(500,function ($data) use(&$return, $column, $service){
|
|
|
+ $data = $data->toArray();
|
|
|
+ $list['data'] = $data;
|
|
|
+
|
|
|
+ //订单数据
|
|
|
+ $list = $service->statisticsRevenueCostOneAndTwoFillData($list);
|
|
|
+
|
|
|
+ $this->fillData($list['data'], $column, $return);
|
|
|
+ });
|
|
|
|
|
|
//合计
|
|
|
$total = $this->countTotal($return, $header_default);
|
|
|
//填充合计
|
|
|
$this->fillTotalData($total, $header_default, $return);
|
|
|
|
|
|
- return $this->saveExportData($return,$header);
|
|
|
- }
|
|
|
-
|
|
|
- public function fourSearch($ergs, $user){
|
|
|
- $data = $ergs['order_search'];
|
|
|
- $data['order_type'] = RevenueCost::ORDER_ONE;
|
|
|
- $service = new StatisticsService();
|
|
|
- list($status, $model) = $service->statisticsRevenueCostOneAndTwoCommon($data, $user, ['id']);
|
|
|
- if(! $status) return [false, $model];
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
-
|
|
|
- return [true, $id];
|
|
|
+ return [true, $this->saveExportData($return,$header)];
|
|
|
}
|
|
|
|
|
|
public function five($ergs,$user){
|
|
|
- $id = $ergs['id'];
|
|
|
-
|
|
|
// 导出数据
|
|
|
$return = [];
|
|
|
- $service = new StatisticsService();
|
|
|
$header_default = $user['e_header_default'];
|
|
|
$column = array_column($header_default,'key');
|
|
|
$header = array_column($header_default,'value');
|
|
|
- DB::table('revenue_cost')
|
|
|
- ->where('del_time',0)
|
|
|
- ->whereIn('id', $id)
|
|
|
- ->select(RevenueCost::$field_xsfp)
|
|
|
- ->orderBy('id','desc')
|
|
|
- ->chunk(500,function ($data) use(&$return, $column, $service){
|
|
|
- $data = Collect($data)->map(function ($object) {
|
|
|
- return (array)$object;
|
|
|
- })->toArray();
|
|
|
- $list['data'] = $data;
|
|
|
-
|
|
|
- //订单数据
|
|
|
- $list = $service->statisticsRevenueCostOneAndTwoFillData($list);
|
|
|
-
|
|
|
- $this->fillData($list['data'], $column, $return);
|
|
|
- });
|
|
|
+
|
|
|
+ $ergs['order_type'] = RevenueCost::ORDER_TWO;
|
|
|
+ $service = new StatisticsService();
|
|
|
+ list($status, $model) = $service->statisticsRevenueCostOneAndTwoCommon($ergs, $user);
|
|
|
+ if(! $status) return [false, $model];
|
|
|
+
|
|
|
+ $model->chunk(500,function ($data) use(&$return, $column, $service){
|
|
|
+ $data = $data->toArray();
|
|
|
+ $list['data'] = $data;
|
|
|
+
|
|
|
+ //订单数据
|
|
|
+ $list = $service->statisticsRevenueCostOneAndTwoFillData($list);
|
|
|
+
|
|
|
+ $this->fillData($list['data'], $column, $return);
|
|
|
+ });
|
|
|
|
|
|
//合计
|
|
|
$total = $this->countTotal($return, $header_default);
|
|
|
//填充合计
|
|
|
$this->fillTotalData($total, $header_default, $return);
|
|
|
|
|
|
- return $this->saveExportData($return,$header);
|
|
|
- }
|
|
|
-
|
|
|
- public function fiveSearch($ergs, $user){
|
|
|
- $data = $ergs['order_search'];
|
|
|
- $data['order_type'] = RevenueCost::ORDER_TWO;
|
|
|
- $service = new StatisticsService();
|
|
|
- list($status, $model) = $service->statisticsRevenueCostOneAndTwoCommon($data, $user, ['id']);
|
|
|
- if(! $status) return [false, $model];
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
-
|
|
|
- return [true, $id];
|
|
|
+ return [true, $this->saveExportData($return,$header)];
|
|
|
}
|
|
|
|
|
|
public function six($ergs,$user){
|
|
|
- $id = $ergs['id'];
|
|
|
-
|
|
|
- $field = RevenueCost::$field_hkd_main;
|
|
|
- $field[] = DB::raw('sum(payment_amount) as payment_amount');
|
|
|
- $field[] = DB::raw('sum(price_4_total) as price_4_total');
|
|
|
- $field[] = DB::raw('sum(profit) as profit');
|
|
|
-
|
|
|
// 导出数据
|
|
|
$return = [];
|
|
|
- $service = new StatisticsService();
|
|
|
$header_default = $user['e_header_default'];
|
|
|
$column = array_column($header_default,'key');
|
|
|
$header = array_column($header_default,'value');
|
|
|
- DB::table('revenue_cost')
|
|
|
- ->where('del_time',0)
|
|
|
- ->whereIn('order_id', $id)
|
|
|
- ->where('order_type',RevenueCost::ORDER_THREE)
|
|
|
- ->select($field)
|
|
|
- ->groupby('order_id')
|
|
|
- ->orderBy('id','desc')
|
|
|
- ->chunk(500,function ($data) use(&$return, $column, $service){
|
|
|
- $data = Collect($data)->map(function ($object) {
|
|
|
- return (array)$object;
|
|
|
- })->toArray();
|
|
|
- $list['data'] = $data;
|
|
|
-
|
|
|
- //订单数据
|
|
|
- $list = $service->statisticsRevenueCostThreeFillData($list);
|
|
|
-
|
|
|
- $this->fillData($list['data'], $column, $return);
|
|
|
- });
|
|
|
+
|
|
|
+ $service = new StatisticsService();
|
|
|
+ list($status, $model) = $service->statisticsRevenueCostThreeCommon($ergs, $user);
|
|
|
+ if(! $status) return [false, $model];
|
|
|
+
|
|
|
+ $model->chunk(500,function ($data) use(&$return, $column, $service){
|
|
|
+ $data = $data->toArray();
|
|
|
+ $list['data'] = $data;
|
|
|
+
|
|
|
+ //订单数据
|
|
|
+ $list = $service->statisticsRevenueCostThreeFillData($list);
|
|
|
+
|
|
|
+ $this->fillData($list['data'], $column, $return);
|
|
|
+ });
|
|
|
|
|
|
//合计
|
|
|
$total = $this->countTotal($return, $header_default);
|
|
|
//填充合计
|
|
|
$this->fillTotalData($total, $header_default, $return);
|
|
|
|
|
|
- return $this->saveExportData($return,$header);
|
|
|
- }
|
|
|
-
|
|
|
- public function sixSearch($ergs, $user){
|
|
|
- $data = $ergs['order_search'];
|
|
|
- $service = new StatisticsService();
|
|
|
- list($status, $model) = $service->statisticsRevenueCostThreeCommon($data, $user, ['order_id']);
|
|
|
- if(! $status) return [false, $model];
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'order_id');
|
|
|
-
|
|
|
- return [true, $id];
|
|
|
+ return [true , $this->saveExportData($return,$header)];
|
|
|
}
|
|
|
|
|
|
public function seven($ergs,$user){
|
|
|
- $id = $ergs['id'];
|
|
|
-
|
|
|
// 导出数据
|
|
|
$return = [];
|
|
|
$header_default = $user['e_header_default'];
|
|
|
$column = array_column($header_default,'key');
|
|
|
$header = array_column($header_default,'value');
|
|
|
$service = new GiveOutService();
|
|
|
- DB::table('give_out')
|
|
|
- ->where('del_time',0)
|
|
|
- ->whereIn('id', $id)
|
|
|
- ->select(GiveOut::$field)
|
|
|
- ->orderBy('id','desc')
|
|
|
- ->chunk(500,function ($data) use(&$return, $column, $service){
|
|
|
- $data = Collect($data)->map(function ($object) {
|
|
|
- return (array)$object;
|
|
|
- })->toArray();
|
|
|
- $list['data'] = $data;
|
|
|
-
|
|
|
- //订单数据
|
|
|
- $list = $service->fillData($list);
|
|
|
-
|
|
|
- $this->fillData($list['data'], $column, $return);
|
|
|
- });
|
|
|
+ $model = $service->giveOutCommon($ergs, $user);
|
|
|
+ $model->chunk(500,function ($data) use(&$return, $column, $service){
|
|
|
+ $data = $data->toArray();
|
|
|
+ $list['data'] = $data;
|
|
|
+
|
|
|
+ //订单数据
|
|
|
+ $list = $service->fillData($list);
|
|
|
+
|
|
|
+ $this->fillData($list['data'], $column, $return);
|
|
|
+ });
|
|
|
|
|
|
//合计
|
|
|
$total = $this->countTotal($return, $header_default);
|
|
|
//填充合计
|
|
|
$this->fillTotalData($total, $header_default, $return);
|
|
|
|
|
|
- return $this->saveExportData($return,$header);
|
|
|
- }
|
|
|
-
|
|
|
- public function sevenSearch($ergs, $user){
|
|
|
- $data = $ergs['order_search'];
|
|
|
- $service = new GiveOutService();
|
|
|
- $model = $service->giveOutCommon($data, $user, ['id']);
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
-
|
|
|
- return [true, $id];
|
|
|
+ return [true, $this->saveExportData($return,$header)];
|
|
|
}
|
|
|
|
|
|
public function eight($ergs,$user){
|
|
|
- $id = $ergs['id'];
|
|
|
-
|
|
|
- $field = RevenueCost::$field_hkd_profit_main;
|
|
|
- $field[] = DB::raw('COALESCE(SUM(rc.payment_amount), 0) AS payment_amount');
|
|
|
- $type = RevenueCost::ORDER_THREE;
|
|
|
-
|
|
|
+ //导出
|
|
|
$return = [];
|
|
|
$header_default = $user['e_header_default'];
|
|
|
$column = array_column($header_default, 'key');
|
|
|
$header = array_column($header_default, 'value');
|
|
|
+
|
|
|
$service = new StatisticsService();
|
|
|
- DB::table('employee_index')
|
|
|
- ->where('employee_index.del_time', 0)
|
|
|
- ->whereIn('employee_index.id', $id)
|
|
|
- ->leftJoin(DB::raw('revenue_cost as rc'), function ($join) use ($type) {
|
|
|
- $join->on('rc.employee_id_2', '=', 'employee_index.employee_id')
|
|
|
- ->where('rc.del_time', 0)
|
|
|
- ->where('rc.order_type', $type)
|
|
|
- ->whereNotNull('rc.employee_id_2')
|
|
|
- ->where('rc.employee_id_2', '<>', '')
|
|
|
- ->whereRaw('rc.order_time >= employee_index.start_time')
|
|
|
- ->whereRaw('rc.order_time <= employee_index.end_time');
|
|
|
- })
|
|
|
- ->select($field)
|
|
|
- ->groupBy('employee_index.employee_id', 'employee_index.start_time', 'employee_index.end_time')
|
|
|
- ->orderBy('employee_index.end_time','desc')
|
|
|
- ->chunk(500, function ($data) use (&$return, $column, $service) {
|
|
|
- $data = Collect($data)->map(function ($object) {
|
|
|
- return (array)$object;
|
|
|
- })->toArray();
|
|
|
- $list['data'] = $data;
|
|
|
-
|
|
|
- //订单数据
|
|
|
- $list = $service->statisticsProfitFillData($list);
|
|
|
-
|
|
|
- $this->fillData($list['data'], $column, $return);
|
|
|
- });
|
|
|
+ list($status,$model) = $service->statisticsProfitCommon($ergs, $user);
|
|
|
+ if(! $status) return [false, $model];
|
|
|
+
|
|
|
+ $model->chunk(500, function ($data) use (&$return, $column, $service) {
|
|
|
+ $data = $data->toArray();
|
|
|
+ $list['data'] = $data;
|
|
|
+
|
|
|
+ //订单数据
|
|
|
+ $list = $service->statisticsProfitFillData($list);
|
|
|
+
|
|
|
+ $this->fillData($list['data'], $column, $return);
|
|
|
+ });
|
|
|
|
|
|
//合计
|
|
|
$total = $this->countTotal($return, $header_default);
|
|
|
//填充合计
|
|
|
$this->fillTotalData($total, $header_default, $return);
|
|
|
|
|
|
- return $this->saveExportData($return,$header);
|
|
|
- }
|
|
|
-
|
|
|
- public function eightSearch($ergs, $user){
|
|
|
- $data = $ergs['order_search'];
|
|
|
- $service = new StatisticsService();
|
|
|
- list($status,$model) = $service->statisticsProfitCommon($data, $user, ['employee_index.id']);
|
|
|
- if(! $status) return [false, $model];
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
-
|
|
|
- return [true, $id];
|
|
|
+ return [true, $this->saveExportData($return,$header)];
|
|
|
}
|
|
|
|
|
|
public function nine($ergs,$user){
|
|
|
- $id = $ergs['id'];
|
|
|
-
|
|
|
- $field = SalaryEmployee::$field;
|
|
|
-
|
|
|
$return = [];
|
|
|
$header_default = $user['e_header_default'];
|
|
|
$column = array_column($header_default, 'key');
|
|
|
$header = array_column($header_default, 'value');
|
|
|
+
|
|
|
$service = new StatisticsService();
|
|
|
- DB::table('salary_employee')
|
|
|
- ->where('del_time', 0)
|
|
|
- ->whereIn('id', $id)
|
|
|
- ->select($field)
|
|
|
- ->orderBy('order_time','desc')
|
|
|
- ->chunk(500, function ($data) use (&$return, $column, $service) {
|
|
|
- $data = Collect($data)->map(function ($object) {
|
|
|
- return (array)$object;
|
|
|
- })->toArray();
|
|
|
- $list['data'] = $data;
|
|
|
-
|
|
|
- //订单数据
|
|
|
- $list = $service->statisticsEmployeeSalaryFillData($list);
|
|
|
-
|
|
|
- $this->fillData($list['data'], $column, $return);
|
|
|
- });
|
|
|
+ list($status,$model) = $service->statisticsEmployeeSalaryCommon($ergs, $user);
|
|
|
+ if(! $status) return [false, $model];
|
|
|
+
|
|
|
+ $model->chunk(500, function ($data) use (&$return, $column, $service) {
|
|
|
+ $data = $data->toArray();
|
|
|
+ $list['data'] = $data;
|
|
|
+
|
|
|
+ //订单数据
|
|
|
+ $list = $service->statisticsEmployeeSalaryFillData($list);
|
|
|
+
|
|
|
+ $this->fillData($list['data'], $column, $return);
|
|
|
+ });
|
|
|
|
|
|
//合计
|
|
|
$total = $this->countTotal($return, $header_default);
|
|
|
//填充合计
|
|
|
$this->fillTotalData($total, $header_default, $return);
|
|
|
|
|
|
- return $this->saveExportData($return,$header);
|
|
|
- }
|
|
|
-
|
|
|
- public function nineSearch($ergs, $user){
|
|
|
- $data = $ergs['order_search'];
|
|
|
- $service = new StatisticsService();
|
|
|
- list($status,$model) = $service->statisticsEmployeeSalaryCommon($data, $user, ['id']);
|
|
|
- if(! $status) return [false, $model];
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
-
|
|
|
- return [true, $id];
|
|
|
+ return [true, $this->saveExportData($return,$header)];
|
|
|
}
|
|
|
|
|
|
public function ten($ergs,$user){
|
|
|
- $id = $ergs['id'];
|
|
|
- if(! empty($ergs['order_search'])){
|
|
|
- $dataSearch = $ergs['order_search'];
|
|
|
- }else{
|
|
|
- $dataSearch = $ergs;
|
|
|
- }
|
|
|
-
|
|
|
- $field = FreightFee::$field;
|
|
|
-
|
|
|
$return = [];
|
|
|
$header_default = $user['e_header_default'];
|
|
|
$column = array_column($header_default, 'key');
|
|
|
$header = array_column($header_default, 'value');
|
|
|
+
|
|
|
$service = new StatisticsService();
|
|
|
- $model = FreightFee::Clear($user, $dataSearch);
|
|
|
+ list($status,$model) = $service->statisticsFreightFeeCommon($ergs, $user);
|
|
|
+ if(! $status) return [false, $model];
|
|
|
|
|
|
- $model->where('del_time', 0)
|
|
|
- ->whereIn('order_time', $id)
|
|
|
- ->select($field)
|
|
|
- ->groupby('order_time')
|
|
|
- ->orderby('order_time', 'desc')
|
|
|
- ->chunk(500, function ($data) use (&$return, $column, $service,$user, $dataSearch) {
|
|
|
- $data = $data->toArray();
|
|
|
- $list['data'] = $data;
|
|
|
+ $model->chunk(500, function ($data) use (&$return, $column, $service,$user, $ergs) {
|
|
|
+ $data = $data->toArray();
|
|
|
+ $list['data'] = $data;
|
|
|
|
|
|
- //订单数据
|
|
|
- $list = $service->statisticsFreightFeeFillData($list, $user,$dataSearch);
|
|
|
+ //订单数据
|
|
|
+ $list = $service->statisticsFreightFeeFillData($list, $user,$ergs);
|
|
|
|
|
|
- $this->fillData($list['data'], $column, $return);
|
|
|
- });
|
|
|
+ $this->fillData($list['data'], $column, $return);
|
|
|
+ });
|
|
|
|
|
|
//合计
|
|
|
$total = $this->countTotal($return, $header_default);
|
|
|
//填充合计
|
|
|
$this->fillTotalData($total, $header_default, $return);
|
|
|
|
|
|
- return $this->saveExportData($return,$header);
|
|
|
- }
|
|
|
-
|
|
|
- public function tenSearch($ergs, $user){
|
|
|
- $data = $ergs['order_search'];
|
|
|
- $service = new StatisticsService();
|
|
|
- list($status,$model) = $service->statisticsFreightFeeCommon($data, $user, ['order_time']);
|
|
|
- if(! $status) return [false, $model];
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'order_time');
|
|
|
-
|
|
|
- return [true, $id];
|
|
|
+ return [true, $this->saveExportData($return,$header)];
|
|
|
}
|
|
|
|
|
|
public function saveExportData($data, $headers, $type = 'default',$file_name = ''){
|