Przeglądaj źródła

多次人才认定兼容按最高级别读取人才信息(需要配合配置文件)

sugangqiang 1 rok temu
rodzic
commit
c9594be725

+ 22 - 0
app/enterprise/controller/Talent.php

@@ -1601,7 +1601,29 @@ class Talent extends EnterpriseController {
         if ($sList) {
             $where[] = ["card_number", "not in", $sList];
         }
+        $twiceIdentifyPersons = \app\common\api\VerifyApi::getTwiceIdentifyPersons();
+        if ($twiceIdentifyPersons) {
+            $_whr = $where;
+            $where[] = ["card_number", "not in", $twiceIdentifyPersons];
+            $_whr[] = ["card_number", "in", $twiceIdentifyPersons];
+            $tmpList = TalentModel::where($_whr)->field("id,name")->select()->toArray();
+
+            $twiceIdentifyPersonList = [];
+            foreach ($tmpList as $person) {
+                if (!$twiceIdentifyPersonList[$person["card_number"]]) {
+                    $twiceIdentifyPersonList[$person["card_number"]] = $person;
+                } else {
+                    if ($person["talent_arrange"] < $twiceIdentifyPersonList[$person["card_number"]]["talent_arrange"]) {
+                        $twiceIdentifyPersonList[$person["card_number"]] = $person;
+                    }
+                }
+            }
+            sort($twiceIdentifyPersonList);
+        }
         $result = TalentModel::where($where)->field("id,name")->select()->toArray();
+        if ($twiceIdentifyPersonList) {
+            $result = array_merge($twiceIdentifyPersonList, (array) $result);
+        }
         return json($result);
     }
 

+ 37 - 14
app/enterprise/controller/TalentBasicChange.php

@@ -141,7 +141,30 @@ class TalentBasicChange extends EnterpriseController {
             $where[] = ["enterprise_id", "=", $this->user["uid"]];
             $where[] = ["id", "not in", $changes];
             $where[] = ["checkState", "=", \app\common\api\TalentState::CERTIFICATED];
+
+            $twiceIdentifyPersons = \app\common\api\VerifyApi::getTwiceIdentifyPersons();
+            if ($twiceIdentifyPersons) {
+                $_whr = $where;
+                $where[] = ["card_number", "not in", $twiceIdentifyPersons];
+                $_whr[] = ["card_number", "in", $twiceIdentifyPersons];
+                $tmpList = \app\enterprise\model\Talent::where($_whr)->field("id,name")->select()->toArray();
+
+                $twiceIdentifyPersonList = [];
+                foreach ($tmpList as $person) {
+                    if (!$twiceIdentifyPersonList[$person["card_number"]]) {
+                        $twiceIdentifyPersonList[$person["card_number"]] = $person;
+                    } else {
+                        if ($person["talent_arrange"] < $twiceIdentifyPersonList[$person["card_number"]]["talent_arrange"]) {
+                            $twiceIdentifyPersonList[$person["card_number"]] = $person;
+                        }
+                    }
+                }
+                sort($twiceIdentifyPersonList);
+            }
             $list = \app\enterprise\model\Talent::where($where)->field("id,name")->select()->toArray();
+            if ($twiceIdentifyPersonList) {
+                $list = array_merge($twiceIdentifyPersonList, (array) $list);
+            }
             $assigns["list"] = $list;
         }
         $assigns["type"] = $this->user["type"];
@@ -322,11 +345,11 @@ class TalentBasicChange extends EnterpriseController {
         return $response;
     }
 
