Browse Source

工作单位变更及离职兼容旧系统数据

sugangqiang 1 year ago
parent
commit
1e7fee99fb

+ 14 - 0
app/admin/controller/TalentQuit.php

@@ -63,6 +63,20 @@ class TalentQuit extends AdminController {
             $responseObj->msg = "系统错误,请联系管理员";
             $responseObj->msg = "系统错误,请联系管理员";
             return $responseObj;
             return $responseObj;
         }
         }
+        if (strlen($info["talentId"]) == 19) {
+            //旧系统申请兼容处理
+            unset($where);
+            $where[] = ["card_number", "=", $info["idCard"]];
+            $where[] = ["checkState", "=", \app\common\api\TalentState::CERTIFICATED];
+            $where[] = ["active", "=", 1];
+            $where[] = ["delete", "=", 0];
+            $ti = \app\enterprise\model\Talent::where($where)->order("createTime desc")->find();
+            if (!$ti) {
+                $responseObj->msg = "未匹配到人才数据";
+                return $responseObj;
+            }
+            $info["talentId"] = $ti["id"];
+        }
         if (!$checkState) {
         if (!$checkState) {
             $responseObj->msg = "请选择审核状态";
             $responseObj->msg = "请选择审核状态";
             return $responseObj;
             return $responseObj;

+ 15 - 0
app/admin/controller/TalentWorkUnitChange.php

@@ -84,6 +84,21 @@ class TalentWorkUnitChange extends AdminController {
             $responseObj->msg = "系统错误,请联系管理员";
             $responseObj->msg = "系统错误,请联系管理员";
             return $responseObj;
             return $responseObj;
         }
         }
+        if (strlen($info["talentId"]) == 19) {
+            //旧系统申请兼容处理
+            unset($where);
+            $where[] = ["enterprise_id", "=", $info["oldEnterpriseId"]];
+            $where[] = ["card_number", "=", $info["idCard"]];
+            $where[] = ["checkState", "=", \app\common\api\TalentState::CERTIFICATED];
+            $where[] = ["active", "=", 2];
+            $where[] = ["delete", "=", 0];
+            $ti = \app\enterprise\model\Talent::where($where)->order("createTime desc")->find();
+            if (!$ti) {
+                $responseObj->msg = "未匹配到人才数据";
+                return $responseObj;
+            }
+            $info["talentId"] = $ti["id"];
+        }
         if (!$checkState) {
         if (!$checkState) {
             $responseObj->msg = "请选择审核状态";
             $responseObj->msg = "请选择审核状态";
             return $responseObj;
             return $responseObj;

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

@@ -1528,28 +1528,28 @@ class Talent extends EnterpriseController {
         if ($type == ProjectState::QUIT) {
         if ($type == ProjectState::QUIT) {
             $_where = [];
             $_where = [];
             $_where[] = ["checkState", "not in", [3]];
             $_where[] = ["checkState", "not in", [3]];
-            $talentIds = Db::table("un_talent_quit")->where($_where)->column("talentId");
-            $sList = array_merge($sList, (array) $talentIds);
+            $idCards = Db::table("un_talent_quit")->where($_where)->column("idCard");
+            $sList = array_merge($sList, (array) $idCards);
             $where[] = ["active", "=", 1];
             $where[] = ["active", "=", 1];
         }
         }
         if ($type == ProjectState::BANKCHANGE) {
         if ($type == ProjectState::BANKCHANGE) {
             $_where = [];
             $_where = [];
             $_where[] = ["checkState", "not in", [3]];
             $_where[] = ["checkState", "not in", [3]];
-            $talentIds = Db::table("un_talent_bank_change")->where($_where)->column("talentId");
-            $sList = array_merge($sList, (array) $talentIds);
+            $idCards = Db::table("un_talent_bank_change")->where($_where)->column("idCard");
+            $sList = array_merge($sList, (array) $idCards);
         }
         }
         if ($type == ProjectState::LEVELCHANGE) {
         if ($type == ProjectState::LEVELCHANGE) {
             $_where = [];
             $_where = [];
             $_where[] = ["checkState", "not in", [35, -1]];
             $_where[] = ["checkState", "not in", [35, -1]];
             $_where[] = ["isPublic", "<", 5];
             $_where[] = ["isPublic", "<", 5];
-            $talentIds = Db::table("un_talent_type_change")->where($_where)->column("talentId");
-            $sList = array_merge($sList, (array) $talentIds);
+            $idCards = Db::table("un_talent_type_change")->where($_where)->column("idCard");
+            $sList = array_merge($sList, (array) $idCards);
         }
         }
         $where[] = ["enterprise_id", "=", $this->user["uid"]];
         $where[] = ["enterprise_id", "=", $this->user["uid"]];
         $where[] = ["checkState", "=", TalentState::CERTIFICATED];
         $where[] = ["checkState", "=", TalentState::CERTIFICATED];
         $where[] = ["isEffect", "<>", 4];
         $where[] = ["isEffect", "<>", 4];
         if ($sList) {
         if ($sList) {
-            $where[] = ["id", "not in", $sList];
+            $where[] = ["card_number", "not in", $sList];
         }
         }
         $result = TalentModel::where($where)->field("id,name")->select()->toArray();
         $result = TalentModel::where($where)->field("id,name")->select()->toArray();
         return json($result);
         return json($result);
@@ -1561,34 +1561,39 @@ class Talent extends EnterpriseController {
         $type = $this->request->param('type');
         $type = $this->request->param('type');
         if ($type == ProjectState::QUIT) {
         if ($type == ProjectState::QUIT) {
             $info = Db::table("un_talent_quit")->where("id", $id)->find();
             $info = Db::table("un_talent_quit")->where("id", $id)->find();
-            $where[] = ["id", "=", $info["talentId"]];
         }
         }
         if ($type == ProjectState::LEVELCHANGE) {
         if ($type == ProjectState::LEVELCHANGE) {
             $info = Db::table("un_talent_type_change")->where("id", $id)->find();
             $info = Db::table("un_talent_type_change")->where("id", $id)->find();
-            $where[] = ["id", "=", $info["talentId"]];
         }
         }
         if ($type == ProjectState::BANKCHANGE) {
         if ($type == ProjectState::BANKCHANGE) {
             $info = Db::table("un_talent_bank_change")->where("id", $id)->find();
             $info = Db::table("un_talent_bank_change")->where("id", $id)->find();
+        }
+        if (strlen($info["talentId"]) == 19) {
+            $where[] = ["enterprise_id", "=", $this->user["uid"]];
+            $where[] = ["card_number", "=", $info["idCard"]];
+            $where[] = ["delete", "=", 0];
+            $where[] = ["checkState", "=", TalentState::CERTIFICATED];
+        } else {
             $where[] = ["id", "=", $info["talentId"]];
             $where[] = ["id", "=", $info["talentId"]];
         }
         }
         $result = TalentModel::where($where)->field("id,name")->select()->toArray();
         $result = TalentModel::where($where)->field("id,name")->select()->toArray();
         return json($result);
         return json($result);
     }
     }
-    
-    public function getTalentBasicById(){        
+
+    public function getTalentBasicById() {
         $id = $this->request["id"];
         $id = $this->request["id"];
         $ti = \app\common\api\VerifyApi::getTalentInfoById($id);
         $ti = \app\common\api\VerifyApi::getTalentInfoById($id);
-        /*if(FengStringUtil.isNotEmpAndNull(year)){
-            StringBuilder sb = new StringBuilder();
-            List<TalentAllowancecontractDetail> contractDetailList = new ArrayList<>();     //保存上一年度的工作单位
-            TalentAllowanceInfo info = new TalentAllowanceInfo();
-            info.setType(ti.getType());
-            info.setYear(year);
-            info.setFirstInJJTime(ti.getFirstInJJTime());
-            ApiTalentAllowanceController.getConcatList(ti,info,year,sb,contractDetailList);
-            int active = AllowanceSelectUtil.validMyqy(contractDetailList,ti,info);
-            ti.setActive(active);
-        }*/
+        /* if(FengStringUtil.isNotEmpAndNull(year)){
+          StringBuilder sb = new StringBuilder();
+          List<TalentAllowancecontractDetail> contractDetailList = new ArrayList<>();     //保存上一年度的工作单位
+          TalentAllowanceInfo info = new TalentAllowanceInfo();
+          info.setType(ti.getType());
+          info.setYear(year);
+          info.setFirstInJJTime(ti.getFirstInJJTime());
+          ApiTalentAllowanceController.getConcatList(ti,info,year,sb,contractDetailList);
+          int active = AllowanceSelectUtil.validMyqy(contractDetailList,ti,info);
+          ti.setActive(active);
+          } */
         return $ti;
         return $ti;
     }
     }
 
 

+ 22 - 6
app/enterprise/controller/TalentQuit.php

@@ -58,6 +58,10 @@ class TalentQuit extends EnterpriseController {
         $request = $this->request;
         $request = $this->request;
         $id = isset($request["id"]) ? $request["id"] : 0;
         $id = isset($request["id"]) ? $request["id"] : 0;
         $info = TqModel::where("id", $id)->find();
         $info = TqModel::where("id", $id)->find();
+        if (strlen($info["talentId"]) == 19) {
+            $newTalentInfo = $this->getTalentInfoByIdCard($info["idCard"]);
+            $info["talentId"] = $newTalentInfo["id"];
+        }
         if ($this->request->isPost()) {
         if ($this->request->isPost()) {
             $response = new \stdClass();
             $response = new \stdClass();
             $response->code = 500;
             $response->code = 500;
@@ -110,6 +114,10 @@ class TalentQuit extends EnterpriseController {
     public function view() {
     public function view() {
         $id = $this->request["id"];
         $id = $this->request["id"];
         $info = TqModel::where("id", $id)->find();
         $info = TqModel::where("id", $id)->find();
+        if (strlen($info["talentId"]) == 19) {
+            $newTalentInfo = $this->getTalentInfoByIdCard($info["idCard"]);
+            $info["talentId"] = $newTalentInfo["id"];
+        }
         return view("", ["row" => $info]);
         return view("", ["row" => $info]);
     }
     }
 
 
@@ -208,12 +216,8 @@ class TalentQuit extends EnterpriseController {
         }
         }
         $ti = \app\common\api\VerifyApi::getTalentInfoById($talentQuit["talentId"]);
         $ti = \app\common\api\VerifyApi::getTalentInfoById($talentQuit["talentId"]);
         if (!$ti) {
         if (!$ti) {
-            unset($where);
-            $where[] = ["card_number", "=", $idCard];
-            $where[] = ["checkState", "=", \app\common\api\TalentState::CERTIFICATED];
-            $where[] = ["active", "=", 2];
-            $where[] = ["delete", "=", 0];
-            $ti = \app\enterprise\model\Talent::where($where)->order("createTime desc")->find();
+            $ti = $this->getTalentInfoByIdCard($idCard, 2);
+            $talentQuit["talentId"] = $ti["id"];
         }
         }
         if (!$ti) {
         if (!$ti) {
             $responseObj->msg = "未匹配到人才数据";
             $responseObj->msg = "未匹配到人才数据";
@@ -235,6 +239,18 @@ class TalentQuit extends EnterpriseController {
         return $responseObj;
         return $responseObj;
     }
     }
 
 
+    private function getTalentInfoByIdCard($idCard, $active = null) {
+        $where[] = ["enterprise_id", "=", $this->user["uid"]];
+        $where[] = ["card_number", "=", $idCard];
+        $where[] = ["checkState", "=", \app\common\api\TalentState::CERTIFICATED];
+        $where[] = ["delete", "=", 0];
+        if ($active) {
+            $where[] = ["active", "=", $active];
+        }
+        $ti = \app\enterprise\model\Talent::where($where)->order("createTime desc")->find();
+        return $ti;
+    }
+
     private function dataCheck($data) {
     private function dataCheck($data) {
         $response = new \stdClass();
         $response = new \stdClass();
         $response->code = 500;
         $response->code = 500;

+ 4 - 0
app/enterprise/controller/TalentWorkUnitChange.php

@@ -77,6 +77,10 @@ class TalentWorkUnitChange extends EnterpriseController {
                 return $check;
                 return $check;
             }
             }
             $talentInfo = \app\common\api\VerifyApi::getTalentInfoById($request["talentId"]);
             $talentInfo = \app\common\api\VerifyApi::getTalentInfoById($request["talentId"]);
+            if (!$talentInfo) {
+                $response->msg = "未匹配到人才数据";
+                return $response;
+            }
             if ($data["id"]) {
             if ($data["id"]) {
                 unset($data["year"]);
                 unset($data["year"]);
                 $data["updateUser"] = $this->user["uid"];
                 $data["updateUser"] = $this->user["uid"];