Talent.php 90 KB

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