Index.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use app\common\api\TalentState;
  5. use app\enterprise\model\Talent;
  6. /**
  7. * Description of Login
  8. *
  9. * @author sgq
  10. */
  11. class Index extends AdminController {
  12. public function index() {
  13. $vars["user"] = [
  14. "name" => $this->user["name"],
  15. "rolename" => $this->user["rolename"],
  16. "avatar" => $this->user["avatar"],
  17. "sex" => $this->user["sex"]
  18. ];
  19. $menus = \app\common\api\MenuApi::getMenuListByRoleid($this->user["roleid"]);
  20. $vars["menus"] = $menus;
  21. $codes = \app\common\api\MenuApi::getCodesByRoleId($this->user["roleid"]);
  22. $backLogCount = 0;
  23. $userType = session("user")["type"];
  24. $companyId = session("user")["companyId"];
  25. if (in_array("talentInfo_firstCheck", $codes)) {
  26. $where[] = ["e.type", "=", $userType];
  27. $where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT];
  28. $where[] = ["tl.state", "in", [TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT]];
  29. $count = Talent::alias("ti")
  30. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  31. ->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")
  32. ->where($where)->count();
  33. if ($count > 0) {
  34. $backlog = ["title" => "【人才认定申报】待初审", "url" => "$('a.J_menuItem[href=\"/admin/talent/fst_verify\"]').click()", "count" => $count];
  35. $vars["backlog"][] = $backlog;
  36. $backLogCount += $count;
  37. }
  38. }
  39. if (in_array("talentInfo_depCheck", $codes)) {
  40. $where = [];
  41. $where[] = ["e.type", "=", $userType];
  42. if (\app\common\api\VerifyApi::chkUserInSuperDeptUsers()) {
  43. $where[] = ["ti.checkState", "=", TalentState::FST_VERIFY_PASS];
  44. $where[] = ["ti.pass_dept_check", "=", 0];
  45. $count = Talent::alias("ti")
  46. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  47. ->where($where)->count();
  48. } else {
  49. $where[] = ["tl.active", "=", 0];
  50. $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
  51. $count = Talent::alias("ti")
  52. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  53. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  54. ->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")
  55. ->where($where)
  56. ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])->count();
  57. }
  58. if ($count > 0) {
  59. $backlog = ["title" => "【人才认定申报】待部门并审", "url" => "$('a.J_menuItem[href=\"/admin/talent/dept_verify\"]').click()", "count" => $count];
  60. $vars["backlog"][] = $backlog;
  61. $backLogCount += $count;
  62. }
  63. }
  64. if (in_array("talentInfo_thirdCheck", $codes)) {
  65. $whereRaw = sprintf("((ti.checkState=%d and ti.pass_dept_check=0) or (ti.checkState=%d and ti.pass_dept_check=1) or (ti.checkState=%d and (tc.companyIds is null or tc.companyIds = ''))) and e.type=%d"
  66. , TalentState::DEPT_VERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_PASS, $userType);
  67. $count = Talent::alias("ti")
  68. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  69. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  70. ->whereRaw($whereRaw)->count();
  71. if ($count > 0) {
  72. $backlog = ["title" => "【人才认定申报】待复审", "url" => "$('a.J_menuItem[href=\"/admin/talent/re_verify\"]').click()", "count" => $count];
  73. $vars["backlog"][] = $backlog;
  74. $backLogCount += $count;
  75. }
  76. }
  77. $vars["backLogCount"] = $backLogCount;
  78. return view("", $vars);
  79. }
  80. }