Bläddra i källkod

保存未提交的部门意见在日志和导出文件中显示为“等待部门审核”,只有提交成功后才对外显示为正确的审核意见

sugangqiang 2 år sedan
förälder
incheckning
99441853de
2 ändrade filer med 46 tillägg och 38 borttagningar
  1. 44 37
      app/common/api/VerifyApi.php
  2. 2 1
      app/common/controller/Api.php

+ 44 - 37
app/common/api/VerifyApi.php

@@ -245,7 +245,7 @@ class VerifyApi {
                 $where[] = ["tl.new_state", "=", TalentState::SCND_SUBMIT];
                 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);
+                $whereRaw = 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;
         }
 
@@ -257,6 +257,7 @@ class VerifyApi {
                         ->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")
                         ->leftJoin(sprintf("(select id as resubmit,mainId from new_talent_checklog where state in(%d,%d) and step is null and `type`=1 and `active`=1 group by mainId) as tl2", TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT), "`tl2`.mainId=`ti`.id")
                         ->where($where)
+                        ->whereRaw($whereRaw)
                         ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])->count();
         $list = Talent::alias("ti")
                         ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
@@ -264,6 +265,7 @@ class VerifyApi {
                         ->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")
                         ->leftJoin(sprintf("(select id as resubmit,mainId from new_talent_checklog where state in(%d,%d) and step is null and `type`=1 and `active`=1 group by mainId) as tl2", TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT), "`tl2`.mainId=`ti`.id")
                         ->where($where)
+                        ->whereRaw($whereRaw)
                         ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])
                         ->field("ti.*,tl.last_state as 'lastState',tl.state as 'realState',tl.new_state as 'newState',e.name as enterprise_name,e.type as enterprise_type,enterpriseTag,tc.name as talentConditionName,tl2.resubmit,tl.active as deptActive")
                         ->limit($offset, $limit)->order("ti.createTime " . $order)
@@ -784,7 +786,7 @@ class VerifyApi {
                                 $where[] = ["tl.new_state", "=", TalentState::SCND_SUBMIT];
                                 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);
+                                $whereRaw = 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;
                         }
                     }
