RecruitController.php 125 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617
  1. <?php
  2. namespace App\Admin\Controllers\Recruit;
  3. use App\Http\Controllers\Controller;
  4. use App\Admin\Extensions\Form\ValidateForm;
  5. use App\Models\Member;
  6. use App\Models\Pms;
  7. use App\Models\Recruit;
  8. use App\Models\RecruitAppointDetail;
  9. use App\Models\RecruitAppointExpandSpecial;
  10. use App\Models\RecruitPost;
  11. use App\Models\RecruitAppointInfo;
  12. use App\Models\RecruitSubjoin;
  13. use App\Models\RecruitAppointLog;
  14. use App\Models\RecruitTicketField;
  15. use App\Models\RecruitSupplement;
  16. use dir\Dir;
  17. use Encore\Admin\Grid;
  18. use Encore\Admin\Form;
  19. use Encore\Admin\Show;
  20. use Encore\Admin\Layout\Content;
  21. use Encore\Admin\Facades\Admin;
  22. use Encore\Admin\Auth\Permission;
  23. use Illuminate\Http\Request;
  24. use Illuminate\Support\Facades\DB;
  25. use Illuminate\Support\Facades\Storage;
  26. use App\Models\Admin\AdminUser;
  27. use PhpOffice\PhpWord\TemplateProcessor;
  28. use Chumper\Zipper\Zipper;
  29. use App\Models\RecruitTicket;
  30. use App\Services\Common\SmsService;
  31. use PhpOffice\PhpSpreadsheet\Spreadsheet;
  32. use PhpOffice\PhpSpreadsheet\IOFactory;
  33. use PhpOffice\PhpSpreadsheet\Cell\DataType;
  34. use PhpOffice\PhpWord\IOFactory as WordIOFactory;
  35. use PhpOffice\PhpWord\Settings;
  36. use App\Jobs\TicketJob;
  37. class RecruitController extends Controller
  38. {
  39. private $smsService;
  40. public function __construct(SmsService $smsService)
  41. {
  42. $this->smsService = $smsService;
  43. }
  44. /**
  45. * 招考报名首页
  46. * @param Content $content
  47. * @return Content
  48. */
  49. public function index(Content $content)
  50. {
  51. return $content
  52. ->header('招考报名管理')
  53. ->description('')
  54. ->body($this->grid());
  55. }
  56. /**
  57. * 新增招考报名表单页.
  58. *
  59. * @param Content $content
  60. * @return Content
  61. */
  62. public function create(Content $content)
  63. {
  64. Permission::check('recruit_manager_create');
  65. return $content
  66. ->header('新增招聘场次')
  67. ->description('新增')
  68. ->body(view('admin.recruit.index')->with(['grid' => $this->form()->render(), 'id' => '0']));
  69. }
  70. /**
  71. * Edit interface.
  72. *
  73. * @param mixed $id
  74. * @param Content $content
  75. * @return Content
  76. */
  77. public function edit($id, Content $content)
  78. {
  79. Permission::check('recruit_manager_edit');
  80. $grid = $this->form()->edit($id)->render();
  81. return $content
  82. ->header('招考管理')
  83. ->description('编辑')
  84. ->body(view('admin.recruit.index')->with(['grid' => $grid, 'id' => $id]));
  85. }
  86. /**
  87. * Show interface.
  88. *
  89. * @param mixed $id
  90. * @param Content $content
  91. * @return Content
  92. */
  93. public function show($id, Content $content)
  94. {
  95. return redirect('/ST3IXxKlOa4eGEv0eTw0CfORI9444Mgj/recruit/index');
  96. }
  97. public function detail($id)
  98. {
  99. $show = new Show(Recruit::findOrFail($id));
  100. // $recruit = Recruit::findOrFail($id);
  101. $show->title('标题');
  102. $show->created_at('创建时间');
  103. return $show;
  104. }
  105. /**
  106. * 获得招考场次的岗位
  107. * @param Request $request
  108. * @return \Illuminate\Http\JsonResponse
  109. */
  110. public function getRecruitPost(Request $request)
  111. {
  112. $id = $request->id;
  113. $recruit = Recruit::find($id);
  114. $post = RecruitPost::where('recruit_id', $id)->get();
  115. return response()->json(['post' => $post, 'recruit' => $recruit], '200');
  116. }
  117. /**
  118. * Make a grid builder.
  119. *
  120. * @return Grid
  121. */
  122. protected function grid()
  123. {
  124. $grid = new Grid(new Recruit);
  125. $grid->model()->orderBy('created_at', 'DESC');
  126. $grid->model()->paginate(20);
  127. if (Admin::user()->can('recruit_manager_create')) {
  128. $grid->disableCreateButton(false);
  129. }
  130. $grid->perPages([10, 20, 30, 40, 50, 100]);
  131. $grid->id('ID');
  132. $grid->name('招考场次名称');
  133. $grid->column('current','当前阶段')->display(function ($current) {
  134. switch ($current){
  135. case '1':
  136. return '报名';
  137. break;
  138. case '2':
  139. return '审核';
  140. break;
  141. case '3':
  142. return '笔试';
  143. break;
  144. case '4':
  145. return '上机测试';
  146. break;
  147. case '5':
  148. return '面试';
  149. break;
  150. case '6':
  151. return '复试';
  152. break;
  153. case '7':
  154. return '体检';
  155. break;
  156. case '8':
  157. return '政审';
  158. break;
  159. case '9':
  160. return '公示';
  161. break;
  162. case '0':
  163. return '已结束';
  164. break;
  165. }
  166. });
  167. $grid->column('status','状态')->display(function ($status) {
  168. return $status ? '显示' : '隐藏';
  169. });
  170. $grid->filter(function ($filter) {
  171. $filter->disableIdFilter();
  172. $filter->where(function ($query) {
  173. $query->where('simple', '=', "{$this->input}");
  174. }, '类型', 'simple')->radio([0 => '招考',1 => '招聘']);
  175. });
  176. $grid->created_at('创建时间');
  177. $grid->actions(function ($actions) {
  178. $actions->append('<a href="/ST3IXxKlOa4eGEv0eTw0CfORI9444Mgj/recruit/appoint_list?id=' . $actions->row['id'] . '" class="btn btn-primary btn-xs" >报名管理</a>');
  179. $actions->disableEdit(false);
  180. $actions->disableDelete(false);
  181. $actions->disableView();
  182. });
  183. return $grid;
  184. }
  185. /**
  186. * 新增/修改招考场次的表单
  187. *
  188. * @return Form
  189. */
  190. protected function form()
  191. {
  192. $form = new ValidateForm(new Recruit);
  193. $form->tab('基础信息', function ($form) {
  194. $form->text('name', '招考场次名称')->rules('required|between:4,61', [
  195. 'required' => '请填写招考场次名称',
  196. 'between' => '招考场次名称长度为2~30个字符'
  197. ])->setWidth(5)->setMustMark();
  198. $form->text('company', '招聘主体')->rules('required|between:4,61', [
  199. 'required' => '请填写招聘主体',
  200. 'between' => '招聘主体长度为2~30个字符'
  201. ])->setWidth(5)->setMustMark();
  202. $form->text('name_en', '英文标识')->setWidth(5)->help('同一个招聘单位,发布的招聘场次若不在同一天,允许一样,若为空则自动生成');
  203. $form->image('small_img', '缩略图')->uniqueName()->setWidth(3);
  204. $form->radio('simple', '类型')->options([0 => '招聘', 1 => '招考'])->default(0)->setMustMark();
  205. $form->switch('status', '状态')->default(1)->setMustMark();
  206. $form->switch('show_report', '显示报名人数')->default(0)->setMustMark();
  207. $form->radio('current', '当前进展')->options([1 => '报名', 2 => '审核', 3 => '笔试', 4 => '上机测试', 5 => '面试', 6 => '复试', 7 => '体检', 8 => '政审', 9 => '公示',0 => '已结束'])->default(1)->setMustMark();
  208. $form->checkbox('step', '招考流程')->options([1 => '报名', 2 => '审核', 3 => '笔试', 4 => '上机测试', 5 => '面试', 6 => '复试', 7 => '体检', 8 => '政审', 9 => '公示'])->default([1, 2])->setMustMark();
  209. $form->datetimeRange('apply_start', 'apply_end', '报名日期')->rules('required', array('required' => '报名日期必须设置'))->setMustMark();
  210. $form->datetimeRange('audit_start', 'audit_end', '审核日期');
  211. $form->datetimeRange('preliminary_start', 'preliminary_end', '笔试时间');
  212. $form->datetimeRange('computer_start', 'computer_end', '上机时间');
  213. $form->datetimeRange('interview_start', 'interview_end', '面试时间');
  214. $form->datetimeRange('reexamine_start', 'reexamine_end', '复试时间');
  215. $form->datetimeRange('health_start', 'health_end', '体检时间');
  216. $form->datetimeRange('political_start', 'political_end', '政审时间');
  217. $form->datetimeRange('publicity_start', 'publicity_end', '公示时间');
  218. $form->editor('introduction', '招考正文')->rules('required', array('required' => '招考正文不能为空。'))->setMustMark();
  219. $form->text('contact', '联系人');
  220. $form->text('phone', '联系电话');
  221. $form->text('host_address', '联系地址');
  222. //$form->switch('predetermined_status', '是否允许报名')->states($display_option)->default(1)->setMustMark();
  223. $form->number('ordid', '排序')->default(0);
  224. $form->multipleFile('addFile', '附件')->move('storage/app/public/recruit/' . time());
  225. })->tab('报名表单与条件', function ($form) {
  226. $form->checkbox('forms', '报名表单模块')->options(['basic' => '基础信息模块','expand_special' => '扩展模块-加分','detail' => '详情介绍模块','identification' => '身份证明上传模块','education_certification' => '学历证明上传模块','other_certification' => '其他证明上传模块', 'remark' => '备注模块','internship' => '实习专场'])->default(['basic'])->setMustMark();
  227. $form->text('limit_times', '报名次数限制')->rules('required|regex:/^\d+$/', [
  228. 'required' => '报名限制次数必须填写',
  229. 'regex' => '次数必须为数字'
  230. ])->default(1)->help('同一个场次允许同时报名几个岗位,直接输入数字即可');
  231. $form->text('post_times', '审核次数限制')->rules('required|regex:/^\d+$/', [
  232. 'required' => '审核限制次数必须填写',
  233. 'regex' => '次数必须为数字'
  234. ])->default(1)->help('允许提交审核的次数,直接输入数字即可');
  235. $form->radio('pay_switch', '缴费报名')->options([0 => '否', 1 => '是'])->default(0);
  236. })->tab('笔试', function ($form) {
  237. $form->radio('pen_ticket_type', '准考证类型')->options([-1 => '不需要',1 => '纸质', 2 => '短信'])->default(-1);
  238. $form->text('pen_ticket_content', '准考证内容')->help('当类型为纸质时,此处填入准考证模板的路径,当类型为短信时,此处填入短信标识');
  239. $form->listbox('pen_ticket_field', '模板字段')->options(RecruitTicketField::ticketFieldData('pen'))->attribute('hight', '200px')->help('仅纸质准考证需要,非ex开头的字段将自动渲染');
  240. })->tab('上机', function ($form) {
  241. $form->radio('computer_ticket_type', '准考证类型')->options([-1 => '不需要',1 => '纸质', 2 => '短信'])->default(-1);
  242. $form->text('computer_ticket_content', '准考证内容')->help('当类型为纸质时,此处填入准考证模板的路径,当类型为短信时,此处填入短信标识');
  243. $form->listbox('computer_ticket_field', '模板字段')->options(RecruitTicketField::ticketFieldData('computer'))->attribute('hight', '200px')->help('仅纸质准考证需要,非ex开头的字段将自动渲染');
  244. })->tab('面试', function ($form) {
  245. $form->radio('face_ticket_type', '准考证类型')->options([-1 => '不需要',1 => '纸质', 2 => '短信'])->default(-1);
  246. $form->text('face_ticket_content', '准考证内容')->help('当类型为纸质时,此处填入准考证模板的路径,当类型为短信时,此处填入短信标识');
  247. $form->listbox('face_ticket_field', '模板字段')->options(RecruitTicketField::ticketFieldData('face'))->attribute('hight', '200px')->help('仅纸质准考证需要,非ex开头的字段将自动渲染');
  248. })->tab('复试', function ($form) {
  249. $form->radio('reexamine_ticket_type', '准考证类型')->options([-1 => '不需要',1 => '纸质', 2 => '短信'])->default(-1);
  250. $form->text('reexamine_ticket_content', '准考证内容')->help('当类型为纸质时,此处填入准考证模板的路径,当类型为短信时,此处填入短信标识');
  251. $form->listbox('reexamine_field', '模板字段')->options(RecruitTicketField::ticketFieldData('reexamine'))->attribute('hight', '200px')->help('仅纸质准考证需要,非ex开头的字段将自动渲染');
  252. });
  253. return $form;
  254. }
  255. /**
  256. * Make a form builder.
  257. *
  258. * @return Form
  259. */
  260. public function store(Request $request)
  261. {
  262. $verify = $this->form()->getValidateInput();//这个方法会调用Form自带的验证和表单处理(文件上传等)验证错误会直接返回错误.不需要判断;
  263. $postCode = $request->input('postcode', []);
  264. $postName = $request->input('postname', []);
  265. if (count($postCode) == 0 or (count($postCode) >= 1 and $postCode[0] == null)) {
  266. return admin_toastr('请填写招考岗位', 'error');
  267. }
  268. if (count($postName) == 0 or (count($postName) >= 1 and $postName[0] == null)) {
  269. return admin_toastr('请填写招考岗位名称', 'error');
  270. }
  271. $data = [];
  272. $data['name'] = $verify['name'];
  273. $data['company'] = $verify['company'];
  274. $data['name_en'] = (array_key_exists('name_en',$verify) && !empty($verify['name_en'])) ? $verify['name_en'] : uniqid();
  275. if(array_key_exists('small_img',$verify)){
  276. $data['small_img'] = $verify['small_img'];
  277. }else{
  278. $data['small_img'] = theme_asset('app/images/index/recruit_index.jpg');
  279. }
  280. $data['status'] = $verify['status'];
  281. $data['show_report'] = $verify['show_report'];
  282. $data['current'] = $verify['current'];
  283. $data['step'] = implode(',',array_filter($verify['step']));
  284. $data['apply_start'] = $verify['apply_start'] ? $verify['apply_start'] : null;//报名时间
  285. $data['apply_end'] = $verify['apply_end'] ? $verify['apply_end'] : null;
  286. $data['audit_start'] = $verify['audit_start'] ? $verify['audit_start'] : null;//审核时间
  287. $data['audit_end'] = $verify['audit_end'] ? $verify['audit_end'] : null;
  288. $data['preliminary_start'] = $verify['preliminary_start'] ? $verify['preliminary_start'] : null;//笔试时间
  289. $data['preliminary_end'] = $verify['preliminary_end'] ? $verify['preliminary_end'] : null;
  290. $data['computer_start'] = $verify['computer_start'] ? $verify['computer_start'] : null;//上机时间
  291. $data['computer_end'] = $verify['computer_end'] ? $verify['computer_end'] : null;
  292. $data['interview_start'] = $verify['interview_start'] ? $verify['interview_start'] : null;//面试时间
  293. $data['interview_end'] = $verify['interview_end'] ? $verify['interview_end'] : null;
  294. $data['reexamine_start'] = $verify['reexamine_start'] ? $verify['reexamine_start'] : null;//复试时间
  295. $data['reexamine_end'] = $verify['reexamine_end'] ? $verify['reexamine_end'] : null;
  296. $data['health_start'] = $verify['health_start'] ? $verify['health_start'] : null;//体检时间
  297. $data['health_end'] = $verify['health_end'] ? $verify['health_end'] : null;
  298. $data['political_start'] = $verify['political_start'] ? $verify['political_start'] : null;//政审时间
  299. $data['political_end'] = $verify['political_end'] ? $verify['political_end'] : null;
  300. $data['publicity_start'] = $verify['publicity_start'] ? $verify['publicity_start'] : null;//公示时间
  301. $data['publicity_end'] = $verify['publicity_end'] ? $verify['publicity_end'] : null;
  302. $data['introduction'] = $verify['introduction'];
  303. $data['host_address'] = $verify['host_address'];
  304. $data['contact'] = $verify['contact'];
  305. $data['phone'] = $verify['phone'];
  306. $data['ordid'] = $verify['ordid'];
  307. $data['limit_times'] = $verify['limit_times'];
  308. $data['post_times'] = $verify['post_times'];
  309. $data['pay_switch'] = $verify['pay_switch'];
  310. $data['forms'] = implode(',',array_filter($verify['forms']));
  311. $data['pen_ticket_type'] = $verify['pen_ticket_type'];
  312. $data['pen_ticket_content'] = $verify['pen_ticket_content'];
  313. $data['pen_ticket_status'] = 0;
  314. $data['computer_ticket_type'] = $verify['computer_ticket_type'];
  315. $data['computer_ticket_content'] = $verify['computer_ticket_content'];
  316. $data['computer_ticket_status'] = 0;
  317. $data['computer_ticket_field'] = implode(',',$verify['computer_ticket_field']);
  318. $data['face_ticket_type'] = $verify['face_ticket_type'];
  319. $data['face_ticket_content'] = $verify['face_ticket_content'];
  320. $data['face_ticket_status'] = 0;
  321. $data['face_ticket_field'] = implode(',',$verify['face_ticket_field']);
  322. $fileCharater = $request->input('addFile');
  323. DB::beginTransaction();//检查数据库事务
  324. try {
  325. $recruit = Recruit::create($data);
  326. $recruit_id = $recruit->id;
  327. //添加招聘岗位
  328. $postcode_array = $request->postcode;
  329. $postname_array = $request->postname;
  330. $postnumber_array = $request->postnumber;
  331. $limit_array = $request->postlimit;
  332. $countnum = count($postcode_array);
  333. for ($i = 0; $i < $countnum; $i++) {
  334. $data = array();
  335. if ($postcode_array[$i] !== '' and $postname_array[$i] !== '') {
  336. $data['code'] = $postcode_array[$i];
  337. $data['name'] = $postname_array[$i];
  338. $data['number'] = $postnumber_array[$i];
  339. $data['limit'] = $limit_array[$i];
  340. $data['status'] = 1;
  341. $data['recruit_id'] = $recruit_id;
  342. RecruitPost::create($data);
  343. }
  344. }
  345. if (!empty($fileCharater)) {
  346. foreach ($fileCharater as $f => $fv) {
  347. $picpath = 'recruit/' . date('Ymd', time()) . '/';
  348. //获取文件的扩展名
  349. $ext = $fv->getClientOriginalExtension();
  350. //获取文件的绝对路径
  351. $path = $fv->getRealPath();
  352. //定义文件名
  353. $filename = time() . rand(100, 999) . '.' . $ext;
  354. //存储文件。disk里面的public。总的来说,就是调用disk模块里的public配置
  355. Storage::disk('public')->put($picpath . $filename, file_get_contents($path));
  356. $data = $picpath . $filename;
  357. $create_arr = [
  358. 'recruit_id' => $recruit_id,
  359. 'subjoin_name' => $fv->getClientOriginalName(),
  360. 'subjoin_path' => $data,
  361. 'subjoin_addtime' => time()
  362. ];
  363. RecruitSubjoin::create($create_arr);
  364. }
  365. }
  366. DB::commit();//检查数据库事务
  367. } catch (\Exception $e) {
  368. DB::rollback();
  369. return admin_toastr($e->getMessage(), 'error');
  370. }
  371. }
  372. /**
  373. * 更新报名场次信息
  374. * @param $id
  375. * @param Request $request
  376. */
  377. public function update($id, Request $request)
  378. {
  379. $verify = $this->Form()->getValidateInput();//这个方法会调用Form自带的验证和表单处理(文件上传等)验证错误会直接返回错误.不需要判断;
  380. $postCode = $request->input('postcode', []);
  381. $postName = $request->input('postname', []);
  382. if (count($postCode) == 0 or (count($postCode) >= 1 and $postCode[0] == null)) {
  383. return admin_toastr('请填写招考岗位', 'error');
  384. }
  385. if (count($postName) == 0 or (count($postName) >= 1 and $postName[0] == null)) {
  386. return admin_toastr('请填写招考岗位名称', 'error');
  387. }
  388. $recruit_id = $id;
  389. $data = [];
  390. $data['name'] = $verify['name'];
  391. $data['company'] = $verify['company'];
  392. $data['name_en'] = (array_key_exists('name_en',$verify) && !empty($verify['name_en'])) ? $verify['name_en'] : uniqid();
  393. if(array_key_exists('small_img',$verify)){
  394. $data['small_img'] = $verify['small_img'];
  395. }else{
  396. $data['small_img'] = theme_asset('app/images/index/recruit_index.jpg');
  397. }
  398. $data['status'] = $verify['status'];
  399. $data['show_report'] = $verify['show_report'];
  400. $data['current'] = $verify['current'];
  401. $data['step'] = implode(',',array_filter($verify['step']));
  402. $data['apply_start'] = $verify['apply_start'] ? $verify['apply_start'] : null;//报名时间
  403. $data['apply_end'] = $verify['apply_end'] ? $verify['apply_end'] : null;
  404. $data['audit_start'] = $verify['audit_start'] ? $verify['audit_start'] : null;//审核时间
  405. $data['audit_end'] = $verify['audit_end'] ? $verify['audit_end'] : null;
  406. $data['preliminary_start'] = $verify['preliminary_start'] ? $verify['preliminary_start'] : null;//笔试时间
  407. $data['preliminary_end'] = $verify['preliminary_end'] ? $verify['preliminary_end'] : null;
  408. $data['computer_start'] = $verify['computer_start'] ? $verify['computer_start'] : null;//上机时间
  409. $data['computer_end'] = $verify['computer_end'] ? $verify['computer_end'] : null;
  410. $data['interview_start'] = $verify['interview_start'] ? $verify['interview_start'] : null;//面试时间
  411. $data['interview_end'] = $verify['interview_end'] ? $verify['interview_end'] : null;
  412. $data['reexamine_start'] = $verify['reexamine_start'] ? $verify['reexamine_start'] : null;//复试时间
  413. $data['reexamine_end'] = $verify['reexamine_end'] ? $verify['reexamine_end'] : null;
  414. $data['health_start'] = $verify['health_start'] ? $verify['health_start'] : null;//体检时间
  415. $data['health_end'] = $verify['health_end'] ? $verify['health_end'] : null;
  416. $data['political_start'] = $verify['political_start'] ? $verify['political_start'] : null;//政审时间
  417. $data['political_end'] = $verify['political_end'] ? $verify['political_end'] : null;
  418. $data['publicity_start'] = $verify['publicity_start'] ? $verify['publicity_start'] : null;//公示时间
  419. $data['publicity_end'] = $verify['publicity_end'] ? $verify['publicity_end'] : null;
  420. $data['introduction'] = $verify['introduction'];
  421. $data['host_address'] = $verify['host_address'];
  422. $data['contact'] = $verify['contact'];
  423. $data['phone'] = $verify['phone'];
  424. $data['ordid'] = $verify['ordid'];
  425. $data['limit_times'] = $verify['limit_times'];
  426. $data['post_times'] = $verify['post_times'];
  427. $data['pay_switch'] = $verify['pay_switch'];
  428. $data['forms'] = implode(',',array_filter($verify['forms']));
  429. $data['pen_ticket_type'] = $verify['pen_ticket_type'];
  430. $data['pen_ticket_content'] = $verify['pen_ticket_content'];
  431. $data['pen_ticket_status'] = 0;
  432. $data['pen_ticket_field'] = implode(',',$verify['pen_ticket_field']);
  433. $data['computer_ticket_type'] = $verify['computer_ticket_type'];
  434. $data['computer_ticket_content'] = $verify['computer_ticket_content'];
  435. $data['computer_ticket_status'] = 0;
  436. $data['computer_ticket_field'] = implode(',',$verify['computer_ticket_field']);
  437. $data['face_ticket_type'] = $verify['face_ticket_type'];
  438. $data['face_ticket_content'] = $verify['face_ticket_content'];
  439. $data['face_ticket_status'] = 0;
  440. $data['face_ticket_field'] = implode(',',$verify['face_ticket_field']);
  441. $ids = RecruitPost::where('recruit_id', $recruit_id)->pluck('id');
  442. $fileCharater = $request->input('addFile');
  443. DB::beginTransaction();//检查数据库事务
  444. try {
  445. Recruit::where('id', $recruit_id)->update($data);
  446. $postcode_array = $request->postcode;
  447. $postname_array = $request->postname;
  448. $postnumber_array = $request->postnumber;
  449. $limit_array = $request->postlimit;
  450. $postid_arr = $request->postid_arr;
  451. $countnum = count($postcode_array);
  452. if ($countnum > 0) {
  453. $ids = RecruitPost::where('recruit_id', $recruit_id)->pluck('id');
  454. if (count($postid_arr) == 0) {//没有提交岗位代表删除岗位
  455. RecruitPost::where('recruit_id', $recruit_id)->delete();
  456. } else {
  457. foreach ($ids as $key => $value) {
  458. if (!in_array($value, $postid_arr)) {
  459. $post_is_create = RecruitAppointInfo::where('post_id', $value)->first();
  460. if (empty($post_is_create)) {
  461. //有报名信息的岗位不能删除
  462. RecruitPost::destroy($value);
  463. }
  464. }
  465. }
  466. }
  467. for ($i = 0; $i < $countnum; $i++) {
  468. $data = array();
  469. if ($postcode_array[$i] !== '' and $postname_array[$i] !== '') {
  470. if (isset($postid_arr[$i])) {
  471. $post_id = $postid_arr[$i];
  472. $data['code'] = $postcode_array[$i];
  473. $data['name'] = $postname_array[$i];
  474. $data['number'] = $postnumber_array[$i];
  475. $data['limit'] = $limit_array[$i];
  476. $data['recruit_id'] = $recruit_id;
  477. RecruitPost::where('id', $post_id)->update($data);
  478. } else {
  479. $data['code'] = $postcode_array[$i];
  480. $data['name'] = $postname_array[$i];
  481. $data['number'] = $postnumber_array[$i];
  482. $data['limit'] = $limit_array[$i];
  483. $data['recruit_id'] = $recruit_id;
  484. RecruitPost::create($data);
  485. }
  486. }
  487. }
  488. } else {
  489. RecruitPost::where('recruit_id', $recruit_id)->delete();
  490. }
  491. $fileCharater = $request->file('addFile');
  492. if (!empty($fileCharater)) {
  493. RecruitSubjoin::where('recruit_id', $recruit_id)->delete();
  494. foreach ($fileCharater as $f => $fv) {
  495. $picpath = 'zhaokaopic/' . date('Ymd', time()) . '/';
  496. //获取文件的扩展名
  497. $ext = $fv->getClientOriginalExtension();
  498. //获取文件的绝对路径
  499. $path = $fv->getRealPath();
  500. //定义文件名
  501. $filename = time() . rand(100, 999) . '.' . $ext;
  502. //存储文件。disk里面的public。总的来说,就是调用disk模块里的public配置
  503. Storage::disk('public')->put($picpath . $filename, file_get_contents($path));
  504. $data = $picpath . $filename;
  505. $create_arr = [
  506. 'recruit_id' => $recruit_id,
  507. 'subjoin_name' => $fv->getClientOriginalName(),
  508. 'subjoin_path' => $data,
  509. 'subjoin_addtime' => time()
  510. ];
  511. RecruitSubjoin::create($create_arr);
  512. }
  513. }
  514. DB::commit();
  515. return admin_toastr('操作成功!', 'success');
  516. } catch (\Exception $e) {
  517. DB::rollback();
  518. return admin_toastr($e->getMessage(), 'error');
  519. }
  520. }
  521. /**
  522. * 删掉指定招考场次
  523. * @param $id
  524. */
  525. public function destroy($id)
  526. {
  527. Permission::check('recruit_manager_del');
  528. $info = Recruit::find($id);
  529. if($info){
  530. if($info->delete()){
  531. //RecruitAppointInfo::where('recruit_id', $id)->delete(); //todo保留
  532. return response()->json(['status' => 1, 'message' => '删除成功!'], '200');
  533. }else{
  534. return response()->json(['status' => 0, 'message' => '删除失败!'], '200');
  535. }
  536. }else{
  537. return response()->json(['status' => 0, 'message' => '找不到记录!'], '200');
  538. }
  539. //Recruit::find($id)->delete();
  540. }
  541. /**
  542. * 报名管理
  543. * @param Content $content
  544. * @param Request $request
  545. * @return Content|\Illuminate\Http\RedirectResponse
  546. */
  547. public function appointList(Content $content, Request $request)
  548. {
  549. Permission::check('recruit_appoint_list');
  550. $id = $request->id;
  551. $recruit = Recruit::find($id);
  552. if (empty($recruit)) {
  553. return back();
  554. }
  555. $search_data = $request->all();
  556. $where = [];
  557. $where[] = ['audit','>',0];
  558. if (isset($search_data['id']) || session('manage_search_data')['id']) {
  559. if (isset($search_data['page'])) {
  560. if (session('search_data')) {
  561. $where = session('managewhere');
  562. unset($search_data['page']);
  563. $search_data = session('manage_search_data');
  564. }
  565. }
  566. foreach ($search_data as $k => $v) {
  567. if ($k == 'realname') {
  568. $where[] = [$k, 'like', "%$v%"];
  569. } elseif ($k == 'id') {
  570. $where[] = ['recruit_appoint_info.recruit_id', '=', $v];
  571. } elseif($k == 'print_bs'){
  572. $where[] = ['recruit_ticket.ex_type', '=', 1];
  573. $where[] = ['recruit_ticket.ex_status', '=', $v];
  574. } elseif($k == 'print_js'){
  575. $where[] = ['recruit_ticket.ex_type', '=', 2];
  576. $where[] = ['recruit_ticket.ex_status', '=', $v];
  577. } elseif($k == 'print_ms'){
  578. $where[] = ['recruit_ticket.ex_type', '=', 3];
  579. $where[] = ['recruit_ticket.ex_status', '=', $v];
  580. } elseif ($k != '_pjax' and $k != 'page' && $k != 'perpage') {
  581. $where[] = [$k, '=', $v];
  582. }
  583. }
  584. session(['managewhere' => $where]);
  585. session(['manage_search_data' => $search_data]);
  586. session()->save();
  587. }
  588. $session_data = session('search_data');
  589. if(isset($session_data['perpage'])){
  590. $perpage = $session_data['perpage'];
  591. }else{
  592. $perpage = 20;
  593. }
  594. $list = RecruitAppointInfo::where($where)
  595. ->join('recruit_post', 'recruit_appoint_info.post_id', '=', 'recruit_post.id', 'left')
  596. ->join('recruit_ticket', 'recruit_ticket.appoint_id', '=', 'recruit_appoint_info.id','left')
  597. ->select('recruit_appoint_info.*', 'recruit_post.code', 'recruit_post.name')
  598. ->orderBy('recruit_appoint_info.updated_at','desc')
  599. ->paginate($perpage);
  600. foreach ($list as $k => $v){
  601. if($v->sex == 0){
  602. $list[$k]['sex'] = '女';
  603. }else{
  604. $list[$k]['sex'] = '男';
  605. }
  606. switch ($v->political_affiliation){
  607. case '01':
  608. $list[$k]['political_affiliation'] = '中共党员';
  609. break;
  610. case '02':
  611. $list[$k]['political_affiliation'] = '中共预备党员';
  612. break;
  613. case '03':
  614. $list[$k]['political_affiliation'] = '共青团员';
  615. break;
  616. case '04':
  617. $list[$k]['political_affiliation'] = '民革党员';
  618. break;
  619. case '05':
  620. $list[$k]['political_affiliation'] = '民盟盟员';
  621. break;
  622. case '06':
  623. $list[$k]['political_affiliation'] = '民建会员';
  624. break;
  625. case '07':
  626. $list[$k]['political_affiliation'] = '民进会员';
  627. break;
  628. case '08':
  629. $list[$k]['political_affiliation'] = '农工党党员';
  630. break;
  631. case '09':
  632. $list[$k]['political_affiliation'] = '致公党党员';
  633. break;
  634. case '10':
  635. $list[$k]['political_affiliation'] = '九三学社社员';
  636. break;
  637. case '11':
  638. $list[$k]['political_affiliation'] = '台盟盟员';
  639. break;
  640. case '12':
  641. $list[$k]['political_affiliation'] = '无党派人士';
  642. break;
  643. case '13':
  644. $list[$k]['political_affiliation'] = '群众';
  645. break;
  646. }
  647. $list[$k]['pen_print'] = 0;
  648. $list[$k]['computer_print'] = 0;
  649. $list[$k]['face_print'] = 0;
  650. $list[$k]['reexamine_print'] = 0;
  651. $tickets = RecruitTicket::where('appoint_id',$v->id)->get();
  652. if($tickets){
  653. foreach ($tickets as $tk => $tv){
  654. if($tv->ex_type == 1){
  655. $list[$k]['pen_print'] = $tv->ex_status;
  656. }
  657. if($tv->ex_type == 2){
  658. $list[$k]['computer_print'] = $tv->ex_status;
  659. }
  660. if($tv->ex_type == 3){
  661. $list[$k]['face_print'] = $tv->ex_status;
  662. }
  663. if($tv->ex_type == 4){
  664. $list[$k]['reexamine_print'] = $tv->ex_status;
  665. }
  666. }
  667. }
  668. }
  669. $post_data = RecruitPost::where('recruit_id',$id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  670. return $content
  671. ->header('报名管理')
  672. ->description('招考人员信息列表')
  673. ->body(view('admin.recruit.appoint_list')->with([
  674. 'list' => $list,
  675. 'search_data' => $search_data,
  676. 'recruit' => $recruit,
  677. 'post' => $post_data
  678. ]));
  679. }
  680. /**
  681. * 查看报名详细信息
  682. * @param Request $request
  683. * @return \Illuminate\Http\JsonResponse
  684. * @throws \Throwable
  685. */
  686. public function getUserinfo(Request $request)
  687. {
  688. Permission::check('recruit_getUserinfo');
  689. $id = $request->id;
  690. $data = RecruitAppointInfo::where('recruit_appoint_info.id',$id)
  691. ->join('recruit_post', 'recruit_appoint_info.post_id', '=', 'recruit_post.id', 'left')
  692. ->join('recruit_appoint_expand_special', 'recruit_appoint_info.id', '=', 'recruit_appoint_expand_special.recruit_appoint_id', 'left')
  693. ->join('recruit_appoint_detail', 'recruit_appoint_detail.recruit_appoint_id', '=', 'recruit_appoint_info.id', 'left')
  694. ->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')
  695. ->first();
  696. $recruit = Recruit::where('id',$data->recruit_id)->first();
  697. $recruit->forms = explode(',', $recruit->forms);
  698. $data->family = json_decode($data->family);
  699. if ($data->family) {
  700. foreach ($data->family as $k => $v) {
  701. $v->political_affiliation = RecruitAppointInfo::$political_affiliation[$v->political_affiliation];
  702. }
  703. }
  704. //layer相册层
  705. $photos = [
  706. 'material'=>[],
  707. 'identification'=>[],
  708. 'education_certification'=>[],
  709. 'other_certification'=>[],
  710. ];
  711. if(in_array('expand_special',$recruit->forms)){
  712. if(json_decode($data->material)){
  713. $data->material = json_decode($data->material);
  714. $photo_data = [];
  715. foreach ($data->material as $k => $v) {
  716. if($v->status){
  717. $photo_data[] = [
  718. 'alt' => $v->name,
  719. 'pid' => $v->uid,
  720. 'src' => $v->response->path,
  721. ];
  722. }
  723. }
  724. $photos['material'] = [
  725. 'title' => '申请加分佐证材料',
  726. 'id' => 1,
  727. 'start' => 0,
  728. 'data' =>$photo_data
  729. ];
  730. }else{
  731. $data->material = [];
  732. }
  733. }
  734. if(in_array('identification',$recruit->forms) || in_array('internship',$recruit->forms)){
  735. if(json_decode($data->identification)){
  736. $data->identification = json_decode($data->identification);
  737. $photo_data = [];
  738. foreach ($data->identification as $k => $v) {
  739. if($v->status){
  740. $photo_data[] = [
  741. 'alt' => $v->name,
  742. 'pid' => $v->uid,
  743. 'src' => $v->response->path,
  744. ];
  745. }
  746. }
  747. $photos['identification'] = [
  748. 'title' => '身份证明',
  749. 'id' => 1,
  750. 'start' => 0,
  751. 'data' =>$photo_data
  752. ];
  753. }else{
  754. $data->identification = [];
  755. }
  756. }
  757. if(in_array('education_certification',$recruit->forms) || in_array('internship',$recruit->forms)){
  758. if(json_decode($data->education_certification)){
  759. $data->education_certification = json_decode($data->education_certification);
  760. $photo_data = [];
  761. foreach ($data->education_certification as $k => $v) {
  762. if($v->status){
  763. $photo_data[] = [
  764. 'alt' => $v->name,
  765. 'pid' => $v->uid,
  766. 'src' => $v->response->path,
  767. ];
  768. }
  769. }
  770. $photos['education_certification'] = [
  771. 'title' => '学历证明',
  772. 'id' => 1,
  773. 'start' => 0,
  774. 'data' =>$photo_data
  775. ];
  776. }else{
  777. $data->education_certification = [];
  778. }
  779. }
  780. if(in_array('other_certification',$recruit->forms) || in_array('internship',$recruit->forms)){
  781. if(json_decode($data->other_certification)){
  782. $data->other_certification = json_decode($data->other_certification);
  783. $photo_data = [];
  784. foreach ($data->other_certification as $k => $v) {
  785. if($v->status){
  786. $photo_data[] = [
  787. 'alt' => $v->name,
  788. 'pid' => $v->uid,
  789. 'src' => $v->response->path,
  790. ];
  791. }
  792. }
  793. $photos['other_certification'] = [
  794. 'title' => '其他证明',
  795. 'id' => 1,
  796. 'start' => 0,
  797. 'data' =>$photo_data
  798. ];
  799. }else{
  800. $data->other_certification = [];
  801. }
  802. }
  803. $html = view('admin.recruit.manageajax_userinfo')->with(['appointinfo' => $data,'recruit' => $recruit,'photos'=>$photos])->render();
  804. return response()->json(['code' => 1, 'data' => $html]);
  805. }
  806. /**
  807. * 第一阶段(报名审核)
  808. * @param Request $request
  809. * @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response|mixed|\Psr\Container\ContainerInterface|\Symfony\Component\HttpFoundation\Response|\think\Response
  810. * @throws \Throwable
  811. */
  812. public function ajax_audit(Request $request)
  813. {
  814. Permission::check('recruit_ajax_audit');
  815. $ids = $request->ids;
  816. $view_data['ids'] = $ids;
  817. return response(['data' => view('admin.recruit.ajax_audit')->with($view_data)->render(), 'status' => 1], '200');
  818. }
  819. /**
  820. * 材料补登审核
  821. * @param Request $request
  822. * @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response|mixed|\Psr\Container\ContainerInterface|\Symfony\Component\HttpFoundation\Response|\think\Response
  823. * @throws \Throwable
  824. */
  825. public function ajax_supplement(Request $request)
  826. {
  827. Permission::check('recruit_ajax_supplement');
  828. $ids = $request->ids;
  829. $view_data['ids'] = $ids;
  830. $info = RecruitSupplement::where('appoint_id',$ids)->first();
  831. if(!$info){
  832. $view_data['switch'] = 0;
  833. }else{
  834. $view_data['switch'] = 1;
  835. $photos = [
  836. 'identification'=>[],
  837. 'household_register' => [],
  838. 'education_certification'=>[],
  839. 'family_planning'=>[],
  840. 'manage' => []
  841. ];
  842. $info->identification = json_decode($info->identification);
  843. $photo_data = [];
  844. foreach ($info->identification as $k => $v) {
  845. if($v->status){
  846. $photo_data[] = [
  847. 'alt' => $v->name,
  848. 'pid' => $v->uid,
  849. 'src' => $v->response->path,
  850. ];
  851. }
  852. }
  853. $photos['identification'] = [
  854. 'title' => '身份证明',
  855. 'id' => 1,
  856. 'start' => 0,
  857. 'data' =>$photo_data
  858. ];
  859. $info->household_register = json_decode($info->household_register);
  860. $photo_data = [];
  861. foreach ($info->household_register as $k => $v) {
  862. if($v->status){
  863. $photo_data[] = [
  864. 'alt' => $v->name,
  865. 'pid' => $v->uid,
  866. 'src' => $v->response->path,
  867. ];
  868. }
  869. }
  870. $photos['household_register'] = [
  871. 'title' => '户口簿',
  872. 'id' => 1,
  873. 'start' => 0,
  874. 'data' =>$photo_data
  875. ];
  876. $info->education_certification = json_decode($info->education_certification);
  877. $photo_data = [];
  878. foreach ($info->education_certification as $k => $v) {
  879. if($v->status){
  880. $photo_data[] = [
  881. 'alt' => $v->name,
  882. 'pid' => $v->uid,
  883. 'src' => $v->response->path,
  884. ];
  885. }
  886. }
  887. $photos['education_certification'] = [
  888. 'title' => '教育证明',
  889. 'id' => 1,
  890. 'start' => 0,
  891. 'data' =>$photo_data
  892. ];
  893. // $info->family_planning = json_decode($info->family_planning);
  894. // $photo_data = [];
  895. // foreach ($info->family_planning 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['family_planning'] = [
  905. // 'title' => '计生证明',
  906. // 'id' => 1,
  907. // 'start' => 0,
  908. // 'data' =>$photo_data
  909. // ];
  910. $info->manage = json_decode($info->manage);
  911. $photo_data = [];
  912. foreach ($info->manage as $k => $v) {
  913. if($v->status){
  914. $photo_data[] = [
  915. 'alt' => $v->name,
  916. 'pid' => $v->uid,
  917. 'src' => $v->response->path,
  918. ];
  919. }
  920. }
  921. $photos['manage'] = [
  922. 'title' => '综治证明',
  923. 'id' => 1,
  924. 'start' => 0,
  925. 'data' =>$photo_data
  926. ];
  927. $view_data['info'] = $info;
  928. $view_data['photos'] = $photos;
  929. }
  930. return response(['data' => view('admin.recruit.ajax_supplement')->with($view_data)->render(), 'status' => 1], '200');
  931. }
  932. /**
  933. * 健康信息审核
  934. * @param Request $request
  935. * @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response|mixed|\Psr\Container\ContainerInterface|\Symfony\Component\HttpFoundation\Response|\think\Response
  936. * @throws \Throwable
  937. */
  938. public function ajax_health(Request $request)
  939. {
  940. Permission::check('recruit_ajax_health');
  941. $ids = $request->ids;
  942. $view_data['ids'] = $ids;
  943. $info = RecruitSupplement::where('appoint_id',$ids)->first();
  944. if(!$info){
  945. $view_data['switch'] = 0;
  946. $view_data['photos'] = [];
  947. }else{
  948. $view_data['switch'] = 1;
  949. $photos = [
  950. 'health_code'=>[],
  951. 'trip_code' => []
  952. ];
  953. $info->health_code = json_decode($info->health_code);
  954. $photo_data = [];
  955. if(is_array($info->health_code)){
  956. foreach ($info->health_code as $k => $v) {
  957. if($v->status){
  958. $photo_data[] = [
  959. 'alt' => $v->name,
  960. 'pid' => $v->uid,
  961. 'src' => $v->response->path,
  962. ];
  963. }
  964. }
  965. }
  966. $photos['health_code'] = [
  967. 'title' => '健康码',
  968. 'id' => 1,
  969. 'start' => 0,
  970. 'data' =>$photo_data
  971. ];
  972. $info->trip_code = json_decode($info->trip_code);
  973. $photo_data = [];
  974. if(is_array($info->trip_code)){
  975. foreach ($info->trip_code as $k => $v) {
  976. if($v->status){
  977. $photo_data[] = [
  978. 'alt' => $v->name,
  979. 'pid' => $v->uid,
  980. 'src' => $v->response->path,
  981. ];
  982. }
  983. }
  984. }
  985. $photos['trip_code'] = [
  986. 'title' => '行程码',
  987. 'id' => 1,
  988. 'start' => 0,
  989. 'data' =>$photo_data
  990. ];
  991. $view_data['info'] = $info;
  992. $view_data['photos'] = $photos;
  993. }
  994. return response(['data' => view('admin.recruit.ajax_health')->with($view_data)->render(), 'status' => 1], '200');
  995. }
  996. /**
  997. * 报名记录审核处理
  998. * @param Request $request
  999. * @return \Illuminate\Http\JsonResponse
  1000. */
  1001. public function appoint_audit(Request $request)
  1002. {
  1003. $ids = $request->ids;
  1004. if (!is_array($ids)) {
  1005. $ids = explode(",", $ids);
  1006. }
  1007. if (empty($ids)) {
  1008. return response()->json(['status' => 0, 'msg' => '请选择审核记录!'], '200');
  1009. }
  1010. $audit = $request->audit;
  1011. $exam_flow_path = $request->exam_flow_path;
  1012. $reason = $request->reason;
  1013. if(empty($audit)){
  1014. return response()->json(['status' => 0, 'msg' => '请选择审核状态!'], '200');
  1015. }
  1016. if($audit == '3' && empty($exam_flow_path)){
  1017. return response()->json(['status' => 0, 'msg' => '请选择审核后的考试流程!'], '200');
  1018. }
  1019. if($audit != '3' && empty($reason)){
  1020. return response()->json(['status' => 0, 'msg' => '请输入审核原因!'], '200');
  1021. }
  1022. $message = [];
  1023. switch ($audit){
  1024. case '1':
  1025. //撤回至未审核
  1026. foreach ($ids as $k => $v){
  1027. $appointinfo = RecruitAppointInfo::where('id', $v)->first();
  1028. if(!$appointinfo || intval($appointinfo->audit) === 1){
  1029. continue;
  1030. }
  1031. //设置该报名的各个状态
  1032. $appointinfo_data = [
  1033. 'current' => 1,
  1034. 'audit' => 1,
  1035. 'pen_audit' => -1,
  1036. 'computer_audit' => -1,
  1037. 'face_audit' => -1,
  1038. 'reexamine_audit' => -1,
  1039. 'inspect_audit' => -1,
  1040. 'political_audit' => -1,
  1041. 'employ_audit' => -1
  1042. ];
  1043. RecruitAppointInfo::where('id', $v)->update($appointinfo_data);
  1044. //写日志
  1045. $log = [
  1046. 'type' => 2,
  1047. 'step' => 1,
  1048. 'appoint_id' => $v,
  1049. 'uid' => Admin::user()->id,
  1050. 'log' => '撤回至未审核状态,原因是:'.$reason
  1051. ];
  1052. RecruitAppointLog::create($log);
  1053. $message[$v] = '您此次的报名需要重新审核,原因是:'.$reason;
  1054. }
  1055. break;
  1056. case '2':
  1057. //审核未通过
  1058. foreach ($ids as $k => $v){
  1059. $appointinfo = RecruitAppointInfo::where('id', $v)->first();
  1060. if(!$appointinfo || intval($appointinfo->audit) === 2){
  1061. continue;
  1062. }
  1063. //设置该报名的各个状态
  1064. $appointinfo_data = [
  1065. 'current' => 1,
  1066. 'audit' => 2,
  1067. 'pen_audit' => -1,
  1068. 'computer_audit' => -1,
  1069. 'face_audit' => -1,
  1070. 'reexamine_audit' => -1,
  1071. 'inspect_audit' => -1,
  1072. 'political_audit' => -1,
  1073. 'employ_audit' => -1
  1074. ];
  1075. RecruitAppointInfo::where('id', $v)->update($appointinfo_data);
  1076. //写日志
  1077. $log = [
  1078. 'type' => 2,
  1079. 'step' => 1,
  1080. 'appoint_id' => $v,
  1081. 'uid' => Admin::user()->id,
  1082. 'log' => '审核未通过,原因是:'.$reason
  1083. ];
  1084. RecruitAppointLog::create($log);
  1085. $message[$v] = '您此次报名审核未通过,原因是:'.$reason;
  1086. $this->smsService->sendSms($appointinfo->mobile,'sms_recruit_register_error',array('reason'=>$reason));
  1087. }
  1088. break;
  1089. case '3':
  1090. //审核通过
  1091. foreach ($ids as $k => $v){
  1092. $appointinfo = RecruitAppointInfo::where('id', $v)->first();
  1093. if(!$appointinfo || intval($appointinfo->audit) === 3){
  1094. continue;
  1095. }
  1096. $recruit = Recruit::where('id',$appointinfo->recruit_id)->first();
  1097. $step = explode(',',$recruit->step);
  1098. $step_str = [
  1099. 'pen' => '未设置此条报名记录的笔试信息',
  1100. ];
  1101. if(in_array('3',$step)){
  1102. //场次有设置笔试
  1103. if(in_array('pen',$exam_flow_path)){
  1104. $step_str['pen'] = '该场次需要笔试,已设置此条报考需要参与笔试';
  1105. $pen_audit = -1;
  1106. }else{
  1107. $step_str['pen'] = '该场次需要笔试,此条报考可跳过笔试';
  1108. $pen_audit = 3;
  1109. }
  1110. }else{
  1111. $step_str['pen'] = '该场次不需要笔试';
  1112. $pen_audit = 3;
  1113. }
  1114. if(in_array('4',$step)){
  1115. //场次有设置上机
  1116. if(in_array('computer',$exam_flow_path)){
  1117. $step_str['computer'] = '该场次需要上机,已设置此条报考需要参与上机';
  1118. $computer_audit = -1;
  1119. }else{
  1120. $step_str['computer'] = '该场次需要上机,此条报考可跳过上机';
  1121. $computer_audit = 3;
  1122. }
  1123. }else{
  1124. $step_str['computer'] = '该场次不需要上机';
  1125. $computer_audit = 3;
  1126. }
  1127. if(in_array('5',$step)){
  1128. //场次有设置上机
  1129. if(in_array('face',$exam_flow_path)){
  1130. $step_str['face'] = '该场次需要面试,已设置此条报考需要参与面试';
  1131. $face_audit = -1;
  1132. }else{
  1133. $step_str['face'] = '该场次需要面试,此条报考可跳过面试';
  1134. $face_audit = 3;
  1135. }
  1136. }else{
  1137. $step_str['face'] = '该场次不需要面试';
  1138. $face_audit = 3;
  1139. }
  1140. if(in_array('6',$step)){
  1141. //场次有设置复试
  1142. if(in_array('reexamine',$exam_flow_path)){
  1143. $step_str['reexamine'] = '该场次需要复试,已设置此条报考需要参与复试';
  1144. $reexamine_audit = -1;
  1145. }else{
  1146. $step_str['reexamine'] = '该场次需要复试,此条报考可跳过复试';
  1147. $reexamine_audit = 3;
  1148. }
  1149. }else{
  1150. $step_str['reexamine'] = '该场次不需要复试';
  1151. $reexamine_audit = 3;
  1152. }
  1153. //设置该报名的各个状态
  1154. $appointinfo_data = [
  1155. 'current' => 2,//审核成功后进入考试流程
  1156. 'audit' => 3,
  1157. 'pen_audit' => $pen_audit,
  1158. 'computer_audit' => $computer_audit,
  1159. 'face_audit' => $face_audit,
  1160. 'reexamine_audit' => $reexamine_audit,
  1161. 'inspect_audit' => -1,
  1162. 'political_audit' => -1,
  1163. 'employ_audit' => -1
  1164. ];
  1165. RecruitAppointInfo::where('id', $v)->update($appointinfo_data);
  1166. $reason = $reason ?? '符合报考条件';
  1167. //写日志
  1168. $log = [
  1169. 'type' => 2,
  1170. 'step' => 1,
  1171. 'appoint_id' => $v,
  1172. 'uid' => Admin::user()->id,
  1173. 'log' => '审核通过,原因是:' . $reason,
  1174. 'admin_log' => implode(';',$step_str)
  1175. ];
  1176. RecruitAppointLog::create($log);
  1177. $message[$v] = '您此次报名审核已通过,原因是:' . $reason;
  1178. $this->smsService->sendSms($appointinfo->mobile,'sms_recruit_register_success',array('reason'=>$reason));
  1179. $this->fetch_word(['recruit_id'=>$appointinfo->recruit_id,'appoint_id'=>$appointinfo->id]);
  1180. }
  1181. break;
  1182. }
  1183. //站内信
  1184. foreach ($ids as $key => $val) {
  1185. if(array_key_exists($val,$message)){
  1186. $user_info = Member::where('id', $appointinfo->uid)->first();
  1187. Pms::write_pmsnotice($user_info->id, $user_info->username, $message[$val]);
  1188. }else{
  1189. continue;
  1190. }
  1191. }
  1192. return response()->json(['status' => 1, 'msg' => '操作成功!', 'data' => 'ok']);
  1193. }
  1194. /**
  1195. * 材料补登审核处理
  1196. * @param Request $request
  1197. * @return \Illuminate\Http\JsonResponse
  1198. */
  1199. public function supplement(Request $request)
  1200. {
  1201. Permission::check('ajax_supplement');
  1202. $ids = $request->ids;
  1203. if (empty($ids)) {
  1204. return response()->json(['status' => 0, 'msg' => '请选择审核记录!'], '200');
  1205. }
  1206. $status = $request->status;
  1207. $reason = $request->reason;
  1208. if(empty($status)){
  1209. return response()->json(['status' => 0, 'msg' => '请选择审核状态!'], '200');
  1210. }
  1211. if($status == -1 && empty($reason)){
  1212. return response()->json(['status' => 0, 'msg' => '请输入审核原因!'], '200');
  1213. }
  1214. if($status == -1){
  1215. $info = RecruitSupplement::where('appoint_id', $ids)->first();
  1216. $appointinfo = RecruitAppointInfo::where('id', $ids)->first();
  1217. //写日志
  1218. $log = [
  1219. 'type' => 2,
  1220. 'step' => 1,
  1221. 'appoint_id' => $ids,
  1222. 'uid' => Admin::user()->id,
  1223. 'log' => '材料补登审核未通过,原因是:'.$reason
  1224. ];
  1225. RecruitAppointLog::create($log);
  1226. $info->status = -1;
  1227. $info->msg = $reason;
  1228. $info->save();
  1229. $appointinfo->political_audit = 0;
  1230. $appointinfo->save();
  1231. $this->smsService->sendSms($appointinfo->mobile,'sms_recruit_register_error',array('reason'=>$reason));
  1232. }
  1233. if($status == 1){
  1234. $reason = $reason ?? '符合报考条件';
  1235. $info = RecruitSupplement::where('appoint_id', $ids)->first();
  1236. $appointinfo = RecruitAppointInfo::where('id', $ids)->first();
  1237. //写日志
  1238. $log = [
  1239. 'type' => 2,
  1240. 'step' => 1,
  1241. 'appoint_id' => $ids,
  1242. 'uid' => Admin::user()->id,
  1243. 'log' => '审核通过,原因是:' . $reason
  1244. ];
  1245. RecruitAppointLog::create($log);
  1246. $info->status = 1;
  1247. $info->msg = $reason;
  1248. $info->save();
  1249. $appointinfo->political_audit = 1;
  1250. $appointinfo->save();
  1251. $this->smsService->sendSms($appointinfo->mobile,'sms_recruit_register_success',array('reason'=>$reason));
  1252. }
  1253. return response()->json(['status' => 1, 'msg' => '操作成功!', 'data' => 'ok']);
  1254. }
  1255. /**
  1256. * 健康信息处理
  1257. * @param Request $request
  1258. * @return \Illuminate\Http\JsonResponse
  1259. */
  1260. public function health(Request $request)
  1261. {
  1262. Permission::check('ajax_health');
  1263. $ids = $request->ids;
  1264. if (empty($ids)) {
  1265. return response()->json(['status' => 0, 'msg' => '请选择审核记录!'], '200');
  1266. }
  1267. $status = $request->h_status;
  1268. $reason = $request->reason;
  1269. if(empty($status)){
  1270. return response()->json(['status' => 0, 'msg' => '请选择审核状态!'], '200');
  1271. }
  1272. if($status == -1 && empty($reason)){
  1273. return response()->json(['status' => 0, 'msg' => '请输入审核原因!'], '200');
  1274. }
  1275. if($status == -1){
  1276. $info = RecruitSupplement::where('appoint_id', $ids)->first();
  1277. $appointinfo = RecruitAppointInfo::where('id', $ids)->first();
  1278. //写日志
  1279. $log = [
  1280. 'type' => 2,
  1281. 'step' => 1,
  1282. 'appoint_id' => $ids,
  1283. 'uid' => Admin::user()->id,
  1284. 'log' => '健康信息审核未通过,原因是:'.$reason
  1285. ];
  1286. RecruitAppointLog::create($log);
  1287. $info->h_status = -1;
  1288. $info->h_msg = $reason;
  1289. $info->save();
  1290. $appointinfo->health_audit = 0;
  1291. $appointinfo->save();
  1292. }
  1293. if($status == 1){
  1294. $reason = $reason ?? '符合报考条件';
  1295. $info = RecruitSupplement::where('appoint_id', $ids)->first();
  1296. $appointinfo = RecruitAppointInfo::where('id', $ids)->first();
  1297. //写日志
  1298. $log = [
  1299. 'type' => 2,
  1300. 'step' => 1,
  1301. 'appoint_id' => $ids,
  1302. 'uid' => Admin::user()->id,
  1303. 'log' => '审核通过,原因是:' . $reason
  1304. ];
  1305. RecruitAppointLog::create($log);
  1306. $info->h_status = 1;
  1307. $info->h_msg = $reason;
  1308. $info->save();
  1309. $appointinfo->health_audit = 1;
  1310. $appointinfo->save();
  1311. }
  1312. return response()->json(['status' => 1, 'msg' => '操作成功!', 'data' => 'ok']);
  1313. }
  1314. public function fetchWord(Request $request)
  1315. {
  1316. $recruit_id = $request->recruit_id;
  1317. $appoint_id = $request->appoint_id;
  1318. if(!empty($recruit_id) && !empty($appoint_id)){
  1319. $url = $this->fetch_word(['recruit_id'=>$recruit_id,'appoint_id'=>$appoint_id]);
  1320. return response()->json(['status' => 1, 'msg' => '生成Word简历成功!', 'data' => 'ok', 'url' => $url]);
  1321. }else{
  1322. return response()->json(['status' => 0, 'msg' => '参数缺失!', 'data' => 'fail']);
  1323. }
  1324. }
  1325. /**
  1326. * 查看审核日志
  1327. * @param Request $request
  1328. * @return \Illuminate\Http\JsonResponse
  1329. */
  1330. public function showLog(Request $request)
  1331. {
  1332. Permission::check('recruit_show_log');
  1333. $id = $request->id;
  1334. $logs = RecruitAppointLog::where('appoint_id', $id)->orderBy('created_at', 'desc')->get()->toArray();
  1335. $str = "";
  1336. if ($logs) {
  1337. $str .= "<table class='table'><tr style='background:#F0F8FD'><td>审核时间</td><td>操作级别</td><td>记录类型</td><td>触发操作的人员</td><td>审核描述</td></tr>";
  1338. foreach ($logs as $k => $v) {
  1339. switch ($v['type']){
  1340. case '1':
  1341. $level = '系统级操作';
  1342. $user = '系统';
  1343. break;
  1344. case '2':
  1345. $level = '审核系列操作';
  1346. $admin = AdminUser::where('id',$v['uid'])->first();
  1347. $user = $admin->name;
  1348. break;
  1349. case '3':
  1350. $level = '用户自行操作';
  1351. $member = Member::where('id',$v['uid'])->first();
  1352. $user = $member->username;
  1353. break;
  1354. }
  1355. switch ($v['step']){
  1356. case '1':
  1357. $step = '报名及审核';
  1358. break;
  1359. case '2':
  1360. $step = '笔试';
  1361. break;
  1362. case '3':
  1363. $step = '面试';
  1364. break;
  1365. case '4':
  1366. $step = '上机';
  1367. break;
  1368. case '5':
  1369. $step = '复审';
  1370. break;
  1371. case '6':
  1372. $step = '体检';
  1373. break;
  1374. case '7':
  1375. $step = '政审';
  1376. break;
  1377. case '8':
  1378. $step = '录用';
  1379. break;
  1380. }
  1381. $str .= "<tr><td>" . $v['created_at'] . "</td><td>" . $level . "</td><td>" . $step . "</td><td>" . $user . "</td><td>" . $v['log'] . "</td></tr>\r\n";
  1382. }
  1383. $str .= "</table>";
  1384. } else {
  1385. $str = "抱歉,暂未有审核记录";
  1386. }
  1387. return response()->json(['code' => 1, 'data' => $str]);
  1388. }
  1389. /**
  1390. * 生成word版简历
  1391. * @param null $data
  1392. * @throws \PhpOffice\PhpWord\Exception\CopyFileException
  1393. * @throws \PhpOffice\PhpWord\Exception\CreateTemporaryFileException
  1394. * @throws \PhpOffice\PhpWord\Exception\Exception
  1395. */
  1396. public function fetch_word($data = null)
  1397. {
  1398. if($data != null && array_key_exists('recruit_id',$data) && array_key_exists('appoint_id',$data)){
  1399. $recruit = Recruit::where('id',$data['recruit_id'])->first();
  1400. $appoint = RecruitAppointInfo::where('id',$data['appoint_id'])->first();
  1401. $templateProcessor = new TemplateProcessor(base_path() . '/public/word/example.docx');
  1402. //通过setValue 方法给模板赋值
  1403. $templateProcessor->setValue('title', $recruit->name);
  1404. $templateProcessor->setValue('realname', $appoint->realname);
  1405. $templateProcessor->setValue('realname', $appoint->realname);
  1406. $templateProcessor->setValue('sex', $appoint->sex == 0 ? '女' : '男');
  1407. $templateProcessor->setValue('birthday', $appoint->birthday);
  1408. $templateProcessor->setValue('nation', $appoint->nation);
  1409. $templateProcessor->setValue('native_place', $appoint->native_place);
  1410. $templateProcessor->setValue('card', $appoint->card);
  1411. switch ($appoint->political_affiliation){
  1412. case '01':
  1413. $templateProcessor->setValue('political_affiliation', '中共党员');
  1414. break;
  1415. case '02':
  1416. $templateProcessor->setValue('political_affiliation', '中共预备党员');
  1417. break;
  1418. case '03':
  1419. $templateProcessor->setValue('political_affiliation', '共青团员');
  1420. break;
  1421. case '04':
  1422. $templateProcessor->setValue('political_affiliation', '民革党员');
  1423. break;
  1424. case '05':
  1425. $templateProcessor->setValue('political_affiliation', '民盟盟员');
  1426. break;
  1427. case '06':
  1428. $templateProcessor->setValue('political_affiliation', '民建会员');
  1429. break;
  1430. case '07':
  1431. $templateProcessor->setValue('political_affiliation', '民进会员');
  1432. break;
  1433. case '08':
  1434. $templateProcessor->setValue('political_affiliation', '农工党党员');
  1435. break;
  1436. case '09':
  1437. $templateProcessor->setValue('political_affiliation', '致公党党员');
  1438. break;
  1439. case '10':
  1440. $templateProcessor->setValue('political_affiliation', '九三学社社员');
  1441. break;
  1442. case '11':
  1443. $templateProcessor->setValue('political_affiliation', '台盟盟员');
  1444. break;
  1445. case '12':
  1446. $templateProcessor->setValue('political_affiliation', '无党派人士');
  1447. break;
  1448. case '13':
  1449. $templateProcessor->setValue('political_affiliation', '群众');
  1450. }
  1451. $templateProcessor->setValue('join_time', $appoint->join_time);
  1452. $templateProcessor->setValue('house_register', $appoint->house_register);
  1453. switch ($appoint->edu_type){
  1454. case '1':
  1455. $templateProcessor->setValue('edu_type', '全日制');
  1456. break;
  1457. case '2':
  1458. $templateProcessor->setValue('edu_type', '在职教育');
  1459. break;
  1460. }
  1461. $templateProcessor->setValue('education', $appoint->education);
  1462. $templateProcessor->setValue('school', $appoint->school);
  1463. $templateProcessor->setValue('degree', $appoint->degree);
  1464. $templateProcessor->setValue('pro', $appoint->pro);
  1465. $templateProcessor->setValue('mobile', $appoint->mobile);
  1466. $templateProcessor->setValue('email', $appoint->email);
  1467. $templateProcessor->setValue('address', $appoint->address);
  1468. $post_data = RecruitPost::where('id',$appoint->post_id)->first();
  1469. $templateProcessor->setValue('post', $post_data->code . " " . $post_data->name);
  1470. $templateProcessor->setValue('work', $appoint->work);
  1471. $templateProcessor->setValue('titles', $appoint->titles);
  1472. $templateProcessor->setValue('concat_name', $appoint->concat_name);
  1473. $templateProcessor->setValue('concat_mobile', $appoint->concat_mobile);
  1474. $forms = explode(',', $recruit->forms);
  1475. if(in_array('expand_special',$forms)){
  1476. $special = RecruitAppointExpandSpecial::where('recruit_appoint_id',$appoint->id)->first();
  1477. $templateProcessor->cloneBlock('special_block',1);
  1478. $templateProcessor->setValue('point_apply', $special->point_apply == 0 ? '否' : '是');
  1479. $templateProcessor->setValue('condition', $special->condition);
  1480. if($material = json_decode($special->material)){
  1481. foreach ($material as $k => $v){
  1482. $templateProcessor->setImageValue('material#'.($k+1),['src' => 'https://www.jucai.gov.cn/'.$v->url]);
  1483. }
  1484. }
  1485. }else{
  1486. $templateProcessor->cloneBlock('special_block',0);
  1487. }
  1488. $templateProcessor->setValue('resume', str_replace("\n",'<w:br/>',$appoint->resume));
  1489. if(in_array('detail',$forms)){
  1490. $detail = RecruitAppointDetail::where('recruit_appoint_id',$appoint->id)->first();
  1491. $templateProcessor->cloneBlock('detail_block',1);
  1492. $templateProcessor->setValue('train', str_replace("\n",'<w:br/>',$detail->train));
  1493. $templateProcessor->setValue('rewards_and_punishments', str_replace("\n",'<w:br/>',$detail->rewards_and_punishments));
  1494. $templateProcessor->setValue('introduce', str_replace("\n",'<w:br/>',$detail->introduce));
  1495. }else{
  1496. $templateProcessor->cloneBlock('detail_block',0);
  1497. }
  1498. if($family = json_decode($appoint->family,true)){
  1499. $templateProcessor->cloneRow('family_relation',count($family));
  1500. $i = 1;
  1501. foreach ($family as $k => $v){
  1502. $templateProcessor->setValue('family_relation#'.$i, $v['relation']);
  1503. $templateProcessor->setValue('family_realname#'.$i, $v['realname']);
  1504. $templateProcessor->setValue('family_birthday#'.$i, $v['birthday']);
  1505. switch ($v['political_affiliation']){
  1506. case '01':
  1507. $political_affiliation = '中共党员';
  1508. break;
  1509. case '02':
  1510. $political_affiliation = '中共预备党员';
  1511. break;
  1512. case '03':
  1513. $political_affiliation = '共青团员';
  1514. break;
  1515. case '04':
  1516. $political_affiliation = '民革党员';
  1517. break;
  1518. case '05':
  1519. $political_affiliation = '民盟盟员';
  1520. break;
  1521. case '06':
  1522. $political_affiliation = '民建会员';
  1523. break;
  1524. case '07':
  1525. $political_affiliation = '民进会员';
  1526. break;
  1527. case '08':
  1528. $political_affiliation = '农工党党员';
  1529. break;
  1530. case '09':
  1531. $political_affiliation = '致公党党员';
  1532. break;
  1533. case '10':
  1534. $political_affiliation = '九三学社社员';
  1535. break;
  1536. case '11':
  1537. $political_affiliation = '台盟盟员';
  1538. break;
  1539. case '12':
  1540. $political_affiliation = '无党派人士';
  1541. break;
  1542. case '13':
  1543. $political_affiliation = '群众';
  1544. }
  1545. $templateProcessor->setValue('family_political_affiliation#'.$i, $political_affiliation);
  1546. $templateProcessor->setValue('family_work#'.$i, $v['work']);
  1547. $i++;
  1548. }
  1549. }
  1550. $templateProcessor->setImageValue('avatar',['path' => 'http://www.jucai.gov.cn/'.$appoint->avatar, 'width' => 200, 'height' => 150]);
  1551. $filename = $appoint->realname . '_' . $appoint->card.'_' . $post_data->code . $post_data->name;
  1552. if(!is_dir(base_path() . "/storage/app/public/recruit/word/" . $recruit->name_en)){
  1553. Storage::makeDirectory("public/recruit/word/{$recruit->name_en}");
  1554. }
  1555. $word_url = "/{$filename}.docx";
  1556. $appoint->word_url = "/storage/recruit/word/" . $recruit->name_en .$word_url;
  1557. $appoint->save();
  1558. $templateProcessor->saveAs(base_path() . "/storage/app/public/recruit/word/" . $recruit->name_en . $word_url);//另存为
  1559. return "/storage/recruit/word/" . $recruit->name_en .$word_url;
  1560. }
  1561. }
  1562. /**
  1563. * 生成word版简历
  1564. * @param null $data
  1565. * @throws \PhpOffice\PhpWord\Exception\CopyFileException
  1566. * @throws \PhpOffice\PhpWord\Exception\CreateTemporaryFileException
  1567. * @throws \PhpOffice\PhpWord\Exception\Exception
  1568. */
  1569. public function fetch_word_internship($data = null)
  1570. {
  1571. if($data != null && array_key_exists('recruit_id',$data) && array_key_exists('appoint_id',$data)){
  1572. $recruit = Recruit::where('id',$data['recruit_id'])->first();
  1573. $appoint = RecruitAppointInfo::where('id',$data['appoint_id'])->first();
  1574. $templateProcessor = new TemplateProcessor(base_path() . '/public/word/example_internship.docx');
  1575. //通过setValue 方法给模板赋值
  1576. $templateProcessor->setValue('title', $recruit->name);
  1577. $templateProcessor->setValue('realname', $appoint->realname);
  1578. $templateProcessor->setValue('realname', $appoint->realname);
  1579. $templateProcessor->setValue('sex', $appoint->sex == 0 ? '女' : '男');
  1580. $templateProcessor->setValue('birthday', $appoint->birthday);
  1581. $templateProcessor->setValue('nation', $appoint->nation);
  1582. $templateProcessor->setValue('native_place', $appoint->native_place);
  1583. $templateProcessor->setValue('card', $appoint->card);
  1584. switch ($appoint->political_affiliation){
  1585. case '01':
  1586. $templateProcessor->setValue('political_affiliation', '中共党员');
  1587. break;
  1588. case '02':
  1589. $templateProcessor->setValue('political_affiliation', '中共预备党员');
  1590. break;
  1591. case '03':
  1592. $templateProcessor->setValue('political_affiliation', '共青团员');
  1593. break;
  1594. case '04':
  1595. $templateProcessor->setValue('political_affiliation', '民革党员');
  1596. break;
  1597. case '05':
  1598. $templateProcessor->setValue('political_affiliation', '民盟盟员');
  1599. break;
  1600. case '06':
  1601. $templateProcessor->setValue('political_affiliation', '民建会员');
  1602. break;
  1603. case '07':
  1604. $templateProcessor->setValue('political_affiliation', '民进会员');
  1605. break;
  1606. case '08':
  1607. $templateProcessor->setValue('political_affiliation', '农工党党员');
  1608. break;
  1609. case '09':
  1610. $templateProcessor->setValue('political_affiliation', '致公党党员');
  1611. break;
  1612. case '10':
  1613. $templateProcessor->setValue('political_affiliation', '九三学社社员');
  1614. break;
  1615. case '11':
  1616. $templateProcessor->setValue('political_affiliation', '台盟盟员');
  1617. break;
  1618. case '12':
  1619. $templateProcessor->setValue('political_affiliation', '无党派人士');
  1620. break;
  1621. case '13':
  1622. $templateProcessor->setValue('political_affiliation', '群众');
  1623. }
  1624. $templateProcessor->setValue('join_time', $appoint->join_time);
  1625. $templateProcessor->setValue('house_register', $appoint->house_register);
  1626. $templateProcessor->setValue('education', $appoint->education);
  1627. $templateProcessor->setValue('school', $appoint->school);
  1628. $templateProcessor->setValue('pro', $appoint->pro);
  1629. $templateProcessor->setValue('adjust', $appoint->adjust == 0 ? '否' : '是');
  1630. $templateProcessor->setValue('mobile', $appoint->mobile);
  1631. $templateProcessor->setValue('email', $appoint->email);
  1632. $templateProcessor->setValue('address', $appoint->address);
  1633. $post_data = RecruitPost::where('id',$appoint->post_id)->first();
  1634. $templateProcessor->setValue('post', $post_data->code . " " . $post_data->name);
  1635. $templateProcessor->setValue('concat_name', $appoint->concat_name);
  1636. $templateProcessor->setValue('concat_mobile', $appoint->concat_mobile);
  1637. $forms = explode(',', $recruit->forms);
  1638. $templateProcessor->setValue('resume', str_replace("\n",'<w:br/>',$appoint->resume));
  1639. $detail = RecruitAppointDetail::where('recruit_appoint_id',$appoint->id)->first();
  1640. $templateProcessor->setValue('train', str_replace("\n",'<w:br/>',$detail->train));
  1641. $templateProcessor->setValue('rewards_and_punishments', str_replace("\n",'<w:br/>',$detail->rewards_and_punishments));
  1642. $templateProcessor->setValue('introduce', str_replace("\n",'<w:br/>',$detail->introduce));
  1643. if($family = json_decode($appoint->family,true)){
  1644. $templateProcessor->cloneRow('family_relation',count($family));
  1645. $i = 1;
  1646. foreach ($family as $k => $v){
  1647. $templateProcessor->setValue('family_relation#'.$i, $v['relation']);
  1648. $templateProcessor->setValue('family_realname#'.$i, $v['realname']);
  1649. $templateProcessor->setValue('family_birthday#'.$i, $v['birthday']);
  1650. switch ($v['political_affiliation']){
  1651. case '01':
  1652. $political_affiliation = '中共党员';
  1653. break;
  1654. case '02':
  1655. $political_affiliation = '中共预备党员';
  1656. break;
  1657. case '03':
  1658. $political_affiliation = '共青团员';
  1659. break;
  1660. case '04':
  1661. $political_affiliation = '民革党员';
  1662. break;
  1663. case '05':
  1664. $political_affiliation = '民盟盟员';
  1665. break;
  1666. case '06':
  1667. $political_affiliation = '民建会员';
  1668. break;
  1669. case '07':
  1670. $political_affiliation = '民进会员';
  1671. break;
  1672. case '08':
  1673. $political_affiliation = '农工党党员';
  1674. break;
  1675. case '09':
  1676. $political_affiliation = '致公党党员';
  1677. break;
  1678. case '10':
  1679. $political_affiliation = '九三学社社员';
  1680. break;
  1681. case '11':
  1682. $political_affiliation = '台盟盟员';
  1683. break;
  1684. case '12':
  1685. $political_affiliation = '无党派人士';
  1686. break;
  1687. case '13':
  1688. $political_affiliation = '群众';
  1689. }
  1690. $templateProcessor->setValue('family_political_affiliation#'.$i, $political_affiliation);
  1691. $templateProcessor->setValue('family_work#'.$i, $v['work']);
  1692. $i++;
  1693. }
  1694. }
  1695. $templateProcessor->setImageValue('avatar',['path' => 'http://www.jucai.gov.cn/'.$appoint->avatar, 'width' => 200, 'height' => 150]);
  1696. $filename = $appoint->realname . '_' . $appoint->card.'_' . $post_data->code . $post_data->name;
  1697. if(!is_dir(base_path() . "/storage/app/public/recruit/word/" . $recruit->name_en)){
  1698. Storage::makeDirectory("public/recruit/word/{$recruit->name_en}");
  1699. }
  1700. $word_url = "/{$filename}.docx";
  1701. $appoint->word_url = "/storage/recruit/word/" . $recruit->name_en .$word_url;
  1702. $appoint->save();
  1703. $templateProcessor->saveAs(base_path() . "/storage/app/public/recruit/word/" . $recruit->name_en . $word_url);//另存为
  1704. return "/storage/recruit/word/" . $recruit->name_en .$word_url;
  1705. }
  1706. }
  1707. /**
  1708. * 将报名资料导出成ZIP压缩包
  1709. * @param Request $request
  1710. * @return \Illuminate\Http\JsonResponse
  1711. * @throws \Exception
  1712. */
  1713. public function out_zip(Request $request)
  1714. {//TODO 数据太大,无法压缩,得做成异步
  1715. Permission::check('recruit_out_excel');
  1716. $recruit_id = $request->id;
  1717. $recruit = Recruit::find($recruit_id);
  1718. if (empty($recruit)) {
  1719. return response()->json(['status' => 0, 'msg' => '找不到对应的招考场次'], 200);
  1720. }
  1721. $data = $request->all();
  1722. $where = [];
  1723. $where[] = ['audit','>',0];
  1724. $where[] = ['recruit_appoint_info.recruit_id', '=', $data['id']];
  1725. $param = parse_url($data['where']);
  1726. parse_str($param['query'],$param);
  1727. if (is_array($param)) {
  1728. unset($param['id']);
  1729. foreach ($param as $k => $v) {
  1730. if ($k == 'realname') {
  1731. $where[] = [$k, 'like', "%$v%"];
  1732. } elseif ($k != '_pjax' and $k != 'page' && $k != 'perpage') {
  1733. $where[] = [$k, '=', $v];
  1734. }
  1735. }
  1736. }
  1737. $select = ['recruit_appoint_info.*', 'recruit_post.code', 'recruit_post.name'];
  1738. $model = RecruitAppointInfo::where($where)->join('recruit_post', 'recruit_appoint_info.post_id', '=', 'recruit_post.id', 'left');
  1739. if(in_array('expand_special',explode(',', $recruit->forms))){
  1740. $model->join('recruit_appoint_expand_special', 'recruit_appoint_expand_special.recruit_appoint_id', '=', 'recruit_appoint_info.id', 'left');
  1741. $special_select = ['recruit_appoint_expand_special.point_apply','recruit_appoint_expand_special.condition','recruit_appoint_expand_special.material'];
  1742. $select = array_merge($select,$special_select);
  1743. }
  1744. if(in_array('detail',explode(',', $recruit->forms))){
  1745. $model->join('recruit_appoint_detail', 'recruit_appoint_detail.recruit_appoint_id', '=', 'recruit_appoint_info.id', 'left');
  1746. $detail_select = ['recruit_appoint_detail.train','recruit_appoint_detail.rewards_and_punishments','recruit_appoint_detail.introduce'];
  1747. $select = array_merge($select,$detail_select);
  1748. }
  1749. $list = $model->select($select)
  1750. ->orderBy('recruit_appoint_info.updated_at','desc')
  1751. ->get();
  1752. if(!is_dir(base_path() . "/storage/app/public/recruit/zip")){
  1753. Storage::makeDirectory("public/recruit/zip");
  1754. }
  1755. if (file_exists(base_path() . '/storage/app/public/recruit/zip/' . $recruit->company . '.zip')) {
  1756. unlink(base_path() . '/storage/app/public/recruit/zip/' . $recruit->company . '.zip');
  1757. }
  1758. if($list){
  1759. // foreach ($list as $key => $value){
  1760. // $path = base_path() . "/storage/app/public/recruit/zip/{$recruit->company}/{$value->realname}_{$value->card}/";
  1761. // if(!is_dir($path)){
  1762. // Storage::makeDirectory("public/recruit/zip/{$recruit->company}/{$value->realname}_{$value->card}");
  1763. // }
  1764. // if(in_array('expand_special',explode(',', $recruit->forms))){
  1765. // $special = RecruitAppointExpandSpecial::where('recruit_appoint_id',$value->id)->first();
  1766. // $material = json_decode($special['material'],true);
  1767. // if($material){
  1768. // foreach ($material as $k => $v){
  1769. // $old_path = base_path() . "/public/" . $v['url'];
  1770. // if (file_exists($old_path)) {
  1771. // $basename = basename($old_path);
  1772. // $new_path = $path . $basename; //iconv("UTF-8", "GBK", $p->picture_name);
  1773. // copy($old_path, $new_path); //拷贝到新目录
  1774. // }
  1775. // }
  1776. // }
  1777. // }
  1778. // if(in_array('identification',explode(',', $recruit->forms))){
  1779. // $identification = json_decode($value->identification,true);
  1780. // if($identification){
  1781. // foreach ($identification as $k => $v){
  1782. // $old_path = base_path() . "/public/" . $v['url'];
  1783. // if (file_exists($old_path)) {
  1784. // $basename = basename($old_path);
  1785. // $new_path = $path . $basename; //iconv("UTF-8", "GBK", $p->picture_name);
  1786. // copy($old_path, $new_path); //拷贝到新目录
  1787. // }
  1788. // }
  1789. // }
  1790. // }
  1791. // if(in_array('education_certification',explode(',', $recruit->forms))){
  1792. // $education_certification = json_decode($value->education_certification,true);
  1793. // if($education_certification){
  1794. // foreach ($education_certification as $k => $v){
  1795. // $old_path = base_path() . "/public/" . $v['url'];
  1796. // if (file_exists($old_path)) {
  1797. // $basename = basename($old_path);
  1798. // $new_path = $path . $basename; //iconv("UTF-8", "GBK", $p->picture_name);
  1799. // copy($old_path, $new_path); //拷贝到新目录
  1800. // }
  1801. // }
  1802. // }
  1803. // }
  1804. // if(in_array('other_certification',explode(',', $recruit->forms))){
  1805. // $other_certification = json_decode($value->other_certification,true);
  1806. // if($other_certification){
  1807. // foreach ($other_certification as $k => $v){
  1808. // $old_path = base_path() . "/public/" . $v['url'];
  1809. // if (file_exists($old_path)) {
  1810. // $basename = basename($old_path);
  1811. // $new_path = $path . $basename; //iconv("UTF-8", "GBK", $p->picture_name);
  1812. // copy($old_path, $new_path); //拷贝到新目录
  1813. // }
  1814. // }
  1815. // }
  1816. // }
  1817. // copy(base_path() . "/public/" . $value->word_url, $path . basename($value->word_url));
  1818. // }
  1819. $savename = base_path() . "/storage/app/public/recruit/zip/{$recruit->company}.zip";
  1820. $zipper = new Zipper();
  1821. $folder = base_path() . "/storage/app/public/recruit/zip/{$recruit->company}/";//$public_path 被压缩的文件名
  1822. $zipper->make($savename)->add($folder)->close();//public_path($reduce_path) 压缩之后的文件名
  1823. // header("Content-Type: application/zip");
  1824. // header("Content-Transfer-Encoding: Binary");
  1825. // header("Content-Length: " . filesize($savename));
  1826. // header("Content-Disposition: attachment; filename=\"" . $savename . "\"");
  1827. //
  1828. // readfile($savename);
  1829. // exit;
  1830. return response()->json(['status' => 1, 'msg' => "/zip/{$recruit->name}.zip" ], 200);
  1831. }else{
  1832. return response()->json(['status' => 0, 'msg' => '没有搜索到相关人员'], 200);
  1833. }
  1834. }
  1835. /**
  1836. * 准考证生成界面
  1837. *
  1838. * @param Content $content
  1839. * @param Request $request
  1840. * @return Content
  1841. */
  1842. public function ticket(Content $content, Request $request)
  1843. {
  1844. $recruit_id = $request->id;
  1845. $recruit = Recruit::find($recruit_id);
  1846. return $content
  1847. ->header('准考证管理')
  1848. ->description('')
  1849. ->body(view('admin.recruit.ticket')->with(['recruit'=>$recruit]));
  1850. }
  1851. /**
  1852. * 导出excel汇总表
  1853. * @param Content $content
  1854. * @param Request $request
  1855. * @return \Illuminate\Http\JsonResponse
  1856. * @throws \PhpOffice\PhpSpreadsheet\Exception
  1857. * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
  1858. */
  1859. public function out_excel(Content $content, Request $request)
  1860. {
  1861. Permission::check('recruit_out_excel');
  1862. $id = $request->id;
  1863. $recruit = Recruit::find($id);
  1864. if (empty($recruit)) {
  1865. return response()->json(['status' => 0, 'msg' => '找不到对应的招考场次'], 200);
  1866. }
  1867. $data = $request->all();
  1868. $where = [];
  1869. $where[] = ['audit','>',0];
  1870. $where[] = ['recruit_appoint_info.recruit_id', '=', $data['id']];
  1871. $param = parse_url($data['where']);
  1872. parse_str($param['query'],$param);
  1873. if (is_array($param)) {
  1874. unset($param['id']);
  1875. foreach ($param as $k => $v) {
  1876. if ($k == 'realname') {
  1877. $where[] = [$k, 'like', "%$v%"];
  1878. } elseif ($k != '_pjax' and $k != 'page' && $k != 'perpage') {
  1879. $where[] = [$k, '=', $v];
  1880. }
  1881. }
  1882. }
  1883. $select = ['recruit_appoint_info.*', 'recruit_post.code', 'recruit_post.name'];
  1884. $model = RecruitAppointInfo::where($where)->join('recruit_post', 'recruit_appoint_info.post_id', '=', 'recruit_post.id', 'left');
  1885. if(in_array('expand_special',explode(',', $recruit->forms))){
  1886. $model->join('recruit_appoint_expand_special', 'recruit_appoint_expand_special.recruit_appoint_id', '=', 'recruit_appoint_info.id', 'left');
  1887. $special_select = ['recruit_appoint_expand_special.point_apply','recruit_appoint_expand_special.condition','recruit_appoint_expand_special.material'];
  1888. $select = array_merge($select,$special_select);
  1889. }
  1890. if(in_array('detail',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1891. $model->join('recruit_appoint_detail', 'recruit_appoint_detail.recruit_appoint_id', '=', 'recruit_appoint_info.id', 'left');
  1892. $detail_select = ['recruit_appoint_detail.train','recruit_appoint_detail.rewards_and_punishments','recruit_appoint_detail.introduce'];
  1893. $select = array_merge($select,$detail_select);
  1894. }
  1895. $list = $model->select($select)
  1896. ->orderBy('recruit_appoint_info.updated_at','desc')
  1897. ->get();
  1898. if(count($list)){
  1899. $spreadsheet = new Spreadsheet();
  1900. $sheet = $spreadsheet->getActiveSheet();
  1901. if(in_array('internship',explode(',', $recruit->forms))){
  1902. $header = ['姓名','性别','生日','头像','民族','籍贯','报名岗位','政治面貌','入党时间','户籍所在地','年级','就读院校','所学专业','是否接受调剂','通信地址','身份证号码','联系电话','电子邮箱','紧急联系人','紧急联系电话'];
  1903. }else{
  1904. $header = ['姓名','性别','生日','头像','民族','籍贯','报考岗位','政治面貌','入党时间','职称或职业资格','现工作单位及职务','户籍所在地','学历','学校','学位','所学专业','通信地址','身份证号码','联系电话','电子邮箱','紧急联系人','紧急联系电话'];
  1905. }
  1906. if(in_array('expand_special',explode(',', $recruit->forms))){
  1907. $special = ['是否申请加分','符合哪一项加分条件','加分佐证材料'];
  1908. $header = array_merge($header,$special);
  1909. }
  1910. if(in_array('detail',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1911. $detail = ['个人简历','培训学习经历','奖惩情况','个人介绍'];
  1912. }else{
  1913. $detail = ['个人简历'];
  1914. }
  1915. $header = array_merge($header,$detail);
  1916. $header[] = '家庭成员及其社会关系';
  1917. if(in_array('identification',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1918. $header[] = '身份证明';
  1919. }
  1920. if(in_array('education_certification',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1921. $header[] = '学历证明';
  1922. }
  1923. if(in_array('other_certification',explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))){
  1924. $header[] = '其他证明';
  1925. }
  1926. $header[] = '审核状态';
  1927. $header[] = '审核意见';
  1928. // if(in_array('3',explode(',', $recruit->step))){
  1929. // $header = array_merge($header,['笔试准考证打印','笔试审核状态','笔试结果']);
  1930. // }
  1931. // if(in_array('4',explode(',', $recruit->step))){
  1932. // $header = array_merge($header,['上机准考证打印','上机审核状态','上机结果']);
  1933. // }
  1934. // if(in_array('5',explode(',', $recruit->step))){
  1935. // $header = array_merge($header,['面试准考证打印','面试审核状态','面试结果']);
  1936. // }
  1937. // if(in_array('6',explode(',', $recruit->step))){
  1938. // $header = array_merge($header,['复试准考证打印','复试审核状态','复试结果']);
  1939. // }
  1940. // if(in_array('7',explode(',', $recruit->step))){
  1941. // $header = array_merge($header,['体检审核状态','体检结果']);
  1942. // }
  1943. // if(in_array('8',explode(',', $recruit->step))){
  1944. // $header = array_merge($header,['政审状态','政审结果']);
  1945. // }
  1946. $header[] = 'word简历的下载地址';
  1947. foreach ($header as $key => $value) {
  1948. $sheet->setCellValueByColumnAndRow($key+1, 1, $value);
  1949. }
  1950. $row = 2;
  1951. $sheet->getStyle('S')->getNumberFormat()->setFormatCode('0');
  1952. $length = count($list);//算出该数组的长度
  1953. $last = $list[$length-1];//取出最后一个数组的值,复制给新变量,-1是因为第一个数组元素下表为0
  1954. unset($list[$length-1]);//将最后一个数组注销
  1955. $list[] = $last;//再将新变量加入到数组里
  1956. $data = [];
  1957. foreach ($list as $k => $v) {
  1958. switch ($v->political_affiliation) {
  1959. case '01':
  1960. $political_affiliation = '中共党员';
  1961. break;
  1962. case '02':
  1963. $political_affiliation = '中共预备党员';
  1964. break;
  1965. case '03':
  1966. $political_affiliation = '共青团员';
  1967. break;
  1968. case '04':
  1969. $political_affiliation = '民革党员';
  1970. break;
  1971. case '05':
  1972. $political_affiliation = '民盟盟员';
  1973. break;
  1974. case '06':
  1975. $political_affiliation = '民建会员';
  1976. break;
  1977. case '07':
  1978. $political_affiliation = '民进会员';
  1979. break;
  1980. case '08':
  1981. $political_affiliation = '农工党党员';
  1982. break;
  1983. case '09':
  1984. $political_affiliation = '致公党党员';
  1985. break;
  1986. case '10':
  1987. $political_affiliation = '九三学社社员';
  1988. break;
  1989. case '11':
  1990. $political_affiliation = '台盟盟员';
  1991. break;
  1992. case '12':
  1993. $political_affiliation = '无党派人士';
  1994. break;
  1995. case '13':
  1996. $political_affiliation = '群众';
  1997. break;
  1998. default:
  1999. $political_affiliation = '未知';
  2000. break;
  2001. }
  2002. if(in_array('internship',explode(',', $recruit->forms))){
  2003. $header = ['姓名','性别','生日','头像','民族','籍贯','报名岗位','政治面貌','入党时间','户籍所在地','年级','就读院校','所学专业','是否接受调剂','通信地址','身份证号码','联系电话','电子邮箱','紧急联系人','紧急联系电话'];
  2004. $item = [
  2005. $v->realname,
  2006. $v->sex == 0 ? '女' : '男',
  2007. $v->birthday,
  2008. "https://www.jucai.gov.cn" . $v->avatar,
  2009. $v->nation,
  2010. $v->native_place,
  2011. $v->code . $v->name,
  2012. $political_affiliation,
  2013. $v->join_time,
  2014. $v->house_register,
  2015. $v->education,
  2016. $v->school,
  2017. $v->pro,
  2018. $v->adjust == 0 ? '否' : '是',
  2019. $v->address,
  2020. '\''.$v->card,
  2021. $v->mobile,
  2022. $v->email,
  2023. $v->concat_name,
  2024. $v->concat_mobile
  2025. ];
  2026. }else{
  2027. $item = [
  2028. $v->realname,
  2029. $v->sex == 0 ? '女' : '男',
  2030. $v->birthday,
  2031. "https://www.jucai.gov.cn" . $v->avatar,
  2032. $v->nation,
  2033. $v->native_place,
  2034. $v->code . $v->name,
  2035. $political_affiliation,
  2036. $v->join_time,
  2037. $v->titles,
  2038. $v->work,
  2039. $v->house_register,
  2040. $v->education,
  2041. $v->school,
  2042. $v->degree,
  2043. $v->pro,
  2044. $v->address,
  2045. '\''.$v->card,
  2046. $v->mobile,
  2047. $v->email,
  2048. $v->concat_name,
  2049. $v->concat_mobile
  2050. ];
  2051. }
  2052. if (in_array('expand_special', explode(',', $recruit->forms))) {
  2053. $material = json_decode($v->material, true);
  2054. $materials = [];
  2055. if($material){
  2056. foreach ($material as $key => $value) {
  2057. array_push($materials, "https://www.jucai.gov.cn" . $value['response']['path']);
  2058. }
  2059. }
  2060. $special = [
  2061. $v->point_apply == 0 ? '否' : '是',
  2062. $v->condition,
  2063. implode("\r\n", $materials)
  2064. ];
  2065. $item = array_merge($item, $special);
  2066. }
  2067. if (in_array('detail', explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))) {
  2068. $detail = [
  2069. $v->resume,
  2070. $v->train,
  2071. $v->rewards_and_punishments,
  2072. $v->introduce
  2073. ];
  2074. } else {
  2075. $detail = [$v->resume];
  2076. }
  2077. $item = array_merge($item, $detail);
  2078. $family = json_decode($v->family, true);
  2079. $familys = [];
  2080. foreach ($family as $val){
  2081. switch ($val['political_affiliation']) {
  2082. case '01':
  2083. $political_affiliation = '中共党员';
  2084. break;
  2085. case '02':
  2086. $political_affiliation = '中共预备党员';
  2087. break;
  2088. case '03':
  2089. $political_affiliation = '共青团员';
  2090. break;
  2091. case '04':
  2092. $political_affiliation = '民革党员';
  2093. break;
  2094. case '05':
  2095. $political_affiliation = '民盟盟员';
  2096. break;
  2097. case '06':
  2098. $political_affiliation = '民建会员';
  2099. break;
  2100. case '07':
  2101. $political_affiliation = '民进会员';
  2102. break;
  2103. case '08':
  2104. $political_affiliation = '农工党党员';
  2105. break;
  2106. case '09':
  2107. $political_affiliation = '致公党党员';
  2108. break;
  2109. case '10':
  2110. $political_affiliation = '九三学社社员';
  2111. break;
  2112. case '11':
  2113. $political_affiliation = '台盟盟员';
  2114. break;
  2115. case '12':
  2116. $political_affiliation = '无党派人士';
  2117. break;
  2118. case '13':
  2119. $political_affiliation = '群众';
  2120. break;
  2121. default:
  2122. $political_affiliation = '未知';
  2123. break;
  2124. }
  2125. $familys[] = "称谓:" . $val['relation'] . ";姓名:".$val['realname'] . ';生日:'.$val['birthday'].';政治面貌:'.$political_affiliation.';职业:'.$val['work'];
  2126. }
  2127. $item[] = implode("\r\n", $familys);
  2128. if (in_array('identification', explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))) {
  2129. $identification = json_decode($v->identification, true);
  2130. $identifications = [];
  2131. foreach ($identification as $val){
  2132. array_push($identifications,"https://www.jucai.gov.cn" . $val['response']['path']);
  2133. }
  2134. array_push($item, implode("\r\n", $identifications));
  2135. }
  2136. if (in_array('education_certification', explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))) {
  2137. $education_certification = json_decode($v->education_certification, true);
  2138. $education_certifications = [];
  2139. foreach ($education_certification as $val){
  2140. array_push($education_certifications,"https://www.jucai.gov.cn" . $val['response']['path']);
  2141. }
  2142. array_push($item, implode("\r\n", $education_certifications));
  2143. }
  2144. if (in_array('other_certification', explode(',', $recruit->forms)) || in_array('internship',explode(',', $recruit->forms))) {
  2145. $other_certification = json_decode($v->other_certification, true);
  2146. $other_certifications = [];
  2147. if($other_certification){
  2148. foreach ($other_certification as $val){
  2149. array_push($other_certifications,"https://www.jucai.gov.cn" . $val['response']['path']);
  2150. }
  2151. }
  2152. array_push($item, implode("\r\n", $other_certifications));
  2153. }
  2154. switch (intval($v->audit)){
  2155. case 1:
  2156. $item[] = '审核中';
  2157. $item[] = '';
  2158. break;
  2159. case 2:
  2160. case 3:
  2161. $log = RecruitAppointLog::where('appoint_id', $v->id)->where('step', 1)->where('type', 2)->orderBy('created_at', 'desc')->first();
  2162. if ($log) {
  2163. $log_arr = explode(',',$log->log);
  2164. $item[] = $log_arr[0];
  2165. $item[] = $log_arr[1];
  2166. } else {
  2167. $item[] = '';
  2168. $item[] = '';
  2169. }
  2170. break;
  2171. default:
  2172. $item[] = '';
  2173. $item[] = '';
  2174. break;
  2175. }
  2176. if(empty($v->word_url)){
  2177. $item[] = "暂无";
  2178. }else{
  2179. $item[] = "https://www.jucai.gov.cn/" . $v->word_url;
  2180. }
  2181. array_push($data,$item);
  2182. }
  2183. foreach($data as $k => $v){
  2184. for ($i = 0;$i<count($v);$i++){
  2185. if($i == 18 || $i == 19 || $i == 22){
  2186. $sheet->setCellValueExplicitByColumnAndRow($i+1, $row, $v[$i], DataType::TYPE_STRING);
  2187. }else{
  2188. $sheet->setCellValueByColumnAndRow($i+1, $row, $v[$i]);
  2189. }
  2190. }
  2191. $row++;
  2192. }
  2193. $file_name = $recruit->name . date("Y-m-d",time());
  2194. header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  2195. header('Content-Disposition: attachment;filename="'.$file_name.'.xlsx"');
  2196. header('Cache-Control: max-age=0');
  2197. // If you're serving to IE 9, then the following may be needed
  2198. header('Cache-Control: max-age=1');
  2199. // If you're serving to IE over SSL, then the following may be needed
  2200. header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
  2201. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
  2202. header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
  2203. header('Pragma: public'); // HTTP/1.0
  2204. $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
  2205. $writer->save('php://output');
  2206. }else{
  2207. return response()->json(['status' => 0, 'msg' => '没有搜索到相关人员'], 200);
  2208. }
  2209. }
  2210. /**
  2211. * 座位贴
  2212. * @param Content $content
  2213. * @param Request $request
  2214. * @return Content
  2215. */
  2216. public function seat_sticker(Content $content, Request $request){
  2217. $recruit_id = $request->id;
  2218. $list = RecruitAppointInfo::where(['recruit_appoint_info.recruit_id' => $recruit_id,'recruit_appoint_info.audit' => 3, 'recruit_ticket.ex_type' => 1])
  2219. ->join('recruit_ticket', 'recruit_ticket.appoint_id', '=', 'recruit_appoint_info.id','left')
  2220. ->select('recruit_appoint_info.*','recruit_ticket.*')
  2221. ->orderBy('recruit_ticket.ex_room','asc')
  2222. ->orderBy('recruit_ticket.ex_seat','asc')
  2223. ->get();
  2224. $data = [];
  2225. foreach ($list as $k => $v){
  2226. $room = $v->ex_room == null ? 'empty' : $v->ex_room;
  2227. if(!array_key_exists($room,$data)){
  2228. $data[$room] = [];
  2229. }
  2230. $item = [
  2231. 'avatar' => $v->avatar,
  2232. 'seat' => $v->ex_seat,
  2233. 'realname' => $v->realname,
  2234. 'number' => $v->ex_number
  2235. ];
  2236. array_push($data[$room],$item);
  2237. }
  2238. //dd($data);
  2239. return $content->body(view('admin.recruit.seat_sticker')->with(['data' => $data]));
  2240. }
  2241. public function sign_table(Content $content, Request $request){
  2242. $recruit_id = $request->id;
  2243. $list = RecruitAppointInfo::where(['recruit_appoint_info.recruit_id' => $recruit_id,'recruit_appoint_info.audit' => 3, 'recruit_ticket.ex_type' => 1])
  2244. ->join('recruit_ticket', 'recruit_ticket.appoint_id', '=', 'recruit_appoint_info.id','left')
  2245. ->select('recruit_appoint_info.*','recruit_ticket.*')
  2246. ->orderBy('recruit_ticket.ex_room','asc')
  2247. ->orderBy('recruit_ticket.ex_seat','asc')
  2248. ->get();
  2249. $data = [];
  2250. foreach ($list as $k => $v){
  2251. $room = $v->ex_room == null ? 'empty' : $v->ex_room;
  2252. if(!array_key_exists($room,$data)){
  2253. $data[$room] = [];
  2254. }
  2255. $item = [
  2256. 'avatar' => $v->avatar,
  2257. 'seat' => $v->ex_seat,
  2258. 'realname' => $v->realname
  2259. ];
  2260. array_push($data[$room],$item);
  2261. }
  2262. return $content->body(view('admin.recruit.sign_table')->with(['data' => $data]));
  2263. }
  2264. /**
  2265. * 上传成绩页面
  2266. *
  2267. * @access public
  2268. */
  2269. public function ajax_record(Request $request)
  2270. {
  2271. $recruit_id = $request->input('recruit_id');
  2272. if(!$recruit_id){
  2273. return response()->json(['status' => 0, 'msg' => '请指定招考场次'], 200);
  2274. }
  2275. $recruit = Recruit::where('id',$recruit_id)->first();
  2276. if(empty($recruit)){
  2277. return response()->json(['status' => 0, 'msg' => '找不到对应招考场次'], 200);
  2278. }
  2279. $view_data = [
  2280. 'recruit' => $recruit
  2281. ];
  2282. return response(['data' => view('admin.recruit.ajax_record')->with($view_data)->render(), 'status' => 1], '200');
  2283. }
  2284. public function update_record(Request $request)
  2285. {
  2286. $data = $request->all();
  2287. if(!array_key_exists('recruit_id',$data) || !$data['recruit_id']){
  2288. return response()->json(['status' => 0, 'msg' => '请指定招考场次'], 200);
  2289. }
  2290. $recruit = Recruit::where('id',$data['recruit_id'])->first();
  2291. if(empty($recruit)){
  2292. return response()->json(['status' => 0, 'msg' => '找不到对应招考场次'], 200);
  2293. }
  2294. if(array_key_exists('pen_data',$data)){
  2295. $ticket_url = base_path() . "/storage/app/public/recruit/ticket/" . uniqid() . '.xlsx';
  2296. if(move_uploaded_file($_FILES['pen_data']['tmp_name'],$ticket_url)){
  2297. $spreadsheet = IOFactory::load($ticket_url);
  2298. $sheet = $spreadsheet->getActiveSheet();
  2299. $rowCount = $sheet->getHighestRow();
  2300. $record = [];
  2301. for($row = 2;$row<=$rowCount;$row++){
  2302. $record[$sheet->getCell("A{$row}")->getValue()] = [
  2303. 'id' => $sheet->getCell("A{$row}")->getValue(),
  2304. 'realname' => $sheet->getCell("B{$row}")->getValue(),
  2305. 'card' => $sheet->getCell("C{$row}")->getValue(),
  2306. 'ex_number' => $sheet->getCell("E{$row}")->getValue(),
  2307. 'record' => $sheet->getCell("F{$row}")->getValue(),
  2308. 'next' => $sheet->getCell("G{$row}")->getValue()
  2309. ];
  2310. }
  2311. Recruit::where('id',$data['recruit_id'])->update(['pen_status' => 1]);
  2312. $record = new TicketJob($data['recruit_id'],'pen_result',$record);
  2313. dispatch($record);
  2314. return response()->json(['status' => 1, 'msg' => '成绩上传成功'], 200);
  2315. }else{
  2316. return response()->json(['status' => 0, 'msg' => '成绩上传失败'], 200);
  2317. }
  2318. }else{
  2319. return response()->json(['status' => 0, 'msg' => '笔试成绩不存在'], 200);
  2320. }
  2321. }
  2322. public function create_record_template(Request $request){
  2323. $recruit_id = $request->input('recruit_id');
  2324. if(!$recruit_id){
  2325. return response()->json(['status' => 0, 'msg' => '请指定招考场次'], 200);
  2326. }
  2327. $recruit = Recruit::where('id',$recruit_id)->first();
  2328. if(empty($recruit)){
  2329. return response()->json(['status' => 0, 'msg' => '找不到对应招考场次'], 200);
  2330. }
  2331. $type = $request->input('type','pen');
  2332. switch ($type){
  2333. case 'pen':
  2334. $list = RecruitAppointInfo::where('recruit_appoint_info.recruit_id',$recruit_id)
  2335. ->where('recruit_appoint_info.audit',3)
  2336. ->where('recruit_appoint_info.pen_audit',-1)
  2337. ->join('recruit_ticket', 'recruit_appoint_info.id', '=', 'recruit_ticket.appoint_id')
  2338. ->select('recruit_appoint_info.*','recruit_ticket.ex_number')->orderBy('post_id','asc')->get();
  2339. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  2340. $data = [];
  2341. foreach ($list as $k => $v){
  2342. $item = [
  2343. $v->id,
  2344. $v->realname,
  2345. $v->card,
  2346. $post_data[$v->post_id],
  2347. $v->ex_number
  2348. ];
  2349. array_push($data,$item);
  2350. }
  2351. $spreadsheet = IOFactory::load(base_path() . '/storage/app/public/recruit/ticket/template/record_data_template.xlsx');
  2352. $sheet = $spreadsheet->getActiveSheet();
  2353. $row = 2;
  2354. foreach($data as $k => $v){
  2355. for ($i = 0;$i<count($v);$i++){
  2356. if($i == 2 || $i == 4){
  2357. $sheet->setCellValueExplicitByColumnAndRow($i+1, $row, $v[$i], DataType::TYPE_STRING);
  2358. }else{
  2359. $sheet->setCellValueByColumnAndRow($i+1, $row, $v[$i]);
  2360. }
  2361. }
  2362. $row++;
  2363. }
  2364. $file_name = $recruit->company . "_成绩表模板";
  2365. header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  2366. header('Content-Disposition: attachment;filename="'.$file_name.'.xlsx"');
  2367. header('Cache-Control: max-age=0');
  2368. // If you're serving to IE 9, then the following may be needed
  2369. header('Cache-Control: max-age=1');
  2370. // If you're serving to IE over SSL, then the following may be needed
  2371. header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
  2372. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
  2373. header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
  2374. header('Pragma: public'); // HTTP/1.0
  2375. $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
  2376. $writer->save('php://output');
  2377. break;
  2378. case 'face':
  2379. $list = RecruitAppointInfo::where('recruit_appoint_info.recruit_id',$recruit_id)
  2380. ->where('recruit_appoint_info.audit',3)
  2381. ->where('recruit_appoint_info.face_audit',-1)
  2382. ->where(function($query){
  2383. $query->where('recruit_appoint_info.pen_audit',1)
  2384. ->orWhere('recruit_appoint_info.pen_audit',3);
  2385. })
  2386. ->join('recruit_ticket', 'recruit_appoint_info.id', '=', 'recruit_ticket.appoint_id')->select('recruit_appoint_info.*','recruit_ticket.ex_number')->orderBy('post_id','asc')->get();
  2387. $post_data = RecruitPost::where('recruit_id',$recruit_id)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  2388. $data = [];
  2389. foreach ($list as $k => $v){
  2390. $item = [
  2391. $v->id,
  2392. $v->realname,
  2393. $v->card,
  2394. $post_data[$v->post_id],
  2395. $v->ex_number
  2396. ];
  2397. array_push($data,$item);
  2398. }
  2399. $spreadsheet = IOFactory::load(base_path() . '/storage/app/public/recruit/ticket/template/record_data_template.xlsx');
  2400. $sheet = $spreadsheet->getActiveSheet();
  2401. $row = 2;
  2402. foreach($data as $k => $v){
  2403. for ($i = 0;$i<count($v);$i++){
  2404. if($i == 2 || $i == 4){
  2405. $sheet->setCellValueExplicitByColumnAndRow($i+1, $row, $v[$i], DataType::TYPE_STRING);
  2406. }else{
  2407. $sheet->setCellValueByColumnAndRow($i+1, $row, $v[$i]);
  2408. }
  2409. }
  2410. $row++;
  2411. }
  2412. $file_name = $recruit->company . "_成绩表模板";
  2413. header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  2414. header('Content-Disposition: attachment;filename="'.$file_name.'.xlsx"');
  2415. header('Cache-Control: max-age=0');
  2416. // If you're serving to IE 9, then the following may be needed
  2417. header('Cache-Control: max-age=1');
  2418. // If you're serving to IE over SSL, then the following may be needed
  2419. header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
  2420. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
  2421. header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
  2422. header('Pragma: public'); // HTTP/1.0
  2423. $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
  2424. $writer->save('php://output');
  2425. break;
  2426. }
  2427. }
  2428. public function create_ticket(Request $request)
  2429. {
  2430. $data = $request->only('recruit_id','type','channel','content','keys');
  2431. //dd($data);
  2432. }
  2433. public function test(Request $request){
  2434. $list = RecruitSupplement::where('recruit_supplement.status',1)
  2435. ->join('recruit_appoint_info', 'recruit_supplement.appoint_id', '=' , 'recruit_appoint_info.id', 'left')
  2436. ->select('recruit_appoint_info.*')
  2437. ->get();
  2438. $post_data = RecruitPost::where('recruit_id',5)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  2439. $header = ['姓名','性别','年龄','联系电话','身份证号码','岗位'];
  2440. $spreadsheet = new Spreadsheet();
  2441. $sheet = $spreadsheet->getActiveSheet();
  2442. foreach ($header as $key => $value) {
  2443. $sheet->setCellValueByColumnAndRow($key+1, 1, $value);
  2444. }
  2445. foreach($list as $k => $v){
  2446. $sheet->setCellValueByColumnAndRow(1, $k+2, $v->realname);
  2447. $sheet->setCellValueByColumnAndRow(2, $k+2, $v->sex == 0 ? '女' : '男');
  2448. $time = explode('-',$v->birthday);
  2449. $sheet->setCellValueByColumnAndRow(3, $k+2, 2021-$time[0]);
  2450. $sheet->setCellValueExplicitByColumnAndRow(4, $k+2, $v->mobile, DataType::TYPE_STRING);
  2451. $sheet->setCellValueExplicitByColumnAndRow(5, $k+2, $v->card, DataType::TYPE_STRING);
  2452. $sheet->setCellValueByColumnAndRow(6, $k+2, $post_data[$v->post_id]);
  2453. }
  2454. $file_name = '名单';
  2455. header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  2456. header('Content-Disposition: attachment;filename="'.$file_name.'.xlsx"');
  2457. header('Cache-Control: max-age=0');
  2458. // If you're serving to IE 9, then the following may be needed
  2459. header('Cache-Control: max-age=1');
  2460. // If you're serving to IE over SSL, then the following may be needed
  2461. header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
  2462. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
  2463. header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
  2464. header('Pragma: public'); // HTTP/1.0
  2465. $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
  2466. $writer->save('php://output');
  2467. dd($list);
  2468. // $ids = [6,7,121,47,181,66,108,138,21,212,177,130,114,27,63,31,51];
  2469. // $data = RecruitAppointInfo::whereIn('id',$ids)->get();
  2470. // $post_data = RecruitPost::where('recruit_id',1)->where('status',1)->selectRaw('id, CONCAT(code," ",name) as post')->pluck('post', 'id');
  2471. //
  2472. //
  2473. // foreach ($data as $k => $v){
  2474. // $templateProcessor = new TemplateProcessor(base_path() . "/storage/app/public/recruit/ticket/template/jjhc_face_ticket.docx");
  2475. // $templateProcessor->setValue('realname', $v->realname);
  2476. // $templateProcessor->setValue('card', $v->card);
  2477. // $templateProcessor->setValue('post', $post_data[$v->post_id]);
  2478. // $name = 'jjhc';
  2479. // $date = '2020-11-30';
  2480. // if(!is_dir(base_path() . "/storage/app/public/recruit/ticket/word/{$date}/{$name}/face")){
  2481. // Storage::makeDirectory("public/recruit/ticket/word/{$date}/{$name}/face");
  2482. // }
  2483. // $filename = $v->realname . '_' . $v->card . '_' . $post_data[$v->post_id];
  2484. // $word_url = base_path() . "/storage/app/public/recruit/ticket/word/{$date}/{$name}/face/" . $filename . '.docx';
  2485. // $templateProcessor->saveAs($word_url);//另存为
  2486. // }
  2487. // $templateProcessor = new TemplateProcessor(base_path() . "/storage/app/public/recruit/ticket/template/jjhc_pen_ticket.docx");
  2488. //
  2489. //
  2490. // $templateProcessor->setImageValue('avatar',['path' => 'https://www.jucai.gov.cn/storage/-1ae05561c7f32869.jpg', 'width' => 200, 'height' => 150]);
  2491. // $templateProcessor->saveAs(base_path() . "/storage/app/public/recruit/ticket/template/test.docx");//另存为
  2492. //shell_exec('libreoffice6.4 --headless --convert-to pdf:writer_pdf_Export ' . base_path() . "/storage/app/public/recruit/ticket/template/test.docx " . base_path() ."/storage/app/public/recruit/ticket/template/test.pdf");
  2493. //libreoffice --headless --convert-to pdf:writer_pdf_Export /data/wwwroot/jucai/storage/app/public/recruit/word/2020-11-30/jjhc/pen/*.docx --outdir /data/wwwroot/jucai/storage/app/public/recruit/pdf/2020-11-30/jjhc/pen
  2494. }
  2495. }