VerifyApi.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <?php
  2. namespace app\common\api;
  3. use app\enterprise\model\Talent;
  4. use app\common\api\DictApi;
  5. use app\admin\model\Enterprise;
  6. use think\facade\Db;
  7. use app\common\model\TalentCondition;
  8. /**
  9. * Description of VerifyApi
  10. *
  11. * @author sgq
  12. */
  13. class VerifyApi {
  14. public static function getTalentInfoById($id) {
  15. $where = [];
  16. $where[] = ["id", "=", $id];
  17. $info = Talent::findOrEmpty($id)->toArray();
  18. if ($info) {
  19. if ($info["talent_type"]) {
  20. $info["talentTypeName"] = DictApi::selectByParentCode("talent_type")[$info["talent_type"]];
  21. }
  22. if ($info["nationality"]) {
  23. $info["nationalityName"] = DictApi::selectByParentCode("nationality")[$info["nationality"]];
  24. }
  25. if ($info["nation"]) {
  26. $info["nationName"] = DictApi::selectByParentCode("nation")[$info["nation"]];
  27. }
  28. if ($info["politics"]) {
  29. $info["politicsName"] = DictApi::selectByParentCode("politics")[$info["politics"]];
  30. }
  31. if ($info["province"]) {
  32. $info["provinceName"] = Db::table("un_common_location")->where("code", "=", $info["province"])->findOrEmpty()["name"];
  33. }
  34. if ($info["city"]) {
  35. $info["cityName"] = Db::table("un_common_location")->where("code", "=", $info["city"])->findOrEmpty()["name"];
  36. }
  37. if ($info["county"]) {
  38. $info["countyName"] = Db::table("un_common_location")->where("code", "=", $info["county"])->findOrEmpty()["name"];
  39. }
  40. $enterprise = Enterprise::findOrEmpty($info["enterprise_id"])->toArray();
  41. $info["enterpriseName"] = $enterprise["name"];
  42. $info["enterpriseTag"] = $enterprise["enterpriseTag"];
  43. if ($enterprise["street"]) {
  44. $info["street"] = $enterprise["street"];
  45. $info["streetName"] = DictApi::selectByParentCode("street")[$enterprise["street"]];
  46. }
  47. if ($enterprise["industryFieldNew"]) {
  48. $info["industryFieldName"] = DictApi::selectByParentCode("industry_field")[$enterprise["industryFieldNew"]];
  49. }
  50. if ($enterprise["enterpriseTag"]) {
  51. $info["enterpriseTagName"] = DictApi::selectByParentCode("enterprise_tag")[$enterprise["enterpriseTag"]];
  52. }
  53. if ($info["talent_arrange"]) {
  54. $info["talentArrangeName"] = DictApi::selectByParentCode("talent_arrange")[$info["talent_arrange"]];
  55. }
  56. if ($info["import_way"]) {
  57. $info["importWayName"] = DictApi::selectByParentCode("import_way")[$info["import_way"]];
  58. }
  59. if ($info["source"]) {
  60. $info["sourceName"] = DictApi::selectByParentCode("source")[$info["source"]];
  61. }
  62. if ($info["source_city"]) {
  63. $info["sourceCityName"] = Db::table("un_common_location")->where("code", "=", $info["source_city"])->findOrEmpty()["name"];
  64. }
  65. if ($info["source_county"]) {
  66. $info["sourceCountyName"] = Db::table("un_common_location")->where("code", "=", $info["source_county"])->findOrEmpty()["name"];
  67. }
  68. if ($info["highest_degree"]) {
  69. $info["highestDegreeName"] = DictApi::selectByParentCode("highest_degree")[$info["highest_degree"]];
  70. }
  71. if ($info["talent_condition"]) {
  72. $talent_condition = \app\common\model\TalentCondition::findOrEmpty($info["talent_condition"]);
  73. $info["talentConditionName"] = $talent_condition["name"];
  74. $info["talent_arrange_category"] = $talent_condition["talentLevelCat"];
  75. $info["talentArrangeCatName"] = DictApi::selectByParentCode("talent_condition_cats")[$talent_condition["talentLevelCat"]];
  76. }
  77. }
  78. return $info;
  79. }
  80. public static function getOne($id) {
  81. return Talent::findOrEmpty($id);
  82. }
  83. public static function getDeptList($params, $where = []) {
  84. $order = $params["order"] ?: "desc";
  85. $offset = $params["offset"] ?: 0;
  86. $limit = $params["limit"] ?: 10;
  87. $companyId = session("user")["companyId"];
  88. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  89. $count = Talent::alias("ti")
  90. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  91. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  92. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  93. ->where($where)
  94. ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])->count();
  95. $list = Talent::alias("ti")
  96. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  97. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  98. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  99. ->where($where)
  100. ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])
  101. ->field("ti.*,tl.last_state as 'lastState',tl.state as 'realState',e.name as enterprise_name,e.type as enterprise_type,enterpriseTag")
  102. ->limit($offset, $limit)->order("ti.createTime " . $order)
  103. ->select()->toArray();
  104. foreach ($list as &$item) {
  105. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江优秀人才" : "集成电路优秀人才";
  106. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  107. $lastCheckLog = TalentLogApi::getCompanyNewestCheckedLog($item["id"], $companyId);
  108. $item["deptCheckState"] = $lastCheckLog["new_state"];
  109. }unset($item);
  110. return ["total" => $count, "rows" => $list];
  111. }
  112. public static function getPublicList($params) {
  113. $order = $params["order"];
  114. $offset = $params["offset"];
  115. $limit = $params["limit"];
  116. $where = [];
  117. if ($params["name"]) {
  118. $where[] = ["ti.name", "like", "%" . $params["name"] . "%"];
  119. }
  120. if ($params["sex"]) {
  121. $where[] = ["ti.sex", "=", $params["sex"]];
  122. }
  123. if ($params["checkState"]) {
  124. $where[] = ["ti.checkState", "=", $params["checkState"]];
  125. }
  126. $type = $params["type"];
  127. switch ($type) {
  128. case 1:
  129. case 2:
  130. $where[] = ["ti.checkState", "=", TalentState::REVERIFY_PASS];
  131. break;
  132. case 3: //公示
  133. case 7: //公示预览
  134. $where[] = ["ti.checkState", "=", TalentState::ZX_PASS];
  135. break;
  136. case 4: //公示通过
  137. $where[] = ["ti.checkState", "=", TalentState::ANNOUNCED];
  138. break;
  139. case 5:
  140. case 8: //公布预览
  141. $where[] = ["ti.checkState", "=", TalentState::ANNOUNCED_REVERIFY_PASS];
  142. break;
  143. case 6:
  144. $where[] = ["ti.checkState", "=", TalentState::PUBLISH_PASS];
  145. break;
  146. }
  147. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  148. $count = Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->where($where)->count();
  149. $list = Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  150. ->where($where)
  151. ->limit($offset, $limit)
  152. ->order("ti.createTime " . $order)->field("ti.*,e.name as enterpriseName,e.type as enterprise_type,enterpriseTag")->select()->toArray();
  153. foreach ($list as &$item) {
  154. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江优秀人才" : "集成电路优秀人才";
  155. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  156. }unset($item);
  157. return ["total" => $count, "rows" => $list];
  158. }
  159. public static function getListByIds($ids) {
  160. $where[] = ["id", "in", $ids];
  161. return Talent::where($where)->select()->toArray();
  162. }
  163. public static function getList($params) {
  164. $where = [];
  165. $order = $params["order"] ?: "desc";
  166. $offset = $params["offset"] ?: 0;
  167. $limit = $params["limit"] ?: 10;
  168. unset($params["order"]);
  169. unset($params["limit"]);
  170. unset($params["offset"]);
  171. if ($params["name"]) {
  172. $where[] = ["ti.name", "like", "%{$params["name"]}%"];
  173. }
  174. if ($params["card_number"]) {
  175. $where[] = ["ti.card_number", "like", "%" . $params["card_number"] . "%"];
  176. }
  177. if ($params["sex"]) {
  178. $where[] = ["ti.sex", "=", $params["sex"]];
  179. }
  180. if ($params["nation"]) {
  181. $where[] = ["ti.nation", "=", $params["nation"]];
  182. }
  183. if ($params["apply_year"]) {
  184. $where[] = ["ti.apply_year", "like", "{$params["apply_year"]}%"];
  185. }
  186. if ($params["phone"]) {
  187. $where[] = ["ti.phone", "like", "%{$params["phone"]}%"];
  188. }
  189. if ($params["email"]) {
  190. $where[] = ["ti.email", "like", "%{$params["email"]}%"];
  191. }
  192. if ($params["nationality"]) {
  193. $where[] = ["ti.nationality", "=", $params["nationality"]];
  194. }
  195. if ($params["province"]) {
  196. $where[] = ["ti.province", "=", $params["province"]];
  197. }
  198. if ($params["politics"]) {
  199. $where[] = ["ti.politics", "=", $params["politics"]];
  200. }
  201. if ($params["enterprise_id"]) {
  202. $where[] = ["ti.enterprise_id", "=", $params["enterprise_id"]];
  203. }
  204. if ($params["street"]) {
  205. $where[] = ["e.street", "=", $params["street"]];
  206. }
  207. if ($params["industry_field"]) {
  208. $where[] = ["e.industryFieldNew", "=", $params["industry_field"]];
  209. }
  210. if ($params["talent_type"]) {
  211. $where[] = ["ti.talent_type", "=", $params["talent_type"]];
  212. }
  213. if ($params["import_way"]) {
  214. $where[] = ["ti.import_way", "=", $params["import_way"]];
  215. }
  216. if ($params["highest_degree"]) {
  217. $where[] = ["ti.highest_degree", "=", $params["highest_degree"]];
  218. }
  219. if ($params["study_abroad"]) {
  220. $where[] = ["ti.study_abroad", "=", $params["study_abroad"]];
  221. }
  222. if ($params["source"]) {
  223. $where[] = ["ti.source", "=", $params["source"]];
  224. }
  225. if ($params["talent_arrange"]) {
  226. $where[] = ["ti.talent_arrange", "=", $params["talent_arrange"]];
  227. }
  228. $process = $params["process"];
  229. if ($process == 4) {
  230. switch ($params["checkState"]) {
  231. case 5:
  232. $_where = [];
  233. $_where[] = ["type", "=", 1];
  234. $_where[] = ["active", "=", 1];
  235. $_where[] = ["step", "=", 3];
  236. $_where[] = ["companyId", "=", session("user")["companyId"]];
  237. $mainIds = \app\common\model\TalentChecklog::where($_where)->group("mainId")->order("createTime desc")->column("mainId");
  238. if ($mainIds) {
  239. $where[] = ["ti.id", "in", $mainIds];
  240. } else {
  241. $where[] = ["ti.checkState", "=", TalentState::FST_VERIFY_PASS];
  242. $where[] = ["ti.pass_dept_check", "=", 0];
  243. }
  244. break;
  245. default:
  246. $where[] = ["ti.checkState", "=", TalentState::FST_VERIFY_PASS];
  247. $where[] = ["ti.pass_dept_check", "=", 0];
  248. break;
  249. }
  250. return self::getDeptList($params, $where);
  251. }
  252. if ($process == 5) {
  253. $whereRaw = sprintf("(ti.checkState in (11,12,13)) or (ti.checkState=9 and ti.pass_dept_check=0) or (ti.checkState=7 and ti.pass_dept_check=1) or (ti.checkState=7 and (tc.companyIds is null or tc.companyIds = ''))");
  254. switch ($params["checkState"]) {
  255. case 1:
  256. $where[] = ["ti.checkState", "in", [TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS]];
  257. break;
  258. case -1:
  259. $where[] = ["ti.checkState", "=", TalentState::REVERIFY_FAIL];
  260. break;
  261. }
  262. $count = Talent::alias("ti")
  263. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  264. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  265. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  266. ->whereRaw($whereRaw)->where($where)->count();
  267. $list = Talent::alias("ti")
  268. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  269. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  270. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  271. ->whereRaw($whereRaw)
  272. ->where($where)
  273. ->limit($offset, $limit)
  274. ->order("ti.createTime " . $order)
  275. ->field("ti.*,tl.last_state as 'lastState',tl.state as 'realState',e.name as enterprise_name,e.type as enterprise_type,enterpriseTag")
  276. ->select()->toArray();
  277. } else {
  278. switch ($process) {
  279. case 1:
  280. $where[] = ["ti.checkState", "in", [TalentState::FST_SUBMIT, TalentState::BASE_VERIFY_FAIL]];
  281. break;
  282. case 2:
  283. //等完善
  284. $where[] = ["ti.checkState", "in", [TalentState::BASE_VERIFY_PASS]];
  285. break;
  286. case 3:
  287. switch ($params["checkState"]) {
  288. case 1://待审核
  289. $where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT];
  290. $where[] = ["tl.state", "=", TalentState::SCND_SUBMIT];
  291. break;
  292. case 2://驳回
  293. $where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT];
  294. $where[] = ["tl.state", "in", [TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT]];
  295. break;
  296. default:
  297. $where[] = ["ti.checkState", "in", [TalentState::SCND_SUBMIT, TalentState::FST_VERIFY_FAIL]];
  298. }
  299. break;
  300. case 6:
  301. $where[] = ["ti.checkState", ">=", TalentState::REVERIFY_PASS];
  302. if ($params["checkState"]) {
  303. $where[] = ["ti.checkState", "=", $params["checkState"]];
  304. }
  305. break;
  306. }
  307. $count = Talent::alias("ti")
  308. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  309. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  310. ->where($where)->count();
  311. $list = Talent::alias("ti")
  312. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  313. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  314. ->where($where)->limit($offset, $limit)->order("ti.createTime " . $order)->field("ti.*,tl.last_state as 'lastState',tl.state as 'realState',e.name as enterprise_name,e.type as enterprise_type,enterpriseTag")->select()->toArray();
  315. }
  316. $talent_arrange_kvs = DictApi::selectByParentCode("talent_arrange");
  317. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  318. foreach ($list as &$item) {
  319. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江优秀人才" : "集成电路优秀人才";
  320. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  321. $item["talentArrangeName"] = $talent_arrange_kvs[$item["talent_arrange"]];
  322. $item["talentConditionName"] = TalentCondition::findOrEmpty($item["talent_condition"])["name"];
  323. //$last_log = TalentLogApi::getLastLog($item["id"], 1, 0, ["step", "=", null]);
  324. //$item["lastState"] = $last_log["last_state"];
  325. //$item["realState"] = $last_log["state"];
  326. }unset($item);
  327. return ["total" => $count, "rows" => $list];
  328. }
  329. public static function getExportDatas($process, $params) {
  330. $where[] = [];
  331. //特殊字段处理
  332. $fields = [];
  333. foreach ($params as $param) {
  334. if (!in_array($param, ["industryFieldNew", "enterpriseName", "enterpriseTag", "street", "talent_arrange_category", "checkMsg"])) {
  335. $fields[] = "ti." . $param;
  336. }
  337. }
  338. $fields[] = "e.name as enterpriseName";
  339. $fields[] = "e.industryFieldNew";
  340. $fields[] = "e.enterpriseTag";
  341. $fields[] = "e.street";
  342. $fields[] = "tc.talentLevelCat";
  343. $fields[] = "tl.description as checkMsg";
  344. $fields[] = "tc.name as talentConditionName";
  345. $fields[] = "tl.description as checkMsg";
  346. if (in_array("card_type", $params)) {
  347. $cardTypes = DictApi::selectByParentCode("card_type");
  348. }
  349. if (in_array("industryFieldNew", $params)) {
  350. $industry_fields = DictApi::selectByParentCode("industry_field");
  351. }
  352. if (in_array("enterpriseTag", $params)) {
  353. $enterpriseTags = DictApi::selectByParentCode("enterprise_tag");
  354. }
  355. if (in_array("street", $params)) {
  356. $streets = DictApi::selectByParentCode("street");
  357. }
  358. if (in_array("nation", $params)) {
  359. $nations = DictApi::selectByParentCode("nation");
  360. }
  361. if (in_array("nationality", $params)) {
  362. $nationalitys = DictApi::selectByParentCode("nationality");
  363. }
  364. if (in_array("politics", $params)) {
  365. $politics = DictApi::selectByParentCode("politics");
  366. }
  367. if (in_array("talent_type", $params)) {
  368. $talentTypes = DictApi::selectByParentCode("talent_type");
  369. }
  370. if (in_array("talent_arrange_category", $params)) {
  371. $talentArrangeCategories = DictApi::selectByParentCode("talent_condition_cats");
  372. }
  373. if (in_array("highest_degree", $params)) {
  374. $highest_degree = DictApi::selectByParentCode("highest_degree");
  375. }
  376. if (in_array("import_way", $params)) {
  377. $import_way = DictApi::selectByParentCode("import_way");
  378. }
  379. if (in_array("source", $params)) {
  380. $source = DictApi::selectByParentCode("source");
  381. }
  382. if (in_array("source_city", $params)) {
  383. $source_city = DictApi::selectByParentCode("source_city");
  384. }
  385. if (in_array("source_county", $params)) {
  386. $source_county = DictApi::selectByParentCode("source_county");
  387. }
  388. if (in_array("talent_arrange", $params)) {
  389. $talent_arrange = DictApi::selectByParentCode("talent_arrange");
  390. }
  391. $sex = [1 => "男", 2 => "女"];
  392. $pre_import_type = [1 => "意向合同", 2 => "创业企业名称预核准"];
  393. $study_abroad = [1 => "是", 2 => "否"];
  394. $where = [];
  395. switch ($process) {
  396. case 1:
  397. $where = "ti.checkState in (" . TalentState::FST_SUBMIT . "," . TalentState::BASE_VERIFY_FAIL . ")";
  398. break;
  399. case 2:
  400. //待完善
  401. break;
  402. case 3:
  403. $where = "ti.checkState in (" . TalentState::SCND_SUBMIT . "," . TalentState::FST_VERIFY_FAIL . ")";
  404. break;
  405. case 4:
  406. $companyId = session("user")["companyId"];
  407. $where = "ti.checkState = " . TalentState::FST_VERIFY_PASS . " and ti.pass_dept_check=0 and find_in_set({$companyId},tc.companyIds)";
  408. break;
  409. case 5:
  410. $where = sprintf("(ti.checkState in (%d,%d,%d)) or (ti.checkState=%d and ti.pass_dept_check=0) or (ti.checkState=%d and ti.pass_dept_check=1) or (ti.checkState=%d and (tc.companyIds is null or tc.companyIds = ''))", TalentState::REVERIFY_PASS, TalentState::REVERIFY_REJECT, TalentState::REVERIFY_FAIL, TalentState::DEPT_VERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_PASS);
  411. break;
  412. case 6:
  413. $where = "ti.checkState >= " . TalentState::REVERIFY_PASS;
  414. break;
  415. }
  416. $list = Talent::alias("ti")
  417. ->field($fields)
  418. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  419. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  420. ->leftJoin("new_talent_checklog tl", "tl.mainId=ti.id and tl.id=(select id from new_talent_checklog where mainId=ti.id and `step` is null and active=1 and typeFileId is null order by createTime desc limit 1)")
  421. ->whereRaw($where)
  422. ->select()->toArray();
  423. foreach ($list as &$item) {
  424. $item["card_type"] = $cardTypes[$item["card_type"]];
  425. $item["industryFieldNew"] = $industry_fields[$item["industryFieldNew"]];
  426. $item["enterpriseTag"] = $enterpriseTags[$item["enterpriseTag"]];
  427. $item["street"] = $streets[$item["street"]];
  428. $item["nation"] = $nations[$item["nation"]];
  429. $item["nationality"] = $nationalitys[$item["nationality"]];
  430. $item["politics"] = $politics[$item["politics"]];
  431. $item["talent_type"] = $talentTypes[$item["talent_type"]];
  432. $item["talent_arrange_category"] = $talentArrangeCategories[$item["talentLevelCat"]];
  433. $item["sex"] = $sex[$item["sex"]];
  434. $item["highest_degree"] = $highest_degree[$item["highest_degree"]];
  435. $item["import_way"] = $import_way[$item["import_way"]];
  436. $item["pre_import_type"] = $pre_import_type[$item["pre_import_type"]];
  437. $item["study_abroad"] = $study_abroad[$item["study_abroad"]];
  438. $item["source"] = $source[$item["source"]];
  439. $item["talent_arrange"] = $talent_arrange[$item["talent_arrange"]];
  440. $item["talent_condition"] = $item["talentConditionName"];
  441. if (in_array("source_city", $params)) {
  442. $item["source_city"] = Db::table("un_common_location")->where("code", "=", $item["source_city"])->findOrEmpty()["name"];
  443. }
  444. if (in_array("source_county", $params)) {
  445. $item["source_county"] = Db::table("un_common_location")->where("code", "=", $item["source_county"])->findOrEmpty()["name"];
  446. }
  447. if (in_array("province", $params)) {
  448. $item["province"] = Db::table("un_common_location")->where("code", "=", $item["province"])->findOrEmpty()["name"];
  449. }
  450. if (in_array("city", $params)) {
  451. $item["city"] = Db::table("un_common_location")->where("code", "=", $item["city"])->findOrEmpty()["name"];
  452. }
  453. if (in_array("county", $params)) {
  454. $item["county"] = Db::table("un_common_location")->where("code", "=", $item["county"])->findOrEmpty()["name"];
  455. }
  456. $item["checkState"] = TalentState::getStateName($item["checkState"]);
  457. }unset($item);
  458. return $list;
  459. }
  460. public static function getListByProcess($process) {
  461. switch ($process) {
  462. case 1:
  463. $where[] = ["ti.checkState", "in", [TalentState::FST_SUBMIT, TalentState::BASE_VERIFY_FAIL]];
  464. break;
  465. case 2:
  466. //待完善
  467. break;
  468. case 3:
  469. $where[] = ["ti.checkState", "in", [TalentState::SCND_SUBMIT, TalentState::FST_VERIFY_FAIL]];
  470. break;
  471. default:
  472. return null;
  473. }
  474. return Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->where($where)->field("ti.*,e.agentName,e.agentPhone")->select()->toArray();
  475. }
  476. public static function setPublic($mainId, $state, $msg, $batch = null, $type = 1) {
  477. $data["id"] = $mainId;
  478. $data["checkState"] = $state;
  479. switch ($state) {
  480. case TalentState::ZX_PASS:
  481. case TalentState::ZX_FAIL:
  482. $data["isPublic"] = 2;
  483. break;
  484. case TalentState::ANNOUNCED:
  485. $data["isPublic"] = 3;
  486. $data["publicBatch"] = $batch;
  487. break;
  488. case TalentState::ANNOUNCED_REVERIFY_PASS:
  489. case TalentState::ANNOUNCED_REVERIFY_FAIL:
  490. $data["isPublic"] = 3;
  491. break;
  492. case TalentState::PUBLISH_PASS:
  493. $data["isPublic"] = 4;
  494. $data["certificateGetTime"] = $batch;
  495. $data["certificateExpireTime"] = date("Y-m-d", strtotime(sprintf("%s +6 years", $batch)));
  496. break;
  497. case TalentState::PUBLISH_FAIL:
  498. $data["isPublic"] = 4;
  499. break;
  500. }
  501. if (Talent::update($data)) {
  502. TalentLogApi::write($type, $mainId, $state, $msg, 1);
  503. return true;
  504. }
  505. return false;
  506. }
  507. }