|
@@ -1931,7 +1931,11 @@ class RecruitController extends Controller
|
|
|
$type = $request->input('type','pen');
|
|
|
switch ($type){
|
|
|
case 'pen':
|
|
|
- $list = RecruitAppointInfo::where('recruit_appoint_info.recruit_id',$recruit_id)->where('recruit_appoint_info.audit',3)->where('recruit_appoint_info.pen_audit',-1)->join('recruit_ticket', 'recruit_appoint_info.id', '=', 'recruit_ticket.appoint_id')->select('recruit_appoint_info.*','recruit_ticket.ex_number')->orderBy('post_id','asc')->get();
|
|
|
+ $list = RecruitAppointInfo::where('recruit_appoint_info.recruit_id',$recruit_id)
|
|
|
+ ->where('recruit_appoint_info.audit',3)
|
|
|
+ ->where('recruit_appoint_info.pen_audit',-1)
|
|
|
+ ->join('recruit_ticket', 'recruit_appoint_info.id', '=', 'recruit_ticket.appoint_id')
|
|
|
+ ->select('recruit_appoint_info.*','recruit_ticket.ex_number')->orderBy('post_id','asc')->get();
|
|
|
$post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
|
|
|
$data = [];
|
|
|
foreach ($list as $k => $v){
|
|
@@ -1973,6 +1977,58 @@ class RecruitController extends Controller
|
|
|
$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
|
|
|
$writer->save('php://output');
|
|
|
|
|
|
+ break;
|
|
|
+ case 'face':
|
|
|
+ $list = RecruitAppointInfo::where('recruit_appoint_info.recruit_id',$recruit_id)
|
|
|
+ ->where('recruit_appoint_info.audit',3)
|
|
|
+ ->where('recruit_appoint_info.face_audit',-1)
|
|
|
+ ->where(function($query){
|
|
|
+ $query->where('recruit_appoint_info.pen_audit',1)
|
|
|
+ ->orWhere('recruit_appoint_info.pen_audit',3);
|
|
|
+ })
|
|
|
+ ->join('recruit_ticket', 'recruit_appoint_info.id', '=', 'recruit_ticket.appoint_id')->select('recruit_appoint_info.*','recruit_ticket.ex_number')->orderBy('post_id','asc')->get();
|
|
|
+
|
|
|
+ $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
|
|
|
+ $data = [];
|
|
|
+ foreach ($list as $k => $v){
|
|
|
+ $item = [
|
|
|
+ $v->id,
|
|
|
+ $v->realname,
|
|
|
+ $v->card,
|
|
|
+ $post_data[$v->post_id],
|
|
|
+ $v->ex_number
|
|
|
+ ];
|
|
|
+ array_push($data,$item);
|
|
|
+ }
|
|
|
+
|
|
|
+ $spreadsheet = IOFactory::load(base_path() . '/storage/app/public/recruit/ticket/template/record_data_template.xlsx');
|
|
|
+ $sheet = $spreadsheet->getActiveSheet();
|
|
|
+
|
|
|
+ $row = 2;
|
|
|
+ foreach($data as $k => $v){
|
|
|
+ for ($i = 0;$i<count($v);$i++){
|
|
|
+ if($i == 2 || $i == 4){
|
|
|
+ $sheet->setCellValueExplicitByColumnAndRow($i+1, $row, $v[$i], DataType::TYPE_STRING);
|
|
|
+ }else{
|
|
|
+ $sheet->setCellValueByColumnAndRow($i+1, $row, $v[$i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $row++;
|
|
|
+ }
|
|
|
+
|
|
|
+ $file_name = $recruit->company . "_成绩表模板";
|
|
|
+ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
|
+ header('Content-Disposition: attachment;filename="'.$file_name.'.xlsx"');
|
|
|
+ header('Cache-Control: max-age=0');
|
|
|
+ // If you're serving to IE 9, then the following may be needed
|
|
|
+ header('Cache-Control: max-age=1');
|
|
|
+ // If you're serving to IE over SSL, then the following may be needed
|
|
|
+ header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
|
|
|
+ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
|
|
|
+ header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
|
|
+ header('Pragma: public'); // HTTP/1.0
|
|
|
+ $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
|
|
|
+ $writer->save('php://output');
|
|
|
break;
|
|
|
}
|
|
|
}
|