|
@@ -540,6 +540,329 @@ class TalentAllowance extends AdminController {
|
|
return new Response(Response::SUCCESS, "核查征信通过成功");
|
|
return new Response(Response::SUCCESS, "核查征信通过成功");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 公示
|
|
|
|
+ * */
|
|
|
|
+ public function publicBatch() {
|
|
|
|
+ $params = $this->request->param();
|
|
|
|
+ $ids = $params["ids"];
|
|
|
|
+ $ids = array_filter(explode(",", $ids));
|
|
|
|
+ if (!$ids) {
|
|
|
|
+ return new Response(Response::ERROR, "请至少选择一行数据");
|
|
|
|
+ }
|
|
|
|
+ $isMessage = $params["isMessage"] == 1 ? true : false;
|
|
|
|
+ if ($isMessage && (!$params["typeName"] || !$params["address"] || !$params["publicStartTime"] || !$params["publicEndTime"] || !$params["dep"] || !$params["phone"] || !$params["email"])) {
|
|
|
|
+ return new Response(Response::ERROR, "短信参数不能为空");
|
|
|
|
+ }
|
|
|
|
+ $where = [];
|
|
|
|
+ $where[] = ["id", "in", $ids];
|
|
|
|
+ $list = TaModel::where($where)->select()->toArray();
|
|
|
|
+ Db::startTrans();
|
|
|
|
+ try {
|
|
|
|
+ $logList = [];
|
|
|
|
+ $phones = [];
|
|
|
|
+ foreach ($list as $info) {
|
|
|
|
+ $data["id"] = $info["id"];
|
|
|
|
+ $data["publicState"] = 3;
|
|
|
|
+ Db::table("un_talent_allowance_info")->update($data);
|
|
|
|
+ /* * 添加日志 */
|
|
|
|
+ $logList[] = [
|
|
|
|
+ "id" => getStringId(),
|
|
|
|
+ "type" => ProjectState::JBT,
|
|
|
|
+ "mainId" => $info["id"],
|
|
|
|
+ "active" => 1,
|
|
|
|
+ "state" => 3,
|
|
|
|
+ "step" => 5,
|
|
|
|
+ "stateChange" => "<span class='label label-success'>待公示</span>-><span class='label label-primary'>公示中</span>",
|
|
|
|
+ "description" => "批量公示",
|
|
|
|
+ "createTime" => date("Y-m-d H:i:s"),
|
|
|
|
+ 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
|
|
|
|
+ ];
|
|
|
|
+ $phones[] = $info["phone"];
|
|
|
|
+ }
|
|
|
|
+ $effect = Db::table("new_talent_checklog")->insertAll($logList);
|
|
|
|
+ Db::commit();
|
|
|
|
+ if ($phones && $isMessage && $effect) {
|
|
|
|
+ $tpl_content = sprintf("【晋江市人才服务平台】您好!您提交申请的%s已完成初步审核,现通过%s将审核结果予以公示,公示时间%s至%s。公示期间如有异议,请及时向%s反映。电话%s,电子邮箱%s。",
|
|
|
|
+ $params["typeName"], $params["address"], $params["publicStartTime"], $params["publicEndTime"], $params["dep"], $params["phone"], $params["email"]);
|
|
|
|
+ $phones = array_filter($phones);
|
|
|
|
+ foreach ($phones as $phone) {
|
|
|
|
+ queue("app\job\Messenger", ["type" => 6, "userId" => 0, "phone" => $phone, "template" => $tpl_content, "processName" => "津补贴-批量公示", "userType" => 3]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return new Response(Response::SUCCESS, "公示成功");
|
|
|
|
+ } catch (\think\db\exception\DbException $e) {
|
|
|
|
+ Db::rollback();
|
|
|
|
+ return new Response(Response::SUCCESS, "公示失败:" . $e->getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 跳转到公示再审核页面
|
|
|
|
+ * */
|
|
|
|
+ public function toSupplePage() {
|
|
|
|
+ $id = $this->request["id"];
|
|
|
|
+ $process = $this->request["process"];
|
|
|
|
+ $obj = TalentAllowanceApi::getInfoById($id);
|
|
|
|
+ $this->translateToChinese($obj);
|
|
|
|
+ return view("public_check", ["row" => $obj, "process" => $process]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 公示再审核计算津补贴
|
|
|
|
+ * */
|
|
|
|
+ public function suppleCheckCalculate() {
|
|
|
|
+ $id = $this->request["id"];
|
|
|
|
+ try {
|
|
|
|
+ $info = TalentAllowanceApi::getInfoById($id);
|
|
|
|
+ $arrangeList = $this->validateAllowanceType($info);
|
|
|
|
+ $detailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $id)->select()->toArray();
|
|
|
|
+ $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
|
|
|
|
+ $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
|
|
|
|
+ foreach ($detailList as &$detail) {
|
|
|
|
+ $detail["enterpriseName"] = $enterpriseMap[$detail["enterpriseId"]];
|
|
|
|
+ if (\StrUtil::isNotEmpAndNull($detal["talentType"])) {
|
|
|
|
+ $detail["talentTypeName"] = $talentTypeMap[$detail["talentType"]];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $res = [
|
|
|
|
+ "info" => $info,
|
|
|
|
+ "detailList" => $detailList
|
|
|
|
+ ];
|
|
|
|
+ return new Response(Response::SUCCESS, "计算成功", $res);
|
|
|
|
+ } catch (\think\Exception $e) {
|
|
|
|
+ return new Response(Response::ERROR, "系统异常,请联系管理员");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 公示后审核
|
|
|
|
+ */
|
|
|
|
+ public function afterCheck() {
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
+ if (!$param["id"]) {
|
|
|
|
+ return new Response(Response::ERROR, "系统错误,请联系管理员");
|
|
|
|
+ }
|
|
|
|
+ $old = TalentAllowanceApi::getInfoById($param["id"]);
|
|
|
|
+ if ($old["publicState"] != 3) {
|
|
|
|
+ return new Response(Response::ERROR, "当前记录不是公示中状态,无法审核");
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ $arrangeList = null;
|
|
|
|
+ $desc = "审核意见:" . $param["checkMsg"] . ";\n";
|
|
|
|
+ $desc .= "征信:" . ($param["zxState"] == 1 ? "征信通过" : $param["zxMsg"] . ";\n");
|
|
|
|
+
|
|
|
|
+ $data["id"] = $param["id"];
|
|
|
|
+ if ($param["checkState"] == -1) {
|
|
|
|
+ $data["checkState"] = -1;
|
|
|
|
+ $data["checkMsg"] = $param["checkMsg"];
|
|
|
|
+ $data["allowanceType"] = 3;
|
|
|
|
+ $data["allowanceMsg"] = "审核不通过,原因:" . $param["checkMsg"];
|
|
|
|
+ $data["outMsg"] = $param["zxState"] == 1 ? "" : $param["zxMsg"];
|
|
|
|
+ } else if ($param["checkState"] == 3) {
|
|
|
|
+ if ($param["zxState"] == 1) {
|
|
|
|
+ $typeName = "";
|
|
|
|
+ $old["recommendAllowanceMsg"] = "";
|
|
|
|
+ if ($param["source"] == 1) { //遵循系统结果
|
|
|
|
+ $arrangeList = $this->validateAllowanceType($old);
|
|
|
|
+ $typeName = "系统判定:津补贴类型(" . (\app\common\state\AllowanceTypeEnum::getTypeName($old["allowanceType"])) . ");享受月份:" . $old["recommendMonths"] . ";\n";
|
|
|
|
+ $old["recommendAllowanceMsg"] = $typeName . "判定说明:\n" . $old["recommendAllowanceMsg"] . ";";
|
|
|
|
+ } else if ($param["source"] == 2) {
|
|
|
|
+ $detailIds = array_column($param["details"], "id");
|
|
|
|
+ $where = [];
|
|
|
|
+ $where[] = ["id", "in", $detailIds];
|
|
|
|
+ $detailList = \app\common\model\TalentAllowancecontractDetail::where($where)->select()->toArray();
|
|
|
|
+ $set = [];
|
|
|
|
+ if ($params["resAllowanceType"] == 1) {
|
|
|
|
+ $monthsMap = [];
|
|
|
|
+ for ($i = 0; $i < count($param["details"]); $i++) {
|
|
|
|
+ $monthsMap[$param["details"][$i]["id"]] = $param["details"][$i]["months"];
|
|
|
|
+ }
|
|
|
|
+ foreach ($detailList as &$detail) {
|
|
|
|
+ $months = $monthdsMap[$detail["id"]];
|
|
|
|
+ if (\StrUtil::isNotEmpAndNull($months)) {
|
|
|
|
+ $detail["months"] = $months;
|
|
|
|
+ $set = array_merge($set, explode(",", $months));
|
|
|
|
+ }
|
|
|
|
+ }unset($detail);
|
|
|
|
+ }
|
|
|
|
+ $set = array_filter($set);
|
|
|
|
+ usort($set, function($a, $b) {
|
|
|
|
+ return (int) $a - (int) $b;
|
|
|
|
+ });
|
|
|
|
+ $old["recommendAllowanceType"] = $param["resAllowanceType"];
|
|
|
|
+ $old["recommendMonths"] = implode(",", $set);
|
|
|
|
+ $typeName = "人工判定:津补贴类型(" . (\app\common\state\AllowanceTypeEnum::getTypeName($old["recommendAllowanceType"])) . ");享受月份:" . $old["recommendMonths"] . ";\n";
|
|
|
|
+ $old["recommendAllowanceMsg"] = $typeName . "判定说明:\n" . $obj["resAllowanceMsg"] . ";";
|
|
|
|
+ $arrangeList = $this->calculateAllowance($old, $set, $detailList);
|
|
|
|
+ }
|
|
|
|
+ $desc .= "判定结果:" . $typeName;
|
|
|
|
+ $data["checkState"] = 30;
|
|
|
|
+ $data["outMsg"] = "";
|
|
|
|
+ $data["allowanceType"] = $old["recommendAllowanceType"];
|
|
|
|
+ $data["allowanceMsg"] = $old["recommendAllowanceMsg"];
|
|
|
|
+ $data["months"] = $old["recommendMonths"];
|
|
|
|
+ $data["money"] = $old["recommendMoney"];
|
|
|
|
+ $data["moneyDesc"] = $old["recommendMoneyDesc"];
|
|
|
|
+ $data["jtTalentArrange"] = $old["recommendTalentArrange"];
|
|
|
|
+ $data["workAllowanceMoney"] = $old["workAllowanceMoney"];
|
|
|
|
+ $data["developAllowanceMoney"] = $old["developAllowanceMoney"];
|
|
|
|
+ } else {
|
|
|
|
+ $data["checkState"] = -1;
|
|
|
|
+ $data["outMsg"] = $param["zxMsg"];
|
|
|
|
+ $data["allowanceType"] = 3;
|
|
|
|
+ $data["allowanceMsg"] = "征信失信(不予兑现),原因:" . $param["zxMsg"];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if ($param["allowanceType"] == 3) {
|
|
|
|
+ $data["months"] = "";
|
|
|
|
+ $data["money"] = 0;
|
|
|
|
+ $data["moneyDesc"] = "";
|
|
|
|
+ $data["jtTalentArrange"] = "";
|
|
|
|
+ $data["workAllowanceMoney"] = null;
|
|
|
|
+ $data["developAllowanceMoney"] = null;
|
|
|
|
+ }
|
|
|
|
+ $data["isPublicCheck"] = 1;
|
|
|
|
+ $data["publicState"] = 4;
|
|
|
|
+ //添加日志
|
|
|
|
+ TalentChecklog::create([
|
|
|
|
+ 'id' => getStringId(),
|
|
|
|
+ 'mainId' => $old['id'],
|
|
|
|
+ 'type' => intval(ProjectState::JBT),
|
|
|
|
+ 'typeFileId' => null,
|
|
|
|
+ 'active' => 1,
|
|
|
|
+ 'state' => $param["checkState"] == AllowanceStateEnum::REVIEW_PASS ? 3 : $param["checkState"],
|
|
|
|
+ 'step' => 6,
|
|
|
|
+ 'stateChange' => "<span class='label label-success'>公示中</span>-><span class='label label-primary'>待兑现</span>",
|
|
|
|
+ 'description' => $desc,
|
|
|
|
+ 'createTime' => date("Y-m-d H:i:s", time()),
|
|
|
|
+ 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
|
|
|
|
+ ]);
|
|
|
|
+ TaModel::update($data);
|
|
|
|
+ if ($arrangeList != null) {
|
|
|
|
+ $taaModel = new TalentAllowanceArrange();
|
|
|
|
+ $taaModel->saveAll($arrangeList);
|
|
|
|
+ }
|
|
|
|
+ return new Response(Response::SUCCESS, "审核成功");
|
|
|
|
+ } catch (\think\Exception $e) {
|
|
|
|
+ return new Response(Response::ERROR, "系统异常,请联系管理员");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 批量公示通过
|
|
|
|
+ */
|
|
|
|
+ public function publicPass() {
|
|
|
|
+ $ids = $this->request["ids"];
|
|
|
|
+ $ids = explode(",", $ids);
|
|
|
|
+ if (!$ids) {
|
|
|
|
+ return new Response(Response::ERROR, "请至少选择一行数据");
|
|
|
|
+ }
|
|
|
|
+ $where = [];
|
|
|
|
+ $where[] = ["id", "in"];
|
|
|
|
+ $list = TaModel::where($where)->select()->toArray();
|
|
|
|
+ $logList = [];
|
|
|
|
+ try {
|
|
|
|
+ Db::startTrans();
|
|
|
|
+ for ($i = 0; $i < count($list); $i++) {
|
|
|
|
+ $obj = $list[$i];
|
|
|
|
+ $upd["id"] = $obj["id"];
|
|
|
|
+ $upd["publicState"] = 4;
|
|
|
|
+ $upd["allowanceType"] = $obj["recommendAllowanceType"];
|
|
|
|
+ $upd["allowanceMsg"] = $obj["recommendAllowanceMsg"];
|
|
|
|
+ if ($upd["allowanceType"] == 1) {
|
|
|
|
+ $upd["months"] = $obj["recommendMonths"];
|
|
|
|
+ $upd["money"] = $obj["recommendMoney"];
|
|
|
|
+ $upd["moneyDesc"] = $obj["recommendMoneyDesc"];
|
|
|
|
+ } else if ($upd["allowanceType"] == 2) {
|
|
|
|
+ $upd["months"] = "";
|
|
|
|
+ $upd["jtTalentArrange"] = $obj["recommendTalentArrange"];
|
|
|
|
+ $upd["money"] = $obj["recommendMoney"];
|
|
|
|
+ $upd["moneyDesc"] = $obj["recommendMoneyDesc"];
|
|
|
|
+ $upd["workAllowanceMoney"] = null;
|
|
|
|
+ $upd["developAllowanceMoney"] = null;
|
|
|
|
+ } else {
|
|
|
|
+ $upd["months"] = "";
|
|
|
|
+ $upd["money"] = 0.00;
|
|
|
|
+ $upd["workAllowanceMoney"] = null;
|
|
|
|
+ $upd["developAllowanceMoney"] = null;
|
|
|
|
+ }
|
|
|
|
+ Db::table("un_talent_allowance_info")->update($upd);
|
|
|
|
+ //添加日志
|
|
|
|
+ $stateChange = null;
|
|
|
|
+ $desc = null;
|
|
|
|
+ if ($obj["checkState"] == AllowanceStateEnum::NOTPASS) {
|
|
|
|
+ $stateChange = "<span class='label label-success'>公示中</span>-><span class='label label-danger'>审核不通过</span>";
|
|
|
|
+ $desc = "审核不通过";
|
|
|
|
+ } else {
|
|
|
|
+ $stateChange = "<span class='label label-success'>公示中</span>-><span class='label label-primary'>待兑现</span>";
|
|
|
|
+ $desc = "批量公示";
|
|
|
|
+ }
|
|
|
|
+ $logList[] = [
|
|
|
|
+ "id" => getStringId(),
|
|
|
|
+ "type" => ProjectState::JBT,
|
|
|
|
+ "mainId" => $obj["id"],
|
|
|
|
+ "active" => 1,
|
|
|
|
+ "state" => 3,
|
|
|
|
+ "step" => 6,
|
|
|
|
+ "stateChange" => $stateChange,
|
|
|
|
+ "description" => $desc,
|
|
|
|
+ "createTime" => date("Y-m-d H:i:s"),
|
|
|
|
+ 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+ Db::table("new_talent_checklog")->insertAll($logList);
|
|
|
|
+ Db::commit();
|
|
|
|
+ return new Response(Response::SUCCESS, "批量公示通过成功");
|
|
|
|
+ } catch (\think\db\exception\DbException $e) {
|
|
|
|
+ Db::rollback();
|
|
|
|
+ return new Response(Response::ERROR, "批量公示失败:" . $e->getCode());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 兑现
|
|
|
|
+ */
|
|
|
|
+ public function cash() {
|
|
|
|
+ $ids = $this->request["ids"];
|
|
|
|
+ $ids = array_filter(explode(",", $ids));
|
|
|
|
+ if (!$ids) {
|
|
|
|
+ return new Response(Response::ERROR, "请至少选择一行数据");
|
|
|
|
+ }
|
|
|
|
+ $where = [];
|
|
|
|
+ $where[] = ["id", "in", $ids];
|
|
|
|
+ $list = TaModel::where($where)->select()->toArray();
|
|
|
|
+ //添加日志
|
|
|
|
+ $logList = [];
|
|
|
|
+ try {
|
|
|
|
+ Db::startTrans();
|
|
|
|
+ for ($i = 0; $i < count($list); $i++) {
|
|
|
|
+ $obj = $list[$i];
|
|
|
|
+ $upd["id"] = $obj["id"];
|
|
|
|
+ $upd["publicState"] = 5;
|
|
|
|
+ Db::table("un_talent_allowance_info")->update($upd);
|
|
|
|
+ $logList[] = [
|
|
|
|
+ "id" => getStringId(),
|
|
|
|
+ "type" => ProjectState::JBT,
|
|
|
|
+ "mainId" => $obj["id"],
|
|
|
|
+ "active" => 1,
|
|
|
|
+ "state" => 3,
|
|
|
|
+ "step" => 50,
|
|
|
|
+ "stateChange" => "<span class='label label-success'>待兑现</span>-><span class='label label-primary'>已兑现</span>;",
|
|
|
|
+ "description" => "批量兑现",
|
|
|
|
+ "createTime" => date("Y-m-d H:i:s"),
|
|
|
|
+ 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+ Db::table("new_talent_checklog")->insertAll($logList);
|
|
|
|
+ Db::commit();
|
|
|
|
+ return new Response(Response::SUCCESS, "批量兑现成功");
|
|
|
|
+ } catch (\think\db\exception\DbException $e) {
|
|
|
|
+ Db::rollback();
|
|
|
|
+ return new Response(Response::ERROR, "批量兑现失败:" . $e->getCode());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 公示预览(不予兑现)
|
|
* 公示预览(不予兑现)
|
|
*/
|
|
*/
|
|
@@ -573,6 +896,50 @@ class TalentAllowance extends AdminController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 导出公示名单(需要兑现)
|
|
|
|
+ */
|
|
|
|
+ public function exportPublic() {
|
|
|
|
+ //获取字典表人才层次+
|
|
|
|
+ $levelMap = DictApi::selectByParentCode("talent_arrange");
|
|
|
|
+ $streetMap = DictApi::selectByParentCode("street");
|
|
|
|
+ //查询企业信息
|
|
|
|
+ $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
|
|
|
|
+ /* * 查询需要公示的数据 */
|
|
|
|
+ $where = [];
|
|
|
|
+ $where[] = ["id", "in", explode(",", $this->request["ids"])];
|
|
|
|
+ $list = TaModel::where($where)->select()->toArray();
|
|
|
|
+ /* * 查询相关的津补贴人才层次 */
|
|
|
|
+ $where = [];
|
|
|
|
+ $where[] = ["mainId", "in", explode(",", $this->request["ids"])];
|
|
|
|
+ $arrangeList = TalentAllowanceArrange::where($where)->select()->toArray();
|
|
|
|
+ foreach ($arrangeList as &$arrange) {
|
|
|
|
+ $arrange["talentArrangeName"] = $levelMap[$arrange["talentArrange"]];
|
|
|
|
+ }unset($arrange);
|
|
|
|
+ /* Map<String,List<TalentAllowanceArrange>> arrangeMap = arrangeList.stream().collect(Collectors.groupingBy(TalentAllowanceArrange::getMainId));
|
|
|
|
+ Integer sheetSize = 0;
|
|
|
|
+ for(TalentAllowanceInfo info:allList){
|
|
|
|
+ info.setEnterpriseName(enterpriseMap.get(info.getEnterpriseId()));
|
|
|
|
+ info.setAddressName(streetMap.get(info.getAddress()));
|
|
|
|
+ info.setTalentArrangeName(levelMap.get(info.getTalentArrange()));
|
|
|
|
+ if(info.getRecommendAllowanceType() == 1){
|
|
|
|
+ info.setArrangeList(arrangeMap.get(info.getId()));
|
|
|
|
+ sheetSize = sheetSize + info.getArrangeList().size();
|
|
|
|
+ }else if(info.getRecommendAllowanceType() == 1){
|
|
|
|
+ sheetSize++;
|
|
|
|
+ }
|
|
|
|
+ } */
|
|
|
|
+ $filename = ($this->user["type"] == 1 ? "晋江市优秀人才" : "晋江市集成电路人才") . $list[0]["year"] . "年度津补贴拟发放对象名单";
|
|
|
|
+ $columns = ["序号", "姓名", "工作单位", "镇(街道)", "人才层次", "津补贴享受月份数", "每月享受津贴标准(元)", $list[0]["year"] . "年度累计应享受津补贴金额(元)", "备注"];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 导出基本信息
|
|
|
|
+ */
|
|
|
|
+ public function exportBasicInfo() {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
private function validateAllowanceType(&$info) {
|
|
private function validateAllowanceType(&$info) {
|
|
$old = TalentAllowanceApi::getInfoById($info["id"]);
|
|
$old = TalentAllowanceApi::getInfoById($info["id"]);
|
|
$talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
|
|
$talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
|