Răsfoiți Sursa

复审退回后初审选择部门再次审核

sugangqiang 2 ani în urmă
părinte
comite
f90891df2e

+ 15 - 7
app/admin/controller/Talent.php

@@ -881,8 +881,12 @@ class Talent extends AdminController {
             return json(["msg" => "不在审核范围。(初审部门已经选择跳过部门并审阶段)"]);
         if (!in_array($this->user["companyId"], $companys))
             return json(["msg" => "您的部门不在该申请的并审部门列表中。"]);
-        $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
-        if (in_array($this->user["companyId"], $pass_companyIds))
+        //$pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
+        //if (in_array($this->user["companyId"], $pass_companyIds))
+        //return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
+
+        $un_check_companyIds = TalentLogApi::getUnCheckDepts($talent_info["id"]); //未审核提交的单位
+        if (!in_array($this->user["companyId"], $un_check_companyIds))
             return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
 
         $params = $request->param();
@@ -949,12 +953,7 @@ class Talent extends AdminController {
         $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
         if (in_array($this->user["companyId"], $pass_companyIds))
             return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
-
         $dept_log = TalentLogApi::getLogByCompanyId($talent_info["id"], $this->user["companyId"], $talent_info["first_dept_check_time"]);
-
-        $over = $pass_companyIds ? count($pass_companyIds) : 0; //完成度,如果重审之前已有通过审核的部门,不用再审,直接按通过算
-        $error = 0; //失败数
-        $nowProcess = 4;
         if (!$dept_log)
             return json(["msg" => "未匹配日志,审核失败"]);
         if ($dept_log["state"] == $dept_log["new_state"])
@@ -962,6 +961,15 @@ class Talent extends AdminController {
         if ($dept_log["active"] == 1)
             return json(["msg" => "您的部门已经审核过了"]);
 
+        if ($talent_info["re_check_companys"]) {
+            $companys = array_filter(explode(",", $talent_info["re_check_companys"]));
+            $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"], $talent_info["first_dept_check_time"]); //重审单位中已经通过的单位
+        }
+
+        $over = $pass_companyIds ? count($pass_companyIds) : 0; //完成度,如果重审之前已有通过审核的部门,不用再审,直接按通过算
+        $error = 0; //失败数
+        $nowProcess = 4;
+
         $over++;
         if ($dept_log["new_state"] == TalentState::SCND_SUBMIT) {
             $error++;

+ 3 - 3
app/common/api/DictApi.php

@@ -353,11 +353,11 @@ class DictApi {
                 if ($step == 3) {
                     $str = '<span class="label label-danger">部门驳回</span>';
                 } else {
-                    if ($last_state == 11) {
+                    if ($last_state == TalentState::FST_VERIFY_REJECT) {
                         $str = '<span class="label label-success">待重审</span>';
-                    } else if ($last_state == 10) {
+                    } else if ($last_state == TalentState::DEPT_VERIFY_REJECT) {
                         $str = '<span class="label label-danger">部门驳回</span>';
-                    } else if ($last_state == 12) {
+                    } else if ($last_state == TalentState::REVERIFY_REJECT) {
                         $str = '<span class="label label-danger">复核驳回</span>';
                     } else {
                         $str = '<span class="label label-success">待初审</span>';

+ 18 - 5
app/common/api/TalentLogApi.php

@@ -21,13 +21,26 @@ class TalentLogApi {
         return $list = TalentLog::whereOr([$where, $whr])->order("createTime desc")->select()->toArray();
     }
 
-    public static function getPassDepts($mainId) {
+    public static function getPassDepts($mainId, $fst_dept_check_time = null) {
+        $dept_pass_state = TalentState::DEPT_VERIFY_PASS;
         $where[] = ["type", "=", 1];
         $where[] = ["mainId", "=", $mainId];
-        $where[] = ["active", "=", 1];
         $where[] = ["step", "=", 3];
-        $where[] = ["new_state", "=", TalentState::DEPT_VERIFY_PASS];
-        return TalentLog::where($where)->column("companyId");
+        if ($fst_dept_check_time) {
+            $where[] = ["createTime", ">=", $fst_dept_check_time];
+        }
+        $dept_logs = TalentLog::where($where)->order("createTime desc")->select();
+        $check_depts = [];
+        $pass_depts = [];
+        foreach ($dept_logs as $dept_log) {
+            if (!in_array($dept_log["companyId"], $check_depts)) {
+                $check_depts[] = $dept_log["companyId"];
+                if ($dept_log["new_state"] == $dept_pass_state && $dept_log["active"] == 1) {
+                    $pass_depts[] = $dept_log["companyId"];
+                }
+            }
+        }
+        return array_unique($pass_depts);
     }
 
     public static function getUnCheckDepts($mainId) {
@@ -35,7 +48,7 @@ class TalentLogApi {
         $where[] = ["mainId", "=", $mainId];
         $where[] = ["active", "=", 0];
         $where[] = ["step", "=", 3];
-        $where[] = ["new_state", "in", [TalentState::DEPT_VERIFY_PASS, TalentState::FST_VERIFY_PASS]];
+        //$where[] = ["new_state", "in", [TalentState::DEPT_VERIFY_PASS, TalentState::FST_VERIFY_PASS]];
         return TalentLog::where($where)->column("companyId");
     }