@@ -833,8 +835,8 @@ class VerifyApi {
         $fields[] = "tc.companyIds";
         if ($process == 4) {
             $fields[] = "tl2.resubmit";
-            $fields[] = "tl3.deptVerifyJsonData";
             if ($company_info["code"] == "super" || $company_info["code"] == "rsj") {
+                $fields[] = "tl3.deptVerifyJsonData";
                 $list = Talent::alias("ti")
                                 ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")
                                 ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
@@ -855,6 +857,7 @@ class VerifyApi {
                                 ->leftJoin("(select mainId,active,description,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")
                                 ->leftJoin(sprintf("(select id as resubmit,mainId from new_talent_checklog where state in(%d,%d) and step is null and `type`=1 and `active`=1 group by mainId) as tl2", TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT), "`tl2`.mainId=`ti`.id")
                                 ->where($where)
+                                ->whereRaw($whereRaw)
                                 ->whereRaw("find_in_set(:companyId,companyIds)", ["companyId" => $companyId])
                                 ->field($fields)
                                 ->select()->toArray();
@@ -991,44 +994,48 @@ class VerifyApi {
             } else {
                 $item["checkState"] = TalentState::getStateName($item["state"]);
             }
-            if ($process == 4 && in_array($company_info["code"], ["super", "rsj"])) {
-                $companys = array_filter(explode(",", $item["companyIds"]));
-                $deptChecklogs = json_decode($item["deptVerifyJsonData"], true);
-                $deptChecklogs = bubbleSort($deptChecklogs, "createTime", "desc");
-                $verifyDepts = [];
-                $item["deptReject"] = 0;
-                $item["deptPass"] = 0;
-                $item["deptWait"] = 0;
-                $deptDescriptions = [];
-                foreach ($companys as $k => $companyId) {
-                    $company = getCacheById("Company", $companyId);
-                    //$log = TalentLogApi::getCompanyNewestCheckedLog($item["id"], $companyId);
-                    $i = 0;
-                    while ($log = $deptChecklogs[$i]) {
-                        if ($log["companyId"] == $companyId) {
-                            break;
-                        }
-                        $i++;
-                    }
-                    $item["first_dept_check_time"] = $log["createTime"];
-                    $verifyDepts[$k] = $company["name"];
-                    if ($log["active"] == 1) {
-                        if ($log["new_state"] == 9) {
-                            $verifyDepts[$k] .= "(审核驳回)";
-                            $item["deptReject"]++;
+            if ($process == 4) {
+                if (in_array($company_info["code"], ["super", "rsj"])) {
+                    $companys = array_filter(explode(",", $item["companyIds"]));
+                    $deptChecklogs = json_decode($item["deptVerifyJsonData"], true);
+                    $deptChecklogs = bubbleSort($deptChecklogs, "createTime", "desc");
+                    $verifyDepts = [];
+                    $item["deptReject"] = 0;
+                    $item["deptPass"] = 0;
+                    $item["deptWait"] = 0;
+                    $deptDescriptions = [];
+                    foreach ($companys as $k => $companyId) {
+                        $company = getCacheById("Company", $companyId);
+                        //$log = TalentLogApi::getCompanyNewestCheckedLog($item["id"], $companyId);
+                        $i = 0;
+                        while ($log = $deptChecklogs[$i]) {
+                            if ($log["companyId"] == $companyId) {
+                                break;
+                            }
+                            $i++;
                         }
-                        if ($log["new_state"] == 12) {
-                            $verifyDepts[$k] .= "(审核通过)";
-                            $item["deptPass"]++;
+                        $item["first_dept_check_time"] = $log["createTime"];
+                        $verifyDepts[$k] = $company["name"];
+                        if ($log["active"] == 1) {
+                            if ($log["new_state"] == 9) {
+                                $verifyDepts[$k] .= "(审核驳回)";
+                                $item["deptReject"]++;
+                            }
+                            if ($log["new_state"] == 12) {
+                                $verifyDepts[$k] .= "(审核通过)";
+                                $item["deptPass"]++;
+                            }
+                            $deptDescriptions[] = sprintf("%s:%s", $company["name"], $log["description"]);
+                        } else {
+                            $verifyDepts[$k] .= "(待审核)";
+                            $item["deptWait"]++;
                         }
-                        $deptDescriptions[] = sprintf("%s:%s", $company["name"], $log["description"]);
-                    } else {
-                        $verifyDepts[$k] .= "(待审核)";
-                        $item["deptWait"]++;
                     }
+                    $item["verifyDepts"] = implode(chr(10), $verifyDepts);
+                    $item["deptDescription"] = implode(chr(10), $deptDescriptions);
+                } else {
+                    $item["checkMsg"] = $item["active"] == 1 ? $item["checkMsg"] : "等待部门审核";
                 }
-                $item["verifyDepts"] = implode(chr(10), $verifyDepts);
-                $item["deptDescription"] = implode(chr(10), $deptDescriptions);
             }
         }unset($item);
         return $list;

+ 2 - 1
app/common/controller/Api.php

@@ -119,6 +119,7 @@ class Api extends BaseController {
         foreach ($list as $key => $item) {
             if (($item["createUser"] == "系统" || $item["updateUser"] == "系统") && $userType != 1)//非管理员用户不显示系统自动生成或修改的日志
                 continue;
+            $new_item["description"] = $item["description"];
             switch ($item['type']) {
                 case 20:
                     $new_item["stepName"] = IntegralState::getLogStepName($item["state"]);
@@ -247,6 +248,7 @@ class Api extends BaseController {
                     if ($item["step"] == 3) {
                         $company = CompanyApi::getOne($item["companyId"]);
                         if ($item["active"] == 0) {
+                            $new_item["description"] = "等待部门审核";
                             $new_item["stateChange"] = str_replace("部门", '"' . $company["name"] . '"', DictApi::getTalentInfoStateName($item["state"], $item["step"]));
                         } else {
                             $new_item["stateChange"] = sprintf("%s -> %s", str_replace("部门", '"' . $company["name"] . '"', DictApi::getTalentInfoStateName($item["state"], $item["step"])), DictApi::getTalentInfoStateName($item["new_state"], $item["step"]));
@@ -260,7 +262,6 @@ class Api extends BaseController {
                     }
                     break;
             }
-            $new_item["description"] = $item["description"];
             $new_item["createUser"] = $item["updateUser"] && strpos($item["updateUser"], "企业用户") === false ? $item["updateUser"] : $item["createUser"]; //$item["updateUser"] ?: $item["createUser"];
             if ($new_item["createUser"] != "用户") {
                 list($name, $company) = explode("(", $new_item["createUser"]);