|
@@ -37,6 +37,7 @@ class House extends EnterpriseController {
|
|
$where = [];
|
|
$where = [];
|
|
$where[] = ["type", "=", $this->user["type"]];
|
|
$where[] = ["type", "=", $this->user["type"]];
|
|
$where[] = ["enterpriseId", "=", $this->user["uid"]];
|
|
$where[] = ["enterpriseId", "=", $this->user["uid"]];
|
|
|
|
+ $where[] = ["delete", "=", 0];
|
|
if ($params["year"]) {
|
|
if ($params["year"]) {
|
|
$where[] = ["year", "=", $params["year"]];
|
|
$where[] = ["year", "=", $params["year"]];
|
|
}
|
|
}
|
|
@@ -99,7 +100,7 @@ class House extends EnterpriseController {
|
|
$info = HouseApi::getInfoById($id);
|
|
$info = HouseApi::getInfoById($id);
|
|
$childrenList = HouseApi::getChildren($id);
|
|
$childrenList = HouseApi::getChildren($id);
|
|
$houseInfo = HouseApi::getHouseInfo($info["idCard"]);
|
|
$houseInfo = HouseApi::getHouseInfo($info["idCard"]);
|
|
- $dicts = DictApi::selectByParentCode("card_type");
|
|
|
|
|
|
+ $dicts = DictApi::findChildDictByCode("card_type");
|
|
$vars["dicts"] = $dicts;
|
|
$vars["dicts"] = $dicts;
|
|
$vars["row"] = $info;
|
|
$vars["row"] = $info;
|
|
$vars["hand"] = $houseInfo ? 2 : 1;
|
|
$vars["hand"] = $houseInfo ? 2 : 1;
|
|
@@ -115,9 +116,10 @@ class House extends EnterpriseController {
|
|
}
|
|
}
|
|
|
|
|
|
public function detail(\think\Request $request) {
|
|
public function detail(\think\Request $request) {
|
|
|
|
+ $id = $this->request["id"];
|
|
$info = HouseApi::getInfoById($id);
|
|
$info = HouseApi::getInfoById($id);
|
|
$childrenList = HouseApi::getChildren($id);
|
|
$childrenList = HouseApi::getChildren($id);
|
|
- $dicts = DictApi::selectByParentCode("card_type");
|
|
|
|
|
|
+ $dicts = DictApi::findChildDictByCode("card_type");
|
|
$vars["dicts"] = $dicts;
|
|
$vars["dicts"] = $dicts;
|
|
$vars["row"] = $info;
|
|
$vars["row"] = $info;
|
|
$vars["childrenList"] = $childrenList;
|
|
$vars["childrenList"] = $childrenList;
|
|
@@ -125,67 +127,6 @@ class House extends EnterpriseController {
|
|
return view("", $vars);
|
|
return view("", $vars);
|
|
}
|
|
}
|
|
|
|
|
|
- private function other_validate(&$info, $type) {
|
|
|
|
- //校验配偶是否在库
|
|
|
|
- if ($info["spouseIsLibrary"] && $info["spouseIsLibrary"] == 1) {
|
|
|
|
- if (\StrUtil::isEmpOrNull($info["spouseIdcard"])) {
|
|
|
|
- return new Response(Response::ERROR, "请填写配偶证件号码");
|
|
|
|
- }
|
|
|
|
- if (\StrUtil::isEmpOrNull($info["spouseName"])) {
|
|
|
|
- return new Response(Response::ERROR, "请填写配偶姓名");
|
|
|
|
- }
|
|
|
|
- $where = [];
|
|
|
|
- $where[] = ["card_number", "=", $info["spouseIdcard"]];
|
|
|
|
- $where[] = ["name", "=", $info["spouseName"]];
|
|
|
|
- $where[] = ["checkState", "=", \app\common\api\TalentState::CERTIFICATED];
|
|
|
|
- $where[] = ["isEffect", "<>", 4];
|
|
|
|
- $where[] = ["delete", "=", 0];
|
|
|
|
- $count = Db::table("new_talent_info")->where($where)->count();
|
|
|
|
- if ($count == 0) {
|
|
|
|
- return new Response(Response::ERROR, "人才库中未查询到配偶相关信息");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- $ti = \app\common\api\VerifyApi::getTalentInfoById($info["talentId"]);
|
|
|
|
- $info["provinceCode"] = $ti["province"];
|
|
|
|
- $info["provinceName"] = $ti["provinceName"];
|
|
|
|
- $info["cityCode"] = $ti["city"];
|
|
|
|
- $info["cityName"] = $ti["cityName"];
|
|
|
|
- $info["countyCode"] = $ti["county"];
|
|
|
|
- $info["countyName"] = $ti["countyName"];
|
|
|
|
- $info["street"] = $ti["street"];
|
|
|
|
- $info["bank"] = $ti["bank"];
|
|
|
|
- $info["bankAccount"] = $ti["bank_account"];
|
|
|
|
- $info["bankNetwork"] = $ti["bank_branch_name"];
|
|
|
|
- $info["bankNumber"] = $ti["bank_number"];
|
|
|
|
- /* * 校验上一年度人才层次 */
|
|
|
|
- if ($type == 1) {
|
|
|
|
- $responseObj = $this->getTalentArrange($ti, $info["year"]);
|
|
|
|
- if ($responseObj->code == 500) {
|
|
|
|
- return $responseObj;
|
|
|
|
- }
|
|
|
|
- $resInfo = $responseObj->obj;
|
|
|
|
- $info["talentArrange"] = $resInfo["talentArrange"];
|
|
|
|
- $info["identifyCondition"] = $resInfo["identifyCondition"];
|
|
|
|
- $info["idenfityConditionName"] = $resInfo["identifyConditionName"];
|
|
|
|
- $info["identifyGetTime"] = $resInfo["identifyGetTime"];
|
|
|
|
-
|
|
|
|
- //设置上一年度人才层次有效月份
|
|
|
|
- $info["monthCount"] = count($resInfo["monthList"]);
|
|
|
|
- if ($info["monthCount"] < 9) {
|
|
|
|
- return new Response(Response::ERROR, "申报年度人才证书有效期未满足九个月,无法申报购房补贴");
|
|
|
|
- }
|
|
|
|
- $info["talentArrangeMonths"] = implode(",", $resInfo["monthList"]);
|
|
|
|
- }
|
|
|
|
- return new Response(Response::SUCCESS, "");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private function validateIsEdit($checkState) {
|
|
|
|
- if ($checkState != MainState::SAVE && $checkState != MainState::FIRST_REJECT) {
|
|
|
|
- return new Response(Response::ERROR, "正在审核中,无法修改");
|
|
|
|
- }
|
|
|
|
- return new Response(Response::SUCCESS, "");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 提交表单
|
|
* 提交表单
|
|
*/
|
|
*/
|
|
@@ -281,6 +222,7 @@ class House extends EnterpriseController {
|
|
}
|
|
}
|
|
|
|
|
|
public function save($info, \think\Request $request) {
|
|
public function save($info, \think\Request $request) {
|
|
|
|
+ Db::startTrans();
|
|
try {
|
|
try {
|
|
$batch = BatchApi::checkBatchValid(["type" => ProjectState::HOUSE, "year" => $info["year"], "first_submit_time" => $info["firstSubmitTime"]], $this->user["type"]);
|
|
$batch = BatchApi::checkBatchValid(["type" => ProjectState::HOUSE, "year" => $info["year"], "first_submit_time" => $info["firstSubmitTime"]], $this->user["type"]);
|
|
|
|
|
|
@@ -309,6 +251,8 @@ class House extends EnterpriseController {
|
|
throw new ValidateException("没有对应的人才认定申报信息");
|
|
throw new ValidateException("没有对应的人才认定申报信息");
|
|
}
|
|
}
|
|
$data["checkState"] = $info["checkState"];
|
|
$data["checkState"] = $info["checkState"];
|
|
|
|
+ $data["updateUser"] = $this->user["uid"];
|
|
|
|
+ $data["updateTime"] = date("Y-m-d H:i:s");
|
|
} else {
|
|
} else {
|
|
$data["id"] = getStringId();
|
|
$data["id"] = getStringId();
|
|
$data["checkState"] = MainState::SAVE;
|
|
$data["checkState"] = MainState::SAVE;
|
|
@@ -325,24 +269,23 @@ class House extends EnterpriseController {
|
|
unset($data["jstime"]);
|
|
unset($data["jstime"]);
|
|
unset($data["childList"]);
|
|
unset($data["childList"]);
|
|
if ($id) {
|
|
if ($id) {
|
|
- $res = houseModel::update($data);
|
|
|
|
|
|
+ $res = Db::table("un_housepurchase")->update($data);
|
|
} else {
|
|
} else {
|
|
- $res = houseModel::insertGetId($data);
|
|
|
|
|
|
+ $res = Db::table("un_housepurchase")->insert($data);
|
|
}
|
|
}
|
|
foreach ($childList as &$children) {
|
|
foreach ($childList as &$children) {
|
|
$children["pId"] = $data["id"];
|
|
$children["pId"] = $data["id"];
|
|
if (\StrUtil::isEmpOrNull($children["id"])) {
|
|
if (\StrUtil::isEmpOrNull($children["id"])) {
|
|
$children["id"] = getStringId();
|
|
$children["id"] = getStringId();
|
|
$children["createTime"] = date("Y-m-d H:i:s");
|
|
$children["createTime"] = date("Y-m-d H:i:s");
|
|
|
|
+ Db::table("un_housepurchase_children")->insert($children);
|
|
} else {
|
|
} else {
|
|
$children["updateTime"] = date("Y-m-d H:i:s");
|
|
$children["updateTime"] = date("Y-m-d H:i:s");
|
|
|
|
+ $res = Db::table("un_housepurchase_children")->update($children);
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if ($childList) {
|
|
|
|
- \app\common\model\HousePurchaseChildren::insertAll($childList);
|
|
|
|
- }
|
|
|
|
|
|
+ }unset($children);
|
|
//添加日志
|
|
//添加日志
|
|
- \app\common\model\TalentChecklog::create([
|
|
|
|
|
|
+ Db::table("new_talent_checklog")->insert([
|
|
'id' => getStringId(),
|
|
'id' => getStringId(),
|
|
'mainId' => $data['id'],
|
|
'mainId' => $data['id'],
|
|
'type' => intval(ProjectState::HOUSE),
|
|
'type' => intval(ProjectState::HOUSE),
|
|
@@ -355,10 +298,14 @@ class House extends EnterpriseController {
|
|
'createTime' => date("Y-m-d H:i:s", time()),
|
|
'createTime' => date("Y-m-d H:i:s", time()),
|
|
'createUser' => "申报用户"
|
|
'createUser' => "申报用户"
|
|
]);
|
|
]);
|
|
|
|
+ $data["childList"] = $childList;
|
|
|
|
+ Db::commit();
|
|
return json(new Response(Response::SUCCESS, "添加成功", $data));
|
|
return json(new Response(Response::SUCCESS, "添加成功", $data));
|
|
} catch (ValidateException $e) {
|
|
} catch (ValidateException $e) {
|
|
|
|
+ Db::rollback();
|
|
return json(new Response(Response::ERROR, $e->getMessage()));
|
|
return json(new Response(Response::ERROR, $e->getMessage()));
|
|
} catch (\think\Exception $e) {
|
|
} catch (\think\Exception $e) {
|
|
|
|
+ Db::rollback();
|
|
$logInfo = [
|
|
$logInfo = [
|
|
"enterprise_id" => $this->user["uid"],
|
|
"enterprise_id" => $this->user["uid"],
|
|
"data" => $data,
|
|
"data" => $data,
|
|
@@ -372,31 +319,33 @@ class House extends EnterpriseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public function delete() {
|
|
|
|
- $id = $this->request->param("id");
|
|
|
|
- $info = CommonLaApi::getInfoById($id);
|
|
|
|
- if (!$info || $info["enterpriseId"] != $this->user["uid"]) {
|
|
|
|
- return json(["msg" => "操作失败"]);
|
|
|
|
|
|
+ public function deleteChildren($id) {
|
|
|
|
+ if (\StrUtil::isEmpOrNull($id)) {
|
|
|
|
+ return new Response(Response::ERROR, "删除失败,系统错误");
|
|
}
|
|
}
|
|
- $checkState = $info["checkState"];
|
|
|
|
- if ($checkState != LaState::LA_SAVE) {
|
|
|
|
- return json(["msg" => "该申报已提交审核,无法删除"]);
|
|
|
|
|
|
+ $obj = HouseApi::getChildrenById($id);
|
|
|
|
+ $housePurchase = HouseApi::getInfoById($obj["pId"]);
|
|
|
|
+ if ($housePurchase["checkState"] != 1 && $housePurchase["checkState"] != 10) {
|
|
|
|
+ return new Response(Response::ERROR, "正在审核中,无法删除");
|
|
}
|
|
}
|
|
- TalentModel::delete($id);
|
|
|
|
-
|
|
|
|
- $where = [["mainId", "=", $id], ["type", "=", ProjectState::LIVINGALLOWANCE]];
|
|
|
|
- $list = Db::table("new_talent_file")->where($where)->select()->toArray();
|
|
|
|
- foreach ($list as $key => $file) {
|
|
|
|
- if (!empty($file["url"])) {
|
|
|
|
- $filepath = "storage/" . $file["url"];
|
|
|
|
- if (file_exists($filepath)) {
|
|
|
|
- @unlink($filepath);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ if (HouseApi::deleteChildrenById($id)) {
|
|
|
|
+ return new Response(Response::SUCCESS, "删除成功");
|
|
|
|
+ }
|
|
|
|
+ return new Response(Response::ERROR, "删除失败");
|
|
|
|
+ }
|
|
|
|
|
|
- Db::table("new_talent_file")->delete($file["id"]);
|
|
|
|
|
|
+ public function delete($id) {
|
|
|
|
+ if (\StrUtil::isEmpOrNull($id)) {
|
|
|
|
+ return new Response(Response::ERROR, "删除失败,系统错误");
|
|
|
|
+ }
|
|
|
|
+ $obj = HouseApi::getInfoById($id);
|
|
|
|
+ if ($obj["checkState"] != 1) {
|
|
|
|
+ return new Response(Response::ERROR, "已提交审核,无法删除");
|
|
}
|
|
}
|
|
- return json(["msg" => "删除成功"]);
|
|
|
|
|
|
+ if (HouseApi::deleteById($id)) {
|
|
|
|
+ return new Response(Response::SUCCESS, "删除成功");
|
|
|
|
+ }
|
|
|
|
+ return new Response(Response::ERROR, "删除失败");
|
|
}
|
|
}
|
|
|
|
|
|
public function getTalentInfo($id, $year, $declareType) {
|
|
public function getTalentInfo($id, $year, $declareType) {
|
|
@@ -418,6 +367,67 @@ class House extends EnterpriseController {
|
|
return new Response(Response::SUCCESS, "", ["talentInfo" => $ti, "houseInfo" => $houseInfo]);
|
|
return new Response(Response::SUCCESS, "", ["talentInfo" => $ti, "houseInfo" => $houseInfo]);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private function other_validate(&$info, $type) {
|
|
|
|
+ //校验配偶是否在库
|
|
|
|
+ if ($info["spouseIsLibrary"] && $info["spouseIsLibrary"] == 1) {
|
|
|
|
+ if (\StrUtil::isEmpOrNull($info["spouseIdcard"])) {
|
|
|
|
+ return new Response(Response::ERROR, "请填写配偶证件号码");
|
|
|
|
+ }
|
|
|
|
+ if (\StrUtil::isEmpOrNull($info["spouseName"])) {
|
|
|
|
+ return new Response(Response::ERROR, "请填写配偶姓名");
|
|
|
|
+ }
|
|
|
|
+ $where = [];
|
|
|
|
+ $where[] = ["card_number", "=", $info["spouseIdcard"]];
|
|
|
|
+ $where[] = ["name", "=", $info["spouseName"]];
|
|
|
|
+ $where[] = ["checkState", "=", \app\common\api\TalentState::CERTIFICATED];
|
|
|
|
+ $where[] = ["isEffect", "<>", 4];
|
|
|
|
+ $where[] = ["delete", "=", 0];
|
|
|
|
+ $count = Db::table("new_talent_info")->where($where)->count();
|
|
|
|
+ if ($count == 0) {
|
|
|
|
+ return new Response(Response::ERROR, "人才库中未查询到配偶相关信息");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $ti = \app\common\api\VerifyApi::getTalentInfoById($info["talentId"]);
|
|
|
|
+ $info["provinceCode"] = $ti["province"];
|
|
|
|
+ $info["provinceName"] = $ti["provinceName"];
|
|
|
|
+ $info["cityCode"] = $ti["city"];
|
|
|
|
+ $info["cityName"] = $ti["cityName"];
|
|
|
|
+ $info["countyCode"] = $ti["county"];
|
|
|
|
+ $info["countyName"] = $ti["countyName"];
|
|
|
|
+ $info["street"] = $ti["street"];
|
|
|
|
+ $info["bank"] = $ti["bank"];
|
|
|
|
+ $info["bankAccount"] = $ti["bank_account"];
|
|
|
|
+ $info["bankNetwork"] = $ti["bank_branch_name"];
|
|
|
|
+ $info["bankNumber"] = $ti["bank_number"];
|
|
|
|
+ /* * 校验上一年度人才层次 */
|
|
|
|
+ if ($type == 1) {
|
|
|
|
+ $responseObj = $this->getTalentArrange($ti, $info["year"]);
|
|
|
|
+ if ($responseObj->code == 500) {
|
|
|
|
+ return $responseObj;
|
|
|
|
+ }
|
|
|
|
+ $resInfo = $responseObj->obj;
|
|
|
|
+ $info["talentArrange"] = $resInfo["talentArrange"];
|
|
|
|
+ $info["identifyCondition"] = $resInfo["identifyCondition"];
|
|
|
|
+ $info["idenfityConditionName"] = $resInfo["identifyConditionName"];
|
|
|
|
+ $info["identifyGetTime"] = $resInfo["identifyGetTime"];
|
|
|
|
+
|
|
|
|
+ //设置上一年度人才层次有效月份
|
|
|
|
+ $info["monthCount"] = count($resInfo["monthList"]);
|
|
|
|
+ if ($info["monthCount"] < 9) {
|
|
|
|
+ return new Response(Response::ERROR, "申报年度人才证书有效期未满足九个月,无法申报购房补贴");
|
|
|
|
+ }
|
|
|
|
+ $info["talentArrangeMonths"] = implode(",", $resInfo["monthList"]);
|
|
|
|
+ }
|
|
|
|
+ return new Response(Response::SUCCESS, "");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private function validateIsEdit($checkState) {
|
|
|
|
+ if ($checkState != MainState::SAVE && $checkState != MainState::FIRST_REJECT) {
|
|
|
|
+ return new Response(Response::ERROR, "正在审核中,无法修改");
|
|
|
|
+ }
|
|
|
|
+ return new Response(Response::SUCCESS, "");
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @param talentInfo
|
|
* @param talentInfo
|
|
* @param year
|
|
* @param year
|