|
@@ -67,7 +67,7 @@ class ExportFileService extends Service
|
|
|
|
|
|
//导出文件方法
|
|
|
protected static $fuc = [
|
|
|
- self::type_one => 'kqList',
|
|
|
+ self::type_one => 'kqCollect',
|
|
|
self::type_two => 'kqSummary',
|
|
|
self::type_three => '',
|
|
|
self::type_four => '',
|
|
@@ -75,11 +75,12 @@ class ExportFileService extends Service
|
|
|
];
|
|
|
|
|
|
protected static $special = [
|
|
|
+ self::type_one,
|
|
|
self::type_two,
|
|
|
];
|
|
|
|
|
|
protected static $fuc_name = [
|
|
|
- self::type_one => '考勤',
|
|
|
+ self::type_one => '考勤统计',
|
|
|
self::type_two => '每日考勤数据汇总',
|
|
|
self::type_three => '',
|
|
|
self::type_four => '',
|
|
@@ -93,43 +94,32 @@ class ExportFileService extends Service
|
|
|
self::$filename = self::$fuc_name[$data['type']] ?? "";
|
|
|
if(! in_array($data['type'], self::$special)) if(empty($data['id'])) return [false,'请选择导出数据'];
|
|
|
|
|
|
-
|
|
|
//不超时
|
|
|
ini_set('max_execution_time', 0);
|
|
|
//内存设置
|
|
|
ini_set('memory_limit', -1);
|
|
|
|
|
|
$function = self::$fuc[$data['type']];
|
|
|
- list($status, $return) = $this->$function($data);
|
|
|
+ list($status, $return) = $this->$function($data,$user);
|
|
|
if(! $status) return [false, $return];
|
|
|
|
|
|
return [true, $return];
|
|
|
}
|
|
|
|
|
|
- public function kqList($ergs){
|
|
|
- $id = $ergs['id'];
|
|
|
+ public function kqCollect($ergs, $user){
|
|
|
+ $service = new KqService();
|
|
|
+ list($status, $msg) = $service->kqCollect($ergs, $user);
|
|
|
+ if(! $status) return [false, $msg];
|
|
|
|
|
|
// 导出数据
|
|
|
- $return = [];
|
|
|
-
|
|
|
- DB::table('kq_list')
|
|
|
- ->whereIn('id', $id)
|
|
|
- ->select('id','order_number','model_type','sales_order_type','sign_time','plat_order','plat_type','product_total','other_fee','discount_fee','contract_fee','crt_time','crt_id','state','invoice_state','pay_way')
|
|
|
- ->orderBy('id','desc')
|
|
|
- ->chunk(500,function ($data) use(&$return){
|
|
|
- $data = Collect($data)->map(function ($object) {
|
|
|
- return (array)$object;
|
|
|
- })->toArray();
|
|
|
-
|
|
|
- $list['data'] = $data;
|
|
|
- });
|
|
|
+ $return = $msg;
|
|
|
|
|
|
- $header = ['合同单号'];
|
|
|
+ $header = ['工号','姓名','考勤天数','总工时','迟到次数','迟到总工时','早退次数','早退总工时','加班次数','加班总工时'];
|
|
|
|
|
|
return $this->saveExportData($return,$header);
|
|
|
}
|
|
|
|
|
|
- public function kqSummary($ergs){
|
|
|
+ public function kqSummary($ergs, $user){
|
|
|
// 导出数据
|
|
|
$return = [];
|
|
|
|