-    public function htindex(){
+    public function htindex() {
         return view("", ["type" => $this->user["type"]]);
     }
 
-    public function htEndList(){
+    public function htEndList() {
         $offset = trim($this->request->param("offset")) ?: 0;
         $limit = trim($this->request->param("limit")) ?: 10;
         $name = trim($this->request->param("name"));
@@ -347,18 +370,18 @@ class TalentBasicChange extends EnterpriseController {
         }
         //dump($where);die;
 
-        $now = date("Y-m-d",time());
+        $now = date("Y-m-d", time());
         //$where[] = ["trim(SUBSTRING_INDEX(ti.labor_contract_rangetime,'-',-3))", "<", $now];
 
 
-        $count = Talent::alias("ti")->field("ti.id,ti.name,ti.card_number,ti.labor_contract_rangetime")->leftJoin("un_talent_basic_change tbc","ti.id = tbc.talentId")->where($where)->whereRaw("trim(SUBSTRING_INDEX(ti.labor_contract_rangetime,'-',-3)) < '{$now}' and tbc.id is null")->count();
-        $list = Talent::alias("ti")->field("ti.id,ti.name,ti.card_number,ti.labor_contract_rangetime")->leftJoin("un_talent_basic_change tbc","ti.id = tbc.talentId")->where($where)->whereRaw("trim(SUBSTRING_INDEX(ti.labor_contract_rangetime,'-',-3)) < '{$now}' and tbc.id is null")->limit($offset, $limit)->select()->toArray();
+        $count = Talent::alias("ti")->field("ti.id,ti.name,ti.card_number,ti.labor_contract_rangetime")->leftJoin("un_talent_basic_change tbc", "ti.id = tbc.talentId")->where($where)->whereRaw("trim(SUBSTRING_INDEX(ti.labor_contract_rangetime,'-',-3)) < '{$now}' and tbc.id is null")->count();
+        $list = Talent::alias("ti")->field("ti.id,ti.name,ti.card_number,ti.labor_contract_rangetime")->leftJoin("un_talent_basic_change tbc", "ti.id = tbc.talentId")->where($where)->whereRaw("trim(SUBSTRING_INDEX(ti.labor_contract_rangetime,'-',-3)) < '{$now}' and tbc.id is null")->limit($offset, $limit)->select()->toArray();
         //echo Talent::getLastSql();die;
 
         return json(["total" => $count, "rows" => $list]);
     }
 
-    public function htEndExport(){
+    public function htEndExport() {
         $where = [];
         $where[] = ["ti.delete", "=", 0];
         $where[] = ["ti.active", "=", 1];
@@ -366,10 +389,10 @@ class TalentBasicChange extends EnterpriseController {
         if (session("user")["usertype"] == 2) {
             $where[] = ["ti.enterprise_id", "=", session("user")["uid"]];
         }
-        $now = date("Y-m-d",time());
-        $count = Talent::alias("ti")->field("ti.id,ti.name,ti.card_number,ti.labor_contract_rangetime")->leftJoin("un_talent_basic_change tbc","ti.id = tbc.talentId")->where($where)->whereRaw("trim(SUBSTRING_INDEX(ti.labor_contract_rangetime,'-',-3)) < '{$now}' and tbc.id is null")->count();
+        $now = date("Y-m-d", time());
+        $count = Talent::alias("ti")->field("ti.id,ti.name,ti.card_number,ti.labor_contract_rangetime")->leftJoin("un_talent_basic_change tbc", "ti.id = tbc.talentId")->where($where)->whereRaw("trim(SUBSTRING_INDEX(ti.labor_contract_rangetime,'-',-3)) < '{$now}' and tbc.id is null")->count();
 
-        if($count > 0){
+        if ($count > 0) {
             $columns = [
                 '姓名',
                 '证件号码',
@@ -378,20 +401,20 @@ class TalentBasicChange extends EnterpriseController {
             $setting = [];
             $setting["freeze"] = "A2";
             $setting["filter"] = sprintf("A1:%s1", getExcelColumnByIndex(count($columns) - 1));
-            $lists = Talent::alias("ti")->field("ti.id,ti.name,ti.card_number,ti.labor_contract_rangetime")->leftJoin("un_talent_basic_change tbc","ti.id = tbc.talentId")->where($where)->whereRaw("trim(SUBSTRING_INDEX(ti.labor_contract_rangetime,'-',-3)) < '{$now}' and tbc.id is null")->select()->toArray();
+            $lists = Talent::alias("ti")->field("ti.id,ti.name,ti.card_number,ti.labor_contract_rangetime")->leftJoin("un_talent_basic_change tbc", "ti.id = tbc.talentId")->where($where)->whereRaw("trim(SUBSTRING_INDEX(ti.labor_contract_rangetime,'-',-3)) < '{$now}' and tbc.id is null")->select()->toArray();
             $datas = [];
-            foreach ($lists as $v){
+            foreach ($lists as $v) {
                 $item = [
                     $v['name'],
                     $v['card_number'],
                     $v['labor_contract_rangetime']
                 ];
-                array_push($datas,$item);
+                array_push($datas, $item);
             }
             export($columns, $datas, "合同到期列表导出", $setting);
-        }else{
+        } else {
             echo "<script>parent.layer.alert('没有可以导出的数据');window.history.go(-1);</script>";
         }
-
     }
+
 }

+ 1 - 1
app/enterprise/controller/TalentQuit.php

@@ -249,7 +249,7 @@ class TalentQuit extends EnterpriseController {
         if ($active) {
             $where[] = ["active", "=", $active];
         }
-        $ti = \app\enterprise\model\Talent::where($where)->order("createTime desc")->find();
+        $ti = \app\enterprise\model\Talent::where($where)->order("talent_arrange asc")->find();
         return $ti;
     }
 

+ 1 - 1
app/enterprise/controller/TalentTypeChange.php

@@ -64,7 +64,7 @@ class TalentTypeChange extends EnterpriseController {
             $where[] = ["card_number", "=", $data["idCard"]];
             $where[] = ["checkState", "=", TalentState::CERTIFICATED];
             $where[] = ["delete", "=", 0];
-            $talentInfo = Db::table("new_talent_info")->where($where)->find();
+            $talentInfo = Db::table("new_talent_info")->where($where)->order("talent_arrange asc")->find();
         } else {
             $talentInfo = TalentApi::getOne($data["talentId"]);
         }

+ 1 - 1
app/enterprise/controller/TalentWorkUnitChange.php

@@ -217,7 +217,7 @@ class TalentWorkUnitChange extends EnterpriseController {
         if ($active) {
             $where[] = ["active", "=", $active];
         }
-        $ti = \app\enterprise\model\Talent::where($where)->order("createTime desc")->find();
+        $ti = \app\enterprise\model\Talent::where($where)->order("talent_arrange asc")->find();
         return $ti;
     }
 

+ 1 - 1
app/person/controller/Education.php

@@ -43,7 +43,7 @@ class Education extends PersonController {
             $where[] = ["checkState", "=", \app\common\api\TalentState::CERTIFICATED];
             $where[] = ["card_number", "=", $this->user["idCard"]];
             $where[] = ["isEffect", "=", 1];
-            $talentInfo = \app\enterprise\model\Talent::where($where)->find();
+            $talentInfo = \app\enterprise\model\Talent::where($where)->order("talent_arrange asc")->find();
             if ($talentInfo) {
                 $talentCondition = \app\common\api\TalentConditionApi::getOne($talentInfo["talent_condition"]);
                 $info["personId"] = $this->user["uid"];