Talent.php 51 KB

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