|
@@ -2,7 +2,10 @@
|
|
|
|
|
|
namespace app\admin\controller;
|
|
|
|
|
|
+use app\common\model\EnterpriseCloseAccount as EcaModel;
|
|
|
use app\admin\common\AdminController;
|
|
|
+use think\facade\Db;
|
|
|
+use app\common\state\MainState;
|
|
|
|
|
|
/**
|
|
|
* Description of EnterpriseCloseAccount
|
|
@@ -20,29 +23,24 @@ class EnterpriseCloseAccount extends AdminController {
|
|
|
$offset = $params["offset"] ?: 0;
|
|
|
$order = $params["order"] ?: "desc";
|
|
|
$limit = $params["limit"] ?: 10;
|
|
|
- $where = $this->setTalentQuit($params);
|
|
|
+ $where = $this->setFilter($params);
|
|
|
$where[] = ["type", "=", $this->user["type"]];
|
|
|
- $where[] = ["delete", "=", 0];
|
|
|
- //获取字典表人才层次
|
|
|
- $levelMap = DictApi::selectByParentCode("talent_arrange");
|
|
|
- $typeMap = DictApi::selectByParentCode("enterprise_tag");
|
|
|
- $count = TqModel::where($where)->count();
|
|
|
- $list = TqModel::where($where)->limit($offset, $limit)->order("createTime {$order}")->select()->toArray();
|
|
|
- foreach ($list as $key => $item) {
|
|
|
- $list[$key]["talentArrangeName"] = $levelMap[$item["talentArrange"]];
|
|
|
- $list[$key]["talentTypeName"] = $typeMap[$item["talentType"]];
|
|
|
- }
|
|
|
+ $count = EcaModel::where($where)->count();
|
|
|
+ $list = EcaModel::where($where)->limit($offset, $limit)->order("createTime {$order}")->select()->toArray();
|
|
|
|
|
|
return json(["rows" => $list, "total" => $count]);
|
|
|
}
|
|
|
|
|
|
public function check() {
|
|
|
$id = $this->request["id"];
|
|
|
- $info = TqModel::where("id", $id)->find();
|
|
|
- $info["talentArrangeName"] = DictApi::selectByParentCode("talent_arrange")[$info["talentArrange"]];
|
|
|
- if (\StrUtil::isNotEmpAndNull($info["talentType"])) {
|
|
|
- $info["talentTypeName"] = DictApi::selectByParentCode("enterprise_tag")[$info["talentType"]];
|
|
|
+ $info = EcaModel::where("id", $id)->find();
|
|
|
+ $files = json_decode($info["files"], true);
|
|
|
+ $fileTmp = [];
|
|
|
+ foreach ($files as $file) {
|
|
|
+ $ext = pathinfo($file)["extension"];
|
|
|
+ $fileTmp[] = ["ext" => $ext, "path" => $file];
|
|
|
}
|
|
|
+ $info["files"] = $fileTmp;
|
|
|
return view("check", ["type" => $this->user["type"], "row" => $info]);
|
|
|
}
|
|
|
|
|
@@ -52,7 +50,7 @@ class EnterpriseCloseAccount extends AdminController {
|
|
|
$id = $this->request["id"];
|
|
|
$checkState = $this->request["checkState"];
|
|
|
$checkMsg = $this->request["checkMsg"];
|
|
|
- $info = TqModel::where("id", $id)->find();
|
|
|
+ $info = EcaModel::where("id", $id)->find();
|
|
|
if (!$info) {
|
|
|
$responseObj->msg = "系统错误,请联系管理员";
|
|
|
return $responseObj;
|
|
@@ -66,38 +64,28 @@ class EnterpriseCloseAccount extends AdminController {
|
|
|
//添加日志
|
|
|
$user = $this->user;
|
|
|
$log["id"] = getStringId();
|
|
|
+ $log["category"] = "enterprise_change";
|
|
|
$log["active"] = 1;
|
|
|
$log["state"] = $checkState;
|
|
|
- $log["step"] = 11;
|
|
|
+ $log["step"] = 101;
|
|
|
$log["stateChange"] = MainState::getStateName($info["checkState"]) . "->" . MainState::getStateName($checkState);
|
|
|
- $log["type"] = ProjectState::QUIT;
|
|
|
+ $log["type"] = 10;
|
|
|
$log["mainId"] = $id;
|
|
|
$log["description"] = $checkMsg;
|
|
|
$log["createUser"] = $user ? sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]) : "系统";
|
|
|
$log["createTime"] = date("Y-m-d H:i:s");
|
|
|
- $updTalentQuit["id"] = $id;
|
|
|
- $updTalentQuit["checkState"] = $checkState;
|
|
|
- $updTalentQuit["checkMsg"] = $checkMsg;
|
|
|
+ $updEca["id"] = $id;
|
|
|
+ $updEca["checkState"] = $checkState;
|
|
|
+ $updEca["checkMsg"] = $checkMsg;
|
|
|
if ($checkState == 3) {
|
|
|
- //修改人才库信息
|
|
|
- $upd["id"] = $info["talentId"];
|
|
|
- $upd["active"] = 2;
|
|
|
- $upd["cur_quit_time"] = $info["quitTime"];
|
|
|
- Db::table("new_talent_info")->save($upd);
|
|
|
-
|
|
|
- $talentLog["id"] = getStringId();
|
|
|
- $talentLog["active"] = 1;
|
|
|
- $talentLog["step"] = 22;
|
|
|
- $talentLog["type"] = ProjectState::TALENT;
|
|
|
- $talentLog["mainId"] = $info["talentId"];
|
|
|
- $talentLog["description"] = "离职变更通过,同步到人才库";
|
|
|
- $talentLog["createUser"] = $user ? sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]) : "系统";
|
|
|
- $talentLog["createTime"] = date("Y-m-d H:i:s");
|
|
|
- Db::table("new_talent_checklog")->insert($talentLog);
|
|
|
- $updTalentQuit["passTime"] = date("Y-m-d H:i:s");
|
|
|
+ $upd["id"] = $info["enterpriseId"];
|
|
|
+ $upd["delete"] = 1;
|
|
|
+ Db::table("un_enterprise")->save($upd);
|
|
|
+
|
|
|
+ $updEca["passTime"] = date("Y-m-d H:i:s");
|
|
|
}
|
|
|
Db::table("new_talent_checklog")->insert($log);
|
|
|
- Db::table("un_talent_quit")->save($updTalentQuit);
|
|
|
+ Db::table("un_enterpriseclose_record")->save($updEca);
|
|
|
$responseObj->code = 200;
|
|
|
$responseObj->msg = "审核成功";
|
|
|
|
|
@@ -112,32 +100,18 @@ class EnterpriseCloseAccount extends AdminController {
|
|
|
|
|
|
public function export() {
|
|
|
$request = $this->request;
|
|
|
- $data["talentName"] = \StrUtil::getRequestDecodeParam($request, "talentName");
|
|
|
+ $data["name"] = \StrUtil::getRequestDecodeParam($request, "name");
|
|
|
$data["idCard"] = \StrUtil::getRequestDecodeParam($request, "idCard");
|
|
|
- $data["enterpriseName"] = \StrUtil::getRequestDecodeParam($request, "enterpriseName");
|
|
|
- $data["talentArrange"] = \StrUtil::getRequestDecodeParam($request, "talentArrange");
|
|
|
$data["checkState"] = \StrUtil::getRequestDecodeParam($request, "checkState");
|
|
|
- $where = $this->setTalentQuit($data);
|
|
|
+ $where = $this->setFilter($data);
|
|
|
$where[] = ["type", "=", $this->user["type"]];
|
|
|
- $where[] = ["delete", "=", 0];
|
|
|
-
|
|
|
- $list = TqModel::where($where)->select()->toArray();
|
|
|
- $levelMap = DictApi::selectByParentCode("talent_arrange");
|
|
|
-
|
|
|
- if ($this->user["type"] == 1) {
|
|
|
- $title = ["姓名", "证件号码", "工作单位", "人才层次", "认定时间", "合同开始时间", "合同截止时间", "入职时间", "离职时间", "离职申报原因",
|
|
|
- "手机号码", "审核状态", "审核意见", "审核通过时间"];
|
|
|
- $keys = ["talentName", "idCard", "enterpriseName", "talentArrangeName", "identifyTime", "starttime", "endtime", "entryTime", "quitTime", "quitReason",
|
|
|
- "phone", "checkStateName", "checkMsg", "passTime"];
|
|
|
- } else {
|
|
|
- $title = ["姓名", "证件号码", "工作单位", "人才层次", "认定时间", "合同开始时间", "合同截止时间", "入职时间", "离职时间",
|
|
|
- "手机号码", "审核状态", "审核意见", "审核通过时间"];
|
|
|
- $keys = ["talentName", "idCard", "enterpriseName", "talentArrangeName", "identifyTime", "starttime", "endtime", "entryTime", "quitTime",
|
|
|
- "phone", "checkStateName", "checkMsg", "passTime"];
|
|
|
- }
|
|
|
+
|
|
|
+ $list = EcaModel::where($where)->select()->toArray();
|
|
|
+
|
|
|
+ $title = ["单位名称", "统一社会信用代码", "登录账号", "注销原因", "审核状态", "审核意见", "审核通过时间"];
|
|
|
+ $keys = ["name", "idCard", "username", "reason", "checkStateName", "checkMsg", "passTime"];
|
|
|
$rows = [];
|
|
|
foreach ($list as &$item) {
|
|
|
- $item["talentArrangeName"] = $levelMap[$item["talentArrange"]];
|
|
|
switch ($item["checkState"]) {
|
|
|
case -1:
|
|
|
$item["checkStateName"] = "待提交";
|
|
@@ -165,26 +139,20 @@ class EnterpriseCloseAccount extends AdminController {
|
|
|
if (!$rows) {
|
|
|
return json(["msg" => "没有可导出的内容"]);
|
|
|
}
|
|
|
- $fileName = "离职变更列表";
|
|
|
+ $fileName = "账户注销申请列表";
|
|
|
export($title, $rows, $fileName);
|
|
|
}
|
|
|
|
|
|
- private function setTalentQuit($talentQuitInfo) {
|
|
|
+ private function setFilter($params) {
|
|
|
$where = [];
|
|
|
- if (\StrUtil::isNotEmpAndNull($talentQuitInfo["talentName"])) {
|
|
|
- $where[] = ["talentName", "=", $talentQuitInfo["talentName"]];
|
|
|
- }
|
|
|
- if (\StrUtil::isNotEmpAndNull($talentQuitInfo["idCard"])) {
|
|
|
- $where[] = ["idCard", "=", $talentQuitInfo["IdCard"]];
|
|
|
- }
|
|
|
- if (\StrUtil::isNotEmpAndNull($talentQuitInfo["enterpriseName"])) {
|
|
|
- $where[] = ["enterpriseName", "=", $talentQuitInfo["enterpriseName"]];
|
|
|
+ if (\StrUtil::isNotEmpAndNull($params["idCard"])) {
|
|
|
+ $where[] = ["idCard", "=", $params["IdCard"]];
|
|
|
}
|
|
|
- if (\StrUtil::isNotEmpAndNull($talentQuitInfo["talentArrange"])) {
|
|
|
- $where[] = ["talentArrange", "=", $talentQuitInfo["talentArrange"]];
|
|
|
+ if (\StrUtil::isNotEmpAndNull($params["name"])) {
|
|
|
+ $where[] = ["name", "=", $params["name"]];
|
|
|
}
|
|
|
- if ($talentQuitInfo["checkState"] != null) {
|
|
|
- $where[] = ["checkState", "=", $talentQuitInfo["checkState"]];
|
|
|
+ if ($params["checkState"] != null) {
|
|
|
+ $where[] = ["checkState", "=", $params["checkState"]];
|
|
|
}
|
|
|
return $where;
|
|
|
}
|