RecruitController.php 125 KB

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