Talent.php 91 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use app\common\api\ChuanglanSmsApi;
  5. use app\common\api\VerifyApi;
  6. use app\common\api\TalentLogApi;
  7. use app\common\api\TalentState;
  8. use app\common\controller\Api;
  9. use app\common\model\MessageRecord;
  10. use app\enterprise\model\Talent as TalentModel;
  11. use app\common\api\TalentConditionApi;
  12. use app\common\api\DictApi;
  13. use app\common\api\EnterpriseApi;
  14. use think\facade\Db;
  15. use app\admin\model\User;
  16. use app\common\api\MenuApi;
  17. use app\admin\model\Menu;
  18. use app\admin\model\SysRelation;
  19. use app\common\api\CompanyApi;
  20. use app\common\state\ProjectState;
  21. use app\admin\api\RsApi;
  22. use app\admin\model\ApiData;
  23. /**
  24. * Description of Talent
  25. *
  26. * @author sgq
  27. */
  28. class Talent extends AdminController {
  29. public function common_check() {
  30. $request = $this->request;
  31. $params = $request->param();
  32. $id = $params["id"];
  33. $process = $params["process"];
  34. $info = VerifyApi::getTalentInfoById($id, true);
  35. $force = intval($this->request['force'], 0);
  36. $api_data = ApiData::where('uid', '=', $info['card_number'])->where('action', '=', 'rending')->where('status', '=', 1)->find(); //
  37. // $api_test = [
  38. // 'code' => 200,
  39. // 'data' => [
  40. // 'list' => [
  41. // [
  42. // "aae022" => 150.8,
  43. // "aae020" => 301.6,
  44. // "aae003" => 201911,
  45. // "aab034" => "晋江市社会劳动保险中心",
  46. // "aae002" => 201912,
  47. // "aab004" => "福建省晋江人力资本有限公司",
  48. // "aaa115" => "正常应缴",
  49. // "aae180" => 1885,
  50. // ],
  51. // [
  52. // "aae022" => 150.8,
  53. // "aae020" => 301.6,
  54. // "aae003" => 201912,
  55. // "aab034" => "晋江市社会劳动保险中心",
  56. // "aae002" => 201912,
  57. // "aab004" => "福建省晋江人力资本有限公司",
  58. // "aaa115" => "正常应缴",
  59. // "aae180" => 1885,
  60. // ]
  61. // ],
  62. // 'totalCount' => 70
  63. // ]
  64. // ];
  65. // $tmp_time = explode(' - ',$info['tax_insurance_month']);
  66. // $formatDate = formatDateByMonth($tmp_time[0],$tmp_time[1],$api_test['data']['list']);
  67. // $str = '';
  68. // foreach ($formatDate as $item){
  69. // $str .= $item . "<br />";
  70. // }
  71. // $info['shenbao'] = "该人员社保填写日期为{$tmp_time[0]}至{$tmp_time[1]},共" . count($formatDate) . "个月,接口返回{$api_test['data']['totalCount']}个月数据,分别为:<br />$str";
  72. //dd($tmp_time,diffDate($tmp_time[0],$tmp_time[1]));
  73. if ($force || !$api_data || !$api_data['status']) {
  74. ApiData::where('uid', '=', $info['card_number'])->where('action', '=', 'rending')->where('status', '=', 1)->update(['status' => 0, 'updateTime' => time()]);
  75. $rsapi = new RsApi();
  76. if ($info['card_type'] == 1) {
  77. $content = [];
  78. $info['rs']['I010902'] = $content['I010902'] = $rsapi->I010902($info['card_number']);
  79. $info['rs']['I030101'] = $content['I030101'] = $rsapi->I030101($info['card_number']);
  80. /* * ***********************处理养老缴费判断开始*************** */
  81. if (!empty($info['tax_insurance_month'])) {
  82. $tmp_time = explode(' - ', $info['tax_insurance_month']);
  83. $content['YL00018'] = $rsapi->YL00018($info['card_number'], str_replace('-', '', $tmp_time[0]), str_replace('-', '', $tmp_time[1]));
  84. $formatDate = formatDateByMonth($tmp_time[0], $tmp_time[1], $content['YL00018']['data']['list']);
  85. $str = '';
  86. foreach ($formatDate as $tmp_item) {
  87. $str .= $tmp_item . "<br />";
  88. }
  89. if (count($formatDate) == $content['YL00018']['data']['totalCount']) {
  90. $content['YL00018']['status'] = 'success';
  91. } else {
  92. $content['YL00018']['status'] = 'warning';
  93. }
  94. $content['YL00018']['content'] = "该人员社保填写日期为{$tmp_time[0]}至{$tmp_time[1]},共" . count($formatDate) . "个月,接口返回{$content['YL00018']['data']['totalCount']}个月数据,分别为:<br />$str";
  95. $info['rs']['YL00018'] = $content['YL00018'];
  96. unset($tmp_time);
  97. unset($tmp_item);
  98. }
  99. /* * ***********************处理养老缴费判断结束*************** */
  100. /* * ***********************处理职业资格证书开始*************** */
  101. if (!empty($info['pro_qua'])) {
  102. $content['SBJ0007'] = $rsapi->SBJ0007($info['name'], $info['card_number']);
  103. if ($content['SBJ0007']['data']['totalCount'] > 0) {
  104. $tmp_str = '';
  105. foreach ($content['SBJ0007']['data']['list'] as $tmp_item) {
  106. $tmp_str .= "职业资格名称:{$tmp_item['ksmc']};级别名称:{$tmp_item['jbmc']};专业名称:{$tmp_item['zymc']}<br />";
  107. }
  108. $content['SBJ0007']['content'] = "该人员共有{$content['SBJ0007']['data']['totalCount']}条职业资格证书记录,分别为:<br />{$tmp_str}";
  109. } else {
  110. $content['SBJ0007']['content'] = "该人员查不到职业资格证书记录";
  111. }
  112. $info['rs']['SBJ0007'] = $content['SBJ0007'];
  113. }
  114. /* * ***********************处理职业资格证书结束*************** */
  115. /* * ***********************处理高校教育信息开始*************** */
  116. if (!empty($info['highest_degree'])) {
  117. $content['SBJ0004'] = $rsapi->SBJ0004($info['name'], $info['card_number']);
  118. if ($content['SBJ0004']['data']['totalCount'] > 0) {
  119. $tmp_str = '';
  120. foreach ($content['SBJ0004']['data']['list'] as $tmp_item) {
  121. $tmp_str .= "层次:{$tmp_item['cc']};毕业学校名称:{$tmp_item['yxmc']}({$tmp_item['rxrq']}-{$tmp_item['byrq']});专业名称:{$tmp_item['zymc']};学习形式:{$tmp_item['xxxs']};编号:{$tmp_item['zsbh']}<br />";
  122. }
  123. $content['SBJ0004']['content'] = "该人员共有{$content['SBJ0004']['data']['totalCount']}条高校教育,分别为:<br />{$tmp_str}";
  124. } else {
  125. $content['SBJ0004']['content'] = "该人员查不到高校教育信息";
  126. }
  127. $info['rs']['SBJ0004'] = $content['SBJ0004'];
  128. }
  129. /* * ***********************处理高校教育信息结束*************** */
  130. $api_model_data = [
  131. 'uid' => $info['card_number'],
  132. 'action' => 'rending',
  133. 'content' => serialize($content),
  134. 'createTime' => time()
  135. ];
  136. ApiData::create($api_model_data);
  137. }
  138. } else {
  139. $content = unserialize($api_data['content']);
  140. if (array_key_exists('YL00018', $content)) {
  141. $tmp_time = explode(' - ', $info['tax_insurance_month']);
  142. $formatDate = formatDateByMonth($tmp_time[0], $tmp_time[1], $content['YL00018']['data']['list']);
  143. $str = '';
  144. foreach ($formatDate as $tmp_item) {
  145. $str .= $tmp_item . "<br />";
  146. }
  147. if (count($formatDate) == $content['YL00018']['data']['totalCount']) {
  148. $content['YL00018']['status'] = 'success';
  149. } else {
  150. $content['YL00018']['status'] = 'warning';
  151. }
  152. $content['YL00018']['content'] = "该人员社保填写日期为{$tmp_time[0]}至{$tmp_time[1]},共" . count($formatDate) . "个月,接口返回{$content['YL00018']['data']['totalCount']}个月数据,分别为:<br />$str";
  153. unset($tmp_time);
  154. unset($tmp_item);
  155. } else {
  156. $content['YL00018'] = [];
  157. }
  158. $info['rs'] = $content;
  159. }
  160. $info["process"] = $process;
  161. if ($process == 7) {
  162. //如果有变更记录,这此处获取最初一条记录的旧值并覆盖$info中的新值
  163. }
  164. if (in_array($info["checkState"], [TalentState::BASE_VERIFY_FAIL, TalentState::FST_SUBMIT, TalentState::BASE_VERIFY_PASS, TalentState::BASE_REVERIFY_REJECT, TalentState::BASE_REVERIFY_FAIL])) {
  165. return view("talentInfo_base_check", ["info" => $info]);
  166. } else {
  167. switch ($info["enterpriseType"]) {
  168. case 1:
  169. $tpl = "talentInfo_common_check"; //$info["isImport"] ? "nofile_talentInfo_common_check" : "talentInfo_common_check";
  170. return view($tpl, ["info" => $info]);
  171. case 2:
  172. return view("talentInfo_common_checkIC", ["info" => $info]);
  173. }
  174. }
  175. }
  176. public function cancel_verify() {
  177. $params = $this->request->param();
  178. $ids = $params["ids"];
  179. $msg = $params["msg"];
  180. if ($msg == "") {
  181. return json(["msg" => "请填写审核不通过的原因"]);
  182. }
  183. $ids_arr = array_filter(explode(",", $ids));
  184. $counts = 0;
  185. foreach ($ids_arr as $id) {
  186. $ti = VerifyApi::getOne($id);
  187. $data["id"] = $id;
  188. if ($ti["checkState"] == TalentState::FST_SUBMIT) {
  189. $data["checkState"] = TalentState::BASE_VERIFY_FAIL;
  190. TalentLogApi::write(1, $id, TalentState::BASE_VERIFY_FAIL, $msg, 1);
  191. TalentModel::update($data);
  192. $counts++;
  193. } else if ($ti["checkState"] == TalentState::SCND_SUBMIT) {
  194. $data["checkState"] = TalentState::FST_VERIFY_FAIL;
  195. TalentLogApi::write(1, $id, TalentState::FST_VERIFY_FAIL, $msg, 1);
  196. TalentModel::update($data);
  197. $counts++;
  198. } else {
  199. return json(["msg" => "不在审核范围"]);
  200. }
  201. }
  202. return json(["code" => 200, "msg" => sprintf("%d个申请已审核不通过", $counts)]);
  203. }
  204. public function base_verify() {
  205. $enterprises = EnterpriseApi::getSimpleList();
  206. return view("", ["enterprises" => $enterprises]);
  207. }
  208. public function base_verify_list() {
  209. $params = $this->request->param();
  210. return json(VerifyApi::getList($params));
  211. }
  212. public function base_reverify() {
  213. $enterprises = EnterpriseApi::getSimpleList();
  214. return view("", ["enterprises" => $enterprises]);
  215. }
  216. public function base_reverify_list() {
  217. $params = $this->request->param();
  218. return json(VerifyApi::getList($params));
  219. }
  220. /**
  221. * 部门初审
  222. * @auth {{/talentInfo/gotoIndex/-1}}
  223. */
  224. public function dept_fst_verify() {
  225. return view();
  226. }
  227. /**
  228. * 初审
  229. * @auth {{/talentInfo/gotoIndex/1}}
  230. */
  231. public function fst_verify() {
  232. return view("", $this->getCommonAssigns());
  233. }
  234. /**
  235. * 初审-审核
  236. * @auth {{/talentInfo/firstCheck}}
  237. */
  238. public function fst_check() {
  239. }
  240. /**
  241. * 初审-审核不通过
  242. * @auth {{/talentInfo/setNotPass}}
  243. */
  244. public function dis_pass() {
  245. }
  246. /**
  247. * 部门审核
  248. * @auth {{/talentInfo/gotoIndex/2}}
  249. */
  250. public function dept_verify() {
  251. $companys = CompanyApi::getAll();
  252. $superpriv = VerifyApi::chkUserInSuperDeptUsers();
  253. $commonAssigns = $this->getCommonAssigns();
  254. $assigns = ["companys" => $companys, "superpriv" => $superpriv];
  255. $newAssigns = array_merge($assigns, $commonAssigns);
  256. return view("", $newAssigns);
  257. }
  258. /**
  259. * 复审
  260. * @auth {{/talentInfo/gotoIndex/3}}
  261. */
  262. public function re_verify() {
  263. return view("", $this->getCommonAssigns());
  264. }
  265. /**
  266. * 复审-撤销复核
  267. * @auth {{/talentInfo/cancleThirdCheck}}
  268. */
  269. public function cancel_check() {
  270. }
  271. /**
  272. * 预备人才库
  273. * @auth {{/talentInfo/gotoIndex/4}}
  274. */
  275. public function pre_list() {
  276. if ($this->user["type"] == 1) {
  277. $message = [
  278. "typeName" => "晋江市现代产业体系人才认定", "address" => "聚才网/人才晋江微信公众号", "dep" => "中共晋江市委人才办、晋江市纪委监委驻市人力资源和社会保障局纪检监察组或晋江市公共就业和人才服务中心",
  279. "phone" => "0595-85633128", "email" => "jjrc85661234@163.com"
  280. ];
  281. } else {
  282. $message = [
  283. "typeName" => "晋江市集成电路产业优秀人才认定", "address" => "福建(晋江)集成电路产业园官方网站及微信公众号", "dep" => "集成电路产业园区",
  284. "phone" => "0595-82250007、0595-82250001", "email" => "jjjcdr@163.com"
  285. ];
  286. }
  287. $commonAssigns = $this->getCommonAssigns();
  288. $assigns = ["message" => $message];
  289. $newAssigns = array_merge($assigns, $commonAssigns);
  290. return view("", $newAssigns);
  291. }
  292. private function getCommonAssigns() {
  293. $type = $this->user["type"];
  294. $enterprises = EnterpriseApi::getSimpleList();
  295. $conditions = TalentConditionApi::getList([1, 2, 3, 4, 5, 6, 7], $type);
  296. $industry_field_new = array_column(DictApi::findChildDictByCode("industry_field"), "code");
  297. foreach ($industry_field_new as &$field) {
  298. $field .= "_field";
  299. }
  300. $parent_industry_fields = implode(",", $industry_field_new);
  301. $where[] = ["d2.code", "in", $parent_industry_fields];
  302. $industry_field_old = \app\common\model\Dict::alias("d1")->field("d1.*,d2.`name` as pname")->leftJoin("new_talent_dict d2", "d1.pid=d2.id")->order("name asc")->where($where)->select();
  303. return ["type" => $type, "enterprises" => $enterprises, "talent_conditions" => $conditions, "industry_field_old" => $industry_field_old];
  304. }
  305. /**
  306. * 优秀人才库
  307. * @auth {{/talentInfo/gotoIndex/5}}
  308. */
  309. public function library() {
  310. return view("", $this->getCommonAssigns());
  311. }
  312. public function selectNeedCheckData() {
  313. $params = $this->request->param();
  314. return json(["code" => 200, "obj" => VerifyApi::getPublicList($params)]);
  315. }
  316. /**
  317. * 预备人才库-核查征信
  318. * @auth {{/talentInfo/prepareHczx}}
  319. */
  320. public function prepareHczx() {
  321. $ids = $this->request->param("ids");
  322. $ids_arr = array_filter(explode(",", $ids));
  323. if (!$ids_arr) {
  324. $res = ["code" => 500, "msg" => "没有选择导出的名单"];
  325. echo sprintf("<script>TalentInfo.callBack(%s);</script>", json_encode($res));
  326. }
  327. $where[] = ["ti.id", "in", $ids_arr];
  328. $list = TalentModel::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.name,ti.card_type,ti.card_number,e.name as enterpriseName,e.description")->where($where)->select();
  329. if (!$list) {
  330. $res = ["code" => 500, "msg" => "没有可以导出的内容"];
  331. echo sprintf("<script>TalentInfo.callBack(%s);</script>", json_encode($res));
  332. }
  333. $columns = ["序号", "姓名", "证件类型", "证件号码", "工作单位", "备注"];
  334. $rows = [];
  335. $i = 1;
  336. $card_types = DictApi::selectByParentCode("card_type");
  337. foreach ($list as $item) {
  338. $row = [
  339. $i, $item["name"], $card_types[$item["card_type"]], $item["card_number"], $item["enterpriseName"], $item["description"]
  340. ];
  341. $rows[] = $row;
  342. $i++;
  343. }
  344. $filename = "现代产业体系人才核查征信名单导出";
  345. if ($rows) {
  346. export($columns, $rows, $filename);
  347. exit();
  348. }
  349. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  350. }
  351. /**
  352. * 预备人才库-征信通过
  353. * @auth {{/talentInfo/hczxPass}}
  354. */
  355. public function hczxPass() {
  356. $params = $this->request->param();
  357. $ids = $params["ids"];
  358. $ids = array_filter(explode(",", $ids));
  359. $msg = "征信通过";
  360. $state = TalentState::ZX_PASS; //征信通过
  361. $total = count($ids);
  362. $error = 0;
  363. $success = 0;
  364. foreach ($ids as $id) {
  365. $talent_info = VerifyApi::getOne($id);
  366. if ($talent_info["checkState"] != TalentState::REVERIFY_PASS) {
  367. $error++;
  368. continue;
  369. }
  370. if (VerifyApi::setPublic($id, $state, $msg)) {
  371. $success++;
  372. } else {
  373. $error++;
  374. }
  375. }
  376. return json(["code" => 200, "msg" => sprintf("核查征信完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
  377. }
  378. /**
  379. * 预备人才库-征信失信
  380. * @auth {{/talentInfo/hczxReject}}
  381. */
  382. public function hczxReject() {
  383. $params = $this->request->param();
  384. $id = $params["id"];
  385. $msg = $params["outMsg"];
  386. if (!$msg)
  387. return json(["msg" => "请填写审核意见"]);
  388. $msg = "征信失信:" . $msg;
  389. $state = TalentState::ZX_FAIL; //征信不通过
  390. $talent_info = VerifyApi::getOne($id);
  391. if ($talent_info["checkState"] != TalentState::REVERIFY_PASS) {
  392. return json(["msg" => "当前记录不是待核查征信状态,无法核查"]);
  393. }
  394. if (VerifyApi::setPublic($id, $state, $msg)) {
  395. return json(["code" => 200, "msg" => "已设置征信失信"]);
  396. }
  397. return json(["msg" => "设置征信失信失败"]);
  398. }
  399. /**
  400. * 预备人才库-公示预览
  401. * @auth {{/talentInfo/publicExportBefore}}
  402. */
  403. public function publicExportBefore() {
  404. $params = $this->request->param();
  405. $ids_arr = array_filter(explode(",", $params["ids"]));
  406. $columns = ["序号", "批次", "姓名", "性别", "工作单位", "本人具备的认定条件", "拟认定人才层次", "审核状态", "备注"];
  407. if ($ids_arr) {
  408. $where[] = ["id", "in", $ids_arr];
  409. $list = TalentModel::where($where)->order("talent_arrange asc,enterprise_id asc")->select();
  410. $rows = [];
  411. $i = 1;
  412. $talentArranges = DictApi::selectByParentCode("talent_arrange");
  413. foreach ($list as $item) {
  414. $talent_condition = TalentConditionApi::getOne($item["talent_condition"]);
  415. $enterprise = EnterpriseApi::getOne($item["enterprise_id"]);
  416. $checkLog = TalentLogApi::getLastLog($item["id"], 1);
  417. $row = [
  418. $i, $item["apply_year"], $item["name"], $item["sex"] == 1 ? "男" : "女", $enterprise["name"], $talent_condition["name"], $talentArranges[$item["talent_arrange"]], $item["checkState"] == TalentState::ZX_PASS ? "审核通过" : "审核不通过", $checkLog["description"]
  419. ];
  420. $rows[] = $row;
  421. $i++;
  422. }
  423. }
  424. if ($rows) {
  425. $filename = "现代产业体系人才公示预览导出";
  426. export($columns, $rows, $filename);
  427. exit();
  428. }
  429. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  430. }
  431. /**
  432. * 预备人才库-公示导出
  433. * @auth {{/talentInfo/publicExport}}
  434. */
  435. public function publicExport() {
  436. $params = $this->request->param();
  437. $columns = ["序号", "批次", "姓名", "性别", "工作单位", "本人具备的认定条件", "拟认定人才层次", "审核状态", "备注"];
  438. $startTime = $params["startTime"];
  439. $endTime = $params["endTime"];
  440. if (!strtotime($startTime) || !strtotime($endTime))
  441. return json(["msg" => "时间格式错误"]);
  442. $where[] = ["checkState", "=", TalentState::ANNOUNCED];
  443. $where[] = ["publicBatch", "between", [$startTime, $endTime]];
  444. $list = TalentModel::where($where)->order("talent_arrange asc,enterprise_id asc")->select();
  445. $rows = [];
  446. $i = 1;
  447. $talentArranges = DictApi::selectByParentCode("talent_arrange");
  448. foreach ($list as $item) {
  449. $talent_condition = TalentConditionApi::getOne($item["talent_condition"]);
  450. $enterprise = EnterpriseApi::getOne($item["enterprise_id"]);
  451. $checkLog = TalentLogApi::getLastLog($item["id"], 1);
  452. $row = [
  453. $i, $item["apply_year"], $item["name"], $item["sex"] == 1 ? "男" : "女", $enterprise["name"], $talent_condition["name"], $talentArranges[$item["talent_arrange"]], $item["checkState"] == TalentState::ANNOUNCED ? "审核通过" : "审核不通过", $checkLog["description"]
  454. ];
  455. $rows[] = $row;
  456. $i++;
  457. }
  458. if ($rows) {
  459. $filename = "现代产业体系人才公示导出";
  460. export($columns, $rows, $filename);
  461. exit();
  462. }
  463. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  464. }
  465. /**
  466. * 预备人才库-公示
  467. * @auth {{/talentInfo/preparePublic}}
  468. */
  469. public function preparePublic() {
  470. $params = $this->request->param();
  471. $ids = $params["ids"];
  472. $publicBatch = $params["batch"];
  473. if (!$publicBatch || strlen($publicBatch) != 6 || !is_numeric($publicBatch))
  474. return json(["msg" => "公示批次错误"]);
  475. $isMessage = $params["isMessage"] == 1 ? true : false;
  476. if ($isMessage && (!$params["typeName"] || !$params["address"] || !$params["publicStartTime"] || !$params["publicEndTime"] || !$params["dep"] || !$params["phone"] || !$params["email"])) {
  477. return json(["msg" => "短信参数不能为空"]);
  478. }
  479. $ids = array_filter(explode(",", $ids));
  480. $msg = "已公示";
  481. $state = TalentState::ANNOUNCED; //公示
  482. $total = count($ids);
  483. $error = 0;
  484. $success = 0;
  485. $phones = [];
  486. foreach ($ids as $id) {
  487. $talent_info = VerifyApi::getOne($id);
  488. if ($talent_info["checkState"] != TalentState::ZX_PASS) {
  489. $error++;
  490. continue;
  491. }
  492. if (VerifyApi::setPublic($id, $state, $msg, $publicBatch)) {
  493. $success++;
  494. $ep = EnterpriseApi::getOne($talent_info['enterprise_id']);
  495. $phones[] = $ep->agentPhone;
  496. } else {
  497. $error++;
  498. }
  499. }
  500. $phones = array_unique(array_filter($phones));
  501. if ($isMessage && $phones) {
  502. $sms = new \app\common\api\ChuanglanSmsApi();
  503. $tpl_content = sprintf("【晋江市人才服务平台】您好!您提交申请的%s已完成初步审核,现通过%s将审核结果予以公示,公示时间%s至%s。公示期间如有异议,请及时向%s反映。电话%s,电子邮箱%s。",
  504. $params["typeName"], $params["address"], $params["publicStartTime"], $params["publicEndTime"], $params["dep"], $params["phone"], $params["email"]);
  505. while ($phone = array_shift($phones)) {
  506. $result = $sms->sendSMS($phone, $tpl_content);
  507. $result = json_decode($result, true);
  508. $recordId = getStringId();
  509. $record_data = [
  510. 'id' => $recordId,
  511. 'bizId' => $result["msgId"],
  512. 'type' => 2,
  513. 'smsType' => 1,
  514. 'phone' => $phone,
  515. 'params' => '公示',
  516. 'templateCode' => $tpl_content,
  517. 'state' => $result['code'] == 0 ? 2 : 3,
  518. 'sendingDate' => date("Y-m-d H:i:s", time()),
  519. 'createTime' => date("Y-m-d H:i:s", time()),
  520. 'msg' => $result['errorMsg']
  521. ];
  522. MessageRecord::create($record_data);
  523. }
  524. }
  525. return json(["code" => 200, "msg" => sprintf("公示完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
  526. }
  527. /**
  528. * 预备人才库-公示再审核
  529. * @auth {{/talentInfo/prepareCheck}}
  530. */
  531. public function prepareCheck() {
  532. $params = $this->request->param();
  533. $id = $params["id"];
  534. $checkState = $params["checkState"];
  535. $msg = $params["checkMsg"];
  536. if (!$msg)
  537. return json(["msg" => "请填写审核意见"]);
  538. if ($checkState == 1) {
  539. $msg = "公示再审核通过:" . $msg;
  540. $state = TalentState::ANNOUNCED_REVERIFY_PASS; //公示再审核通过
  541. } else {
  542. $msg = "公示再审核不通过:" . $msg;
  543. $state = TalentState::ANNOUNCED_REVERIFY_FAIL; //公示再审核不通过
  544. }
  545. $talent_info = VerifyApi::getOne($id);
  546. if ($talent_info["checkState"] != TalentState::ANNOUNCED) {
  547. return json(["msg" => "当前记录不是公示状态,无法审核"]);
  548. }
  549. if (VerifyApi::setPublic($id, $state, $msg)) {
  550. return json(["code" => 200, "msg" => "公示再审核完成"]);
  551. }
  552. return json(["msg" => "公示再审核失败"]);
  553. }
  554. /**
  555. * 预备人才库-公示通过(批量)
  556. * @auth {{/talentInfo/publicPass}}
  557. */
  558. public function publicPass() {
  559. $params = $this->request->param();
  560. $ids = $params["ids"];
  561. $ids = array_filter(explode(",", $ids));
  562. $msg = "公示再审核批量通过";
  563. $state = TalentState::ANNOUNCED_REVERIFY_PASS; //公示再审核通过
  564. $total = count($ids);
  565. $error = 0;
  566. $success = 0;
  567. foreach ($ids as $id) {
  568. $talent_info = VerifyApi::getOne($id);
  569. if ($talent_info["checkState"] != TalentState::ANNOUNCED) {
  570. $error++;
  571. continue;
  572. }
  573. if (VerifyApi::setPublic($id, $state, $msg)) {
  574. $success++;
  575. } else {
  576. $error++;
  577. }
  578. }
  579. return json(["code" => 200, "msg" => sprintf("公示再审核完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
  580. }
  581. /**
  582. * 预备人才库-公布预览
  583. * @auth {{/talentInfo/publishExportBefore}}
  584. */
  585. public function publishExportBefore() {
  586. $params = $this->request->param();
  587. $ids = $params["ids"];
  588. $ids = array_filter(explode(",", $ids));
  589. if ($ids) {
  590. $where[] = ["id", "in", $ids];
  591. $list = TalentModel::where($where)->order("talent_arrange asc,enterprise_id asc")->select();
  592. $rows = [];
  593. $i = 1;
  594. $talentArranges = DictApi::selectByParentCode("talent_arrange");
  595. foreach ($list as $item) {
  596. $talent_condition = TalentConditionApi::getOne($item["talent_condition"]);
  597. $enterprise = EnterpriseApi::getOne($item["enterprise_id"]);
  598. $checkLog = TalentLogApi::getLastLog($item["id"], 1);
  599. $row = [
  600. $i, $item["apply_year"], $item["name"], $item["sex"] == 1 ? "男" : "女", $enterprise["name"], $talent_condition["name"], $talentArranges[$item["talent_arrange"]], $item["checkState"] == TalentState::ANNOUNCED_REVERIFY_PASS ? "审核通过" : "审核不通过", $checkLog["description"]
  601. ];
  602. $rows[] = $row;
  603. $i++;
  604. }
  605. }
  606. $columns = ["序号", "批次", "姓名", "性别", "工作单位", "本人具备的认定条件", "认定人才层次", "审核状态", "备注"];
  607. $filename = "现代产业体系人才" . date("Ym") . "公布预览名单导出(公示批次-" . $list[0]["publicBatch"] . ")";
  608. if ($rows) {
  609. export($columns, $rows, $filename);
  610. exit();
  611. }
  612. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  613. }
  614. /**
  615. * 预备人才库-公布导出
  616. * @auth {{/talentInfo/publishExport}}
  617. */
  618. public function publishExport() {
  619. $params = $this->request->param();
  620. $startTime = $params["startTime"];
  621. $endTime = $params["endTime"];
  622. if (!strtotime($startTime) || !strtotime($endTime))
  623. return json(["msg" => "时间格式错误"]);
  624. $where[] = ["checkState", "=", TalentState::PUBLISH_PASS];
  625. $where[] = ["certificateGetTime", "between", [$startTime, $endTime]];
  626. $list = TalentModel::where($where)->order("talent_arrange asc,enterprise_id asc")->select();
  627. $rows = [];
  628. $i = 1;
  629. $talentArranges = DictApi::selectByParentCode("talent_arrange");
  630. foreach ($list as $item) {
  631. $talent_condition = TalentConditionApi::getOne($item["talent_condition"]);
  632. $enterprise = EnterpriseApi::getOne($item["enterprise_id"]);
  633. $checkLog = TalentLogApi::getLastLog($item["id"], 1);
  634. $row = [
  635. $i, $item["apply_year"], $item["name"], $item["sex"] == 1 ? "男" : "女", $enterprise["name"], $talent_condition["name"], $talentArranges[$item["talent_arrange"]], $item["checkState"] == TalentState::PUBLISH_PASS ? "审核通过" : "审核不通过", $checkLog["description"]
  636. ];
  637. $rows[] = $row;
  638. $i++;
  639. }
  640. $columns = ["序号", "批次", "姓名", "性别", "工作单位", "本人具备的认定条件", "认定人才层次", "审核状态", "备注"];
  641. $filename = "现代产业体系人才" . date("Ym") . "公布名单导出(公示批次-" . $list[0]["publicBatch"] . ")";
  642. if ($rows) {
  643. export($columns, $rows, $filename);
  644. exit();
  645. }
  646. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  647. }
  648. /**
  649. * 预备人才库-公布
  650. * @auth {{/talentInfo/publish}}
  651. */
  652. public function publish() {
  653. $params = $this->request->param();
  654. $id = $params["id"];
  655. $msg = $params["checkMsg"];
  656. $checkState = $params["checkState"];
  657. $batch = $params["batch"];
  658. if ($checkState == 1) {
  659. $state = TalentState::PUBLISH_PASS;
  660. $msg = "公布审核通过:" . $msg;
  661. } else {
  662. $state = TalentState::PUBLISH_FAIL;
  663. $msg = "公布审核不通过:" . $msg;
  664. }
  665. if (!$batch || !strtotime($batch))
  666. return json(["msg" => "公布批次时间错误"]);
  667. if (!$msg)
  668. return json(["msg" => "请填写审核意见"]);
  669. $state = TalentState::PUBLISH_PASS; //公示再审核通过
  670. $batch = $params["batch"];
  671. if (!strtotime($batch))
  672. return json(["msg" => "公布批次时间错误"]);
  673. $talent_info = VerifyApi::getOne($id);
  674. if ($talent_info["checkState"] != TalentState::ANNOUNCED_REVERIFY_PASS) {
  675. return json(["msg" => "当前记录不是公示再审核通过状态,无法审核"]);
  676. }
  677. if (VerifyApi::setPublic($id, $state, $msg, $batch)) {
  678. return json(["code" => 200, "msg" => "公布审核完成"]);
  679. }
  680. return json(["msg" => "公布审核失败"]);
  681. }
  682. /**
  683. * 预备人才库-批量公布通过
  684. * @auth {{/talentInfo/preparePublish}}
  685. */
  686. public function preparePublish() {
  687. $params = $this->request->param();
  688. $ids = $params["ids"];
  689. $ids = array_filter(explode(",", $ids));
  690. $msg = "批量公布";
  691. $state = TalentState::PUBLISH_PASS; //公示再审核通过
  692. $batch = $params["batch"];
  693. if (!strtotime($batch))
  694. return json(["msg" => "公布批次时间错误"]);
  695. $total = count($ids);
  696. $error = 0;
  697. $success = 0;
  698. foreach ($ids as $id) {
  699. $talent_info = VerifyApi::getOne($id);
  700. if ($talent_info["checkState"] != TalentState::ANNOUNCED_REVERIFY_PASS) {
  701. $error++;
  702. continue;
  703. }
  704. if (VerifyApi::setPublic($id, $state, $msg, $batch)) {
  705. $success++;
  706. } else {
  707. $error++;
  708. }
  709. }
  710. return json(["code" => 200, "msg" => sprintf("公布完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
  711. }
  712. /**
  713. * 预备人才库-批量发放人才码
  714. * @auth {{/talentInfo/prepareCertification}}
  715. */
  716. public function prepareCertification() {
  717. $lockFile = fopen("send_certificate.lock", "a");
  718. if (flock($lockFile, LOCK_EX | LOCK_NB)) {//文件锁(独占)
  719. //查询所有待发放人才码的数据
  720. $params = $this->request->param();
  721. $ids = array_filter(explode(",", $params["ids"]));
  722. //晋江市优秀人才证书:当前年份+层次+四位递增数字
  723. //集成电路优秀人才证书:IC+当前年份+递增四位数,如IC20190001
  724. Db::startTrans();
  725. $talent_max_no = [];
  726. $user = $this->user;
  727. $_prefix_type = "";
  728. $subindex = 5;
  729. switch ($user["type"]) {
  730. case 2:
  731. $_prefix_type = "IC";
  732. $subindex += strlen($_prefix_type);
  733. break;
  734. }
  735. try {
  736. $talent_list = VerifyApi::getListByIds($ids);
  737. $year = date("Y");
  738. foreach ($talent_list as $talent_info) {
  739. if ($talent_info["checkState"] != TalentState::PUBLISH_PASS) {
  740. Db::rollback();
  741. return json(["msg" => "只能对公布通过的对象发放人才码,请核查待发放人才码名单后再重新发放人才码"]);
  742. }
  743. /* 检查是否有存在人才码,保持同一个人唯一 */
  744. $where = [];
  745. $where[] = ["card_type", "=", $talent_info["card_type"]];
  746. $where[] = ["card_number", "=", $talent_info["card_number"]];
  747. $where[] = ["checkState", "=", TalentState::CERTIFICATED];
  748. $fstTalentInfo = Db::table("new_talent_info")->where($where)->order("createTime asc")->find(); //取第一条全通记录
  749. if ($fstTalentInfo) {
  750. $max_no = $fstTalentInfo["certificateNo"];
  751. } else {
  752. $no_prefix = $_prefix_type . $year . $talent_info["talent_arrange"];
  753. $where = [];
  754. $where[] = ["certificateNo", "like", $no_prefix . "%"];
  755. $max_no = $talent_max_no[$talent_info["talent_arrange"]] ?: Db::table("new_talent_info")->where($where)->max("certificateNo", false);
  756. if (!$max_no) {
  757. $max_no = $no_prefix . "0001";
  758. } else {
  759. $new_no = intval(substr($max_no, $subindex)) + 1;
  760. $max_no = $no_prefix . str_pad($new_no, 4, "0", STR_PAD_LEFT);
  761. }
  762. }
  763. //更新证书编号
  764. $data["id"] = $talent_info["id"];
  765. $data["certificateNo"] = $max_no;
  766. $data["checkState"] = TalentState::CERTIFICATED;
  767. $data["isEffect"] = 1;
  768. $data["isPublic"] = 5;
  769. Db::table("new_talent_info")->update($data);
  770. //写入日志
  771. $log["last_state"] = TalentState::PUBLISH_PASS;
  772. $log["id"] = getStringId();
  773. $log["state"] = $log["new_state"] = TalentState::CERTIFICATED;
  774. $log["type"] = 1;
  775. $log["mainId"] = $talent_info["id"];
  776. $log["companyId"] = $user["companyId"];
  777. $log["active"] = 1;
  778. $log["description"] = "人才码为:" . $max_no;
  779. $log["createUser"] = sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]);
  780. $log["createTime"] = date("Y-m-d H:i:s");
  781. Db::table("new_talent_checklog")->insert($log);
  782. $talent_max_no[$talent_info["talent_arrange"]] = $max_no;
  783. }
  784. Db::commit();
  785. if ($user["type"] == 2) {
  786. //办法上只写电路人才,所以暂时只给电路增加基础分
  787. $_ids = array_column($talent_list, "id");
  788. for ($i = 0; $i < count($_ids); $i++) {
  789. queue("app\job\Talent", ["type" => 4, "id" => $_ids[$i]]);
  790. }
  791. }
  792. return json(["code" => 200, "msg" => "发放人才码成功"]);
  793. } catch (\Exception $e) {
  794. Db::rollback();
  795. return json(["msg" => "发放人才码失败:" . $e->getMessage()]);
  796. }
  797. flock($lockFile, LOCK_UN);
  798. } else {
  799. return json(["msg" => "同一时间只能有一个管理员进行发放人才码操作"]);
  800. }
  801. }
  802. /**
  803. * 预备人才库-撤销公布
  804. * @auth {{/talentInfo/prepareCanclePublish}}
  805. */
  806. public function pre_cancel_publish() {
  807. }
  808. /**
  809. * 基本条件审核-提交未保存
  810. * @param \think\Request $request
  811. * @param type $talent_info
  812. * @return type json
  813. */
  814. private function baseCheck(\think\Request $request, $talent_info) {
  815. $params = $request->param();
  816. if ($params["checkState"] == 3) {
  817. //审核成功
  818. $log_checkState = $checkState = TalentState::BASE_VERIFY_PASS; //基础信息审核成功
  819. } else {
  820. //审核驳回并记录需要修改的字段和上传文件
  821. $checkState = TalentState::FST_SAVE; //退回提交材料阶段
  822. $log_checkState = TalentState::BASE_REJECT; //日志记录拒绝状态
  823. }
  824. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  825. if (!$log)
  826. return json(["msg" => "日志数据异常,保存失败"]);
  827. if ($log["active"] == 0) {
  828. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  829. } else {
  830. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  831. }
  832. $data["id"] = $talent_info["id"];
  833. $data["modify_files"] = $params["files"];
  834. $data["modify_fields"] = $params["fields"];
  835. TalentModel::update($data);
  836. return json(["code" => 200, "msg" => "保存成功"]);
  837. }
  838. /**
  839. * 基本条件审核-提交审核
  840. * @param type $talent_info
  841. * @return type json
  842. */
  843. private function baseSubmitCheck($talent_info) {
  844. return $this->commonSubmitCheck($talent_info, 1);
  845. }
  846. /**
  847. * 基本条件复审-提交未保存
  848. * @param \think\Request $request
  849. * @param type $talent_info
  850. * @return type json
  851. */
  852. private function baseReCheck(\think\Request $request, $talent_info) {
  853. $params = $request->param();
  854. if ($params["checkState"] == 3) {
  855. //审核成功
  856. $log_checkState = $checkState = TalentState::BASE_REVERIFY_PASS; //基础信息复审成功
  857. } else if ($params["checkState"] == 2) {
  858. //审核驳回并记录需要修改的字段和上传文件
  859. $checkState = TalentState::FST_SUBMIT; //退回待基础审核状态
  860. $log_checkState = TalentState::BASE_REVERIFY_REJECT; //日志记录拒绝状态
  861. } else {
  862. $log_checkState = $checkState = TalentState::BASE_REVERIFY_FAIL; //审核失败
  863. }
  864. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  865. if (!$log)
  866. return json(["msg" => "日志数据异常,保存失败"]);
  867. if ($log["active"] == 0) {
  868. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  869. } else {
  870. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  871. }
  872. $data["id"] = $talent_info["id"];
  873. $data["modify_files"] = $params["files"];
  874. $data["modify_fields"] = $params["fields"];
  875. TalentModel::update($data);
  876. return json(["code" => 200, "msg" => "保存成功"]);
  877. }
  878. /**
  879. * 基本条件复审-提交审核
  880. * @param type $talent_info
  881. * @return type json
  882. */
  883. private function baseReSubmitCheck($talent_info) {
  884. return $this->commonSubmitCheck($talent_info, 2);
  885. }
  886. /**
  887. * 初审-提交未保存
  888. * @param \think\Request $request
  889. * @param type $talent_info
  890. * @return type json
  891. */
  892. private function fstCheck(\think\Request $request, $talent_info) {
  893. $params = $request->param();
  894. $data["pass_dept_check"] = 0;
  895. if ($params["checkState"] == 3) {
  896. //审核成功,并取消设置越过部门并审
  897. $log_checkState = $checkState = TalentState::FST_VERIFY_PASS; //初审成功
  898. if ($talent_info["isImport"] && $talent_info["isMatchZhiren"]) {
  899. $data["pass_dept_check"] = 1;
  900. }
  901. } else if ($params["checkState"] == 4) {
  902. if ($talent_info["highProcess"] < 3)
  903. return json(["msg" => "只有曾经达到过部门并审,初审时才可以选择直接跳过部门并审阶段"]);
  904. //审核成功,并设置越过部门并审。附加条件:最高进度曾经通过初审3,上级驳回后重新初审的
  905. $log_checkState = $checkState = TalentState::FST_VERIFY_PASS; //初审成功
  906. if ($talent_info["highProcess"] >= 3) {
  907. $data["pass_dept_check"] = 1;
  908. }
  909. } else if ($params["checkState"] == 5) {
  910. //选择重审部门
  911. if ($talent_info["highProcess"] < 3)
  912. return json(["msg" => "只有曾经达到过部门并审,初审时才可以选择再次审核的部门"]);
  913. if (!$params["companys"])
  914. return json(["msg" => "请选择需要再次审核的部门"]);
  915. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  916. $companyIds = array_filter(explode(",", $condition["companyIds"])); //该条件下需要审核的所有单位
  917. $re_check_companys = array_filter(explode(",", $talent_info["re_check_companys"]));
  918. foreach ($re_check_companys as $reCompanyId) {
  919. if (!in_array($reCompanyId, $companyIds)) {
  920. return json(["msg" => "错误的部门"]);
  921. }
  922. }
  923. $log_checkState = $checkState = TalentState::FST_VERIFY_PASS; //初审成功
  924. } else {
  925. //审核驳回并记录需要修改的字段和上传文件
  926. $checkState = TalentState::SCND_SAVE; //退回材料编辑状态
  927. $log_checkState = TalentState::FST_VERIFY_REJECT; //日志记录拒绝状态
  928. }
  929. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  930. if (!$log && !$talent_info["oldId"])
  931. return json(["msg" => "日志数据异常,保存失败"]);
  932. if ($log["active"] === 0) {
  933. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  934. } else {
  935. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  936. }
  937. $data["id"] = $talent_info["id"];
  938. $data["modify_files"] = $params["files"];
  939. $data["modify_fields"] = $params["fields"];
  940. $data["re_check_companys"] = $params["companys"];
  941. TalentModel::update($data);
  942. return json(["code" => 200, "msg" => "保存成功"]);
  943. }
  944. /**
  945. * 初审-提交审核
  946. * @param type $talent_info
  947. * @return type json
  948. */
  949. private function fstSubmitCheck($talent_info) {
  950. $nowProcess = 3;
  951. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  952. if (!$log || $log["active"] == 1)
  953. return json(["msg" => "请先保存审核状态,再提交审核"]);
  954. if (in_array($log["new_state"], [TalentState::BASE_VERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::REVERIFY_PASS])) {
  955. $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
  956. }
  957. $userIds = [];
  958. if ($log["state"] == TalentState::FST_VERIFY_PASS && $talent_info["pass_dept_check"] == 0) {
  959. $data["first_dept_check_time"] = date("Y-m-d H:i:s");
  960. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  961. $companyIds = array_filter(explode(",", $condition["companyIds"])); //该条件下需要审核的所有单位
  962. if ($talent_info["re_check_companys"]) {
  963. $unpass_companyIds = array_filter(explode(",", $talent_info["re_check_companys"]));
  964. } else {
  965. //这边去除已经审核通过的单位,主要通过日志是否存在记录。
  966. $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
  967. $unpass_companyIds = array_diff($companyIds, (array) $pass_companyIds); //排除已经通过的单位
  968. if (!$unpass_companyIds) {
  969. $data["pass_dept_check"] = 1; //部门已经全部审核过了,跳过部门审核
  970. }
  971. }
  972. if ($unpass_companyIds) {
  973. sort($unpass_companyIds);
  974. $delay = 9 * 24 * 3600; //9天的秒数
  975. queue("app\job\Talent", ["type" => 1, "id" => $talent_info["id"]], $delay); //加入部门审核超期处理队列,延迟7天执行
  976. TalentLogApi::writeDeptLogs($talent_info["id"], $unpass_companyIds, TalentState::FST_VERIFY_PASS);
  977. //初审通过发送短信通知并审部门
  978. $codes = ["talentInfo_depCheck"];
  979. $menuIds = MenuApi::getMenuIdsByCodes($codes);
  980. $where = [];
  981. $where[] = ["menuid", "in", $menuIds];
  982. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($codes))->column("roleid");
  983. $where = [];
  984. $where[] = ["status", "=", 1];
  985. $where[] = ["type", "=", $this->user["type"]];
  986. $where[] = ["companyId", "in", $unpass_companyIds];
  987. $where[] = ["roleid", "<>", 1];
  988. $regstr = ",(" . implode("|", $roleIds) . "),";
  989. $whereRaw = "concat(',',roleid,',') REGEXP '$regstr'";
  990. $userIds = User::where($where)->whereRaw($whereRaw)->column("id");
  991. /* $privs = ["/admin/talent/dept_check"];
  992. $menuIds = MenuApi::getMenuIdsByNewUrls($privs);
  993. $where[] = ["menuid", "in", $menuIds];
  994. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($privs))->column("roleid");
  995. $where = [];
  996. $where[] = ["status", "=", 1];
  997. $where[] = ["companyId", "in", $unpass_companyIds];
  998. $where[] = ["roleid", "in", $roleIds];
  999. $where[] = ["roleid", "<>", 1];
  1000. $userIds = User::where($where)->column("id"); */
  1001. }
  1002. }
  1003. $data["id"] = $talent_info["id"];
  1004. $data["checkState"] = $log["new_state"];
  1005. TalentModel::update($data);
  1006. TalentLogApi::setActive($log["id"], 1);
  1007. $this->sendMsgByState($talent_info, $log["state"], $userIds, $log["description"]);
  1008. return json(["code" => 200, "msg" => "审核成功"]);
  1009. }
  1010. /**
  1011. * 部门审核-提交未保存
  1012. * @param \think\Request $request
  1013. * @param type $talent_info
  1014. * @return type json
  1015. */
  1016. private function deptCheck(\think\Request $request, $talent_info, $companys) {
  1017. if ($talent_info["pass_dept_check"] == 1)
  1018. return json(["msg" => "不在审核范围。(初审部门已经选择跳过部门并审阶段)"]);
  1019. if (!in_array($this->user["companyId"], $companys))
  1020. return json(["msg" => "您的部门不在该申请的并审部门列表中。"]);
  1021. $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
  1022. $un_check_companyIds = TalentLogApi::getUnCheckDepts($talent_info["id"]); //未审核提交的单位
  1023. if (!in_array($this->user["companyId"], $un_check_companyIds) && in_array($this->user["companyId"], $pass_companyIds)) {
  1024. //判断不在未审核列表的同时判断已经在审核列表,是为了排除意外情况:缺失的待审核部门(通常是认证条件新增审核部门导致新增的部门未在审核列表中)
  1025. //缺失的待审核部门,作为未审状态,将在函数末尾根据当前审核情况补充一条保存未提交的记录
  1026. return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
  1027. }
  1028. $params = $request->param();
  1029. if ($params["checkState"] == 3) {
  1030. //审核成功
  1031. $log_checkState = TalentState::FST_VERIFY_PASS; //当前状态不变
  1032. $checkState = TalentState::DEPT_VERIFY_PASS; //审核成功
  1033. } else {
  1034. //审核驳回并记录需要修改的字段和上传文件
  1035. $checkState = TalentState::SCND_SUBMIT; //退回待初审
  1036. $log_checkState = TalentState::FST_VERIFY_PASS; //当前状态不变
  1037. $talent_condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1038. if (!$talent_condition["companyWithFileType"])
  1039. return json(["msg" => "尚未设置单位可审的附件,请联系管理员设置后再进行审批"]);
  1040. $cwfts = explode(";", $talent_condition["companyWithFileType"]);
  1041. $company_setting = [];
  1042. foreach ($cwfts as $cwft) {
  1043. $_company_setting = explode(":", $cwft);
  1044. if ($_company_setting[0] == $this->user["companyId"]) {
  1045. $company_setting = explode(",", $_company_setting[1]);
  1046. break;
  1047. }
  1048. }
  1049. if (!$company_setting)
  1050. return json(["msg" => "尚未设置单位可审的附件,请联系管理员设置后再进行审批"]);
  1051. //$data["modify_fields"] = $params["fields"];
  1052. $original_modify_files = explode(",", $talent_info["modify_files"]);
  1053. $_current_modify_files = explode(",", $params["files"]);
  1054. $unselect_files = array_diff($company_setting, $_current_modify_files); //比较设置和当前提交的,取差值集,既是可选而未选的附件集合
  1055. $new_modify_files = array_unique(array_merge($original_modify_files, $_current_modify_files)); //合并当前提交及库中原来保存的值
  1056. foreach ($new_modify_files as $key => $item) {
  1057. if (in_array($item, $unselect_files))
  1058. unset($new_modify_files[$key]);
  1059. }
  1060. $data["modify_files"] = implode(",", array_unique($new_modify_files));
  1061. }
  1062. $fst_dept_check_time = $talent_info["first_dept_check_time"];
  1063. $dept_log = TalentLogApi::getLogByCompanyId($talent_info["id"], $this->user["companyId"], $fst_dept_check_time);
  1064. if ($dept_log["active"] == 1)
  1065. return json(["msg" => "您的部门已经审核过了"]);
  1066. $data["id"] = $talent_info["id"];
  1067. TalentModel::update($data);
  1068. //修改日志
  1069. if (!$dept_log) {
  1070. TalentLogApi::write(ProjectState::TALENT, $talent_info["id"], [$log_checkState, $checkState, 3], $params["checkMsg"]); //补一条记录
  1071. //return json(["msg" => "未匹配日志,审核失败"]);
  1072. } else {
  1073. TalentLogApi::rewrite($dept_log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  1074. }
  1075. return json(["code" => 200, "msg" => "保存成功"]);
  1076. }
  1077. /**
  1078. * 部门审核-提交审核
  1079. * @param type $talent_info
  1080. * @return type json
  1081. */
  1082. private function deptSubmitCheck($talent_info, $companys) {
  1083. if ($talent_info["pass_dept_check"] == 1)
  1084. return json(["msg" => "不在审核范围。(初审部门已经选择跳过部门并审阶段)"]);
  1085. if (!in_array($this->user["companyId"], $companys))
  1086. return json(["msg" => "您的部门不在该申请的并审部门列表中。"]);
  1087. $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
  1088. if (in_array($this->user["companyId"], $pass_companyIds))
  1089. return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
  1090. $dept_log = TalentLogApi::getLogByCompanyId($talent_info["id"], $this->user["companyId"], $talent_info["first_dept_check_time"]);
  1091. //if (!$dept_log)
  1092. //return json(["msg" => "未匹配日志,审核失败"]);
  1093. if ($dept_log["state"] == $dept_log["new_state"] || !$dept_log)
  1094. return json(["msg" => "请先保存审核状态,再提交审核"]);
  1095. if ($dept_log["active"] == 1)
  1096. return json(["msg" => "您的部门已经审核过了"]);
  1097. if ($talent_info["re_check_companys"]) {
  1098. $re_check_companys = array_filter(explode(",", $talent_info["re_check_companys"]));
  1099. $companys = VerifyApi::getNewReCheckCompanyIds($re_check_companys, $companys, $pass_companyIds);
  1100. $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"], $talent_info["first_dept_check_time"]); //重审单位中已经通过的单位
  1101. }
  1102. $no_valid_companyIds = array_diff($pass_companyIds, $companys);
  1103. $pass_companyIds = array_diff($pass_companyIds, $no_valid_companyIds);
  1104. $over = $pass_companyIds ? count($pass_companyIds) : 0; //完成度,如果重审之前已有通过审核的部门,不用再审,直接按通过算
  1105. $error = 0; //失败数
  1106. $nowProcess = 4;
  1107. $over++;
  1108. if ($dept_log["new_state"] == TalentState::SCND_SUBMIT) {
  1109. $error++;
  1110. }
  1111. $logs = TalentLogApi::getListLogByTime($talent_info["id"], $talent_info["first_dept_check_time"]);
  1112. for ($i = 0; $i < count($logs); $i++) {
  1113. if (!in_array($logs[$i]["companyId"], $pass_companyIds) && in_array($logs[$i]["companyId"], $companys)) {
  1114. $over += $logs[$i]["active"] == 1 ? 1 : 0;
  1115. if ($logs[$i]["new_state"] == TalentState::SCND_SUBMIT) {
  1116. $error++;
  1117. }
  1118. }
  1119. }
  1120. if ($over == count($companys)) {
  1121. //全部已审核
  1122. $checkState = TalentState::SCND_SUBMIT;
  1123. $log_checkState = TalentState::DEPT_VERIFY_REJECT;
  1124. if ($error == 0) {
  1125. $log_checkState = $checkState = TalentState::DEPT_VERIFY_PASS;
  1126. $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
  1127. $data["modify_files"] = null;
  1128. }
  1129. if ($log_checkState == TalentState::DEPT_VERIFY_REJECT) {
  1130. $talent_condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1131. $cwfts = explode(";", $talent_condition["companyWithFileType"]);
  1132. $fileTypes = [];
  1133. foreach ($cwfts as $cwft) {
  1134. $_company_setting = explode(":", $cwft);
  1135. $_fileTypes = explode(",", $_company_setting[1]);
  1136. $fileTypes = array_merge($fileTypes, $_fileTypes);
  1137. }
  1138. $modify_files = explode(",", $talent_info["modify_files"]);
  1139. $removeFileTypes = array_diff($modify_files, $fileTypes);
  1140. $newModifyFiles = array_diff($modify_files, $removeFileTypes);
  1141. $data["modify_files"] = implode(",", $newModifyFiles);
  1142. }
  1143. $data["id"] = $talent_info["id"];
  1144. $data["checkState"] = $checkState;
  1145. $data["first_dept_check_time"] = null;
  1146. $data["re_check_companys"] = null;
  1147. TalentModel::update($data);
  1148. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], "部门审核结束", 1);
  1149. if ($log_checkState == TalentState::DEPT_VERIFY_REJECT) {
  1150. //部门驳回发送短信通知
  1151. $codes = ["talentInfo_firstCheck"];
  1152. $menuIds = MenuApi::getMenuIdsByCodes($codes);
  1153. $where = [];
  1154. $where[] = ["menuid", "in", $menuIds];
  1155. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($codes))->column("roleid");
  1156. $where = [];
  1157. $where[] = ["status", "=", 1];
  1158. $where[] = ["type", "=", $this->user["type"]];
  1159. $where[] = ["roleid", "<>", 1];
  1160. $regstr = ",(" . implode("|", $roleIds) . "),";
  1161. $whereRaw = "concat(',',roleid,',') REGEXP '$regstr'";
  1162. $userIds = User::where($where)->whereRaw($whereRaw)->column("id");
  1163. /* $privs = ["admin/talent/fst_check"];
  1164. $menuIds = MenuApi::getMenuIdsByNewUrls($privs);
  1165. $where[] = ["menuid", "in", $menuIds];
  1166. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($privs))->column("roleid");
  1167. $where = [];
  1168. $where[] = ["status", "=", 1];
  1169. $where[] = ["roleid", "in", $roleIds];
  1170. $where[] = ["roleid", "<>", 1];
  1171. $userIds = User::where($where)->column("id"); */
  1172. $this->sendMsgByState($talent_info, $log_checkState, $userIds, $dept_log["description"]);
  1173. }
  1174. }
  1175. TalentLogApi::setActive($dept_log["id"], 1);
  1176. return json(["code" => 200, "msg" => "审核成功"]);
  1177. }
  1178. /**
  1179. * 复审-提交未保存
  1180. * @param \think\Request $request
  1181. * @param type $talent_info
  1182. * @param type json
  1183. */
  1184. private function reCheck(\think\Request $request, $talent_info) {
  1185. $params = $request->param();
  1186. if ($params["checkState"] == 3) {
  1187. //审核成功
  1188. $log_checkState = $checkState = TalentState::REVERIFY_PASS; //复核成功
  1189. } else if ($params["checkState"] == 2) {
  1190. //审核驳回并记录需要修改的字段和上传文件
  1191. $checkState = TalentState::SCND_SUBMIT; //退回待初审
  1192. $log_checkState = TalentState::REVERIFY_REJECT; //日志记录拒绝状态
  1193. } else {
  1194. $log_checkState = $checkState = TalentState::REVERIFY_FAIL; //审核失败
  1195. }
  1196. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  1197. if (!$log && !$talent_info["oldId"])
  1198. return json(["msg" => "日志数据异常,保存失败"]);
  1199. if ($log["active"] === 0) {
  1200. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  1201. } else {
  1202. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  1203. }
  1204. $data["id"] = $talent_info["id"];
  1205. $data["modify_files"] = $params["files"];
  1206. $data["modify_fields"] = $params["fields"];
  1207. TalentModel::update($data);
  1208. return json(["code" => 200, "msg" => "保存成功"]);
  1209. }
  1210. /**
  1211. * 复审-提交审核
  1212. * @param type $talent_info
  1213. * @return type json
  1214. */
  1215. private function reSubmitCheck($talent_info) {
  1216. return $this->commonSubmitCheck($talent_info, 5);
  1217. }
  1218. private function commonSubmitCheck($talent_info, $nowProcess) {
  1219. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  1220. if (!$log || $log["active"] == 1)
  1221. return json(["msg" => "请先保存审核状态,再提交审核"]);
  1222. if (in_array($log["new_state"], [TalentState::BASE_VERIFY_PASS, TalentState::BASE_REVERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::REVERIFY_PASS])) {
  1223. $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
  1224. }
  1225. $data["id"] = $talent_info["id"];
  1226. $data["checkState"] = $log["new_state"];
  1227. TalentModel::update($data);
  1228. TalentLogApi::setActive($log["id"], 1);
  1229. $userIds = [];
  1230. if (in_array($log["state"], [TalentState::REVERIFY_PASS, TalentState::REVERIFY_REJECT])) {
  1231. //复核成功需要发送短信给征信部门,复核的其它状态发送通知给用户,调用此方法的还有基础审核的每个状态都要发送通知给用户
  1232. //从征信审核权限,逆推征信部门
  1233. if ($data["checkState"] == TalentState::REVERIFY_PASS) {
  1234. $codes = ["talentInfohczxReject", "talentInfohczxPass"];
  1235. } else {
  1236. $codes = ["talentInfo_firstCheck"];
  1237. }
  1238. $menuIds = MenuApi::getMenuIdsByCodes($codes);
  1239. $where = [];
  1240. $where[] = ["menuid", "in", $menuIds];
  1241. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($codes))->column("roleid");
  1242. $where = [];
  1243. $where[] = ["status", "=", 1];
  1244. $where[] = ["type", "=", $this->user["type"]];
  1245. $where[] = ["roleid", "<>", 1];
  1246. $regstr = ",(" . implode("|", $roleIds) . "),";
  1247. $whereRaw = "concat(',',roleid,',') REGEXP '$regstr'";
  1248. $userIds = User::where($where)->whereRaw($whereRaw)->column("id");
  1249. /* if ($data["checkState"] == TalentState::REVERIFY_PASS) {
  1250. $privs = ["/admin/talent/hczxReject", "/admin/talent/hczxPass"];
  1251. } else {
  1252. $privs = ["admin/talent/fst_check"];
  1253. }
  1254. $menuIds = MenuApi::getMenuIdsByNewUrls($privs);
  1255. $where = [];
  1256. $where[] = ["menuid", "in", $menuIds];
  1257. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($privs))->column("roleid");
  1258. $where = [];
  1259. $where[] = ["status", "=", 1];
  1260. $where[] = ["roleid", "in", $roleIds];
  1261. $where[] = ["roleid", "<>", 1];
  1262. $userIds = User::where($where)->column("id"); */
  1263. }
  1264. $this->sendMsgByState($talent_info, $log["state"], $userIds, $log["description"]);
  1265. return json(["code" => 200, "msg" => "审核成功"]);
  1266. }
  1267. private function sendMsgByState($talent_info, $state, $userIds = [], $description = "") {
  1268. $phones = [];
  1269. $template = "";
  1270. $type = 0;
  1271. $processName = "";
  1272. $userId = 0;
  1273. $name = null;
  1274. switch ($state) {
  1275. case TalentState::BASE_VERIFY_PASS://基础信息审核通过发送短信通知用户
  1276. $type = 2;
  1277. $processName = "基础信息审核";
  1278. $template = "【晋江市人才服务平台】尊敬的用户,您提交的人才基础信息审核通过,请及时登录申报系统并进行人才认定的信息申报填写。";
  1279. break;
  1280. case TalentState::BASE_REJECT://基础信息审核驳回发送短信通知用户
  1281. $type = 2;
  1282. $processName = "基础信息审核";
  1283. $template = "【晋江市人才服务平台】尊敬的用户,您提交的人才基础信息审核驳回,原因是:{$description},请及时登录申报系统修改并重新提交。";
  1284. break;
  1285. case TalentState::BASE_VERIFY_FAIL://基础信息审核不通过发送短信通知用户
  1286. $type = 2;
  1287. $processName = "基础信息审核";
  1288. $template = "【晋江市人才服务平台】尊敬的用户,您提交的人才基础信息审核不通过,原因是:{$description}。";
  1289. break;
  1290. case TalentState::FST_VERIFY_PASS://初审通过发送短信通知并审部门
  1291. $type = 1;
  1292. $processName = "初级审核";
  1293. $template = "【晋江市人才服务平台】您的部门有新的人才认定申报需要审批,请及时登录审批系统处理。";
  1294. break;
  1295. case TalentState::FST_VERIFY_REJECT; //初审驳回发送短信通知用户
  1296. $type = 2;
  1297. $processName = "初级审核";
  1298. $template = "【晋江市人才服务平台】尊敬的用户,您提交的人才认定申报审核驳回,原因是:{$description},请及时登录申报系统修改并重新提交。";
  1299. break;
  1300. case TalentState::FST_VERIFY_FAIL://初审不通过发送短信通知用户
  1301. $type = 2;
  1302. $processName = "初级审核";
  1303. $template = "【晋江市人才服务平台】尊敬的用户,您提交的人才认定申报审核不通过,原因是:{$description}。";
  1304. break;
  1305. case TalentState::DEPT_VERIFY_REJECT://并审驳回发送短信通知初审部门
  1306. $type = 1;
  1307. $processName = "部门并审";
  1308. $template = "【晋江市人才服务平台】有人才认定申报在并审阶段被驳回,原因是:{$description},请及时登录审批系统处理。";
  1309. break;
  1310. case TalentState::REVERIFY_PASS://复核通过发短信通知征信部门
  1311. $type = 1;
  1312. $processName = "复审";
  1313. $template = "【晋江市人才服务平台】有新的人才认定申报通过复审进入征信阶段,请及时登录审批系统处理。";
  1314. break;
  1315. case TalentState::REVERIFY_REJECT://复核驳回发短信通知初审部门
  1316. $type = 1;
  1317. $processName = "复审";
  1318. $template = "【晋江市人才服务平台】有人才认定申报在复审阶段被驳回,原因是:{$description},请及时登录审批系统处理。";
  1319. break;
  1320. }
  1321. if ($type == 1) {
  1322. $where = [];
  1323. $where[] = ["id", "in", $userIds];
  1324. $phones = User::where($where)->column("phone");
  1325. $phones = array_unique(array_filter($phones));
  1326. }
  1327. if ($type == 2) {
  1328. $ep = EnterpriseApi::getOne($talent_info['enterprise_id']);
  1329. $phones[] = $ep->agentPhone;
  1330. $userId = $ep->id;
  1331. $name = $ep->name;
  1332. }
  1333. if ($phones && $template) {
  1334. while ($phone = array_shift($phones)) {
  1335. $smsapi = new ChuanglanSmsApi();
  1336. $result = $smsapi->sendSMS($phone, $template);
  1337. $result = json_decode($result, true);
  1338. $id = getStringId();
  1339. $record_data = [
  1340. 'id' => $id,
  1341. 'userId' => $userId,
  1342. 'bizId' => $result["msgId"],
  1343. 'type' => $type,
  1344. 'smsType' => 2,
  1345. 'name' => $name,
  1346. 'phone' => $phone,
  1347. 'params' => $processName,
  1348. 'templateCode' => $template,
  1349. 'state' => $result['code'] == 0 ? 2 : 3,
  1350. 'sendingDate' => date("Y-m-d H:i:s", time()),
  1351. 'createTime' => date("Y-m-d H:i:s", time()),
  1352. 'msg' => $result['errorMsg']
  1353. ];
  1354. MessageRecord::create($record_data);
  1355. }
  1356. }
  1357. }
  1358. public function check() {
  1359. //公共调度方法
  1360. $request = $this->request;
  1361. $params = $request->param();
  1362. $check = $params["checkState"];
  1363. $check_msg = trim($params["checkMsg"]);
  1364. $files = $params["files"];
  1365. $fields = $params["fields"];
  1366. $id = $params["id"];
  1367. $talent_info = VerifyApi::getOne($id);
  1368. $checkState = $talent_info["checkState"];
  1369. if (!$talent_info) {
  1370. return json(["msg" => "数据错误"]);
  1371. }
  1372. if (!$check) {
  1373. return json(["msg" => "请选择审核状态"]);
  1374. }
  1375. if (!$check_msg) {
  1376. return json(["msg" => "请填写审核说明"]);
  1377. }
  1378. if ($checkState == TalentState::FST_SUBMIT) {
  1379. return $this->baseCheck($request, $talent_info);
  1380. } else if ($checkState == TalentState::BASE_VERIFY_PASS) {
  1381. return $this->baseReCheck($request, $talent_info);
  1382. } else if ($checkState == TalentState::SCND_SUBMIT) {
  1383. return $this->fstCheck($request, $talent_info);
  1384. } else if ($checkState == TalentState::FST_VERIFY_PASS) {
  1385. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1386. $companys = array_filter(explode(",", $condition["companyIds"]));
  1387. if ($companys && $talent_info["pass_dept_check"] != 1) {
  1388. if (!in_array($this->user["companyId"], $companys))
  1389. return json(["msg" => "你的部门不在并审部门列表"]);
  1390. return $this->deptCheck($request, $talent_info, $companys);
  1391. } else {
  1392. return $this->reCheck($request, $talent_info);
  1393. }
  1394. } else if ($checkState == TalentState::DEPT_VERIFY_PASS) {
  1395. return $this->reCheck($request, $talent_info);
  1396. } else {
  1397. return json(["msg" => "不在审核范围内,保存失败"]);
  1398. }
  1399. }
  1400. public function submitCheck() {
  1401. //公共调度方法
  1402. $id = $this->request->param("id");
  1403. $talent_info = VerifyApi::getOne($id);
  1404. $checkState = $talent_info["checkState"];
  1405. if (!$talent_info) {
  1406. return json(["msg" => "数据错误"]);
  1407. }
  1408. if ($checkState == TalentState::FST_SUBMIT) {
  1409. return $this->baseSubmitCheck($talent_info);
  1410. } else if ($checkState == TalentState::BASE_VERIFY_PASS) {
  1411. return $this->baseReSubmitCheck($talent_info);
  1412. } else if ($checkState == TalentState::SCND_SUBMIT) {
  1413. return $this->fstSubmitCheck($talent_info);
  1414. } else if ($checkState == TalentState::FST_VERIFY_PASS) {
  1415. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1416. $companys = array_filter(explode(",", $condition["companyIds"]));
  1417. if ($companys && $talent_info["pass_dept_check"] != 1) {
  1418. if (!in_array($this->user["companyId"], $companys))
  1419. return json(["msg" => "你的部门不在并审部门列表"]);
  1420. return $this->deptSubmitCheck($talent_info, $companys);
  1421. } else {
  1422. return $this->reSubmitCheck($talent_info);
  1423. }
  1424. } else if ($checkState == TalentState::DEPT_VERIFY_PASS) {
  1425. return $this->reSubmitCheck($talent_info);
  1426. } else {
  1427. return json(["msg" => "不在审核范围内,审核失败"]);
  1428. }
  1429. }
  1430. public function validateIsCheck() {
  1431. $params = $this->request->param();
  1432. $id = $params["id"];
  1433. $process = $params["process"];
  1434. $talent_info = VerifyApi::getOne($id);
  1435. $fstLog = TalentLogApi::getFstLog($id, 1);
  1436. $isMix = false;
  1437. if (in_array($fstLog["state"], [TalentState::SCND_SAVE, TalentState::SCND_SUBMIT])) {
  1438. //初次提交是待初审状态,则为新的混合基础信息和人才认证信息的申报
  1439. $isMix = true;
  1440. }
  1441. $enterprise = \app\common\model\Enterprise::findOrEmpty($talent_info["enterprise_id"]);
  1442. if ($talent_info) {
  1443. $checkState = $talent_info["checkState"];
  1444. if (!$process || ($process == 3 && $checkState != TalentState::SCND_SUBMIT) || ($process == 4 && ($checkState != TalentState::FST_VERIFY_PASS || $talent_info["pass_dept_check"] == 1)) || ($process == 5 && !in_array($checkState, [TalentState::DEPT_VERIFY_PASS, TalentState::FST_VERIFY_PASS]))) {
  1445. return json(["msg" => "该申报不在审核范围内,无法审核"]);
  1446. }
  1447. $process = 0;
  1448. switch ($checkState) {
  1449. case TalentState::FST_SUBMIT:
  1450. $fields = DictApi::getTalentFields(1, $talent_info["isImport"]);
  1451. $field_tmp = [];
  1452. foreach ($fields as $key => $field) {
  1453. $field_tmp[] = ["key" => $key, "value" => $field];
  1454. }
  1455. $where[] = ["project", "=", 1];
  1456. $where[] = ["step", "=", 1];
  1457. $where[] = ["active", "=", 1];
  1458. $where[] = ["type", "=", $enterprise["type"]];
  1459. $files = \think\facade\Db::table("new_common_filetype")->where($where)->select();
  1460. $process = 1;
  1461. break;
  1462. case TalentState::BASE_VERIFY_PASS:
  1463. $fields = DictApi::getTalentFields(1, $talent_info["isImport"]);
  1464. $field_tmp = [];
  1465. foreach ($fields as $key => $field) {
  1466. $field_tmp[] = ["key" => $key, "value" => $field];
  1467. }
  1468. $where[] = ["project", "=", 1];
  1469. $where[] = ["step", "=", 1];
  1470. $where[] = ["active", "=", 1];
  1471. $where[] = ["type", "=", $enterprise["type"]];
  1472. $files = \think\facade\Db::table("new_common_filetype")->where($where)->select();
  1473. $process = 2;
  1474. break;
  1475. case TalentState::SCND_SUBMIT:
  1476. $fields = DictApi::getTalentFields(2, $talent_info["isImport"]);
  1477. $process = 3;
  1478. break;
  1479. case TalentState::FST_VERIFY_PASS:
  1480. $tc = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1481. if ($tc["companyIds"] && $talent_info["pass_dept_check"] != 1) {
  1482. $process = 4;
  1483. $fields = DictApi::getTalentFields(3, $talent_info["isImport"]);
  1484. } else {
  1485. $process = 5;
  1486. $fields = DictApi::getTalentFields(2, $talent_info["isImport"]);
  1487. }
  1488. break;
  1489. case TalentState::DEPT_VERIFY_PASS:
  1490. $process = 5;
  1491. $fields = DictApi::getTalentFields(2, $talent_info["isImport"]);
  1492. break;
  1493. }
  1494. if ($isMix && $process != 4) {
  1495. if ($enterprise["type"] == 2) {
  1496. $fields = DictApi::getTalentFields_IC();
  1497. } else {
  1498. $fields = DictApi::getTalentFields(4, $talent_info["isImport"]);
  1499. }
  1500. }
  1501. if ($fields["fst_work_time"] && in_array($enterprise['enterpriseTag'], ['mtdw', 'gyqyh', 'mbfqy', 'jrjg']) && $enterprise["type"] == 1) {
  1502. $fields["fst_work_time"] = $talent_info['talent_type'] == 1 ? "近三年来晋工作时间" : "近三年(首次)来晋工作时间";
  1503. }
  1504. if ($checkState != TalentState::FST_SUBMIT) {
  1505. //$fields = DictApi::getTalentFields(2);
  1506. $field_tmp = [];
  1507. if ($fields) {
  1508. foreach ($fields as $key => $field) {
  1509. $field_tmp[] = ["key" => $key, "value" => $field];
  1510. }
  1511. }
  1512. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1513. $companys = array_filter(explode(",", $condition["companyIds"]));
  1514. $_companys = [];
  1515. foreach ($companys as $companyId) {
  1516. $company = CompanyApi::getOne($companyId);
  1517. $_companys[] = $company;
  1518. }
  1519. if ($process == 4 && $enterprise["type"] == 1) {
  1520. $where = [];
  1521. $cwfts = explode(";", $condition["companyWithFileType"]);
  1522. foreach ($cwfts as $cwft) {
  1523. $_company_setting = explode(":", $cwft);
  1524. if ($_company_setting[0] == $this->user["companyId"]) {
  1525. $where[] = ["id", "in", explode(",", $_company_setting[1])];
  1526. break;
  1527. }
  1528. }
  1529. if ($where) {
  1530. $where[] = ["delete", "=", 0];
  1531. $files = \think\facade\Db::table("new_common_filetype")->where($where)->order("sn asc")->select();
  1532. } else {
  1533. $files = [];
  1534. }
  1535. } else {
  1536. $where = [];
  1537. $whr = [];
  1538. if (!$isMix) {
  1539. $where[] = ["step", "=", 2];
  1540. }
  1541. $where[] = ["project", "=", 1];
  1542. $where[] = ["active", "=", 1];
  1543. $where[] = ["type", "=", $enterprise["type"]];
  1544. $where[] = ["isConditionFile", "<>", 1];
  1545. $where[] = ["delete", "=", 0];
  1546. if ($condition && $condition["bindFileTypes"]) {
  1547. $whr[] = ["id", "in", explode(",", $condition["bindFileTypes"])];
  1548. $files = \think\facade\Db::table("new_common_filetype")->whereOr([$where, $whr])->order("sn asc")->select();
  1549. } else {
  1550. $files = \think\facade\Db::table("new_common_filetype")->where($where)->order("sn asc")->select();
  1551. }
  1552. }
  1553. }
  1554. $talent_info["files"] = array_filter(explode(",", $talent_info["modify_files"]));
  1555. $talent_info["fields"] = array_filter(explode(",", $talent_info["modify_fields"]));
  1556. /* 保存的审核内容start */
  1557. $last_log = TalentLogApi::getLastLog($id, ProjectState::TALENT, 0, ["active", "=", 0]);
  1558. if ($last_log["step"] == 3 && $last_log["companyId"] != $this->user["companyId"]) {
  1559. $last_log = TalentLogApi::getLastLog($id, ProjectState::TALENT, $this->user["companyId"], ["active", "=", 0]);
  1560. }
  1561. $check = ["msg" => $last_log["description"]];
  1562. if ($last_log["state"] == TalentState::FST_VERIFY_PASS && $last_log["new_state"] == TalentState::FST_VERIFY_PASS) {
  1563. if ($talent_info["pass_dept_check"] == 1) {
  1564. if ($talent_info["isImport"] && $talent_info["isMatchZhiren"]) {
  1565. $check["checkState"] = 3; //初审通过
  1566. } else {
  1567. $check["checkState"] = 4; //初审通过(跳过部门并审)
  1568. }
  1569. } else {
  1570. if ($talent_info["re_check_companys"] && $talent_info["highProcess"] >= 4) {
  1571. $talent_info["re_check_companys"] = array_filter(explode(",", $talent_info["re_check_companys"]));
  1572. $check["checkState"] = 5; //初审通过(需要再次部门并审)
  1573. } else {
  1574. if ($process == 4) {
  1575. $check["checkState"] = ""; //部门待审核(系统自动生成的记录,应该算未保存状态,所以设成空,未选择状态)
  1576. } else {
  1577. $check["checkState"] = 3; //初审通过
  1578. }
  1579. }
  1580. }
  1581. }
  1582. if ($last_log["state"] == TalentState::FST_VERIFY_REJECT && $last_log["new_state"] == TalentState::SCND_SAVE) {
  1583. $check["checkState"] = 2; //初审驳回
  1584. }
  1585. if ($last_log["state"] == TalentState::FST_VERIFY_PASS && $last_log["new_state"] == TalentState::DEPT_VERIFY_PASS) {
  1586. $check["checkState"] = 3; //部门通过
  1587. }
  1588. if ($last_log["state"] == TalentState::FST_VERIFY_PASS && $last_log["new_state"] == TalentState::SCND_SUBMIT) {
  1589. $check["checkState"] = 2; //部门驳回
  1590. }
  1591. if ($last_log["state"] == TalentState::REVERIFY_PASS && $last_log["new_state"] == TalentState::REVERIFY_PASS) {
  1592. $check["checkState"] = 3; //复审通过
  1593. }
  1594. if ($last_log["state"] == TalentState::REVERIFY_REJECT && $last_log["new_state"] == TalentState::SCND_SUBMIT) {
  1595. $check["checkState"] = 2; //复审驳回
  1596. }
  1597. if ($last_log["state"] == TalentState::REVERIFY_FAIL && $last_log["new_state"] == TalentState::REVERIFY_FAIL) {
  1598. $check["checkState"] = -1; //复审失败
  1599. }
  1600. /* 保存的审核内容end */
  1601. return json(["code" => 200, "obj" => ["process" => $process, "talentInfo" => $talent_info, "check" => $check, "fieldList" => $field_tmp, "fileList" => $files, "companys" => $_companys]]);
  1602. }
  1603. }
  1604. public function findFieldsAndFiles() {
  1605. $id = $this->request["id"];
  1606. $talentInfo = VerifyApi::getOne($id);
  1607. $lastLog = TalentLogApi::getLastLog($id, ProjectState::TALENT);
  1608. $responseObj = new \stdClass();
  1609. if ($talentInfo["checkState"] == TalentState::SCND_SAVE && $lastLog["state"] == TalentState::FST_VERIFY_REJECT) {
  1610. if ($this->user["type"] == 2) {
  1611. $fields = DictApi::getTalentFields_IC();
  1612. } else {
  1613. $fields = DictApi::getTalentFields(4, $talentInfo["isImport"]);
  1614. }
  1615. $enterprise = \app\common\model\Enterprise::findOrEmpty($talentInfo["enterprise_id"]);
  1616. if ($fields["fst_work_time"] && in_array($enterprise['enterpriseTag'], ['mtdw', 'gyqyh', 'mbfqy', 'jrjg']) && $enterprise["type"] == 1) {
  1617. $fields["fst_work_time"] = $talentInfo['talent_type'] == 1 ? "近三年来晋工作时间" : "近三年(首次)来晋工作时间";
  1618. }
  1619. $field_tmp = [];
  1620. if ($fields) {
  1621. foreach ($fields as $key => $field) {
  1622. $field_tmp[] = ["key" => $key, "value" => $field];
  1623. }
  1624. }
  1625. $condition = TalentConditionApi::getOne($talentInfo["talent_condition"]);
  1626. $where = [];
  1627. $whr = [];
  1628. $where[] = ["project", "=", 1];
  1629. $where[] = ["active", "=", 1];
  1630. $where[] = ["type", "=", $enterprise["type"]];
  1631. $where[] = ["isConditionFile", "<>", 1];
  1632. $where[] = ["delete", "=", 0];
  1633. if ($condition && $condition["bindFileTypes"]) {
  1634. $whr[] = ["id", "in", explode(",", $condition["bindFileTypes"])];
  1635. $files = \think\facade\Db::table("new_common_filetype")->whereOr([$where, $whr])->order("sn asc")->select();
  1636. } else {
  1637. $files = \think\facade\Db::table("new_common_filetype")->where($where)->order("sn asc")->select();
  1638. }
  1639. $responseObj->code = 200;
  1640. $responseObj->id = $id;
  1641. $responseObj->fileList = $files;
  1642. $responseObj->fieldList = $field_tmp;
  1643. $responseObj->select = [
  1644. "files" => array_filter(explode(",", $talentInfo["modify_files"])),
  1645. "fields" => array_filter(explode(",", $talentInfo["modify_fields"]))
  1646. ];
  1647. } else {
  1648. $responseObj->msg = "不是驳回状态不可以编辑驳回内容";
  1649. }
  1650. return json($responseObj);
  1651. }
  1652. /**
  1653. * 初审-修改驳回字段
  1654. * @auth {{/talentInfo/updateFieldsAndFiles}}
  1655. */
  1656. public function updateFieldsAndFiles() {
  1657. $id = $this->request["id"];
  1658. $fields = array_filter(explode(",", $this->request["fields"]));
  1659. $files = array_filter(explode(",", $this->request["files"]));
  1660. $talentInfo = VerifyApi::getOne($id);
  1661. $lastLog = TalentLogApi::getLastLog($id, ProjectState::TALENT);
  1662. $responseObj = new \stdClass();
  1663. if ($talentInfo["checkState"] == TalentState::SCND_SAVE && $lastLog["state"] == TalentState::FST_VERIFY_REJECT) {
  1664. if (!$fields && !$files) {
  1665. $responseObj->msg = "请选择可修改的字段或附件!";
  1666. return json($responseObj);
  1667. }
  1668. try {
  1669. $data["id"] = $id;
  1670. $data["modify_fields"] = $fields ? implode(",", $fields) : null;
  1671. $data["modify_files"] = $files ? implode(",", $files) : null;
  1672. TalentModel::update($data);
  1673. $responseObj->code = 200;
  1674. $responseObj->msg = "驳回字段修改成功";
  1675. return json($responseObj);
  1676. } catch (\think\db\exception\DbException $e) {
  1677. $responseObj->msg = $e->getMessage();
  1678. return json($responseObj);
  1679. }
  1680. } else {
  1681. $responseObj->msg = "不是驳回状态不可以编辑驳回内容";
  1682. return json($responseObj);
  1683. }
  1684. }
  1685. /**
  1686. * 人才库-取消人才
  1687. * @auth {{/talentInfo/libraryCancle}}
  1688. */
  1689. public function removeFromLibrary() {
  1690. $responseObj = new \stdClass();
  1691. $params = $this->request->param();
  1692. $info = VerifyApi::getOne($params["id"]);
  1693. if (!$params["id"] || !$info) {
  1694. $responseObj->msg = "系统错误,请联系管理员";
  1695. return json($responseObj);
  1696. }
  1697. if ($info["active"] != 2) {
  1698. $responseObj->msg = "该人才未处于离职状态,无法取消";
  1699. return json($responseObj);
  1700. }
  1701. if ($info["isEffect"] == 4) {
  1702. $responseObj->msg = "无法重复取消";
  1703. return json($responseObj);
  1704. }
  1705. if (VerifyApi::setEffect($info["id"], 4, ["description" => "取消优秀人才", "stateChange" => "有效->无效", "active" => 1])) {
  1706. $responseObj->code = 200;
  1707. $responseObj->msg = "取消优秀人才成功";
  1708. return json($responseObj);
  1709. }
  1710. $responseObj->msg = "系统错误,请联系管理员";
  1711. return json($responseObj);
  1712. }
  1713. /**
  1714. * 人才库-恢复人才
  1715. * @auth {{/talentInfo/libraryRecovery}}
  1716. */
  1717. public function recovery() {
  1718. $responseObj = new \stdClass();
  1719. $params = $this->request->param();
  1720. $info = VerifyApi::getOne($params["id"]);
  1721. if (!$params["id"] || !$info) {
  1722. $responseObj->msg = "系统错误,请联系管理员";
  1723. return json($responseObj);
  1724. }
  1725. if ($info["isEffect"] != 4) {
  1726. $responseObj->msg = "无法恢复有效数据";
  1727. return json($responseObj);
  1728. }
  1729. if (VerifyApi::setEffect($info["id"], 1, ["description" => "恢复优秀人才", "stateChange" => "无效->有效", "active" => 1])) {
  1730. $responseObj->code = 200;
  1731. $responseObj->msg = "恢复优秀人才成功";
  1732. return json($responseObj);
  1733. }
  1734. $responseObj->msg = "系统错误,请联系管理员";
  1735. return json($responseObj);
  1736. }
  1737. public function baseVerifyListExport() {
  1738. $this->commonExport(1);
  1739. }
  1740. public function baseReverifyListExport() {
  1741. $this->commonExport(2);
  1742. }
  1743. public function fstVerifyListExport() {
  1744. $this->commonExport(3);
  1745. }
  1746. public function deptVerifyListExport() {
  1747. $this->commonExport(4);
  1748. }
  1749. public function reVerifyListExport() {
  1750. $this->commonExport(5);
  1751. }
  1752. public function preListExport() {
  1753. $this->commonExport(6);
  1754. }
  1755. public function libraryListExport() {
  1756. $this->commonExport(7);
  1757. }
  1758. private function commonExport($process) {
  1759. $companyId = $this->user['companyId'];
  1760. $company = getCacheById("Company", $companyId);
  1761. $setting = [];
  1762. $params = $this->request->param();
  1763. $fields = $params["export"];
  1764. if (!$fields)
  1765. return json(["msg" => "请选择要导出的数据"]);
  1766. $names = DictApi::getTalentFields(4, in_array("isMatchZhiren", $fields));
  1767. $names["industryFieldNew"] = "产业领域";
  1768. $names["enterpriseName"] = "单位名称";
  1769. $names["enterpriseTag"] = "单位标签";
  1770. $names["street"] = "所属镇街";
  1771. $names["checkState"] = "审核状态";
  1772. $names["checkMsg"] = "审核意见";
  1773. $names["first_dept_check_time"] = "进入并审时间";
  1774. $names["verifyDepts"] = "审核部门";
  1775. $names["deptDescription"] = "审核部门意见";
  1776. $names["deptPass"] = "部门通过";
  1777. $names["deptReject"] = "部门驳回";
  1778. $names["deptWait"] = "部门待审";
  1779. $names["breakFaithName"] = "曾被相关主管部门列为失信个人";
  1780. $names["identifyMonth"] = "公布入选月份";
  1781. $names["certificateNo"] = "人才编号";
  1782. $names["activeName"] = "离职状态";
  1783. $names["cur_quit_time"] = "离职时间";
  1784. $names["first_submit_time"] = "首次确认提交时间";
  1785. $names["new_submit_time"] = "最新确认提交时间";
  1786. $list = VerifyApi::getExportDatas($process, $params);
  1787. if ($process == 4 && VerifyApi::chkUserInSuperDeptUsers()) {
  1788. $fields[] = "first_dept_check_time";
  1789. $fields[] = "verifyDepts";
  1790. $fields[] = "deptDescription";
  1791. $fields[] = "deptPass";
  1792. $fields[] = "deptReject";
  1793. $fields[] = "deptWait";
  1794. $verifyDescriptionColumn = getExcelColumnByIndex(count($fields) - 4);
  1795. $setting["font"][] = [sprintf("%s%d:%s%d", $verifyDescriptionColumn, 2, $verifyDescriptionColumn, count($list) + 1), 8, "宋体"];
  1796. $setting["width"][] = [$verifyDescriptionColumn, 45];
  1797. $verifyDeptsColumn = getExcelColumnByIndex(count($fields) - 5);
  1798. $setting["font"][] = [sprintf("%s%d:%s%d", $verifyDeptsColumn, 2, $verifyDeptsColumn, count($list) + 1), 8, "宋体"];
  1799. $setting["width"][] = [$verifyDeptsColumn, 30];
  1800. }
  1801. foreach ($fields as $field) {
  1802. $columns[] = $names[$field];
  1803. }
  1804. $datas = [];
  1805. for ($i = 0; $i < count($list); $i++) {
  1806. $data = [];
  1807. for ($n = 0; $n < count($fields); $n++) {
  1808. $cellValue = $list[$i][$fields[$n]];
  1809. $data[] = $cellValue;
  1810. if ($fields[$n] == "deptPass" && $cellValue > 0) {
  1811. $setting["color"][] = [sprintf("%s%d", getExcelColumnByIndex($n), $i + 2), "15dd0f"];
  1812. }
  1813. if ($fields[$n] == "deptReject" && $cellValue > 0) {
  1814. $setting["color"][] = [sprintf("%s%d", getExcelColumnByIndex($n), $i + 2), "ff0000"];
  1815. }
  1816. if ($fields[$n] == "deptWait" && $cellValue > 0) {
  1817. $setting["color"][] = [sprintf("%s%d", getExcelColumnByIndex($n), $i + 2), "fdcb54"];
  1818. }
  1819. }
  1820. $datas[] = $data;
  1821. }
  1822. $setting["freeze"] = "A2";
  1823. $setting["filter"] = sprintf("A1:%s1", getExcelColumnByIndex(count($columns) - 1));
  1824. if ($datas) {
  1825. export($columns, $datas, "人才审核列表导出", $setting);
  1826. exit();
  1827. }
  1828. echo "<script>parent.layer.alert('没有可以导出的数据');window.history.go(-1);</script>";
  1829. }
  1830. public function getPhones() {
  1831. $list = VerifyApi::getListByProcess($this->request->param("process"));
  1832. $result = [];
  1833. if ($list) {
  1834. foreach ($list as $item) {
  1835. if ($item["phone"] && $item["name"]) {
  1836. $result[] = sprintf("%s:%s", $item["name"], $item["phone"]);
  1837. }
  1838. }
  1839. }
  1840. return json(["code" => 200, "obj" => implode(";", $result)]);
  1841. }
  1842. public function getEnterprisePhones() {
  1843. $list = VerifyApi::getListByProcess($this->request->param("process"));
  1844. $result = [];
  1845. if ($list) {
  1846. foreach ($list as $item) {
  1847. if ($item["agentName"] && $item["agentPhone"]) {
  1848. $result[] = sprintf("%s:%s", $item["agentName"], $item["agentPhone"]);
  1849. }
  1850. }
  1851. }
  1852. return json(["code" => 200, "obj" => implode(";", $result)]);
  1853. }
  1854. }