Talent.php 91 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955
  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. $no_prefix = $_prefix_type . $year . $talent_info["talent_arrange"];
  744. $where = [];
  745. $where[] = ["certificateNo", "like", $no_prefix . "%"];
  746. $max_no = $talent_max_no[$talent_info["talent_arrange"]] ?: Db::table("new_talent_info")->where($where)->max("certificateNo", false);
  747. if (!$max_no) {
  748. $max_no = $no_prefix . "0001";
  749. } else {
  750. $new_no = intval(substr($max_no, $subindex)) + 1;
  751. $max_no = $no_prefix . str_pad($new_no, 4, "0", STR_PAD_LEFT);
  752. }
  753. //更新证书编号
  754. $data["id"] = $talent_info["id"];
  755. $data["certificateNo"] = $max_no;
  756. $data["checkState"] = TalentState::CERTIFICATED;
  757. $data["isEffect"] = 1;
  758. $data["isPublic"] = 5;
  759. Db::table("new_talent_info")->update($data);
  760. //写入日志
  761. $log["last_state"] = TalentState::PUBLISH_PASS;
  762. $log["id"] = getStringId();
  763. $log["state"] = $log["new_state"] = TalentState::CERTIFICATED;
  764. $log["type"] = 1;
  765. $log["mainId"] = $talent_info["id"];
  766. $log["companyId"] = $user["companyId"];
  767. $log["active"] = 1;
  768. $log["description"] = "人才码为:" . $max_no;
  769. $log["createUser"] = sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]);
  770. $log["createTime"] = date("Y-m-d H:i:s");
  771. Db::table("new_talent_checklog")->insert($log);
  772. $talent_max_no[$talent_info["talent_arrange"]] = $max_no;
  773. }
  774. Db::commit();
  775. if ($user["type"] == 2) {
  776. //办法上只写电路人才,所以暂时只给电路增加基础分
  777. $_ids = array_column($talent_list, "id");
  778. for ($i = 0; $i < count($_ids); $i++) {
  779. queue("app\job\Talent", ["type" => 4, "id" => $_ids[$i]]);
  780. }
  781. }
  782. return json(["code" => 200, "msg" => "发放人才码成功"]);
  783. } catch (\Exception $e) {
  784. Db::rollback();
  785. return json(["msg" => "发放人才码失败:" . $e->getMessage()]);
  786. }
  787. flock($lockFile, LOCK_UN);
  788. } else {
  789. return json(["msg" => "同一时间只能有一个管理员进行发放人才码操作"]);
  790. }
  791. }
  792. /**
  793. * 预备人才库-撤销公布
  794. * @auth {{/talentInfo/prepareCanclePublish}}
  795. */
  796. public function pre_cancel_publish() {
  797. }
  798. /**
  799. * 基本条件审核-提交未保存
  800. * @param \think\Request $request
  801. * @param type $talent_info
  802. * @return type json
  803. */
  804. private function baseCheck(\think\Request $request, $talent_info) {
  805. $params = $request->param();
  806. if ($params["checkState"] == 3) {
  807. //审核成功
  808. $log_checkState = $checkState = TalentState::BASE_VERIFY_PASS; //基础信息审核成功
  809. } else {
  810. //审核驳回并记录需要修改的字段和上传文件
  811. $checkState = TalentState::FST_SAVE; //退回提交材料阶段
  812. $log_checkState = TalentState::BASE_REJECT; //日志记录拒绝状态
  813. }
  814. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  815. if (!$log)
  816. return json(["msg" => "日志数据异常,保存失败"]);
  817. if ($log["active"] == 0) {
  818. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  819. } else {
  820. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  821. }
  822. $data["id"] = $talent_info["id"];
  823. $data["modify_files"] = $params["files"];
  824. $data["modify_fields"] = $params["fields"];
  825. TalentModel::update($data);
  826. return json(["code" => 200, "msg" => "保存成功"]);
  827. }
  828. /**
  829. * 基本条件审核-提交审核
  830. * @param type $talent_info
  831. * @return type json
  832. */
  833. private function baseSubmitCheck($talent_info) {
  834. return $this->commonSubmitCheck($talent_info, 1);
  835. }
  836. /**
  837. * 基本条件复审-提交未保存
  838. * @param \think\Request $request
  839. * @param type $talent_info
  840. * @return type json
  841. */
  842. private function baseReCheck(\think\Request $request, $talent_info) {
  843. $params = $request->param();
  844. if ($params["checkState"] == 3) {
  845. //审核成功
  846. $log_checkState = $checkState = TalentState::BASE_REVERIFY_PASS; //基础信息复审成功
  847. } else if ($params["checkState"] == 2) {
  848. //审核驳回并记录需要修改的字段和上传文件
  849. $checkState = TalentState::FST_SUBMIT; //退回待基础审核状态
  850. $log_checkState = TalentState::BASE_REVERIFY_REJECT; //日志记录拒绝状态
  851. } else {
  852. $log_checkState = $checkState = TalentState::BASE_REVERIFY_FAIL; //审核失败
  853. }
  854. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  855. if (!$log)
  856. return json(["msg" => "日志数据异常,保存失败"]);
  857. if ($log["active"] == 0) {
  858. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  859. } else {
  860. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  861. }
  862. $data["id"] = $talent_info["id"];
  863. $data["modify_files"] = $params["files"];
  864. $data["modify_fields"] = $params["fields"];
  865. TalentModel::update($data);
  866. return json(["code" => 200, "msg" => "保存成功"]);
  867. }
  868. /**
  869. * 基本条件复审-提交审核
  870. * @param type $talent_info
  871. * @return type json
  872. */
  873. private function baseReSubmitCheck($talent_info) {
  874. return $this->commonSubmitCheck($talent_info, 2);
  875. }
  876. /**
  877. * 初审-提交未保存
  878. * @param \think\Request $request
  879. * @param type $talent_info
  880. * @return type json
  881. */
  882. private function fstCheck(\think\Request $request, $talent_info) {
  883. $params = $request->param();
  884. $data["pass_dept_check"] = 0;
  885. if ($params["checkState"] == 3) {
  886. //审核成功,并取消设置越过部门并审
  887. $log_checkState = $checkState = TalentState::FST_VERIFY_PASS; //初审成功
  888. if ($talent_info["isImport"] && $talent_info["isMatchZhiren"]) {
  889. $data["pass_dept_check"] = 1;
  890. }
  891. } else if ($params["checkState"] == 4) {
  892. if ($talent_info["highProcess"] < 3)
  893. return json(["msg" => "只有曾经达到过部门并审,初审时才可以选择直接跳过部门并审阶段"]);
  894. //审核成功,并设置越过部门并审。附加条件:最高进度曾经通过初审3,上级驳回后重新初审的
  895. $log_checkState = $checkState = TalentState::FST_VERIFY_PASS; //初审成功
  896. if ($talent_info["highProcess"] >= 3) {
  897. $data["pass_dept_check"] = 1;
  898. }
  899. } else if ($params["checkState"] == 5) {
  900. //选择重审部门
  901. if ($talent_info["highProcess"] < 3)
  902. return json(["msg" => "只有曾经达到过部门并审,初审时才可以选择再次审核的部门"]);
  903. if (!$params["companys"])
  904. return json(["msg" => "请选择需要再次审核的部门"]);
  905. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  906. $companyIds = array_filter(explode(",", $condition["companyIds"])); //该条件下需要审核的所有单位
  907. $re_check_companys = array_filter(explode(",", $talent_info["re_check_companys"]));
  908. foreach ($re_check_companys as $reCompanyId) {
  909. if (!in_array($reCompanyId, $companyIds)) {
  910. return json(["msg" => "错误的部门"]);
  911. }
  912. }
  913. $log_checkState = $checkState = TalentState::FST_VERIFY_PASS; //初审成功
  914. } else {
  915. //审核驳回并记录需要修改的字段和上传文件
  916. $checkState = TalentState::SCND_SAVE; //退回材料编辑状态
  917. $log_checkState = TalentState::FST_VERIFY_REJECT; //日志记录拒绝状态
  918. }
  919. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  920. if (!$log && !$talent_info["oldId"])
  921. return json(["msg" => "日志数据异常,保存失败"]);
  922. if ($log["active"] === 0) {
  923. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  924. } else {
  925. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  926. }
  927. $data["id"] = $talent_info["id"];
  928. $data["modify_files"] = $params["files"];
  929. $data["modify_fields"] = $params["fields"];
  930. $data["re_check_companys"] = $params["companys"];
  931. TalentModel::update($data);
  932. return json(["code" => 200, "msg" => "保存成功"]);
  933. }
  934. /**
  935. * 初审-提交审核
  936. * @param type $talent_info
  937. * @return type json
  938. */
  939. private function fstSubmitCheck($talent_info) {
  940. $nowProcess = 3;
  941. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  942. if (!$log || $log["active"] == 1)
  943. return json(["msg" => "请先保存审核状态,再提交审核"]);
  944. if (in_array($log["new_state"], [TalentState::BASE_VERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::REVERIFY_PASS])) {
  945. $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
  946. }
  947. $userIds = [];
  948. if ($log["state"] == TalentState::FST_VERIFY_PASS && $talent_info["pass_dept_check"] == 0) {
  949. $data["first_dept_check_time"] = date("Y-m-d H:i:s");
  950. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  951. $companyIds = array_filter(explode(",", $condition["companyIds"])); //该条件下需要审核的所有单位
  952. if ($talent_info["re_check_companys"]) {
  953. $unpass_companyIds = array_filter(explode(",", $talent_info["re_check_companys"]));
  954. } else {
  955. //这边去除已经审核通过的单位,主要通过日志是否存在记录。
  956. $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
  957. $unpass_companyIds = array_diff($companyIds, (array) $pass_companyIds); //排除已经通过的单位
  958. if (!$unpass_companyIds) {
  959. $data["pass_dept_check"] = 1; //部门已经全部审核过了,跳过部门审核
  960. }
  961. }
  962. if ($unpass_companyIds) {
  963. sort($unpass_companyIds);
  964. $delay = 9 * 24 * 3600; //9天的秒数
  965. queue("app\job\Talent", ["type" => 1, "id" => $talent_info["id"]], $delay); //加入部门审核超期处理队列,延迟7天执行
  966. TalentLogApi::writeDeptLogs($talent_info["id"], $unpass_companyIds, TalentState::FST_VERIFY_PASS);
  967. //初审通过发送短信通知并审部门
  968. $codes = ["talentInfo_depCheck"];
  969. $menuIds = MenuApi::getMenuIdsByCodes($codes);
  970. $where = [];
  971. $where[] = ["menuid", "in", $menuIds];
  972. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($codes))->column("roleid");
  973. $where = [];
  974. $where[] = ["status", "=", 1];
  975. $where[] = ["type", "=", $this->user["type"]];
  976. $where[] = ["companyId", "in", $unpass_companyIds];
  977. $where[] = ["roleid", "<>", 1];
  978. $regstr = ",(" . implode("|", $roleIds) . "),";
  979. $whereRaw = "concat(',',roleid,',') REGEXP '$regstr'";
  980. $userIds = User::where($where)->whereRaw($whereRaw)->column("id");
  981. /* $privs = ["/admin/talent/dept_check"];
  982. $menuIds = MenuApi::getMenuIdsByNewUrls($privs);
  983. $where[] = ["menuid", "in", $menuIds];
  984. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($privs))->column("roleid");
  985. $where = [];
  986. $where[] = ["status", "=", 1];
  987. $where[] = ["companyId", "in", $unpass_companyIds];
  988. $where[] = ["roleid", "in", $roleIds];
  989. $where[] = ["roleid", "<>", 1];
  990. $userIds = User::where($where)->column("id"); */
  991. }
  992. }
  993. $data["id"] = $talent_info["id"];
  994. $data["checkState"] = $log["new_state"];
  995. TalentModel::update($data);
  996. TalentLogApi::setActive($log["id"], 1);
  997. $this->sendMsgByState($talent_info, $log["state"], $userIds, $log["description"]);
  998. return json(["code" => 200, "msg" => "审核成功"]);
  999. }
  1000. /**
  1001. * 部门审核-提交未保存
  1002. * @param \think\Request $request
  1003. * @param type $talent_info
  1004. * @return type json
  1005. */
  1006. private function deptCheck(\think\Request $request, $talent_info, $companys) {
  1007. if ($talent_info["pass_dept_check"] == 1)
  1008. return json(["msg" => "不在审核范围。(初审部门已经选择跳过部门并审阶段)"]);
  1009. if (!in_array($this->user["companyId"], $companys))
  1010. return json(["msg" => "您的部门不在该申请的并审部门列表中。"]);
  1011. $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
  1012. $un_check_companyIds = TalentLogApi::getUnCheckDepts($talent_info["id"]); //未审核提交的单位
  1013. if (!in_array($this->user["companyId"], $un_check_companyIds) && in_array($this->user["companyId"], $pass_companyIds)) {
  1014. //判断不在未审核列表的同时判断已经在审核列表,是为了排除意外情况:缺失的待审核部门(通常是认证条件新增审核部门导致新增的部门未在审核列表中)
  1015. //缺失的待审核部门,作为未审状态,将在函数末尾根据当前审核情况补充一条保存未提交的记录
  1016. return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
  1017. }
  1018. $params = $request->param();
  1019. if ($params["checkState"] == 3) {
  1020. //审核成功
  1021. $log_checkState = TalentState::FST_VERIFY_PASS; //当前状态不变
  1022. $checkState = TalentState::DEPT_VERIFY_PASS; //审核成功
  1023. } else {
  1024. //审核驳回并记录需要修改的字段和上传文件
  1025. $checkState = TalentState::SCND_SUBMIT; //退回待初审
  1026. $log_checkState = TalentState::FST_VERIFY_PASS; //当前状态不变
  1027. $talent_condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1028. if (!$talent_condition["companyWithFileType"])
  1029. return json(["msg" => "尚未设置单位可审的附件,请联系管理员设置后再进行审批"]);
  1030. $cwfts = explode(";", $talent_condition["companyWithFileType"]);
  1031. $company_setting = [];
  1032. foreach ($cwfts as $cwft) {
  1033. $_company_setting = explode(":", $cwft);
  1034. if ($_company_setting[0] == $this->user["companyId"]) {
  1035. $company_setting = explode(",", $_company_setting[1]);
  1036. break;
  1037. }
  1038. }
  1039. if (!$company_setting)
  1040. return json(["msg" => "尚未设置单位可审的附件,请联系管理员设置后再进行审批"]);
  1041. //$data["modify_fields"] = $params["fields"];
  1042. $original_modify_files = explode(",", $talent_info["modify_files"]);
  1043. $_current_modify_files = explode(",", $params["files"]);
  1044. $unselect_files = array_diff($company_setting, $_current_modify_files); //比较设置和当前提交的,取差值集,既是可选而未选的附件集合
  1045. $new_modify_files = array_unique(array_merge($original_modify_files, $_current_modify_files)); //合并当前提交及库中原来保存的值
  1046. foreach ($new_modify_files as $key => $item) {
  1047. if (in_array($item, $unselect_files))
  1048. unset($new_modify_files[$key]);
  1049. }
  1050. $data["modify_files"] = implode(",", array_unique($new_modify_files));
  1051. }
  1052. $fst_dept_check_time = $talent_info["first_dept_check_time"];
  1053. $dept_log = TalentLogApi::getLogByCompanyId($talent_info["id"], $this->user["companyId"], $fst_dept_check_time);
  1054. if ($dept_log["active"] == 1)
  1055. return json(["msg" => "您的部门已经审核过了"]);
  1056. $data["id"] = $talent_info["id"];
  1057. TalentModel::update($data);
  1058. //修改日志
  1059. if (!$dept_log) {
  1060. TalentLogApi::write(ProjectState::TALENT, $talent_info["id"], [$log_checkState, $checkState, 3], $params["checkMsg"]); //补一条记录
  1061. //return json(["msg" => "未匹配日志,审核失败"]);
  1062. } else {
  1063. TalentLogApi::rewrite($dept_log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  1064. }
  1065. return json(["code" => 200, "msg" => "保存成功"]);
  1066. }
  1067. /**
  1068. * 部门审核-提交审核
  1069. * @param type $talent_info
  1070. * @return type json
  1071. */
  1072. private function deptSubmitCheck($talent_info, $companys) {
  1073. if ($talent_info["pass_dept_check"] == 1)
  1074. return json(["msg" => "不在审核范围。(初审部门已经选择跳过部门并审阶段)"]);
  1075. if (!in_array($this->user["companyId"], $companys))
  1076. return json(["msg" => "您的部门不在该申请的并审部门列表中。"]);
  1077. $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
  1078. if (in_array($this->user["companyId"], $pass_companyIds))
  1079. return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
  1080. $dept_log = TalentLogApi::getLogByCompanyId($talent_info["id"], $this->user["companyId"], $talent_info["first_dept_check_time"]);
  1081. //if (!$dept_log)
  1082. //return json(["msg" => "未匹配日志,审核失败"]);
  1083. if ($dept_log["state"] == $dept_log["new_state"] || !$dept_log)
  1084. return json(["msg" => "请先保存审核状态,再提交审核"]);
  1085. if ($dept_log["active"] == 1)
  1086. return json(["msg" => "您的部门已经审核过了"]);
  1087. if ($talent_info["re_check_companys"]) {
  1088. $re_check_companys = array_filter(explode(",", $talent_info["re_check_companys"]));
  1089. $companys = VerifyApi::getNewReCheckCompanyIds($re_check_companys, $companys, $pass_companyIds);
  1090. $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"], $talent_info["first_dept_check_time"]); //重审单位中已经通过的单位
  1091. }
  1092. $no_valid_companyIds = array_diff($pass_companyIds, $companys);
  1093. $pass_companyIds = array_diff($pass_companyIds, $no_valid_companyIds);
  1094. $over = $pass_companyIds ? count($pass_companyIds) : 0; //完成度,如果重审之前已有通过审核的部门,不用再审,直接按通过算
  1095. $error = 0; //失败数
  1096. $nowProcess = 4;
  1097. $over++;
  1098. if ($dept_log["new_state"] == TalentState::SCND_SUBMIT) {
  1099. $error++;
  1100. }
  1101. $logs = TalentLogApi::getListLogByTime($talent_info["id"], $talent_info["first_dept_check_time"]);
  1102. for ($i = 0; $i < count($logs); $i++) {
  1103. if (!in_array($logs[$i]["companyId"], $pass_companyIds) && in_array($logs[$i]["companyId"], $companys)) {
  1104. $over += $logs[$i]["active"] == 1 ? 1 : 0;
  1105. if ($logs[$i]["new_state"] == TalentState::SCND_SUBMIT) {
  1106. $error++;
  1107. }
  1108. }
  1109. }
  1110. if ($over == count($companys)) {
  1111. //全部已审核
  1112. $checkState = TalentState::SCND_SUBMIT;
  1113. $log_checkState = TalentState::DEPT_VERIFY_REJECT;
  1114. if ($error == 0) {
  1115. $log_checkState = $checkState = TalentState::DEPT_VERIFY_PASS;
  1116. $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
  1117. $data["modify_files"] = null;
  1118. }
  1119. if ($log_checkState == TalentState::DEPT_VERIFY_REJECT) {
  1120. $talent_condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1121. $cwfts = explode(";", $talent_condition["companyWithFileType"]);
  1122. $fileTypes = [];
  1123. foreach ($cwfts as $cwft) {
  1124. $_company_setting = explode(":", $cwft);
  1125. $_fileTypes = explode(",", $_company_setting[1]);
  1126. $fileTypes = array_merge($fileTypes, $_fileTypes);
  1127. }
  1128. $modify_files = explode(",", $talent_info["modify_files"]);
  1129. $removeFileTypes = array_diff($modify_files, $fileTypes);
  1130. $newModifyFiles = array_diff($modify_files, $removeFileTypes);
  1131. $data["modify_files"] = implode(",", $newModifyFiles);
  1132. }
  1133. $data["id"] = $talent_info["id"];
  1134. $data["checkState"] = $checkState;
  1135. $data["first_dept_check_time"] = null;
  1136. $data["re_check_companys"] = null;
  1137. TalentModel::update($data);
  1138. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], "部门审核结束", 1);
  1139. if ($log_checkState == TalentState::DEPT_VERIFY_REJECT) {
  1140. //部门驳回发送短信通知
  1141. $codes = ["talentInfo_firstCheck"];
  1142. $menuIds = MenuApi::getMenuIdsByCodes($codes);
  1143. $where = [];
  1144. $where[] = ["menuid", "in", $menuIds];
  1145. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($codes))->column("roleid");
  1146. $where = [];
  1147. $where[] = ["status", "=", 1];
  1148. $where[] = ["type", "=", $this->user["type"]];
  1149. $where[] = ["roleid", "<>", 1];
  1150. $regstr = ",(" . implode("|", $roleIds) . "),";
  1151. $whereRaw = "concat(',',roleid,',') REGEXP '$regstr'";
  1152. $userIds = User::where($where)->whereRaw($whereRaw)->column("id");
  1153. /* $privs = ["admin/talent/fst_check"];
  1154. $menuIds = MenuApi::getMenuIdsByNewUrls($privs);
  1155. $where[] = ["menuid", "in", $menuIds];
  1156. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($privs))->column("roleid");
  1157. $where = [];
  1158. $where[] = ["status", "=", 1];
  1159. $where[] = ["roleid", "in", $roleIds];
  1160. $where[] = ["roleid", "<>", 1];
  1161. $userIds = User::where($where)->column("id"); */
  1162. $this->sendMsgByState($talent_info, $log_checkState, $userIds, $dept_log["description"]);
  1163. }
  1164. }
  1165. TalentLogApi::setActive($dept_log["id"], 1);
  1166. return json(["code" => 200, "msg" => "审核成功"]);
  1167. }
  1168. /**
  1169. * 复审-提交未保存
  1170. * @param \think\Request $request
  1171. * @param type $talent_info
  1172. * @param type json
  1173. */
  1174. private function reCheck(\think\Request $request, $talent_info) {
  1175. $params = $request->param();
  1176. if ($params["checkState"] == 3) {
  1177. //审核成功
  1178. $log_checkState = $checkState = TalentState::REVERIFY_PASS; //复核成功
  1179. } else if ($params["checkState"] == 2) {
  1180. //审核驳回并记录需要修改的字段和上传文件
  1181. $checkState = TalentState::SCND_SUBMIT; //退回待初审
  1182. $log_checkState = TalentState::REVERIFY_REJECT; //日志记录拒绝状态
  1183. } else {
  1184. $log_checkState = $checkState = TalentState::REVERIFY_FAIL; //审核失败
  1185. }
  1186. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  1187. if (!$log && !$talent_info["oldId"])
  1188. return json(["msg" => "日志数据异常,保存失败"]);
  1189. if ($log["active"] === 0) {
  1190. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  1191. } else {
  1192. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  1193. }
  1194. $data["id"] = $talent_info["id"];
  1195. $data["modify_files"] = $params["files"];
  1196. $data["modify_fields"] = $params["fields"];
  1197. TalentModel::update($data);
  1198. return json(["code" => 200, "msg" => "保存成功"]);
  1199. }
  1200. /**
  1201. * 复审-提交审核
  1202. * @param type $talent_info
  1203. * @return type json
  1204. */
  1205. private function reSubmitCheck($talent_info) {
  1206. return $this->commonSubmitCheck($talent_info, 5);
  1207. }
  1208. private function commonSubmitCheck($talent_info, $nowProcess) {
  1209. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  1210. if (!$log || $log["active"] == 1)
  1211. return json(["msg" => "请先保存审核状态,再提交审核"]);
  1212. if (in_array($log["new_state"], [TalentState::BASE_VERIFY_PASS, TalentState::BASE_REVERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::REVERIFY_PASS])) {
  1213. $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
  1214. }
  1215. $data["id"] = $talent_info["id"];
  1216. $data["checkState"] = $log["new_state"];
  1217. TalentModel::update($data);
  1218. TalentLogApi::setActive($log["id"], 1);
  1219. $userIds = [];
  1220. if (in_array($log["state"], [TalentState::REVERIFY_PASS, TalentState::REVERIFY_REJECT])) {
  1221. //复核成功需要发送短信给征信部门,复核的其它状态发送通知给用户,调用此方法的还有基础审核的每个状态都要发送通知给用户
  1222. //从征信审核权限,逆推征信部门
  1223. if ($data["checkState"] == TalentState::REVERIFY_PASS) {
  1224. $codes = ["talentInfohczxReject", "talentInfohczxPass"];
  1225. } else {
  1226. $codes = ["talentInfo_firstCheck"];
  1227. }
  1228. $menuIds = MenuApi::getMenuIdsByCodes($codes);
  1229. $where = [];
  1230. $where[] = ["menuid", "in", $menuIds];
  1231. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($codes))->column("roleid");
  1232. $where = [];
  1233. $where[] = ["status", "=", 1];
  1234. $where[] = ["type", "=", $this->user["type"]];
  1235. $where[] = ["roleid", "<>", 1];
  1236. $regstr = ",(" . implode("|", $roleIds) . "),";
  1237. $whereRaw = "concat(',',roleid,',') REGEXP '$regstr'";
  1238. $userIds = User::where($where)->whereRaw($whereRaw)->column("id");
  1239. /* if ($data["checkState"] == TalentState::REVERIFY_PASS) {
  1240. $privs = ["/admin/talent/hczxReject", "/admin/talent/hczxPass"];
  1241. } else {
  1242. $privs = ["admin/talent/fst_check"];
  1243. }
  1244. $menuIds = MenuApi::getMenuIdsByNewUrls($privs);
  1245. $where = [];
  1246. $where[] = ["menuid", "in", $menuIds];
  1247. $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($privs))->column("roleid");
  1248. $where = [];
  1249. $where[] = ["status", "=", 1];
  1250. $where[] = ["roleid", "in", $roleIds];
  1251. $where[] = ["roleid", "<>", 1];
  1252. $userIds = User::where($where)->column("id"); */
  1253. }
  1254. $this->sendMsgByState($talent_info, $log["state"], $userIds, $log["description"]);
  1255. return json(["code" => 200, "msg" => "审核成功"]);
  1256. }
  1257. private function sendMsgByState($talent_info, $state, $userIds = [], $description = "") {
  1258. $phones = [];
  1259. $template = "";
  1260. $type = 0;
  1261. $processName = "";
  1262. $userId = 0;
  1263. $name = null;
  1264. switch ($state) {
  1265. case TalentState::BASE_VERIFY_PASS://基础信息审核通过发送短信通知用户
  1266. $type = 2;
  1267. $processName = "基础信息审核";
  1268. $template = "【晋江市人才服务平台】尊敬的用户,您提交的人才基础信息审核通过,请及时登录申报系统并进行人才认定的信息申报填写。";
  1269. break;
  1270. case TalentState::BASE_REJECT://基础信息审核驳回发送短信通知用户
  1271. $type = 2;
  1272. $processName = "基础信息审核";
  1273. $template = "【晋江市人才服务平台】尊敬的用户,您提交的人才基础信息审核驳回,原因是:{$description},请及时登录申报系统修改并重新提交。";
  1274. break;
  1275. case TalentState::BASE_VERIFY_FAIL://基础信息审核不通过发送短信通知用户
  1276. $type = 2;
  1277. $processName = "基础信息审核";
  1278. $template = "【晋江市人才服务平台】尊敬的用户,您提交的人才基础信息审核不通过,原因是:{$description}。";
  1279. break;
  1280. case TalentState::FST_VERIFY_PASS://初审通过发送短信通知并审部门
  1281. $type = 1;
  1282. $processName = "初级审核";
  1283. $template = "【晋江市人才服务平台】您的部门有新的人才认定申报需要审批,请及时登录审批系统处理。";
  1284. break;
  1285. case TalentState::FST_VERIFY_REJECT; //初审驳回发送短信通知用户
  1286. $type = 2;
  1287. $processName = "初级审核";
  1288. $template = "【晋江市人才服务平台】尊敬的用户,您提交的人才认定申报审核驳回,原因是:{$description},请及时登录申报系统修改并重新提交。";
  1289. break;
  1290. case TalentState::FST_VERIFY_FAIL://初审不通过发送短信通知用户
  1291. $type = 2;
  1292. $processName = "初级审核";
  1293. $template = "【晋江市人才服务平台】尊敬的用户,您提交的人才认定申报审核不通过,原因是:{$description}。";
  1294. break;
  1295. case TalentState::DEPT_VERIFY_REJECT://并审驳回发送短信通知初审部门
  1296. $type = 1;
  1297. $processName = "部门并审";
  1298. $template = "【晋江市人才服务平台】有人才认定申报在并审阶段被驳回,原因是:{$description},请及时登录审批系统处理。";
  1299. break;
  1300. case TalentState::REVERIFY_PASS://复核通过发短信通知征信部门
  1301. $type = 1;
  1302. $processName = "复审";
  1303. $template = "【晋江市人才服务平台】有新的人才认定申报通过复审进入征信阶段,请及时登录审批系统处理。";
  1304. break;
  1305. case TalentState::REVERIFY_REJECT://复核驳回发短信通知初审部门
  1306. $type = 1;
  1307. $processName = "复审";
  1308. $template = "【晋江市人才服务平台】有人才认定申报在复审阶段被驳回,原因是:{$description},请及时登录审批系统处理。";
  1309. break;
  1310. }
  1311. if ($type == 1) {
  1312. $where = [];
  1313. $where[] = ["id", "in", $userIds];
  1314. $phones = User::where($where)->column("phone");
  1315. $phones = array_unique(array_filter($phones));
  1316. }
  1317. if ($type == 2) {
  1318. $ep = EnterpriseApi::getOne($talent_info['enterprise_id']);
  1319. $phones[] = $ep->agentPhone;
  1320. $userId = $ep->id;
  1321. $name = $ep->name;
  1322. }
  1323. if ($phones && $template) {
  1324. while ($phone = array_shift($phones)) {
  1325. $smsapi = new ChuanglanSmsApi();
  1326. $result = $smsapi->sendSMS($phone, $template);
  1327. $result = json_decode($result, true);
  1328. $id = getStringId();
  1329. $record_data = [
  1330. 'id' => $id,
  1331. 'userId' => $userId,
  1332. 'bizId' => $result["msgId"],
  1333. 'type' => $type,
  1334. 'smsType' => 2,
  1335. 'name' => $name,
  1336. 'phone' => $phone,
  1337. 'params' => $processName,
  1338. 'templateCode' => $template,
  1339. 'state' => $result['code'] == 0 ? 2 : 3,
  1340. 'sendingDate' => date("Y-m-d H:i:s", time()),
  1341. 'createTime' => date("Y-m-d H:i:s", time()),
  1342. 'msg' => $result['errorMsg']
  1343. ];
  1344. MessageRecord::create($record_data);
  1345. }
  1346. }
  1347. }
  1348. public function check() {
  1349. //公共调度方法
  1350. $request = $this->request;
  1351. $params = $request->param();
  1352. $check = $params["checkState"];
  1353. $check_msg = trim($params["checkMsg"]);
  1354. $files = $params["files"];
  1355. $fields = $params["fields"];
  1356. $id = $params["id"];
  1357. $talent_info = VerifyApi::getOne($id);
  1358. $checkState = $talent_info["checkState"];
  1359. if (!$talent_info) {
  1360. return json(["msg" => "数据错误"]);
  1361. }
  1362. if (!$check) {
  1363. return json(["msg" => "请选择审核状态"]);
  1364. }
  1365. if (!$check_msg) {
  1366. return json(["msg" => "请填写审核说明"]);
  1367. }
  1368. if ($checkState == TalentState::FST_SUBMIT) {
  1369. return $this->baseCheck($request, $talent_info);
  1370. } else if ($checkState == TalentState::BASE_VERIFY_PASS) {
  1371. return $this->baseReCheck($request, $talent_info);
  1372. } else if ($checkState == TalentState::SCND_SUBMIT) {
  1373. return $this->fstCheck($request, $talent_info);
  1374. } else if ($checkState == TalentState::FST_VERIFY_PASS) {
  1375. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1376. $companys = array_filter(explode(",", $condition["companyIds"]));
  1377. if ($companys && $talent_info["pass_dept_check"] != 1) {
  1378. if (!in_array($this->user["companyId"], $companys))
  1379. return json(["msg" => "你的部门不在并审部门列表"]);
  1380. return $this->deptCheck($request, $talent_info, $companys);
  1381. } else {
  1382. return $this->reCheck($request, $talent_info);
  1383. }
  1384. } else if ($checkState == TalentState::DEPT_VERIFY_PASS) {
  1385. return $this->reCheck($request, $talent_info);
  1386. } else {
  1387. return json(["msg" => "不在审核范围内,保存失败"]);
  1388. }
  1389. }
  1390. public function submitCheck() {
  1391. //公共调度方法
  1392. $id = $this->request->param("id");
  1393. $talent_info = VerifyApi::getOne($id);
  1394. $checkState = $talent_info["checkState"];
  1395. if (!$talent_info) {
  1396. return json(["msg" => "数据错误"]);
  1397. }
  1398. if ($checkState == TalentState::FST_SUBMIT) {
  1399. return $this->baseSubmitCheck($talent_info);
  1400. } else if ($checkState == TalentState::BASE_VERIFY_PASS) {
  1401. return $this->baseReSubmitCheck($talent_info);
  1402. } else if ($checkState == TalentState::SCND_SUBMIT) {
  1403. return $this->fstSubmitCheck($talent_info);
  1404. } else if ($checkState == TalentState::FST_VERIFY_PASS) {
  1405. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1406. $companys = array_filter(explode(",", $condition["companyIds"]));
  1407. if ($companys && $talent_info["pass_dept_check"] != 1) {
  1408. if (!in_array($this->user["companyId"], $companys))
  1409. return json(["msg" => "你的部门不在并审部门列表"]);
  1410. return $this->deptSubmitCheck($talent_info, $companys);
  1411. } else {
  1412. return $this->reSubmitCheck($talent_info);
  1413. }
  1414. } else if ($checkState == TalentState::DEPT_VERIFY_PASS) {
  1415. return $this->reSubmitCheck($talent_info);
  1416. } else {
  1417. return json(["msg" => "不在审核范围内,审核失败"]);
  1418. }
  1419. }
  1420. public function validateIsCheck() {
  1421. $params = $this->request->param();
  1422. $id = $params["id"];
  1423. $process = $params["process"];
  1424. $talent_info = VerifyApi::getOne($id);
  1425. $fstLog = TalentLogApi::getFstLog($id, 1);
  1426. $isMix = false;
  1427. if (in_array($fstLog["state"], [TalentState::SCND_SAVE, TalentState::SCND_SUBMIT])) {
  1428. //初次提交是待初审状态,则为新的混合基础信息和人才认证信息的申报
  1429. $isMix = true;
  1430. }
  1431. $enterprise = \app\common\model\Enterprise::findOrEmpty($talent_info["enterprise_id"]);
  1432. if ($talent_info) {
  1433. $checkState = $talent_info["checkState"];
  1434. 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]))) {
  1435. return json(["msg" => "该申报不在审核范围内,无法审核"]);
  1436. }
  1437. $process = 0;
  1438. switch ($checkState) {
  1439. case TalentState::FST_SUBMIT:
  1440. $fields = DictApi::getTalentFields(1, $talent_info["isImport"]);
  1441. $field_tmp = [];
  1442. foreach ($fields as $key => $field) {
  1443. $field_tmp[] = ["key" => $key, "value" => $field];
  1444. }
  1445. $where[] = ["project", "=", 1];
  1446. $where[] = ["step", "=", 1];
  1447. $where[] = ["active", "=", 1];
  1448. $where[] = ["type", "=", $enterprise["type"]];
  1449. $files = \think\facade\Db::table("new_common_filetype")->where($where)->select();
  1450. $process = 1;
  1451. break;
  1452. case TalentState::BASE_VERIFY_PASS:
  1453. $fields = DictApi::getTalentFields(1, $talent_info["isImport"]);
  1454. $field_tmp = [];
  1455. foreach ($fields as $key => $field) {
  1456. $field_tmp[] = ["key" => $key, "value" => $field];
  1457. }
  1458. $where[] = ["project", "=", 1];
  1459. $where[] = ["step", "=", 1];
  1460. $where[] = ["active", "=", 1];
  1461. $where[] = ["type", "=", $enterprise["type"]];
  1462. $files = \think\facade\Db::table("new_common_filetype")->where($where)->select();
  1463. $process = 2;
  1464. break;
  1465. case TalentState::SCND_SUBMIT:
  1466. $fields = DictApi::getTalentFields(2, $talent_info["isImport"]);
  1467. $process = 3;
  1468. break;
  1469. case TalentState::FST_VERIFY_PASS:
  1470. $tc = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1471. if ($tc["companyIds"] && $talent_info["pass_dept_check"] != 1) {
  1472. $process = 4;
  1473. $fields = DictApi::getTalentFields(3, $talent_info["isImport"]);
  1474. } else {
  1475. $process = 5;
  1476. $fields = DictApi::getTalentFields(2, $talent_info["isImport"]);
  1477. }
  1478. break;
  1479. case TalentState::DEPT_VERIFY_PASS:
  1480. $process = 5;
  1481. $fields = DictApi::getTalentFields(2, $talent_info["isImport"]);
  1482. break;
  1483. }
  1484. if ($isMix && $process != 4) {
  1485. if ($enterprise["type"] == 2) {
  1486. $fields = DictApi::getTalentFields_IC();
  1487. } else {
  1488. $fields = DictApi::getTalentFields(4, $talent_info["isImport"]);
  1489. }
  1490. }
  1491. if ($fields["fst_work_time"] && in_array($enterprise['enterpriseTag'], ['mtdw', 'gyqyh', 'mbfqy', 'jrjg']) && $enterprise["type"] == 1) {
  1492. $fields["fst_work_time"] = $talent_info['talent_type'] == 1 ? "近三年来晋工作时间" : "近三年(首次)来晋工作时间";
  1493. }
  1494. if ($checkState != TalentState::FST_SUBMIT) {
  1495. //$fields = DictApi::getTalentFields(2);
  1496. $field_tmp = [];
  1497. if ($fields) {
  1498. foreach ($fields as $key => $field) {
  1499. $field_tmp[] = ["key" => $key, "value" => $field];
  1500. }
  1501. }
  1502. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1503. $companys = array_filter(explode(",", $condition["companyIds"]));
  1504. $_companys = [];
  1505. foreach ($companys as $companyId) {
  1506. $company = CompanyApi::getOne($companyId);
  1507. $_companys[] = $company;
  1508. }
  1509. if ($process == 4 && $enterprise["type"] == 1) {
  1510. $where = [];
  1511. $cwfts = explode(";", $condition["companyWithFileType"]);
  1512. foreach ($cwfts as $cwft) {
  1513. $_company_setting = explode(":", $cwft);
  1514. if ($_company_setting[0] == $this->user["companyId"]) {
  1515. $where[] = ["id", "in", explode(",", $_company_setting[1])];
  1516. break;
  1517. }
  1518. }
  1519. if ($where) {
  1520. $where[] = ["delete", "=", 0];
  1521. $files = \think\facade\Db::table("new_common_filetype")->where($where)->order("sn asc")->select();
  1522. } else {
  1523. $files = [];
  1524. }
  1525. } else {
  1526. $where = [];
  1527. $whr = [];
  1528. if (!$isMix) {
  1529. $where[] = ["step", "=", 2];
  1530. }
  1531. $where[] = ["project", "=", 1];
  1532. $where[] = ["active", "=", 1];
  1533. $where[] = ["type", "=", $enterprise["type"]];
  1534. $where[] = ["isConditionFile", "<>", 1];
  1535. $where[] = ["delete", "=", 0];
  1536. if ($condition && $condition["bindFileTypes"]) {
  1537. $whr[] = ["id", "in", explode(",", $condition["bindFileTypes"])];
  1538. $files = \think\facade\Db::table("new_common_filetype")->whereOr([$where, $whr])->order("sn asc")->select();
  1539. } else {
  1540. $files = \think\facade\Db::table("new_common_filetype")->where($where)->order("sn asc")->select();
  1541. }
  1542. }
  1543. }
  1544. $talent_info["files"] = array_filter(explode(",", $talent_info["modify_files"]));
  1545. $talent_info["fields"] = array_filter(explode(",", $talent_info["modify_fields"]));
  1546. /* 保存的审核内容start */
  1547. $last_log = TalentLogApi::getLastLog($id, ProjectState::TALENT, 0, ["active", "=", 0]);
  1548. if ($last_log["step"] == 3 && $last_log["companyId"] != $this->user["companyId"]) {
  1549. $last_log = TalentLogApi::getLastLog($id, ProjectState::TALENT, $this->user["companyId"], ["active", "=", 0]);
  1550. }
  1551. $check = ["msg" => $last_log["description"]];
  1552. if ($last_log["state"] == TalentState::FST_VERIFY_PASS && $last_log["new_state"] == TalentState::FST_VERIFY_PASS) {
  1553. if ($talent_info["pass_dept_check"] == 1) {
  1554. if ($talent_info["isImport"] && $talent_info["isMatchZhiren"]) {
  1555. $check["checkState"] = 3; //初审通过
  1556. } else {
  1557. $check["checkState"] = 4; //初审通过(跳过部门并审)
  1558. }
  1559. } else {
  1560. if ($talent_info["re_check_companys"] && $talent_info["highProcess"] >= 4) {
  1561. $talent_info["re_check_companys"] = array_filter(explode(",", $talent_info["re_check_companys"]));
  1562. $check["checkState"] = 5; //初审通过(需要再次部门并审)
  1563. } else {
  1564. if ($process == 4) {
  1565. $check["checkState"] = ""; //部门待审核(系统自动生成的记录,应该算未保存状态,所以设成空,未选择状态)
  1566. } else {
  1567. $check["checkState"] = 3; //初审通过
  1568. }
  1569. }
  1570. }
  1571. }
  1572. if ($last_log["state"] == TalentState::FST_VERIFY_REJECT && $last_log["new_state"] == TalentState::SCND_SAVE) {
  1573. $check["checkState"] = 2; //初审驳回
  1574. }
  1575. if ($last_log["state"] == TalentState::FST_VERIFY_PASS && $last_log["new_state"] == TalentState::DEPT_VERIFY_PASS) {
  1576. $check["checkState"] = 3; //部门通过
  1577. }
  1578. if ($last_log["state"] == TalentState::FST_VERIFY_PASS && $last_log["new_state"] == TalentState::SCND_SUBMIT) {
  1579. $check["checkState"] = 2; //部门驳回
  1580. }
  1581. if ($last_log["state"] == TalentState::REVERIFY_PASS && $last_log["new_state"] == TalentState::REVERIFY_PASS) {
  1582. $check["checkState"] = 3; //复审通过
  1583. }
  1584. if ($last_log["state"] == TalentState::REVERIFY_REJECT && $last_log["new_state"] == TalentState::SCND_SUBMIT) {
  1585. $check["checkState"] = 2; //复审驳回
  1586. }
  1587. if ($last_log["state"] == TalentState::REVERIFY_FAIL && $last_log["new_state"] == TalentState::REVERIFY_FAIL) {
  1588. $check["checkState"] = -1; //复审失败
  1589. }
  1590. /* 保存的审核内容end */
  1591. return json(["code" => 200, "obj" => ["process" => $process, "talentInfo" => $talent_info, "check" => $check, "fieldList" => $field_tmp, "fileList" => $files, "companys" => $_companys]]);
  1592. }
  1593. }
  1594. public function findFieldsAndFiles() {
  1595. $id = $this->request["id"];
  1596. $talentInfo = VerifyApi::getOne($id);
  1597. $lastLog = TalentLogApi::getLastLog($id, ProjectState::TALENT);
  1598. $responseObj = new \stdClass();
  1599. if ($talentInfo["checkState"] == TalentState::SCND_SAVE && $lastLog["state"] == TalentState::FST_VERIFY_REJECT) {
  1600. if ($this->user["type"] == 2) {
  1601. $fields = DictApi::getTalentFields_IC();
  1602. } else {
  1603. $fields = DictApi::getTalentFields(4, $talentInfo["isImport"]);
  1604. }
  1605. $enterprise = \app\common\model\Enterprise::findOrEmpty($talentInfo["enterprise_id"]);
  1606. if ($fields["fst_work_time"] && in_array($enterprise['enterpriseTag'], ['mtdw', 'gyqyh', 'mbfqy', 'jrjg']) && $enterprise["type"] == 1) {
  1607. $fields["fst_work_time"] = $talentInfo['talent_type'] == 1 ? "近三年来晋工作时间" : "近三年(首次)来晋工作时间";
  1608. }
  1609. $field_tmp = [];
  1610. if ($fields) {
  1611. foreach ($fields as $key => $field) {
  1612. $field_tmp[] = ["key" => $key, "value" => $field];
  1613. }
  1614. }
  1615. $condition = TalentConditionApi::getOne($talentInfo["talent_condition"]);
  1616. $where = [];
  1617. $whr = [];
  1618. $where[] = ["project", "=", 1];
  1619. $where[] = ["active", "=", 1];
  1620. $where[] = ["type", "=", $enterprise["type"]];
  1621. $where[] = ["isConditionFile", "<>", 1];
  1622. $where[] = ["delete", "=", 0];
  1623. if ($condition && $condition["bindFileTypes"]) {
  1624. $whr[] = ["id", "in", explode(",", $condition["bindFileTypes"])];
  1625. $files = \think\facade\Db::table("new_common_filetype")->whereOr([$where, $whr])->order("sn asc")->select();
  1626. } else {
  1627. $files = \think\facade\Db::table("new_common_filetype")->where($where)->order("sn asc")->select();
  1628. }
  1629. $responseObj->code = 200;
  1630. $responseObj->id = $id;
  1631. $responseObj->fileList = $files;
  1632. $responseObj->fieldList = $field_tmp;
  1633. $responseObj->select = [
  1634. "files" => array_filter(explode(",", $talentInfo["modify_files"])),
  1635. "fields" => array_filter(explode(",", $talentInfo["modify_fields"]))
  1636. ];
  1637. } else {
  1638. $responseObj->msg = "不是驳回状态不可以编辑驳回内容";
  1639. }
  1640. return json($responseObj);
  1641. }
  1642. /**
  1643. * 初审-修改驳回字段
  1644. * @auth {{/talentInfo/updateFieldsAndFiles}}
  1645. */
  1646. public function updateFieldsAndFiles() {
  1647. $id = $this->request["id"];
  1648. $fields = array_filter(explode(",", $this->request["fields"]));
  1649. $files = array_filter(explode(",", $this->request["files"]));
  1650. $talentInfo = VerifyApi::getOne($id);
  1651. $lastLog = TalentLogApi::getLastLog($id, ProjectState::TALENT);
  1652. $responseObj = new \stdClass();
  1653. if ($talentInfo["checkState"] == TalentState::SCND_SAVE && $lastLog["state"] == TalentState::FST_VERIFY_REJECT) {
  1654. if (!$fields && !$files) {
  1655. $responseObj->msg = "请选择可修改的字段或附件!";
  1656. return json($responseObj);
  1657. }
  1658. try {
  1659. $data["id"] = $id;
  1660. $data["modify_fields"] = $fields ? implode(",", $fields) : null;
  1661. $data["modify_files"] = $files ? implode(",", $files) : null;
  1662. TalentModel::update($data);
  1663. $responseObj->code = 200;
  1664. $responseObj->msg = "驳回字段修改成功";
  1665. return json($responseObj);
  1666. } catch (\think\db\exception\DbException $e) {
  1667. $responseObj->msg = $e->getMessage();
  1668. return json($responseObj);
  1669. }
  1670. } else {
  1671. $responseObj->msg = "不是驳回状态不可以编辑驳回内容";
  1672. return json($responseObj);
  1673. }
  1674. }
  1675. /**
  1676. * 人才库-取消人才
  1677. * @auth {{/talentInfo/libraryCancle}}
  1678. */
  1679. public function removeFromLibrary() {
  1680. $responseObj = new \stdClass();
  1681. $params = $this->request->param();
  1682. $info = VerifyApi::getOne($params["id"]);
  1683. if (!$params["id"] || !$info) {
  1684. $responseObj->msg = "系统错误,请联系管理员";
  1685. return json($responseObj);
  1686. }
  1687. if ($info["active"] != 2) {
  1688. $responseObj->msg = "该人才未处于离职状态,无法取消";
  1689. return json($responseObj);
  1690. }
  1691. if ($info["isEffect"] == 4) {
  1692. $responseObj->msg = "无法重复取消";
  1693. return json($responseObj);
  1694. }
  1695. if (VerifyApi::setEffect($info["id"], 4, ["description" => "取消优秀人才", "stateChange" => "有效->无效", "active" => 1])) {
  1696. $responseObj->code = 200;
  1697. $responseObj->msg = "取消优秀人才成功";
  1698. return json($responseObj);
  1699. }
  1700. $responseObj->msg = "系统错误,请联系管理员";
  1701. return json($responseObj);
  1702. }
  1703. /**
  1704. * 人才库-恢复人才
  1705. * @auth {{/talentInfo/libraryRecovery}}
  1706. */
  1707. public function recovery() {
  1708. $responseObj = new \stdClass();
  1709. $params = $this->request->param();
  1710. $info = VerifyApi::getOne($params["id"]);
  1711. if (!$params["id"] || !$info) {
  1712. $responseObj->msg = "系统错误,请联系管理员";
  1713. return json($responseObj);
  1714. }
  1715. if ($info["isEffect"] != 4) {
  1716. $responseObj->msg = "无法恢复有效数据";
  1717. return json($responseObj);
  1718. }
  1719. if (VerifyApi::setEffect($info["id"], 1, ["description" => "恢复优秀人才", "stateChange" => "无效->有效", "active" => 1])) {
  1720. $responseObj->code = 200;
  1721. $responseObj->msg = "恢复优秀人才成功";
  1722. return json($responseObj);
  1723. }
  1724. $responseObj->msg = "系统错误,请联系管理员";
  1725. return json($responseObj);
  1726. }
  1727. public function baseVerifyListExport() {
  1728. $this->commonExport(1);
  1729. }
  1730. public function baseReverifyListExport() {
  1731. $this->commonExport(2);
  1732. }
  1733. public function fstVerifyListExport() {
  1734. $this->commonExport(3);
  1735. }
  1736. public function deptVerifyListExport() {
  1737. $this->commonExport(4);
  1738. }
  1739. public function reVerifyListExport() {
  1740. $this->commonExport(5);
  1741. }
  1742. public function preListExport() {
  1743. $this->commonExport(6);
  1744. }
  1745. public function libraryListExport() {
  1746. $this->commonExport(7);
  1747. }
  1748. private function commonExport($process) {
  1749. $companyId = $this->user['companyId'];
  1750. $company = getCacheById("Company", $companyId);
  1751. $setting = [];
  1752. $params = $this->request->param();
  1753. $fields = $params["export"];
  1754. if (!$fields)
  1755. return json(["msg" => "请选择要导出的数据"]);
  1756. $names = DictApi::getTalentFields(4, in_array("isMatchZhiren", $fields));
  1757. $names["industryFieldNew"] = "产业领域";
  1758. $names["enterpriseName"] = "单位名称";
  1759. $names["enterpriseTag"] = "单位标签";
  1760. $names["street"] = "所属镇街";
  1761. $names["checkState"] = "审核状态";
  1762. $names["checkMsg"] = "审核意见";
  1763. $names["first_dept_check_time"] = "进入并审时间";
  1764. $names["verifyDepts"] = "审核部门";
  1765. $names["deptDescription"] = "审核部门意见";
  1766. $names["deptPass"] = "部门通过";
  1767. $names["deptReject"] = "部门驳回";
  1768. $names["deptWait"] = "部门待审";
  1769. $names["breakFaithName"] = "曾被相关主管部门列为失信个人";
  1770. $names["identifyMonth"] = "公布入选月份";
  1771. $names["certificateNo"] = "人才编号";
  1772. $names["activeName"] = "离职状态";
  1773. $names["cur_quit_time"] = "离职时间";
  1774. $names["first_submit_time"] = "首次确认提交时间";
  1775. $names["new_submit_time"] = "最新确认提交时间";
  1776. $list = VerifyApi::getExportDatas($process, $params);
  1777. if ($process == 4 && VerifyApi::chkUserInSuperDeptUsers()) {
  1778. $fields[] = "first_dept_check_time";
  1779. $fields[] = "verifyDepts";
  1780. $fields[] = "deptDescription";
  1781. $fields[] = "deptPass";
  1782. $fields[] = "deptReject";
  1783. $fields[] = "deptWait";
  1784. $verifyDescriptionColumn = getExcelColumnByIndex(count($fields) - 4);
  1785. $setting["font"][] = [sprintf("%s%d:%s%d", $verifyDescriptionColumn, 2, $verifyDescriptionColumn, count($list) + 1), 8, "宋体"];
  1786. $setting["width"][] = [$verifyDescriptionColumn, 45];
  1787. $verifyDeptsColumn = getExcelColumnByIndex(count($fields) - 5);
  1788. $setting["font"][] = [sprintf("%s%d:%s%d", $verifyDeptsColumn, 2, $verifyDeptsColumn, count($list) + 1), 8, "宋体"];
  1789. $setting["width"][] = [$verifyDeptsColumn, 30];
  1790. }
  1791. foreach ($fields as $field) {
  1792. $columns[] = $names[$field];
  1793. }
  1794. $datas = [];
  1795. for ($i = 0; $i < count($list); $i++) {
  1796. $data = [];
  1797. for ($n = 0; $n < count($fields); $n++) {
  1798. $cellValue = $list[$i][$fields[$n]];
  1799. $data[] = $cellValue;
  1800. if ($fields[$n] == "deptPass" && $cellValue > 0) {
  1801. $setting["color"][] = [sprintf("%s%d", getExcelColumnByIndex($n), $i + 2), "15dd0f"];
  1802. }
  1803. if ($fields[$n] == "deptReject" && $cellValue > 0) {
  1804. $setting["color"][] = [sprintf("%s%d", getExcelColumnByIndex($n), $i + 2), "ff0000"];
  1805. }
  1806. if ($fields[$n] == "deptWait" && $cellValue > 0) {
  1807. $setting["color"][] = [sprintf("%s%d", getExcelColumnByIndex($n), $i + 2), "fdcb54"];
  1808. }
  1809. }
  1810. $datas[] = $data;
  1811. }
  1812. $setting["freeze"] = "A2";
  1813. $setting["filter"] = sprintf("A1:%s1", getExcelColumnByIndex(count($columns) - 1));
  1814. if ($datas) {
  1815. export($columns, $datas, "人才审核列表导出", $setting);
  1816. exit();
  1817. }
  1818. echo "<script>parent.layer.alert('没有可以导出的数据');window.history.go(-1);</script>";
  1819. }
  1820. public function getPhones() {
  1821. $list = VerifyApi::getListByProcess($this->request->param("process"));
  1822. $result = [];
  1823. if ($list) {
  1824. foreach ($list as $item) {
  1825. if ($item["phone"] && $item["name"]) {
  1826. $result[] = sprintf("%s:%s", $item["name"], $item["phone"]);
  1827. }
  1828. }
  1829. }
  1830. return json(["code" => 200, "obj" => implode(";", $result)]);
  1831. }
  1832. public function getEnterprisePhones() {
  1833. $list = VerifyApi::getListByProcess($this->request->param("process"));
  1834. $result = [];
  1835. if ($list) {
  1836. foreach ($list as $item) {
  1837. if ($item["agentName"] && $item["agentPhone"]) {
  1838. $result[] = sprintf("%s:%s", $item["agentName"], $item["agentPhone"]);
  1839. }
  1840. }
  1841. }
  1842. return json(["code" => 200, "obj" => implode(";", $result)]);
  1843. }
  1844. }