VerifyApi.php 71 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225
  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. $info["isGeneral"] = $enterprise["isGeneral"];
  51. $info["medicalCommunityName"] = \app\common\api\Nhc::getMedicalCommunityMap()[$enterprise["medicalCommunityId"]];
  52. if ($enterprise["street"]) {
  53. $info["street"] = $enterprise["street"];
  54. $info["streetName"] = DictApi::selectByParentCode("street")[$enterprise["street"]];
  55. }
  56. if ($enterprise["industryFieldNew"]) {
  57. $info["industryFieldName"] = DictApi::selectByParentCode("industry_field")[$enterprise["industryFieldNew"]];
  58. }
  59. if ($enterprise["enterpriseTag"]) {
  60. $info["enterpriseTagName"] = DictApi::selectByParentCode("enterprise_tag")[$enterprise["enterpriseTag"]];
  61. }
  62. if ($info["talent_arrange"]) {
  63. $info["talentArrangeName"] = DictApi::selectByParentCode("talent_arrange")[$info["talent_arrange"]];
  64. }
  65. if ($info["import_way"]) {
  66. $info["importWayName"] = DictApi::selectByParentCode("import_way")[$info["import_way"]];
  67. }
  68. if ($info["source"]) {
  69. $info["sourceName"] = DictApi::selectByParentCode("source")[$info["source"]];
  70. }
  71. if ($info["source_city"]) {
  72. $info["sourceCityName"] = Db::table("un_common_location")->where("code", "=", $info["source_city"])->findOrEmpty()["name"];
  73. }
  74. if ($info["source_county"]) {
  75. $info["sourceCountyName"] = Db::table("un_common_location")->where("code", "=", $info["source_county"])->findOrEmpty()["name"];
  76. }
  77. if ($info["highest_degree"]) {
  78. $info["highestDegreeName"] = DictApi::selectByParentCode("highest_degree")[$info["highest_degree"]];
  79. }
  80. if ($info["qz_talent_info"]) {
  81. $qz_talent_info = explode(";", $info["qz_talent_info"]);
  82. list($tmp1, $timeStart) = explode(":", $qz_talent_info[1]);
  83. list($tmp2, $timeEnd) = explode(":", $qz_talent_info[2]);
  84. if (strtotime($timeStart)) {
  85. $tmp_time = date("Y-m-d", strtotime($timeStart));
  86. $qz_talent_info[1] = implode(":", [$tmp1, $tmp_time]);
  87. if ($isAdmin) {
  88. $batch_info = NoticeModel::where('batch', $tmp_time)->find();
  89. if ($batch_info) {
  90. $qz_talent_info[1] = "<a target='_blank' href='/common/notice/view/id/" . $batch_info['id'] . "'>" . $qz_talent_info[1] . "</a>";
  91. }
  92. }
  93. }
  94. if (strtotime($timeEnd)) {
  95. $qz_talent_info[2] = implode(":", [$tmp2, date("Y-m-d", strtotime($timeEnd))]);
  96. }
  97. $info["qz_talent_info"] = implode(";", $qz_talent_info);
  98. }
  99. if ($info["fj_talent_info"]) {
  100. $fj_talent_info = explode(";", $info["fj_talent_info"]);
  101. list($tmp1, $timeStart) = explode(":", $fj_talent_info[0]);
  102. list($tmp2, $validYear) = explode(":", $fj_talent_info[2]);
  103. $timeStart = str_replace(["."], "-", $timeStart);
  104. if (strtotime($timeStart)) {
  105. $tmp_time = date("Y-m-d", strtotime($timeStart));
  106. $fj_talent_info[0] = implode(":", [$tmp1, $tmp_time]);
  107. if ($isAdmin) {
  108. $batch_info = NoticeModel::where('batch', $tmp_time)->find();
  109. if ($batch_info) {
  110. $fj_talent_info[0] = "<a target='_blank' href='/common/notice/view/id/" . $batch_info['id'] . "'>" . $fj_talent_info[0] . "</a>";
  111. }
  112. }
  113. if (strtotime($validYear)) {
  114. $fj_talent_info[2] = implode(":", [$tmp2, date("Y-m-d", strtotime($validYear))]);
  115. } else {
  116. $validval = intval($validYear);
  117. if ($validYear > 0) {
  118. $timestr = str_replace($validval, "", $validYear);
  119. switch ($timestr) {
  120. case "月":
  121. $timetype = "months";
  122. break;
  123. case "日":
  124. $timetype = "days";
  125. break;
  126. default:
  127. $timetype = "years";
  128. break;
  129. }
  130. $fj_talent_info[2] = implode(":", [$tmp2, date("Y-m-d", strtotime("+{$validval} {$timetype} -1 days", strtotime($timeStart)))]);
  131. }
  132. }
  133. }
  134. $info["fj_talent_info"] = implode(";", $fj_talent_info);
  135. }
  136. if ($info["talent_condition"]) {
  137. $talent_condition = \app\common\model\TalentCondition::findOrEmpty($info["talent_condition"]);
  138. $info["talentConditionName"] = $talent_condition["name"];
  139. $info["talent_arrange_category"] = $talent_condition["talentLevelCat"];
  140. $info["talentArrangeCatName"] = DictApi::selectByParentCode("talent_condition_cats")[$talent_condition["talentLevelCat"]];
  141. }
  142. }
  143. return $info;
  144. }
  145. public static function getOne($id) {
  146. return Talent::findOrEmpty($id);
  147. }
  148. /**
  149. * 获得新的需要重审的部门集合(如果$oriReCheckCompanyIds为空,返回认定条件审核部门集合$talentConditionCompanyIds)
  150. * @param type $oriReCheckCompanyIds 原来的需要再审核的部门id集合
  151. * @param type $talentConditionCompanyIds 认定条件中的审核部门id集合
  152. * @param type $passedCompanyIds 已经通过审核的部门id集合
  153. * @return type
  154. */
  155. public static function getNewReCheckCompanyIds($oriReCheckCompanyIds, $talentConditionCompanyIds, $passedCompanyIds) {
  156. if ($oriReCheckCompanyIds) {
  157. //$removeReCheckCompanyIds:获得再审核部门中已经被移除的集合(修改认定条件审核部门后,已经不再在列表中的部门Id集合)
  158. $removeReCheckCompanyIds = array_diff($oriReCheckCompanyIds, $talentConditionCompanyIds);
  159. //$reCheckCompanyIds:获得再审核部门中仍需审核的部门集合
  160. $reCheckCompanyIds = array_diff($oriReCheckCompanyIds, $removeReCheckCompanyIds);
  161. //$notInReCheckCompanyIds:不在重审列表里面的审核部门集合(这里面存在新增的审核部门)
  162. $notInReCheckCompanyIds = array_diff($talentConditionCompanyIds, $reCheckCompanyIds);
  163. //$needReCheckCompanyIds:找出不在重审列表里面并且没有在已审核通过的列表中的部门Id集合
  164. $needReCheckCompanyIds = array_diff($notInReCheckCompanyIds, $passedCompanyIds);
  165. //合并新的需要重审的部门集合
  166. $newReCheckCompanyIds = array_unique(array_merge($reCheckCompanyIds, $needReCheckCompanyIds));
  167. return $newReCheckCompanyIds;
  168. }
  169. return $talentConditionCompanyIds;
  170. }
  171. public static function getFullDeptList($params, $where = []) {
  172. $order = $params["order"] ?: "desc";
  173. $offset = $params["offset"] ?: 0;
  174. $limit = $params["limit"] ?: 10;
  175. $whereRaw = "";
  176. if ($params["company_id"]) {
  177. $where[] = ["tc.companyIds", "like", "%" . $params["company_id"] . "%"];
  178. }
  179. switch ($params["checkState"]) {
  180. case 1://待部门并审(首次提交)
  181. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  182. $where[] = ["ti.pass_dept_check", "=", 0];
  183. $where[] = ["tl2.resubmit", "EXP", Db::raw("is null")];
  184. break;
  185. case 2://待部门并审(重新提交)
  186. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  187. $where[] = ["ti.pass_dept_check", "=", 0];
  188. $where[] = ["tl2.resubmit", "EXP", Db::raw("is not null")];
  189. break;
  190. case 3://部门并审通过
  191. $where[] = ["tl.state", "=", TalentState::DEPT_VERIFY_PASS];
  192. break;
  193. case 4://部门并审驳回
  194. $where[] = ["tl.state", "=", TalentState::DEPT_VERIFY_REJECT];
  195. break;
  196. default:
  197. $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);
  198. break;
  199. }
  200. $companyId = session("user")["companyId"];
  201. $talent_arrange_kvs = DictApi::selectByParentCode("talent_arrange");
  202. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  203. $count = Talent::alias("ti")
  204. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  205. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  206. ->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")
  207. ->leftJoin(sprintf("(select id as resubmit,mainId from new_talent_checklog where state in(%d,%d) and step is null and `type`=1 and `active`=1 group by mainId) as tl2", TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT), "`tl2`.mainId=`ti`.id")
  208. ->where($where)
  209. ->where($whereRaw)->count();
  210. $list = Talent::alias("ti")
  211. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  212. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  213. ->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")
  214. ->leftJoin(sprintf("(select id as resubmit,mainId from new_talent_checklog where state in(%d,%d) and step is null and `type`=1 and `active`=1 group by mainId) as tl2", TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT), "`tl2`.mainId=`ti`.id")
  215. ->where($where)
  216. ->where($whereRaw)
  217. ->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,tl2.resubmit")
  218. ->limit($offset, $limit)->order("ti.createTime " . $order)
  219. ->select()->toArray();
  220. foreach ($list as &$item) {
  221. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江市现代产业体系人才" : "集成电路优秀人才";
  222. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  223. $item["talentArrangeName"] = $talent_arrange_kvs[$item["talent_arrange"]];
  224. $companys = array_filter(explode(",", $item["companyIds"]));
  225. $verifyDepts = [];
  226. foreach ($companys as $k => $companyId) {
  227. $company = getCacheById("Company", $companyId);
  228. $log = TalentLogApi::getCompanyNewestCheckedLog($item["id"], $companyId);
  229. if (!$log && in_array($item["realState"], [TalentState::DEPT_VERIFY_PASS, TalentState::DEPT_VERIFY_REJECT]))
  230. continue;
  231. $verifyDepts[$k]["id"] = $companyId;
  232. $verifyDepts[$k]["shortName"] = $company["shortName"];
  233. $verifyDepts[$k]["name"] = $company["name"];
  234. $verifyDepts[$k]["code"] = $company["code"];
  235. $verifyDepts[$k]["checkState"] = $log["new_state"];
  236. $verifyDepts[$k]["active"] = $log["active"];
  237. }
  238. $item["verifyDepts"] = $verifyDepts;
  239. }unset($item);
  240. return ["total" => $count, "rows" => $list];
  241. }
  242. public static function getDeptList($params, $where = []) {
  243. $order = $params["order"] ?: "desc";
  244. $offset = $params["offset"] ?: 0;
  245. $limit = $params["limit"] ?: 10;
  246. $companyId = session("user")["companyId"];
  247. $whereRaw = "";
  248. switch ($params["checkState"]) {
  249. case 1://待部门并审(首次提交)
  250. //$where[] = ["tl.active", "=", 0];
  251. //$where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  252. //$where[] = ["tl2.resubmit", "EXP", Db::raw("is null")];
  253. $whereRaw = sprintf("((tl.active=0 and tl.state=%d) or (tl.active is null)) and tl2.resubmit is null and ti.pass_dept_check=0 and ti.checkState=%d", TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_PASS);
  254. break;
  255. case 2://待部门并审(重新提交)
  256. //$where[] = ["tl.active", "=", 0];
  257. //$where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  258. //$where[] = ["tl2.resubmit", "EXP", Db::raw("is not null")];
  259. $whereRaw = sprintf("((tl.active=0 and tl.state=%d) or (tl.active is null)) and tl2.resubmit is not null and ti.pass_dept_check=0 and ti.checkState=%d", TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_PASS);
  260. break;
  261. case 3://部门并审通过
  262. $where[] = ["tl.active", "=", 1];
  263. $where[] = ["tl.new_state", "=", TalentState::DEPT_VERIFY_PASS];
  264. break;
  265. case 4://部门并审驳回
  266. $where[] = ["tl.active", "=", 1];
  267. $where[] = ["tl.new_state", "=", TalentState::SCND_SUBMIT];
  268. break;
  269. default:
  270. $whereRaw = sprintf("(((tl.active=0 and tl.state=%d) or (tl.active is null)) and ti.pass_dept_check=0 and ti.checkState=%d) or (tl.active=1 and (tl.new_state in (%d,%d)))", TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_PASS);
  271. break;
  272. }
  273. $talent_arrange_kvs = DictApi::selectByParentCode("talent_arrange");
  274. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  275. $count = Talent::alias("ti")
  276. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  277. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  278. ->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")
  279. ->leftJoin(sprintf("(select id as resubmit,mainId from new_talent_checklog where state in(%d,%d) and step is null and `type`=1 and `active`=1 group by mainId) as tl2", TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT), "`tl2`.mainId=`ti`.id")
  280. ->where($where)
  281. ->where($whereRaw)
  282. ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])->count();
  283. $list = Talent::alias("ti")
  284. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  285. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  286. ->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")
  287. ->leftJoin(sprintf("(select id as resubmit,mainId from new_talent_checklog where state in(%d,%d) and step is null and `type`=1 and `active`=1 group by mainId) as tl2", TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT), "`tl2`.mainId=`ti`.id")
  288. ->where($where)
  289. ->where($whereRaw)
  290. ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])
  291. ->field("ti.*,tl.last_state as 'lastState',tl.state as 'realState',tl.new_state as 'newState',e.name as enterprise_name,e.type as enterprise_type,enterpriseTag,tc.name as talentConditionName,tl2.resubmit,tl.active as deptActive")
  292. ->limit($offset, $limit)->order("ti.createTime " . $order)
  293. ->select()->toArray();
  294. foreach ($list as &$item) {
  295. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江市现代产业体系人才" : "集成电路优秀人才";
  296. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  297. $lastCheckLog = TalentLogApi::getCompanyNewestCheckedLog($item["id"], $companyId);
  298. $item["deptCheckState"] = $lastCheckLog["new_state"] ?: TalentState::FST_VERIFY_PASS;
  299. $item["talentArrangeName"] = $talent_arrange_kvs[$item["talent_arrange"]];
  300. }unset($item);
  301. return ["total" => $count, "rows" => $list];
  302. }
  303. public static function getPublicList($params) {
  304. $order = $params["order"];
  305. $offset = $params["offset"];
  306. $limit = $params["limit"];
  307. $where = [];
  308. $where[] = ["e.type", "=", session("user")["type"]];
  309. if ($params["name"]) {
  310. $where[] = ["ti.name", "like", "%" . $params["name"] . "%"];
  311. }
  312. if ($params["sex"]) {
  313. $where[] = ["ti.sex", "=", $params["sex"]];
  314. }
  315. if ($params["checkState"]) {
  316. $where[] = ["ti.checkState", "=", $params["checkState"]];
  317. }
  318. $type = $params["type"];
  319. switch ($type) {
  320. case 1:
  321. case 2:
  322. $where[] = ["ti.checkState", "=", TalentState::REVERIFY_PASS];
  323. break;
  324. case 3: //公示
  325. case 7: //公示预览
  326. $where[] = ["ti.checkState", "=", TalentState::ZX_PASS];
  327. break;
  328. case 4: //公示通过
  329. $where[] = ["ti.checkState", "=", TalentState::ANNOUNCED];
  330. break;
  331. case 5:
  332. case 8: //公布预览
  333. $where[] = ["ti.checkState", "=", TalentState::ANNOUNCED_REVERIFY_PASS];
  334. break;
  335. case 6:
  336. $where[] = ["ti.checkState", "=", TalentState::PUBLISH_PASS];
  337. break;
  338. }
  339. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  340. //$count = Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->where($where)->count();
  341. $list = Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  342. ->where($where)
  343. //->limit($offset, $limit)
  344. ->order("ti.createTime " . $order)
  345. ->field("ti.*,e.name as enterpriseName,e.type as enterprise_type,enterpriseTag")->select()->toArray();
  346. foreach ($list as &$item) {
  347. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江市现代产业体系人才" : "集成电路优秀人才";
  348. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  349. }unset($item);
  350. return $list;
  351. }
  352. public static function getListByIds($ids) {
  353. $where[] = ["id", "in", $ids];
  354. return Talent::where($where)->select()->toArray();
  355. }
  356. public static function getList($params) {
  357. $where = [];
  358. $order = $params["order"] ?: "desc";
  359. $offset = $params["offset"] ?: 0;
  360. $limit = $params["limit"] ?: 10;
  361. $type = session("user")["type"];
  362. $where[] = ["e.type", "=", $type];
  363. if ($params["name"]) {
  364. $where[] = ["ti.name", "like", "%{$params["name"]}%"];
  365. }
  366. if ($params["card_number"]) {
  367. $where[] = ["ti.card_number", "like", "%" . $params["card_number"] . "%"];
  368. }
  369. if ($params["sex"]) {
  370. $where[] = ["ti.sex", "=", $params["sex"]];
  371. }
  372. if ($params["nation"]) {
  373. $where[] = ["ti.nation", "=", $params["nation"]];
  374. }
  375. if ($params["apply_year"]) {
  376. $where[] = ["ti.apply_year", "like", "{$params["apply_year"]}%"];
  377. }
  378. if ($params["phone"]) {
  379. $where[] = ["ti.phone", "like", "%{$params["phone"]}%"];
  380. }
  381. if ($params["email"]) {
  382. $where[] = ["ti.email", "like", "%{$params["email"]}%"];
  383. }
  384. if ($params["nationality"]) {
  385. $where[] = ["ti.nationality", "=", $params["nationality"]];
  386. }
  387. if ($params["province"]) {
  388. $where[] = ["ti.province", "=", $params["province"]];
  389. }
  390. if ($params["politics"]) {
  391. $where[] = ["ti.politics", "=", $params["politics"]];
  392. }
  393. if ($params["enterprise_id"]) {
  394. $where[] = ["ti.enterprise_id", "=", $params["enterprise_id"]];
  395. }
  396. if ($params["medicalCommunityId"]) {
  397. $where[] = ["e.medicalCommunityId", "=", $params["medicalCommunityId"]];
  398. }
  399. if ($params["isGeneral"]) {
  400. $where[] = ["e.isGeneral", "=", $params["isGeneral"]];
  401. }
  402. if ($params["street"]) {
  403. $where[] = ["e.street", "=", $params["street"]];
  404. }
  405. if ($params["industry_field"]) {
  406. $where[] = ["e.industryFieldNew", "=", $params["industry_field"]];
  407. }
  408. if ($params["industry_field_old"]) {
  409. $where[] = ["e.industryFieldOld", "=", $params["industry_field_old"]];
  410. }
  411. if ($params["enterprise_tag"]) {
  412. $where[] = ["e.enterpriseTag", "=", $params["enterprise_tag"]];
  413. }
  414. if ($params["talent_type"]) {
  415. $where[] = ["ti.talent_type", "=", $params["talent_type"]];
  416. }
  417. if ($params["import_way"]) {
  418. $where[] = ["ti.import_way", "=", $params["import_way"]];
  419. }
  420. if ($params["highest_degree"]) {
  421. $where[] = ["ti.highest_degree", "=", $params["highest_degree"]];
  422. }
  423. if ($params["study_abroad"]) {
  424. $where[] = ["ti.study_abroad", "=", $params["study_abroad"]];
  425. }
  426. if ($params["source"]) {
  427. $where[] = ["ti.source", "=", $params["source"]];
  428. }
  429. if ($params["talent_arrange"]) {
  430. $where[] = ["ti.talent_arrange", "=", $params["talent_arrange"]];
  431. }
  432. if ($params["talent_condition"]) {
  433. $where[] = ["ti.talent_condition", "=", $params["talent_condition"]];
  434. }
  435. if ($params["isMatchZhiren"]) {
  436. $params["isMatchZhiren"] = $params["isMatchZhiren"] == 1 ?: 0;
  437. $where[] = ["ti.isMatchZhiren", "=", $params["isMatchZhiren"]];
  438. }
  439. if ($params["active"]) {
  440. $where[] = ["ti.active", "=", $params["active"]];
  441. }
  442. if ($params["breakFaith"]) {
  443. $where[] = ["ti.break_faith", "=", $params["breakFaith"]];
  444. }
  445. $process = $params["process"];
  446. if ($process == 4) {
  447. if (self::chkUserInSuperDeptUsers()) {
  448. return self::getFullDeptList($params, $where);
  449. } else {
  450. return self::getDeptList($params, $where);
  451. }
  452. }
  453. if ($process == 5) {
  454. $whereRaw = sprintf("(tl.state in (-14,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 = ''))");
  455. switch ($params["checkState"]) {
  456. case 1://待复审(首次提交)
  457. $where[] = ["tl.state", "in", [TalentState::REVERIFY_CANCEL, TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS]];
  458. $where[] = ["tl2.resubmit", "EXP", Db::raw("is null")];
  459. break;
  460. case 2://待复审(重新提交)
  461. $where[] = ["tl.state", "in", [TalentState::REVERIFY_CANCEL, TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS]];
  462. $where[] = ["tl2.resubmit", "EXP", Db::raw("is not null")];
  463. break;
  464. case 3://复审通过
  465. $where[] = ["tl.state", "=", TalentState::REVERIFY_PASS];
  466. break;
  467. case 4://复审驳回
  468. $where[] = ["tl.state", "=", TalentState::REVERIFY_REJECT];
  469. break;
  470. case 5://复审不通过
  471. $where[] = ["tl.state", "=", TalentState::REVERIFY_FAIL];
  472. break;
  473. default:
  474. if ($type == 2) {
  475. $where[] = ["tl.state", "in", [TalentState::REVERIFY_CANCEL, TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS]];
  476. }
  477. break;
  478. }
  479. $count = Talent::alias("ti")
  480. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  481. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  482. ->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")
  483. ->leftJoin("(select id as resubmit,mainId from new_talent_checklog where state=" . TalentState::REVERIFY_REJECT . " and `type`=1 and `active`=1 group by mainId) as tl2", "`tl2`.mainId=`ti`.id")
  484. ->whereRaw($whereRaw)->where($where)->count();
  485. $list = Talent::alias("ti")
  486. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  487. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  488. ->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")
  489. ->leftJoin("(select id as resubmit,mainId from new_talent_checklog where state=" . TalentState::REVERIFY_REJECT . " and `type`=1 and `active`=1 group by mainId) as tl2", "`tl2`.mainId=`ti`.id")
  490. ->whereRaw($whereRaw)
  491. ->where($where)
  492. ->limit($offset, $limit)
  493. ->order("ti.createTime " . $order)
  494. ->field("ti.*,tl.last_state as 'lastState',tl.state as 'realState',e.name as enterprise_name,e.type as enterprise_type,enterpriseTag,e.isGeneral,e.medicalCommunityId,tl2.resubmit")
  495. ->select()->toArray();
  496. } else {
  497. switch ($process) {
  498. case 1:
  499. $where[] = ["ti.checkState", "in", [TalentState::FST_SUBMIT, TalentState::BASE_VERIFY_FAIL]];
  500. break;
  501. case 2:
  502. $where[] = ["ti.checkState", "in", [TalentState::BASE_VERIFY_PASS, TalentState::BASE_REVERIFY_FAIL]];
  503. break;
  504. case 3:
  505. switch ($params["checkState"]) {
  506. case 1://保存未提交
  507. $where[] = ["tl.new_state", "=", TalentState::SCND_SAVE];
  508. $where[] = ["tl.state", "=", TalentState::SCND_SAVE];
  509. $where[] = ["ti.delete", "=", 0];
  510. break;
  511. case 2://初审驳回
  512. $where[] = ["tl.new_state", "=", TalentState::SCND_SAVE];
  513. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_REJECT];
  514. $where[] = ["ti.delete", "=", 0];
  515. break;
  516. case 3://待初审(首次提交)
  517. $where[] = ["tl.last_state", "<>", TalentState::FST_VERIFY_REJECT];
  518. $where[] = ["tl.state", "=", TalentState::SCND_SUBMIT];
  519. $where[] = ["ti.delete", "=", 0];
  520. break;
  521. case 4://待初审(重新提交)
  522. $where[] = ["tl.last_state", "=", TalentState::FST_VERIFY_REJECT];
  523. $where[] = ["tl.state", "=", TalentState::SCND_SUBMIT];
  524. $where[] = ["ti.delete", "=", 0];
  525. break;
  526. case 5://待初审(部门并审驳回)
  527. $where[] = ["tl.new_state", "=", TalentState::SCND_SUBMIT];
  528. $where[] = ["tl.state", "=", TalentState::DEPT_VERIFY_REJECT];
  529. $where[] = ["ti.delete", "=", 0];
  530. break;
  531. case 6://待初审(复审驳回)
  532. $where[] = ["tl.new_state", "=", TalentState::SCND_SUBMIT];
  533. $where[] = ["tl.state", "=", TalentState::REVERIFY_REJECT];
  534. $where[] = ["ti.delete", "=", 0];
  535. break;
  536. case 7://初审通过(待部门并审)
  537. $where[] = ["ti.pass_dept_check", "=", 0];
  538. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  539. $where[] = ["ti.delete", "=", 0];
  540. break;
  541. case 8://初审通过(待复审)
  542. $where[] = ["ti.pass_dept_check", "=", 1];
  543. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  544. $where[] = ["ti.delete", "=", 0];
  545. break;
  546. case 9://初审不通过
  547. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_FAIL];
  548. $where[] = ["ti.delete", "=", 0];
  549. break;
  550. default:
  551. //$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);
  552. if ($type == 2) {
  553. $where[] = ["tl.state", "in", [TalentState::FST_VERIFY_REJECT, TalentState::SCND_SUBMIT,
  554. TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT]];
  555. $where[] = ["ti.delete", "=", 0];
  556. } else {
  557. $where[] = ["tl.state", "in", [TalentState::SCND_SAVE, TalentState::FST_VERIFY_REJECT, TalentState::SCND_SUBMIT,
  558. TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT, TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_FAIL]];
  559. $where[] = ["ti.delete", "=", 0];
  560. }
  561. }
  562. break;
  563. case 6:
  564. $where[] = ["tl.state", ">=", TalentState::REVERIFY_PASS];
  565. $where[] = ["tl.state", "not in", [TalentState::REVERIFY_REJECT, TalentState::REVERIFY_FAIL]];
  566. if ($params["checkState"]) {
  567. $where[] = ["tl.state", "=", $params["checkState"]];
  568. }
  569. break;
  570. case 7:
  571. $where[] = ["tl.state", "=", TalentState::CERTIFICATED];
  572. break;
  573. }
  574. $count = Talent::alias("ti")
  575. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  576. ->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")
  577. //->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")
  578. ->where($where)->where($whereRaw)->count();
  579. $list = Talent::alias("ti")
  580. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  581. ->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")
  582. //->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")
  583. ->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,e.isGeneral,e.medicalCommunityId")->select()->toArray();
  584. }
  585. $talent_arrange_kvs = DictApi::selectByParentCode("talent_arrange");
  586. $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
  587. $medicalCommunity_kvs = Nhc::getMedicalCommunityMap();
  588. foreach ($list as &$item) {
  589. $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江市现代产业体系人才" : "集成电路优秀人才";
  590. $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
  591. $item["talentArrangeName"] = $talent_arrange_kvs[$item["talent_arrange"]];
  592. $item["talentConditionName"] = TalentCondition::findOrEmpty($item["talent_condition"])["name"];
  593. $item["medicalCommunityName"] = $item["medicalCommunityId"] ? $medicalCommunity_kvs[$item["medicalCommunityId"]] : null;
  594. //$last_log = TalentLogApi::getLastLog($item["id"], 1, 0, ["step", "=", null]);
  595. //$item["lastState"] = $last_log["last_state"];
  596. //$item["realState"] = $last_log["state"];
  597. }unset($item);
  598. return ["total" => $count, "rows" => $list];
  599. }
  600. public static function getExportDatas($process, $params) {
  601. $where[] = [];
  602. //特殊字段处理
  603. $exportFields = $params["export"];
  604. $fields = [];
  605. foreach ($exportFields as $field) {
  606. if (!in_array($field, ["industryFieldNew", "enterpriseName", "enterpriseTag", "street", "talent_arrange_category", "checkMsg", "breakFaithName", "activeName"])) {
  607. $fields[] = "ti." . $field;
  608. }
  609. }
  610. $fields[] = "e.name as enterpriseName";
  611. $fields[] = "e.industryFieldNew";
  612. $fields[] = "e.enterpriseTag";
  613. $fields[] = "e.street";
  614. $fields[] = "tc.talentLevelCat";
  615. $fields[] = "tl.description as checkMsg";
  616. $fields[] = "tc.name as talentConditionName";
  617. $fields[] = "tl.description as checkMsg";
  618. $fields[] = "if(ti.break_faith=1,'是','否') as breakFaithName";
  619. $fields[] = "if(ti.active=2,'离职','在职') as activeName";
  620. if (in_array("card_type", $exportFields)) {
  621. $cardTypes = DictApi::selectByParentCode("card_type");
  622. }
  623. if (in_array("industryFieldNew", $exportFields)) {
  624. $industry_fields = DictApi::selectByParentCode("industry_field");
  625. }
  626. if (in_array("enterpriseTag", $exportFields)) {
  627. $enterpriseTags = DictApi::selectByParentCode("enterprise_tag");
  628. }
  629. if (in_array("street", $exportFields)) {
  630. $streets = DictApi::selectByParentCode("street");
  631. }
  632. if (in_array("nation", $exportFields)) {
  633. $nations = DictApi::selectByParentCode("nation");
  634. }
  635. if (in_array("nationality", $exportFields)) {
  636. $nationalitys = DictApi::selectByParentCode("nationality");
  637. }
  638. if (in_array("politics", $exportFields)) {
  639. $politics = DictApi::selectByParentCode("politics");
  640. }
  641. if (in_array("talent_type", $exportFields)) {
  642. $talentTypes = DictApi::selectByParentCode("talent_type");
  643. }
  644. if (in_array("talent_arrange_category", $exportFields)) {
  645. $talentArrangeCategories = DictApi::selectByParentCode("talent_condition_cats");
  646. }
  647. if (in_array("highest_degree", $exportFields)) {
  648. $highest_degree = DictApi::selectByParentCode("highest_degree");
  649. }
  650. if (in_array("import_way", $exportFields)) {
  651. $import_way = DictApi::selectByParentCode("import_way");
  652. }
  653. if (in_array("source", $exportFields)) {
  654. $source = DictApi::selectByParentCode("source");
  655. }
  656. if (in_array("source_city", $exportFields)) {
  657. $source_city = DictApi::selectByParentCode("source_city");
  658. }
  659. if (in_array("source_county", $exportFields)) {
  660. $source_county = DictApi::selectByParentCode("source_county");
  661. }
  662. if (in_array("talent_arrange", $exportFields)) {
  663. $talent_arrange = DictApi::selectByParentCode("talent_arrange");
  664. }
  665. $sex = [1 => "男", 2 => "女"];
  666. $pre_import_type = [1 => "意向合同", 2 => "创业企业名称预核准"];
  667. $study_abroad = [1 => "是", 2 => "否"];
  668. $salary_pay_way = [1 => "本单位", 2 => "本单位所属集团公司及权属公司"];
  669. $return = [1 => "是", 2 => "否"];
  670. $isMatchZhiren = [0 => "否", 1 => "是"];
  671. $where = [];
  672. $whereRaw = "";
  673. $user = session("user");
  674. if ($user["usertype"] == 1) {
  675. $where[] = ["e.type", "=", $user["type"]];
  676. } else if ($user["usertype"] == 2) {
  677. $where[] = ["e.id", "=", $user["uid"]];
  678. } else {
  679. }
  680. if ($params["all"] != 1) {
  681. if ($params["name"]) {
  682. $where[] = ["ti.name", "like", "%{$params["name"]}%"];
  683. }
  684. if ($params["card_number"]) {
  685. $where[] = ["ti.card_number", "like", "%" . $params["card_number"] . "%"];
  686. }
  687. if ($params["sex"]) {
  688. $where[] = ["ti.sex", "=", $params["sex"]];
  689. }
  690. if ($params["nation"]) {
  691. $where[] = ["ti.nation", "=", $params["nation"]];
  692. }
  693. if ($params["apply_year"]) {
  694. $where[] = ["ti.apply_year", "like", "{$params["apply_year"]}%"];
  695. }
  696. if ($params["phone"]) {
  697. $where[] = ["ti.phone", "like", "%{$params["phone"]}%"];
  698. }
  699. if ($params["email"]) {
  700. $where[] = ["ti.email", "like", "%{$params["email"]}%"];
  701. }
  702. if ($params["nationality"]) {
  703. $where[] = ["ti.nationality", "=", $params["nationality"]];
  704. }
  705. if ($params["province"]) {
  706. $where[] = ["ti.province", "=", $params["province"]];
  707. }
  708. if ($params["politics"]) {
  709. $where[] = ["ti.politics", "=", $params["politics"]];
  710. }
  711. if ($params["enterprise_id"]) {
  712. $where[] = ["ti.enterprise_id", "=", $params["enterprise_id"]];
  713. }
  714. if ($params["street"]) {
  715. $where[] = ["e.street", "=", $params["street"]];
  716. }
  717. if ($params["industry_field"]) {
  718. $where[] = ["e.industryFieldNew", "=", $params["industry_field"]];
  719. }
  720. if ($params["industry_field_old"]) {
  721. $where[] = ["e.industryFieldOld", "=", $params["industry_field_old"]];
  722. }
  723. if ($params["enterprise_tag"]) {
  724. $where[] = ["e.enterpriseTag", "=", $params["enterprise_tag"]];
  725. }
  726. if ($params["talent_type"]) {
  727. $where[] = ["ti.talent_type", "=", $params["talent_type"]];
  728. }
  729. if ($params["import_way"]) {
  730. $where[] = ["ti.import_way", "=", $params["import_way"]];
  731. }
  732. if ($params["highest_degree"]) {
  733. $where[] = ["ti.highest_degree", "=", $params["highest_degree"]];
  734. }
  735. if ($params["study_abroad"]) {
  736. $where[] = ["ti.study_abroad", "=", $params["study_abroad"]];
  737. }
  738. if ($params["source"]) {
  739. $where[] = ["ti.source", "=", $params["source"]];
  740. }
  741. if ($params["talent_arrange"]) {
  742. $where[] = ["ti.talent_arrange", "=", $params["talent_arrange"]];
  743. }
  744. if ($params["talent_condition"]) {
  745. $where[] = ["ti.talent_condition", "=", $params["talent_condition"]];
  746. }
  747. if ($params["isMatchZhiren"]) {
  748. $params["isMatchZhiren"] = $params["isMatchZhiren"] == 1 ?: 0;
  749. $where[] = ["ti.isMatchZhiren", "=", $params["isMatchZhiren"]];
  750. }
  751. if ($params["active"]) {
  752. $where[] = ["ti.active", "=", $params["active"]];
  753. }
  754. if ($params["breakFaith"]) {
  755. $where[] = ["ti.break_faith", "=", $params["breakFaith"]];
  756. }
  757. if ($params["company_id"]) {
  758. $where[] = ["tc.companyIds", "like", "%" . $params["company_id"] . "%"];
  759. }
  760. switch ($process) {
  761. case 1:
  762. $where[] = ["ti.checkState", "in", [TalentState::FST_SUBMIT, TalentState::BASE_VERIFY_FAIL]];
  763. break;
  764. case 2:
  765. $where[] = ["ti.checkState", "in", [TalentState::BASE_VERIFY_PASS, TalentState::BASE_REVERIFY_FAIL]];
  766. break;
  767. case 3:
  768. switch ($params["checkState"]) {
  769. case 1://保存未提交
  770. $where[] = ["tl.new_state", "=", TalentState::SCND_SAVE];
  771. $where[] = ["tl.state", "=", TalentState::SCND_SAVE];
  772. $where[] = ["ti.delete", "=", 0];
  773. break;
  774. case 2://初审驳回
  775. $where[] = ["tl.new_state", "=", TalentState::SCND_SAVE];
  776. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_REJECT];
  777. break;
  778. case 3://待初审(首次提交)
  779. $where[] = ["tl.last_state", "<>", TalentState::FST_VERIFY_REJECT];
  780. $where[] = ["tl.state", "=", TalentState::SCND_SUBMIT];
  781. break;
  782. case 4://待初审(重新提交)
  783. $where[] = ["tl.last_state", "=", TalentState::FST_VERIFY_REJECT];
  784. $where[] = ["tl.state", "=", TalentState::SCND_SUBMIT];
  785. break;
  786. case 5://待初审(部门并审驳回)
  787. $where[] = ["tl.new_state", "=", TalentState::SCND_SUBMIT];
  788. $where[] = ["tl.state", "=", TalentState::DEPT_VERIFY_REJECT];
  789. break;
  790. case 6://待初审(复审驳回)
  791. $where[] = ["tl.new_state", "=", TalentState::SCND_SUBMIT];
  792. $where[] = ["tl.state", "=", TalentState::REVERIFY_REJECT];
  793. break;
  794. case 7://初审通过(待部门并审)
  795. $where[] = ["ti.pass_dept_check", "=", 0];
  796. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  797. break;
  798. case 8://初审通过(待复审)
  799. $where[] = ["ti.pass_dept_check", "=", 1];
  800. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  801. break;
  802. case 9://初审不通过
  803. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_FAIL];
  804. break;
  805. default:
  806. $where[] = ["tl.state", "in", [TalentState::SCND_SAVE, TalentState::FST_VERIFY_REJECT, TalentState::SCND_SUBMIT,
  807. TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT, TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_FAIL]];
  808. $where[] = ["ti.delete", "=", 0];
  809. }
  810. break;
  811. case 4:
  812. $companyId = session('user')['companyId'];
  813. $company_info = CompanyApi::getOne($companyId);
  814. if (self::chkUserInSuperDeptUsers()) {
  815. switch ($params["checkState"]) {
  816. case 1:
  817. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  818. $where[] = ["ti.pass_dept_check", "=", 0];
  819. $where[] = ["tl2.resubmit", "EXP", Db::raw("is null")];
  820. break;
  821. case 2:
  822. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  823. $where[] = ["ti.pass_dept_check", "=", 0];
  824. $where[] = ["tl2.resubmit", "EXP", Db::raw("is not null")];
  825. break;
  826. case 3:
  827. $where[] = ["tl.state", "=", TalentState::DEPT_VERIFY_PASS];
  828. break;
  829. case 4:
  830. $where[] = ["tl.state", "=", TalentState::DEPT_VERIFY_REJECT];
  831. break;
  832. default:
  833. $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);
  834. break;
  835. }
  836. } else {
  837. switch ($params["checkState"]) {
  838. case 1://待部门并审(首次提交)
  839. //$where[] = ["tl.active", "=", 0];
  840. //$where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  841. //$where[] = ["tl2.resubmit", "EXP", Db::raw("is null")];
  842. $whereRaw = sprintf("((tl.active=0 and tl.state=%d) or (tl.active is null)) and tl2.resubmit is null and ti.pass_dept_check=0 and ti.checkState=%d", TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_PASS);
  843. break;
  844. case 2://待部门并审(重新提交)
  845. //$where[] = ["tl.active", "=", 0];
  846. //$where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  847. //$where[] = ["tl2.resubmit", "EXP", Db::raw("is not null")];
  848. $whereRaw = sprintf("((tl.active=0 and tl.state=%d) or (tl.active is null)) and tl2.resubmit is not null and ti.pass_dept_check=0 and ti.checkState=%d", TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_PASS);
  849. break;
  850. case 3://部门并审通过
  851. $where[] = ["tl.active", "=", 1];
  852. $where[] = ["tl.new_state", "=", TalentState::DEPT_VERIFY_PASS];
  853. break;
  854. case 4://部门并审驳回
  855. $where[] = ["tl.active", "=", 1];
  856. $where[] = ["tl.new_state", "=", TalentState::SCND_SUBMIT];
  857. break;
  858. default:
  859. $whereRaw = sprintf("(((tl.active=0 and tl.state=%d) or (tl.active is null)) and ti.pass_dept_check=0 and ti.checkState=%d) or (tl.active=1 and (tl.new_state in (%d,%d)))", TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_PASS);
  860. break;
  861. }
  862. }
  863. break;
  864. case 5:
  865. $whereRaw = sprintf("(tl.state in (-14,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 = ''))");
  866. switch ($params["checkState"]) {
  867. case 1://待复审(首次提交)
  868. $where[] = ["tl.state", "in", [TalentState::REVERIFY_CANCEL, TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS]];
  869. $where[] = ["tl2.resubmit", "EXP", Db::raw("is null")];
  870. break;
  871. case 2://待复审(重新提交)
  872. $where[] = ["tl.state", "in", [TalentState::REVERIFY_CANCEL, TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS]];
  873. $where[] = ["tl2.resubmit", "EXP", Db::raw("is not null")];
  874. break;
  875. case 3://复审通过
  876. $where[] = ["tl.state", "=", TalentState::REVERIFY_PASS];
  877. break;
  878. case 4://复审驳回
  879. $where[] = ["tl.state", "=", TalentState::REVERIFY_REJECT];
  880. break;
  881. case 5://复审不通过
  882. $where[] = ["tl.state", "=", TalentState::REVERIFY_FAIL];
  883. break;
  884. }
  885. break;
  886. case 6:
  887. $where[] = ["tl.state", ">=", TalentState::REVERIFY_PASS];
  888. if ($params["checkState"]) {
  889. $where[] = ["tl.state", "=", $params["checkState"]];
  890. }
  891. break;
  892. case 7:
  893. $where[] = ["tl.state", "=", TalentState::CERTIFICATED];
  894. break;
  895. }
  896. } else {
  897. $whereRaw = "tl.state is not null";
  898. $where[] = ["ti.delete", "=", 0];
  899. }
  900. $fields[] = "ti.id";
  901. $fields[] = "ti.pass_dept_check";
  902. $fields[] = "tl.state";
  903. $fields[] = "tl.new_state";
  904. $fields[] = "tl.last_state";
  905. $fields[] = "tc.companyIds";
  906. if ($process == 4) {
  907. $fields[] = "tl2.resubmit";
  908. if (self::chkUserInSuperDeptUsers()) {
  909. $fields[] = "tl3.deptVerifyJsonData";
  910. $list = Talent::alias("ti")
  911. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  912. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  913. ->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")
  914. ->leftJoin(sprintf("(select id as resubmit,mainId from new_talent_checklog where state in(%d,%d) and step is null and `type`=1 and `active`=1 group by mainId) as tl2", TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT), "`tl2`.mainId=`ti`.id")
  915. ->leftJoin("(select mainId,JSON_ARRAYAGG(JSON_OBJECT('companyId',companyId,'active',`active`,'description',`description`,'new_state',`new_state`,'createTime',unix_timestamp(`createTime`))) as deptVerifyJsonData from new_talent_checklog where `step`=3 and `type`=1 group by mainId) as tl3", "tl3.mainId=ti.`id`")
  916. ->where($where)
  917. ->where($whereRaw)
  918. ->field($fields)
  919. ->select()->toArray();
  920. } else {
  921. $fields[] = "tl.active";
  922. $fields[] = "if(tl.new_state,tl.new_state,10) as deptCheckState";
  923. $fields[] = "tl.createTime as first_dept_check_time";
  924. $list = Talent::alias("ti")
  925. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  926. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  927. ->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")
  928. ->leftJoin(sprintf("(select id as resubmit,mainId from new_talent_checklog where state in(%d,%d) and step is null and `type`=1 and `active`=1 group by mainId) as tl2", TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT), "`tl2`.mainId=`ti`.id")
  929. ->where($where)
  930. ->where($whereRaw)
  931. ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])
  932. ->field($fields)
  933. ->select()->toArray();
  934. }
  935. } else if ($process == 5) {
  936. $fields[] = "tl2.resubmit";
  937. $list = Talent::alias("ti")
  938. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  939. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  940. ->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")
  941. ->leftJoin("(select id as resubmit,mainId from new_talent_checklog where state=" . TalentState::REVERIFY_REJECT . " and `type`=1 and `active`=1 group by mainId) as tl2", "`tl2`.mainId=`ti`.id")
  942. ->where($whereRaw)
  943. ->where($where)
  944. ->field($fields)
  945. ->select()->toArray();
  946. } else {
  947. $list = Talent::alias("ti")
  948. ->field($fields)
  949. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  950. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  951. ->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")
  952. //->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)")
  953. ->where($where)
  954. ->where($whereRaw)
  955. ->select()->toArray();
  956. }
  957. $un_common_location = Db::table("un_common_location")->column('name', 'code');
  958. foreach ($list as &$item) {
  959. $item["card_type"] = $cardTypes[$item["card_type"]];
  960. $item["industryFieldNew"] = $industry_fields[$item["industryFieldNew"]];
  961. $item["enterpriseTag"] = $enterpriseTags[$item["enterpriseTag"]];
  962. $item["street"] = $streets[$item["street"]];
  963. $item["nation"] = $nations[$item["nation"]];
  964. $item["nationality"] = $nationalitys[$item["nationality"]];
  965. $item["politics"] = $politics[$item["politics"]];
  966. $item["talent_type"] = $talentTypes[$item["talent_type"]];
  967. $item["talent_arrange_category"] = $talentArrangeCategories[$item["talentLevelCat"]];
  968. $item["sex"] = $sex[$item["sex"]];
  969. $item["highest_degree"] = $highest_degree[$item["highest_degree"]];
  970. $item["import_way"] = $import_way[$item["import_way"]];
  971. $item["salary_pay_way"] = $salary_pay_way[$item["salary_pay_way"]];
  972. $item["pre_import_type"] = $pre_import_type[$item["pre_import_type"]];
  973. $item["return"] = $return[$item["return"]];
  974. $item["isMatchZhiren"] = $isMatchZhiren[$item["isMatchZhiren"]];
  975. $item["study_abroad"] = $study_abroad[$item["study_abroad"]];
  976. $item["source"] = $source[$item["source"]];
  977. $item["talent_arrange"] = $talent_arrange[$item["talent_arrange"]];
  978. $item["talent_condition"] = $item["checkState"] == TalentState::CERTIFICATED && !$item["talent_condition"] ? "积分认定" : $item["talentConditionName"];
  979. if (in_array("source_city", $exportFields)) {
  980. $item["source_city"] = $un_common_location[$item["source_city"]];
  981. }
  982. if (in_array("source_county", $exportFields)) {
  983. $item["source_county"] = $un_common_location[$item["source_county"]];
  984. }
  985. if (in_array("province", $exportFields)) {
  986. $item["province"] = $un_common_location[$item["province"]];
  987. }
  988. if (in_array("city", $exportFields)) {
  989. $item["city"] = $un_common_location[$item["city"]];
  990. }
  991. if (in_array("county", $exportFields)) {
  992. $item["county"] = $un_common_location[$item["county"]];
  993. }
  994. if ($item["state"] == TalentState::SCND_SUBMIT) {
  995. if ($item["last_state"] == TalentState::FST_VERIFY_REJECT) {
  996. $item["checkState"] = "待初审(重新提交)";
  997. } else {
  998. $item["checkState"] = "待初审(首次提交)";
  999. }
  1000. } else if ($item["state"] == TalentState::FST_VERIFY_PASS || (!$item["state"] && $item["deptCheckState"])) {
  1001. if ($item["deptCheckState"]) {
  1002. if (($item["acitve"] == 0 && $item["state"] == TalentState::FST_VERIFY_PASS) || !$item["active"]) {
  1003. if ($item["resubmit"]) {
  1004. $item["checkState"] = "待部门并审(重新提交)";
  1005. } else {
  1006. $item["checkState"] = "待部门并审(首次提交)";
  1007. }
  1008. }
  1009. if ($item["active"] == 1 && $item["new_state"] == TalentState::DEPT_VERIFY_PASS) {
  1010. $item["checkState"] = "部门并审通过";
  1011. }
  1012. if ($item["active"] == 1 && $item["new_state"] == TalentState::SCND_SUBMIT) {
  1013. $item["checkState"] = "部门并审驳回";
  1014. }
  1015. } else {
  1016. if (!$item["companyIds"] || $item["pass_dept_check"] == 1) {
  1017. if ($process == 3) {
  1018. $item["checkState"] = "初审通过(待复审)";
  1019. } else {
  1020. if ($item["resubmit"]) {
  1021. $item["checkState"] = "待复审(重新提交)";
  1022. } else {
  1023. $item["checkState"] = "待复审(首次提交)";
  1024. }
  1025. }
  1026. }
  1027. if ($item["pass_dept_check"] == 0) {
  1028. if ($process == 3) {
  1029. $item["checkState"] = "初审通过(待部门并审)";
  1030. } else {
  1031. if ($item["resubmit"]) {
  1032. $item["checkState"] = "待部门并审(重新提交)";
  1033. } else {
  1034. $item["checkState"] = "待部门并审(首次提交)";
  1035. }
  1036. }
  1037. }
  1038. }
  1039. } else if ($item["state"] == TalentState::DEPT_VERIFY_REJECT) {
  1040. if ($process == 3) {
  1041. $item["checkState"] = "待初审(部门并审驳回)";
  1042. } else {
  1043. $item["checkState"] = "部门并审驳回";
  1044. }
  1045. } else if ($item["state"] == TalentState::DEPT_VERIFY_PASS) {
  1046. if ($process == 3) {
  1047. $item["checkState"] = "待复审(部门并审通过)";
  1048. } else if ($process == 4) {
  1049. $item["checkState"] = "部门并审通过";
  1050. } else {
  1051. if ($item["resubmit"]) {
  1052. $item["checkState"] = "待复审(重新提交)";
  1053. } else {
  1054. $item["checkState"] = "待复审(首次提交)";
  1055. }
  1056. }
  1057. } else if ($item["state"] == TalentState::REVERIFY_REJECT) {
  1058. if ($process == 3) {
  1059. $item["checkState"] = "待初审(复审驳回)";
  1060. } else {
  1061. $item["checkState"] = "复审驳回";
  1062. }
  1063. } else {
  1064. $item["checkState"] = TalentState::getStateName($item["state"]);
  1065. }
  1066. if ($process == 4) {
  1067. if (self::chkUserInSuperDeptUsers()) {
  1068. $companys = array_filter(explode(",", $item["companyIds"]));
  1069. $deptChecklogs = json_decode($item["deptVerifyJsonData"], true);
  1070. $deptChecklogs = bubbleSort($deptChecklogs, "createTime", "desc");
  1071. $verifyDepts = [];
  1072. $item["deptReject"] = 0;
  1073. $item["deptPass"] = 0;
  1074. $item["deptWait"] = 0;
  1075. $deptDescriptions = [];
  1076. foreach ($companys as $k => $companyId) {
  1077. $company = getCacheById("Company", $companyId);
  1078. //$log = TalentLogApi::getCompanyNewestCheckedLog($item["id"], $companyId);
  1079. $i = 0;
  1080. while ($log = $deptChecklogs[$i]) {
  1081. if ($log["companyId"] == $companyId) {
  1082. break;
  1083. } else {
  1084. $log = null;
  1085. }
  1086. $i++;
  1087. }
  1088. $item["first_dept_check_time"] = date("Y-m-d H:i:s", $log["createTime"]);
  1089. $verifyDepts[$k] = $company["name"];
  1090. if ($log["active"] == 1) {
  1091. if ($log["new_state"] == 9) {
  1092. $verifyDepts[$k] .= "(审核驳回)";
  1093. $item["deptReject"]++;
  1094. }
  1095. if ($log["new_state"] == 12) {
  1096. $verifyDepts[$k] .= "(审核通过)";
  1097. $item["deptPass"]++;
  1098. }
  1099. $deptDescriptions[] = sprintf("%s:%s", $company["name"], $log["description"]);
  1100. } else {
  1101. if (!$log && in_array($item["state"], [TalentState::DEPT_VERIFY_PASS, TalentState::DEPT_VERIFY_REJECT])) {
  1102. unset($verifyDepts[$k]);
  1103. continue;
  1104. }
  1105. $verifyDepts[$k] .= "(待审核)";
  1106. $item["deptWait"]++;
  1107. }
  1108. }
  1109. $item["verifyDepts"] = implode(chr(10), $verifyDepts);
  1110. $item["deptDescription"] = implode(chr(10), $deptDescriptions);
  1111. } else {
  1112. $item["checkMsg"] = $item["active"] == 1 ? $item["checkMsg"] : "等待部门审核";
  1113. }
  1114. }
  1115. }unset($item);
  1116. return $list;
  1117. }
  1118. public static function getListByProcess($process) {
  1119. switch ($process) {
  1120. case 1:
  1121. $where[] = ["ti.checkState", "in", [TalentState::FST_SUBMIT, TalentState::BASE_VERIFY_FAIL]];
  1122. break;
  1123. case 2:
  1124. $where[] = ["ti.checkState", "in", [TalentState::BASE_VERIFY_PASS, TalentState::BASE_REVERIFY_FAIL]];
  1125. break;
  1126. case 3:
  1127. $where[] = ["ti.checkState", "in", [TalentState::SCND_SUBMIT, TalentState::FST_VERIFY_FAIL]];
  1128. break;
  1129. default:
  1130. return null;
  1131. }
  1132. return Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->where($where)->field("ti.*,e.agentName,e.agentPhone")->select()->toArray();
  1133. }
  1134. public static function setPublic($mainId, $state, $msg, $batch = null, $type = 1) {
  1135. $data["id"] = $mainId;
  1136. $data["checkState"] = $state;
  1137. switch ($state) {
  1138. case TalentState::ZX_PASS:
  1139. case TalentState::ZX_FAIL:
  1140. $data["isPublic"] = 2;
  1141. break;
  1142. case TalentState::ANNOUNCED:
  1143. $data["isPublic"] = 3;
  1144. $data["publicBatch"] = $batch;
  1145. break;
  1146. case TalentState::ANNOUNCED_REVERIFY_PASS:
  1147. case TalentState::ANNOUNCED_REVERIFY_FAIL:
  1148. $data["isPublic"] = 3;
  1149. break;
  1150. case TalentState::PUBLISH_PASS:
  1151. $data["isPublic"] = 4;
  1152. $data["identifyMonth"] = $batch;
  1153. $data["certificateGetTime"] = $batch; //时间待定
  1154. $data["certificateExpireTime"] = date("Y-m-d", strtotime(sprintf("%s +6 years -1 days", $batch))); //时间待定
  1155. break;
  1156. case TalentState::PUBLISH_FAIL:
  1157. $data["isPublic"] = 4;
  1158. break;
  1159. }
  1160. if (Talent::update($data)) {
  1161. TalentLogApi::write($type, $mainId, $state, $msg, 1);
  1162. return true;
  1163. }
  1164. return false;
  1165. }
  1166. public static function setEffect($mainId, $effect, $log) {
  1167. $data["id"] = $mainId;
  1168. $data["isEffect"] = $effect;
  1169. if (Talent::update($data)) {
  1170. $user = session("user");
  1171. $log["id"] = getStringId();
  1172. $log["type"] = \app\common\state\ProjectState::TALENT;
  1173. $log["mainId"] = $mainId;
  1174. if ($user) {
  1175. $log["companyId"] = $user["companyId"];
  1176. }
  1177. $log["active"] = $log["active"] ?: 0;
  1178. $log["createUser"] = $user ? sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]) : "系统";
  1179. $log["createTime"] = date("Y-m-d H:i:s");
  1180. if ($effect == 1) {
  1181. $log["step"] = 65;
  1182. } else {
  1183. $log["step"] = 60;
  1184. }
  1185. \app\common\model\TalentLog::create($log);
  1186. return true;
  1187. }
  1188. return false;
  1189. }
  1190. private static function getSuperPrivsForDeptVerify() {
  1191. $config = getJsonConfig("../sys_config.json", "super_privs_for_dept_verify");
  1192. return $config;
  1193. }
  1194. public static function chkUserInSuperDeptUsers() {
  1195. $config = self::getSuperPrivsForDeptVerify();
  1196. $companyId = session("user")["companyId"];
  1197. $company = getCacheById("Company", $companyId);
  1198. $account = session("user")["account"];
  1199. return in_array($company["code"], $config["companys"]) || in_array($account, $config["users"]);
  1200. }
  1201. }