Răsfoiți Sursa

部门导出修改

sugangqiang 2 ani în urmă
părinte
comite
6b07a88ab5
1 a modificat fișierele cu 75 adăugiri și 32 ștergeri
  1. 75 32
      app/common/api/VerifyApi.php

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

@@ -677,25 +677,45 @@ class VerifyApi {
                     }
                     break;
                 case 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 {
+                    $companyId = session('user')['companyId'];
+                    $company_info = CompanyApi::getOne($companyId);
+                    if ($company_info["code"] == "super" || $company_info["code"] == "rsj") {
+                        switch ($params["checkState"]) {
+                            case 1:
                                 $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
                                 $where[] = ["ti.pass_dept_check", "=", 0];
-                            }
-                            break;
-                        default:
-                            $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
-                            $where[] = ["ti.pass_dept_check", "=", 0];
-                            break;
+                                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;
+                        }
+                    } else {
+                        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;
+                        }
                     }
                     break;
                 case 5:
@@ -729,16 +749,27 @@ class VerifyApi {
         $fields[] = "tl.last_state";
         $fields[] = "tc.companyIds";
         if ($process == 4) {
-            $companyId = session("user")["companyId"];
-            $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 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")
-                            //->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])
-                            ->field($fields)
-                            ->select()->toArray();
+            if ($company_info["code"] == "super" || $company_info["code"] == "rsj") {
+                $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,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")
+                                ->where($where)
+                                ->where($whereRaw)
+                                ->field($fields)
+                                ->select()->toArray();
+            } else {
+                $fields[] = "tl.active";
+                $fields[] = "tl.new_state as deptCheckState";
+                $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,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`=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($fields)
+                                ->select()->toArray();
+            }
         } else if ($process == 5) {
             $list = Talent::alias("ti")
                             ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
@@ -805,11 +836,23 @@ class VerifyApi {
                     $item["checkState"] = "待初审(首次提交)";
                 }
             } else if ($item["state"] == TalentState::FST_VERIFY_PASS) {
-                if (!$item["companyIds"] || $item["pass_dept_check"] == 1) {
-                    $item["checkState"] = "待复核(初审通过)";
-                }
-                if ($item["pass_dept_check"] == 0) {
-                    $item["checkState"] = "待部门并审";
+                if ($item["deptCheckState"]) {
+                    if ($item["acitve"] == 0 && $item["state"] == TalentState::FST_VERIFY_PASS) {
+                        $item["checkState"] = "待部门审核";
+                    }
+                    if ($item["active"] == 1 && $item["new_state"] == TalentState::DEPT_VERIFY_PASS) {
+                        $item["checkState"] = "部门审核通过";
+                    }
+                    if ($item["active"] == 1 && $item["new_state"] == TalentState::SCND_SUBMIT) {
+                        $item["checkState"] = "部门审核驳回";
+                    }
+                } else {
+                    if (!$item["companyIds"] || $item["pass_dept_check"] == 1) {
+                        $item["checkState"] = "待复核(初审通过)";
+                    }
+                    if ($item["pass_dept_check"] == 0) {
+                        $item["checkState"] = "待部门并审";
+                    }
                 }
             } else if ($item["state"] == TalentState::DEPT_VERIFY_REJECT) {
                 $item["checkState"] = "待初审(部门并审驳回)";