Index.php 5.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. if (\app\common\api\VerifyApi::chkUserInSuperDeptUsers()) {
  42. $where[] = ["e.type", "=", $userType];
  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. $whereRaw = sprintf("((tl.active=0 and tl.state=%d) or (tl.active is null)) and ti.pass_dept_check=0 and tl.state=%d", TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_PASS);
  52. $count = Talent::alias("ti")
  53. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  54. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  55. ->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")
  56. ->where($where)
  57. ->where($whereRaw)
  58. ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])->count();
  59. }
  60. if ($count > 0) {
  61. $backlog = ["title" => "【人才认定申报】待部门并审", "url" => "$('a.J_menuItem[href=\"/admin/talent/dept_verify\"]').click()", "count" => $count];
  62. $vars["backlog"][] = $backlog;
  63. $backLogCount += $count;
  64. }
  65. }
  66. if (in_array("talentInfo_thirdCheck", $codes)) {
  67. $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"
  68. , TalentState::DEPT_VERIFY_PASS, TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_PASS, $userType);
  69. $count = Talent::alias("ti")
  70. ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
  71. ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
  72. ->whereRaw($whereRaw)->count();
  73. if ($count > 0) {
  74. $backlog = ["title" => "【人才认定申报】待复审", "url" => "$('a.J_menuItem[href=\"/admin/talent/re_verify\"]').click()", "count" => $count];
  75. $vars["backlog"][] = $backlog;
  76. $backLogCount += $count;
  77. }
  78. }
  79. $vars["backLogCount"] = $backLogCount;
  80. return view("", $vars);
  81. }
  82. }