RecruitController.php 150 KB

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