sugangqiang 2 년 전
부모
커밋
ec09962e69
2개의 변경된 파일86개의 추가작업 그리고 0개의 파일을 삭제
  1. 85 0
      app/command/ExpireVerifyChecker.php
  2. 1 0
      config/console.php

+ 85 - 0
app/command/ExpireVerifyChecker.php

@@ -0,0 +1,85 @@
+<?php
+
+declare (strict_types=1);
+
+namespace app\command;
+
+use think\console\Command;
+use think\console\Input;
+use think\console\input\Argument;
+use think\console\input\Option;
+use think\console\Output;
+use think\facade\Db;
+use think\facade\Log;
+use app\enterprise\model\Talent;
+use app\common\api\TalentState;
+use app\common\api\MenuApi;
+use app\admin\model\SysRelation;
+use app\admin\model\User;
+
+/**
+ * 人才认定过期检测
+ */
+class ExpireVerifyChecker extends Command {
+
+    protected function configure() {
+        // 指令配置
+        $this->setName('ExpireVerifyChecker')
+                ->setDescription('Expire Verify Checker');
+    }
+
+    protected function execute(Input $input, Output $output) {
+        $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 createTime in (select max(createTime) 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 createTime in (select max(createTime) 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;
+            }
+        }
+    }
+
+}

+ 1 - 0
config/console.php

@@ -10,5 +10,6 @@ return [
         "FstVerifyChecker" => "app\command\FstVerifyChecker", //人才认定初审阶段检查
         "RegisterMessenger" => "app\command\RegisterMessenger", //注册短信提醒后台审核
         "DeptVerifyChecker" => "app\command\DeptVerifyChecker", //人才认定部门审核阶段检查
+        "ExpireVerifyChecker" => "app\command\ExpireVerifyChecker", //人才认定过期检查
     ],
 ];