|
@@ -9,6 +9,7 @@ use app\common\state\ProjectState;
|
|
|
use app\common\model\TalentLog;
|
|
|
use think\facade\Db;
|
|
|
use app\common\api\EnterpriseApi;
|
|
|
+use app\common\api\DictApi;
|
|
|
|
|
|
/**
|
|
|
* Description of TalentBankChange
|
|
@@ -28,7 +29,7 @@ class TalentBankChange extends EnterpriseController {
|
|
|
$offset = $params["offset"] ?: 0;
|
|
|
$limit = $params["limit"] ?: 10;
|
|
|
$where = [];
|
|
|
- $where[] = ["newEnterpriseId", "=", $this->user["uid"]];
|
|
|
+ $where[] = ["enterpriseId", "=", $this->user["uid"]];
|
|
|
$where[] = ["delete", "=", 0];
|
|
|
if ($params["talentName"]) {
|
|
|
$where[] = ["talentName", "like", "%" . $params["talentName"] . "%"];
|
|
@@ -36,23 +37,20 @@ class TalentBankChange extends EnterpriseController {
|
|
|
if ($params["idCard"]) {
|
|
|
$where[] = ["idCard", "like", "%" . $params["idCard"] . "%"];
|
|
|
}
|
|
|
- if ($params["oldEnterpriseId"]) {
|
|
|
- $whr = [];
|
|
|
- $whr[] = ["name", "like", "%{$params["oldEnterpriseId"]}%"];
|
|
|
- $ids = \app\common\model\Enterprise::where($whr)->column("id");
|
|
|
- $where[] = ["oldEnterpriseId", "in", $ids];
|
|
|
+ if ($params["oldBankName"]) {
|
|
|
+ $where[] = ["oldBankName", "like", "%" . $params["oldBankName"] . "%"];
|
|
|
+ }
|
|
|
+ if ($params["newBankName"]) {
|
|
|
+ $where[] = ["newBankName", "like", "%" . $params["newBankName"] . "%"];
|
|
|
}
|
|
|
if ($params["checkState"]) {
|
|
|
$where[] = ["checkState", "=", $params["checkState"]];
|
|
|
}
|
|
|
- $count = TwcModel::where($where)->count();
|
|
|
- $list = TwcModel::where($where)->limit($offset, $limit)->order("createTime " . $order)->select()->toArray();
|
|
|
- $talentArrangeMap = \app\common\api\DictApi::selectByParentCode("talent_arrange");
|
|
|
- $epMaps = \app\common\model\Enterprise::column("name", "id");
|
|
|
+ $count = TbcModel::where($where)->count();
|
|
|
+ $list = TbcModel::where($where)->limit($offset, $limit)->order("createTime " . $order)->select()->toArray();
|
|
|
+ $talentArrangeMap = DictApi::selectByParentCode("talent_arrange");
|
|
|
foreach ($list as &$item) {
|
|
|
$item["talentArrangeName"] = $talentArrangeMap[$item["talentArrange"]];
|
|
|
- $item["oldEnterpriseName"] = $epMaps[$item["oldEnterpriseId"]];
|
|
|
- $item["newEnterpriseName"] = $epMaps[$item["newEnterpriseId"]];
|
|
|
}unset($item);
|
|
|
|
|
|
return json(["total" => $count, "rows" => $list]);
|
|
@@ -61,12 +59,9 @@ class TalentBankChange extends EnterpriseController {
|
|
|
public function apply() {
|
|
|
$request = $this->request;
|
|
|
$id = isset($request["id"]) ? $request["id"] : 0;
|
|
|
- $info = TwcModel::where("id", $id)->find();
|
|
|
+ $info = TbcModel::where("id", $id)->find();
|
|
|
if ($info) {
|
|
|
- $epOld = EnterpriseApi::getOne($info["oldEnterpriseId"]);
|
|
|
- $epNew = EnterpriseApi::getOne($info["newEnterpriseId"]);
|
|
|
- $info["oldEnterpriseName"] = $epOld["name"];
|
|
|
- $info["newEnterpriseName"] = $epNew["name"];
|
|
|
+ $info["talentArrangeName"] = DictApi::selectByParentCode("talent_arrange")[$info["talentArrange"]];
|
|
|
}
|
|
|
if ($this->request->isPost()) {
|
|
|
$response = new \stdClass();
|
|
@@ -78,21 +73,18 @@ class TalentBankChange extends EnterpriseController {
|
|
|
}
|
|
|
$talentInfo = \app\common\api\VerifyApi::getTalentInfoById($request["talentId"]);
|
|
|
if ($data["id"]) {
|
|
|
- unset($data["year"]);
|
|
|
$data["updateUser"] = $this->user["uid"];
|
|
|
$data["updateTime"] = date("Y-m-d H:i:s");
|
|
|
- TwcModel::update($data);
|
|
|
+ TbcModel::update($data);
|
|
|
$response->code = 200;
|
|
|
$response->msg = "修改成功";
|
|
|
return $response;
|
|
|
} else {
|
|
|
$data["id"] = getStringId();
|
|
|
- $data["oldStartTime"] = $talentInfo["startTime"];
|
|
|
- $data["oldEndTime"] = $talentInfo["endTime"];
|
|
|
$data["checkState"] = -1;
|
|
|
$data["createUser"] = $this->user["uid"];
|
|
|
$data["createTime"] = date("Y-m-d H:i:s");
|
|
|
- TwcModel::create($data);
|
|
|
+ TbcModel::create($data);
|
|
|
|
|
|
$user = $this->user;
|
|
|
$log["id"] = getStringId();
|
|
@@ -100,9 +92,9 @@ class TalentBankChange extends EnterpriseController {
|
|
|
$log["state"] = 1;
|
|
|
$log["step"] = 0;
|
|
|
$log["stateChange"] = "";
|
|
|
- $log["type"] = ProjectState::WORKCHANGE;
|
|
|
+ $log["type"] = ProjectState::BANKCHANGE;
|
|
|
$log["mainId"] = $data["id"];
|
|
|
- $log["description"] = "添加工作单位变更申报";
|
|
|
+ $log["description"] = "添加银行账号变更申请";
|
|
|
$log["createUser"] = $user ? sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]) : "系统";
|
|
|
$log["createTime"] = date("Y-m-d H:i:s");
|
|
|
TalentLog::create($log);
|
|
@@ -112,17 +104,13 @@ class TalentBankChange extends EnterpriseController {
|
|
|
return $response;
|
|
|
}
|
|
|
}
|
|
|
- $year = $info["year"] ?: $request["year"];
|
|
|
- return view("", ["type" => $this->user["type"], "year" => $year, "row" => $info]);
|
|
|
+ return view("", ["row" => $info]);
|
|
|
}
|
|
|
|
|
|
public function view() {
|
|
|
$id = $this->request["id"];
|
|
|
- $info = TwcModel::where("id", $id)->find();
|
|
|
- $epOld = EnterpriseApi::getOne($info["oldEnterpriseId"]);
|
|
|
- $epNew = EnterpriseApi::getOne($info["newEnterpriseId"]);
|
|
|
- $info["oldEnterpriseName"] = $epOld["name"];
|
|
|
- $info["newEnterpriseName"] = $epNew["name"];
|
|
|
+ $info = TbcModel::where("id", $id)->find();
|
|
|
+ $info["talentArrangeName"] = DictApi::selectByParentCode("talent_arrange")[$info["talentArrange"]];
|
|
|
return view("", ["row" => $info]);
|
|
|
}
|
|
|
|
|
@@ -130,7 +118,7 @@ class TalentBankChange extends EnterpriseController {
|
|
|
$response = new \stdClass();
|
|
|
$response->code = 500;
|
|
|
$id = $this->request["id"];
|
|
|
- $info = TwcModel::where("id", $id)->find();
|
|
|
+ $info = TbcModel::where("id", $id)->find();
|
|
|
if (!$info) {
|
|
|
$response->msg = "提交审核失败,请先填写基础信息";
|
|
|
return $response;
|
|
@@ -139,38 +127,16 @@ class TalentBankChange extends EnterpriseController {
|
|
|
$response->msg = "不能重复提交审核";
|
|
|
return $response;
|
|
|
}
|
|
|
- $where = [];
|
|
|
- $where[] = ["type", "=", $info["type"]];
|
|
|
- $where[] = ["project", "=", ProjectState::WORKCHANGE];
|
|
|
- $where[] = ["active", "=", 1];
|
|
|
- $filetypes = Db::table("new_common_filetype")->where($where)->order("sn asc")->select()->toArray();
|
|
|
- foreach ($filetypes as $filetype) {
|
|
|
- $sb = [];
|
|
|
- $sb[] = "以下为必传附件:";
|
|
|
- if ($filetype["must"] == 1) {
|
|
|
- $where = [];
|
|
|
- $where[] = ["mainId", "=", $id];
|
|
|
- $where[] = ["typeId", "=", $filetype["id"]];
|
|
|
- $count = Db::table("new_talent_common_file")->where($where)->count();
|
|
|
- if ($count == 0) {
|
|
|
- $sb[] = $filetype["name"] . ";";
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (count($sb) > 1) {
|
|
|
- $response->msg = implode("<br>", $sb);
|
|
|
- return $response;
|
|
|
- }
|
|
|
$data["id"] = $id;
|
|
|
$data["checkState"] = $info["checkState"] == 2 ? 9 : 1;
|
|
|
- TwcModel::update($data);
|
|
|
+ TbcModel::update($data);
|
|
|
$user = $this->user;
|
|
|
$log["id"] = getStringId();
|
|
|
$log["active"] = 1;
|
|
|
$log["state"] = 1;
|
|
|
$log["step"] = 0;
|
|
|
- $log["stateChange"] = "<span class='label'>待提交</span>-><span class='label label-success'>待审核</span>";
|
|
|
- $log["type"] = ProjectState::WORKCHANGE;
|
|
|
+ $log["stateChange"] = "<span class='label'>待提交</span>-><span class='label label-success'>待初审</span>";
|
|
|
+ $log["type"] = ProjectState::BANKCHANGE;
|
|
|
$log["mainId"] = $id;
|
|
|
$log["description"] = "确认提交审核";
|
|
|
$log["createUser"] = $user ? sprintf("%s(%s)", $user["account"], $user["companyName"] ?: $user["rolename"]) : "系统";
|
|
@@ -185,7 +151,7 @@ class TalentBankChange extends EnterpriseController {
|
|
|
public function delete() {
|
|
|
$response = new \stdClass();
|
|
|
$response->code = 500;
|
|
|
- $info = TwcModel::where("id", $this->request["id"])->find();
|
|
|
+ $info = TbcModel::where("id", $this->request["id"])->find();
|
|
|
if ($info["checkState"] != -1) {
|
|
|
$response->msg = "已提交审核,无法删除";
|
|
|
return $response;
|
|
@@ -193,7 +159,7 @@ class TalentBankChange extends EnterpriseController {
|
|
|
$data["id"] = $info["id"];
|
|
|
$data["delete"] = 1;
|
|
|
$data["deleteTime"] = date("Y-m-d H:i:s");
|
|
|
- TwcModel::update($data);
|
|
|
+ TbcModel::update($data);
|
|
|
$response->code = 200;
|
|
|
$response->msg = "删除成功";
|
|
|
return $response;
|
|
@@ -202,33 +168,41 @@ class TalentBankChange extends EnterpriseController {
|
|
|
private function dataCheck($data) {
|
|
|
$response = new \stdClass();
|
|
|
$response->code = 500;
|
|
|
- if (\StrUtil::isEmpOrNull($data["starttime"])) {
|
|
|
- $response->msg = "合同开始时间不能为空";
|
|
|
+ if (\StrUtil::isEmpOrNull($data["talentId"])) {
|
|
|
+ $response->msg = "申报对象不能为空";
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+ if (\StrUtil::isEmpOrNull($data["newBankName"])) {
|
|
|
+ $response->msg = "新开户银行不能为空";
|
|
|
return $response;
|
|
|
}
|
|
|
- if (\StrUtil::isEmpOrNull($data["endtime"])) {
|
|
|
- $response->msg = "合同结束时间不能为空";
|
|
|
+ if (\StrUtil::isEmpOrNull($data["newBankNerPoint"])) {
|
|
|
+ $response->msg = "新开户银行网点不能为空";
|
|
|
return $response;
|
|
|
}
|
|
|
- if (\StrUtil::isEmpOrNull($data["phone"])) {
|
|
|
- $response->msg = "手机号码不能为空";
|
|
|
+ if (\StrUtil::isEmpOrNull($data["newBankAccount"])) {
|
|
|
+ $response->msg = "新开户银行账号不能为空";
|
|
|
return $response;
|
|
|
}
|
|
|
- if (\StrUtil::isEmpOrNull($data["newEnterpriseId"])) {
|
|
|
- $response->msg = "新单位名称不能为空";
|
|
|
+ if (!preg_match("/^[\x{4e00}-\x{9fa5}]*银行$/u", $data["newBankName"])) {
|
|
|
+ $response->msg = "新开户银行格式不正确";
|
|
|
return $response;
|
|
|
}
|
|
|
- if (\StrUtil::isEmpOrNull($data["phone"])) {
|
|
|
- $response->msg = "手机号码不能为空";
|
|
|
+ if (!preg_match("/^[\x{4e00}-\x{9fa5}]*银行[\x{4e00}-\x{9fa5}]*省?[\x{4e00}-\x{9fa5}]+市[\x{4e00}-\x{9fa5}]*$/u", $data["newBankNerPoint"])) {
|
|
|
+ $response->msg = "新开户银行网点格式不正确";
|
|
|
return $response;
|
|
|
}
|
|
|
- if (\StrUtil::isEmpOrNull($data["anyTime"])) {
|
|
|
- $response->msg = "入职/变更时间不能为空";
|
|
|
+ if (!preg_match("/^\d+$/", $data["newBankAccount"])) {
|
|
|
+ $response->msg = "新银行账户格式不合法";
|
|
|
return $response;
|
|
|
}
|
|
|
if ($data["type"] == 1) {
|
|
|
- if (\StrUtil::isEmpOrNull($data["anyReason"])) {
|
|
|
- $response->msg = "单位变更申报原因不能为空";
|
|
|
+ if (\StrUtil::isEmpOrNull($data["newBankNumber"])) {
|
|
|
+ $response->msg = "新银行行号不能为空";
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+ if (!preg_match("/^\d+$/", $data["newBankNumber"])) {
|
|
|
+ $response->msg = "银行行号格式不合法";
|
|
|
return $response;
|
|
|
}
|
|
|
}
|