|
@@ -44,31 +44,65 @@ class Education extends PersonController {
|
|
|
$where[] = ["card_number", "=", $this->user["idCard"]];
|
|
|
$where[] = ["isEffect", "=", 1];
|
|
|
$talentInfo = \app\enterprise\model\Talent::where($where)->find();
|
|
|
- $talentCondition = \app\common\api\TalentConditionApi::getOne($talentInfo["talent_condition"]);
|
|
|
- $info["personId"] = $this->user["uid"];
|
|
|
- $info["type"] = $this->user["type"];
|
|
|
- $info["talentId"] = $talentInfo["id"];
|
|
|
- $info["pName"] = $talentInfo["name"];
|
|
|
- $info["pSex"] = $talentInfo["sex"];
|
|
|
- $info["pIdcard"] = $talentInfo["card_number"];
|
|
|
- $info["talentArrange"] = $talentInfo["talent_arrange"];
|
|
|
- $info["identifyCondition"] = $talentCondition["name"];
|
|
|
- $info["certificateStartTime"] = $talentInfo["certificateGetTime"];
|
|
|
- $info["qzgccrcActiveTime"] = $talentInfo["certificateExpireTime"];
|
|
|
- $info["certificateNo"] = $talentInfo["certificateNo"];
|
|
|
- $area = [];
|
|
|
- if ($talentInfo["province"]) {
|
|
|
- $area[] = Db::table("un_common_location")->where("code", "=", $talentInfo["province"])->findOrEmpty()["name"];
|
|
|
- }
|
|
|
- if ($talentInfo["city"]) {
|
|
|
- $area[] = Db::table("un_common_location")->where("code", "=", $talentInfo["city"])->findOrEmpty()["name"];
|
|
|
- }
|
|
|
- if ($talentInfo["county"]) {
|
|
|
- $area[] = Db::table("un_common_location")->where("code", "=", $talentInfo["county"])->findOrEmpty()["name"];
|
|
|
+ if ($talentInfo) {
|
|
|
+ $talentCondition = \app\common\api\TalentConditionApi::getOne($talentInfo["talent_condition"]);
|
|
|
+ $info["personId"] = $this->user["uid"];
|
|
|
+ $info["type"] = $this->user["type"];
|
|
|
+ $info["talentId"] = $talentInfo["id"];
|
|
|
+ $info["pName"] = $talentInfo["name"];
|
|
|
+ $info["pSex"] = $talentInfo["sex"];
|
|
|
+ $info["pIdcard"] = $talentInfo["card_number"];
|
|
|
+ $info["talentArrange"] = $talentInfo["talent_arrange"];
|
|
|
+ $info["identifyCondition"] = $talentCondition["name"];
|
|
|
+ $info["certificateStartTime"] = $talentInfo["certificateGetTime"];
|
|
|
+ $info["qzgccrcActiveTime"] = $talentInfo["certificateExpireTime"];
|
|
|
+ $info["certificateNo"] = $talentInfo["certificateNo"];
|
|
|
+ $area = [];
|
|
|
+ if ($talentInfo["province"]) {
|
|
|
+ $area[] = Db::table("un_common_location")->where("code", "=", $talentInfo["province"])->findOrEmpty()["name"];
|
|
|
+ }
|
|
|
+ if ($talentInfo["city"]) {
|
|
|
+ $area[] = Db::table("un_common_location")->where("code", "=", $talentInfo["city"])->findOrEmpty()["name"];
|
|
|
+ }
|
|
|
+ if ($talentInfo["county"]) {
|
|
|
+ $area[] = Db::table("un_common_location")->where("code", "=", $talentInfo["county"])->findOrEmpty()["name"];
|
|
|
+ }
|
|
|
+ $info["nativePlace"] = implode("", $area);
|
|
|
+ $info["certificateNo"] = $talentInfo["certificateNo"];
|
|
|
+ $info["phone"] = $talentInfo["phone"];
|
|
|
+ } else {
|
|
|
+ $oldWhere = [];
|
|
|
+ $oldWhere[] = ["idCard", "=", $this->user["idCard"]];
|
|
|
+ $oldWhere[] = ["checkState", "=", MainState::PASS];
|
|
|
+ $oldWhere[] = ["isPublic", "=", 6];
|
|
|
+ $oldWhere[] = ["isEffect", "=", 1];
|
|
|
+ $oldTalentInfo = Db::table("un_talent_info")->where($oldWhere)->find();
|
|
|
+
|
|
|
+ $info["personId"] = $this->user["uid"];
|
|
|
+ $info["type"] = $this->user["type"];
|
|
|
+ $info["talentId"] = $oldTalentInfo["id"];
|
|
|
+ $info["pName"] = $oldTalentInfo["name"];
|
|
|
+ $info["pSex"] = $oldTalentInfo["sex"];
|
|
|
+ $info["pIdcard"] = $oldTalentInfo["idCard"];
|
|
|
+ $info["talentArrange"] = $oldTalentInfo["talentArrange"];
|
|
|
+ $info["identifyCondition"] = $oldTalentInfo["identifyConditionName"];
|
|
|
+ $info["certificateStartTime"] = $oldTalentInfo["certificateStartTime"];
|
|
|
+ $info["qzgccrcActiveTime"] = $oldTalentInfo["qzgccrcActiveTime"];
|
|
|
+ $info["certificateNo"] = $oldTalentInfo["certificateNO"];
|
|
|
+ $area = [];
|
|
|
+ if ($oldTalentInfo["provinceName"]) {
|
|
|
+ $area[] = $oldTalentInfo["provinceName"];
|
|
|
+ }
|
|
|
+ if ($oldTalentInfo["cityName"]) {
|
|
|
+ $area[] = $oldTalentInfo["cityName"];
|
|
|
+ }
|
|
|
+ if ($oldTalentInfo["countyName"]) {
|
|
|
+ $area[] = $oldTalentInfo["countyName"];
|
|
|
+ }
|
|
|
+ $info["nativePlace"] = implode("", $area);
|
|
|
+ $info["certificateNo"] = $oldTalentInfo["certificateNO"];
|
|
|
+ $info["phone"] = $oldTalentInfo["phone"];
|
|
|
}
|
|
|
- $info["nativePlace"] = implode("", $area);
|
|
|
- $info["certificateNo"] = $talentInfo["certificateNo"];
|
|
|
- $info["phone"] = $talentInfo["phone"];
|
|
|
}
|
|
|
if ($request->isPost()) {
|
|
|
return $this->save($info, $request);
|
|
@@ -111,38 +145,72 @@ class Education extends PersonController {
|
|
|
$response->msg = "修改成功";
|
|
|
} else {
|
|
|
$talentInfo = \app\enterprise\api\TalentApi::getOne($info["talentId"]);
|
|
|
- if (!$talentInfo || $talentInfo["checkState"] != \app\common\api\TalentState::CERTIFICATED) {
|
|
|
- throw new ValidateException("未查询到有效的人才数据(根据证件号码匹配),无法申报");
|
|
|
- }
|
|
|
- if (!strtotime($talentInfo["certificateExpireTime"]) || strtotime($talentInfo["certificateExpireTime"]) < time()) {
|
|
|
- throw new ValidateException("您的人才证书已过期,请进行人才层次变更后再申报");
|
|
|
- }
|
|
|
- if ($this->user["type"] == 1 && $talentInfo["talent_arrange"] > 5) {
|
|
|
- throw new ValidateException("子女择校政策只针对第一至五层次人才!");
|
|
|
- }
|
|
|
-
|
|
|
$area = [];
|
|
|
- if ($talentInfo["province"]) {
|
|
|
- $area[] = Db::table("un_common_location")->where("code", "=", $talentInfo["province"])->findOrEmpty()["name"];
|
|
|
- }
|
|
|
- if ($talentInfo["city"]) {
|
|
|
- $area[] = Db::table("un_common_location")->where("code", "=", $talentInfo["city"])->findOrEmpty()["name"];
|
|
|
- }
|
|
|
- if ($talentInfo["county"]) {
|
|
|
- $area[] = Db::table("un_common_location")->where("code", "=", $talentInfo["county"])->findOrEmpty()["name"];
|
|
|
- }
|
|
|
+ if ($talentInfo) {
|
|
|
+ if (!$talentInfo || $talentInfo["checkState"] != \app\common\api\TalentState::CERTIFICATED || $talentInfo["isEffect"] != 1) {
|
|
|
+ throw new ValidateException("未查询到有效的人才数据(根据证件号码匹配),无法申报");
|
|
|
+ }
|
|
|
+ if (!strtotime($talentInfo["certificateExpireTime"]) || strtotime($talentInfo["certificateExpireTime"]) < time()) {
|
|
|
+ throw new ValidateException("您的人才证书已过期,请进行人才层次变更后再申报");
|
|
|
+ }
|
|
|
+ if ($this->user["type"] == 1 && $talentInfo["talent_arrange"] > 5) {
|
|
|
+ throw new ValidateException("子女择校政策只针对第一至五层次人才!");
|
|
|
+ }
|
|
|
|
|
|
- $data["id"] = getStringId();
|
|
|
- $data["personId"] = $this->user["uid"];
|
|
|
- $data["pName"] = $talentInfo["name"];
|
|
|
- $data["pSex"] = $talentInfo["sex"];
|
|
|
- $data["pIdcard"] = $talentInfo["card_number"];
|
|
|
- $data["talentArrange"] = $talentInfo["talent_arrange"];
|
|
|
- $talentCondition = \app\common\api\TalentConditionApi::getOne($talentInfo["talent_condition"]);
|
|
|
- $data["identifyCondition"] = $talentCondition["name"];
|
|
|
- $data["certificateNo"] = $talentInfo["certificateNo"];
|
|
|
- $data["certificateStartTime"] = $talentInfo["certificateGetTime"];
|
|
|
- $data["qzgccrcActiveTime"] = $talentInfo["certificateExpireTime"];
|
|
|
+ if ($talentInfo["province"]) {
|
|
|
+ $area[] = Db::table("un_common_location")->where("code", "=", $talentInfo["province"])->findOrEmpty()["name"];
|
|
|
+ }
|
|
|
+ if ($talentInfo["city"]) {
|
|
|
+ $area[] = Db::table("un_common_location")->where("code", "=", $talentInfo["city"])->findOrEmpty()["name"];
|
|
|
+ }
|
|
|
+ if ($talentInfo["county"]) {
|
|
|
+ $area[] = Db::table("un_common_location")->where("code", "=", $talentInfo["county"])->findOrEmpty()["name"];
|
|
|
+ }
|
|
|
+
|
|
|
+ $data["id"] = getStringId();
|
|
|
+ $data["personId"] = $this->user["uid"];
|
|
|
+ $data["pName"] = $talentInfo["name"];
|
|
|
+ $data["pSex"] = $talentInfo["sex"];
|
|
|
+ $data["pIdcard"] = $talentInfo["card_number"];
|
|
|
+ $data["talentArrange"] = $talentInfo["talent_arrange"];
|
|
|
+ $talentCondition = \app\common\api\TalentConditionApi::getOne($talentInfo["talent_condition"]);
|
|
|
+ $data["identifyCondition"] = $talentCondition["name"];
|
|
|
+ $data["certificateNo"] = $talentInfo["certificateNo"];
|
|
|
+ $data["certificateStartTime"] = $talentInfo["certificateGetTime"];
|
|
|
+ $data["qzgccrcActiveTime"] = $talentInfo["certificateExpireTime"];
|
|
|
+ } else {
|
|
|
+ $oldTalentInfo = Db::table("un_talent_info")->where("id", $info["talentId"])->find();
|
|
|
+ if (!$oldTalentInfo || $oldTalentInfo["checkState"] != MainState::PASS || $oldTalentInfo["isEffect"] != 1 || $oldTalentInfo["isPublic"] != 6) {
|
|
|
+ throw new ValidateException("未查询到有效的人才数据(根据证件号码匹配),无法申报");
|
|
|
+ }
|
|
|
+ if (!strtotime($oldTalentInfo["qzgccrcActiveTime"]) || strtotime($oldTalentInfo["qzgccrcActiveTime"]) < time()) {
|
|
|
+ throw new ValidateException("您的人才证书已过期,请进行人才层次变更后再申报");
|
|
|
+ }
|
|
|
+ if ($this->user["type"] == 1 && $oldTalentInfo["talentArrange"] > 5) {
|
|
|
+ throw new ValidateException("子女择校政策只针对第一至五层次人才!");
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($oldTalentInfo["provinceName"]) {
|
|
|
+ $area[] = $oldTalentInfo["provinceName"];
|
|
|
+ }
|
|
|
+ if ($oldTalentInfo["cityName"]) {
|
|
|
+ $area[] = $oldTalentInfo["cityName"];
|
|
|
+ }
|
|
|
+ if ($oldTalentInfo["countyName"]) {
|
|
|
+ $area[] = $oldTalentInfo["countyName"];
|
|
|
+ }
|
|
|
+
|
|
|
+ $data["id"] = getStringId();
|
|
|
+ $data["personId"] = $this->user["uid"];
|
|
|
+ $data["pName"] = $oldTalentInfo["name"];
|
|
|
+ $data["pSex"] = $oldTalentInfo["sex"];
|
|
|
+ $data["pIdcard"] = $oldTalentInfo["idCard"];
|
|
|
+ $data["talentArrange"] = $oldTalentInfo["talentArrange"];
|
|
|
+ $data["identifyCondition"] = $oldTalentInfo["identifyConditionName"];
|
|
|
+ $data["certificateNo"] = $oldTalentInfo["certificateNO"];
|
|
|
+ $data["certificateStartTime"] = $oldTalentInfo["certificateStartTime"];
|
|
|
+ $data["qzgccrcActiveTime"] = $oldTalentInfo["qzgccrcActiveTime"];
|
|
|
+ }
|
|
|
$data["nativePlace"] = implode("", $area);
|
|
|
$data["checkState"] = -2;
|
|
|
$data["createTime"] = date("Y-m-d H:i:s");
|
|
@@ -310,16 +378,24 @@ class Education extends PersonController {
|
|
|
$where[] = ["checkState", "=", \app\common\api\TalentState::CERTIFICATED];
|
|
|
$where[] = ["isEffect", "=", 1];
|
|
|
$list = \app\enterprise\model\Talent::where($where)->select()->toArray();
|
|
|
- if (!$list || count($list) == 0) {
|
|
|
+
|
|
|
+ $whereOld = [];
|
|
|
+ $whereOld[] = ["idCard", "=", $this->user["idCard"]];
|
|
|
+ $whereOld[] = ["isPublic", "=", 6];
|
|
|
+ $whereOld[] = ["checkState", "=", MainState::PASS];
|
|
|
+ $whereOld[] = ["isEffect", "=", 1];
|
|
|
+ $oldList = Db::table("un_talent_info")->where($whereOld)->select()->toArray();
|
|
|
+ if (!$list && !$oldList) {
|
|
|
$response->msg = "未查询到有效的人才数据(根据证件号码匹配),无法申报";
|
|
|
return json($response);
|
|
|
}
|
|
|
- if (count($list) > 1) {
|
|
|
+ $count = $list ? count($list) : count($oldList);
|
|
|
+ $expireTime = $list ? $list[0]["certificateExpireTime"] : $oldList[0]["qzgccrcActiveTime"];
|
|
|
+ if ($count > 1) {
|
|
|
$response->msg = "根据证件号码查询到多条在库数据,无法申报,可联系相关单位取消重复人才资格";
|
|
|
return json($response);
|
|
|
}
|
|
|
- $info = $list[0];
|
|
|
- if ($this->user["type"] == 1 && (!strtotime($info["certificateExpireTime"]) || strtotime($info["certificateExpireTime"]) < time())) {
|
|
|
+ if ($this->user["type"] == 1 && (!strtotime($expireTime) || strtotime($expireTime) < time())) {
|
|
|
$response->msg = "您的人才证书已过期,请进行人才层次变更后再申报";
|
|
|
return json($response);
|
|
|
}
|