Parcourir la source

用户端不显示系统生成日志
超过批次提交时间未提交审核自动判定失效

sugangqiang il y a 2 ans
Parent
commit
fe4bf90c70

+ 1 - 1
app/command/DeptVerifyChecker.php

@@ -30,7 +30,7 @@ class DeptVerifyChecker extends Command {
 
     protected function execute(Input $input, Output $output) {
         $where[] = ["e.type", "=", 1];
-        $where[] = ["ti.checkState", "=", TalentState::FST_VERIFY_PASS];
+        $where[] = ["tl.state", "=", TalentState::FST_VERIFY_PASS];
         $where[] = ["ti.pass_dept_check", "=", 0];
         $jjrc_list = Talent::alias("ti")
                         ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")

+ 16 - 49
app/command/ExpireVerifyChecker.php

@@ -29,58 +29,25 @@ class ExpireVerifyChecker extends Command {
     }
 
     protected function execute(Input $input, Output $output) {
-        $data["id"] = 2;
-        $data["updateTime"] = date("Y-m-d H:i:s");
-        Db::table("new_schedule")->save($data);exit();
         $where = [];
         $where[] = ["active", "=", 1];
         $where[] = ["type", "=", \app\common\state\ProjectState::TALENT];
-        $batch = \app\common\model\Batch::where($where)->find();
-        if ($batch && $batch["submitEndTime"] && strtotime($batch["submitEndTime"]) < time()) {
-            //存在激活的批次,并且有设置提交截止时间,且已经超过截止时间,则检查此批次的申报是否存在尚在审批的申请(不包括通过复审的申请),全部以失败处置
-        }
-
-        $where[] = ["e.type", "=", 1];
-        $where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT];
-        $where[] = ["tl.state", "in", [TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT]];
-        $jjrc_count = Talent::alias("ti")
-                        ->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")
-                        ->where($where)->count();
-
-        $where = [];
-        $where[] = ["e.type", "=", 2];
-        $where[] = ["ti.checkState", "=", TalentState::SCND_SUBMIT];
-        $where[] = ["tl.state", "in", [TalentState::SCND_SUBMIT, TalentState::DEPT_VERIFY_REJECT, TalentState::REVERIFY_REJECT]];
-        $ic_count = Talent::alias("ti")
-                        ->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")
-                        ->where($where)->count();
-        $codes = ["talentInfo_first"];
-        $menuIds = MenuApi::getMenuIdsByCodes($codes);
-
-        $where = [];
-        $where[] = ["menuid", "in", $menuIds];
-        $roleIds = SysRelation::where($where)->group("roleid")->having("count(*)=" . count($codes))->column("roleid");
-
-        $where = [];
-        $where[] = ["status", "=", 1];
-        $where[] = ["roleid", "<>", 1];
-        $regstr = ",(" . implode("|", $roleIds) . "),";
-        $whereRaw = "concat(',',roleid,',') REGEXP '$regstr'";
-        $users = User::where($where)->whereRaw($whereRaw)->select();
-        foreach ($users as $user) {
-            switch ($user["type"]) {
-                case 1:
-                    if ($jjrc_count > 0 && $user["phone"]) {
-                        queue("app\job\Messenger", ["type" => 2, "userId" => $user["id"], "name" => $user["name"], "phone" => $user["phone"], "count" => $jjrc_count]);
-                    }
-                    break;
-                case 2:
-                    if ($ic_count > 0 && $user["phone"]) {
-                        queue("app\job\Messenger", ["type" => 2, "userId" => $user["id"], "name" => $user["name"], "phone" => $user["phone"], "count" => $ic_count]);
-                    }
-                    break;
+        $whereRaw = sprintf("submitEndTime is not null and submitEndTime<>'' and submitEndTime < '%s'", date("Y-m-d H:i:s"));
+        $batchs = \app\common\model\Batch::where($where)->whereRaw($whereRaw)->select();
+        if ($batchs) {
+            unset($where);
+            //存在激活的批次,并且有设置提交截止时间,且已经超过截止时间,则检查此批次的申报是否存在驳回或者尚在保存未提交状态
+            foreach ($batchs as $batch) {
+                $where[] = ["e.type", "=", $batch["source"]];
+                $where[] = ["ti.checkState", "=", TalentState::SCND_SAVE];
+                $where[] = ["apply_year", "in", $batch["batch"]];
+                $list = Talent::alias("ti")
+                                ->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")
+                                ->field("ti.*,e.type as enterpriseType")
+                                ->where($where)->select();
+                foreach ($list as $ti) {
+                    queue("app\job\Talent", ["type" => 2, "talentInfo" => $ti]);
+                }
             }
         }
     }

+ 2 - 1
app/command/ReVerifyChecker.php

@@ -29,7 +29,8 @@ class ReVerifyChecker extends Command {
     }
 
     protected function execute(Input $input, Output $output) {
-        $whereRaw = sprintf("(ti.checkState in (14,15,16)) or (ti.checkState=12 and ti.pass_dept_check=0) or (ti.checkState=10 and ti.pass_dept_check=1) or (ti.checkState=10 and (tc.companyIds is null or tc.companyIds = ''))");
+        $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 = ''))");
+        //$whereRaw = sprintf("(ti.checkState in (14,15,16)) or (ti.checkState=12 and ti.pass_dept_check=0) or (ti.checkState=10 and ti.pass_dept_check=1) or (ti.checkState=10 and (tc.companyIds is null or tc.companyIds = ''))");
         $where[] = ["ti.checkState", "in", [TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS]];
         $list = Talent::alias("ti")
                         ->leftJoin("new_talent_condition tc", "tc.id=ti.talent_condition")

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

@@ -108,7 +108,7 @@ class TalentLogApi {
 
     public static function writeDeptLogs($mainId, $companyIds, $state = []) {
         $user = session("user");
-        $last_log = self::getLastLog($mainId, 1);
+        $last_log = self::getLastLog($mainId, 1, 0, ["active", "=", 1]);
         for ($i = 0; $i < count($companyIds); $i++) {
             $log["last_state"] = $last_log["state"] ?: 0;
             $log["id"] = getStringId();
@@ -131,7 +131,7 @@ class TalentLogApi {
 
     public static function write($type, $mainId, $state = [], $description = "", $active = 0, $fileType = null, $fileId = null) {
         $user = session("user");
-        $last_log = self::getLastLog($mainId, $type);
+        $last_log = self::getLastLog($mainId, $type, 0, ["active", "=", 1]);
         $log["last_state"] = $last_log["state"] ?: 0;
         $log["id"] = getStringId();
         if (is_array($state)) {
@@ -187,7 +187,7 @@ class TalentLogApi {
 
     public static function system($type, $mainId, $state = [], $description = "", $active = 0, $fileType = null, $fileId = null) {
 
-        $last_log = self::getLastLog($mainId, $type);
+        $last_log = self::getLastLog($mainId, $type, 0, ["active", "=", 1]);
         $log["last_state"] = $last_log["state"] ?: 0;
         $log["id"] = getStringId();
         if (is_array($state)) {

+ 3 - 0
app/common/controller/Api.php

@@ -84,6 +84,7 @@ class Api extends BaseController {
     }
 
     public function getCheckLog() {
+        $userType = session("user")["usertype"];
         $params = $this->request->param();
         $mainId = $params["mainId"];
         $enterpriseId = $params["enterpriseId"];
@@ -116,6 +117,8 @@ class Api extends BaseController {
         }
         $new_list = [];
         foreach ($list as $key => $item) {
+            if (($item["createUser"] == "系统" || $item["updateUser"] == "系统") && $userType != 1)//非管理员用户不显示系统自动生成或修改的日志
+                continue;
             switch ($item['type']) {
                 case 20:
                     $new_item["stepName"] = IntegralState::getLogStepName($item["state"]);

+ 24 - 0
app/job/Talent.php

@@ -11,6 +11,7 @@ use app\common\api\TalentLogApi;
 use app\common\api\TalentConditionApi;
 use app\common\api\TalentState;
 use app\enterprise\model\Talent as TalentModel;
+use app\common\state\ProjectState;
 
 /**
  * Description of Talent
@@ -104,6 +105,29 @@ class Talent {
                     return true;
                 }
                 break;
+            case 2:
+                //超过批次提交时间驳回
+                $talentInfo = $data["talentInfo"];
+                $projectType = ProjectState::TALENT; //项目类型
+                $mainId = $talentInfo["id"]; //申报id
+                $checkState = TalentState::FST_VERIFY_FAIL; //系统审核失败状态,初审不通过
+                if ($talentInfo["checkState"] == TalentState::SCND_SAVE) {
+                    $where = [];
+                    $where[] = ["active", "=", 1];
+                    $where[] = ["type", "=", $projectType];
+                    $where[] = ["source", "=", $talentInfo["enterpriseType"]];
+                    $where[] = ["batch", "=", $talentInfo["apply_year"]];
+                    $whereRaw = sprintf("submitEndTime is not null and submitEndTime<>'' and submitEndTime < '%s'", date("Y-m-d H:i:s"));
+                    $batch = \app\common\model\Batch::where($where)->whereRaw($whereRaw)->find();
+                    if ($batch) {
+                        $save["id"] = $mainId;
+                        $save["checkState"] = $checkState;
+                        TalentModel::update($save);
+                        TalentLogApi::write($projectType, $mainId, $checkState, "超过该批次提交截止时间未提交审核,系统自动结束该申报", 1);
+                    }
+                    return true;
+                }
+                break;
         }
         return false;
     }