VerifyApi.php 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934
  1. <?php
  2. namespace app\common\api;
  3. use app\admin\model\Notice as NoticeModel;
  4. use app\enterprise\model\Talent;
  5. use app\common\api\DictApi;
  6. use app\admin\model\Enterprise;
  7. use think\facade\Db;
  8. use app\common\model\TalentCondition;
  9. /**
  10. * Description of VerifyApi
  11. *
  12. * @author sgq
  13. */
  14. class VerifyApi {
  15. public static function getTalentInfoById($id, $isAdmin = false) {//添加admin只为区别导入数据管理端的显示差异
  16. $where = [];
  17. $where[] = ["id", "=", $id];
  18. $info = Talent::findOrEmpty($id)->toArray();
  19. if ($info) {
  20. if ($info["talent_type"]) {
  21. $info["talentTypeName"] = DictApi::selectByParentCode("talent_type")[$info["talent_type"]];
  22. }
  23. if ($info["nationality"]) {
  24. $info["nationalityName"] = DictApi::selectByParentCode("nationality")[$info["nationality"]];
  25. }
  26. if ($info["nation"]) {
  27. $info["nationName"] = DictApi::selectByParentCode("nation")[$info["nation"]];
  28. }
  29. if ($info["politics"]) {
  30. $info["politicsName"] = DictApi::selectByParentCode("politics")[$info["politics"]];
  31. }
  32. if ($info["province"]) {
  33. $info["provinceName"] = Db::table("un_common_location")->where("code", "=", $info["province"])->findOrEmpty()["name"];
  34. }
  35. if ($info["city"]) {
  36. $info["cityName"] = Db::table("un_common_location")->where("code", "=", $info["city"])->findOrEmpty()["name"];
  37. }
  38. if ($info["county"]) {
  39. $info["countyName"] = Db::table("un_common_location")->where("code", "=", $info["county"])->findOrEmpty()["name"];
  40. }
  41. $enterprise = Enterprise::findOrEmpty($info["enterprise_id"])->toArray();
  42. $info["enterpriseName"] = $enterprise["name"];
  43. $info["enterpriseId"] = $enterprise["id"];
  44. $info["enterpriseType"] = $enterprise["type"];
  45. $info["enterpriseEphone"] = $enterprise["ephone"];
  46. $info["enterpriseTag"] = $enterprise["enterpriseTag"];
  47. $info["enterpriseBankCard"] = $enterprise["bankCard"];
  48. $info["enterpriseBankNetwork"] = $enterprise["bankNetwork"];
  49. $info["enterpriseBank"] = $enterprise["bank"];
  50. if ($enterprise["street"]) {
  51. $info["street"] = $enterprise["street"];
  52. $info["streetName"] = DictApi::selectByParentCode("street")[$enterprise["street"]];
  53. }
  54. if ($enterprise["industryFieldNew"]) {
  55. $info["industryFieldName"] = DictApi::selectByParentCode("industry_field")[$enterprise["industryFieldNew"]];
  56. }
  57. if ($enterprise["enterpriseTag"]) {
  58. $info["enterpriseTagName"] = DictApi::selectByParentCode("enterprise_tag")[$enterprise["enterpriseTag"]];
  59. }
  60. if ($info["talent_arrange"]) {
  61. $info["talentArrangeName"] = DictApi::selectByParentCode("talent_arrange")[$info["talent_arrange"]];
  62. }
  63. if ($info["import_way"]) {
  64. $info["importWayName"] = DictApi::selectByParentCode("import_way")[$info["import_way"]];
  65. }
  66. if ($info["source"]) {
  67. $info["sourceName"] = DictApi::selectByParentCode("source")[$info["source"]];
  68. }
  69. if ($info["source_city"]) {
  70. $info["sourceCityName"] = Db::table("un_common_location")->where("code", "=", $info["source_city"])->findOrEmpty()["name"];
  71. }
  72. if ($info["source_county"]) {
  73. $info["sourceCountyName"] = Db::table("un_common_location")->where("code", "=", $info["source_county"])->findOrEmpty()["name"];
  74. }
  75. if ($info["highest_degree"]) {
  76. $info["highestDegreeName"] = DictApi::selectByParentCode("highest_degree")[$info["highest_degree"]];
  77. }
  78. if ($info["qz_talent_info"]) {
  79. $qz_talent_info = explode(";", $info["qz_talent_info"]);
  80. list($tmp1, $timeStart) = explode(":", $qz_talent_info[1]);
  81. list($tmp2, $timeEnd) = explode(":", $qz_talent_info[2]);
  82. if (strtotime($timeStart)) {
  83. $tmp_time = date("Y-m-d", strtotime($timeStart));
  84. $qz_talent_info[1] = implode(":", [$tmp1, $tmp_time]);
  85. if ($isAdmin) {
  86. $batch_info = NoticeModel::where('batch', $tmp_time)->find();
  87. if ($batch_info) {
  88. $qz_talent_info[1] = "<a target='_blank' href='/common/notice/view/id/" . $batch_info['id'] . "'>" . $qz_talent_info[1] . "</a>";
  89. }
  90. }
  91. }
  92. if (strtotime($timeEnd)) {
  93. $qz_talent_info[2] = implode(":", [$tmp2, date("Y-m-d", strtotime($timeEnd))]);
  94. }
  95. $info["qz_talent_info"] = implode(";", $qz_talent_info);
  96. }
  97. if ($info["fj_talent_info"]) {
  98. $fj_talent_info = explode(";", $info["fj_talent_info"]);
  99. list($tmp1, $timeStart) = explode(":", $fj_talent_info[0]);
  100. list($tmp2, $validYear) = explode(":", $fj_talent_info[2]);
  101. $timeStart = str_replace(["."], "-", $timeStart);
  102. if (strtotime($timeStart)) {
  103. $tmp_time = date("Y-m-d", strtotime($timeStart));
  104. $fj_talent_info[0] = implode(":", [$tmp1, $tmp_time]);
  105. if ($isAdmin) {
  106. $batch_info = NoticeModel::where('batch', $tmp_time)->find();
  107. if ($batch_info) {
  108. $fj_talent_info[0] = "<a target='_blank' href='/common/notice/view/id/" . $batch_info['id'] . "'>" . $fj_talent_info[0] . "</a>";
  109. }
  110. }
  111. if (strtotime($validYear)) {
  112. $fj_talent_info[2] = implode(":", [$tmp2, date("Y-m-d", strtotime($validYear))]);
  113. } else {
  114. $validval = intval($validYear);
  115. if ($validYear > 0) {
  116. $timestr = str_replace($validval, "", $validYear);
  117. switch ($timestr) {
  118. case "月":
  119. $timetype = "months";
  120. break;
  121. case "日":
  122. $timetype = "days";
  123. break;
  124. default:
  125. $timetype = "years";
  126. break;
  127. }
  128. $fj_talent_info[2] = implode(":", [$tmp2, date("Y-m-d", strtotime("+{$validval} {$timetype} -1 days", strtotime($timeStart)))]);
  129. }
  130. }
  131. }
  132. $info["fj_talent_info"] = implode(";", $fj_talent_info);
  133. }
  134. if ($info["talent_condition"]) {
  135. $talent_condition = \app\common\model\TalentCondition::findOrEmpty($info["talent_condition"]);
  136. $info["talentConditionName"] = $talent_condition["name"];
  137. $info["talent_arrange_category"] = $talent_condition["talentLevelCat"];
  138. $info["talentArrangeCatName"] = DictApi::selectByParentCode("talent_condition_cats")[$talent_condition["talentLevelCat"]];
  139. }
  140. }
  141. return $info;
  142. }
  143. public static function getOne($id) {
  144. return Talent::findOrEmpty($id);
  145. }
  146. public static function getFullDeptList($params, $where = []) {
  147. $order = $params["order"] ?: "desc";
  148. $offset = $params["offset"] ?: 0;
  149. $limit = $params["limit"] ?: 10;
  150. $whereRaw = "";
  151. if ($params["company_id"]) {
  152. $where[] = ["tc.companyIds", "like", "%" . $params["company_id"] . "%"];
  153. }
  154. switch ($params["checkState"]) {
  155. case 1:
  156. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  157. $where[] = ["ti.pass_dept_check", "=", 0];
  158. break;
  159. case 2:
  160. $where[] = ["tl.state", "=", TalentState::DEPT_VERIFY_REJECT];
  161. break;
  162. case 3:
  163. $where[] = ["tl.state", "=", TalentState::DEPT_VERIFY_PASS];
  164. break;
  165. default:
  166. $whereRaw = sprintf("(tl.state=%d and ti.pass_dept_check=0) or (tl.state=%d) or (tl.state=%d)", TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS, TalentState::DEPT_VERIFY_REJECT);
  167. break;
  168. }
  169. $companyId = session("user")["companyId"];
  170. $talent_arrange_kvs = DictApi::selectByParentCode("talent_arrange");
  171. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  172. $count = Talent::alias("ti")
  173. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  174. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  175. ->leftJoin("(select mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
  176. ->where($where)
  177. ->where($whereRaw)->count();
  178. $list = Talent::alias("ti")
  179. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  180. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  181. ->leftJoin("(select mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
  182. ->where($where)
  183. ->where($whereRaw)
  184. ->field("ti.*,tl.last_state as 'lastState',tl.state as 'realState',e.name as enterprise_name,e.type as enterprise_type,enterpriseTag,tc.name as talentConditionName,tc.companyIds")
  185. ->limit($offset, $limit)->order("ti.createTime " . $order)
  186. ->select()->toArray();
  187. foreach ($list as &$item) {
  188. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江市现代产业体系人才" : "集成电路优秀人才";
  189. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  190. $item["talentArrangeName"] = $talent_arrange_kvs[$item["talent_arrange"]];
  191. $companys = array_filter(explode(",", $item["companyIds"]));
  192. $verifyDepts = [];
  193. foreach ($companys as $k => $companyId) {
  194. $company = getCacheById("Company", $companyId);
  195. $log = TalentLogApi::getCompanyNewestCheckedLog($item["id"], $companyId);
  196. $verifyDepts[$k]["id"] = $companyId;
  197. $verifyDepts[$k]["shortName"] = $company["shortName"];
  198. $verifyDepts[$k]["name"] = $company["name"];
  199. $verifyDepts[$k]["code"] = $company["code"];
  200. $verifyDepts[$k]["checkState"] = $log["new_state"];
  201. $verifyDepts[$k]["active"] = $log["active"];
  202. }
  203. $item["verifyDepts"] = $verifyDepts;
  204. }unset($item);
  205. return ["total" => $count, "rows" => $list];
  206. }
  207. public static function getDeptList($params, $where = []) {
  208. $order = $params["order"] ?: "desc";
  209. $offset = $params["offset"] ?: 0;
  210. $limit = $params["limit"] ?: 10;
  211. $companyId = session("user")["companyId"];
  212. switch ($params["checkState"]) {
  213. case 1:
  214. //待审核
  215. $where[] = ["tl.active", "=", 0];
  216. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  217. break;
  218. case 2:
  219. //已驳回
  220. $where[] = ["tl.active", "=", 1];
  221. $where[] = ["tl.new_state", "=", TalentState::SCND_SUBMIT];
  222. break;
  223. case 3:
  224. //已通过
  225. $where[] = ["tl.active", "=", 1];
  226. $where[] = ["tl.new_state", "=", TalentState::DEPT_VERIFY_PASS];
  227. break;
  228. default:
  229. $where = sprintf("(tl.active=0 and tl.state=%d) or (tl.active=1 and (tl.new_state in (%d,%d)))", TalentState::FST_VERIFY_PASS, TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_PASS);
  230. break;
  231. }
  232. $talent_arrange_kvs = DictApi::selectByParentCode("talent_arrange");
  233. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  234. $count = Talent::alias("ti")
  235. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  236. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  237. ->leftJoin("(select mainId,active,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,companyId,mainId,`type`)) in (select md5(concat(max(createTime),companyId,mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step`=3 and companyId='{$companyId}' and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
  238. ->where($where)
  239. ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])->count();
  240. $list = Talent::alias("ti")
  241. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  242. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  243. ->leftJoin("(select mainId,active,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,companyId,mainId,`type`)) in (select md5(concat(max(createTime),companyId,mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step`=3 and companyId='{$companyId}' and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
  244. ->where($where)
  245. ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])
  246. ->field("ti.*,tl.last_state as 'lastState',tl.state as 'realState',e.name as enterprise_name,e.type as enterprise_type,enterpriseTag,tc.name as talentConditionName")
  247. ->limit($offset, $limit)->order("ti.createTime " . $order)
  248. ->select()->toArray();
  249. foreach ($list as &$item) {
  250. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江市现代产业体系人才" : "集成电路优秀人才";
  251. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  252. $lastCheckLog = TalentLogApi::getCompanyNewestCheckedLog($item["id"], $companyId);
  253. $item["deptCheckState"] = $lastCheckLog["new_state"];
  254. $item["talentArrangeName"] = $talent_arrange_kvs[$item["talent_arrange"]];
  255. }unset($item);
  256. return ["total" => $count, "rows" => $list];
  257. }
  258. public static function getPublicList($params) {
  259. $order = $params["order"];
  260. $offset = $params["offset"];
  261. $limit = $params["limit"];
  262. $where = [];
  263. $where[] = ["e.type", "=", session("user")["type"]];
  264. if ($params["name"]) {
  265. $where[] = ["ti.name", "like", "%" . $params["name"] . "%"];
  266. }
  267. if ($params["sex"]) {
  268. $where[] = ["ti.sex", "=", $params["sex"]];
  269. }
  270. if ($params["checkState"]) {
  271. $where[] = ["ti.checkState", "=", $params["checkState"]];
  272. }
  273. $type = $params["type"];
  274. switch ($type) {
  275. case 1:
  276. case 2:
  277. $where[] = ["ti.checkState", "=", TalentState::REVERIFY_PASS];
  278. break;
  279. case 3: //公示
  280. case 7: //公示预览
  281. $where[] = ["ti.checkState", "=", TalentState::ZX_PASS];
  282. break;
  283. case 4: //公示通过
  284. $where[] = ["ti.checkState", "=", TalentState::ANNOUNCED];
  285. break;
  286. case 5:
  287. case 8: //公布预览
  288. $where[] = ["ti.checkState", "=", TalentState::ANNOUNCED_REVERIFY_PASS];
  289. break;
  290. case 6:
  291. $where[] = ["ti.checkState", "=", TalentState::PUBLISH_PASS];
  292. break;
  293. }
  294. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  295. $count = Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->where($where)->count();
  296. $list = Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  297. ->where($where)
  298. ->limit($offset, $limit)
  299. ->order("ti.createTime " . $order)->field("ti.*,e.name as enterpriseName,e.type as enterprise_type,enterpriseTag")->select()->toArray();
  300. foreach ($list as &$item) {
  301. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江市现代产业体系人才" : "集成电路优秀人才";
  302. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  303. }unset($item);
  304. return ["total" => $count, "rows" => $list];
  305. }
  306. public static function getListByIds($ids) {
  307. $where[] = ["id", "in", $ids];
  308. return Talent::where($where)->select()->toArray();
  309. }
  310. public static function getList($params) {
  311. $where = [];
  312. $order = $params["order"] ?: "desc";
  313. $offset = $params["offset"] ?: 0;
  314. $limit = $params["limit"] ?: 10;
  315. $where[] = ["e.type", "=", session("user")["type"]];
  316. if ($params["name"]) {
  317. $where[] = ["ti.name", "like", "%{$params["name"]}%"];
  318. }
  319. if ($params["card_number"]) {
  320. $where[] = ["ti.card_number", "like", "%" . $params["card_number"] . "%"];
  321. }
  322. if ($params["sex"]) {
  323. $where[] = ["ti.sex", "=", $params["sex"]];
  324. }
  325. if ($params["nation"]) {
  326. $where[] = ["ti.nation", "=", $params["nation"]];
  327. }
  328. if ($params["apply_year"]) {
  329. $where[] = ["ti.apply_year", "like", "{$params["apply_year"]}%"];
  330. }
  331. if ($params["phone"]) {
  332. $where[] = ["ti.phone", "like", "%{$params["phone"]}%"];
  333. }
  334. if ($params["email"]) {
  335. $where[] = ["ti.email", "like", "%{$params["email"]}%"];
  336. }
  337. if ($params["nationality"]) {
  338. $where[] = ["ti.nationality", "=", $params["nationality"]];
  339. }
  340. if ($params["province"]) {
  341. $where[] = ["ti.province", "=", $params["province"]];
  342. }
  343. if ($params["politics"]) {
  344. $where[] = ["ti.politics", "=", $params["politics"]];
  345. }
  346. if ($params["enterprise_id"]) {
  347. $where[] = ["ti.enterprise_id", "=", $params["enterprise_id"]];
  348. }
  349. if ($params["street"]) {
  350. $where[] = ["e.street", "=", $params["street"]];
  351. }
  352. if ($params["industry_field"]) {
  353. $where[] = ["e.industryFieldNew", "=", $params["industry_field"]];
  354. }
  355. if ($params["industry_field_old"]) {
  356. $where[] = ["e.industryFieldOld", "=", $params["industry_field_old"]];
  357. }
  358. if ($params["enterprise_tag"]) {
  359. $where[] = ["e.enterpriseTag", "=", $params["enterprise_tag"]];
  360. }
  361. if ($params["talent_type"]) {
  362. $where[] = ["ti.talent_type", "=", $params["talent_type"]];
  363. }
  364. if ($params["import_way"]) {
  365. $where[] = ["ti.import_way", "=", $params["import_way"]];
  366. }
  367. if ($params["highest_degree"]) {
  368. $where[] = ["ti.highest_degree", "=", $params["highest_degree"]];
  369. }
  370. if ($params["study_abroad"]) {
  371. $where[] = ["ti.study_abroad", "=", $params["study_abroad"]];
  372. }
  373. if ($params["source"]) {
  374. $where[] = ["ti.source", "=", $params["source"]];
  375. }
  376. if ($params["talent_arrange"]) {
  377. $where[] = ["ti.talent_arrange", "=", $params["talent_arrange"]];
  378. }
  379. if ($params["talent_condition"]) {
  380. $where[] = ["ti.talent_condition", "=", $params["talent_condition"]];
  381. }
  382. if ($params["isMatchZhiren"]) {
  383. $where[] = ["ti.isMatchZhiren", "=", $params["isMatchZhiren"]];
  384. }
  385. $process = $params["process"];
  386. if ($process == 4) {
  387. $companyId = session('user')['companyId'];
  388. $company_info = CompanyApi::getOne($companyId);
  389. if ($company_info["code"] == "super" || $company_info["code"] == "rsj") {
  390. return self::getFullDeptList($params, $where);
  391. } else {
  392. return self::getDeptList($params, $where);
  393. }
  394. }
  395. if ($process == 5) {
  396. $whereRaw = sprintf("(tl.state in (14,15,16)) or (tl.state=12 and ti.pass_dept_check=0) or (tl.state=10 and ti.pass_dept_check=1) or (tl.state=10 and (tc.companyIds is null or tc.companyIds = ''))");
  397. switch ($params["checkState"]) {
  398. case 1:
  399. $where[] = ["tl.state", "in", [TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS]];
  400. break;
  401. case -1:
  402. $where[] = ["tl.state", "=", TalentState::REVERIFY_FAIL];
  403. break;
  404. }
  405. $count = Talent::alias("ti")
  406. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  407. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  408. ->leftJoin("(select mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
  409. //->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)")
  410. ->whereRaw($whereRaw)->where($where)->count();
  411. $list = Talent::alias("ti")
  412. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  413. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  414. ->leftJoin("(select mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
  415. //->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)")
  416. ->whereRaw($whereRaw)
  417. ->where($where)
  418. ->limit($offset, $limit)
  419. ->order("ti.createTime " . $order)
  420. ->field("ti.*,tl.last_state as 'lastState',tl.state as 'realState',e.name as enterprise_name,e.type as enterprise_type,enterpriseTag")
  421. ->select()->toArray();
  422. } else {
  423. switch ($process) {
  424. case 1:
  425. $where[] = ["ti.checkState", "in", [TalentState::FST_SUBMIT, TalentState::BASE_VERIFY_FAIL]];
  426. break;
  427. case 2:
  428. $where[] = ["ti.checkState", "in", [TalentState::BASE_VERIFY_PASS, TalentState::BASE_REVERIFY_FAIL]];
  429. break;
  430. case 3:
  431. switch ($params["checkState"]) {
  432. case -1://保存未提交
  433. $where[] = ["tl.new_state", "=", TalentState::SCND_SAVE];
  434. $where[] = ["tl.state", "<>", TalentState::FST_VERIFY_REJECT];
  435. //$where[] = ["ti.first_submit_time", "exp", Db::raw("is null")];
  436. $where[] = ["ti.delete", "=", 0];
  437. break;
  438. case 1://待审核
  439. $where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT];
  440. //$where[] = ["tl.state", "in", [TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT]];
  441. $where[] = ["tl.last_state", "<>", TalentState::FST_VERIFY_REJECT];
  442. break;
  443. case 2://驳回
  444. //$where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT];
  445. $where[] = ["tl.new_state", "=", TalentState::SCND_SAVE];
  446. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_REJECT];
  447. break;
  448. case 3://通过
  449. //$where[] = ["tl.state", "in", [TalentState::FST_VERIFY_PASS]];
  450. $whereRaw = sprintf("tl.state=%d or tl.state>%d", TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_REJECT);
  451. break;
  452. case 4://失败
  453. $where[] = ["tl.state", "in", [TalentState::FST_VERIFY_FAIL]];
  454. break;
  455. case 5://重新提交
  456. $where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT];
  457. $where[] = ["tl.last_state", "=", TalentState::FST_VERIFY_REJECT];
  458. break;
  459. default:
  460. //$where[] = ["tl.state", "in", [TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT, TalentState::FST_VERIFY_REJECT]];
  461. $whereRaw = sprintf("((tl.new_state=%d and ti.`delete`=0) or tl.new_state=%d or tl.state in (%d,%d) or tl.state>%d)", TalentState::SCND_SAVE, TalentState::SCND_SUBMIT, TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_FAIL, TalentState::FST_VERIFY_REJECT);
  462. }
  463. break;
  464. case 6:
  465. $where[] = ["tl.state", ">=", TalentState::REVERIFY_PASS];
  466. if ($params["checkState"]) {
  467. $where[] = ["tl.state", "=", $params["checkState"]];
  468. }
  469. break;
  470. case 7:
  471. $where[] = ["tl.state", "=", TalentState::CERTIFICATED];
  472. break;
  473. }
  474. $count = Talent::alias("ti")
  475. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  476. ->leftJoin("(select mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
  477. //->leftJoin("(select mainId,last_state,new_state,state,createTime,row_number() over (partition by mainId order by createTime desc) as rowIndex from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null) tl", "tl.mainId=ti.id and tl.rowIndex=1")
  478. ->where($where)->where($whereRaw)->count();
  479. $list = Talent::alias("ti")
  480. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  481. ->leftJoin("(select mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
  482. //->leftJoin("(select mainId,last_state,new_state,state,createTime,row_number() over (partition by mainId order by createTime desc) as rowIndex from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null) tl", "tl.mainId=ti.id and tl.rowIndex=1")
  483. ->where($where)->where($whereRaw)->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();
  484. }
  485. $talent_arrange_kvs = DictApi::selectByParentCode("talent_arrange");
  486. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  487. foreach ($list as &$item) {
  488. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江市现代产业体系人才" : "集成电路优秀人才";
  489. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  490. $item["talentArrangeName"] = $talent_arrange_kvs[$item["talent_arrange"]];
  491. $item["talentConditionName"] = TalentCondition::findOrEmpty($item["talent_condition"])["name"];
  492. //$last_log = TalentLogApi::getLastLog($item["id"], 1, 0, ["step", "=", null]);
  493. //$item["lastState"] = $last_log["last_state"];
  494. //$item["realState"] = $last_log["state"];
  495. }unset($item);
  496. return ["total" => $count, "rows" => $list];
  497. }
  498. public static function getExportDatas($process, $params) {
  499. $where[] = [];
  500. //特殊字段处理
  501. $exportFields = $params["export"];
  502. $fields = [];
  503. foreach ($exportFields as $field) {
  504. if (!in_array($field, ["industryFieldNew", "enterpriseName", "enterpriseTag", "street", "talent_arrange_category", "checkMsg"])) {
  505. $fields[] = "ti." . $field;
  506. }
  507. }
  508. $fields[] = "e.name as enterpriseName";
  509. $fields[] = "e.industryFieldNew";
  510. $fields[] = "e.enterpriseTag";
  511. $fields[] = "e.street";
  512. $fields[] = "tc.talentLevelCat";
  513. $fields[] = "tl.description as checkMsg";
  514. $fields[] = "tc.name as talentConditionName";
  515. $fields[] = "tl.description as checkMsg";
  516. if (in_array("card_type", $exportFields)) {
  517. $cardTypes = DictApi::selectByParentCode("card_type");
  518. }
  519. if (in_array("industryFieldNew", $exportFields)) {
  520. $industry_fields = DictApi::selectByParentCode("industry_field");
  521. }
  522. if (in_array("enterpriseTag", $exportFields)) {
  523. $enterpriseTags = DictApi::selectByParentCode("enterprise_tag");
  524. }
  525. if (in_array("street", $exportFields)) {
  526. $streets = DictApi::selectByParentCode("street");
  527. }
  528. if (in_array("nation", $exportFields)) {
  529. $nations = DictApi::selectByParentCode("nation");
  530. }
  531. if (in_array("nationality", $exportFields)) {
  532. $nationalitys = DictApi::selectByParentCode("nationality");
  533. }
  534. if (in_array("politics", $exportFields)) {
  535. $politics = DictApi::selectByParentCode("politics");
  536. }
  537. if (in_array("talent_type", $exportFields)) {
  538. $talentTypes = DictApi::selectByParentCode("talent_type");
  539. }
  540. if (in_array("talent_arrange_category", $exportFields)) {
  541. $talentArrangeCategories = DictApi::selectByParentCode("talent_condition_cats");
  542. }
  543. if (in_array("highest_degree", $exportFields)) {
  544. $highest_degree = DictApi::selectByParentCode("highest_degree");
  545. }
  546. if (in_array("import_way", $exportFields)) {
  547. $import_way = DictApi::selectByParentCode("import_way");
  548. }
  549. if (in_array("source", $exportFields)) {
  550. $source = DictApi::selectByParentCode("source");
  551. }
  552. if (in_array("source_city", $exportFields)) {
  553. $source_city = DictApi::selectByParentCode("source_city");
  554. }
  555. if (in_array("source_county", $exportFields)) {
  556. $source_county = DictApi::selectByParentCode("source_county");
  557. }
  558. if (in_array("talent_arrange", $exportFields)) {
  559. $talent_arrange = DictApi::selectByParentCode("talent_arrange");
  560. }
  561. $sex = [1 => "男", 2 => "女"];
  562. $pre_import_type = [1 => "意向合同", 2 => "创业企业名称预核准"];
  563. $study_abroad = [1 => "是", 2 => "否"];
  564. $salary_pay_way = [1 => "本单位", 2 => "本单位所属集团公司及权属公司"];
  565. $return = [1 => "是", 2 => "否"];
  566. $isMatchZhiren = [0 => "否", 1 => "是"];
  567. $where = [];
  568. $where[] = ["e.type", "=", session("user")["type"]];
  569. if ($params["all"] != 1) {
  570. if ($params["name"]) {
  571. $where[] = ["ti.name", "like", "%{$params["name"]}%"];
  572. }
  573. if ($params["card_number"]) {
  574. $where[] = ["ti.card_number", "like", "%" . $params["card_number"] . "%"];
  575. }
  576. if ($params["sex"]) {
  577. $where[] = ["ti.sex", "=", $params["sex"]];
  578. }
  579. if ($params["nation"]) {
  580. $where[] = ["ti.nation", "=", $params["nation"]];
  581. }
  582. if ($params["apply_year"]) {
  583. $where[] = ["ti.apply_year", "like", "{$params["apply_year"]}%"];
  584. }
  585. if ($params["phone"]) {
  586. $where[] = ["ti.phone", "like", "%{$params["phone"]}%"];
  587. }
  588. if ($params["email"]) {
  589. $where[] = ["ti.email", "like", "%{$params["email"]}%"];
  590. }
  591. if ($params["nationality"]) {
  592. $where[] = ["ti.nationality", "=", $params["nationality"]];
  593. }
  594. if ($params["province"]) {
  595. $where[] = ["ti.province", "=", $params["province"]];
  596. }
  597. if ($params["politics"]) {
  598. $where[] = ["ti.politics", "=", $params["politics"]];
  599. }
  600. if ($params["enterprise_id"]) {
  601. $where[] = ["ti.enterprise_id", "=", $params["enterprise_id"]];
  602. }
  603. if ($params["street"]) {
  604. $where[] = ["e.street", "=", $params["street"]];
  605. }
  606. if ($params["industry_field"]) {
  607. $where[] = ["e.industryFieldNew", "=", $params["industry_field"]];
  608. }
  609. if ($params["industry_field_old"]) {
  610. $where[] = ["e.industryFieldOld", "=", $params["industry_field_old"]];
  611. }
  612. if ($params["enterprise_tag"]) {
  613. $where[] = ["e.enterpriseTag", "=", $params["enterprise_tag"]];
  614. }
  615. if ($params["talent_type"]) {
  616. $where[] = ["ti.talent_type", "=", $params["talent_type"]];
  617. }
  618. if ($params["import_way"]) {
  619. $where[] = ["ti.import_way", "=", $params["import_way"]];
  620. }
  621. if ($params["highest_degree"]) {
  622. $where[] = ["ti.highest_degree", "=", $params["highest_degree"]];
  623. }
  624. if ($params["study_abroad"]) {
  625. $where[] = ["ti.study_abroad", "=", $params["study_abroad"]];
  626. }
  627. if ($params["source"]) {
  628. $where[] = ["ti.source", "=", $params["source"]];
  629. }
  630. if ($params["talent_arrange"]) {
  631. $where[] = ["ti.talent_arrange", "=", $params["talent_arrange"]];
  632. }
  633. if ($params["talent_condition"]) {
  634. $where[] = ["ti.talent_condition", "=", $params["talent_condition"]];
  635. }
  636. if ($params["isMatchZhiren"]) {
  637. $where[] = ["ti.isMatchZhiren", "=", $params["isMatchZhiren"]];
  638. }
  639. switch ($process) {
  640. case 1:
  641. $where[] = ["ti.checkState", "in", [TalentState::FST_SUBMIT, TalentState::BASE_VERIFY_FAIL]];
  642. break;
  643. case 2:
  644. $where[] = ["ti.checkState", "in", [TalentState::BASE_VERIFY_PASS, TalentState::BASE_REVERIFY_FAIL]];
  645. break;
  646. case 3:
  647. switch ($params["checkState"]) {
  648. case -1://保存未提交
  649. $where[] = ["tl.new_state", "=", TalentState::SCND_SAVE];
  650. $where[] = ["tl.state", "<>", TalentState::FST_VERIFY_REJECT];
  651. //$where[] = ["ti.first_submit_time", "exp", Db::raw("is null")];
  652. $where[] = ["ti.delete", "=", 0];
  653. break;
  654. case 1://待审核
  655. $where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT];
  656. //$where[] = ["tl.state", "in", [TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT]];
  657. $where[] = ["tl.last_state", "<>", TalentState::FST_VERIFY_REJECT];
  658. break;
  659. case 2://驳回
  660. //$where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT];
  661. $where[] = ["tl.new_state", "=", TalentState::SCND_SAVE];
  662. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_REJECT];
  663. break;
  664. case 3://通过
  665. //$where[] = ["tl.state", "in", [TalentState::FST_VERIFY_PASS]];
  666. $whereRaw = sprintf("tl.state=%d or tl.state>%d", TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_REJECT);
  667. break;
  668. case 4://失败
  669. $where[] = ["tl.state", "in", [TalentState::FST_VERIFY_FAIL]];
  670. break;
  671. case 5://重新提交
  672. $where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT];
  673. $where[] = ["tl.last_state", "=", TalentState::FST_VERIFY_REJECT];
  674. break;
  675. default:
  676. //$where[] = ["tl.state", "in", [TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT, TalentState::FST_VERIFY_REJECT]];
  677. $whereRaw = sprintf("((tl.new_state=%d and ti.`delete`=0) or tl.new_state=%d or tl.state in (%d,%d) or tl.state>%d)", TalentState::SCND_SAVE, TalentState::SCND_SUBMIT, TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_FAIL, TalentState::FST_VERIFY_REJECT);
  678. }
  679. break;
  680. case 4:
  681. $companyId = session('user')['companyId'];
  682. $company_info = CompanyApi::getOne($companyId);
  683. if ($company_info["code"] == "super" || $company_info["code"] == "rsj") {
  684. switch ($params["checkState"]) {
  685. case 1:
  686. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  687. $where[] = ["ti.pass_dept_check", "=", 0];
  688. break;
  689. case 2:
  690. $where[] = ["tl.state", "=", TalentState::DEPT_VERIFY_REJECT];
  691. break;
  692. case 3:
  693. $where[] = ["tl.state", "=", TalentState::DEPT_VERIFY_PASS];
  694. break;
  695. default:
  696. $whereRaw = sprintf("(tl.state=%d and ti.pass_dept_check=0) or (tl.state=%d) or (tl.state=%d)", TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS, TalentState::DEPT_VERIFY_REJECT);
  697. break;
  698. }
  699. } else {
  700. switch ($params["checkState"]) {
  701. case 1:
  702. //待审核
  703. $where[] = ["tl.active", "=", 0];
  704. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  705. break;
  706. case 2:
  707. //已驳回
  708. $where[] = ["tl.active", "=", 1];
  709. $where[] = ["tl.new_state", "=", TalentState::SCND_SUBMIT];
  710. break;
  711. case 3:
  712. //已通过
  713. $where[] = ["tl.active", "=", 1];
  714. $where[] = ["tl.new_state", "=", TalentState::DEPT_VERIFY_PASS];
  715. break;
  716. default:
  717. $where = sprintf("(tl.active=0 and tl.state=%d) or (tl.active=1 and (tl.new_state in (%d,%d)))", TalentState::FST_VERIFY_PASS, TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_PASS);
  718. break;
  719. }
  720. }
  721. break;
  722. case 5:
  723. $whereRaw = sprintf("(tl.state in (14,15,16)) or (tl.state=12 and ti.pass_dept_check=0) or (tl.state=10 and ti.pass_dept_check=1) or (tl.state=10 and (tc.companyIds is null or tc.companyIds = ''))");
  724. switch ($params["checkState"]) {
  725. case 1:
  726. $where[] = ["tl.state", "in", [TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS]];
  727. break;
  728. case -1:
  729. $where[] = ["tl.state", "=", TalentState::REVERIFY_FAIL];
  730. break;
  731. }
  732. break;
  733. case 6:
  734. $where[] = ["tl.state", ">=", TalentState::REVERIFY_PASS];
  735. if ($params["checkState"]) {
  736. $where[] = ["tl.state", "=", $params["checkState"]];
  737. }
  738. break;
  739. case 7:
  740. $where[] = ["tl.state", "=", TalentState::CERTIFICATED];
  741. break;
  742. }
  743. } else {
  744. $whereRaw = "tl.state is not null";
  745. $where[] = ["ti.delete", "=", 0];
  746. }
  747. $fields[] = "ti.pass_dept_check";
  748. $fields[] = "tl.state";
  749. $fields[] = "tl.new_state";
  750. $fields[] = "tl.last_state";
  751. $fields[] = "tc.companyIds";
  752. if ($process == 4) {
  753. if ($company_info["code"] == "super" || $company_info["code"] == "rsj") {
  754. $list = Talent::alias("ti")
  755. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  756. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  757. ->leftJoin("(select mainId,description,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
  758. ->where($where)
  759. ->where($whereRaw)
  760. ->field($fields)
  761. ->select()->toArray();
  762. } else {
  763. $fields[] = "tl.active";
  764. $fields[] = "tl.new_state as deptCheckState";
  765. $list = Talent::alias("ti")
  766. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  767. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  768. ->leftJoin("(select mainId,active,description,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,companyId,mainId,`type`)) in (select md5(concat(max(createTime),companyId,mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step`=3 and companyId='{$companyId}' and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
  769. ->where($where)
  770. ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])
  771. ->field($fields)
  772. ->select()->toArray();
  773. }
  774. } else if ($process == 5) {
  775. $list = Talent::alias("ti")
  776. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  777. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  778. ->leftJoin("(select description,mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
  779. //->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)")
  780. ->whereRaw($whereRaw)
  781. ->where($where)
  782. ->field($fields)
  783. ->select()->toArray();
  784. } else {
  785. $list = Talent::alias("ti")
  786. ->field($fields)
  787. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  788. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  789. ->leftJoin("(select description,mainId,last_state,new_state,state,createTime from new_talent_checklog where md5(concat(createTime,mainId,`type`)) in (select md5(concat(max(createTime),mainId,`type`)) from `new_talent_checklog` where `type`=1 and `step` is null and active=1 and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
  790. //->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)")
  791. ->where($where)
  792. ->where($whereRaw)
  793. ->select()->toArray();
  794. }
  795. $un_common_location = Db::table("un_common_location")->column('name', 'code');
  796. foreach ($list as &$item) {
  797. $item["card_type"] = $cardTypes[$item["card_type"]];
  798. $item["industryFieldNew"] = $industry_fields[$item["industryFieldNew"]];
  799. $item["enterpriseTag"] = $enterpriseTags[$item["enterpriseTag"]];
  800. $item["street"] = $streets[$item["street"]];
  801. $item["nation"] = $nations[$item["nation"]];
  802. $item["nationality"] = $nationalitys[$item["nationality"]];
  803. $item["politics"] = $politics[$item["politics"]];
  804. $item["talent_type"] = $talentTypes[$item["talent_type"]];
  805. $item["talent_arrange_category"] = $talentArrangeCategories[$item["talentLevelCat"]];
  806. $item["sex"] = $sex[$item["sex"]];
  807. $item["highest_degree"] = $highest_degree[$item["highest_degree"]];
  808. $item["import_way"] = $import_way[$item["import_way"]];
  809. $item["salary_pay_way"] = $salary_pay_way[$item["salary_pay_way"]];
  810. $item["pre_import_type"] = $pre_import_type[$item["pre_import_type"]];
  811. $item["return"] = $return[$item["return"]];
  812. $item["isMatchZhiren"] = $isMatchZhiren[$item["isMatchZhiren"]];
  813. $item["study_abroad"] = $study_abroad[$item["study_abroad"]];
  814. $item["source"] = $source[$item["source"]];
  815. $item["talent_arrange"] = $talent_arrange[$item["talent_arrange"]];
  816. $item["talent_condition"] = $item["talentConditionName"];
  817. if (in_array("source_city", $exportFields)) {
  818. $item["source_city"] = $un_common_location[$item["source_city"]];
  819. }
  820. if (in_array("source_county", $exportFields)) {
  821. $item["source_county"] = $un_common_location[$item["source_county"]];
  822. }
  823. if (in_array("province", $exportFields)) {
  824. $item["province"] = $un_common_location[$item["province"]];
  825. }
  826. if (in_array("city", $exportFields)) {
  827. $item["city"] = $un_common_location[$item["city"]];
  828. }
  829. if (in_array("county", $exportFields)) {
  830. $item["county"] = $un_common_location[$item["county"]];
  831. }
  832. if ($item["state"] == TalentState::SCND_SUBMIT) {
  833. if ($item["last_state"] == TalentState::FST_VERIFY_REJECT) {
  834. $item["checkState"] = "待初审(重新提交)";
  835. } else {
  836. $item["checkState"] = "待初审(首次提交)";
  837. }
  838. } else if ($item["state"] == TalentState::FST_VERIFY_PASS) {
  839. if ($item["deptCheckState"]) {
  840. if ($item["acitve"] == 0 && $item["state"] == TalentState::FST_VERIFY_PASS) {
  841. $item["checkState"] = "待部门审核";
  842. }
  843. if ($item["active"] == 1 && $item["new_state"] == TalentState::DEPT_VERIFY_PASS) {
  844. $item["checkState"] = "部门审核通过";
  845. }
  846. if ($item["active"] == 1 && $item["new_state"] == TalentState::SCND_SUBMIT) {
  847. $item["checkState"] = "部门审核驳回";
  848. }
  849. } else {
  850. if (!$item["companyIds"] || $item["pass_dept_check"] == 1) {
  851. $item["checkState"] = "待复核(初审通过)";
  852. }
  853. if ($item["pass_dept_check"] == 0) {
  854. $item["checkState"] = "待部门并审";
  855. }
  856. }
  857. } else if ($item["state"] == TalentState::DEPT_VERIFY_REJECT) {
  858. $item["checkState"] = "待初审(部门并审驳回)";
  859. } else if ($item["state"] == TalentState::DEPT_VERIFY_PASS) {
  860. $item["checkState"] = "待复核(部门并审通过)";
  861. } else {
  862. $item["checkState"] = TalentState::getStateName($item["state"]);
  863. }
  864. }unset($item);
  865. return $list;
  866. }
  867. public static function getListByProcess($process) {
  868. switch ($process) {
  869. case 1:
  870. $where[] = ["ti.checkState", "in", [TalentState::FST_SUBMIT, TalentState::BASE_VERIFY_FAIL]];
  871. break;
  872. case 2:
  873. $where[] = ["ti.checkState", "in", [TalentState::BASE_VERIFY_PASS, TalentState::BASE_REVERIFY_FAIL]];
  874. break;
  875. case 3:
  876. $where[] = ["ti.checkState", "in", [TalentState::SCND_SUBMIT, TalentState::FST_VERIFY_FAIL]];
  877. break;
  878. default:
  879. return null;
  880. }
  881. return Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->where($where)->field("ti.*,e.agentName,e.agentPhone")->select()->toArray();
  882. }
  883. public static function setPublic($mainId, $state, $msg, $batch = null, $type = 1) {
  884. $data["id"] = $mainId;
  885. $data["checkState"] = $state;
  886. switch ($state) {
  887. case TalentState::ZX_PASS:
  888. case TalentState::ZX_FAIL:
  889. $data["isPublic"] = 2;
  890. break;
  891. case TalentState::ANNOUNCED:
  892. $data["isPublic"] = 3;
  893. $data["publicBatch"] = $batch;
  894. break;
  895. case TalentState::ANNOUNCED_REVERIFY_PASS:
  896. case TalentState::ANNOUNCED_REVERIFY_FAIL:
  897. $data["isPublic"] = 3;
  898. break;
  899. case TalentState::PUBLISH_PASS:
  900. $data["isPublic"] = 4;
  901. $data["identifyMonth"] = $batch;
  902. $data["certificateGetTime"] = $batch; //时间待定
  903. $data["certificateExpireTime"] = date("Y-m-d", strtotime(sprintf("%s +6 years -1 days", $batch))); //时间待定
  904. break;
  905. case TalentState::PUBLISH_FAIL:
  906. $data["isPublic"] = 4;
  907. break;
  908. }
  909. if (Talent::update($data)) {
  910. TalentLogApi::write($type, $mainId, $state, $msg, 1);
  911. return true;
  912. }
  913. return false;
  914. }
  915. }