VerifyApi.php 26 KB

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