SpecialController.php 83 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742
  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. dd($data);
  961. $html = view('admin.recruit.manageajax_userinfo')->with(['appointinfo' => $data,'recruit' => $recruit,'photos'=>$photos])->render();
  962. return response()->json(['code' => 1, 'data' => $html]);
  963. }
  964. /**
  965. * 获得招考场次的岗位
  966. * @param Request $request
  967. * @return \Illuminate\Http\JsonResponse
  968. */
  969. public function getRecruitPost(Request $request)
  970. {
  971. //Permission::check('special_recruit_manager_create');
  972. //Permission::check('special_recruit_manager_edit');
  973. $id = $request->id;
  974. $recruit = Recruit::find($id);
  975. $post = RecruitPost::where('recruit_id', $id)->get();
  976. return response()->json(['post' => $post, 'recruit' => $recruit], '200');
  977. }
  978. /**
  979. * 报名记录审核处理
  980. * @param Request $request
  981. * @return \Illuminate\Http\JsonResponse
  982. */
  983. public function appoint_audit(Request $request)
  984. {
  985. $ids = $request->ids;
  986. if (!is_array($ids)) {
  987. $ids = explode(",", $ids);
  988. }
  989. if (empty($ids)) {
  990. return response()->json(['status' => 0, 'msg' => '请选择审核记录!'], '200');
  991. }
  992. $audit = $request->audit;
  993. $exam_flow_path = $request->exam_flow_path;
  994. $reason = $request->reason;
  995. if(empty($audit)){
  996. return response()->json(['status' => 0, 'msg' => '请选择审核状态!'], '200');
  997. }
  998. if($audit == '3' && empty($exam_flow_path)){
  999. return response()->json(['status' => 0, 'msg' => '请选择审核后的考试流程!'], '200');
  1000. }
  1001. if($audit != '3' && empty($reason)){
  1002. return response()->json(['status' => 0, 'msg' => '请输入审核原因!'], '200');
  1003. }
  1004. $message = [];
  1005. switch ($audit){
  1006. case '1':
  1007. //撤回至未审核
  1008. foreach ($ids as $k => $v){
  1009. $appointinfo = RecruitAppointInfo::where('id', $v)->first();
  1010. $recruit = Recruit::find($appointinfo->recruit_id);
  1011. if(!$recruit->special){
  1012. continue;
  1013. }
  1014. if(!$appointinfo || intval($appointinfo->audit) === 1){
  1015. continue;
  1016. }
  1017. //设置该报名的各个状态
  1018. $appointinfo_data = [
  1019. 'current' => 1,
  1020. 'audit' => 1,
  1021. 'pen_audit' => -1,
  1022. 'computer_audit' => -1,
  1023. 'face_audit' => -1,
  1024. 'reexamine_audit' => -1,
  1025. 'inspect_audit' => -1,
  1026. 'political_audit' => -1,
  1027. 'employ_audit' => -1
  1028. ];
  1029. RecruitAppointInfo::where('id', $v)->update($appointinfo_data);
  1030. //写日志
  1031. $log = [
  1032. 'type' => 2,
  1033. 'step' => 1,
  1034. 'appoint_id' => $v,
  1035. 'uid' => Admin::user()->id,
  1036. 'log' => '撤回至未审核状态,原因是:'.$reason
  1037. ];
  1038. RecruitAppointLog::create($log);
  1039. $message[$v] = '您此次的报名需要重新审核,原因是:'.$reason;
  1040. }
  1041. break;
  1042. case '2':
  1043. //审核未通过
  1044. foreach ($ids as $k => $v){
  1045. $appointinfo = RecruitAppointInfo::where('id', $v)->first();
  1046. $recruit = Recruit::find($appointinfo->recruit_id);
  1047. if(!$recruit->special){
  1048. continue;
  1049. }
  1050. if(!$appointinfo || intval($appointinfo->audit) === 2){
  1051. continue;
  1052. }
  1053. //设置该报名的各个状态
  1054. $appointinfo_data = [
  1055. 'current' => 1,
  1056. 'audit' => 2,
  1057. 'pen_audit' => -1,
  1058. 'computer_audit' => -1,
  1059. 'face_audit' => -1,
  1060. 'reexamine_audit' => -1,
  1061. 'inspect_audit' => -1,
  1062. 'political_audit' => -1,
  1063. 'employ_audit' => -1
  1064. ];
  1065. RecruitAppointInfo::where('id', $v)->update($appointinfo_data);
  1066. //写日志
  1067. $log = [
  1068. 'type' => 2,
  1069. 'step' => 1,
  1070. 'appoint_id' => $v,
  1071. 'uid' => Admin::user()->id,
  1072. 'log' => '审核未通过,原因是:'.$reason
  1073. ];
  1074. RecruitAppointLog::create($log);
  1075. $message[$v] = '您此次报名审核未通过,原因是:'.$reason;
  1076. $this->smsService->sendSms($appointinfo->mobile,'sms_recruit_register_error',array('reason'=>$reason));
  1077. }
  1078. break;
  1079. case '3':
  1080. //审核通过
  1081. foreach ($ids as $k => $v){
  1082. $appointinfo = RecruitAppointInfo::where('id', $v)->first();
  1083. $recruit = Recruit::find($appointinfo->recruit_id);
  1084. if(!$recruit->special){
  1085. continue;
  1086. }
  1087. if(!$appointinfo || intval($appointinfo->audit) === 3){
  1088. continue;
  1089. }
  1090. $recruit = Recruit::where('id',$appointinfo->recruit_id)->first();
  1091. $step = explode(',',$recruit->step);
  1092. $step_str = [
  1093. 'pen' => '未设置此条报名记录的笔试信息',
  1094. ];
  1095. if(in_array('3',$step)){
  1096. //场次有设置笔试
  1097. if(in_array('pen',$exam_flow_path)){
  1098. $step_str['pen'] = '该场次需要笔试,已设置此条报考需要参与笔试';
  1099. $pen_audit = -1;
  1100. }else{
  1101. $step_str['pen'] = '该场次需要笔试,此条报考可跳过笔试';
  1102. $pen_audit = 3;
  1103. }
  1104. }else{
  1105. $step_str['pen'] = '该场次不需要笔试';
  1106. $pen_audit = 3;
  1107. }
  1108. if(in_array('4',$step)){
  1109. //场次有设置上机
  1110. if(in_array('computer',$exam_flow_path)){
  1111. $step_str['computer'] = '该场次需要上机,已设置此条报考需要参与上机';
  1112. $computer_audit = -1;
  1113. }else{
  1114. $step_str['computer'] = '该场次需要上机,此条报考可跳过上机';
  1115. $computer_audit = 3;
  1116. }
  1117. }else{
  1118. $step_str['computer'] = '该场次不需要上机';
  1119. $computer_audit = 3;
  1120. }
  1121. if(in_array('5',$step)){
  1122. //场次有设置上机
  1123. if(in_array('face',$exam_flow_path)){
  1124. $step_str['face'] = '该场次需要面试,已设置此条报考需要参与面试';
  1125. $face_audit = -1;
  1126. }else{
  1127. $step_str['face'] = '该场次需要面试,此条报考可跳过面试';
  1128. $face_audit = 3;
  1129. }
  1130. }else{
  1131. $step_str['face'] = '该场次不需要面试';
  1132. $face_audit = 3;
  1133. }
  1134. if(in_array('6',$step)){
  1135. //场次有设置复试
  1136. if(in_array('reexamine',$exam_flow_path)){
  1137. $step_str['reexamine'] = '该场次需要复试,已设置此条报考需要参与复试';
  1138. $reexamine_audit = -1;
  1139. }else{
  1140. $step_str['reexamine'] = '该场次需要复试,此条报考可跳过复试';
  1141. $reexamine_audit = 3;
  1142. }
  1143. }else{
  1144. $step_str['reexamine'] = '该场次不需要复试';
  1145. $reexamine_audit = 3;
  1146. }
  1147. //设置该报名的各个状态
  1148. $appointinfo_data = [
  1149. 'current' => 2,//审核成功后进入考试流程
  1150. 'audit' => 3,
  1151. 'pen_audit' => $pen_audit,
  1152. 'computer_audit' => $computer_audit,
  1153. 'face_audit' => $face_audit,
  1154. 'reexamine_audit' => $reexamine_audit,
  1155. 'inspect_audit' => -1,
  1156. 'political_audit' => -1,
  1157. 'employ_audit' => -1
  1158. ];
  1159. RecruitAppointInfo::where('id', $v)->update($appointinfo_data);
  1160. $reason = $reason ?? '符合报考条件';
  1161. //写日志
  1162. $log = [
  1163. 'type' => 2,
  1164. 'step' => 1,
  1165. 'appoint_id' => $v,
  1166. 'uid' => Admin::user()->id,
  1167. 'log' => '审核通过,原因是:' . $reason,
  1168. 'admin_log' => implode(';',$step_str)
  1169. ];
  1170. RecruitAppointLog::create($log);
  1171. $message[$v] = '您此次报名审核已通过,原因是:' . $reason;
  1172. $this->smsService->sendSms($appointinfo->mobile,'sms_recruit_register_success',array('reason'=>$reason));
  1173. $this->fetch_word(['recruit_id'=>$appointinfo->recruit_id,'appoint_id'=>$appointinfo->id]);
  1174. }
  1175. break;
  1176. }
  1177. //站内信
  1178. foreach ($ids as $key => $val) {
  1179. if(array_key_exists($val,$message)){
  1180. $user_info = Member::where('id', $appointinfo->uid)->first();
  1181. Pms::write_pmsnotice($user_info->id, $user_info->username, $message[$val]);
  1182. }else{
  1183. continue;
  1184. }
  1185. }
  1186. return response()->json(['status' => 1, 'msg' => '操作成功!', 'data' => 'ok']);
  1187. }
  1188. /**
  1189. * 第一阶段(报名审核)
  1190. * @param Request $request
  1191. * @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response|mixed|\Psr\Container\ContainerInterface|\Symfony\Component\HttpFoundation\Response|\think\Response
  1192. * @throws \Throwable
  1193. */
  1194. public function ajax_audit(Request $request)
  1195. {
  1196. Permission::check('special_recruit_ajax_audit');
  1197. $ids = $request->ids;
  1198. $view_data['ids'] = $ids;
  1199. return response(['data' => view('admin.special.ajax_audit')->with($view_data)->render(), 'status' => 1], '200');
  1200. }
  1201. /**
  1202. * 导出excel汇总表
  1203. * @param Content $content
  1204. * @param Request $request
  1205. * @return \Illuminate\Http\JsonResponse
  1206. * @throws \PhpOffice\PhpSpreadsheet\Exception
  1207. * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
  1208. */
  1209. public function out_excel(Content $content, Request $request)
  1210. {
  1211. Permission::check('special_recruit_out_excel');
  1212. $id = $request->id;
  1213. $recruit = Recruit::find($id);
  1214. if(!$recruit->special){
  1215. $this->show();
  1216. }
  1217. if (empty($recruit)) {
  1218. return response()->json(['status' => 0, 'msg' => '找不到对应的招考场次'], 200);
  1219. }
  1220. $data = $request->all();
  1221. $where = [];
  1222. $where[] = ['audit','>',0];
  1223. $where[] = ['recruit_appoint_info.recruit_id', '=', $data['id']];
  1224. $param = parse_url($data['where']);
  1225. parse_str($param['query'],$param);
  1226. if (is_array($param)) {
  1227. unset($param['id']);
  1228. foreach ($param as $k => $v) {
  1229. if ($k == 'realname') {
  1230. $where[] = [$k, 'like', "%$v%"];
  1231. } elseif ($k == 'id') {
  1232. $where[] = ['recruit_appoint_info.recruit_id', '=', $v];
  1233. } elseif($k == 'print_bs'){
  1234. $where[] = ['recruit_ticket.ex_type', '=', 1];
  1235. $where[] = ['recruit_ticket.ex_status', '=', $v];
  1236. } elseif($k == 'print_js'){
  1237. $where[] = ['recruit_ticket.ex_type', '=', 2];
  1238. $where[] = ['recruit_ticket.ex_status', '=', $v];
  1239. } elseif($k == 'print_ms'){
  1240. $where[] = ['recruit_ticket.ex_type', '=', 3];
  1241. $where[] = ['recruit_ticket.ex_status', '=', $v];
  1242. } elseif ($k != '_pjax' and $k != 'page' && $k != 'perpage') {
  1243. $where[] = [$k, '=', $v];
  1244. }
  1245. }
  1246. }
  1247. $select = ['recruit_appoint_info.*', 'recruit_post.code', 'recruit_post.name'];
  1248. $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');
  1249. if(in_array('expand_special',explode(',', $recruit->forms))){
  1250. $model->join('recruit_appoint_expand_special', 'recruit_appoint_expand_special.recruit_appoint_id', '=', 'recruit_appoint_info.id', 'left');
  1251. $special_select = ['recruit_appoint_expand_special.point_apply','recruit_appoint_expand_special.condition','recruit_appoint_expand_special.material'];
  1252. $select = array_merge($select,$special_select);
  1253. }
  1254. if(in_array('detail',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1255. $model->join('recruit_appoint_detail', 'recruit_appoint_detail.recruit_appoint_id', '=', 'recruit_appoint_info.id', 'left');
  1256. $detail_select = ['recruit_appoint_detail.train','recruit_appoint_detail.rewards_and_punishments','recruit_appoint_detail.introduce'];
  1257. $select = array_merge($select,$detail_select);
  1258. }
  1259. $list = $model->select($select)
  1260. ->orderBy('recruit_appoint_info.updated_at','desc')
  1261. ->get();
  1262. if(count($list)){
  1263. $spreadsheet = new Spreadsheet();
  1264. $sheet = $spreadsheet->getActiveSheet();
  1265. if(in_array('internship',explode(',', $recruit->forms))){
  1266. $header = ['姓名','性别','生日','头像','民族','籍贯','报名岗位','政治面貌','入党时间','户籍所在地','年级','就读院校','所学专业','是否接受调剂','通信地址','身份证号码','联系电话','电子邮箱','紧急联系人','紧急联系电话'];
  1267. }else{
  1268. $header = ['姓名','性别','生日','头像','民族','籍贯','报考岗位','政治面貌','入党时间','职称或职业资格','现工作单位及职务','户籍所在地','学历','学校','学位','所学专业','通信地址','身份证号码','联系电话','电子邮箱','紧急联系人','紧急联系电话'];
  1269. }
  1270. if(in_array('expand_special',explode(',', $recruit->forms))){
  1271. $special = ['是否申请加分','符合哪一项加分条件','加分佐证材料'];
  1272. $header = array_merge($header,$special);
  1273. }
  1274. if(in_array('detail',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1275. $detail = ['个人简历','培训学习经历','奖惩情况','个人介绍'];
  1276. }else{
  1277. $detail = ['个人简历'];
  1278. }
  1279. $header = array_merge($header,$detail);
  1280. $header[] = '家庭成员及其社会关系';
  1281. if(in_array('identification',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1282. $header[] = '身份证明';
  1283. }
  1284. if(in_array('education_certification',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1285. $header[] = '学历证明';
  1286. }
  1287. if(in_array('other_certification',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1288. $header[] = '其他证明';
  1289. }
  1290. if(in_array('chengnuoshu',explode(',', $recruit->forms))){
  1291. $header[] = '诚信承诺书';
  1292. }
  1293. if(in_array('shixin',explode(',', $recruit->forms))){
  1294. $header[] = '失信被执行人查询信息页扫描件';
  1295. }
  1296. $header[] = '审核状态';
  1297. $header[] = '审核意见';
  1298. // if(in_array('3',explode(',', $recruit->step))){
  1299. // $header = array_merge($header,['笔试准考证打印','笔试审核状态','笔试结果']);
  1300. // }
  1301. // if(in_array('4',explode(',', $recruit->step))){
  1302. // $header = array_merge($header,['上机准考证打印','上机审核状态','上机结果']);
  1303. // }
  1304. // if(in_array('5',explode(',', $recruit->step))){
  1305. // $header = array_merge($header,['面试准考证打印','面试审核状态','面试结果']);
  1306. // }
  1307. // if(in_array('6',explode(',', $recruit->step))){
  1308. // $header = array_merge($header,['复试准考证打印','复试审核状态','复试结果']);
  1309. // }
  1310. // if(in_array('7',explode(',', $recruit->step))){
  1311. // $header = array_merge($header,['体检审核状态','体检结果']);
  1312. // }
  1313. // if(in_array('8',explode(',', $recruit->step))){
  1314. // $header = array_merge($header,['政审状态','政审结果']);
  1315. // }
  1316. $header[] = 'word简历的下载地址';
  1317. foreach ($header as $key => $value) {
  1318. $sheet->setCellValueByColumnAndRow($key+1, 1, $value);
  1319. }
  1320. $row = 2;
  1321. $sheet->getStyle('S')->getNumberFormat()->setFormatCode('0');
  1322. $length = count($list);//算出该数组的长度
  1323. $last = $list[$length-1];//取出最后一个数组的值,复制给新变量,-1是因为第一个数组元素下表为0
  1324. unset($list[$length-1]);//将最后一个数组注销
  1325. $list[] = $last;//再将新变量加入到数组里
  1326. $data = [];
  1327. foreach ($list as $k => $v) {
  1328. switch ($v->political_affiliation) {
  1329. case '01':
  1330. $political_affiliation = '中共党员';
  1331. break;
  1332. case '02':
  1333. $political_affiliation = '中共预备党员';
  1334. break;
  1335. case '03':
  1336. $political_affiliation = '共青团员';
  1337. break;
  1338. case '04':
  1339. $political_affiliation = '民革党员';
  1340. break;
  1341. case '05':
  1342. $political_affiliation = '民盟盟员';
  1343. break;
  1344. case '06':
  1345. $political_affiliation = '民建会员';
  1346. break;
  1347. case '07':
  1348. $political_affiliation = '民进会员';
  1349. break;
  1350. case '08':
  1351. $political_affiliation = '农工党党员';
  1352. break;
  1353. case '09':
  1354. $political_affiliation = '致公党党员';
  1355. break;
  1356. case '10':
  1357. $political_affiliation = '九三学社社员';
  1358. break;
  1359. case '11':
  1360. $political_affiliation = '台盟盟员';
  1361. break;
  1362. case '12':
  1363. $political_affiliation = '无党派人士';
  1364. break;
  1365. case '13':
  1366. $political_affiliation = '群众';
  1367. break;
  1368. default:
  1369. $political_affiliation = '未知';
  1370. break;
  1371. }
  1372. if(in_array('internship',explode(',', $recruit->forms))){
  1373. $header = ['姓名','性别','生日','头像','民族','籍贯','报名岗位','政治面貌','入党时间','户籍所在地','年级','就读院校','所学专业','是否接受调剂','通信地址','身份证号码','联系电话','电子邮箱','紧急联系人','紧急联系电话'];
  1374. $item = [
  1375. $v->realname,
  1376. $v->sex == 0 ? '女' : '男',
  1377. $v->birthday,
  1378. "https://www.jucai.gov.cn" . $v->avatar,
  1379. $v->nation,
  1380. $v->native_place,
  1381. $v->code . $v->name,
  1382. $political_affiliation,
  1383. $v->join_time,
  1384. $v->house_register,
  1385. $v->education,
  1386. $v->school,
  1387. $v->pro,
  1388. $v->adjust == 0 ? '否' : '是',
  1389. $v->address,
  1390. '\''.$v->card,
  1391. $v->mobile,
  1392. $v->email,
  1393. $v->concat_name,
  1394. $v->concat_mobile
  1395. ];
  1396. }else{
  1397. $item = [
  1398. $v->realname,
  1399. $v->sex == 0 ? '女' : '男',
  1400. $v->birthday,
  1401. "https://www.jucai.gov.cn" . $v->avatar,
  1402. $v->nation,
  1403. $v->native_place,
  1404. $v->code . $v->name,
  1405. $political_affiliation,
  1406. $v->join_time,
  1407. $v->titles,
  1408. $v->work,
  1409. $v->house_register,
  1410. $v->education,
  1411. $v->school,
  1412. $v->degree,
  1413. $v->pro,
  1414. $v->address,
  1415. '\''.$v->card,
  1416. $v->mobile,
  1417. $v->email,
  1418. $v->concat_name,
  1419. $v->concat_mobile
  1420. ];
  1421. }
  1422. if (in_array('expand_special', explode(',', $recruit->forms))) {
  1423. $material = json_decode($v->material, true);
  1424. $materials = [];
  1425. if($material){
  1426. foreach ($material as $key => $value) {
  1427. array_push($materials, "https://www.jucai.gov.cn" . $value['response']['path']);
  1428. }
  1429. }
  1430. $special = [
  1431. $v->point_apply == 0 ? '否' : '是',
  1432. $v->condition,
  1433. implode("\r\n", $materials)
  1434. ];
  1435. $item = array_merge($item, $special);
  1436. }
  1437. if (in_array('detail', explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))) {
  1438. $detail = [
  1439. $v->resume,
  1440. $v->train,
  1441. $v->rewards_and_punishments,
  1442. $v->introduce
  1443. ];
  1444. } else {
  1445. $detail = [$v->resume];
  1446. }
  1447. $item = array_merge($item, $detail);
  1448. $family = json_decode($v->family, true);
  1449. $familys = [];
  1450. foreach ($family as $val){
  1451. switch ($val['political_affiliation']) {
  1452. case '01':
  1453. $political_affiliation = '中共党员';
  1454. break;
  1455. case '02':
  1456. $political_affiliation = '中共预备党员';
  1457. break;
  1458. case '03':
  1459. $political_affiliation = '共青团员';
  1460. break;
  1461. case '04':
  1462. $political_affiliation = '民革党员';
  1463. break;
  1464. case '05':
  1465. $political_affiliation = '民盟盟员';
  1466. break;
  1467. case '06':
  1468. $political_affiliation = '民建会员';
  1469. break;
  1470. case '07':
  1471. $political_affiliation = '民进会员';
  1472. break;
  1473. case '08':
  1474. $political_affiliation = '农工党党员';
  1475. break;
  1476. case '09':
  1477. $political_affiliation = '致公党党员';
  1478. break;
  1479. case '10':
  1480. $political_affiliation = '九三学社社员';
  1481. break;
  1482. case '11':
  1483. $political_affiliation = '台盟盟员';
  1484. break;
  1485. case '12':
  1486. $political_affiliation = '无党派人士';
  1487. break;
  1488. case '13':
  1489. $political_affiliation = '群众';
  1490. break;
  1491. default:
  1492. $political_affiliation = '未知';
  1493. break;
  1494. }
  1495. $familys[] = "称谓:" . $val['relation'] . ";姓名:".$val['realname'] . ';生日:'.$val['birthday'].';政治面貌:'.$political_affiliation.';职业:'.$val['work'];
  1496. }
  1497. $item[] = implode("\r\n", $familys);
  1498. if (in_array('identification', explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))) {
  1499. $identification = json_decode($v->identification, true);
  1500. $identifications = [];
  1501. foreach ($identification as $val){
  1502. if(array_key_exists('path', $val['response'])){
  1503. array_push($identifications,"https://www.jucai.gov.cn" . $val['response']['path']);
  1504. }
  1505. }
  1506. array_push($item, implode("\r\n", $identifications));
  1507. }
  1508. if (in_array('education_certification', explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))) {
  1509. $education_certification = json_decode($v->education_certification, true);
  1510. $education_certifications = [];
  1511. foreach ($education_certification as $val){
  1512. if(array_key_exists('path', $val['response'])){
  1513. array_push($education_certifications,"https://www.jucai.gov.cn" . $val['response']['path']);
  1514. }
  1515. }
  1516. array_push($item, implode("\r\n", $education_certifications));
  1517. }
  1518. if (in_array('other_certification', explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))) {
  1519. $other_certification = json_decode($v->other_certification, true);
  1520. $other_certifications = [];
  1521. if($other_certification){
  1522. foreach ($other_certification as $val){
  1523. if(array_key_exists('path', $val['response'])){
  1524. array_push($other_certifications,"https://www.jucai.gov.cn" . $val['response']['path']);
  1525. }
  1526. }
  1527. }
  1528. array_push($item, implode("\r\n", $other_certifications));
  1529. }
  1530. if (in_array('chengnuoshu', explode(',', $recruit->forms))) {
  1531. $chengnuoshu = json_decode($v->chengnuoshu, true);
  1532. $chengnuoshu = [];
  1533. if($chengnuoshu){
  1534. foreach ($chengnuoshu as $val){
  1535. if(array_key_exists('path', $val['response'])){
  1536. array_push($chengnuoshu,"https://www.jucai.gov.cn" . $val['response']['path']);
  1537. }
  1538. }
  1539. }
  1540. array_push($item, implode("\r\n", $chengnuoshu));
  1541. }
  1542. if (in_array('shixin', explode(',', $recruit->forms))) {
  1543. $shixin = json_decode($v->shixin, true);
  1544. $shixin = [];
  1545. if($shixin){
  1546. foreach ($shixin as $val){
  1547. if(array_key_exists('path', $val['response'])){
  1548. array_push($shixin,"https://www.jucai.gov.cn" . $val['response']['path']);
  1549. }
  1550. }
  1551. }
  1552. array_push($item, implode("\r\n", $shixin));
  1553. }
  1554. switch (intval($v->audit)){
  1555. case 1:
  1556. $item[] = '审核中';
  1557. $item[] = '';
  1558. break;
  1559. case 2:
  1560. case 3:
  1561. $log = RecruitAppointLog::where('appoint_id', $v->id)->where('step', 1)->where('type', 2)->orderBy('created_at', 'desc')->first();
  1562. if ($log) {
  1563. $log_split = explode(':',$log->log);
  1564. $log_status = explode(',',$log_split[0]);
  1565. $item[] = $log_status[0];
  1566. $item[] = $log_split[1];
  1567. } else {
  1568. $item[] = '';
  1569. $item[] = '';
  1570. }
  1571. break;
  1572. default:
  1573. $item[] = '';
  1574. $item[] = '';
  1575. break;
  1576. }
  1577. if(empty($v->word_url)){
  1578. $item[] = "暂无";
  1579. }else{
  1580. $item[] = "https://www.jucai.gov.cn/" . $v->word_url;
  1581. }
  1582. array_push($data,$item);
  1583. }
  1584. foreach($data as $k => $v){
  1585. for ($i = 0;$i<count($v);$i++){
  1586. if($i == 18 || $i == 19 || $i == 22){
  1587. $sheet->setCellValueExplicitByColumnAndRow($i+1, $row, $v[$i], DataType::TYPE_STRING);
  1588. }else{
  1589. $sheet->setCellValueByColumnAndRow($i+1, $row, $v[$i]);
  1590. }
  1591. }
  1592. $row++;
  1593. }
  1594. $file_name = $recruit->name . date("Y-m-d",time());
  1595. header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  1596. header('Content-Disposition: attachment;filename="'.$file_name.'.xlsx"');
  1597. header('Cache-Control: max-age=0');
  1598. // If you're serving to IE 9, then the following may be needed
  1599. header('Cache-Control: max-age=1');
  1600. // If you're serving to IE over SSL, then the following may be needed
  1601. header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
  1602. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
  1603. header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
  1604. header('Pragma: public'); // HTTP/1.0
  1605. $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
  1606. $writer->save('php://output');
  1607. }else{
  1608. return response()->json(['status' => 0, 'msg' => '没有搜索到相关人员'], 200);
  1609. }
  1610. }
  1611. /**
  1612. * 座位贴
  1613. * @param Content $content
  1614. * @param Request $request
  1615. * @return Content
  1616. */
  1617. public function seat_sticker(Content $content, Request $request){
  1618. $recruit_id = $request->id;
  1619. $list = RecruitAppointInfo::where(['recruit_appoint_info.recruit_id' => $recruit_id,'recruit_appoint_info.audit' => 3, 'recruit_ticket.ex_type' => 1])
  1620. ->join('recruit_ticket', 'recruit_ticket.appoint_id', '=', 'recruit_appoint_info.id','left')
  1621. ->select('recruit_appoint_info.*','recruit_ticket.*')
  1622. ->orderBy('recruit_ticket.ex_room','asc')
  1623. ->orderByRaw('recruit_ticket.ex_seat+0 asc')
  1624. ->get();
  1625. $data = [];
  1626. foreach ($list as $k => $v){
  1627. $place = $v->ex_place == null ? 'empty' : $v->ex_place;
  1628. if(!array_key_exists($place,$data)){
  1629. $data[$place] = [];
  1630. }
  1631. $room = $v->ex_room == null ? 'empty' : $v->ex_room;
  1632. if(!array_key_exists($room,$data[$place])){
  1633. $data[$place][$room] = [];
  1634. }
  1635. $item = [
  1636. 'avatar' => $v->avatar,
  1637. 'seat' => $v->ex_seat,
  1638. 'realname' => $v->realname,
  1639. 'number' => $v->ex_number
  1640. ];
  1641. array_push($data[$place][$room],$item);
  1642. }
  1643. //dd($data);
  1644. return $content->body(view('admin.recruit.seat_sticker')->with(['data' => $data]));
  1645. }
  1646. public function sign_table(Content $content, Request $request){
  1647. $recruit_id = $request->id;
  1648. $list = RecruitAppointInfo::where(['recruit_appoint_info.recruit_id' => $recruit_id,'recruit_appoint_info.audit' => 3, 'recruit_ticket.ex_type' => 1])
  1649. ->join('recruit_ticket', 'recruit_ticket.appoint_id', '=', 'recruit_appoint_info.id','left')
  1650. ->select('recruit_appoint_info.*','recruit_ticket.*')
  1651. ->orderBy('recruit_ticket.ex_room','asc')
  1652. ->orderByRaw('recruit_ticket.ex_seat+0 asc')
  1653. ->get();
  1654. $data = [];
  1655. foreach ($list as $k => $v){
  1656. $place = $v->ex_place == null ? '' : $v->ex_place;
  1657. if(!array_key_exists($place,$data)){
  1658. $data[$place] = [];
  1659. }
  1660. $room = $v->ex_room == null ? '' : $v->ex_room;
  1661. if(!array_key_exists($room,$data[$place])){
  1662. $data[$place][$room] = [];
  1663. }
  1664. $item = [
  1665. 'avatar' => $v->avatar,
  1666. 'seat' => $v->ex_seat,
  1667. 'realname' => $v->realname
  1668. ];
  1669. array_push($data[$place][$room],$item);
  1670. }
  1671. return $content->body(view('admin.recruit.sign_table')->with(['data' => $data]));
  1672. }
  1673. }