소스 검색

津补贴兼容两次认证(在配置文件中设置重复认证的证件号)

sugangqiang 1 년 전
부모
커밋
1c958a9211
5개의 변경된 파일133개의 추가작업 그리고 6개의 파일을 삭제
  1. 4 2
      app/common.php
  2. 8 3
      app/common/api/VerifyApi.php
  3. 30 0
      app/enterprise/controller/Talent.php
  4. 59 0
      app/enterprise/controller/TalentAllowance.php
  5. 32 1
      app/job/TalentAllowance.php

+ 4 - 2
app/common.php

@@ -646,8 +646,10 @@ function bubbleSort($array, $sortkey, $order = "asc") {
     $length = count($array);
     for ($i = 0; $i < $length - 1; $i++) {
         for ($j = 0; $j < $length - $i - 1; $j++) {
-            $v1 = intval($array[$j][$sortkey]) ?: 0;
-            $v2 = intval($array[$j + 1][$sortkey]) ?: 0;
+            $v1 = 0;
+            $v2 = 0;
+            $v1 = strtotime($array[$j][$sortkey]) > 0 ? strtotime($array[$j][$sortkey]) : intval($array[$j][$sortkey]);
+            $v2 = strtotime($array[$j + 1][$sortkey]) > 0 ? strtotime($array[$j + 1][$sortkey]) : intval($array[$j + 1][$sortkey]);
             if ($v1 > $v2) {
                 $temp = $array[$j];
                 $array[$j] = $array[$j + 1];

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

@@ -1174,11 +1174,11 @@ 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 {
@@ -1187,7 +1187,7 @@ class VerifyApi {
                                 continue;
                             }
                             $verifyDepts[$k] .= "(待审核)";
-                            $item["deptWait"] ++;
+                            $item["deptWait"]++;
                         }
                     }
                     $item["verifyDepts"] = implode(chr(10), $verifyDepts);
@@ -1375,4 +1375,9 @@ class VerifyApi {
         return in_array($company["code"], $config["companys"]) || in_array($account, $config["users"]);
     }
 
+    public static function getTwiceIdentifyPersons() {
+        $twiceIdentifyPersons = getJsonConfig("../sys_config.json", "twice_indentify_person");
+        return $twiceIdentifyPersons;
+    }
+
 }

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

@@ -1691,7 +1691,34 @@ class Talent extends EnterpriseController {
         $whr[] = ["ti.enterprise_id", "=", $this->user["uid"]];
         $whr[] = ["e.type", "=", $this->user["type"]];
         $whr[] = ["ti.id", "not in", $ids];
+        $twiceIdentifyPersons = \app\common\api\VerifyApi::getTwiceIdentifyPersons();
+        if ($twiceIdentifyPersons) {
+            $_whr = $whr;
+            $whr[] = ["card_number", "not in", $twiceIdentifyPersons];
+            $_whr[] = ["card_number", "in", $twiceIdentifyPersons];
+            $tmpList = TalentModel::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.*,e.`type` as eType")->order("identifyMonth desc")->where($_whr)->select()->toArray();
+
+            $twiceIdentifyPersonList = [];
+            $otherTypeChangeList = [];
+            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"]) {
+                        $otherTypeChangeList[$person["card_number"]][] = ["oldIdentifyMonth" => $twiceIdentifyPersonList[$person["card_number"]]["identifyMonth"], "oldIdentifyGetTime" => $twiceIdentifyPersonList[$person["card_number"]]["identifyGetTime"]];
+                        $twiceIdentifyPersonList[$person["card_number"]] = $person;
+                    } else {
+                        $otherTypeChangeList[$person["card_number"]][] = ["oldIdentifyMonth" => $person["identifyMonth"], "oldIdentifyGetTime" => $person["identifyGetTime"]];
+                    }
+                }
+            }
+            sort($twiceIdentifyPersonList);
+        }
         $list = TalentModel::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.*,e.`type` as eType")->order("identifyMonth desc")->where($whr)->select()->toArray();
