SpecialController.php 83 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741
  1. <?php
  2. namespace App\Admin\Controllers\Recruit;
  3. use App\Admin\Extensions\Form\ValidateForm;
  4. use App\Http\Controllers\Controller;
  5. use App\Models\Admin\AdminUser;
  6. use App\Models\Member;
  7. use App\Models\Pms;
  8. use App\Models\Recruit;
  9. use App\Models\RecruitAppointInfo;
  10. use App\Models\RecruitAppointLog;
  11. use App\Models\RecruitPost;
  12. use App\Models\RecruitSubjoin;
  13. use App\Models\RecruitTicket;
  14. use App\Models\RecruitTicketField;
  15. use App\Services\Common\SmsService;
  16. use Encore\Admin\Auth\Permission;
  17. use Encore\Admin\Facades\Admin;
  18. use Encore\Admin\Form;
  19. use Encore\Admin\Grid;
  20. use Encore\Admin\Layout\Content;
  21. use Illuminate\Http\Request;
  22. use Illuminate\Support\Facades\DB;
  23. use Illuminate\Support\Facades\Storage;
  24. use PhpOffice\PhpSpreadsheet\Cell\DataType;
  25. use PhpOffice\PhpSpreadsheet\IOFactory;
  26. use PhpOffice\PhpSpreadsheet\Spreadsheet;
  27. class SpecialController extends Controller
  28. {
  29. private $smsService;
  30. public function __construct(SmsService $smsService)
  31. {
  32. $this->smsService = $smsService;
  33. }
  34. /**
  35. * Show interface.
  36. *
  37. * @param mixed $id
  38. * @param Content $content
  39. * @return Content
  40. */
  41. public function show($id, Content $content)
  42. {
  43. return redirect('/ST3IXxKlOa4eGEv0eTw0CfORI9444Mgj/special/index');
  44. }
  45. /**
  46. * 招考报名首页
  47. * @param Content $content
  48. * @return Content
  49. */
  50. public function index(Content $content)
  51. {
  52. return $content
  53. ->header('专场招考报名管理')
  54. ->description('')
  55. ->body($this->grid());
  56. }
  57. /**
  58. * Make a grid builder.
  59. *
  60. * @return Grid
  61. */
  62. protected function grid()
  63. {
  64. $grid = new Grid(new Recruit);
  65. $grid->model()->where('special',1);
  66. $grid->model()->orderBy('created_at', 'DESC');
  67. $grid->model()->paginate(20);
  68. if (Admin::user()->can('special_recruit_manager_create')) {
  69. $grid->disableCreateButton(false);
  70. }
  71. $grid->perPages([10, 20, 30, 40, 50, 100]);
  72. $grid->id('ID');
  73. $grid->name('招考场次名称');
  74. $grid->column('current','当前阶段')->display(function ($current) {
  75. switch ($current){
  76. case '1':
  77. return '报名';
  78. break;
  79. case '2':
  80. return '审核';
  81. break;
  82. case '3':
  83. return '笔试';
  84. break;
  85. case '4':
  86. return '上机测试';
  87. break;
  88. case '5':
  89. return '面试';
  90. break;
  91. case '6':
  92. return '复试';
  93. break;
  94. case '7':
  95. return '体检';
  96. break;
  97. case '8':
  98. return '政审';
  99. break;
  100. case '9':
  101. return '公示';
  102. break;
  103. case '0':
  104. return '已结束';
  105. break;
  106. }
  107. });
  108. $grid->column('status','状态')->display(function ($status) {
  109. return $status ? '显示' : '隐藏';
  110. });
  111. $grid->filter(function ($filter) {
  112. $filter->disableIdFilter();
  113. $filter->where(function ($query) {
  114. $query->where('simple', '=', "{$this->input}");
  115. }, '类型', 'simple')->radio([0 => '招考',1 => '招聘']);
  116. });
  117. $grid->created_at('创建时间');
  118. $grid->actions(function ($actions) {
  119. $actions->append('<a href="/ST3IXxKlOa4eGEv0eTw0CfORI9444Mgj/special/appoint_list?id=' . $actions->row['id'] . '" class="btn btn-primary btn-xs" >报名管理</a>');
  120. $actions->disableEdit(false);
  121. $actions->disableDelete(false);
  122. $actions->disableView();
  123. });
  124. return $grid;
  125. }
  126. /**
  127. * 新增招考报名表单页.
  128. *
  129. * @param Content $content
  130. * @return Content
  131. */
  132. public function create(Content $content)
  133. {
  134. Permission::check('special_recruit_manager_create');
  135. return $content
  136. ->header('新增专场招聘场次')
  137. ->description('新增')
  138. ->body(view('admin.special.index')->with(['grid' => $this->form()->render(), 'id' => '0']));
  139. }
  140. /**
  141. * 更新报名场次信息
  142. * @param $id
  143. * @param Request $request
  144. */
  145. public function update($id, Request $request)
  146. {
  147. $verify = $this->Form()->getValidateInput();//这个方法会调用Form自带的验证和表单处理(文件上传等)验证错误会直接返回错误.不需要判断;
  148. $postCode = $request->input('postcode', []);
  149. $postName = $request->input('postname', []);
  150. if (count($postCode) == 0 or (count($postCode) >= 1 and $postCode[0] == null)) {
  151. return admin_toastr('请填写招考岗位', 'error');
  152. }
  153. if (count($postName) == 0 or (count($postName) >= 1 and $postName[0] == null)) {
  154. return admin_toastr('请填写招考岗位名称', 'error');
  155. }
  156. $recruit_id = $id;
  157. $recruit = Recruit::find($id);
  158. if(!$recruit->special){
  159. $this->show();
  160. }
  161. $data = [];
  162. $data['name'] = $verify['name'];
  163. $data['company'] = $verify['company'];
  164. $data['name_en'] = (array_key_exists('name_en',$verify) && !empty($verify['name_en'])) ? $verify['name_en'] : uniqid();
  165. if(array_key_exists('small_img',$verify)){
  166. $data['small_img'] = $verify['small_img'];
  167. }else{
  168. $data['small_img'] = theme_asset('app/images/index/recruit_index.jpg');
  169. }
  170. $data['status'] = $verify['status'];
  171. $data['show_report'] = $verify['show_report'];
  172. $data['current'] = $verify['current'];
  173. $data['step'] = implode(',',array_filter($verify['step']));
  174. $data['apply_start'] = $verify['apply_start'] ? $verify['apply_start'] : null;//报名时间
  175. $data['apply_end'] = $verify['apply_end'] ? $verify['apply_end'] : null;
  176. $data['audit_start'] = $verify['audit_start'] ? $verify['audit_start'] : null;//审核时间
  177. $data['audit_end'] = $verify['audit_end'] ? $verify['audit_end'] : null;
  178. $data['preliminary_start'] = $verify['preliminary_start'] ? $verify['preliminary_start'] : null;//笔试时间
  179. $data['preliminary_end'] = $verify['preliminary_end'] ? $verify['preliminary_end'] : null;
  180. $data['computer_start'] = $verify['computer_start'] ? $verify['computer_start'] : null;//上机时间
  181. $data['computer_end'] = $verify['computer_end'] ? $verify['computer_end'] : null;
  182. $data['interview_start'] = $verify['interview_start'] ? $verify['interview_start'] : null;//面试时间
  183. $data['interview_end'] = $verify['interview_end'] ? $verify['interview_end'] : null;
  184. $data['reexamine_start'] = $verify['reexamine_start'] ? $verify['reexamine_start'] : null;//复试时间
  185. $data['reexamine_end'] = $verify['reexamine_end'] ? $verify['reexamine_end'] : null;
  186. $data['health_start'] = $verify['health_start'] ? $verify['health_start'] : null;//体检时间
  187. $data['health_end'] = $verify['health_end'] ? $verify['health_end'] : null;
  188. $data['political_start'] = $verify['political_start'] ? $verify['political_start'] : null;//政审时间
  189. $data['political_end'] = $verify['political_end'] ? $verify['political_end'] : null;
  190. $data['publicity_start'] = $verify['publicity_start'] ? $verify['publicity_start'] : null;//公示时间
  191. $data['publicity_end'] = $verify['publicity_end'] ? $verify['publicity_end'] : null;
  192. $data['supplement_start'] = $verify['supplement_start'] ? $verify['supplement_start'] : null;
  193. $data['supplement_end'] = $verify['supplement_end'] ? $verify['supplement_end'] : null;
  194. $data['introduction'] = $verify['introduction'];
  195. $data['host_address'] = $verify['host_address'];
  196. $data['contact'] = $verify['contact'];
  197. $data['phone'] = $verify['phone'];
  198. $data['ordid'] = $verify['ordid'];
  199. $data['limit_times'] = $verify['limit_times'];
  200. $data['post_times'] = $verify['post_times'];
  201. $data['pay_switch'] = $verify['pay_switch'];
  202. $data['forms'] = implode(',',array_filter($verify['forms']));
  203. $data['pen_ticket_type'] = $verify['pen_ticket_type'];
  204. $data['pen_ticket_content'] = $verify['pen_ticket_content'];
  205. $data['pen_ticket_status'] = 0;
  206. $data['pen_ticket_field'] = implode(',',$verify['pen_ticket_field']);
  207. $data['pen_comfirm'] = $verify['pen_comfirm'];
  208. $data['pen_comfirm_start'] = $verify['pen_comfirm_start'] ? $verify['pen_comfirm_start'] : null;
  209. $data['pen_comfirm_end'] = $verify['pen_comfirm_end'] ? $verify['pen_comfirm_end'] : null;
  210. $data['pen_epidemic'] = $verify['pen_epidemic'];
  211. $data['pen_health'] = $verify['pen_health'];
  212. $data['pen_health_start'] = $verify['pen_health_start'] ? $verify['pen_health_start'] : null;
  213. $data['pen_health_end'] = $verify['pen_health_end'] ? $verify['pen_health_end'] : null;
  214. $data['computer_ticket_type'] = $verify['computer_ticket_type'];
  215. $data['computer_ticket_content'] = $verify['computer_ticket_content'];
  216. $data['computer_ticket_status'] = 0;
  217. $data['computer_ticket_field'] = implode(',',$verify['computer_ticket_field']);
  218. $data['face_ticket_type'] = $verify['face_ticket_type'];
  219. $data['face_ticket_content'] = $verify['face_ticket_content'];
  220. $data['face_ticket_status'] = 0;
  221. $data['face_ticket_field'] = implode(',',$verify['face_ticket_field']);
  222. $data['face_epidemic'] = $verify['face_epidemic'];
  223. $data['face_health'] = $verify['face_health'];
  224. $data['face_health_start'] = $verify['face_health_start'] ? $verify['face_health_start'] : null;
  225. $data['face_health_end'] = $verify['face_health_end'] ? $verify['face_health_end'] : null;
  226. $data['reexamine_ticket_type'] = $verify['reexamine_ticket_type'];
  227. $data['reexamine_ticket_content'] = $verify['reexamine_ticket_content'];
  228. $data['reexamine_ticket_status'] = 0;
  229. $data['reexamine_field'] = implode(',',$verify['reexamine_field']);
  230. $ids = RecruitPost::where('recruit_id', $recruit_id)->pluck('id');
  231. $fileCharater = $request->input('addFile');
  232. $data['special'] = 1;
  233. DB::beginTransaction();//检查数据库事务
  234. try {
  235. $res = Recruit::where('id', $recruit_id)->update($data);
  236. $postcode_array = $request->postcode;
  237. $postname_array = $request->postname;
  238. $postnumber_array = $request->postnumber;
  239. $limit_array = $request->postlimit;
  240. $postid_arr = $request->postid_arr;
  241. $countnum = count($postcode_array);
  242. if ($countnum > 0) {
  243. $ids = RecruitPost::where('recruit_id', $recruit_id)->pluck('id');
  244. if (count($postid_arr) == 0) {//没有提交岗位代表删除岗位
  245. RecruitPost::where('recruit_id', $recruit_id)->delete();
  246. } else {
  247. foreach ($ids as $key => $value) {
  248. if (!in_array($value, $postid_arr)) {
  249. $post_is_create = RecruitAppointInfo::where('post_id', $value)->first();
  250. if (empty($post_is_create)) {
  251. //有报名信息的岗位不能删除
  252. RecruitPost::destroy($value);
  253. }
  254. }
  255. }
  256. }
  257. for ($i = 0; $i < $countnum; $i++) {
  258. $data = array();
  259. if ($postcode_array[$i] !== '' and $postname_array[$i] !== '') {
  260. if (isset($postid_arr[$i])) {
  261. $post_id = $postid_arr[$i];
  262. $data['code'] = $postcode_array[$i];
  263. $data['name'] = $postname_array[$i];
  264. $data['number'] = $postnumber_array[$i];
  265. $data['limit'] = $limit_array[$i];
  266. $data['recruit_id'] = $recruit_id;
  267. RecruitPost::where('id', $post_id)->update($data);
  268. } else {
  269. $data['code'] = $postcode_array[$i];
  270. $data['name'] = $postname_array[$i];
  271. $data['number'] = $postnumber_array[$i];
  272. $data['limit'] = $limit_array[$i];
  273. $data['recruit_id'] = $recruit_id;
  274. RecruitPost::create($data);
  275. }
  276. }
  277. }
  278. } else {
  279. RecruitPost::where('recruit_id', $recruit_id)->delete();
  280. }
  281. $fileCharater = $request->file('addFile');
  282. if (!empty($fileCharater)) {
  283. RecruitSubjoin::where('recruit_id', $recruit_id)->delete();
  284. foreach ($fileCharater as $f => $fv) {
  285. $picpath = 'zhaokaopic/' . date('Ymd', time()) . '/';
  286. //获取文件的扩展名
  287. $ext = $fv->getClientOriginalExtension();
  288. //获取文件的绝对路径
  289. $path = $fv->getRealPath();
  290. //定义文件名
  291. $filename = time() . rand(100, 999) . '.' . $ext;
  292. //存储文件。disk里面的public。总的来说,就是调用disk模块里的public配置
  293. Storage::disk('public')->put($picpath . $filename, file_get_contents($path));
  294. $data = $picpath . $filename;
  295. $create_arr = [
  296. 'recruit_id' => $recruit_id,
  297. 'subjoin_name' => $fv->getClientOriginalName(),
  298. 'subjoin_path' => $data,
  299. 'subjoin_addtime' => time()
  300. ];
  301. RecruitSubjoin::create($create_arr);
  302. }
  303. }
  304. DB::commit();
  305. return admin_toastr('操作成功!', 'success');
  306. } catch (\Exception $e) {
  307. DB::rollback();
  308. return admin_toastr($e->getMessage(), 'error');
  309. }
  310. }
  311. /**
  312. * 新增/修改招考场次的表单
  313. *
  314. * @return Form
  315. */
  316. protected function form()
  317. {
  318. $form = new ValidateForm(new Recruit);
  319. $form->tab('基础信息', function ($form) {
  320. $form->text('name', '招考场次名称')->rules('required|between:4,61', [
  321. 'required' => '请填写招考场次名称',
  322. 'between' => '招考场次名称长度为2~30个字符'
  323. ])->setWidth(5)->setMustMark();
  324. $form->text('company', '招聘主体')->rules('required|between:4,61', [
  325. 'required' => '请填写招聘主体',
  326. 'between' => '招聘主体长度为2~30个字符'
  327. ])->setWidth(5)->setMustMark();
  328. $form->text('name_en', '英文标识')->setWidth(5)->help('同一个招聘单位,发布的招聘场次若不在同一天,允许一样,若为空则自动生成');
  329. $form->image('small_img', '缩略图')->uniqueName()->setWidth(3);
  330. $form->radio('simple', '类型')->options([0 => '招聘', 1 => '招考'])->default(0)->setMustMark();
  331. $form->switch('status', '状态')->default(1)->setMustMark();
  332. $form->switch('show_report', '显示报名人数')->default(0)->setMustMark();
  333. $form->radio('current', '当前进展')->options([1 => '报名', 2 => '审核', 3 => '笔试', 4 => '上机测试', 5 => '面试', 6 => '复试', 7 => '体检', 8 => '政审', 9 => '公示',0 => '已结束'])->default(1)->setMustMark();
  334. $form->checkbox('step', '招考流程')->options([1 => '报名', 2 => '审核', 3 => '笔试', 4 => '上机测试', 5 => '面试', 6 => '复试', 7 => '体检', 8 => '政审', 9 => '公示'])->default([1, 2])->setMustMark();
  335. $form->datetimeRange('apply_start', 'apply_end', '报名日期')->rules('required', array('required' => '报名日期必须设置'))->setMustMark();
  336. $form->datetimeRange('audit_start', 'audit_end', '审核日期');
  337. $form->datetimeRange('preliminary_start', 'preliminary_end', '笔试时间');
  338. $form->datetimeRange('computer_start', 'computer_end', '上机时间');
  339. $form->datetimeRange('interview_start', 'interview_end', '面试时间');
  340. $form->datetimeRange('reexamine_start', 'reexamine_end', '复试时间');
  341. $form->datetimeRange('health_start', 'health_end', '体检时间');
  342. $form->datetimeRange('political_start', 'political_end', '政审时间');
  343. $form->datetimeRange('publicity_start', 'publicity_end', '公示时间');
  344. $form->editor('introduction', '招考正文')->rules('required', array('required' => '招考正文不能为空。'))->setMustMark();
  345. $form->text('contact', '联系人');
  346. $form->text('phone', '联系电话');
  347. $form->text('host_address', '联系地址');
  348. //$form->switch('predetermined_status', '是否允许报名')->states($display_option)->default(1)->setMustMark();
  349. $form->number('ordid', '排序')->default(0);
  350. $form->multipleFile('addFile', '附件')->move('storage/app/public/recruit/' . time());
  351. })->tab('报名表单与条件', function ($form) {
  352. $form->checkbox('forms', '报名表单模块')->options(['basic' => '基础信息模块','expand_special' => '扩展模块-加分','detail' => '详情介绍模块','identification' => '身份证明上传模块','education_certification' => '学历证明上传模块','other_certification' => '其他证明上传模块', 'remark' => '备注模块','chengnuoshu'=>'诚信承诺书','shixin'=>'失信被执行人查询信息页扫描件','internship' => '实习专场'])->default(['basic'])->setMustMark();
  353. $str = "let num = $(\"#forms\").find(\".checked\").length;
  354. if(num == 0){
  355. alert(\"未选中报名表单模块\");
  356. return false;
  357. }
  358. let modules = new Array();
  359. $.each($(\"#forms\").find(\".checked\"),function(index,item){
  360. modules.push($(item).children(\"input\").val())
  361. });
  362. window.open(\"https://www.jucai.gov.cn/recruit/preview?modules=\"+modules.join(','));
  363. return false;";
  364. $form->button('test','勾选对应模块后点击我')->on('click',$str);
  365. $form->text('limit_times', '报名次数限制')->rules('required|regex:/^\d+$/', [
  366. 'required' => '报名限制次数必须填写',
  367. 'regex' => '次数必须为数字'
  368. ])->default(1)->help('同一个场次允许同时报名几个岗位,直接输入数字即可');
  369. $form->text('post_times', '审核次数限制')->rules('required|regex:/^\d+$/', [
  370. 'required' => '审核限制次数必须填写',
  371. 'regex' => '次数必须为数字'
  372. ])->default(1)->help('允许提交审核的次数,直接输入数字即可');
  373. $form->datetimeRange('supplement_start', 'supplement_end', '材料补登时间');
  374. $form->radio('pay_switch', '缴费报名')->options([0 => '否', 1 => '是'])->default(0);
  375. $form->radio('special_condition_type', '加分条件样式')->options([0 => '手输', 1 => '下拉选择'])->default(0);
  376. $form->text('special_condition_value', '加分条件值')->default("")->help('下拉选择项请用英文,隔开');
  377. })->tab('笔试', function ($form) {
  378. $form->switch('pen_comfirm', '笔试确认')->help("打开后将会在设置时间段内开启笔试确认功能,有且仅当确认了才能打印准考证参加笔试")->default(0)->setMustMark();
  379. $form->datetimeRange('pen_comfirm_start', 'pen_comfirm_end', '确认笔试时间')->help("设置该时间后,仅在该时间段内才可以确认参加笔试");
  380. $form->radio('pen_ticket_type', '准考证类型')->options([-1 => '不需要',1 => '纸质', 2 => '短信', 3 => '模板'])->default(-1);
  381. $form->text('pen_ticket_content', '准考证内容')->help('当类型为纸质时,此处填入准考证模板的路径,当类型为短信时,此处填入短信标识,当类型为模板时,输入模板ID');
  382. $form->listbox('pen_ticket_field', '模板字段')->options(RecruitTicketField::ticketFieldData('pen'))->attribute('hight', '200px')->help('仅纸质准考证需要,非ex开头的字段将自动渲染');
  383. $form->switch('pen_epidemic', '两码上传')->help("下列依赖两码设置,须此项打开才可生效")->default(0)->setMustMark();
  384. $form->switch('pen_health', '健康状态')->help('当两码上传打开且该选项打开时,打印准考证必须通过两码审核')->default(0)->setMustMark();
  385. $form->datetimeRange('pen_health_start', 'pen_health_end', '两码时间')->help("设置该时间后,仅在该时间段内上传该时段内的两码截图才可以");
  386. })->tab('上机', function ($form) {
  387. $form->radio('computer_ticket_type', '准考证类型')->options([-1 => '不需要',1 => '纸质', 2 => '短信', 3 => '模板'])->default(-1);
  388. $form->text('computer_ticket_content', '准考证内容')->help('当类型为纸质时,此处填入准考证模板的路径,当类型为短信时,此处填入短信标识,当类型为模板时,输入模板ID');
  389. $form->listbox('computer_ticket_field', '模板字段')->options(RecruitTicketField::ticketFieldData('computer'))->attribute('hight', '200px')->help('仅纸质准考证需要,非ex开头的字段将自动渲染');
  390. $form->switch('computer_epidemic', '两码上传')->help("下列依赖两码设置,须此项打开才可生效")->default(0)->setMustMark();
  391. $form->switch('computer_health', '健康状态')->help('当两码上传打开且该选项打开时,打印准考证必须通过两码审核')->default(0)->setMustMark();
  392. $form->datetimeRange('computer_health_start', 'computer_health_end', '两码时间')->help("设置该时间后,仅在该时间段内上传该时段内的两码截图才可以");
  393. })->tab('面试', function ($form) {
  394. $form->radio('face_ticket_type', '准考证类型')->options([-1 => '不需要',1 => '纸质', 2 => '短信', 3 => '模板'])->default(-1);
  395. $form->text('face_ticket_content', '准考证内容')->help('当类型为纸质时,此处填入准考证模板的路径,当类型为短信时,此处填入短信标识,当类型为模板时,输入模板ID');
  396. $form->listbox('face_ticket_field', '模板字段')->options(RecruitTicketField::ticketFieldData('face'))->attribute('hight', '200px')->help('仅纸质准考证需要,非ex开头的字段将自动渲染');
  397. $form->switch('face_epidemic', '两码上传')->help("下列依赖两码设置,须此项打开才可生效")->default(0)->setMustMark();
  398. $form->switch('face_health', '健康状态')->help('当两码上传打开且该选项打开时,打印准考证必须通过两码审核')->default(0)->setMustMark();
  399. $form->datetimeRange('face_health_start', 'face_health_end', '两码时间')->help("设置该时间后,仅在该时间段内上传该时段内的两码截图才可以");
  400. })->tab('复试', function ($form) {
  401. $form->radio('reexamine_ticket_type', '准考证类型')->options([-1 => '不需要',1 => '纸质', 2 => '短信', 3 => '模板'])->default(-1);
  402. $form->text('reexamine_ticket_content', '准考证内容')->help('当类型为纸质时,此处填入准考证模板的路径,当类型为短信时,此处填入短信标识,当类型为模板时,输入模板ID');
  403. $form->listbox('reexamine_field', '模板字段')->options(RecruitTicketField::ticketFieldData('reexamine'))->attribute('hight', '200px')->help('仅纸质准考证需要,非ex开头的字段将自动渲染');
  404. });
  405. return $form;
  406. }
  407. /**
  408. * Make a form builder.
  409. *
  410. * @return Form
  411. */
  412. public function store(Request $request)
  413. {
  414. $verify = $this->form()->getValidateInput();//这个方法会调用Form自带的验证和表单处理(文件上传等)验证错误会直接返回错误.不需要判断;
  415. $postCode = $request->input('postcode', []);
  416. $postName = $request->input('postname', []);
  417. if (count($postCode) == 0 or (count($postCode) >= 1 and $postCode[0] == null)) {
  418. return admin_toastr('请填写招考岗位', 'error');
  419. }
  420. if (count($postName) == 0 or (count($postName) >= 1 and $postName[0] == null)) {
  421. return admin_toastr('请填写招考岗位名称', 'error');
  422. }
  423. $data = [];
  424. $data['name'] = $verify['name'];
  425. $data['company'] = $verify['company'];
  426. $data['name_en'] = (array_key_exists('name_en',$verify) && !empty($verify['name_en'])) ? $verify['name_en'] : uniqid();
  427. if(array_key_exists('small_img',$verify)){
  428. $data['small_img'] = $verify['small_img'];
  429. }else{
  430. $data['small_img'] = theme_asset('app/images/index/recruit_index.jpg');
  431. }
  432. $data['status'] = $verify['status'];
  433. $data['show_report'] = $verify['show_report'];
  434. $data['current'] = $verify['current'];
  435. $data['step'] = implode(',',array_filter($verify['step']));
  436. $data['apply_start'] = $verify['apply_start'] ? $verify['apply_start'] : null;//报名时间
  437. $data['apply_end'] = $verify['apply_end'] ? $verify['apply_end'] : null;
  438. $data['audit_start'] = $verify['audit_start'] ? $verify['audit_start'] : null;//审核时间
  439. $data['audit_end'] = $verify['audit_end'] ? $verify['audit_end'] : null;
  440. $data['preliminary_start'] = $verify['preliminary_start'] ? $verify['preliminary_start'] : null;//笔试时间
  441. $data['preliminary_end'] = $verify['preliminary_end'] ? $verify['preliminary_end'] : null;
  442. $data['computer_start'] = $verify['computer_start'] ? $verify['computer_start'] : null;//上机时间
  443. $data['computer_end'] = $verify['computer_end'] ? $verify['computer_end'] : null;
  444. $data['interview_start'] = $verify['interview_start'] ? $verify['interview_start'] : null;//面试时间
  445. $data['interview_end'] = $verify['interview_end'] ? $verify['interview_end'] : null;
  446. $data['reexamine_start'] = $verify['reexamine_start'] ? $verify['reexamine_start'] : null;//复试时间
  447. $data['reexamine_end'] = $verify['reexamine_end'] ? $verify['reexamine_end'] : null;
  448. $data['health_start'] = $verify['health_start'] ? $verify['health_start'] : null;//体检时间
  449. $data['health_end'] = $verify['health_end'] ? $verify['health_end'] : null;
  450. $data['political_start'] = $verify['political_start'] ? $verify['political_start'] : null;//政审时间
  451. $data['political_end'] = $verify['political_end'] ? $verify['political_end'] : null;
  452. $data['publicity_start'] = $verify['publicity_start'] ? $verify['publicity_start'] : null;//公示时间
  453. $data['publicity_end'] = $verify['publicity_end'] ? $verify['publicity_end'] : null;
  454. $data['supplement_start'] = $verify['supplement_start'] ? $verify['supplement_start'] : null;
  455. $data['supplement_end'] = $verify['supplement_end'] ? $verify['supplement_end'] : null;
  456. $data['introduction'] = $verify['introduction'];
  457. $data['host_address'] = $verify['host_address'];
  458. $data['contact'] = $verify['contact'];
  459. $data['phone'] = $verify['phone'];
  460. $data['ordid'] = $verify['ordid'];
  461. $data['limit_times'] = $verify['limit_times'];
  462. $data['post_times'] = $verify['post_times'];
  463. $data['pay_switch'] = $verify['pay_switch'];
  464. $data['forms'] = implode(',',array_filter($verify['forms']));
  465. $data['pen_ticket_type'] = $verify['pen_ticket_type'];
  466. $data['pen_ticket_content'] = $verify['pen_ticket_content'];
  467. $data['pen_ticket_status'] = 0;
  468. $data['pen_comfirm'] = $verify['pen_comfirm'];
  469. $data['pen_comfirm_start'] = $verify['pen_comfirm_start'] ? $verify['pen_comfirm_start'] : null;
  470. $data['pen_comfirm_end'] = $verify['pen_comfirm_end'] ? $verify['pen_comfirm_end'] : null;
  471. $data['pen_epidemic'] = $verify['pen_epidemic'];
  472. $data['pen_health'] = $verify['pen_health'];
  473. $data['pen_health_start'] = $verify['pen_health_start'] ? $verify['pen_health_start'] : null;
  474. $data['pen_health_end'] = $verify['pen_health_end'] ? $verify['pen_health_end'] : null;
  475. $data['computer_ticket_type'] = $verify['computer_ticket_type'];
  476. $data['computer_ticket_content'] = $verify['computer_ticket_content'];
  477. $data['computer_ticket_status'] = 0;
  478. $data['computer_ticket_field'] = implode(',',$verify['computer_ticket_field']);
  479. $data['face_ticket_type'] = $verify['face_ticket_type'];
  480. $data['face_ticket_content'] = $verify['face_ticket_content'];
  481. $data['face_ticket_status'] = 0;
  482. $data['face_ticket_field'] = implode(',',$verify['face_ticket_field']);
  483. $data['face_epidemic'] = $verify['face_epidemic'];
  484. $data['face_health'] = $verify['face_health'];
  485. $data['face_health_start'] = $verify['face_health_start'] ? $verify['face_health_start'] : null;
  486. $data['face_health_end'] = $verify['face_health_end'] ? $verify['face_health_end'] : null;
  487. $data['reexamine_ticket_type'] = $verify['reexamine_ticket_type'];
  488. $data['reexamine_ticket_content'] = $verify['reexamine_ticket_content'];
  489. $data['reexamine_ticket_status'] = 0;
  490. $data['reexamine_field'] = implode(',',$verify['reexamine_field']);
  491. $data['special'] = 1;
  492. $fileCharater = $request->input('addFile');
  493. DB::beginTransaction();//检查数据库事务
  494. try {
  495. $recruit = Recruit::create($data);
  496. $recruit_id = $recruit->id;
  497. //添加招聘岗位
  498. $postcode_array = $request->postcode;
  499. $postname_array = $request->postname;
  500. $postnumber_array = $request->postnumber;
  501. $limit_array = $request->postlimit;
  502. $countnum = count($postcode_array);
  503. for ($i = 0; $i < $countnum; $i++) {
  504. $data = array();
  505. if ($postcode_array[$i] !== '' and $postname_array[$i] !== '') {
  506. $data['code'] = $postcode_array[$i];
  507. $data['name'] = $postname_array[$i];
  508. $data['number'] = $postnumber_array[$i];
  509. $data['limit'] = $limit_array[$i];
  510. $data['status'] = 1;
  511. $data['recruit_id'] = $recruit_id;
  512. RecruitPost::create($data);
  513. }
  514. }
  515. if (!empty($fileCharater)) {
  516. foreach ($fileCharater as $f => $fv) {
  517. $picpath = 'recruit/' . date('Ymd', time()) . '/';
  518. //获取文件的扩展名
  519. $ext = $fv->getClientOriginalExtension();
  520. //获取文件的绝对路径
  521. $path = $fv->getRealPath();
  522. //定义文件名
  523. $filename = time() . rand(100, 999) . '.' . $ext;
  524. //存储文件。disk里面的public。总的来说,就是调用disk模块里的public配置
  525. Storage::disk('public')->put($picpath . $filename, file_get_contents($path));
  526. $data = $picpath . $filename;
  527. $create_arr = [
  528. 'recruit_id' => $recruit_id,
  529. 'subjoin_name' => $fv->getClientOriginalName(),
  530. 'subjoin_path' => $data,
  531. 'subjoin_addtime' => time()
  532. ];
  533. RecruitSubjoin::create($create_arr);
  534. }
  535. }
  536. DB::commit();//检查数据库事务
  537. } catch (\Exception $e) {
  538. dd($e->getMessage());
  539. DB::rollback();
  540. return admin_toastr($e->getMessage(), 'error');
  541. }
  542. }
  543. /**
  544. * Edit interface.
  545. *
  546. * @param mixed $id
  547. * @param Content $content
  548. * @return Content
  549. */
  550. public function edit($id, Content $content)
  551. {
  552. Permission::check('special_recruit_manager_edit');
  553. $recruit = Recruit::find($id);
  554. if(!$recruit->special){
  555. $this->show();
  556. }
  557. $grid = $this->form()->edit($id)->render();
  558. return $content
  559. ->header('招考管理')
  560. ->description('编辑')
  561. ->body(view('admin.special.index')->with(['grid' => $grid, 'id' => $id]));
  562. }
  563. /**
  564. * 删掉指定招考场次
  565. * @param $id
  566. */
  567. public function destroy($id)
  568. {
  569. Permission::check('special_recruit_manager_del');
  570. $info = Recruit::find($id);
  571. if($info){
  572. if(!$info->special){
  573. $this->show();
  574. }
  575. if($info->delete()){
  576. //RecruitAppointInfo::where('recruit_id', $id)->delete(); //todo保留
  577. return response()->json(['status' => 1, 'message' => '删除成功!'], '200');
  578. }else{
  579. return response()->json(['status' => 0, 'message' => '删除失败!'], '200');
  580. }
  581. }else{
  582. return response()->json(['status' => 0, 'message' => '找不到记录!'], '200');
  583. }
  584. }
  585. /**
  586. * 报名管理
  587. * @param Content $content
  588. * @param Request $request
  589. * @return Content|\Illuminate\Http\RedirectResponse
  590. */
  591. public function appointList(Content $content, Request $request)
  592. {
  593. Permission::check('special_recruit_appoint_list');
  594. $id = $request->id;
  595. $recruit = Recruit::find($id);
  596. if(!$recruit->special){
  597. $this->show();
  598. }
  599. if (empty($recruit)) {
  600. return back();
  601. }
  602. $search_data = $request->all();
  603. $where = [];
  604. $where[] = ['audit','>',0];
  605. if (isset($search_data['id']) || session('manage_search_data')['id']) {
  606. if (isset($search_data['page'])) {
  607. if (session('search_data')) {
  608. $where = session('managewhere');
  609. unset($search_data['page']);
  610. $search_data = session('manage_search_data');
  611. }
  612. }
  613. foreach ($search_data as $k => $v) {
  614. if ($k == 'realname') {
  615. $where[] = [$k, 'like', "%$v%"];
  616. } elseif ($k == 'id') {
  617. $where[] = ['recruit_appoint_info.recruit_id', '=', $v];
  618. } elseif($k == 'print_bs'){
  619. $where[] = ['recruit_ticket.ex_type', '=', 1];
  620. $where[] = ['recruit_ticket.ex_status', '=', $v];
  621. } elseif($k == 'print_js'){
  622. $where[] = ['recruit_ticket.ex_type', '=', 2];
  623. $where[] = ['recruit_ticket.ex_status', '=', $v];
  624. } elseif($k == 'print_ms'){
  625. $where[] = ['recruit_ticket.ex_type', '=', 3];
  626. $where[] = ['recruit_ticket.ex_status', '=', $v];
  627. } elseif ($k != '_pjax' and $k != 'page' && $k != 'perpage') {
  628. $where[] = [$k, '=', $v];
  629. }
  630. }
  631. session(['managewhere' => $where]);
  632. session(['manage_search_data' => $search_data]);
  633. session()->save();
  634. }
  635. $session_data = session('search_data');
  636. if(isset($session_data['perpage'])){
  637. $perpage = $session_data['perpage'];
  638. }else{
  639. $perpage = 20;
  640. }
  641. $list = RecruitAppointInfo::where($where)
  642. ->join('recruit_post', 'recruit_appoint_info.post_id', '=', 'recruit_post.id', 'left')
  643. ->join('recruit_ticket', 'recruit_ticket.appoint_id', '=', 'recruit_appoint_info.id','left')
  644. ->select('recruit_appoint_info.*', 'recruit_post.code', 'recruit_post.name')
  645. ->orderBy('recruit_appoint_info.updated_at','desc')
  646. ->paginate($perpage);
  647. foreach ($list as $k => $v){
  648. if($v->sex == 0){
  649. $list[$k]['sex'] = '女';
  650. }else{
  651. $list[$k]['sex'] = '男';
  652. }
  653. switch ($v->political_affiliation){
  654. case '01':
  655. $list[$k]['political_affiliation'] = '中共党员';
  656. break;
  657. case '02':
  658. $list[$k]['political_affiliation'] = '中共预备党员';
  659. break;
  660. case '03':
  661. $list[$k]['political_affiliation'] = '共青团员';
  662. break;
  663. case '04':
  664. $list[$k]['political_affiliation'] = '民革党员';
  665. break;
  666. case '05':
  667. $list[$k]['political_affiliation'] = '民盟盟员';
  668. break;
  669. case '06':
  670. $list[$k]['political_affiliation'] = '民建会员';
  671. break;
  672. case '07':
  673. $list[$k]['political_affiliation'] = '民进会员';
  674. break;
  675. case '08':
  676. $list[$k]['political_affiliation'] = '农工党党员';
  677. break;
  678. case '09':
  679. $list[$k]['political_affiliation'] = '致公党党员';
  680. break;
  681. case '10':
  682. $list[$k]['political_affiliation'] = '九三学社社员';
  683. break;
  684. case '11':
  685. $list[$k]['political_affiliation'] = '台盟盟员';
  686. break;
  687. case '12':
  688. $list[$k]['political_affiliation'] = '无党派人士';
  689. break;
  690. case '13':
  691. $list[$k]['political_affiliation'] = '群众';
  692. break;
  693. }
  694. $list[$k]['pen_print'] = 0;
  695. $list[$k]['computer_print'] = 0;
  696. $list[$k]['face_print'] = 0;
  697. $list[$k]['reexamine_print'] = 0;
  698. $tickets = RecruitTicket::where('appoint_id',$v->id)->get();
  699. if($tickets){
  700. foreach ($tickets as $tk => $tv){
  701. if($tv->ex_type == 1){
  702. $list[$k]['pen_print'] = $tv->ex_status;
  703. }
  704. if($tv->ex_type == 2){
  705. $list[$k]['computer_print'] = $tv->ex_status;
  706. }
  707. if($tv->ex_type == 3){
  708. $list[$k]['face_print'] = $tv->ex_status;
  709. }
  710. if($tv->ex_type == 4){
  711. $list[$k]['reexamine_print'] = $tv->ex_status;
  712. }
  713. }
  714. }
  715. }
  716. $post_data = RecruitPost::where('recruit_id',$id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  717. return $content
  718. ->header('报名管理')
  719. ->description('招考人员信息列表')
  720. ->body(view('admin.special.appoint_list')->with([
  721. 'list' => $list,
  722. 'search_data' => $search_data,
  723. 'recruit' => $recruit,
  724. 'post' => $post_data
  725. ]));
  726. }
  727. /**
  728. * 查看审核日志
  729. * @param Request $request
  730. * @return \Illuminate\Http\JsonResponse
  731. */
  732. public function showLog(Request $request)
  733. {
  734. Permission::check('special_recruit_show_log');
  735. $id = $request->id;
  736. $logs = RecruitAppointLog::where('appoint_id', $id)->orderBy('created_at', 'desc')->get()->toArray();
  737. $str = "";
  738. if ($logs) {
  739. $str .= "<table class='table'><tr style='background:#F0F8FD'><td>审核时间</td><td>操作级别</td><td>记录类型</td><td>触发操作的人员</td><td>审核描述</td></tr>";
  740. foreach ($logs as $k => $v) {
  741. switch ($v['type']){
  742. case '1':
  743. $level = '系统级操作';
  744. $user = '系统';
  745. break;
  746. case '2':
  747. $level = '审核系列操作';
  748. $admin = AdminUser::where('id',$v['uid'])->first();
  749. $user = $admin->name;
  750. break;
  751. case '3':
  752. $level = '用户自行操作';
  753. $member = Member::where('id',$v['uid'])->first();
  754. $user = $member->username;
  755. break;
  756. }
  757. switch ($v['step']){
  758. case '1':
  759. $step = '报名及审核';
  760. break;
  761. case '2':
  762. $step = '笔试';
  763. break;
  764. case '3':
  765. $step = '面试';
  766. break;
  767. case '4':
  768. $step = '上机';
  769. break;
  770. case '5':
  771. $step = '复审';
  772. break;
  773. case '6':
  774. $step = '体检';
  775. break;
  776. case '7':
  777. $step = '政审';
  778. break;
  779. case '8':
  780. $step = '录用';
  781. break;
  782. }
  783. $str .= "<tr><td>" . $v['created_at'] . "</td><td>" . $level . "</td><td>" . $step . "</td><td>" . $user . "</td><td>" . $v['log'] . "</td></tr>\r\n";
  784. }
  785. $str .= "</table>";
  786. } else {
  787. $str = "抱歉,暂未有审核记录";
  788. }
  789. return response()->json(['code' => 1, 'data' => $str]);
  790. }
  791. /**
  792. * 查看报名详细信息
  793. * @param Request $request
  794. * @return \Illuminate\Http\JsonResponse
  795. * @throws \Throwable
  796. */
  797. public function getUserinfo(Request $request)
  798. {
  799. Permission::check('special_recruit_getUserinfo');
  800. $id = $request->id;
  801. $data = RecruitAppointInfo::where('recruit_appoint_info.id',$id)
  802. ->join('recruit_post', 'recruit_appoint_info.post_id', '=', 'recruit_post.id', 'left')
  803. ->join('recruit_appoint_expand_special', 'recruit_appoint_info.id', '=', 'recruit_appoint_expand_special.recruit_appoint_id', 'left')
  804. ->join('recruit_appoint_detail', 'recruit_appoint_detail.recruit_appoint_id', '=', 'recruit_appoint_info.id', 'left')
  805. ->select('recruit_appoint_info.*', 'recruit_post.name', 'recruit_post.code', 'recruit_appoint_detail.train', 'recruit_appoint_detail.rewards_and_punishments', 'recruit_appoint_detail.introduce', 'recruit_appoint_expand_special.point_apply', 'recruit_appoint_expand_special.condition', 'recruit_appoint_expand_special.material')
  806. ->first();
  807. $recruit = Recruit::where('id',$data->recruit_id)->first();
  808. $recruit->forms = explode(',', $recruit->forms);
  809. $data->family = json_decode($data->family);
  810. if ($data->family) {
  811. foreach ($data->family as $k => $v) {
  812. $v->political_affiliation = RecruitAppointInfo::$political_affiliation[$v->political_affiliation];
  813. }
  814. }
  815. //layer相册层
  816. $photos = [
  817. 'material'=>[],
  818. 'identification'=>[],
  819. 'education_certification'=>[],
  820. 'other_certification'=>[],
  821. ];
  822. if(in_array('expand_special',$recruit->forms)){
  823. if(json_decode($data->material)){
  824. $data->material = json_decode($data->material);
  825. $photo_data = [];
  826. foreach ($data->material as $k => $v) {
  827. if($v->status){
  828. $photo_data[] = [
  829. 'alt' => $v->name,
  830. 'pid' => $v->uid,
  831. 'src' => $v->response->path,
  832. ];
  833. }
  834. }
  835. $photos['material'] = [
  836. 'title' => '申请加分佐证材料',
  837. 'id' => 1,
  838. 'start' => 0,
  839. 'data' =>$photo_data
  840. ];
  841. }else{
  842. $data->material = [];
  843. }
  844. }
  845. if(in_array('identification',$recruit->forms) || in_array('internship',$recruit->forms)){
  846. if(json_decode($data->identification)){
  847. $data->identification = json_decode($data->identification);
  848. $photo_data = [];
  849. foreach ($data->identification as $k => $v) {
  850. if($v->status){
  851. $photo_data[] = [
  852. 'alt' => $v->name,
  853. 'pid' => $v->uid,
  854. 'src' => $v->response->path,
  855. ];
  856. }
  857. }
  858. $photos['identification'] = [
  859. 'title' => '身份证明',
  860. 'id' => 1,
  861. 'start' => 0,
  862. 'data' =>$photo_data
  863. ];
  864. }else{
  865. $data->identification = [];
  866. }
  867. }
  868. if(in_array('education_certification',$recruit->forms) || in_array('internship',$recruit->forms)){
  869. if(json_decode($data->education_certification)){
  870. $data->education_certification = json_decode($data->education_certification);
  871. $photo_data = [];
  872. foreach ($data->education_certification as $k => $v) {
  873. if($v->status){
  874. $photo_data[] = [
  875. 'alt' => $v->name,
  876. 'pid' => $v->uid,
  877. 'src' => $v->response->path,
  878. ];
  879. }
  880. }
  881. $photos['education_certification'] = [
  882. 'title' => '学历证明',
  883. 'id' => 1,
  884. 'start' => 0,
  885. 'data' =>$photo_data
  886. ];
  887. }else{
  888. $data->education_certification = [];
  889. }
  890. }
  891. if(in_array('other_certification',$recruit->forms) || in_array('internship',$recruit->forms)){
  892. if(json_decode($data->other_certification)){
  893. $data->other_certification = json_decode($data->other_certification);
  894. $photo_data = [];
  895. foreach ($data->other_certification as $k => $v) {
  896. if($v->status){
  897. $photo_data[] = [
  898. 'alt' => $v->name,
  899. 'pid' => $v->uid,
  900. 'src' => $v->response->path,
  901. ];
  902. }
  903. }
  904. $photos['other_certification'] = [
  905. 'title' => '其他证明',
  906. 'id' => 1,
  907. 'start' => 0,
  908. 'data' =>$photo_data
  909. ];
  910. }else{
  911. $data->other_certification = [];
  912. }
  913. }
  914. if(in_array('chengnuoshu',$recruit->forms)){
  915. if(json_decode($data->chengnuoshu)){
  916. $data->chengnuoshu = json_decode($data->chengnuoshu);
  917. $photo_data = [];
  918. foreach ($data->chengnuoshu as $k => $v) {
  919. if($v->status){
  920. $photo_data[] = [
  921. 'alt' => $v->name,
  922. 'pid' => $v->uid,
  923. 'src' => $v->response->path,
  924. ];
  925. }
  926. }
  927. $photos['chengnuoshu'] = [
  928. 'title' => '诚信承诺书',
  929. 'id' => 1,
  930. 'start' => 0,
  931. 'data' =>$photo_data
  932. ];
  933. }else{
  934. $data->chengnuoshu = [];
  935. }
  936. }
  937. if(in_array('shixin',$recruit->forms)){
  938. if(json_decode($data->shixin)){
  939. $data->shixin = json_decode($data->shixin);
  940. $photo_data = [];
  941. foreach ($data->shixin as $k => $v) {
  942. if($v->status){
  943. $photo_data[] = [
  944. 'alt' => $v->name,
  945. 'pid' => $v->uid,
  946. 'src' => $v->response->path,
  947. ];
  948. }
  949. }
  950. $photos['shixin'] = [
  951. 'title' => '失信被执行人查询信息页扫描件',
  952. 'id' => 1,
  953. 'start' => 0,
  954. 'data' =>$photo_data
  955. ];
  956. }else{
  957. $data->shixin = [];
  958. }
  959. }
  960. $html = view('admin.recruit.manageajax_userinfo')->with(['appointinfo' => $data,'recruit' => $recruit,'photos'=>$photos])->render();
  961. return response()->json(['code' => 1, 'data' => $html]);
  962. }
  963. /**
  964. * 获得招考场次的岗位
  965. * @param Request $request
  966. * @return \Illuminate\Http\JsonResponse
  967. */
  968. public function getRecruitPost(Request $request)
  969. {
  970. //Permission::check('special_recruit_manager_create');
  971. //Permission::check('special_recruit_manager_edit');
  972. $id = $request->id;
  973. $recruit = Recruit::find($id);
  974. $post = RecruitPost::where('recruit_id', $id)->get();
  975. return response()->json(['post' => $post, 'recruit' => $recruit], '200');
  976. }
  977. /**
  978. * 报名记录审核处理
  979. * @param Request $request
  980. * @return \Illuminate\Http\JsonResponse
  981. */
  982. public function appoint_audit(Request $request)
  983. {
  984. $ids = $request->ids;
  985. if (!is_array($ids)) {
  986. $ids = explode(",", $ids);
  987. }
  988. if (empty($ids)) {
  989. return response()->json(['status' => 0, 'msg' => '请选择审核记录!'], '200');
  990. }
  991. $audit = $request->audit;
  992. $exam_flow_path = $request->exam_flow_path;
  993. $reason = $request->reason;
  994. if(empty($audit)){
  995. return response()->json(['status' => 0, 'msg' => '请选择审核状态!'], '200');
  996. }
  997. if($audit == '3' && empty($exam_flow_path)){
  998. return response()->json(['status' => 0, 'msg' => '请选择审核后的考试流程!'], '200');
  999. }
  1000. if($audit != '3' && empty($reason)){
  1001. return response()->json(['status' => 0, 'msg' => '请输入审核原因!'], '200');
  1002. }
  1003. $message = [];
  1004. switch ($audit){
  1005. case '1':
  1006. //撤回至未审核
  1007. foreach ($ids as $k => $v){
  1008. $appointinfo = RecruitAppointInfo::where('id', $v)->first();
  1009. $recruit = Recruit::find($appointinfo->recruit_id);
  1010. if(!$recruit->special){
  1011. continue;
  1012. }
  1013. if(!$appointinfo || intval($appointinfo->audit) === 1){
  1014. continue;
  1015. }
  1016. //设置该报名的各个状态
  1017. $appointinfo_data = [
  1018. 'current' => 1,
  1019. 'audit' => 1,
  1020. 'pen_audit' => -1,
  1021. 'computer_audit' => -1,
  1022. 'face_audit' => -1,
  1023. 'reexamine_audit' => -1,
  1024. 'inspect_audit' => -1,
  1025. 'political_audit' => -1,
  1026. 'employ_audit' => -1
  1027. ];
  1028. RecruitAppointInfo::where('id', $v)->update($appointinfo_data);
  1029. //写日志
  1030. $log = [
  1031. 'type' => 2,
  1032. 'step' => 1,
  1033. 'appoint_id' => $v,
  1034. 'uid' => Admin::user()->id,
  1035. 'log' => '撤回至未审核状态,原因是:'.$reason
  1036. ];
  1037. RecruitAppointLog::create($log);
  1038. $message[$v] = '您此次的报名需要重新审核,原因是:'.$reason;
  1039. }
  1040. break;
  1041. case '2':
  1042. //审核未通过
  1043. foreach ($ids as $k => $v){
  1044. $appointinfo = RecruitAppointInfo::where('id', $v)->first();
  1045. $recruit = Recruit::find($appointinfo->recruit_id);
  1046. if(!$recruit->special){
  1047. continue;
  1048. }
  1049. if(!$appointinfo || intval($appointinfo->audit) === 2){
  1050. continue;
  1051. }
  1052. //设置该报名的各个状态
  1053. $appointinfo_data = [
  1054. 'current' => 1,
  1055. 'audit' => 2,
  1056. 'pen_audit' => -1,
  1057. 'computer_audit' => -1,
  1058. 'face_audit' => -1,
  1059. 'reexamine_audit' => -1,
  1060. 'inspect_audit' => -1,
  1061. 'political_audit' => -1,
  1062. 'employ_audit' => -1
  1063. ];
  1064. RecruitAppointInfo::where('id', $v)->update($appointinfo_data);
  1065. //写日志
  1066. $log = [
  1067. 'type' => 2,
  1068. 'step' => 1,
  1069. 'appoint_id' => $v,
  1070. 'uid' => Admin::user()->id,
  1071. 'log' => '审核未通过,原因是:'.$reason
  1072. ];
  1073. RecruitAppointLog::create($log);
  1074. $message[$v] = '您此次报名审核未通过,原因是:'.$reason;
  1075. $this->smsService->sendSms($appointinfo->mobile,'sms_recruit_register_error',array('reason'=>$reason));
  1076. }
  1077. break;
  1078. case '3':
  1079. //审核通过
  1080. foreach ($ids as $k => $v){
  1081. $appointinfo = RecruitAppointInfo::where('id', $v)->first();
  1082. $recruit = Recruit::find($appointinfo->recruit_id);
  1083. if(!$recruit->special){
  1084. continue;
  1085. }
  1086. if(!$appointinfo || intval($appointinfo->audit) === 3){
  1087. continue;
  1088. }
  1089. $recruit = Recruit::where('id',$appointinfo->recruit_id)->first();
  1090. $step = explode(',',$recruit->step);
  1091. $step_str = [
  1092. 'pen' => '未设置此条报名记录的笔试信息',
  1093. ];
  1094. if(in_array('3',$step)){
  1095. //场次有设置笔试
  1096. if(in_array('pen',$exam_flow_path)){
  1097. $step_str['pen'] = '该场次需要笔试,已设置此条报考需要参与笔试';
  1098. $pen_audit = -1;
  1099. }else{
  1100. $step_str['pen'] = '该场次需要笔试,此条报考可跳过笔试';
  1101. $pen_audit = 3;
  1102. }
  1103. }else{
  1104. $step_str['pen'] = '该场次不需要笔试';
  1105. $pen_audit = 3;
  1106. }
  1107. if(in_array('4',$step)){
  1108. //场次有设置上机
  1109. if(in_array('computer',$exam_flow_path)){
  1110. $step_str['computer'] = '该场次需要上机,已设置此条报考需要参与上机';
  1111. $computer_audit = -1;
  1112. }else{
  1113. $step_str['computer'] = '该场次需要上机,此条报考可跳过上机';
  1114. $computer_audit = 3;
  1115. }
  1116. }else{
  1117. $step_str['computer'] = '该场次不需要上机';
  1118. $computer_audit = 3;
  1119. }
  1120. if(in_array('5',$step)){
  1121. //场次有设置上机
  1122. if(in_array('face',$exam_flow_path)){
  1123. $step_str['face'] = '该场次需要面试,已设置此条报考需要参与面试';
  1124. $face_audit = -1;
  1125. }else{
  1126. $step_str['face'] = '该场次需要面试,此条报考可跳过面试';
  1127. $face_audit = 3;
  1128. }
  1129. }else{
  1130. $step_str['face'] = '该场次不需要面试';
  1131. $face_audit = 3;
  1132. }
  1133. if(in_array('6',$step)){
  1134. //场次有设置复试
  1135. if(in_array('reexamine',$exam_flow_path)){
  1136. $step_str['reexamine'] = '该场次需要复试,已设置此条报考需要参与复试';
  1137. $reexamine_audit = -1;
  1138. }else{
  1139. $step_str['reexamine'] = '该场次需要复试,此条报考可跳过复试';
  1140. $reexamine_audit = 3;
  1141. }
  1142. }else{
  1143. $step_str['reexamine'] = '该场次不需要复试';
  1144. $reexamine_audit = 3;
  1145. }
  1146. //设置该报名的各个状态
  1147. $appointinfo_data = [
  1148. 'current' => 2,//审核成功后进入考试流程
  1149. 'audit' => 3,
  1150. 'pen_audit' => $pen_audit,
  1151. 'computer_audit' => $computer_audit,
  1152. 'face_audit' => $face_audit,
  1153. 'reexamine_audit' => $reexamine_audit,
  1154. 'inspect_audit' => -1,
  1155. 'political_audit' => -1,
  1156. 'employ_audit' => -1
  1157. ];
  1158. RecruitAppointInfo::where('id', $v)->update($appointinfo_data);
  1159. $reason = $reason ?? '符合报考条件';
  1160. //写日志
  1161. $log = [
  1162. 'type' => 2,
  1163. 'step' => 1,
  1164. 'appoint_id' => $v,
  1165. 'uid' => Admin::user()->id,
  1166. 'log' => '审核通过,原因是:' . $reason,
  1167. 'admin_log' => implode(';',$step_str)
  1168. ];
  1169. RecruitAppointLog::create($log);
  1170. $message[$v] = '您此次报名审核已通过,原因是:' . $reason;
  1171. $this->smsService->sendSms($appointinfo->mobile,'sms_recruit_register_success',array('reason'=>$reason));
  1172. $this->fetch_word(['recruit_id'=>$appointinfo->recruit_id,'appoint_id'=>$appointinfo->id]);
  1173. }
  1174. break;
  1175. }
  1176. //站内信
  1177. foreach ($ids as $key => $val) {
  1178. if(array_key_exists($val,$message)){
  1179. $user_info = Member::where('id', $appointinfo->uid)->first();
  1180. Pms::write_pmsnotice($user_info->id, $user_info->username, $message[$val]);
  1181. }else{
  1182. continue;
  1183. }
  1184. }
  1185. return response()->json(['status' => 1, 'msg' => '操作成功!', 'data' => 'ok']);
  1186. }
  1187. /**
  1188. * 第一阶段(报名审核)
  1189. * @param Request $request
  1190. * @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response|mixed|\Psr\Container\ContainerInterface|\Symfony\Component\HttpFoundation\Response|\think\Response
  1191. * @throws \Throwable
  1192. */
  1193. public function ajax_audit(Request $request)
  1194. {
  1195. Permission::check('special_recruit_ajax_audit');
  1196. $ids = $request->ids;
  1197. $view_data['ids'] = $ids;
  1198. return response(['data' => view('admin.special.ajax_audit')->with($view_data)->render(), 'status' => 1], '200');
  1199. }
  1200. /**
  1201. * 导出excel汇总表
  1202. * @param Content $content
  1203. * @param Request $request
  1204. * @return \Illuminate\Http\JsonResponse
  1205. * @throws \PhpOffice\PhpSpreadsheet\Exception
  1206. * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
  1207. */
  1208. public function out_excel(Content $content, Request $request)
  1209. {
  1210. Permission::check('special_recruit_out_excel');
  1211. $id = $request->id;
  1212. $recruit = Recruit::find($id);
  1213. if(!$recruit->special){
  1214. $this->show();
  1215. }
  1216. if (empty($recruit)) {
  1217. return response()->json(['status' => 0, 'msg' => '找不到对应的招考场次'], 200);
  1218. }
  1219. $data = $request->all();
  1220. $where = [];
  1221. $where[] = ['audit','>',0];
  1222. $where[] = ['recruit_appoint_info.recruit_id', '=', $data['id']];
  1223. $param = parse_url($data['where']);
  1224. parse_str($param['query'],$param);
  1225. if (is_array($param)) {
  1226. unset($param['id']);
  1227. foreach ($param as $k => $v) {
  1228. if ($k == 'realname') {
  1229. $where[] = [$k, 'like', "%$v%"];
  1230. } elseif ($k == 'id') {
  1231. $where[] = ['recruit_appoint_info.recruit_id', '=', $v];
  1232. } elseif($k == 'print_bs'){
  1233. $where[] = ['recruit_ticket.ex_type', '=', 1];
  1234. $where[] = ['recruit_ticket.ex_status', '=', $v];
  1235. } elseif($k == 'print_js'){
  1236. $where[] = ['recruit_ticket.ex_type', '=', 2];
  1237. $where[] = ['recruit_ticket.ex_status', '=', $v];
  1238. } elseif($k == 'print_ms'){
  1239. $where[] = ['recruit_ticket.ex_type', '=', 3];
  1240. $where[] = ['recruit_ticket.ex_status', '=', $v];
  1241. } elseif ($k != '_pjax' and $k != 'page' && $k != 'perpage') {
  1242. $where[] = [$k, '=', $v];
  1243. }
  1244. }
  1245. }
  1246. $select = ['recruit_appoint_info.*', 'recruit_post.code', 'recruit_post.name'];
  1247. $model = RecruitAppointInfo::where($where)->join('recruit_post', 'recruit_appoint_info.post_id', '=', 'recruit_post.id', 'left')->join('recruit_ticket','recruit_ticket.appoint_id','=','recruit_appoint_info.id','left');
  1248. if(in_array('expand_special',explode(',', $recruit->forms))){
  1249. $model->join('recruit_appoint_expand_special', 'recruit_appoint_expand_special.recruit_appoint_id', '=', 'recruit_appoint_info.id', 'left');
  1250. $special_select = ['recruit_appoint_expand_special.point_apply','recruit_appoint_expand_special.condition','recruit_appoint_expand_special.material'];
  1251. $select = array_merge($select,$special_select);
  1252. }
  1253. if(in_array('detail',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1254. $model->join('recruit_appoint_detail', 'recruit_appoint_detail.recruit_appoint_id', '=', 'recruit_appoint_info.id', 'left');
  1255. $detail_select = ['recruit_appoint_detail.train','recruit_appoint_detail.rewards_and_punishments','recruit_appoint_detail.introduce'];
  1256. $select = array_merge($select,$detail_select);
  1257. }
  1258. $list = $model->select($select)
  1259. ->orderBy('recruit_appoint_info.updated_at','desc')
  1260. ->get();
  1261. if(count($list)){
  1262. $spreadsheet = new Spreadsheet();
  1263. $sheet = $spreadsheet->getActiveSheet();
  1264. if(in_array('internship',explode(',', $recruit->forms))){
  1265. $header = ['姓名','性别','生日','头像','民族','籍贯','报名岗位','政治面貌','入党时间','户籍所在地','年级','就读院校','所学专业','是否接受调剂','通信地址','身份证号码','联系电话','电子邮箱','紧急联系人','紧急联系电话'];
  1266. }else{
  1267. $header = ['姓名','性别','生日','头像','民族','籍贯','报考岗位','政治面貌','入党时间','职称或职业资格','现工作单位及职务','户籍所在地','学历','学校','学位','所学专业','通信地址','身份证号码','联系电话','电子邮箱','紧急联系人','紧急联系电话'];
  1268. }
  1269. if(in_array('expand_special',explode(',', $recruit->forms))){
  1270. $special = ['是否申请加分','符合哪一项加分条件','加分佐证材料'];
  1271. $header = array_merge($header,$special);
  1272. }
  1273. if(in_array('detail',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1274. $detail = ['个人简历','培训学习经历','奖惩情况','个人介绍'];
  1275. }else{
  1276. $detail = ['个人简历'];
  1277. }
  1278. $header = array_merge($header,$detail);
  1279. $header[] = '家庭成员及其社会关系';
  1280. if(in_array('identification',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1281. $header[] = '身份证明';
  1282. }
  1283. if(in_array('education_certification',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1284. $header[] = '学历证明';
  1285. }
  1286. if(in_array('other_certification',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1287. $header[] = '其他证明';
  1288. }
  1289. if(in_array('chengnuoshu',explode(',', $recruit->forms))){
  1290. $header[] = '诚信承诺书';
  1291. }
  1292. if(in_array('shixin',explode(',', $recruit->forms))){
  1293. $header[] = '失信被执行人查询信息页扫描件';
  1294. }
  1295. $header[] = '审核状态';
  1296. $header[] = '审核意见';
  1297. // if(in_array('3',explode(',', $recruit->step))){
  1298. // $header = array_merge($header,['笔试准考证打印','笔试审核状态','笔试结果']);
  1299. // }
  1300. // if(in_array('4',explode(',', $recruit->step))){
  1301. // $header = array_merge($header,['上机准考证打印','上机审核状态','上机结果']);
  1302. // }
  1303. // if(in_array('5',explode(',', $recruit->step))){
  1304. // $header = array_merge($header,['面试准考证打印','面试审核状态','面试结果']);
  1305. // }
  1306. // if(in_array('6',explode(',', $recruit->step))){
  1307. // $header = array_merge($header,['复试准考证打印','复试审核状态','复试结果']);
  1308. // }
  1309. // if(in_array('7',explode(',', $recruit->step))){
  1310. // $header = array_merge($header,['体检审核状态','体检结果']);
  1311. // }
  1312. // if(in_array('8',explode(',', $recruit->step))){
  1313. // $header = array_merge($header,['政审状态','政审结果']);
  1314. // }
  1315. $header[] = 'word简历的下载地址';
  1316. foreach ($header as $key => $value) {
  1317. $sheet->setCellValueByColumnAndRow($key+1, 1, $value);
  1318. }
  1319. $row = 2;
  1320. $sheet->getStyle('S')->getNumberFormat()->setFormatCode('0');
  1321. $length = count($list);//算出该数组的长度
  1322. $last = $list[$length-1];//取出最后一个数组的值,复制给新变量,-1是因为第一个数组元素下表为0
  1323. unset($list[$length-1]);//将最后一个数组注销
  1324. $list[] = $last;//再将新变量加入到数组里
  1325. $data = [];
  1326. foreach ($list as $k => $v) {
  1327. switch ($v->political_affiliation) {
  1328. case '01':
  1329. $political_affiliation = '中共党员';
  1330. break;
  1331. case '02':
  1332. $political_affiliation = '中共预备党员';
  1333. break;
  1334. case '03':
  1335. $political_affiliation = '共青团员';
  1336. break;
  1337. case '04':
  1338. $political_affiliation = '民革党员';
  1339. break;
  1340. case '05':
  1341. $political_affiliation = '民盟盟员';
  1342. break;
  1343. case '06':
  1344. $political_affiliation = '民建会员';
  1345. break;
  1346. case '07':
  1347. $political_affiliation = '民进会员';
  1348. break;
  1349. case '08':
  1350. $political_affiliation = '农工党党员';
  1351. break;
  1352. case '09':
  1353. $political_affiliation = '致公党党员';
  1354. break;
  1355. case '10':
  1356. $political_affiliation = '九三学社社员';
  1357. break;
  1358. case '11':
  1359. $political_affiliation = '台盟盟员';
  1360. break;
  1361. case '12':
  1362. $political_affiliation = '无党派人士';
  1363. break;
  1364. case '13':
  1365. $political_affiliation = '群众';
  1366. break;
  1367. default:
  1368. $political_affiliation = '未知';
  1369. break;
  1370. }
  1371. if(in_array('internship',explode(',', $recruit->forms))){
  1372. $header = ['姓名','性别','生日','头像','民族','籍贯','报名岗位','政治面貌','入党时间','户籍所在地','年级','就读院校','所学专业','是否接受调剂','通信地址','身份证号码','联系电话','电子邮箱','紧急联系人','紧急联系电话'];
  1373. $item = [
  1374. $v->realname,
  1375. $v->sex == 0 ? '女' : '男',
  1376. $v->birthday,
  1377. "https://www.jucai.gov.cn" . $v->avatar,
  1378. $v->nation,
  1379. $v->native_place,
  1380. $v->code . $v->name,
  1381. $political_affiliation,
  1382. $v->join_time,
  1383. $v->house_register,
  1384. $v->education,
  1385. $v->school,
  1386. $v->pro,
  1387. $v->adjust == 0 ? '否' : '是',
  1388. $v->address,
  1389. '\''.$v->card,
  1390. $v->mobile,
  1391. $v->email,
  1392. $v->concat_name,
  1393. $v->concat_mobile
  1394. ];
  1395. }else{
  1396. $item = [
  1397. $v->realname,
  1398. $v->sex == 0 ? '女' : '男',
  1399. $v->birthday,
  1400. "https://www.jucai.gov.cn" . $v->avatar,
  1401. $v->nation,
  1402. $v->native_place,
  1403. $v->code . $v->name,
  1404. $political_affiliation,
  1405. $v->join_time,
  1406. $v->titles,
  1407. $v->work,
  1408. $v->house_register,
  1409. $v->education,
  1410. $v->school,
  1411. $v->degree,
  1412. $v->pro,
  1413. $v->address,
  1414. '\''.$v->card,
  1415. $v->mobile,
  1416. $v->email,
  1417. $v->concat_name,
  1418. $v->concat_mobile
  1419. ];
  1420. }
  1421. if (in_array('expand_special', explode(',', $recruit->forms))) {
  1422. $material = json_decode($v->material, true);
  1423. $materials = [];
  1424. if($material){
  1425. foreach ($material as $key => $value) {
  1426. array_push($materials, "https://www.jucai.gov.cn" . $value['response']['path']);
  1427. }
  1428. }
  1429. $special = [
  1430. $v->point_apply == 0 ? '否' : '是',
  1431. $v->condition,
  1432. implode("\r\n", $materials)
  1433. ];
  1434. $item = array_merge($item, $special);
  1435. }
  1436. if (in_array('detail', explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))) {
  1437. $detail = [
  1438. $v->resume,
  1439. $v->train,
  1440. $v->rewards_and_punishments,
  1441. $v->introduce
  1442. ];
  1443. } else {
  1444. $detail = [$v->resume];
  1445. }
  1446. $item = array_merge($item, $detail);
  1447. $family = json_decode($v->family, true);
  1448. $familys = [];
  1449. foreach ($family as $val){
  1450. switch ($val['political_affiliation']) {
  1451. case '01':
  1452. $political_affiliation = '中共党员';
  1453. break;
  1454. case '02':
  1455. $political_affiliation = '中共预备党员';
  1456. break;
  1457. case '03':
  1458. $political_affiliation = '共青团员';
  1459. break;
  1460. case '04':
  1461. $political_affiliation = '民革党员';
  1462. break;
  1463. case '05':
  1464. $political_affiliation = '民盟盟员';
  1465. break;
  1466. case '06':
  1467. $political_affiliation = '民建会员';
  1468. break;
  1469. case '07':
  1470. $political_affiliation = '民进会员';
  1471. break;
  1472. case '08':
  1473. $political_affiliation = '农工党党员';
  1474. break;
  1475. case '09':
  1476. $political_affiliation = '致公党党员';
  1477. break;
  1478. case '10':
  1479. $political_affiliation = '九三学社社员';
  1480. break;
  1481. case '11':
  1482. $political_affiliation = '台盟盟员';
  1483. break;
  1484. case '12':
  1485. $political_affiliation = '无党派人士';
  1486. break;
  1487. case '13':
  1488. $political_affiliation = '群众';
  1489. break;
  1490. default:
  1491. $political_affiliation = '未知';
  1492. break;
  1493. }
  1494. $familys[] = "称谓:" . $val['relation'] . ";姓名:".$val['realname'] . ';生日:'.$val['birthday'].';政治面貌:'.$political_affiliation.';职业:'.$val['work'];
  1495. }
  1496. $item[] = implode("\r\n", $familys);
  1497. if (in_array('identification', explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))) {
  1498. $identification = json_decode($v->identification, true);
  1499. $identifications = [];
  1500. foreach ($identification as $val){
  1501. if(array_key_exists('path', $val['response'])){
  1502. array_push($identifications,"https://www.jucai.gov.cn" . $val['response']['path']);
  1503. }
  1504. }
  1505. array_push($item, implode("\r\n", $identifications));
  1506. }
  1507. if (in_array('education_certification', explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))) {
  1508. $education_certification = json_decode($v->education_certification, true);
  1509. $education_certifications = [];
  1510. foreach ($education_certification as $val){
  1511. if(array_key_exists('path', $val['response'])){
  1512. array_push($education_certifications,"https://www.jucai.gov.cn" . $val['response']['path']);
  1513. }
  1514. }
  1515. array_push($item, implode("\r\n", $education_certifications));
  1516. }
  1517. if (in_array('other_certification', explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))) {
  1518. $other_certification = json_decode($v->other_certification, true);
  1519. $other_certifications = [];
  1520. if($other_certification){
  1521. foreach ($other_certification as $val){
  1522. if(array_key_exists('path', $val['response'])){
  1523. array_push($other_certifications,"https://www.jucai.gov.cn" . $val['response']['path']);
  1524. }
  1525. }
  1526. }
  1527. array_push($item, implode("\r\n", $other_certifications));
  1528. }
  1529. if (in_array('chengnuoshu', explode(',', $recruit->forms))) {
  1530. $chengnuoshu = json_decode($v->chengnuoshu, true);
  1531. $chengnuoshu = [];
  1532. if($chengnuoshu){
  1533. foreach ($chengnuoshu as $val){
  1534. if(array_key_exists('path', $val['response'])){
  1535. array_push($chengnuoshu,"https://www.jucai.gov.cn" . $val['response']['path']);
  1536. }
  1537. }
  1538. }
  1539. array_push($item, implode("\r\n", $chengnuoshu));
  1540. }
  1541. if (in_array('shixin', explode(',', $recruit->forms))) {
  1542. $shixin = json_decode($v->shixin, true);
  1543. $shixin = [];
  1544. if($shixin){
  1545. foreach ($shixin as $val){
  1546. if(array_key_exists('path', $val['response'])){
  1547. array_push($shixin,"https://www.jucai.gov.cn" . $val['response']['path']);
  1548. }
  1549. }
  1550. }
  1551. array_push($item, implode("\r\n", $shixin));
  1552. }
  1553. switch (intval($v->audit)){
  1554. case 1:
  1555. $item[] = '审核中';
  1556. $item[] = '';
  1557. break;
  1558. case 2:
  1559. case 3:
  1560. $log = RecruitAppointLog::where('appoint_id', $v->id)->where('step', 1)->where('type', 2)->orderBy('created_at', 'desc')->first();
  1561. if ($log) {
  1562. $log_split = explode(':',$log->log);
  1563. $log_status = explode(',',$log_split[0]);
  1564. $item[] = $log_status[0];
  1565. $item[] = $log_split[1];
  1566. } else {
  1567. $item[] = '';
  1568. $item[] = '';
  1569. }
  1570. break;
  1571. default:
  1572. $item[] = '';
  1573. $item[] = '';
  1574. break;
  1575. }
  1576. if(empty($v->word_url)){
  1577. $item[] = "暂无";
  1578. }else{
  1579. $item[] = "https://www.jucai.gov.cn/" . $v->word_url;
  1580. }
  1581. array_push($data,$item);
  1582. }
  1583. foreach($data as $k => $v){
  1584. for ($i = 0;$i<count($v);$i++){
  1585. if($i == 18 || $i == 19 || $i == 22){
  1586. $sheet->setCellValueExplicitByColumnAndRow($i+1, $row, $v[$i], DataType::TYPE_STRING);
  1587. }else{
  1588. $sheet->setCellValueByColumnAndRow($i+1, $row, $v[$i]);
  1589. }
  1590. }
  1591. $row++;
  1592. }
  1593. $file_name = $recruit->name . date("Y-m-d",time());
  1594. header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  1595. header('Content-Disposition: attachment;filename="'.$file_name.'.xlsx"');
  1596. header('Cache-Control: max-age=0');
  1597. // If you're serving to IE 9, then the following may be needed
  1598. header('Cache-Control: max-age=1');
  1599. // If you're serving to IE over SSL, then the following may be needed
  1600. header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
  1601. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
  1602. header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
  1603. header('Pragma: public'); // HTTP/1.0
  1604. $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
  1605. $writer->save('php://output');
  1606. }else{
  1607. return response()->json(['status' => 0, 'msg' => '没有搜索到相关人员'], 200);
  1608. }
  1609. }
  1610. /**
  1611. * 座位贴
  1612. * @param Content $content
  1613. * @param Request $request
  1614. * @return Content
  1615. */
  1616. public function seat_sticker(Content $content, Request $request){
  1617. $recruit_id = $request->id;
  1618. $list = RecruitAppointInfo::where(['recruit_appoint_info.recruit_id' => $recruit_id,'recruit_appoint_info.audit' => 3, 'recruit_ticket.ex_type' => 1])
  1619. ->join('recruit_ticket', 'recruit_ticket.appoint_id', '=', 'recruit_appoint_info.id','left')
  1620. ->select('recruit_appoint_info.*','recruit_ticket.*')
  1621. ->orderBy('recruit_ticket.ex_room','asc')
  1622. ->orderByRaw('recruit_ticket.ex_seat+0 asc')
  1623. ->get();
  1624. $data = [];
  1625. foreach ($list as $k => $v){
  1626. $place = $v->ex_place == null ? 'empty' : $v->ex_place;
  1627. if(!array_key_exists($place,$data)){
  1628. $data[$place] = [];
  1629. }
  1630. $room = $v->ex_room == null ? 'empty' : $v->ex_room;
  1631. if(!array_key_exists($room,$data[$place])){
  1632. $data[$place][$room] = [];
  1633. }
  1634. $item = [
  1635. 'avatar' => $v->avatar,
  1636. 'seat' => $v->ex_seat,
  1637. 'realname' => $v->realname,
  1638. 'number' => $v->ex_number
  1639. ];
  1640. array_push($data[$place][$room],$item);
  1641. }
  1642. //dd($data);
  1643. return $content->body(view('admin.recruit.seat_sticker')->with(['data' => $data]));
  1644. }
  1645. public function sign_table(Content $content, Request $request){
  1646. $recruit_id = $request->id;
  1647. $list = RecruitAppointInfo::where(['recruit_appoint_info.recruit_id' => $recruit_id,'recruit_appoint_info.audit' => 3, 'recruit_ticket.ex_type' => 1])
  1648. ->join('recruit_ticket', 'recruit_ticket.appoint_id', '=', 'recruit_appoint_info.id','left')
  1649. ->select('recruit_appoint_info.*','recruit_ticket.*')
  1650. ->orderBy('recruit_ticket.ex_room','asc')
  1651. ->orderByRaw('recruit_ticket.ex_seat+0 asc')
  1652. ->get();
  1653. $data = [];
  1654. foreach ($list as $k => $v){
  1655. $place = $v->ex_place == null ? 'empty' : $v->ex_place;
  1656. if(!array_key_exists($place,$data)){
  1657. $data[$place] = [];
  1658. }
  1659. $room = $v->ex_room == null ? 'empty' : $v->ex_room;
  1660. if(!array_key_exists($room,$data[$place])){
  1661. $data[$place][$room] = [];
  1662. }
  1663. $item = [
  1664. 'avatar' => $v->avatar,
  1665. 'seat' => $v->ex_seat,
  1666. 'realname' => $v->realname
  1667. ];
  1668. array_push($data[$place][$room],$item);
  1669. }
  1670. return $content->body(view('admin.recruit.sign_table')->with(['data' => $data]));
  1671. }
  1672. }