Talent.php 49 KB

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