+        if ($twiceIdentifyPersonList) {
+            $list = array_merge((array) $list, $twiceIdentifyPersonList);
+            $list = bubbleSort($list, "identifyMonth", "desc");
+        }
         foreach ($list as $info) {
             $info["enterpriseName"] = $this->user["name"];
             $identifyTime = $info["identifyMonth"];
@@ -1706,6 +1733,9 @@ class Talent extends EnterpriseController {
                 $whereTypeChange[] = ["checkState", "=", \app\common\state\MainState::PASS];
                 $whereTypeChange[] = ["isPublic", "=", 6];
                 $typeChanges = \app\enterprise\model\TalentTypeChange::where($whereTypeChange)->select()->toArray();
+                if ($otherTypeChangeList[$info["card_number"]]) {
+                    $typeChanges = array_merge($otherTypeChangeList[$info["card_number"]], (array) $typeChanges);
+                }
                 foreach ($typeChanges as $typeChange) {
                     $oldIdentifyTime = $typeChange["oldIdentifyMonth"];
                     if ($typeChange["type"] == CommonConst::ENTERPRISE_JC) {

+ 59 - 0
app/enterprise/controller/TalentAllowance.php

@@ -463,6 +463,36 @@ class TalentAllowance extends EnterpriseController {
             "newIdentifyMonth" => $year . "-12-31",
             "newIdentifyGetTime" => $year . "-12-31"
         ];
+        if (in_array($info["idCard"], \app\common\api\VerifyApi::getTwiceIdentifyPersons())) {
+            $whr = [];
+            $whr[] = ["ti.checkState", "=", \app\common\api\TalentState::CERTIFICATED];
+            $whr[] = ["ti.enterprise_id", "=", $this->user["uid"]];
+            $whr[] = ["e.type", "=", $this->user["type"]];
+            $whr[] = ["ti.id", "<>", $talentInfo["id"]];
+            $whr[] = ["card_number", "=", $info["idCard"]];
+            $otherChangeList = \app\enterprise\model\Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.*,e.`type` as eType")->order("identifyMonth desc")->where($whr)->select()->toArray();
+            foreach ($otherChangeList as $k => $oc) {
+                if ($k == 0) {
+                    $newIdentifyMonth = $talentInfo["identifyMonth"];
+                    $newIdentifyGetTime = $talentInfo["identifyGetTime"];
+                } else {
+                    $newIdentifyMonth = $oc[$k - 1]["identifyMonth"];
+                    $newIdentifyGetTime = $oc[$k - 1]["identifyGetTime"];
+                }
+                $typeList[] = [
+                    "oldTalentArrange" => $oc["talent_arrange"],
+                    "oldIdentifyCondition" => $oc["talent_condition"],
+                    "oldIdentifyGetTime" => $oc["identifyGetTime"],
+                    "oldIdentifyOutTime" => $oc["identifyExpireTime"],
+                    "oldIdentifyMonth" => $oc["identifyMonth"],
+                    "oldCertificateStartTime" => $oc["certificateGetTime"],
+                    "oldCertificateOutTime" => $oc["certificateExpireTime"],
+                    "newIdentifyMonth" => $newIdentifyMonth,
+                    "newIdentifyGetTime" => $newIdentifyGetTime
+                ];
+            }
+        }
+
         $totalMonth = \DateUtil::getMonthBetweenDates($year . "-01-01", $year . "-12-31");
         /*         * 获取上一年度有效的人才层次 */
         usort($typeList, function($a, $b) {
@@ -1049,7 +1079,33 @@ class TalentAllowance extends EnterpriseController {
             $whr[] = ["ti.enterprise_id", "=", $this->user["uid"]];
             $whr[] = ["e.type", "=", $this->user["type"]];
             $whr[] = ["ti.id", "not in", $ids];
+            $twiceIdentifyPersons = \app\common\api\VerifyApi::getTwiceIdentifyPersons();
+            if ($twiceIdentifyPersons) {
+                $_whr = $whr;
+                $whr[] = ["card_number", "not in", $twiceIdentifyPersons];
+                $_whr[] = ["card_number", "in", $twiceIdentifyPersons];
+                $tmpList = \app\enterprise\model\Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.id,ti.name,ti.card_number as idCard,ti.cur_entry_time,e.`type` as eType")->where($_whr)->select()->toArray();
+
+                $twiceIdentifyPersonList = [];
+                $otherTypeChangeList = [];
+                foreach ($tmpList as $person) {
+                    if (!$twiceIdentifyPersonList[$person["idCard"]]) {
+                        $twiceIdentifyPersonList[$person["idCard"]] = $person;
+                    } else {
+                        if ($person["talent_arrange"] < $twiceIdentifyPersonList[$person["idCard"]]["talent_arrange"]) {
+                            $otherTypeChangeList[$person["idCard"]][] = ["oldIdentifyMonth" => $twiceIdentifyPersonList[$person["idCard"]]["identifyMonth"], "oldIdentifyGetTime" => $twiceIdentifyPersonList[$person["idCard"]]["identifyGetTime"]];
+                            $twiceIdentifyPersonList[$person["idCard"]] = $person;
+                        } else {
+                            $otherTypeChangeList[$person["idCard"]][] = ["oldIdentifyMonth" => $person["identifyMonth"], "oldIdentifyGetTime" => $person["identifyGetTime"]];
+                        }
+                    }
+                }
+                sort($twiceIdentifyPersonList);
+            }
             $list = \app\enterprise\model\Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.id,ti.name,ti.card_number as idCard,ti.cur_entry_time,e.`type` as eType")->where($whr)->select()->toArray();
+            if ($twiceIdentifyPersonList) {
+                $list = array_merge((array) $list, $twiceIdentifyPersonList);
+            }
             foreach ($list as $info) {
                 $identifyTime = $info["identifyMonth"];
                 if ($info["eType"] == CommonConst::ENTERPRISE_JC) {
@@ -1063,6 +1119,9 @@ class TalentAllowance extends EnterpriseController {
                     $whereTypeChange[] = ["checkState", "=", MainState::PASS];
                     $whereTypeChange[] = ["isPublic", "=", 6];
                     $typeChanges = TalentTypeChange::where($whereTypeChange)->select()->toArray();
+                    if ($otherTypeChangeList[$info["idCard"]]) {
+                        $typeChanges = array_merge($otherTypeChangeList[$info["idCard"]], (array) $typeChanges);
+                    }
                     foreach ($typeChanges as $typeChange) {
                         $oldIdentifyTime = $typeChange["oldIdentifyMonth"];
                         if ($typeChange["type"] == CommonConst::ENTERPRISE_JC) {

+ 32 - 1
app/job/TalentAllowance.php

@@ -59,7 +59,7 @@ class TalentAllowance {
                         $where[] = ["card_number", "=", $importRow[1]];
                         $where[] = ["delete", "=", 0];
                         $where[] = ["checkState", "=", TalentState::CERTIFICATED];
-                        $ti = Db::table("new_talent_info")->where($where)->find();
+                        $ti = Db::table("new_talent_info")->where($where)->order("talent_arrange asc")->find();
                         $talentId = $ti["id"];
                         $ti = \app\common\api\VerifyApi::getTalentInfoById($talentId);
                         if ($ti["talent_type"] == 1 && $ti["enterpriseType"] == \app\common\state\CommonConst::ENTERPRISE_WJ && $allowanceType == AllowanceTypeEnum::JBT_JT) {
@@ -214,6 +214,37 @@ class TalentAllowance {
             "newIdentifyMonth" => $year . "-12-31",
             "newIdentifyGetTime" => $year . "-12-31"
         ];
+
+        if (in_array($info["idCard"], \app\common\api\VerifyApi::getTwiceIdentifyPersons())) {
+            $whr = [];
+            $whr[] = ["ti.checkState", "=", TalentState::CERTIFICATED];
+            $whr[] = ["ti.enterprise_id", "=", $talentInfo["enterpriseId"]];
+            $whr[] = ["e.type", "=", $talentInfo["enterpriseType"]];
+            $whr[] = ["ti.id", "<>", $talentInfo["id"]];
+            $whr[] = ["card_number", "=", $info["idCard"]];
+            $otherChangeList = \app\enterprise\model\Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.*,e.`type` as eType")->order("identifyMonth desc")->where($whr)->select()->toArray();
+            foreach ($otherChangeList as $k => $oc) {
+                if ($k == 0) {
+                    $newIdentifyMonth = $talentInfo["identifyMonth"];
+                    $newIdentifyGetTime = $talentInfo["identifyGetTime"];
+                } else {
+                    $newIdentifyMonth = $oc[$k - 1]["identifyMonth"];
+                    $newIdentifyGetTime = $oc[$k - 1]["identifyGetTime"];
+                }
+                $typeList[] = [
+                    "oldTalentArrange" => $oc["talent_arrange"],
+                    "oldIdentifyCondition" => $oc["talent_condition"],
+                    "oldIdentifyGetTime" => $oc["identifyGetTime"],
+                    "oldIdentifyOutTime" => $oc["identifyExpireTime"],
+                    "oldIdentifyMonth" => $oc["identifyMonth"],
+                    "oldCertificateStartTime" => $oc["certificateGetTime"],
+                    "oldCertificateOutTime" => $oc["certificateExpireTime"],
+                    "newIdentifyMonth" => $newIdentifyMonth,
+                    "newIdentifyGetTime" => $newIdentifyGetTime
+                ];
+            }
+        }
+
         $totalMonth = \DateUtil::getMonthBetweenDates($year . "-01-01", $year . "-12-31");
         /*         * 获取上一年度有效的人才层次 */
         usort($typeList, function($a, $b) {