Эх сурвалжийг харах

部门审核修改未完成

sugangqiang 2 жил өмнө
parent
commit
107a1e6609

+ 14 - 11
app/admin/controller/Talent.php

@@ -1056,13 +1056,13 @@ 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))
-        //return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
-
+        $pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
         $un_check_companyIds = TalentLogApi::getUnCheckDepts($talent_info["id"]); //未审核提交的单位
-        if (!in_array($this->user["companyId"], $un_check_companyIds))
+        if (!in_array($this->user["companyId"], $un_check_companyIds) && in_array($this->user["companyId"], $pass_companyIds)) {
+            //判断不在未审核列表的同时判断已经在审核列表,是为了排除意外情况:缺失的待审核部门(通常是认证条件新增审核部门导致新增的部门未在审核列表中)
+            //缺失的待审核部门,作为未审状态,将在函数末尾根据当前审核情况补充一条保存未提交的记录
             return json(["msg" => "您的部门已经审核过了,无需重复审核。"]);
+        }
 
         $params = $request->param();
         if ($params["checkState"] == 3) {
@@ -1104,14 +1104,17 @@ class Talent extends AdminController {
 
         $fst_dept_check_time = $talent_info["first_dept_check_time"];
         $dept_log = TalentLogApi::getLogByCompanyId($talent_info["id"], $this->user["companyId"], $fst_dept_check_time);
-        if (!$dept_log)
-            return json(["msg" => "未匹配日志,审核失败"]);
         if ($dept_log["active"] == 1)
             return json(["msg" => "您的部门已经审核过了"]);
         $data["id"] = $talent_info["id"];
         TalentModel::update($data);
 //修改日志
-        TalentLogApi::rewrite($dept_log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
+        if (!$dept_log) {
+            TalentLogApi::write(ProjectState::TALENT, $talent_info["id"], [$log_checkState, $checkState, 3], $params["checkMsg"]); //补一条记录
+            //return json(["msg" => "未匹配日志,审核失败"]);
+        } else {
+            TalentLogApi::rewrite($dept_log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
+        }
         return json(["code" => 200, "msg" => "保存成功"]);
     }
 
@@ -1129,9 +1132,9 @@ class Talent extends AdminController {
         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"]);
-        if (!$dept_log)
-            return json(["msg" => "未匹配日志,审核失败"]);
-        if ($dept_log["state"] == $dept_log["new_state"])
+        //if (!$dept_log)
+        //return json(["msg" => "未匹配日志,审核失败"]);
+        if ($dept_log["state"] == $dept_log["new_state"] || !$dept_log)
             return json(["msg" => "请先保存审核状态,再提交审核"]);
         if ($dept_log["active"] == 1)
             return json(["msg" => "您的部门已经审核过了"]);

+ 19 - 3
app/common/api/VerifyApi.php

@@ -149,6 +149,20 @@ class VerifyApi {
         return Talent::findOrEmpty($id);
     }
 
+    /**
+     * 
+     * @param type $oriReCheckCompanyIds 原来的需要再审核的部门id集合
+     * @param type $TalentConditionCompanyIds 认定条件中的审核部门id集合
+     * @param type $passedCompanyIds 已经通过审核的部门id集合
+     * @return type
+     */
+    public static function getReCheckCompanyIds($oriReCheckCompanyIds, $TalentConditionCompanyIds, $passedCompanyIds) {
+        if (!$oriReCheckCompanyIds || !$TalentConditionCompanyIds)
+            return null;
+        $removeReCheckCompanyIds = array_diff($oriReCheckCompanyIds, $TalentConditionCompanyIds);
+        $remainReCheckCompanyIds = array_diff($oriReCheckCompanyIds, $removeReCheckCompanyIds);
+    }
+
     public static function getFullDeptList($params, $where = []) {
         $order = $params["order"] ?: "desc";
         $offset = $params["offset"] ?: 0;
@@ -231,11 +245,13 @@ class VerifyApi {
                 $where[] = ["tl.active", "=", 0];
                 $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
                 $where[] = ["tl2.resubmit", "EXP", Db::raw("is null")];
+                //$whereRaw = sprintf("((tl.active=0 and tl.state=%d) or (tl.active is null)) and tl2.resubmit is null and ti.pass_dept_check=0 and ti.checkState=%d", TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_PASS);
                 break;
             case 2://待部门并审(重新提交)
                 $where[] = ["tl.active", "=", 0];
                 $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
                 $where[] = ["tl2.resubmit", "EXP", Db::raw("is not null")];
+                //$whereRaw = sprintf("((tl.active=0 and tl.state=%d) or (tl.active is null)) and tl2.resubmit is not null and ti.pass_dept_check=0 and ti.checkState=%d", TalentState::FST_VERIFY_PASS, TalentState::FST_VERIFY_PASS);
                 break;
             case 3://部门并审通过
                 $where[] = ["tl.active", "=", 1];
@@ -1019,16 +1035,16 @@ class VerifyApi {
                         if ($log["active"] == 1) {
                             if ($log["new_state"] == 9) {
                                 $verifyDepts[$k] .= "(审核驳回)";
-                                $item["deptReject"] ++;
+                                $item["deptReject"]++;
                             }
                             if ($log["new_state"] == 12) {
                                 $verifyDepts[$k] .= "(审核通过)";
-                                $item["deptPass"] ++;
+                                $item["deptPass"]++;
                             }
                             $deptDescriptions[] = sprintf("%s:%s", $company["name"], $log["description"]);
                         } else {
                             $verifyDepts[$k] .= "(待审核)";
-                            $item["deptWait"] ++;
+                            $item["deptWait"]++;
                         }
                     }
                     $item["verifyDepts"] = implode(chr(10), $verifyDepts);