Talent.php 71 KB

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