|
@@ -10,6 +10,7 @@ use app\enterprise\model\Talent as TalentModel;
|
|
|
use app\common\api\TalentConditionApi;
|
|
|
use app\common\api\DictApi;
|
|
|
use app\common\api\EnterpriseApi;
|
|
|
+use think\facade\Db;
|
|
|
|
|
|
/**
|
|
|
* Description of Talent
|
|
@@ -176,7 +177,9 @@ class Talent extends AdminController {
|
|
|
$filename = "优秀人才核查征信名单导出";
|
|
|
if ($rows) {
|
|
|
export($columns, $rows, $filename);
|
|
|
+ exit();
|
|
|
}
|
|
|
+ echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -259,7 +262,44 @@ class Talent extends AdminController {
|
|
|
if ($rows) {
|
|
|
$filename = "优秀人才公示预览导出";
|
|
|
export($columns, $rows, $filename);
|
|
|
+ exit();
|
|
|
}
|
|
|
+ echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预备人才库-公示导出
|
|
|
+ * @auth {{/talentInfo/publicExport}}
|
|
|
+ */
|
|
|
+ public function publicExport() {
|
|
|
+ $params = $this->request->param();
|
|
|
+ $columns = ["序号", "批次", "姓名", "性别", "工作单位", "本人具备的认定条件", "拟认定人才层次", "审核状态", "备注"];
|
|
|
+ $startTime = $params["startTime"];
|
|
|
+ $endTime = $params["endTime"];
|
|
|
+ if (!strtotime($startTime) || !strtotime($endTime))
|
|
|
+ return json(["msg" => "时间格式错误"]);
|
|
|
+ $where[] = ["checkState", "=", TalentState::ANNOUNCED];
|
|
|
+ $where[] = ["publicBatch", "between", [$startTime, $endTime]];
|
|
|
+ $list = TalentModel::where($where)->order("talent_arrange asc,enterprise_id asc")->select();
|
|
|
+ $rows = [];
|
|
|
+ $i = 1;
|
|
|
+ $talentArranges = DictApi::selectByParentCode("talent_arrange");
|
|
|
+ foreach ($list as $item) {
|
|
|
+ $talent_condition = TalentConditionApi::getOne($item["talent_condition"]);
|
|
|
+ $enterprise = EnterpriseApi::getOne($item["enterprise_id"]);
|
|
|
+ $checkLog = TalentLogApi::getLastLog($item["id"], 1);
|
|
|
+ $row = [
|
|
|
+ $i, $item["apply_year"], $item["name"], $item["sex"] == 1 ? "男" : "女", $enterprise["name"], $talent_condition["name"], $talentArranges[$item["talent_arrange"]], $item["checkState"] == TalentState::ANNOUNCED ? "审核通过" : "审核不通过", $checkLog["description"]
|
|
|
+ ];
|
|
|
+ $rows[] = $row;
|
|
|
+ $i++;
|
|
|
+ }
|
|
|
+ if ($rows) {
|
|
|
+ $filename = "优秀人才公示导出";
|
|
|
+ export($columns, $rows, $filename);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+ echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -380,10 +420,47 @@ class Talent extends AdminController {
|
|
|
}
|
|
|
}
|
|
|
$columns = ["序号", "批次", "姓名", "性别", "工作单位", "本人具备的认定条件", "认定人才层次", "审核状态", "备注"];
|
|
|
+ $filename = "优秀人才" . date("Ym") . "公布预览名单导出(公示批次-" . $list[0]["publicBatch"] . ")";
|
|
|
+ if ($rows) {
|
|
|
+ export($columns, $rows, $filename);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+ echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预备人才库-公布导出
|
|
|
+ * @auth {{/talentInfo/publishExport}}
|
|
|
+ */
|
|
|
+ public function publishExport() {
|
|
|
+ $params = $this->request->param();
|
|
|
+ $startTime = $params["startTime"];
|
|
|
+ $endTime = $params["endTime"];
|
|
|
+ if (!strtotime($startTime) || !strtotime($endTime))
|
|
|
+ return json(["msg" => "时间格式错误"]);
|
|
|
+ $where[] = ["checkState", "=", TalentState::PUBLISH_PASS];
|
|
|
+ $where[] = ["certificateGetTime", "between", [$startTime, $endTime]];
|
|
|
+ $list = TalentModel::where($where)->order("talent_arrange asc,enterprise_id asc")->select();
|
|
|
+ $rows = [];
|
|
|
+ $i = 1;
|
|
|
+ $talentArranges = DictApi::selectByParentCode("talent_arrange");
|
|
|
+ foreach ($list as $item) {
|
|
|
+ $talent_condition = TalentConditionApi::getOne($item["talent_condition"]);
|
|
|
+ $enterprise = EnterpriseApi::getOne($item["enterprise_id"]);
|
|
|
+ $checkLog = TalentLogApi::getLastLog($item["id"], 1);
|
|
|
+ $row = [
|
|
|
+ $i, $item["apply_year"], $item["name"], $item["sex"] == 1 ? "男" : "女", $enterprise["name"], $talent_condition["name"], $talentArranges[$item["talent_arrange"]], $item["checkState"] == TalentState::PUBLISH_PASS ? "审核通过" : "审核不通过", $checkLog["description"]
|
|
|
+ ];
|
|
|
+ $rows[] = $row;
|
|
|
+ $i++;
|
|
|
+ }
|
|
|
+ $columns = ["序号", "批次", "姓名", "性别", "工作单位", "本人具备的认定条件", "认定人才层次", "审核状态", "备注"];
|
|
|
$filename = "优秀人才" . date("Ym") . "公布名单导出(公示批次-" . $list[0]["publicBatch"] . ")";
|
|
|
if ($rows) {
|
|
|
export($columns, $rows, $filename);
|
|
|
+ exit();
|
|
|
}
|
|
|
+ echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -452,26 +529,71 @@ class Talent extends AdminController {
|
|
|
return json(["code" => 200, "msg" => sprintf("公布完成:共提交%d个人才,通过%d个,失败%d个", $total, $success, $error)]);
|
|
|
}
|
|
|
|
|
|
- public function sendCard() {
|
|
|
- //查询所有待发证的数据
|
|
|
- $params = $this->request->param();
|
|
|
- $ids = array_filter(explode(",", $params["ids"]));
|
|
|
- $talent_list = VerifyApi::getListByIds($ids);
|
|
|
- //晋江市优秀人才证书:当前年份+层次+四位递增数字
|
|
|
- //集成电路优秀人才证书:IC+当前年份+递增四位数,如IC20190001
|
|
|
- $year = date("Y");
|
|
|
- foreach ($talent_list as $talent_info) {
|
|
|
- $no_prefix = $year . $talent_info["talent_arrange"];
|
|
|
- }
|
|
|
- return new ResponseObj(ResponseObj . SUCCESS, "发证成功");
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
- * 预备人才库-发证
|
|
|
+ * 预备人才库-批量发证
|
|
|
* @auth {{/talentInfo/prepareCertification}}
|
|
|
*/
|
|
|
- public function pre_certification() {
|
|
|
-
|
|
|
+ public function prepareCertification() {
|
|
|
+ $lockFile = fopen("send_certificate.lock", "a");
|
|
|
+ if (flock($lockFile, LOCK_EX | LOCK_NB)) {//文件锁(独占)
|
|
|
+//查询所有待发证的数据
|
|
|
+ $params = $this->request->param();
|
|
|
+ $ids = array_filter(explode(",", $params["ids"]));
|
|
|
+//晋江市优秀人才证书:当前年份+层次+四位递增数字
|
|
|
+//集成电路优秀人才证书:IC+当前年份+递增四位数,如IC20190001
|
|
|
+ Db::startTrans();
|
|
|
+ $talent_max_no = [];
|
|
|
+ $user = session("user");
|
|
|
+ try {
|
|
|
+ $talent_list = VerifyApi::getListByIds($ids);
|
|
|
+ $year = date("Y");
|
|
|
+ foreach ($talent_list as $talent_info) {
|
|
|
+ if ($talent_info["checkState"] != TalentState::PUBLISH_PASS) {
|
|
|
+ Db::rollback();
|
|
|
+ return json(["msg" => "只能对公布通过的对象进行发证,请核查待发证名单后再重新发证"]);
|
|
|
+ }
|
|
|
+
|
|
|
+ $no_prefix = $year . $talent_info["talent_arrange"];
|
|
|
+ $where[] = ["certificateNo", "like", $no_prefix . "%"];
|
|
|
+ $max_no = $talent_max_no[$talent_info["talent_arrange"]] ?: Db::table("new_talent_info")->where($where)->max("certificateNo");
|
|
|
+ if (!$max_no) {
|
|
|
+ $max_no = $no_prefix . "0001";
|
|
|
+ } else {
|
|
|
+ $new_no = intval(substr($max_no, 5)) + 1;
|
|
|
+ $max_no = $no_prefix . str_pad($new_no, 4, "0", STR_PAD_LEFT);
|
|
|
+ }
|
|
|
+//更新证书编号
|
|
|
+ $data["id"] = $talent_info["id"];
|
|
|
+ $data["certificateNo"] = $max_no;
|
|
|
+ $data["checkState"] = TalentState::CERTIFICATED;
|
|
|
+ $data["isPublic"] = 5;
|
|
|
+ Db::table("new_talent_info")->update($data);
|
|
|
+
|
|
|
+//写入日志
|
|
|
+ $log["last_state"] = TalentState::PUBLISH_PASS;
|
|
|
+ $log["id"] = getStringId();
|
|
|
+ $log["state"] = $log["new_state"] = TalentState::CERTIFICATED;
|
|
|
+ $log["type"] = 1;
|
|
|
+ $log["mainId"] = $talent_info["id"];
|
|
|
+ $log["companyId"] = $user["companyId"];
|
|
|
+ $log["active"] = 1;
|
|
|
+ $log["description"] = "人才编号为:" . $max_no;
|
|
|
+ $log["createUser"] = sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]);
|
|
|
+ $log["createTime"] = date("Y-m-d H:i:s");
|
|
|
+ Db::table("new_talent_checklog")->insert($log);
|
|
|
+
|
|
|
+ $talent_max_no[$talent_info["talent_arrange"]] = $max_no;
|
|
|
+ }
|
|
|
+ Db::commit();
|
|
|
+ return json(["code" => 200, "msg" => "发证成功"]);
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Db::rollback();
|
|
|
+ return json(["msg" => "发证失败:" . $e->getMessage()]);
|
|
|
+ }
|
|
|
+ flock($lockFile, LOCK_UN);
|
|
|
+ } else {
|
|
|
+ return json(["msg" => "同一时间只能有一个管理员进行发证操作"]);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -482,14 +604,6 @@ class Talent extends AdminController {
|
|
|
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 预备人才库-公示预览
|
|
|
- * @auth {{/talentInfo/publicExportBefore}}
|
|
|
- */
|
|
|
- public function pre_public_preview() {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 基本条件审核-提交未保存
|
|
|
* @param \think\Request $request
|
|
@@ -499,10 +613,10 @@ class Talent extends AdminController {
|
|
|
private function baseCheck(\think\Request $request, $talent_info) {
|
|
|
$params = $request->param();
|
|
|
if ($params["checkState"] == 3) {
|
|
|
- //审核成功
|
|
|
+//审核成功
|
|
|
$log_checkState = $checkState = TalentState::BASE_VERIFY_PASS; //初审成功
|
|
|
} else {
|
|
|
- //审核驳回并记录需要修改的字段和上传文件
|
|
|
+//审核驳回并记录需要修改的字段和上传文件
|
|
|
$checkState = TalentState::FST_SAVE; //退回提交材料阶段
|
|
|
$log_checkState = TalentState::BASE_REJECT; //日志记录拒绝状态
|
|
|
}
|
|
@@ -539,17 +653,17 @@ class Talent extends AdminController {
|
|
|
private function fstCheck(\think\Request $request, $talent_info) {
|
|
|
$params = $request->param();
|
|
|
if ($params["checkState"] == 3) {
|
|
|
- //审核成功,并取消设置越过部门并审
|
|
|
+//审核成功,并取消设置越过部门并审
|
|
|
$log_checkState = $checkState = TalentState::FST_VERIFY_PASS; //初审成功
|
|
|
$data["pass_dept_check"] = 0;
|
|
|
} else if ($params["checkState"] == 4) {
|
|
|
if ($talent_info["highProcess"] < 3)
|
|
|
return json(["msg" => "只有曾经通过部门并审,初审时才可以选择直接跳过部门并审阶段"]);
|
|
|
- //审核成功,并设置越过部门并审。附加条件:最高进度曾经通过部门并审3(包含部门并审)
|
|
|
+//审核成功,并设置越过部门并审。附加条件:最高进度曾经通过部门并审3(包含部门并审)
|
|
|
$log_checkState = $checkState = TalentState::FST_VERIFY_PASS; //初审成功
|
|
|
$data["pass_dept_check"] = $talent_info["highProcess"] >= 3 ? 1 : 0;
|
|
|
} else {
|
|
|
- //审核驳回并记录需要修改的字段和上传文件
|
|
|
+//审核驳回并记录需要修改的字段和上传文件
|
|
|
$checkState = TalentState::SCND_SAVE; //退回材料编辑状态
|
|
|
$log_checkState = TalentState::FST_VERIFY_REJECT; //日志记录拒绝状态
|
|
|
}
|
|
@@ -585,7 +699,7 @@ class Talent extends AdminController {
|
|
|
$data["first_dept_check_time"] = date("Y-m-d H:i:s");
|
|
|
$condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
|
|
|
$companyIds = array_filter(explode(",", $condition["companyIds"])); //该条件下需要审核的所有单位
|
|
|
- //这边去除已经审核通过的单位,主要通过日志是否存在记录。
|
|
|
+//这边去除已经审核通过的单位,主要通过日志是否存在记录。
|
|
|
$pass_companyIds = TalentLogApi::getPassDepts($talent_info["id"]); //已经通过的单位
|
|
|
$unpass_companyIds = array_diff($companyIds, (array) $pass_companyIds); //排除已经通过的单位
|
|
|
sort($unpass_companyIds);
|
|
@@ -615,11 +729,11 @@ class Talent extends AdminController {
|
|
|
|
|
|
$params = $request->param();
|
|
|
if ($params["checkState"] == 3) {
|
|
|
- //审核成功
|
|
|
+//审核成功
|
|
|
$log_checkState = TalentState::FST_VERIFY_PASS; //当前状态不变
|
|
|
$checkState = TalentState::DEPT_VERIFY_PASS; //审核成功
|
|
|
} else {
|
|
|
- //审核驳回并记录需要修改的字段和上传文件
|
|
|
+//审核驳回并记录需要修改的字段和上传文件
|
|
|
$checkState = TalentState::SCND_SUBMIT; //退回待初审
|
|
|
$log_checkState = TalentState::FST_VERIFY_PASS; //当前状态不变
|
|
|
$data["modify_files"] = $params["files"];
|
|
@@ -634,7 +748,7 @@ class Talent extends AdminController {
|
|
|
return json(["msg" => "您的部门已经审核过了"]);
|
|
|
$data["id"] = $talent_info["id"];
|
|
|
TalentModel::update($data);
|
|
|
- //修改日志
|
|
|
+//修改日志
|
|
|
TalentLogApi::rewrite($dept_log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
|
|
|
return json(["code" => 200, "msg" => "保存成功"]);
|
|
|
}
|
|
@@ -679,7 +793,7 @@ class Talent extends AdminController {
|
|
|
}
|
|
|
}
|
|
|
if ($over == count($companys)) {
|
|
|
- //全部已审核
|
|
|
+//全部已审核
|
|
|
$checkState = TalentState::SCND_SUBMIT;
|
|
|
$log_checkState = TalentState::DEPT_VERIFY_REJECT;
|
|
|
if ($error == 0) {
|
|
@@ -705,10 +819,10 @@ class Talent extends AdminController {
|
|
|
private function reCheck(\think\Request $request, $talent_info) {
|
|
|
$params = $request->param();
|
|
|
if ($params["checkState"] == 3) {
|
|
|
- //审核成功
|
|
|
+//审核成功
|
|
|
$log_checkState = $checkState = TalentState::REVERIFY_PASS; //复核成功
|
|
|
} else if ($params["checkState"] == 2) {
|
|
|
- //审核驳回并记录需要修改的字段和上传文件
|
|
|
+//审核驳回并记录需要修改的字段和上传文件
|
|
|
$checkState = TalentState::SCND_SUBMIT; //退回待初审
|
|
|
$log_checkState = TalentState::REVERIFY_REJECT; //日志记录拒绝状态
|
|
|
} else {
|
|
@@ -753,7 +867,7 @@ class Talent extends AdminController {
|
|
|
}
|
|
|
|
|
|
public function check() {
|
|
|
- //公共调度方法
|
|
|
+//公共调度方法
|
|
|
$request = $this->request;
|
|
|
$params = $request->param();
|
|
|
$check = $params["checkState"];
|
|
@@ -794,7 +908,7 @@ class Talent extends AdminController {
|
|
|
}
|
|
|
|
|
|
public function submitCheck() {
|
|
|
- //公共调度方法
|
|
|
+//公共调度方法
|
|
|
$id = $this->request->param("id");
|
|
|
$talent_info = VerifyApi::getOne($id);
|
|
|
$checkState = $talent_info["checkState"];
|
|
@@ -828,7 +942,7 @@ class Talent extends AdminController {
|
|
|
$talent_info = VerifyApi::getOne($id);
|
|
|
if ($talent_info) {
|
|
|
$checkState = $talent_info["checkState"];
|
|
|
- // 0正在填写 1保存未提交 2已提交未审核 3已审核 4驳回 5保存补充材料未提交 6提交补充材料进入初审 7初审通过 8初审驳回 9部门审核通过 10部门审核驳回 11复核通过 12复核驳回 13复核失败
|
|
|
+// 0正在填写 1保存未提交 2已提交未审核 3已审核 4驳回 5保存补充材料未提交 6提交补充材料进入初审 7初审通过 8初审驳回 9部门审核通过 10部门审核驳回 11复核通过 12复核驳回 13复核失败
|
|
|
$process = 0;
|
|
|
if (in_array($checkState, [2, 6, 7, 9])) {
|
|
|
switch ($checkState) {
|
|
@@ -924,7 +1038,9 @@ class Talent extends AdminController {
|
|
|
}
|
|
|
if ($datas) {
|
|
|
export($columns, $datas);
|
|
|
+ exit();
|
|
|
}
|
|
|
+ echo "<script>parent.layer.alert('没有可以导出的数据');</script>";
|
|
|
}
|
|
|
|
|
|
public function getPhones() {
|