|
@@ -269,10 +269,11 @@ class Talent extends EnterpriseController {
|
|
exit;
|
|
exit;
|
|
}
|
|
}
|
|
$checkState = $info["checkState"];
|
|
$checkState = $info["checkState"];
|
|
- if ($checkState == TalentState::SCND_SAVE || $checkState == TalentState::BASE_REVERIFY_PASS) {
|
|
|
|
- $field_dict = \app\common\api\DictApi::getTalentFields(2);
|
|
|
|
|
|
+ if ($checkState == TalentState::SCND_SAVE) {
|
|
|
|
+ $field_dict = \app\common\api\DictApi::getTalentFields(4);
|
|
|
|
|
|
- $no_empty = ["talent_arrange", "talent_condition", "highest_degree", "graduate_school", "major", "bank", "bank_number", "bank_branch_name",
|
|
|
|
|
|
+ $no_empty = ["name", "nation", "card_type", "card_number", "sex", "birthday", "politics", "nationality", "province", "city", "county", "talent_type", "experience", "education",
|
|
|
|
+ "talent_arrange", "talent_condition", "highest_degree", "graduate_school", "major", "bank", "bank_number", "bank_branch_name",
|
|
"bank_account", "study_abroad", "phone", "email", "import_way", "cur_entry_time", "cur_entry_time", "position", "source"];
|
|
"bank_account", "study_abroad", "phone", "email", "import_way", "cur_entry_time", "cur_entry_time", "position", "source"];
|
|
|
|
|
|
$where = [];
|
|
$where = [];
|
|
@@ -288,6 +289,13 @@ class Talent extends EnterpriseController {
|
|
if ($abroad_files)
|
|
if ($abroad_files)
|
|
$abroad_file_ids = array_column($abroad_files, "id");
|
|
$abroad_file_ids = array_column($abroad_files, "id");
|
|
|
|
|
|
|
|
+ if (in_array($param["talent_type"], [1, 2])) {
|
|
|
|
+ $no_empty[] = "tax_insurance_month";
|
|
|
|
+ $no_empty[] = "labor_contract_rangetime";
|
|
|
|
+ }
|
|
|
|
+ if ($param["talent_type"] == 3) {
|
|
|
|
+ $no_empty[] = "pre_import_type";
|
|
|
|
+ }
|
|
if ($params["study_abroad"] == 1) {
|
|
if ($params["study_abroad"] == 1) {
|
|
$no_empty[] = "abroad_school";
|
|
$no_empty[] = "abroad_school";
|
|
$no_empty[] = "abroad_major";
|
|
$no_empty[] = "abroad_major";
|
|
@@ -332,7 +340,6 @@ class Talent extends EnterpriseController {
|
|
$whr[] = ["must", "=", 1];
|
|
$whr[] = ["must", "=", 1];
|
|
}
|
|
}
|
|
$where = [];
|
|
$where = [];
|
|
- $where[] = ["step", "=", 2];
|
|
|
|
$where[] = ["project", "=", 1];
|
|
$where[] = ["project", "=", 1];
|
|
$where[] = ["type", "=", $this->user["type"]];
|
|
$where[] = ["type", "=", $this->user["type"]];
|
|
$where[] = ["must", "=", 1];
|
|
$where[] = ["must", "=", 1];
|
|
@@ -364,7 +371,7 @@ class Talent extends EnterpriseController {
|
|
}
|
|
}
|
|
|
|
|
|
$this->save($info, $this->request, TalentState::SCND_SUBMIT);
|
|
$this->save($info, $this->request, TalentState::SCND_SUBMIT);
|
|
- } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL])) {
|
|
|
|
|
|
+ } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL, TalentState::ZX_FAIL, TalentState::ANNOUNCED_REVERIFY_FAIL, TalentState::PUBLISH_FAIL])) {
|
|
$res = ["msg" => "审核失败,不能再提交审核"];
|
|
$res = ["msg" => "审核失败,不能再提交审核"];
|
|
echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
|
|
echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
|
|
exit;
|
|
exit;
|
|
@@ -493,8 +500,7 @@ class Talent extends EnterpriseController {
|
|
validate(TalentInfo::class)->check($param);
|
|
validate(TalentInfo::class)->check($param);
|
|
$id = $param["id"];
|
|
$id = $param["id"];
|
|
if ($id) {
|
|
if ($id) {
|
|
- $data["id"] = $id;
|
|
|
|
- if (!$info) {
|
|
|
|
|
|
+ if (!$info || $info["id"] != $id || $info["enterprise_id"] != $this->user["uid"]) {
|
|
throw new ValidateException("没有对应的人才认定申报信息");
|
|
throw new ValidateException("没有对应的人才认定申报信息");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -523,6 +529,41 @@ class Talent extends EnterpriseController {
|
|
if (!$data["headimgurl"] && $checkState == TalentState::SCND_SUBMIT)
|
|
if (!$data["headimgurl"] && $checkState == TalentState::SCND_SUBMIT)
|
|
throw new ValidateException("请上传头像。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
|
|
throw new ValidateException("请上传头像。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
|
|
|
|
|
|
|
|
+ $where = [];
|
|
|
|
+ $where[] = ["project", "=", 1];
|
|
|
|
+ $where[] = ["type", "=", $this->user["type"]];
|
|
|
|
+ $where[] = ["must", "=", 1];
|
|
|
|
+ $where[] = ["active", "=", 1];
|
|
|
|
+ $where[] = ["delete", "=", 0];
|
|
|
|
+ $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
|
|
|
|
+
|
|
|
|
+ $age = 0;
|
|
|
|
+ if ($param["birthday"]) {
|
|
|
|
+ $birthday = $param["birthday"];
|
|
|
|
+ $birthdayYear = substr($birthday, 0, 4);
|
|
|
|
+ $currentYear = date("Y");
|
|
|
|
+ $age = $currentYear - $birthdayYear;
|
|
|
|
+ }
|
|
|
|
+ $ft_ids = [];
|
|
|
|
+ $deletes = [];
|
|
|
|
+ foreach ($filetypes as $ft) {
|
|
|
|
+ if ($ft["option"]) {
|
|
|
|
+ if ($ft["rel"] == "birthday") {
|
|
|
|
+ if ($age < $ft["option"]) {
|
|
|
|
+ $deletes[] = $ft["id"];
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ $selectVal = $param[$ft["rel"]];
|
|
|
|
+ $conditions = array_filter(explode(",", $ft["option"]));
|
|
|
|
+ if (!in_array($selectVal, $conditions)) {
|
|
|
|
+ $deletes[] = $ft["id"];
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $ft_ids[] = $ft["id"];
|
|
|
|
+ }
|
|
|
|
|
|
$data["apply_year"] = $batch["batch"];
|
|
$data["apply_year"] = $batch["batch"];
|
|
|
|
|
|
@@ -588,7 +629,7 @@ class Talent extends EnterpriseController {
|
|
}
|
|
}
|
|
|
|
|
|
if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
|
|
if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
|
|
- //真实状态8是驳回,需要判断什么字段可以提交
|
|
|
|
|
|
+ //真实状态11是驳回,需要判断什么字段可以提交
|
|
$modify_fields = array_filter(explode(",", $info["modify_fields"]));
|
|
$modify_fields = array_filter(explode(",", $info["modify_fields"]));
|
|
$tmp_data = $data;
|
|
$tmp_data = $data;
|
|
$data = [];
|
|
$data = [];
|
|
@@ -597,28 +638,71 @@ class Talent extends EnterpriseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$data["checkState"] = $checkState;
|
|
$data["checkState"] = $checkState;
|
|
- $data["id"] = $info["id"];
|
|
|
|
|
|
+ $data["id"] = $id;
|
|
$success_msg = "提交成功";
|
|
$success_msg = "提交成功";
|
|
$error_msg = "提交失败";
|
|
$error_msg = "提交失败";
|
|
if ($checkState == TalentState::SCND_SAVE) {
|
|
if ($checkState == TalentState::SCND_SAVE) {
|
|
- $last_log = TalentLogApi::getLastLog($data["id"], 1);
|
|
|
|
- if ($last_log["new_state"] != TalentState::SCND_SAVE) {
|
|
|
|
- TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
|
|
|
|
|
|
+ $success_msg = "保存成功";
|
|
|
|
+ if ($data["id"]) {
|
|
|
|
+ //编辑
|
|
|
|
+ TalentModel::update($data);
|
|
|
|
+ $last_log = TalentLogApi::getLastLog($data["id"], 1);
|
|
|
|
+ if ($last_log["new_state"] != TalentState::SCND_SAVE) {
|
|
|
|
+ TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
|
|
|
|
+ } else {
|
|
|
|
+ TalentLogApi::setActive($last_log["id"], 1); //更新修改时间
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //新增
|
|
|
|
+ $data["enterprise_id"] = $this->user["uid"];
|
|
|
|
+ $id = TalentModel::insertGetId($data);
|
|
|
|
+ TalentLogApi::write(1, $id, $checkState, "保存未提交", 1);
|
|
|
|
+ $whr = [];
|
|
|
|
+ $whr[] = ["fileId", "in", $files];
|
|
|
|
+ $upd_checklog["mainId"] = $id;
|
|
|
|
+ Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
|
|
}
|
|
}
|
|
- TalentModel::update($data);
|
|
|
|
} else if ($checkState == TalentState::SCND_SUBMIT) {
|
|
} else if ($checkState == TalentState::SCND_SUBMIT) {
|
|
- $success_msg = "提交成功";
|
|
|
|
- $error_msg = "提交失败";
|
|
|
|
$data["new_submit_time"] = date("Y-m-d H:i:s");
|
|
$data["new_submit_time"] = date("Y-m-d H:i:s");
|
|
TalentModel::update($data);
|
|
TalentModel::update($data);
|
|
- TalentLogApi::write(1, $info["id"], $checkState, "确认提交审核", 1);
|
|
|
|
|
|
+ TalentLogApi::write(1, $data["id"], $checkState, "确认提交审核", 1);
|
|
|
|
+ } else {
|
|
|
|
+ throw new ValidateException($error_msg);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ($id) {
|
|
|
|
+ if ($deletes) {
|
|
|
|
+ //删除多余的附件,一般是选择人才类型留下来的
|
|
|
|
+ $whr = [];
|
|
|
|
+ $whr[] = ["typeId", "in", $deletes];
|
|
|
|
+ $whr[] = ["id", "in", $files];
|
|
|
|
+ $_wait_del_files = Db::table("new_talent_file")->where($whr)->select()->toArray();
|
|
|
|
+ $_logfileIds[] = [];
|
|
|
|
+ foreach ($_wait_del_files as $_del_file) {
|
|
|
|
+ $_logfileIds[] = $_del_file["id"];
|
|
|
|
+ @unlink("storage/" . $_del_file["url"]);
|
|
|
|
+ }
|
|
|
|
+ Db::table("new_talent_file")->where($whr)->delete();
|
|
|
|
+ if ($_logfileIds) {
|
|
|
|
+ $whr = [];
|
|
|
|
+ $whr[] = ["fileId", "in", $_logfileIds];
|
|
|
|
+ $_upd_checklog["description"] = "删除附件";
|
|
|
|
+ $_upd_checklog["updateUser"] = sprintf("%s(%s)", $this->user["account"], $this->user["companyName"] ?: $this->user["rolename"]);
|
|
|
|
+ $_upd_checklog["updateTime"] = date("Y-m-d H:i:s");
|
|
|
|
+ Db::table("new_talent_checklog")->where($whr)->save($_upd_checklog);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $whr = [];
|
|
|
|
+ $whr[] = ["id", "in", $files];
|
|
|
|
+ Db::table("new_talent_file")->where($whr)->save(["mainId" => $id]);
|
|
|
|
+ $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
|
|
|
|
+ $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
|
|
|
|
+ echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
|
|
|
|
+ exit();
|
|
} else {
|
|
} else {
|
|
throw new ValidateException($error_msg);
|
|
throw new ValidateException($error_msg);
|
|
}
|
|
}
|
|
- $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $info["id"], "checkState" => $checkState]];
|
|
|
|
- $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
|
|
|
|
- echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
|
|
|
|
- exit();
|
|
|
|
} catch (ValidateException $e) {
|
|
} catch (ValidateException $e) {
|
|
$res = ["msg" => $e->getMessage()];
|
|
$res = ["msg" => $e->getMessage()];
|
|
$callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
|
|
$callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
|
|
@@ -638,7 +722,27 @@ class Talent extends EnterpriseController {
|
|
$log = TalentLogApi::getLastLog($id, 1);
|
|
$log = TalentLogApi::getLastLog($id, 1);
|
|
if ($log["state"] > 1) {
|
|
if ($log["state"] > 1) {
|
|
//有提交审核记录
|
|
//有提交审核记录
|
|
- return json(["msg" => "操作失败"]);
|
|
|
|
|
|
+ return json(["msg" => "该申报已提交审核,无法删除"]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $data["id"] = $id;
|
|
|
|
+ $data["delete"] = 1;
|
|
|
|
+ TalentModel::update($data);
|
|
|
|
+ return json(["msg" => "删除成功"]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function mixDelete() {
|
|
|
|
+ $id = $this->request->param("talentInfoId");
|
|
|
|
+ $info = Talent::chkIsOwner($id, $this->user["uid"]);
|
|
|
|
+ if (!$info) {
|
|
|
|
+ return json(["msg" => "操作失败"]);
|
|
|
|
+ }
|
|
|
|
+ $checkState = $info["checkState"];
|
|
|
|
+ if (in_array($checkState, [0, TalentState::SCND_SAVE])) {
|
|
|
|
+ $log = TalentLogApi::getLastLog($id, 1);
|
|
|
|
+ if ($log["state"] > 1) {
|
|
|
|
+ //有提交审核记录
|
|
|
|
+ return json(["msg" => "该申报已提交审核,无法删除"]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
$data["id"] = $id;
|
|
$data["id"] = $id;
|