Talent.php 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use app\common\api\VerifyApi;
  5. use app\common\api\TalentLogApi;
  6. use app\common\api\TalentState;
  7. use app\enterprise\model\Talent as TalentModel;
  8. use app\common\api\TalentConditionApi;
  9. use app\common\api\DictApi;
  10. use app\common\api\EnterpriseApi;
  11. use think\facade\Db;
  12. /**
  13. * Description of Talent
  14. *
  15. * @author sgq
  16. */
  17. class Talent extends AdminController {
  18. public function common_check() {
  19. $request = $this->request;
  20. $params = $request->param();
  21. $id = $params["id"];
  22. $info = VerifyApi::getTalentInfoById($id);
  23. if (in_array($info["checkState"], [-1, 2])) {
  24. return view("talentInfo_base_check", ["info" => $info]);
  25. } else {
  26. return view("talentInfo_common_check", ["info" => $info]);
  27. }
  28. }
  29. public function cancel_verify() {
  30. $params = $this->request->param();
  31. $ids = $params["ids"];
  32. $msg = $params["msg"];
  33. if ($msg == "") {
  34. return json(["msg" => "请填写审核不通过的原因"]);
  35. }
  36. $ids_arr = array_filter(explode(",", $ids));
  37. $counts = 0;
  38. foreach ($ids_arr as $id) {
  39. $ti = VerifyApi::getOne($id);
  40. $data["id"] = $id;
  41. if ($ti["checkState"] == TalentState::FST_SUBMIT) {
  42. $data["checkState"] = TalentState::BASE_VERIFY_FAIL;
  43. TalentLogApi::write(1, $id, TalentState::BASE_VERIFY_FAIL, $msg, 1);
  44. TalentModel::update($data);
  45. $counts++;
  46. } else if ($ti["checkState"] == TalentState::SCND_SAVE) {
  47. $data["checkState"] = TalentState::FST_VERIFY_FAIL;
  48. TalentLogApi::write(1, $id, TalentState::FST_VERIFY_FAIL, $msg, 1);
  49. TalentModel::update($data);
  50. $counts++;
  51. } else {
  52. return json(["msg" => "不在审核范围"]);
  53. }
  54. }
  55. return json(["code" => 200, sprintf("%d个申请已审核失败", $counts)]);
  56. }
  57. public function base_verify() {
  58. return view();
  59. }
  60. public function base_verify_list() {
  61. $request = $this->request;
  62. return json(VerifyApi::getList($request));
  63. }
  64. /**
  65. * 部门初审
  66. * @auth {{/talentInfo/gotoIndex/-1}}
  67. */
  68. public function dept_fst_verify() {
  69. return view();
  70. }
  71. /**
  72. * 初审
  73. * @auth {{/talentInfo/gotoIndex/1}}
  74. */
  75. public function fst_verify() {
  76. return view();
  77. }
  78. /**
  79. * 初审-审核
  80. * @auth {{/talentInfo/firstCheck}}
  81. */
  82. public function fst_check() {
  83. }
  84. /**
  85. * 初审-修改驳回字段
  86. * @auth {{/talentInfo/updateFieldsAndFiles}}
  87. */
  88. public function updateFieldsAndFiles() {
  89. }
  90. /**
  91. * 初审-审核不通过
  92. * @auth {{/talentInfo/setNotPass}}
  93. */
  94. public function dis_pass() {
  95. }
  96. /**
  97. * 部门审核
  98. * @auth {{/talentInfo/gotoIndex/2}}
  99. */
  100. public function dept_verify() {
  101. return view();
  102. }
  103. /**
  104. * 复审
  105. * @auth {{/talentInfo/gotoIndex/3}}
  106. */
  107. public function re_verify() {
  108. return view();
  109. }
  110. /**
  111. * 复审-撤销复核
  112. * @auth {{/talentInfo/cancleThirdCheck}}
  113. */
  114. public function cancel_check() {
  115. }
  116. /**
  117. * 预备人才库
  118. * @auth {{/talentInfo/gotoIndex/4}}
  119. */
  120. public function pre_list() {
  121. return view();
  122. }
  123. public function selectNeedCheckData() {
  124. $params = $this->request->param();
  125. return json(["code" => 200, "obj" => VerifyApi::getPublicList($params)]);
  126. }
  127. /**
  128. * 预备人才库-核查征信
  129. * @auth {{/talentInfo/prepareHczx}}
  130. */
  131. public function prepareHczx() {
  132. $ids = $this->request->param("ids");
  133. $ids_arr = array_filter(explode(",", $ids));
  134. if (!$ids_arr) {
  135. $res = ["code" => 500, "msg" => "没有选择导出的名单"];
  136. echo sprintf("<script>TalentInfo.callBack(%s);</script>", json_encode($res));
  137. }
  138. $where[] = ["ti.id", "in", $ids_arr];
  139. $list = TalentModel::alias("ti")->leftJoin("new_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();
  140. if (!$list) {
  141. $res = ["code" => 500, "msg" => "没有可以导出的内容"];
  142. echo sprintf("<script>TalentInfo.callBack(%s);</script>", json_encode($res));
  143. }
  144. $columns = ["序号", "姓名", "证件类型", "证件号码", "工作单位", "备注"];
  145. $rows = [];
  146. $i = 1;
  147. $card_types = DictApi::selectByParentCode("card_type");
  148. foreach ($list as $item) {
  149. $row = [
  150. $i, $item["name"], $card_types[$item["card_type"]], $item["card_number"], $item["enterpriseName"], $item["description"]
  151. ];
  152. $rows[] = $row;
  153. $i++;
  154. }
  155. $filename = "优秀人才核查征信名单导出";
  156. if ($rows) {
  157. export($columns, $rows, $filename);
  158. exit();
  159. }
  160. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  161. }
  162. /**
  163. * 预备人才库-征信通过
  164. * @auth {{/talentInfo/hczxPass}}
  165. */
  166. public function hczxPass() {
  167. $params = $this->request->param();
  168. $ids = $params["ids"];
  169. $ids = array_filter(explode(",", $ids));
  170. $msg = "征信通过";
  171. $state = TalentState::ZX_PASS; //征信通过
  172. $total = count($ids);
  173. $error = 0;
  174. $success = 0;
  175. foreach ($ids as $id) {
  176. $talent_info = VerifyApi::getOne($id);
  177. if ($talent_info["checkState"] != TalentState::REVERIFY_PASS) {
  178. $error++;
  179. continue;
  180. }
  181. if (VerifyApi::setPublic($id, $state, $msg)) {
  182. $success++;
  183. } else {
  184. $error++;
  185. }
  186. }
  187. return json(["code" => 200, "msg" => sprintf("核查征信完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
  188. }
  189. /**
  190. * 预备人才库-征信失信
  191. * @auth {{/talentInfo/hczxReject}}
  192. */
  193. public function hczxReject() {
  194. $params = $this->request->param();
  195. $id = $params["id"];
  196. $msg = $params["outMsg"];
  197. if (!$msg)
  198. return json(["msg" => "请填写审核意见"]);
  199. $msg = "征信失信:" . $msg;
  200. $state = TalentState::ZX_FAIL; //征信不通过
  201. $talent_info = VerifyApi::getOne($id);
  202. if ($talent_info["checkState"] != TalentState::REVERIFY_PASS) {
  203. return json(["msg" => "当前记录不是待核查征信状态,无法核查"]);
  204. }
  205. if (VerifyApi::setPublic($id, $state, $msg)) {
  206. return json(["code" => 200, "msg" => "已设置征信失信"]);
  207. }
  208. return json(["msg" => "设置征信失信失败"]);
  209. }
  210. /**
  211. * 预备人才库-公示预览
  212. * @auth {{/talentInfo/publicExportBefore}}
  213. */
  214. public function publicExportBefore() {
  215. $params = $this->request->param();
  216. $ids_arr = array_filter(explode(",", $params["ids"]));
  217. $columns = ["序号", "批次", "姓名", "性别", "工作单位", "本人具备的认定条件", "拟认定人才层次", "审核状态", "备注"];
  218. if ($ids_arr) {
  219. $where[] = ["id", "in", $ids_arr];
  220. $list = TalentModel::where($where)->order("talent_arrange asc,enterprise_id asc")->select();
  221. $rows = [];
  222. $i = 1;
  223. $talentArranges = DictApi::selectByParentCode("talent_arrange");
  224. foreach ($list as $item) {
  225. $talent_condition = TalentConditionApi::getOne($item["talent_condition"]);
  226. $enterprise = EnterpriseApi::getOne($item["enterprise_id"]);
  227. $checkLog = TalentLogApi::getLastLog($item["id"], 1);
  228. $row = [
  229. $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"]
  230. ];
  231. $rows[] = $row;
  232. $i++;
  233. }
  234. }
  235. if ($rows) {
  236. $filename = "优秀人才公示预览导出";
  237. export($columns, $rows, $filename);
  238. exit();
  239. }
  240. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  241. }
  242. /**
  243. * 预备人才库-公示导出
  244. * @auth {{/talentInfo/publicExport}}
  245. */
  246. public function publicExport() {
  247. $params = $this->request->param();
  248. $columns = ["序号", "批次", "姓名", "性别", "工作单位", "本人具备的认定条件", "拟认定人才层次", "审核状态", "备注"];
  249. $startTime = $params["startTime"];
  250. $endTime = $params["endTime"];
  251. if (!strtotime($startTime) || !strtotime($endTime))
  252. return json(["msg" => "时间格式错误"]);
  253. $where[] = ["checkState", "=", TalentState::ANNOUNCED];
  254. $where[] = ["publicBatch", "between", [$startTime, $endTime]];
  255. $list = TalentModel::where($where)->order("talent_arrange asc,enterprise_id asc")->select();
  256. $rows = [];
  257. $i = 1;
  258. $talentArranges = DictApi::selectByParentCode("talent_arrange");
  259. foreach ($list as $item) {
  260. $talent_condition = TalentConditionApi::getOne($item["talent_condition"]);
  261. $enterprise = EnterpriseApi::getOne($item["enterprise_id"]);
  262. $checkLog = TalentLogApi::getLastLog($item["id"], 1);
  263. $row = [
  264. $i, $item["apply_year"], $item["name"], $item["sex"] == 1 ? "男" : "女", $enterprise["name"], $talent_condition["name"], $talentArranges[$item["talent_arrange"]], $item["checkState"] == TalentState::ANNOUNCED ? "审核通过" : "审核不通过", $checkLog["description"]
  265. ];
  266. $rows[] = $row;
  267. $i++;
  268. }
  269. if ($rows) {
  270. $filename = "优秀人才公示导出";
  271. export($columns, $rows, $filename);
  272. exit();
  273. }
  274. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  275. }
  276. /**
  277. * 预备人才库-公示
  278. * @auth {{/talentInfo/preparePublic}}
  279. */
  280. public function preparePublic() {
  281. $params = $this->request->param();
  282. $isMessage = $params["isMessage"] ?: 2;
  283. $ids = $params["ids"];
  284. $publicBatch = $params["batch"];
  285. if (!$publicBatch || strlen($publicBatch) != 6 || !is_numeric($publicBatch))
  286. return json(["msg" => "公示批次错误"]);
  287. $ids = array_filter(explode(",", $ids));
  288. $msg = "已公示";
  289. $state = TalentState::ANNOUNCED; //公示
  290. $total = count($ids);
  291. $error = 0;
  292. $success = 0;
  293. foreach ($ids as $id) {
  294. $talent_info = VerifyApi::getOne($id);
  295. if ($talent_info["checkState"] != TalentState::ZX_PASS) {
  296. $error++;
  297. continue;
  298. }
  299. if (VerifyApi::setPublic($id, $state, $msg, $publicBatch)) {
  300. $success++;
  301. } else {
  302. $error++;
  303. }
  304. }
  305. return json(["code" => 200, "msg" => sprintf("公示完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
  306. }
  307. /**
  308. * 预备人才库-公示再审核
  309. * @auth {{/talentInfo/prepareCheck}}
  310. */
  311. public function prepareCheck() {
  312. $params = $this->request->param();
  313. $id = $params["id"];
  314. $checkState = $params["checkState"];
  315. $msg = $params["checkMsg"];
  316. if (!$msg)
  317. return json(["msg" => "请填写审核意见"]);
  318. if ($checkState == 1) {
  319. $msg = "公示再审核通过:" . $msg;
  320. $state = TalentState::ANNOUNCED_REVERIFY_PASS; //公示再审核通过
  321. } else {
  322. $msg = "公示再审核不通过:" . $msg;
  323. $state = TalentState::ANNOUNCED_REVERIFY_FAIL; //公示再审核不通过
  324. }
  325. $talent_info = VerifyApi::getOne($id);
  326. if ($talent_info["checkState"] != TalentState::ANNOUNCED) {
  327. return json(["msg" => "当前记录不是公示状态,无法审核"]);
  328. }
  329. if (VerifyApi::setPublic($id, $state, $msg)) {
  330. return json(["code" => 200, "msg" => "公示再审核完成"]);
  331. }
  332. return json(["msg" => "公示再审核失败"]);
  333. }
  334. /**
  335. * 预备人才库-公示通过(批量)
  336. * @auth {{/talentInfo/publicPass}}
  337. */
  338. public function publicPass() {
  339. $params = $this->request->param();
  340. $ids = $params["ids"];
  341. $ids = array_filter(explode(",", $ids));
  342. $msg = "公示再审核批量通过";
  343. $state = TalentState::ANNOUNCED_REVERIFY_PASS; //公示再审核通过
  344. $total = count($ids);
  345. $error = 0;
  346. $success = 0;
  347. foreach ($ids as $id) {
  348. $talent_info = VerifyApi::getOne($id);
  349. if ($talent_info["checkState"] != TalentState::ANNOUNCED) {
  350. $error++;
  351. continue;
  352. }
  353. if (VerifyApi::setPublic($id, $state, $msg)) {
  354. $success++;
  355. } else {
  356. $error++;
  357. }
  358. }
  359. return json(["code" => 200, "msg" => sprintf("公示再审核完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
  360. }
  361. /**
  362. * 预备人才库-公布预览
  363. * @auth {{/talentInfo/publishExportBefore}}
  364. */
  365. public function publishExportBefore() {
  366. $params = $this->request->param();
  367. $ids = $params["ids"];
  368. $ids = array_filter(explode(",", $ids));
  369. if ($ids) {
  370. $where[] = ["id", "in", $ids];
  371. $list = TalentModel::where($where)->order("talent_arrange asc,enterprise_id asc")->select();
  372. $rows = [];
  373. $i = 1;
  374. $talentArranges = DictApi::selectByParentCode("talent_arrange");
  375. foreach ($list as $item) {
  376. $talent_condition = TalentConditionApi::getOne($item["talent_condition"]);
  377. $enterprise = EnterpriseApi::getOne($item["enterprise_id"]);
  378. $checkLog = TalentLogApi::getLastLog($item["id"], 1);
  379. $row = [
  380. $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"]
  381. ];
  382. $rows[] = $row;
  383. $i++;
  384. }
  385. }
  386. $columns = ["序号", "批次", "姓名", "性别", "工作单位", "本人具备的认定条件", "认定人才层次", "审核状态", "备注"];
  387. $filename = "优秀人才" . date("Ym") . "公布预览名单导出(公示批次-" . $list[0]["publicBatch"] . ")";
  388. if ($rows) {
  389. export($columns, $rows, $filename);
  390. exit();
  391. }
  392. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  393. }
  394. /**
  395. * 预备人才库-公布导出
  396. * @auth {{/talentInfo/publishExport}}
  397. */
  398. public function publishExport() {
  399. $params = $this->request->param();
  400. $startTime = $params["startTime"];
  401. $endTime = $params["endTime"];
  402. if (!strtotime($startTime) || !strtotime($endTime))
  403. return json(["msg" => "时间格式错误"]);
  404. $where[] = ["checkState", "=", TalentState::PUBLISH_PASS];
  405. $where[] = ["certificateGetTime", "between", [$startTime, $endTime]];
  406. $list = TalentModel::where($where)->order("talent_arrange asc,enterprise_id asc")->select();
  407. $rows = [];
  408. $i = 1;
  409. $talentArranges = DictApi::selectByParentCode("talent_arrange");
  410. foreach ($list as $item) {
  411. $talent_condition = TalentConditionApi::getOne($item["talent_condition"]);
  412. $enterprise = EnterpriseApi::getOne($item["enterprise_id"]);
  413. $checkLog = TalentLogApi::getLastLog($item["id"], 1);
  414. $row = [
  415. $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"]
  416. ];
  417. $rows[] = $row;
  418. $i++;
  419. }
  420. $columns = ["序号", "批次", "姓名", "性别", "工作单位", "本人具备的认定条件", "认定人才层次", "审核状态", "备注"];
  421. $filename = "优秀人才" . date("Ym") . "公布名单导出(公示批次-" . $list[0]["publicBatch"] . ")";
  422. if ($rows) {
  423. export($columns, $rows, $filename);
  424. exit();
  425. }
  426. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  427. }
  428. /**
  429. * 预备人才库-公布
  430. * @auth {{/talentInfo/publish}}
  431. */
  432. public function publish() {
  433. $params = $this->request->param();
  434. $id = $params["id"];
  435. $msg = $params["checkMsg"];
  436. $checkState = $params["checkState"];
  437. $batch = $params["batch"];
  438. if ($checkState == 1) {
  439. $state = TalentState::PUBLISH_PASS;
  440. $msg = "公布审核通过:" . $msg;
  441. } else {
  442. $state = TalentState::PUBLISH_FAIL;
  443. $msg = "公布审核不通过:" . $msg;
  444. }
  445. if (!$batch || !strtotime($batch))
  446. return json(["msg" => "公布批次时间错误"]);
  447. if (!$msg)
  448. return json(["msg" => "请填写审核意见"]);
  449. $state = TalentState::PUBLISH_PASS; //公示再审核通过
  450. $batch = $params["batch"];
  451. if (!strtotime($batch))
  452. return json(["msg" => "公布批次时间错误"]);
  453. $talent_info = VerifyApi::getOne($id);
  454. if ($talent_info["checkState"] != TalentState::ANNOUNCED_REVERIFY_PASS) {
  455. return json(["msg" => "当前记录不是公示再审核通过状态,无法审核"]);
  456. }
  457. if (VerifyApi::setPublic($id, $state, $msg, $batch)) {
  458. return json(["code" => 200, "msg" => "公布审核完成"]);
  459. }
  460. return json(["msg" => "公布审核失败"]);
  461. }
  462. /**
  463. * 预备人才库-批量公布通过
  464. * @auth {{/talentInfo/preparePublish}}
  465. */
  466. public function preparePublish() {
  467. $params = $this->request->param();
  468. $ids = $params["ids"];
  469. $ids = array_filter(explode(",", $ids));
  470. $msg = "批量公布";
  471. $state = TalentState::PUBLISH_PASS; //公示再审核通过
  472. $batch = $params["batch"];
  473. if (!strtotime($batch))
  474. return json(["msg" => "公布批次时间错误"]);
  475. $total = count($ids);
  476. $error = 0;
  477. $success = 0;
  478. foreach ($ids as $id) {
  479. $talent_info = VerifyApi::getOne($id);
  480. if ($talent_info["checkState"] != TalentState::ANNOUNCED_REVERIFY_PASS) {
  481. $error++;
  482. continue;
  483. }
  484. if (VerifyApi::setPublic($id, $state, $msg, $batch)) {
  485. $success++;
  486. } else {
  487. $error++;
  488. }
  489. }
  490. return json(["code" => 200, "msg" => sprintf("公布完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
  491. }
  492. /**
  493. * 预备人才库-批量发证
  494. * @auth {{/talentInfo/prepareCertification}}
  495. */
  496. public function prepareCertification() {
  497. $lockFile = fopen("send_certificate.lock", "a");
  498. if (flock($lockFile, LOCK_EX | LOCK_NB)) {//文件锁(独占)
  499. //查询所有待发证的数据
  500. $params = $this->request->param();
  501. $ids = array_filter(explode(",", $params["ids"]));
  502. //晋江市优秀人才证书:当前年份+层次+四位递增数字
  503. //集成电路优秀人才证书:IC+当前年份+递增四位数,如IC20190001
  504. Db::startTrans();
  505. $talent_max_no = [];
  506. $user = session("user");
  507. try {
  508. $talent_list = VerifyApi::getListByIds($ids);
  509. $year = date("Y");
  510. foreach ($talent_list as $talent_info) {
  511. if ($talent_info["checkState"] != TalentState::PUBLISH_PASS) {
  512. Db::rollback();
  513. return json(["msg" => "只能对公布通过的对象进行发证,请核查待发证名单后再重新发证"]);
  514. }
  515. $no_prefix = $year . $talent_info["talent_arrange"];
  516. $where[] = ["certificateNo", "like", $no_prefix . "%"];
  517. $max_no = $talent_max_no[$talent_info["talent_arrange"]] ?: Db::table("new_talent_info")->where($where)->max("certificateNo");
  518. if (!$max_no) {
  519. $max_no = $no_prefix . "0001";
  520. } else {
  521. $new_no = intval(substr($max_no, 5)) + 1;
  522. $max_no = $no_prefix . str_pad($new_no, 4, "0", STR_PAD_LEFT);
  523. }
  524. //更新证书编号
  525. $data["id"] = $talent_info["id"];
  526. $data["certificateNo"] = $max_no;
  527. $data["checkState"] = TalentState::CERTIFICATED;
  528. $data["isPublic"] = 5;
  529. Db::table("new_talent_info")->update($data);
  530. //写入日志
  531. $log["last_state"] = TalentState::PUBLISH_PASS;
  532. $log["id"] = getStringId();
  533. $log["state"] = $log["new_state"] = TalentState::CERTIFICATED;
  534. $log["type"] = 1;
  535. $log["mainId"] = $talent_info["id"];
  536. $log["companyId"] = $user["companyId"];
  537. $log["active"] = 1;
  538. $log["description"] = "人才编号为:" . $max_no;
  539. $log["createUser"] = sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]);
  540. $log["createTime"] = date("Y-m-d H:i:s");
  541. Db::table("new_talent_checklog")->insert($log);
  542. $talent_max_no[$talent_info["talent_arrange"]] = $max_no;
  543. }
  544. Db::commit();
  545. return json(["code" => 200, "msg" => "发证成功"]);
  546. } catch (\Exception $e) {
  547. Db::rollback();
  548. return json(["msg" => "发证失败:" . $e->getMessage()]);
  549. }
  550. flock($lockFile, LOCK_UN);
  551. } else {
  552. return json(["msg" => "同一时间只能有一个管理员进行发证操作"]);
  553. }
  554. }
  555. /**
  556. * 预备人才库-撤销公布
  557. * @auth {{/talentInfo/prepareCanclePublish}}
  558. */
  559. public function pre_cancel_publish() {
  560. }
  561. /**
  562. * 基本条件审核-提交未保存
  563. * @param \think\Request $request
  564. * @param type $talent_info
  565. * @return type json
  566. */
  567. private function baseCheck(\think\Request $request, $talent_info) {
  568. $params = $request->param();
  569. if ($params["checkState"] == 3) {
  570. //审核成功
  571. $log_checkState = $checkState = TalentState::BASE_VERIFY_PASS; //初审成功
  572. } else {
  573. //审核驳回并记录需要修改的字段和上传文件
  574. $checkState = TalentState::FST_SAVE; //退回提交材料阶段
  575. $log_checkState = TalentState::BASE_REJECT; //日志记录拒绝状态
  576. }
  577. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  578. if (!$log)
  579. return json(["msg" => "日志数据异常,保存失败"]);
  580. if ($log["active"] == 0) {
  581. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  582. } else {
  583. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  584. }
  585. $data["id"] = $talent_info["id"];
  586. $data["modify_files"] = $params["files"];
  587. $data["modify_fields"] = $params["fields"];
  588. TalentModel::update($data);
  589. return json(["code" => 200, "msg" => "保存成功"]);
  590. }
  591. /**
  592. * 基本条件审核-提交审核
  593. * @param type $talent_info
  594. * @return type json
  595. */
  596. private function baseSubmitCheck($talent_info) {
  597. return $this->commonSubmitCheck($talent_info, 1);
  598. }
  599. /**
  600. * 初审-提交未保存
  601. * @param \think\Request $request
  602. * @param type $talent_info
  603. * @return type json
  604. */
  605. private function fstCheck(\think\Request $request, $talent_info) {
  606. $params = $request->param();
  607. if ($params["checkState"] == 3) {
  608. //审核成功,并取消设置越过部门并审
  609. $log_checkState = $checkState = TalentState::FST_VERIFY_PASS; //初审成功
  610. $data["pass_dept_check"] = 0;
  611. } else if ($params["checkState"] == 4) {
  612. if ($talent_info["highProcess"] < 3)
  613. return json(["msg" => "只有曾经通过部门并审,初审时才可以选择直接跳过部门并审阶段"]);
  614. //审核成功,并设置越过部门并审。附加条件:最高进度曾经通过部门并审3(包含部门并审)
  615. $log_checkState = $checkState = TalentState::FST_VERIFY_PASS; //初审成功
  616. $data["pass_dept_check"] = $talent_info["highProcess"] >= 3 ? 1 : 0;
  617. } else {
  618. //审核驳回并记录需要修改的字段和上传文件
  619. $checkState = TalentState::SCND_SAVE; //退回材料编辑状态
  620. $log_checkState = TalentState::FST_VERIFY_REJECT; //日志记录拒绝状态
  621. }
  622. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  623. if (!$log)
  624. return json(["msg" => "日志数据异常,保存失败"]);
  625. if ($log["active"] == 0) {
  626. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  627. } else {
  628. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  629. }
  630. $data["id"] = $talent_info["id"];
  631. $data["modify_files"] = $params["files"];
  632. $data["modify_fields"] = $params["fields"];
  633. TalentModel::update($data);
  634. return json(["code" => 200, "msg" => "保存成功"]);
  635. }
  636. /**
  637. * 初审-提交审核
  638. * @param type $talent_info
  639. * @return type json
  640. */
  641. private function fstSubmitCheck($talent_info) {
  642. $nowProcess = 2;
  643. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  644. if (!$log || $log["active"] == 1)
  645. return json(["msg" => "请先保存审核状态,再提交审核"]);
  646. if (in_array($log["new_state"], [TalentState::BASE_VERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::REVERIFY_PASS])) {
  647. $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
  648. }
  649. if ($log["new_state"] == TalentState::FST_VERIFY_PASS && $talent_info["pass_dept_check"] == 0) {
  650. $data["first_dept_check_time"] = date("Y-m-d H:i:s");
  651. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  652. $companyIds = array_filter(explode(",", $condition["companyIds"])); //该条件下需要审核的所有单位
  653. //这边去除已经审核通过的单位,主要通过日志是否存在记录。
  654. $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
  655. $unpass_companyIds = array_diff($companyIds, (array) $pass_companyIds); //排除已经通过的单位
  656. sort($unpass_companyIds);
  657. TalentLogApi::writeDeptLogs($talent_info["id"], $unpass_companyIds, TalentState::FST_VERIFY_PASS);
  658. }
  659. $data["id"] = $talent_info["id"];
  660. $data["checkState"] = $log["new_state"];
  661. TalentModel::update($data);
  662. TalentLogApi::setActive($log["id"], 1);
  663. return json(["code" => 200, "msg" => "审核成功"]);
  664. }
  665. /**
  666. * 部门审核-提交未保存
  667. * @param \think\Request $request
  668. * @param type $talent_info
  669. * @return type json
  670. */
  671. private function deptCheck(\think\Request $request, $talent_info, $companys) {
  672. if ($talent_info["pass_dept_check"] == 1)
  673. return json(["msg" => "不在审核范围。(初审部门已经选择跳过部门并审阶段)"]);
  674. if (!in_array($this->user["companyId"], $companys))
  675. return json(["msg" => "您的部门不在该申请的并审部门列表中。"]);
  676. $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
  677. if (in_array($this->user["companyId"], $pass_companyIds))
  678. return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
  679. $params = $request->param();
  680. if ($params["checkState"] == 3) {
  681. //审核成功
  682. $log_checkState = TalentState::FST_VERIFY_PASS; //当前状态不变
  683. $checkState = TalentState::DEPT_VERIFY_PASS; //审核成功
  684. } else {
  685. //审核驳回并记录需要修改的字段和上传文件
  686. $checkState = TalentState::SCND_SUBMIT; //退回待初审
  687. $log_checkState = TalentState::FST_VERIFY_PASS; //当前状态不变
  688. $talent_condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  689. if (!$talent_condition["companyWithFileType"])
  690. return json(["msg" => "尚未设置单位可审的附件,请联系管理员设置后再进行审批"]);
  691. $cwfts = explode(";", $talent_condition["companyWithFileType"]);
  692. $company_setting = [];
  693. foreach ($cwfts as $cwft) {
  694. $_company_setting = explode(":", $cwft);
  695. if ($_company_setting[0] == $this->user["companyId"]) {
  696. $company_setting = explode(",", $_company_setting[1]);
  697. break;
  698. }
  699. }
  700. if (!$company_setting)
  701. return json(["msg" => "尚未设置单位可审的附件,请联系管理员设置后再进行审批"]);
  702. //$data["modify_fields"] = $params["fields"];
  703. $original_modify_files = explode(",", $talent_info["modify_files"]);
  704. $_current_modify_files = explode(",", $params["files"]);
  705. $unselect_files = array_diff($company_setting, $_current_modify_files); //比较设置和当前提交的,取差值集,既是可选而未选的附件集合
  706. $new_modify_files = array_unique(array_merge($original_modify_files, $_current_modify_files)); //合并当前提交及库中原来保存的值
  707. foreach ($new_modify_files as $key => $item) {
  708. if (in_array($item, $unselect_files))
  709. unset($new_modify_files[$key]);
  710. }
  711. $data["modify_files"] = implode(",", array_unique($new_modify_files));
  712. }
  713. $fst_dept_check_time = $talent_info["first_dept_check_time"];
  714. $dept_log = TalentLogApi::getLogByCompanyId($talent_info["id"], $this->user["companyId"], $fst_dept_check_time);
  715. if (!$dept_log)
  716. return json(["msg" => "未匹配日志,审核失败"]);
  717. if ($dept_log["active"] == 1)
  718. return json(["msg" => "您的部门已经审核过了"]);
  719. $data["id"] = $talent_info["id"];
  720. TalentModel::update($data);
  721. //修改日志
  722. TalentLogApi::rewrite($dept_log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  723. return json(["code" => 200, "msg" => "保存成功"]);
  724. }
  725. /**
  726. * 部门审核-提交审核
  727. * @param type $talent_info
  728. * @return type json
  729. */
  730. private function deptSubmitCheck($talent_info, $companys) {
  731. if ($talent_info["pass_dept_check"] == 1)
  732. return json(["msg" => "不在审核范围。(初审部门已经选择跳过部门并审阶段)"]);
  733. if (!in_array($this->user["companyId"], $companys))
  734. return json(["msg" => "您的部门不在该申请的并审部门列表中。"]);
  735. $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
  736. if (in_array($this->user["companyId"], $pass_companyIds))
  737. return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
  738. $dept_log = TalentLogApi::getLogByCompanyId($talent_info["id"], $this->user["companyId"], $talent_info["first_dept_check_time"]);
  739. $over = $pass_companyIds ? count($pass_companyIds) : 0; //完成度,如果重审之前已有通过审核的部门,不用再审,直接按通过算
  740. $error = 0; //失败数
  741. $nowProcess = 3;
  742. if (!$dept_log)
  743. return json(["msg" => "未匹配日志,审核失败"]);
  744. if ($dept_log["state"] == $dept_log["new_state"])
  745. return json(["msg" => "请先保存审核状态,再提交审核"]);
  746. if ($dept_log["active"] == 1)
  747. return json(["msg" => "您的部门已经审核过了"]);
  748. $over++;
  749. if ($dept_log["new_state"] == TalentState::SCND_SUBMIT) {
  750. $error++;
  751. }
  752. $logs = TalentLogApi::getListLogByTime($talent_info["id"], $talent_info["first_dept_check_time"]);
  753. for ($i = 0; $i < count($logs); $i++) {
  754. if (!in_array($logs[$i]["companyId"], $pass_companyIds)) {
  755. $over += $logs[$i]["active"] == 1 ? 1 : 0;
  756. if ($logs[$i]["new_state"] == TalentState::SCND_SUBMIT) {
  757. $error++;
  758. }
  759. }
  760. }
  761. if ($over == count($companys)) {
  762. //全部已审核
  763. $checkState = TalentState::SCND_SUBMIT;
  764. $log_checkState = TalentState::DEPT_VERIFY_REJECT;
  765. if ($error == 0) {
  766. $log_checkState = $checkState = TalentState::DEPT_VERIFY_PASS;
  767. $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
  768. }
  769. $data["id"] = $talent_info["id"];
  770. $data["checkState"] = $checkState;
  771. $data["first_dept_check_time"] = null;
  772. TalentModel::update($data);
  773. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], "部门审核结束", 1);
  774. }
  775. TalentLogApi::setActive($dept_log["id"], 1);
  776. return json(["code" => 200, "msg" => "审核成功"]);
  777. }
  778. /**
  779. * 复审-提交未保存
  780. * @param \think\Request $request
  781. * @param type $talent_info
  782. * @param type json
  783. */
  784. private function reCheck(\think\Request $request, $talent_info) {
  785. $params = $request->param();
  786. if ($params["checkState"] == 3) {
  787. //审核成功
  788. $log_checkState = $checkState = TalentState::REVERIFY_PASS; //复核成功
  789. } else if ($params["checkState"] == 2) {
  790. //审核驳回并记录需要修改的字段和上传文件
  791. $checkState = TalentState::SCND_SUBMIT; //退回待初审
  792. $log_checkState = TalentState::REVERIFY_REJECT; //日志记录拒绝状态
  793. } else {
  794. $log_checkState = $checkState = TalentState::REVERIFY_FAIL; //审核失败
  795. }
  796. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  797. if (!$log)
  798. return json(["msg" => "日志数据异常,保存失败"]);
  799. if ($log["active"] == 0) {
  800. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  801. } else {
  802. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  803. }
  804. $data["id"] = $talent_info["id"];
  805. $data["modify_files"] = $params["files"];
  806. $data["modify_fields"] = $params["fields"];
  807. TalentModel::update($data);
  808. return json(["code" => 200, "msg" => "保存成功"]);
  809. }
  810. /**
  811. * 复审-提交审核
  812. * @param type $talent_info
  813. * @return type json
  814. */
  815. private function reSubmitCheck($talent_info) {
  816. return $this->commonSubmitCheck($talent_info, 4);
  817. }
  818. private function commonSubmitCheck($talent_info, $nowProcess) {
  819. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  820. if (!$log || $log["active"] == 1)
  821. return json(["msg" => "请先保存审核状态,再提交审核"]);
  822. if (in_array($log["new_state"], [TalentState::BASE_VERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::REVERIFY_PASS])) {
  823. $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
  824. }
  825. $data["id"] = $talent_info["id"];
  826. $data["checkState"] = $log["new_state"];
  827. TalentModel::update($data);
  828. TalentLogApi::setActive($log["id"], 1);
  829. return json(["code" => 200, "msg" => "审核成功"]);
  830. }
  831. public function check() {
  832. //公共调度方法
  833. $request = $this->request;
  834. $params = $request->param();
  835. $check = $params["checkState"];
  836. $check_msg = trim($params["checkMsg"]);
  837. $files = $params["files"];
  838. $fields = $params["fields"];
  839. $id = $params["id"];
  840. $talent_info = VerifyApi::getOne($id);
  841. $checkState = $talent_info["checkState"];
  842. if (!$talent_info) {
  843. return json(["msg" => "数据错误"]);
  844. }
  845. if (!$check) {
  846. return json(["msg" => "请选择审核状态"]);
  847. }
  848. if (!$check_msg) {
  849. return json(["msg" => "请填写审核说明"]);
  850. }
  851. if ($checkState == TalentState::FST_SUBMIT) {
  852. return $this->baseCheck($request, $talent_info);
  853. } else if ($checkState == TalentState::SCND_SUBMIT) {
  854. return $this->fstCheck($request, $talent_info);
  855. } else if ($checkState == TalentState::FST_VERIFY_PASS) {
  856. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  857. $companys = array_filter(explode(",", $condition["companyIds"]));
  858. if ($companys && $talent_info["pass_dept_check"] != 1) {
  859. if (!in_array($this->user["companyId"], $companys))
  860. return json(["msg" => "你的部门不在并审部门列表"]);
  861. return $this->deptCheck($request, $talent_info, $companys);
  862. } else {
  863. return $this->reCheck($request, $talent_info);
  864. }
  865. } else if ($checkState == TalentState::DEPT_VERIFY_PASS) {
  866. return $this->reCheck($request, $talent_info);
  867. } else {
  868. return json(["msg" => "不在审核范围内,保存失败"]);
  869. }
  870. }
  871. public function submitCheck() {
  872. //公共调度方法
  873. $id = $this->request->param("id");
  874. $talent_info = VerifyApi::getOne($id);
  875. $checkState = $talent_info["checkState"];
  876. if (!$talent_info) {
  877. return json(["msg" => "数据错误"]);
  878. }
  879. if ($checkState == TalentState::FST_SUBMIT) {
  880. return $this->baseSubmitCheck($talent_info);
  881. } else if ($checkState == TalentState::SCND_SUBMIT) {
  882. return $this->fstSubmitCheck($talent_info);
  883. } else if ($checkState == TalentState::FST_VERIFY_PASS) {
  884. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  885. $companys = array_filter(explode(",", $condition["companyIds"]));
  886. if ($companys && $talent_info["pass_dept_check"] != 1) {
  887. if (!in_array($this->user["companyId"], $companys))
  888. return json(["msg" => "你的部门不在并审部门列表"]);
  889. return $this->deptSubmitCheck($talent_info, $companys);
  890. } else {
  891. return $this->reSubmitCheck($talent_info);
  892. }
  893. } else if ($checkState == TalentState::DEPT_VERIFY_PASS) {
  894. return $this->reSubmitCheck($talent_info);
  895. } else {
  896. return json(["msg" => "不在审核范围内,审核失败"]);
  897. }
  898. }
  899. public function validateIsCheck() {
  900. $params = $this->request->param();
  901. $id = $params["id"];
  902. $talent_info = VerifyApi::getOne($id);
  903. if ($talent_info) {
  904. $checkState = $talent_info["checkState"];
  905. // 0正在填写 1保存未提交 2已提交未审核 3已审核 4驳回 5保存补充材料未提交 6提交补充材料进入初审 7初审通过 8初审驳回 9部门审核通过 10部门审核驳回 11复核通过 12复核驳回 13复核失败
  906. $process = 0;
  907. if (in_array($checkState, [2, 6, 7, 9])) {
  908. switch ($checkState) {
  909. case 2:
  910. $enterprise = \app\common\model\Enterprise::findOrEmpty($talent_info["enterprise_id"]);
  911. $fields = DictApi::getTalentFields(1);
  912. $field_tmp = [];
  913. foreach ($fields as $key => $field) {
  914. $field_tmp[] = ["key" => $key, "value" => $field];
  915. }
  916. $where[] = ["project", "=", 1];
  917. $where[] = ["step", "=", 1];
  918. $where[] = ["active", "=", 1];
  919. $where[] = ["type", "=", $enterprise["type"]];
  920. $files = \think\facade\Db::table("new_common_filetype")->where($where)->select();
  921. $process = 1;
  922. break;
  923. case 6:
  924. $fields = DictApi::getTalentFields(2);
  925. $process = 2;
  926. break;
  927. case 7:
  928. $tc = TalentConditionApi::getOne($talent_info["talent_condition"]);
  929. if ($tc["companyIds"] && $talent_info["pass_dept_check"] != 1) {
  930. $process = 3;
  931. } else {
  932. $process = 4;
  933. }
  934. $fields = DictApi::getTalentFields($process);
  935. break;
  936. case 9:
  937. $process = 4;
  938. $fields = DictApi::getTalentFields($process);
  939. break;
  940. }
  941. if ($checkState != 2) {
  942. $enterprise = \app\common\model\Enterprise::findOrEmpty($talent_info["enterprise_id"]);
  943. //$fields = DictApi::getTalentFields(2);
  944. $field_tmp = [];
  945. if ($fields) {
  946. foreach ($fields as $key => $field) {
  947. $field_tmp[] = ["key" => $key, "value" => $field];
  948. }
  949. }
  950. $where = [];
  951. $whr = [];
  952. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  953. $where[] = ["project", "=", 1];
  954. $where[] = ["step", "=", 2];
  955. $where[] = ["active", "=", 1];
  956. $where[] = ["type", "=", $enterprise["type"]];
  957. $where[] = ["isConditionFile", "<>", 1];
  958. if ($process == 3) {
  959. $where = [];
  960. $cwfts = explode(";", $condition["companyWithFileType"]);
  961. foreach ($cwfts as $cwft) {
  962. $_company_setting = explode(":", $cwft);
  963. if ($_company_setting[0] == $this->user["companyId"]) {
  964. $where[] = ["id", "in", explode(",", $_company_setting[1])];
  965. break;
  966. }
  967. }
  968. if ($where) {
  969. $files = \think\facade\Db::table("new_common_filetype")->where($where)->select();
  970. } else {
  971. $files = [];
  972. }
  973. } else {
  974. if ($condition && $condition["bindFileTypes"]) {
  975. $whr[] = ["id", "in", explode(",", $condition["bindFileTypes"])];
  976. $files = \think\facade\Db::table("new_common_filetype")->whereOr([$where, $whr])->select();
  977. } else {
  978. $files = \think\facade\Db::table("new_common_filetype")->where($where)->select();
  979. }
  980. }
  981. }
  982. $talent_info["files"] = array_filter(explode(",", $talent_info["modify_files"]));
  983. $talent_info["fields"] = array_filter(explode(",", $talent_info["modify_fields"]));
  984. return json(["code" => 200, "obj" => ["process" => $process, "talentInfo" => $talent_info, "fieldList" => $field_tmp, "fileList" => $files]]);
  985. } else {
  986. return json(["msg" => "该申报不在审核范围内,无法审核"]);
  987. }
  988. }
  989. }
  990. public function findFieldsAndFiles() {
  991. }
  992. public function commonExport() {
  993. $params = $this->request->param();
  994. $fields = $params["export"];
  995. if (!$fields)
  996. return json(["msg" => "请选择要导出的数据"]);
  997. $names = DictApi::getTalentFields(4);
  998. $names["industryFieldNew"] = "产业领域";
  999. $names["enterpriseName"] = "单位名称";
  1000. $names["enterpriseTag"] = "单位标签";
  1001. $names["street"] = "所属镇街";
  1002. $names["checkState"] = "审核状态";
  1003. $list = VerifyApi::getExportDatas($fields);
  1004. foreach ($fields as $field) {
  1005. $columns[] = $names[$field];
  1006. }
  1007. $datas = [];
  1008. for ($i = 0; $i < count($list); $i++) {
  1009. $data = [];
  1010. for ($n = 0; $n < count($fields); $n++) {
  1011. $data[] = $list[$i][$fields[$n]];
  1012. }
  1013. $datas[] = $data;
  1014. }
  1015. if ($datas) {
  1016. export($columns, $datas);
  1017. exit();
  1018. }
  1019. echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
  1020. }
  1021. public function getPhones() {
  1022. $list = VerifyApi::getListByProcess($this->request->param("process"));
  1023. $result = [];
  1024. if ($list) {
  1025. foreach ($list as $item) {
  1026. if ($item["phone"] && $item["name"]) {
  1027. $result[] = sprintf("%s:%s", $item["name"], $item["phone"]);
  1028. }
  1029. }
  1030. }
  1031. return json(["code" => 200, "obj" => implode(";", $result)]);
  1032. }
  1033. public function getEnterprisePhones() {
  1034. $list = VerifyApi::getListByProcess($this->request->param("process"));
  1035. $result = [];
  1036. if ($list) {
  1037. foreach ($list as $item) {
  1038. if ($item["agentName"] && $item["agentPhone"]) {
  1039. $result[] = sprintf("%s:%s", $item["agentName"], $item["agentPhone"]);
  1040. }
  1041. }
  1042. }
  1043. return json(["code" => 200, "obj" => implode(";", $result)]);
  1044. }
  1045. }