Forráskód Böngészése

部门审核列表添加人社视角,修改正常部门审核列表搜索逻辑

sugangqiang 2 éve
szülő
commit
8b1027795d
2 módosított fájl, 77 hozzáadás és 25 törlés
  1. 2 1
      app/admin/view/talent/dept_verify.html
  2. 75 24
      app/common/api/VerifyApi.php

+ 2 - 1
app/admin/view/talent/dept_verify.html

@@ -110,7 +110,8 @@
                                     <select class="form-control" id="checkState">
                                         <option value="">---请选择---</option>
                                         <option value="1">待审核</option>
-                                        <option value="5">已审核</option>
+                                        <option value="2">已驳回</option>
+                                        <option value="3">已通过</option>
                                     </select>
                                 </div>                            
                             </div>

+ 75 - 24
app/common/api/VerifyApi.php

@@ -149,10 +149,26 @@ class VerifyApi {
         return Talent::findOrEmpty($id);
     }
 
-    public static function getDeptList($params, $where = []) {
+    public static function getFullDeptList($params, $where = []) {
         $order = $params["order"] ?: "desc";
         $offset = $params["offset"] ?: 0;
         $limit = $params["limit"] ?: 10;
+        $whereRaw = "";
+        switch ($params["checkState"]) {
+            case 1:
+                $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
+                $where[] = ["ti.pass_dept_check", "=", 0];
+                break;
+            case 2:
+                $where[] = ["tl.state", "=", TalentState::DEPT_VERIFY_REJECT];
+                break;
+            case 3:
+                $where[] = ["tl.state", "=", TalentState::DEPT_VERIFY_PASS];
+                break;
+            default:
+                $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);
+                break;
+        }
 
         $companyId = session("user")["companyId"];
         $talent_arrange_kvs = DictApi::selectByParentCode("talent_arrange");
@@ -161,14 +177,63 @@ class VerifyApi {
                         ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
                         ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
                         ->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")
-                        //->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)")
                         ->where($where)
-                        ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])->count();
+                        ->where($whereRaw)->count();
         $list = Talent::alias("ti")
                         ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
                         ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
                         ->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")
-                        //->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)")
+                        ->where($where)
+                        ->where($whereRaw)
+                        ->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")
+                        ->limit($offset, $limit)->order("ti.createTime " . $order)
+                        ->select()->toArray();
+        foreach ($list as &$item) {
+            $item["talent_type"] = $item["enterprise_type"] == 1 ? "晋江市现代产业体系人才" : "集成电路优秀人才";
+            $item["enterprise_tag"] = $enterprise_tag_kvs[$item["enterpriseTag"]];
+            $item["talentArrangeName"] = $talent_arrange_kvs[$item["talent_arrange"]];
+        }unset($item);
+        return ["total" => $count, "rows" => $list];
+    }
+
+    public static function getDeptList($params, $where = []) {
+        $order = $params["order"] ?: "desc";
+        $offset = $params["offset"] ?: 0;
+        $limit = $params["limit"] ?: 10;
+        $companyId = session("user")["companyId"];
+        switch ($params["checkState"]) {
+            case 1:
+                //待审核
+                $where[] = ["tl.active", "=", 0];
+                $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
+                break;
+            case 2:
+                //已驳回
+                $where[] = ["tl.active", "=", 1];
+                $where[] = ["tl.new_state", "=", TalentState::SCND_SUBMIT];
+                break;
+            case 3:
+                //已通过
+                $where[] = ["tl.active", "=", 1];
+                $where[] = ["tl.new_state", "=", TalentState::DEPT_VERIFY_PASS];
+                break;
+            default:
+                $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);
+                break;
+        }
+
+        $talent_arrange_kvs = DictApi::selectByParentCode("talent_arrange");
+        $enterprise_tag_kvs = DictApi::selectByParentCode("enterprise_tag");
+        $count = Talent::alias("ti")
+                        ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
+                        ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
+                        ->leftJoin("(select mainId,active,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`=3 and companyId='{$companyId}' and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
+                        ->where($where)
+                        ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])->count();
+        $list = Talent::alias("ti")
+                        ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
+                        ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
+                        ->leftJoin("(select mainId,active,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`=3 and companyId='{$companyId}' and typeFileId is null group by mainId,`type`)) tl", "`tl`.`mainId`=ti.id")
                         ->where($where)
                         ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])
                         ->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")
@@ -316,27 +381,13 @@ class VerifyApi {
 
         $process = $params["process"];
         if ($process == 4) {
-            switch ($params["checkState"]) {
-                case 5:
-                    $_where = [];
-                    $_where[] = ["type", "=", 1];
-                    $_where[] = ["active", "=", 1];
-                    $_where[] = ["step", "=", 3];
-                    $_where[] = ["companyId", "=", session("user")["companyId"]];
-                    $mainIds = \app\common\model\TalentChecklog::where($_where)->group("mainId")->order("createTime desc")->column("mainId");
-                    if ($mainIds) {
-                        $where[] = ["ti.id", "in", $mainIds];
-                    } else {
-                        $where[] = ["ti.checkState", "=", TalentState::FST_VERIFY_PASS];
-                        $where[] = ["ti.pass_dept_check", "=", 0];
-                    }
-                    break;
-                default:
-                    $where[] = ["ti.checkState", "=", TalentState::FST_VERIFY_PASS];
-                    $where[] = ["ti.pass_dept_check", "=", 0];
-                    break;
+            $companyId = session('user')['companyId'];
+            $company_info = CompanyApi::getOne($companyId);
+            if ($company_info["code"] == "super" || $company_info["code"] == "rsj") {
+                return self::getFullDeptList($params, $where);
+            } else {
+                return self::getDeptList($params, $where);
             }
-            return self::getDeptList($params, $where);
         }
         if ($process == 5) {
             $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 = ''))");