SpecialController.php 81 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674
  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_arr = explode(',',$log->log);
  1563. $item[] = $log_arr[0];
  1564. $item[] = $log_arr[1];
  1565. } else {
  1566. $item[] = '';
  1567. $item[] = '';
  1568. }
  1569. break;
  1570. default:
  1571. $item[] = '';
  1572. $item[] = '';
  1573. break;
  1574. }
  1575. if(empty($v->word_url)){
  1576. $item[] = "暂无";
  1577. }else{
  1578. $item[] = "https://www.jucai.gov.cn/" . $v->word_url;
  1579. }
  1580. array_push($data,$item);
  1581. }
  1582. foreach($data as $k => $v){
  1583. for ($i = 0;$i<count($v);$i++){
  1584. if($i == 18 || $i == 19 || $i == 22){
  1585. $sheet->setCellValueExplicitByColumnAndRow($i+1, $row, $v[$i], DataType::TYPE_STRING);
  1586. }else{
  1587. $sheet->setCellValueByColumnAndRow($i+1, $row, $v[$i]);
  1588. }
  1589. }
  1590. $row++;
  1591. }
  1592. $file_name = $recruit->name . date("Y-m-d",time());
  1593. header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  1594. header('Content-Disposition: attachment;filename="'.$file_name.'.xlsx"');
  1595. header('Cache-Control: max-age=0');
  1596. // If you're serving to IE 9, then the following may be needed
  1597. header('Cache-Control: max-age=1');
  1598. // If you're serving to IE over SSL, then the following may be needed
  1599. header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
  1600. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
  1601. header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
  1602. header('Pragma: public'); // HTTP/1.0
  1603. $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
  1604. $writer->save('php://output');
  1605. }else{
  1606. return response()->json(['status' => 0, 'msg' => '没有搜索到相关人员'], 200);
  1607. }
  1608. }
  1609. }