RecruitController.php 150 KB

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