IntegralVerify.php 53 KB

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