|
@@ -101,14 +101,16 @@ class Talent extends EnterpriseController {
|
|
|
exit();
|
|
|
break;
|
|
|
case CommonConst::ENTERPRISE_WJ:
|
|
|
- if ($ep->isGeneral == 1) {
|
|
|
+ if ($ep->isGeneral == 1 || ($ep->isGeneral == 2 && !\app\common\api\Nhc::hasGeneralHospital($ep->medicalCommunityId))) {
|
|
|
$this->wjSave($info, $request, TalentState::SCND_SAVE);
|
|
|
} else {
|
|
|
$this->wjSave($info, $request, TalentState::FST_SAVE);
|
|
|
}
|
|
|
+ exit();
|
|
|
break;
|
|
|
case CommonConst::ENTERPRISE_GJ:
|
|
|
$this->gjSave($info, $request, TalentState::SCND_SAVE);
|
|
|
+ exit();
|
|
|
break;
|
|
|
}
|
|
|
} else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL])) {
|
|
@@ -542,7 +544,9 @@ class Talent extends EnterpriseController {
|
|
|
$params = $this->request->param();
|
|
|
$id = $params["id"];
|
|
|
if (!$info = TalentApi::chkIsOwner($id, $this->user["uid"])) {
|
|
|
- return json(["msg" => "没有对应的人才认定申报信息"]);
|
|
|
+ $res = ["msg" => "没有对应的人才认定申报信息"];
|
|
|
+ echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
|
|
|
+ exit;
|
|
|
}
|
|
|
if ($info) {
|
|
|
$info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
|
|
@@ -559,12 +563,14 @@ class Talent extends EnterpriseController {
|
|
|
$no_empty = array_filter($no_empty);
|
|
|
$return = [];
|
|
|
foreach ($no_empty as $key) {
|
|
|
- if (!$info[$key]) {
|
|
|
+ if (!$params[$key]) {
|
|
|
$return[] = sprintf("请填写“%s”", $field_dict[$key]);
|
|
|
}
|
|
|
}
|
|
|
if (count($return) > 0) {
|
|
|
- return json(["msg" => implode("<br>", $return)]);
|
|
|
+ $res = ["msg" => implode("<br>", $return)];
|
|
|
+ echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
|
|
|
+ exit;
|
|
|
}
|
|
|
$condition_info = Db::table("new_talent_condition")->findOrEmpty($params["talent_condition"]);
|
|
|
if ($condition_info["bindFileTypes"]) {
|
|
@@ -591,7 +597,9 @@ class Talent extends EnterpriseController {
|
|
|
$distinct_filetypes = Db::table("new_talent_file")->where($whr)->distinct(true)->field("typeId")->select()->toArray();
|
|
|
$upload_type_counts = count($distinct_filetypes);
|
|
|
if ($upload_type_counts != count($ft_ids)) {
|
|
|
- return json(["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"]);
|
|
|
+ $res = ["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"];
|
|
|
+ echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
|
|
|
+ exit;
|
|
|
}
|
|
|
if ($checkState == TalentState::FST_SAVE) {
|
|
|
return $this->wjSave($info, $this->request, TalentState::FST_SUBMIT);
|
|
@@ -599,9 +607,13 @@ class Talent extends EnterpriseController {
|
|
|
return $this->wjSave($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, TalentState::ZX_FAIL, TalentState::ANNOUNCED_REVERIFY_FAIL, TalentState::PUBLISH_FAIL])) {
|
|
|
- return json(["msg" => "审核不通过,不能再提交审核", "code" => 500]);
|
|
|
+ $res = ["msg" => "审核不通过,不能再提交审核", "code" => 500];
|
|
|
+ echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
|
|
|
+ exit;
|
|
|
}
|
|
|
- return json(["msg" => "已提交审核,请耐心等待", "code" => 500]);
|
|
|
+ $res = ["msg" => "已提交审核,请耐心等待", "code" => 500];
|
|
|
+ echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
|
|
|
+ exit;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1074,7 +1086,11 @@ class Talent extends EnterpriseController {
|
|
|
echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
|
|
|
exit();
|
|
|
} else if ($checkState == TalentState::SCND_SUBMIT) {
|
|
|
- $data["new_submit_time"] = date("Y-m-d H:i:s");
|
|
|
+ if (!$info["first_submit_time"]) {
|
|
|
+ $data["first_submit_time"] = date("Y-m-d H:i:s");
|
|
|
+ } else {
|
|
|
+ $data["new_submit_time"] = date("Y-m-d H:i:s");
|
|
|
+ }
|
|
|
$data["updateTime"] = date("Y-m-d H:i:s");
|
|
|
TalentModel::update($data);
|
|
|
TalentLogApi::write(1, $data["id"], $checkState, "确认提交审核", 1);
|
|
@@ -1119,13 +1135,17 @@ class Talent extends EnterpriseController {
|
|
|
* @throws ValidateException
|
|
|
*/
|
|
|
private function wjSave($info, \think\Request $request, $checkState) {
|
|
|
+ $callback = "infoCallback";
|
|
|
+ if (in_array($checkState, [TalentState::FST_SUBMIT, TalentState::SCND_SUBMIT])) {
|
|
|
+ $callback = "submitCallback";
|
|
|
+ }
|
|
|
try {
|
|
|
$batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"], "first_submit_time" => $info["first_submit_time"]], $this->user["type"]);
|
|
|
if ($batch["code"] != 200) {
|
|
|
throw new ValidateException($batch["msg"]);
|
|
|
}
|
|
|
$param = $request->param();
|
|
|
- validate(TalentInfo::class)->check($param);
|
|
|
+ $i = validate(TalentInfo::class)->check($param);
|
|
|
$id = $param["id"];
|
|
|
if ($id) {
|
|
|
if (!$info || $info["id"] != $id || $info["enterprise_id"] != $this->user["uid"]) {
|
|
@@ -1191,7 +1211,7 @@ class Talent extends EnterpriseController {
|
|
|
$data["updateTime"] = date("Y-m-d H:i:s");
|
|
|
TalentModel::update($data);
|
|
|
$last_log = TalentLogApi::getLastLog($data["id"], 1);
|
|
|
- if ($last_log["new_state"] != TalentState::SCND_SAVE || $last_log["new_state"] != TalentState::FST_SAVE) {
|
|
|
+ if ($last_log["new_state"] != TalentState::SCND_SAVE && $last_log["new_state"] != TalentState::FST_SAVE) {
|
|
|
TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
|
|
|
} else {
|
|
|
if (!$last_log["companyId"]) {
|
|
@@ -1210,25 +1230,27 @@ class Talent extends EnterpriseController {
|
|
|
Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
|
|
|
}
|
|
|
$res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
|
|
|
- echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
|
|
|
+ echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
|
|
|
exit();
|
|
|
} else if ($checkState == TalentState::SCND_SUBMIT || $checkState == TalentState::FST_SUBMIT) {
|
|
|
- $data["new_submit_time"] = date("Y-m-d H:i:s");
|
|
|
+ if (!$info["first_submit_time"]) {
|
|
|
+ $data["first_submit_time"] = date("Y-m-d H:i:s");
|
|
|
+ } else {
|
|
|
+ $data["new_submit_time"] = date("Y-m-d H:i:s");
|
|
|
+ }
|
|
|
$data["updateTime"] = date("Y-m-d H:i:s");
|
|
|
TalentModel::update($data);
|
|
|
TalentLogApi::write(1, $data["id"], $checkState, "确认提交审核", 1);
|
|
|
- return json(["msg" => $success_msg, "code" => 200]);
|
|
|
+ $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
|
|
|
+ echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
|
|
|
+ exit();
|
|
|
} else {
|
|
|
throw new ValidateException($error_msg);
|
|
|
}
|
|
|
} catch (ValidateException $e) {
|
|
|
- if ($checkState == TalentState::SCND_SAVE) {
|
|
|
- $res = ["msg" => $e->getMessage()];
|
|
|
- echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
|
|
|
- exit();
|
|
|
- } else {
|
|
|
- return json(["msg" => $e->getMessage()]);
|
|
|
- }
|
|
|
+ $res = ["msg" => $e->getMessage()];
|
|
|
+ echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
|
|
|
+ exit();
|
|
|
} catch (\think\Exception $e) {
|
|
|
$res = ["msg" => "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()];
|
|
|
$logInfo = [
|
|
@@ -1240,12 +1262,8 @@ class Talent extends EnterpriseController {
|
|
|
"errMsg" => $e->getMessage()
|
|
|
];
|
|
|
Log::write($logInfo, "error");
|
|
|
- if ($checkState == TalentState::SCND_SAVE || $checkState == TalentState::FST_SAVE) {
|
|
|
- echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
|
|
|
- exit();
|
|
|
- } else {
|
|
|
- return json($res);
|
|
|
- }
|
|
|
+ echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
|
|
|
+ exit();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1318,6 +1336,212 @@ class Talent extends EnterpriseController {
|
|
|
return TalentModel::where($where)->field("id,name")->select()->toArray();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 审核列表页
|
|
|
+ */
|
|
|
+ public function examineCenter() {
|
|
|
+ $tpl = "";
|
|
|
+ switch ($this->user["type"]) {
|
|
|
+ case CommonConst::ENTERPRISE_WJ:
|
|
|
+ if ($this->user["isGeneral"] == 1) {
|
|
|
+ $tpl = "/talent/hospital/examine_center"; //卫健医院
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return view($tpl);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 审核列表页
|
|
|
+ */
|
|
|
+ public function examineList() {
|
|
|
+ $res = TalentApi::getHospitalExamineList($this->request);
|
|
|
+ return json($res);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function examinePage() {
|
|
|
+ $id = $this->request->param("id");
|
|
|
+ $info = \app\common\api\VerifyApi::getTalentInfoById($id);
|
|
|
+ return view("/talent/hospital/view", ["row" => $info]);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 医院人才申报审核保存
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ public function check() {
|
|
|
+ $request = $this->request;
|
|
|
+ $params = $request->param();
|
|
|
+ $check = $params["checkState"];
|
|
|
+ $check_msg = trim($params["checkMsg"]);
|
|
|
+ $files = $params["files"];
|
|
|
+ $fields = $params["fields"];
|
|
|
+ $id = $params["id"];
|
|
|
+ $talent_info = \app\common\api\VerifyApi::getOne($id);
|
|
|
+ if (!$talent_info) {
|
|
|
+ return json(["msg" => "数据错误"]);
|
|
|
+ }
|
|
|
+ $enterprise = EnterpriseApi::getOne($talent_info["enterprise_id"]);
|
|
|
+ $checkState = $talent_info["checkState"];
|
|
|
+ if ($this->user["isGeneral"] != 1) {
|
|
|
+ return json(["msg" => "非总院账号,无法审核"]);
|
|
|
+ }
|
|
|
+ if ($this->user["medicalCommunityId"] != $enterprise["medicalCommunityId"]) {
|
|
|
+ return json(["msg" => "不能审核其它非本医共体医院"]);
|
|
|
+ }
|
|
|
+ if (!$check) {
|
|
|
+ return json(["msg" => "请选择审核状态"]);
|
|
|
+ }
|
|
|
+ if (!$check_msg) {
|
|
|
+ return json(["msg" => "请填写审核说明"]);
|
|
|
+ }
|
|
|
+ if ($checkState == TalentState::FST_SUBMIT) {
|
|
|
+ if ($params["checkState"] == 3) {
|
|
|
+//审核成功,并取消设置越过部门并审
|
|
|
+ $log_checkState = $checkState = TalentState::BASE_VERIFY_PASS; //初审成功
|
|
|
+ } else {
|
|
|
+//审核驳回并记录需要修改的字段和上传文件
|
|
|
+ $checkState = TalentState::FST_SAVE; //退回材料编辑状态
|
|
|
+ $log_checkState = TalentState::BASE_REJECT; //日志记录拒绝状态
|
|
|
+ }
|
|
|
+ $log = TalentLogApi::getLastLog($id, 1);
|
|
|
+ if (!$log && !$talent_info["oldId"])
|
|
|
+ return json(["msg" => "日志数据异常,保存失败"]);
|
|
|
+ if ($log["active"] === 0) {
|
|
|
+ TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
|
|
|
+ } else {
|
|
|
+ TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
|
|
|
+ }
|
|
|
+ $data["id"] = $talent_info["id"];
|
|
|
+ $data["modify_files"] = $params["files"];
|
|
|
+ $data["modify_fields"] = $params["fields"];
|
|
|
+ TalentModel::update($data);
|
|
|
+ return json(["code" => 200, "msg" => "保存成功"]);
|
|
|
+ } else {
|
|
|
+ return json(["msg" => "不在审核范围内,保存失败"]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 医院人才申报审核
|
|
|
+ * @return type
|
|
|
+ */
|
|
|
+ public function submitCheck() {
|
|
|
+ $id = $this->request->param("id");
|
|
|
+ $talent_info = \app\common\api\VerifyApi::getOne($id);
|
|
|
+ if (!$talent_info) {
|
|
|
+ return json(["msg" => "数据错误"]);
|
|
|
+ }
|
|
|
+ $enterprise = EnterpriseApi::getOne($talent_info["enterprise_id"]);
|
|
|
+ $checkState = $talent_info["checkState"];
|
|
|
+ if ($this->user["isGeneral"] != 1) {
|
|
|
+ return json(["msg" => "非总院账号,无法审核"]);
|
|
|
+ }
|
|
|
+ if ($this->user["medicalCommunityId"] != $enterprise["medicalCommunityId"]) {
|
|
|
+ return json(["msg" => "不能审核其它非本医共体医院"]);
|
|
|
+ }
|
|
|
+ if ($checkState == TalentState::FST_SUBMIT) {
|
|
|
+ $nowProcess = 1;
|
|
|
+ $log = TalentLogApi::getLastLog($talent_info["id"], 1);
|
|
|
+ if (!$log || $log["active"] == 1)
|
|
|
+ return json(["msg" => "请先保存审核状态,再提交审核"]);
|
|
|
+ if (in_array($log["new_state"], [TalentState::BASE_VERIFY_PASS])) {
|
|
|
+ $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
|
|
|
+ }
|
|
|
+ $data["id"] = $talent_info["id"];
|
|
|
+ $data["checkState"] = $log["new_state"];
|
|
|
+ TalentModel::update($data);
|
|
|
+ TalentLogApi::setActive($log["id"], 1);
|
|
|
+ if ($log["state"] == TalentState::BASE_REJECT) {
|
|
|
+ $this->sendMsg($enterprise["id"], $log["description"]);
|
|
|
+ }
|
|
|
+ return json(["code" => 200, "msg" => "审核成功"]);
|
|
|
+ } else {
|
|
|
+ return json(["msg" => "不在审核范围内,审核失败"]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private function sendMsg($enterprise_id, $description = "") {
|
|
|
+ $ep = EnterpriseApi::getOne($enterprise_id);
|
|
|
+ if ($ep->agentPhone) {
|
|
|
+ $smsapi = new \app\common\api\ChuanglanSmsApi();
|
|
|
+ $result = $smsapi->sendSMS($phone, $template);
|
|
|
+ $result = json_decode($result, true);
|
|
|
+ $id = getStringId();
|
|
|
+ $record_data = [
|
|
|
+ 'id' => $id,
|
|
|
+ 'userId' => $ep->id,
|
|
|
+ 'bizId' => $result["msgId"],
|
|
|
+ 'type' => 2,
|
|
|
+ 'smsType' => 2,
|
|
|
+ 'name' => $ep->name,
|
|
|
+ 'phone' => $ep->agentPhone,
|
|
|
+ 'params' => "总院审核",
|
|
|
+ 'templateCode' => "【晋江市人才服务平台】尊敬的用户,您提交的人才认定申报审核驳回,原因是:{$description},请及时登录申报系统修改并重新提交。",
|
|
|
+ 'state' => $result['code'] == 0 ? 2 : 3,
|
|
|
+ 'sendingDate' => date("Y-m-d H:i:s", time()),
|
|
|
+ 'createTime' => date("Y-m-d H:i:s", time()),
|
|
|
+ 'msg' => $result['errorMsg']
|
|
|
+ ];
|
|
|
+ \app\admin\model\MessageRecord::create($record_data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public function validateIsCheck() {
|
|
|
+ $params = $this->request->param();
|
|
|
+ $id = $params["id"];
|
|
|
+ $talent_info = \app\common\api\VerifyApi::getTalentInfoById($id);
|
|
|
+ $enterprise = EnterpriseApi::getOne($talent_info["enterprise_id"]);
|
|
|
+ if ($talent_info) {
|
|
|
+ $checkState = $talent_info["checkState"];
|
|
|
+ if ($this->user["isGeneral"] != 1) {
|
|
|
+ return json(["msg" => "非总院账号,无法审核"]);
|
|
|
+ }
|
|
|
+ if ($this->user["medicalCommunityId"] != $enterprise["medicalCommunityId"]) {
|
|
|
+ return json(["msg" => "不能审核其它非本医共体医院"]);
|
|
|
+ }
|
|
|
+ if ($checkState != TalentState::FST_SUBMIT) {
|
|
|
+ return json(["msg" => "该申报不在审核范围内,无法审核"]);
|
|
|
+ }
|
|
|
+ $fields = DictApi::getTalentFields_WJ();
|
|
|
+ $field_tmp = [];
|
|
|
+ if ($fields) {
|
|
|
+ foreach ($fields as $key => $field) {
|
|
|
+ $field_tmp[] = ["key" => $key, "value" => $field];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $condition = \app\common\api\TalentConditionApi::getOne($talent_info["talent_condition"]);
|
|
|
+ $where = [];
|
|
|
+ $whr = [];
|
|
|
+ $where[] = ["project", "=", 1];
|
|
|
+ $where[] = ["active", "=", 1];
|
|
|
+ $where[] = ["type", "=", $enterprise["type"]];
|
|
|
+ $where[] = ["isConditionFile", "<>", 1];
|
|
|
+ $where[] = ["delete", "=", 0];
|
|
|
+ if ($condition && $condition["bindFileTypes"]) {
|
|
|
+ $whr[] = ["id", "in", explode(",", $condition["bindFileTypes"])];
|
|
|
+ $files = \think\facade\Db::table("new_common_filetype")->whereOr([$where, $whr])->order("sn asc")->select();
|
|
|
+ } else {
|
|
|
+ $files = \think\facade\Db::table("new_common_filetype")->where($where)->order("sn asc")->select();
|
|
|
+ }
|
|
|
+ $talent_info["files"] = array_filter(explode(",", $talent_info["modify_files"]));
|
|
|
+ $talent_info["fields"] = array_filter(explode(",", $talent_info["modify_fields"]));
|
|
|
+
|
|
|
+ /* 保存的审核内容start */
|
|
|
+ $last_log = TalentLogApi::getLastLog($id, ProjectState::TALENT, 0, ["active", "=", 0]);
|
|
|
+ $check = ["msg" => $last_log["description"]];
|
|
|
+ if ($last_log["state"] == TalentState::BASE_VERIFY_PASS) {
|
|
|
+ $check["checkState"] = 3;
|
|
|
+ }
|
|
|
+ if ($last_log["new_state"] == TalentState::FST_SAVE && $last_log["state"] == TalentState::BASE_REJECT) {
|
|
|
+ $check["checkState"] = 2;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* 保存的审核内容end */
|
|
|
+ return json(["code" => 200, "obj" => ["talentInfo" => $talent_info, "check" => $check, "fieldList" => $field_tmp, "fileList" => $files]]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// public function mixDelete() {
|
|
|
// $id = $this->request->param("talentInfoId");
|
|
|
// $info = TalentApi::chkIsOwner($id, $this->user["uid"]);
|