RecruitController.php 150 KB

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