TalentAllowance.php 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024
  1. <?php
  2. /*
  3. * To change this license header, choose License Headers in Project Properties.
  4. * To change this template file, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7. namespace app\enterprise\controller;
  8. use app\enterprise\common\EnterpriseController;
  9. use app\common\state\CommonConst;
  10. use app\common\api\BatchApi;
  11. use app\common\api\TalentAllowanceApi;
  12. use app\common\state\ProjectState;
  13. use app\common\api\DictApi;
  14. use app\common\state\MainState;
  15. use app\common\model\TalentAllowance as TaModel;
  16. use app\common\state\AllowanceProjectEnum;
  17. use app\common\model\TalentChecklog;
  18. use think\facade\Db;
  19. use app\common\api\Response;
  20. use app\common\api\UploadApi;
  21. use app\enterprise\model\TalentTypeChange;
  22. use app\common\state\AllowanceTypeEnum;
  23. /**
  24. * Description of TalentAllowance
  25. *
  26. * @author sgq
  27. */
  28. class TalentAllowance extends EnterpriseController {
  29. public function index() {
  30. $tpl = "";
  31. switch ($this->user["type"]) {
  32. case CommonConst::ENTERPRISE_JC:
  33. $tpl = "indexIC";
  34. break;
  35. }
  36. return view($tpl, ['type' => $this->user["type"]]);
  37. }
  38. public function list() {
  39. $res = TalentAllowanceApi::getList($this->request);
  40. return json($res);
  41. }
  42. /**
  43. * 申请
  44. */
  45. public function apply(\think\Request $request) {
  46. $param = $request->param();
  47. $id = isset($param["id"]) ? $param["id"] : 0;
  48. $info = null;
  49. if ($id) {
  50. $info = TalentAllowanceApi::getInfoById($id);
  51. $this->translateToChinese($info);
  52. }
  53. if ($request->isPost()) {
  54. return $this->save($info, $request);
  55. }
  56. $batch = $info["year"] ?: BatchApi::getValidBatch(ProjectState::JBT, $this->user["type"])["batch"];
  57. return view("", ["year" => $batch, "type" => $this->user["type"], "row" => $info]);
  58. }
  59. public function batchApply() {
  60. $ids = $this->request["ids"];
  61. $ids = array_filter(explode(",", $ids));
  62. $allowanceType = $this->request["allowanceType"];
  63. $batch = BatchApi::getValidBatch(ProjectState::JBT, $this->user["type"])["batch"];
  64. if (!$batch) {
  65. return new Response(Response::ERROR, "当前并无有效的申报批次进行中");
  66. }
  67. for ($i = 0; $i < count($ids); $i++) {
  68. queue("app\job\TalentAllowance", ["type" => 1, "talentId" => $ids[$i], "enterprise" => $this->user, "year" => $batch, "allowanceType" => $allowanceType]);
  69. }
  70. return new Response(Response::SUCCESS, "已经成功添加到计划任务,请稍候查看申报列表进行确认");
  71. }
  72. private function save($talentAllowance, \think\Request $request) {
  73. $response = new \stdClass();
  74. $response->code = 500;
  75. $param = $request->param();
  76. if (!$param) {
  77. $response->msg = "请填写信息后在提交";
  78. return $response;
  79. }
  80. if (\StrUtil::isEmpOrNull($param["talentId"])) {
  81. $response->msg = "请选择申报对象";
  82. return $response;
  83. }
  84. if (!$param["id"]) {
  85. $where = [];
  86. $where[] = ["year", "=", $param["year"]];
  87. $where[] = ["idCard", "=", $param["idCard"]];
  88. $where[] = ["checkState", "not in", [MainState::NOTPASS, MainState::PASS]];
  89. $exists = TaModel::where($where)->find();
  90. if ($exists) {
  91. $response->msg = "当前申请对象在当前批次中存在申请中的记录,请等待申请结束后再操作";
  92. return $response;
  93. }
  94. $user = $this->user;
  95. $ti = \app\common\api\VerifyApi::getTalentInfoById($param["talentId"]);
  96. $data = [
  97. "talentId" => $param["talentId"],
  98. "enterpriseId" => $ti["enterprise_id"],
  99. "enterpriseName" => $user["name"],
  100. "year" => $param["year"],
  101. "source" => $ti["source"],
  102. "qzgccrcActiveTime" => $ti["certificateExpireTime"],
  103. "talentType" => $ti["enterpriseTag"],
  104. "address" => $ti["street"],
  105. "name" => $ti["name"],
  106. "sex" => $ti["sex"],
  107. "cardType" => $ti["card_type"],
  108. "idCard" => $ti["card_number"],
  109. "firstInJJTime" => $ti["fst_work_time"],
  110. "entryTime" => $ti["cur_entry_time"],
  111. "post" => $ti["position"],
  112. "phone" => $ti["phone"],
  113. "talentArrange" => $ti["talent_arrange"],
  114. "identifyCondition" => $ti["talent_condition"],
  115. "identifyGetTime" => $ti["identifyGetTime"],
  116. "identifyOutTime" => $ti["identifyExpireTime"],
  117. "identifyConditionName" => $ti["identifyConditionName"],
  118. "identifyMonth" => $ti["identifyMonth"],
  119. "bank" => $ti["bank"],
  120. "bankNetwork" => $ti["bank_branch_name"],
  121. "bankAccount" => $ti["bank_account"],
  122. "bankNumber" => $ti["bank_number"],
  123. "checkState" => 1,
  124. "type" => $user["type"],
  125. "provinceCode" => $ti["province"],
  126. "provinceName" => \app\common\api\LocationApi::getNameByCode($ti["province"]),
  127. "cityCode" => $ti["city"],
  128. "cityName" => \app\common\api\LocationApi::getNameByCode($ti["city"]),
  129. "countyCode" => $ti["county"],
  130. "countyName" => \app\common\api\LocationApi::getNameByCode($ti["county"]),
  131. "isSupple" => 2,
  132. "createTime" => date("Y-m-d H:i:s"),
  133. "createUser" => $user["uid"],
  134. "id" => getStringId(),
  135. "wage" => $param["wage"],
  136. "allowanceType" => $param["allowanceType"]
  137. ];
  138. /* * 1.获取上一年度的人才层次 */
  139. $arrangeList = $this->getLastYearTalentType($data, $ti);
  140. if (!$arrangeList) {
  141. $response->msg = "上一年度暂无有效的人才层次";
  142. return $response;
  143. }
  144. /* * 2.获取上一年度所在单位* */
  145. $contractDetailList = $this->getConcatList($ti, $data, $param["year"]); //保存上一年度的工作单位
  146. if (!$contractDetailList) {
  147. $response->msg = "申报失败,原因为:申报年度不存在有效的工作单位";
  148. return $response;
  149. }
  150. TaModel::insert($data);
  151. \app\common\model\TalentAllowancecontractDetail::insertAll($contractDetailList);
  152. /**
  153. * 4.添加津补贴核查项目
  154. */
  155. //核查项目详情表
  156. $this->createAllowanceProject($data, $contractDetailList);
  157. \app\common\model\TalentAllowanceArrange::insertAll($arrangeList);
  158. //添加日志
  159. TalentChecklog::create([
  160. 'id' => getStringId(),
  161. 'mainId' => $data['id'],
  162. 'type' => intval(ProjectState::JBT),
  163. 'typeFileId' => null,
  164. 'active' => 1,
  165. 'state' => 1,
  166. 'step' => 0,
  167. 'stateChange' => "保存未提交",
  168. 'description' => "添加津补贴申报",
  169. 'createTime' => date("Y-m-d H:i:s", time()),
  170. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  171. ]);
  172. $response->msg = "保存成功";
  173. $response->code = 200;
  174. $response->obj = $data;
  175. return $response;
  176. } else {
  177. TaModel::update($param);
  178. $response->msg = "修改成功";
  179. $response->code = 200;
  180. return $response;
  181. }
  182. }
  183. public function getInfoByIdAndYear($id, $year) {
  184. $ti = \app\common\api\VerifyApi::getTalentInfoById($id);
  185. $data = [
  186. "talentId" => $id,
  187. "year" => $year,
  188. "idCard" => $ti["card_number"],
  189. "id" => getStringId()
  190. ];
  191. /* * 1.获取上一年度的人才层次 */
  192. $arrangeList = $this->getLastYearTalentType($data, $ti);
  193. if (!$arrangeList) {
  194. return new Response(Response::ERROR, "该人员上一年度暂无有效的人才层次");
  195. }
  196. /* * 2.获取上一年度所在单位* */
  197. $contractDetailList = $this->getConcatList($ti, $data, $year); //保存上一年度的工作单位
  198. if (!$contractDetailList) {
  199. return new Response(Response::ERROR, "该人员申报年度不存在有效的工作单位");
  200. }
  201. return new Response(Response::SUCCESS, "", $ti);
  202. }
  203. /**
  204. * 删除优秀人才津补贴
  205. */
  206. public function delete() {
  207. $id = $this->request["id"];
  208. $response = new \stdClass();
  209. $response->code = 500;
  210. $info = TalentAllowanceApi::getInfoById($id);
  211. if ($info["checkState"] != 1) {
  212. $response->msg = "删除失败!此数据已提交审核,无法删除!";
  213. return $response;
  214. }
  215. Db::startTrans();
  216. try {
  217. //删除核查项目表
  218. Db::table("un_talent_allowance_project")->where("mainId", $id)->delete();
  219. //删除合同情况表
  220. Db::table("un_talent_allowancecontract_detail")->where("mainId", $id)->delete();
  221. //删除人才层次变更表
  222. Db::table("un_talent_allowance_arrange")->where("mainId", $id)->delete();
  223. //删除日志
  224. $where[] = ["mainId", "=", $id];
  225. $where[] = ["type", "=", ProjectState::JBT];
  226. Db::table("new_talent_checklog")->where($where)->delete();
  227. //删除主表
  228. Db::table("un_talent_allowance_info")->delete($id);
  229. Db::commit();
  230. $response->code = 200;
  231. $response->msg = "删除成功";
  232. return $response;
  233. } catch (think\db\exception\DbException $e) {
  234. Db::rollback();
  235. $response->msg = $e->getMessage();
  236. return $response;
  237. }
  238. }
  239. public function detail(\think\Request $request) {
  240. $param = $request->param();
  241. $id = $param["id"];
  242. $info = TalentAllowanceApi::getInfoById($id);
  243. $this->translateToChinese($info);
  244. return view("", ["row" => $info]);
  245. }
  246. private function translateToChinese(&$obj) {
  247. if (\StrUtil::isNotEmpAndNull($obj["address"])) {
  248. $obj["addressName"] = DictApi::findByParentCodeAndCode("street", $obj["address"])["name"];
  249. }
  250. if (\StrUtil::isNotEmpAndNull($obj["talentType"])) {
  251. $obj["talentTypeName"] = DictApi::findByParentCodeAndCode("enterprise_tag", $obj["talentType"])["name"];
  252. }
  253. if (\StrUtil::isNotEmpAndNull($obj["talentArrange"])) {
  254. $obj["talentArrangeName"] = DictApi::findByParentCodeAndCode("talent_arrange", $obj["talentArrange"])["name"];
  255. }
  256. if (\StrUtil::isNotEmpAndNull($obj["identifyCondition"])) {
  257. $obj["identifyConditionText"] = \app\common\api\TalentConditionApi::getOne($obj["identifyCondition"])["name"];
  258. }
  259. if (\StrUtil::isNotEmpAndNull($obj["introductionMode"])) {
  260. $obj["introductionModeName"] = DictApi::findByParentCodeAndCode("import_way", $obj["introductionMode"])["name"];
  261. }
  262. }
  263. /* * 获取上一年度的人才层次变更信息 */
  264. private function getLastYearTalentType($info, $talentInfo) {
  265. $arrangeList = [];
  266. /* * * 添加人才层次记录 */
  267. $where = [];
  268. $where[] = ["idCard", "=", $info["idCard"]];
  269. $where[] = ["checkState", "=", MainState::PASS];
  270. $where[] = ["isPublic", ">=", 5];
  271. $where[] = ["oldIdentifyMonth", "<=", $info["year"] . "-12-31"];
  272. $typeList = TalentTypeChange::where($where)->field("oldTalentArrange,oldIdentifyCondition,oldIdentifyGetTime,oldIdentifyOutTime,oldIdentifyMonth,oldCertificateStartTime,oldCertificateOutTime,newIdentifyMonth")->order("createTime desc")->select()->toArray();
  273. $typeList[] = [
  274. "oldTalentArrange" => $talentInfo["talent_arrange"],
  275. "oldIdentifyCondition" => $talentInfo["talent_condition"],
  276. "oldIdentifyGetTime" => $talentInfo["identifyGetTime"],
  277. "oldIdentifyOutTime" => $talentInfo["identifyExpireTime"],
  278. "oldIdentifyMonth" => $talentInfo["identifyMonth"],
  279. "oldCertificateStartTime" => $talentInfo["certificateGetTime"],
  280. "oldCertificateOutTime" => $talentInfo["certificateExpireTime"],
  281. "newIdentifyMonth" => $info["year"] . "-12-31"
  282. ];
  283. $totalMonth = \DateUtil::getMonthBetweenDates($info["year"] . "-01-01", $info["year"] . "-12-31");
  284. /* * 获取上一年度有效的人才层次 */
  285. usort($typeList, function($a, $b) {
  286. return (int) $b["oldTalentArrange"] - (int) $a["oldTalentArrange"];
  287. });
  288. $commonMonth = [];
  289. foreach ($typeList as $talentTypeChange) {
  290. $startTime = $talentTypeChange["oldIdentifyMonth"];
  291. $endTime = $talentTypeChange["newIdentifyMonth"];
  292. $monthList = \DateUtil::getMonthBetweenDatesNotBegin($startTime, $endTime);
  293. if ($monthList) {
  294. $monthList = array_intersect($monthList, $totalMonth);
  295. }
  296. if ($monthList) {
  297. $months = implode(",", $monthList);
  298. $monthList = array_filter($monthList, function($value) use ($commonMonth) {
  299. return !in_array($value, $commonMonth);
  300. });
  301. $commonMonth = array_filter(array_merge($commonMonth, $monthList));
  302. if (count($monthList) > 0) {
  303. $arrange = [
  304. "id" => getStringId(),
  305. "mainId" => $info["id"],
  306. "talentArrange" => $talentTypeChange["oldTalentArrange"],
  307. "identifyCondition" => $talentTypeChange["oldIdentifyCondition"],
  308. "startTime" => $startTime,
  309. "endTime" => $endTime,
  310. "prepareMonths" => null,
  311. "description" => "申报年度有效月份:" . $months,
  312. "identifyConditionName" => $talentTypeChange["oldIdentifyConditionName"],
  313. "identifyConditionGetTime" => $talentTypeChange["oldIdentifyGetTime"],
  314. ];
  315. $sb = '';
  316. foreach ($monthList as $month) {
  317. $sb .= substr($month, 5, 2) . ",";
  318. }
  319. $arrange["prepareMonths"] = rtrim($sb, ",");
  320. $arrangeList[] = $arrange;
  321. }
  322. }
  323. }
  324. return $arrangeList;
  325. }
  326. /**
  327. * @param
  328. * @returns void
  329. * @author Liu
  330. * @date 2020/4/26
  331. * @description 获取上一年度所在单位
  332. * */
  333. private function getConcatList($talentInfo, $info, $year) {
  334. $totalMonth = \DateUtil::getMonthBetweenDates($year . "-01-01", $year . "-12-31");
  335. /** 添加申报人才上一年度工作单位记录 */
  336. $where = [];
  337. $where[] = ["idCard", "=", $talentInfo["card_number"]];
  338. $where[] = ["checkState", "=", 3];
  339. $quitList = \app\common\model\TalentQuit::where($where)->field("enterpriseId,enterpriseName,talentType,identifyGetTime,starttime,endtime,entryTime,quitTime,post")->select()->toArray();
  340. /* * * 将最新的人才数据转为工作变更记录(为了统一处理) */
  341. if ($talentInfo["active"] == 1) {
  342. $labor_contract_rangetime = explode(" - ", $talentInfo["labor_contract_rangetime"]);
  343. $starttime = $labor_contract_rangetime[0];
  344. $endtime = $labor_contract_rangetime[1];
  345. $quitList[] = [
  346. "enterpriseId" => $talentInfo["enterprise_id"],
  347. "enterpriseName" => $talentInfo["enterpriseName"],
  348. "talentType" => $talentInfo["enterpriseTag"],
  349. "identifyGetTime" => $talentInfo["identifyGetTime"],
  350. "starttime" => $starttime,
  351. "endtime" => $endtime,
  352. "entryTime" => $talentInfo["cur_entry_time"],
  353. "quitTime" => null,
  354. "post" => $talentInfo["position"]
  355. ];
  356. }
  357. $list = [];
  358. foreach ($quitList as $quit) {
  359. $monthList = \DateUtil::getMonthBetweenDates($quit["entryTime"], \StrUtil::isEmpOrNull($quit["quitTime"]) ? $year . "-12-31" : $quit["quitTime"]);
  360. $monthList = array_intersect($monthList, $totalMonth);
  361. if ($monthList) {
  362. $sb = '';
  363. foreach ($monthList as $month) {
  364. $sb .= substr($month, 5, 2) . ",";
  365. }
  366. $list[] = [
  367. "id" => getStringId(),
  368. "mainId" => $info["id"],
  369. "enterpriseId" => $quit["enterpriseId"],
  370. "talentType" => $quit["talentType"],
  371. "startTime" => $quit["starttime"],
  372. "endTime" => $quit["endtime"],
  373. "entryTime" => $quit["entryTime"],
  374. "quitTime" => \StrUtil::isEmpOrNull($quit["quitTime"]) ? $year . "-12-31" : $quit["quitTime"],
  375. "letterTime" => $quit["letterTime"],
  376. "gygb" => $quit["gygb"],
  377. "identifyGetTime" => $quit["identifyGetTime"],
  378. "isQuit" => \StrUtil::isEmpOrNull($quit["quitTime"]) ? 2 : 1,
  379. "post" => $quit["post"],
  380. "months" => rtrim($sb, ",")
  381. ];
  382. }
  383. }
  384. return $list;
  385. }
  386. private function createAllowanceProject($info, $contractList) {
  387. foreach ($contractList as $detail) {
  388. $projects = [
  389. //AllowanceProjectEnum::PROJECT_CONTRACT,
  390. AllowanceProjectEnum::PROJECT_TAX,
  391. AllowanceProjectEnum::PROJECT_WAGES,
  392. AllowanceProjectEnum::PROJECT_ATTENDANCE,
  393. AllowanceProjectEnum::PROJECT_SB_PENSION,
  394. AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
  395. AllowanceProjectEnum::PROJECT_SB_MEDICA,
  396. //AllowanceProjectEnum::PROJECT_WORKDAY,
  397. ];
  398. $list = [];
  399. foreach ($projects as $project) {
  400. $list[] = [
  401. "mainId" => $info["id"],
  402. "baseId" => $detail["id"],
  403. "enterpriseId" => $detail["enterpriseId"],
  404. "project" => $project,
  405. "isLock" => 1,
  406. "createTime" => date("Y-m-d H:i:s")
  407. ];
  408. }
  409. \app\common\model\TalentAllowanceProject::insertAll($list);
  410. }
  411. }
  412. /**
  413. * 查询工作单位
  414. */
  415. public function findAllowanceContractDetail() {
  416. $mainId = $this->request["mainId"];
  417. $offset = $this->request["offset"] ?: 0;
  418. $limit = $this->request["limit"] ?: 1000;
  419. $count = \app\common\model\TalentAllowancecontractDetail::where("mainId", $mainId)->count();
  420. $list = \app\common\model\TalentAllowancecontractDetail::where("mainId", $mainId)->limit($offset, $limit)->select()->toArray();
  421. $enterpriseMap = \app\common\model\Enterprise::column("name", "id");
  422. foreach ($list as &$row) {
  423. $row["enterpriseName"] = $enterpriseMap[$row["enterpriseId"]];
  424. }unset($row);
  425. return json(["rows" => $list, "total" => $count]);
  426. }
  427. /**
  428. * 查询核查项目情况
  429. */
  430. public function findAllowanceProject() {
  431. $mainId = $this->request["mainId"];
  432. $baseId = $this->request["baseId"];
  433. $offset = $this->request["offset"] ?: 0;
  434. $limit = $this->request["limit"] ?: 1000;
  435. $where = [];
  436. $where[] = ["mainId", "=", $mainId];
  437. $where[] = ["baseId", "=", $baseId];
  438. $count = \app\common\model\TalentAllowanceProject::where($where)->count();
  439. $list = \app\common\model\TalentAllowanceProject::where($where)->limit($offset, $limit)->select()->toArray();
  440. $info = TalentAllowanceApi::getInfoById($mainId);
  441. foreach ($list as &$project) {
  442. $project["projectName"] = AllowanceProjectEnum::getProjectName($project["project"]);
  443. if ($info["checkState"] == 1) {
  444. $project["isEdit"] = in_array($project["project"], [
  445. //AllowanceProjectEnum::PROJECT_CONTRACT,
  446. AllowanceProjectEnum::PROJECT_TAX,
  447. AllowanceProjectEnum::PROJECT_WAGES,
  448. AllowanceProjectEnum::PROJECT_ATTENDANCE,
  449. AllowanceProjectEnum::PROJECT_SB_PENSION,
  450. AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
  451. AllowanceProjectEnum::PROJECT_SB_MEDICA,
  452. //AllowanceProjectEnum::PROJECT_WORKDAY
  453. ]) ? 1 : 2;
  454. } else if ($info["checkState"] == 10) {
  455. $projects = explode(",", $info["projects"]);
  456. if (in_array($project["id"], $projects)) {
  457. $project["isEdit"] = 1;
  458. } else {
  459. $project["isEdit"] = 2;
  460. }
  461. } else {
  462. $project["isEdit"] = 2;
  463. }
  464. }unset($project);
  465. return json(["rows" => $list, "total" => $count]);
  466. }
  467. /**
  468. * 查询人才层次变更记录
  469. */
  470. public function findAllowanceArrange() {
  471. $mainId = $this->request["mainId"];
  472. $offset = $this->request["offset"] ?: 0;
  473. $limit = $this->request["limit"] ?: 1000;
  474. $where = [];
  475. $where[] = ["mainId", "=", $mainId];
  476. $count = \app\common\model\TalentAllowanceArrange::where($where)->count();
  477. $list = \app\common\model\TalentAllowanceArrange::where($where)->limit($offset, $limit)->select()->toArray();
  478. foreach ($list as &$arrange) {
  479. $condition = \app\common\api\TalentConditionApi::getOne($arrange["identifyCondition"]);
  480. $arrange["identifyConditionText"] = $condition["name"];
  481. $arrange["talentArrangeName"] = app\common\state\CommonConst::getLayerNameByLayer($arrange["talentArrange"]);
  482. }unset($arrange);
  483. return json(["rows" => $list, "total" => $count]);
  484. }
  485. /**
  486. * 修改合同起止时间
  487. */
  488. public function editContract() {
  489. $response = new \stdClass();
  490. $response->code = 500;
  491. $param = $this->request->param();
  492. if (!$param["id"]) {
  493. $response->msg = "系统错误,请联系管理员";
  494. return $response;
  495. }
  496. $detail = \app\common\model\TalentAllowancecontractDetail::find($param["id"]);
  497. $info = TalentAllowanceApi::getInfoById($detail["mainId"]);
  498. if (\StrUtil::isEmpOrNull($param["startTime"])) {
  499. $response->msg = "请选择合同起始时间";
  500. return $response;
  501. }
  502. if (\StrUtil::isEmpOrNull($param["endTime"])) {
  503. $response->msg = "请选择合同截止时间";
  504. return $response;
  505. }
  506. \app\common\model\TalentAllowancecontractDetail::update($param);
  507. //添加日志
  508. TalentChecklog::create([
  509. 'id' => getStringId(),
  510. 'mainId' => $info['id'],
  511. 'type' => intval(ProjectState::JBT),
  512. 'typeFileId' => $param["id"],
  513. 'active' => 1,
  514. 'state' => null,
  515. 'step' => 0,
  516. 'stateChange' => null,
  517. 'description' => "修改工作单位合同时间为:" . $param["startTime"] . "至" . $param["endTime"],
  518. 'createTime' => date("Y-m-d H:i:s", time()),
  519. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  520. ]);
  521. $response->msg = "修改成功";
  522. $response->code = 200;
  523. return $response;
  524. }
  525. /**
  526. * 修改项目
  527. */
  528. public function editProject() {
  529. $response = new \stdClass();
  530. $response->code = 500;
  531. $param = $this->request->param();
  532. if (!$param["id"]) {
  533. $response->msg = "系统错误,请联系管理员";
  534. return $response;
  535. }
  536. $detail = \app\common\model\TalentAllowanceProject::find($param["id"]);
  537. $info = TalentAllowanceApi::getInfoById($detail["mainId"]);
  538. \app\common\model\TalentAllowanceProject::update($param);
  539. //添加日志
  540. TalentChecklog::create([
  541. 'id' => getStringId(),
  542. 'mainId' => $info['id'],
  543. 'type' => intval(ProjectState::JBT),
  544. 'typeFileId' => $param["id"],
  545. 'active' => 1,
  546. 'state' => null,
  547. 'step' => 0,
  548. 'stateChange' => null,
  549. 'description' => "修改项目名:" . AllowanceProjectEnum::getProjectName($detail["project"]) . "的值为:" . $param["months"] . ";备注为:" . $param["description"],
  550. 'createTime' => date("Y-m-d H:i:s", time()),
  551. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  552. ]);
  553. $response->msg = "修改成功";
  554. $response->code = 200;
  555. return $response;
  556. }
  557. /**
  558. * 判断是否可以修改
  559. */
  560. public function validateIsEdit() {
  561. $id = $this->request["id"];
  562. $type = $this->request["type"];
  563. $info = null;
  564. if ($type == 1) { //编辑合同
  565. $detail = \app\common\model\TalentAllowancecontractDetail::find($id);
  566. } else if ($type == 2) { //编辑项目
  567. $detail = \app\common\model\TalentAllowanceProject::find($id);
  568. }
  569. $info = TalentAllowanceApi::getInfoById($detail["mainId"]);
  570. if ($info["checkState"] != 1 && $info["checkState"] != 10) {
  571. if ($info["checkState"] == -1) {
  572. return new Response(Response::ERROR, "您的申报审核不通过,无法操作");
  573. } else if ($info["checkState"] == 30) {
  574. return new Response(Response::ERROR, "您的申报已审核通过,无法操作");
  575. } else {
  576. return new Response(Response::ERROR, "您的申报正在审核中,请耐心等待");
  577. }
  578. }
  579. return new Response(Response::SUCCESS, "");
  580. }
  581. /**
  582. * 提交审核
  583. */
  584. public function submitToCheck() {
  585. $data = $this->request->param();
  586. $response = new \stdClass();
  587. $response->code = 500;
  588. if (!$data || !$data["id"]) {
  589. $response->msg = "提交审核失败,请先填写基础信息";
  590. return $response;
  591. }
  592. $old = TalentAllowanceApi::getInfoById($data["id"]);
  593. $batch = BatchApi::checkBatchValid(["type" => ProjectState::JBT, "year" => $old["year"], "first_submit_time" => $old["firstSubmitTime"]], $this->user["type"]);
  594. if ($batch["code"] != 200) {
  595. $response->msg = $batch["msg"];
  596. return $response;
  597. }
  598. if ($old["checkState"] != 1 && $old["checkState"] != 10) {
  599. $response->msg = "不能重复提交审核";
  600. return $response;
  601. }
  602. if (!$old["allowanceType"]) {
  603. $response->msg = "没有明确津贴类型";
  604. return $response;
  605. }
  606. //因为工作津贴和交通补贴两者的考勤分别记录的是月份和天数,如果没有手动修改值会导致数据不对口,如修改类型却未修改考勤记录,则手动改为空。
  607. $where = [];
  608. $where[] = ["project", "=", AllowanceProjectEnum::PROJECT_ATTENDANCE];
  609. $where[] = ["mainId", "=", $data["id"]];
  610. $attendanceList = \app\common\model\TalentAllowanceProject::where($where)->select()->toArray();
  611. if ($old["allowanceType"] == AllowanceTypeEnum::JBT_JT) {
  612. //因为天数保存格式为 月份=天数 如 01=31,02=20,03=15,月份保存格式为01,02,03,所以可以从有没有=号判断是否有进行考勤的修改保存操作
  613. foreach ($attendanceList as $a) {
  614. //$a["months"]有值但是没有包含=号则一般可认为是类型修改为交通补贴而未修改考勤,此时的months字段数据是错误的,修改为空。
  615. if ($a["months"] && strpos($a["months"], "=") === false) {
  616. $_updProject["id"] = $a["id"];
  617. $_updProject["months"] = "";
  618. \app\common\model\TalentAllowanceProject::update($_updProject);
  619. }
  620. }
  621. } else {
  622. foreach ($attendanceList as $a) {
  623. //$a["months"]有值但是包含了=号则一般可认为是类型修改为工作津贴而未修改考勤,此时的months字段数据是错误的,修改为空。
  624. if ($a["months"] && strpos($a["months"], "=") !== false) {
  625. $_updProject["id"] = $a["id"];
  626. $_updProject["months"] = "";
  627. \app\common\model\TalentAllowanceProject::update($_updProject);
  628. }
  629. }
  630. }
  631. $where = [];
  632. $where[] = ["type", "=", $old["type"]];
  633. $where[] = ["project", "=", ProjectState::JBT];
  634. $where[] = ["isConditionFile", "in", [0, $old["allowanceType"]]];
  635. $where[] = ["active", "=", 1];
  636. $where[] = ["delete", "=", 0];
  637. $filetypes = Db::table("new_common_filetype")->where($where)->order("sn asc")->select()->toArray();
  638. $sb = [];
  639. $sb[] = "以下为必传附件:";
  640. foreach ($filetypes as $filetype) {
  641. if ($filetype["must"] == 1) {
  642. $where = [];
  643. $where[] = ["mainId", "=", $data["id"]];
  644. $where[] = ["typeId", "=", $filetype["id"]];
  645. $count = Db::table("new_talent_file")->where($where)->count();
  646. if ($count == 0) {
  647. $sb[] = $filetype["name"] . ";";
  648. }
  649. }
  650. }
  651. if (count($sb) > 1) {
  652. $response->msg = implode("<br>", $sb);
  653. return $response;
  654. }
  655. /**
  656. * 初步判断合同是否满两年
  657. */
  658. $detailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $old["id"])->select()->toArray();
  659. foreach ($detailList as $detail) {
  660. if (\StrUtil::isEmpOrNull($detail["startTime"]) || \StrUtil::isEmpOrNull($detail["endTime"])) {
  661. $response->msg = "合同起止时间不能为空";
  662. return $response;
  663. }
  664. }
  665. foreach ($detailList as $detail) {
  666. $contractEndTime = strtotime($detail["endTime"]);
  667. $contractStartTimeAdd2Years = strtotime("+2 years -1 day {$detail['startTime']}");
  668. $where = [];
  669. $where[] = ["mainId", "=", $data["id"]];
  670. $where[] = ["baseId", "=", $detail["id"]];
  671. $where[] = ["project", "=", AllowanceProjectEnum::PROJECT_CONTRACT];
  672. $updProject["months"] = $contractEndTime >= $contractStartTimeAdd2Years ? "是" : "否";
  673. \app\common\model\TalentAllowanceProject::where($where)->update($updProject);
  674. }
  675. $data["checkMsg"] = "";
  676. $data["checkState"] = 5;
  677. $data["files"] = "";
  678. $data["projects"] = "";
  679. $data["concats"] = "";
  680. $data["fields"] = "";
  681. $data["toDep"] = "";
  682. $data["process"] = null;
  683. if (!$old["firstSubmitTime"]) {
  684. $data["firstSubmitTime"] = date("Y-m-d H:i:s");
  685. }
  686. $data["newSubmitTime"] = date("Y-m-d H:i:s");
  687. TaModel::update($data);
  688. //添加日志
  689. TalentChecklog::create([
  690. 'id' => getStringId(),
  691. 'mainId' => $data['id'],
  692. 'type' => intval(ProjectState::JBT),
  693. 'typeFileId' => null,
  694. 'active' => 1,
  695. 'state' => 1,
  696. 'step' => 0,
  697. 'stateChange' => sprintf("%s->%s", MainState::getStateDesc(1), MainState::getStateDesc(7)),
  698. 'description' => "确认提交审核",
  699. 'createTime' => date("Y-m-d H:i:s", time()),
  700. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  701. ]);
  702. $response->msg = "提交审核成功";
  703. $response->code = 200;
  704. $response->obj = 5;
  705. return $response;
  706. }
  707. public function updateSuppleState() {
  708. $id = $this->request["id"];
  709. $response = new \stdClass();
  710. $response->code = 500;
  711. if (\StrUtil::isEmpOrNull($id)) {
  712. $response->msg = "系统错误,请联系管理员";
  713. return $response;
  714. }
  715. $data["id"] = $id;
  716. $data["isSupple"] = 1;
  717. TaModel::update($data);
  718. $response->msg = "状态更新成功";
  719. $response->code = 200;
  720. return $response;
  721. }
  722. public function uploadCommonFile() {
  723. $batchId = $this->request["batch"];
  724. if (!$batchId) {
  725. return json(new Response(Response::ERROR, "没有提交批次信息,无法按批次归档,上传被中止"));
  726. }
  727. $batchInfo = BatchApi::getOne($batchId);
  728. if (!$batchInfo) {
  729. return json(new Response(Response::ERROR, "批次信息不存在,无法按批次归档,上传被中止"));
  730. }
  731. if (!$this->request->file()) {
  732. return json(new Response(Response::ERROR, "没有上传任何材料"));
  733. }
  734. $file = $this->request->file("file");
  735. $upload = new UploadApi();
  736. $result = $upload->uploadOne($file, "system", "talent/TalentAllowanceCommonFile");
  737. if ($result->code != 200) {
  738. return json(new Response(Response::ERROR, $result->msg));
  739. }
  740. $data["id"] = getStringId();
  741. $data["enterpriseId"] = $this->user["uid"];
  742. $data["batchId"] = $batchId;
  743. $data["batch"] = $batchInfo["batch"];
  744. $data["url"] = $result->filepath;
  745. $data["originalName"] = $file->getOriginalName();
  746. $data["createTime"] = date("Y-m-d H:i:s");
  747. $data["createUser"] = $this->user["uid"];
  748. $res = Db::table("un_talent_allowance_common_file")->insert($data);
  749. return json(new Response(Response::SUCCESS, "上传成功"));
  750. }
  751. public function listCommonFile() {
  752. $param = $this->request->param();
  753. $batchId = $param["batch"];
  754. $where = [["batchId", "=", $batchId], ["enterpriseId", "=", $this->user["uid"]]];
  755. $list = Db::table("un_talent_allowance_common_file")->where($where)->select()->toArray();
  756. foreach ($list as $key => $item) {
  757. $list[$key]["ext"] = pathinfo($item["url"])["extension"];
  758. $list[$key]["url"] = getStoragePath($item["url"]);
  759. }
  760. return json(["rows" => $list]);
  761. }
  762. public function deleteCommonFile() {
  763. $id = $this->request["id"];
  764. $where = [];
  765. $where[] = ["id", "=", $id];
  766. $where[] = ["enterpriseId", "=", $this->user["uid"]];
  767. $file = Db::table("un_talent_allowance_common_file")->where($where)->find();
  768. if (!$file) {
  769. return json(new Response(Response::ERROR, "不存在的文件,删除失败"));
  770. }
  771. if (Db::table("un_talent_allowance_common_file")->where($where)->delete()) {
  772. if (!empty($file["url"])) {
  773. $filepath = "storage/" . $file["url"];
  774. if (file_exists($filepath)) {
  775. unlink($filepath);
  776. }
  777. }
  778. return json(new Response(Response::SUCCESS, "删除成功"));
  779. }
  780. }
  781. public function findTalentAllowance() {
  782. $res = [];
  783. $batch = BatchApi::getValidBatch(ProjectState::JBT, $this->user["type"]);
  784. $year = $batch["batch"];
  785. if ($year) {
  786. $ids = null;
  787. //根据申报年度查询当前企业已申报的人才
  788. $where = [];
  789. $where[] = ["year", "=", $year];
  790. $where[] = ["enterpriseId", "=", $this->user["uid"]];
  791. $talentAllowances = TaModel::where($where)->select()->toArray();
  792. $ids = array_unique(array_column($talentAllowances, "talentId"));
  793. $whr = [];
  794. $whr[] = ["ti.checkState", "=", \app\common\api\TalentState::CERTIFICATED];
  795. $whr[] = ["ti.enterprise_id", "=", $this->user["uid"]];
  796. $whr[] = ["e.type", "=", $this->user["type"]];
  797. $whr[] = ["ti.id", "not in", $ids];
  798. $list = \app\enterprise\model\Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.id,ti.name,ti.card_number as idCard")->where($whr)->select()->toArray();
  799. foreach ($list as $info) {
  800. if (strtotime($year . "-12-31") >= strtotime($info["identifyMonth"])) {
  801. $res[] = $info;
  802. } else {
  803. $whereTypeChange = [];
  804. $whereTypeChange[] = ["idCard", "=", $info["idCard"]];
  805. $whereTypeChange[] = ["checkState", "=", MainState::PASS];
  806. $whereTypeChange[] = ["isPublic", "=", 6];
  807. $typeChanges = TalentTypeChange::where($whereTypeChange)->select()->toArray();
  808. foreach ($typeChanges as $typeChange) {
  809. if (strtotime($year . "-12-31") >= strtotime($typeChange["oldIdentifyMonth"])) {
  810. $res[] = $info;
  811. break;
  812. }
  813. }
  814. }
  815. }
  816. }
  817. return new Response(Response::SUCCESS, "", ["rows" => $res, "total" => count($res)]);
  818. }
  819. public function export() {
  820. $obj["year"] = \StrUtil::getRequestDecodeParam($this->request, "year");
  821. $obj["name"] = \StrUtil::getRequestDecodeParam($this->request, "name");
  822. $obj["talentArrange"] = \StrUtil::getRequestDecodeParam($this->request, "talentArrange");
  823. $obj["address"] = \StrUtil::getRequestDecodeParam($this->request, "address");
  824. $obj["identifyCondition"] = \StrUtil::getRequestDecodeParam($this->request, "identifyCondition");
  825. $where = [];
  826. $where[] = ["ta.enterpriseId", "=", $this->user["uid"]];
  827. if (\StrUtil::isNotEmpAndNull($obj["year"])) {
  828. $where[] = ["ta.year", "like", "%" . $obj["year"] . "%"];
  829. }
  830. if (\StrUtil::isNotEmpAndNull($obj["name"])) {
  831. $where[] = ["ta.name", "like", "%" . $obj["name"] . "%"];
  832. }
  833. if (\StrUtil::isNotEmpAndNull($obj["talentArrange"])) {
  834. $where[] = ["ta.talentArrange", "=", $obj["talentArrange"]];
  835. }
  836. if (\StrUtil::isNotEmpAndNull($obj["address"])) {
  837. $where[] = ["ta.address", "=", $obj["address"]];
  838. }
  839. if (\StrUtil::isNotEmpAndNull($obj["identifyCondition"])) {
  840. $where[] = ["ta.identifyCondition", "=", $obj["identifyCondition"]];
  841. }
  842. $projects = [
  843. AllowanceProjectEnum::PROJECT_TAX,
  844. AllowanceProjectEnum::PROJECT_WAGES,
  845. AllowanceProjectEnum::PROJECT_ATTENDANCE,
  846. AllowanceProjectEnum::PROJECT_SB_PENSION,
  847. AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
  848. AllowanceProjectEnum::PROJECT_SB_MEDICA,
  849. ];
  850. $months = [];
  851. for ($m = 1; $m <= 12; $m++) {
  852. $months[] = $m . "月";
  853. }
  854. $columns = [["年度", [1, 2]], ["所属镇街", [1, 2]], ["姓名", [1, 2]], ["性别", [1, 2]], ["证件号码", [1, 2]], ["人才层次", [1, 2]], ["认定条件", [1, 2]], ["认定条件取得时间", [1, 2]], ["认定条件名称", [1, 2]], ["公布入选月份", [1, 2]], ["津补贴类型", [1, 2]], ["兑现月份", [1, 2]], ["兑现金额", [1, 2]], ["金额说明", [1, 2]], ["审核状态", [1, 2]], ["缴纳单位", [1, 2]]];
  855. $infoCols = count($columns);
  856. for ($i = 0; $i < count($projects); $i++) {
  857. $columns[] = [AllowanceProjectEnum::getProjectName($projects[$i]), $months];
  858. }
  859. $list = \app\common\model\TalentAllowanceProject::alias("pro")
  860. ->field("ta.id,ta.year,ta.enterpriseId as curEnterpriseId,ta.address,ta.name,ta.sex,ta.idCard,ta.talentArrange,ta.identifyCondition,ta.identifyGetTime,ta.identifyConditionName,ta.identifyMonth,ta.allowanceType,ta.months,ta.money,ta.moneyDesc,ta.checkState,ta.publicState,pro.project,pro.months as pre_months,con.enterpriseId,con.startTime,con.endTime,con.entryTime,con.quitTime,con.isQuit")
  861. ->leftJoin("un_talent_allowance_info ta", "ta.id=pro.mainId")
  862. ->leftJoin("un_talent_allowancecontract_detail con", "pro.baseId=con.id")
  863. ->where($where)
  864. ->order("ta.year desc,ta.createTime desc,pro.project asc")
  865. ->select()->toArray();
  866. $tmpList = [];
  867. $levelMap = DictApi::selectByParentCode("talent_arrange");
  868. $streetMap = DictApi::selectByParentCode("street");
  869. $where = [];
  870. $where[] = ["id", "in", array_column($list, "identifyCondition")];
  871. $icmap = \app\common\model\TalentCondition::where($where)->column("name", "id");
  872. $where = [];
  873. $where[] = ["id", "in", array_column($list, "enterpriseId")];
  874. $enterpriseMap = \app\common\model\Enterprise::where($where)->column("name", "id");
  875. foreach ($list as $item) {
  876. //组装数据
  877. if (!$tmpList[$item["id"]]) {
  878. $tmpList[$item["id"]]["curEnterpriseId"] = $item["curEnterpriseId"];
  879. $tmpList[$item["id"]]["info"] = [$item["year"], $streetMap[$item["address"]], $item["name"], $item["sex"] == 1 ? "男" : "女", $item["idCard"], $levelMap[$item["talentArrange"]],
  880. $icmap[$item["identifyCondition"]], $item["identifyGetTime"], $item["identifyConditionName"], $item["identifyMonth"], AllowanceTypeEnum::getTypeName($item["allowanceType"]), $item["months"], $item["money"],
  881. $item["moneyDesc"], $this->getCheckStateName($item["checkState"], $item["publicState"], $item["allowanceType"])];
  882. }
  883. if (!$tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]) {
  884. $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]] = [
  885. "startTime" => $item["startTime"],
  886. "endTime" => $item["endTime"],
  887. "entryTime" => $item["entryTime"],
  888. "isQuit" => $item["isQuit"]
  889. ];
  890. }
  891. $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]["projects"][$item["project"]] = $item["pre_months"];
  892. }
  893. $rows = [];
  894. $colorset = [];
  895. foreach ($tmpList as $id => $item) {
  896. foreach ($item["enterprise"] as $enterpriseId => $enterprise) {
  897. $row = $item["info"];
  898. $row[] = $this->user["uid"] == $enterpriseId ? "本单位" : $enterpriseMap[$enterpriseId];
  899. for ($i = 0; $i < count($projects); $i++) {
  900. if (strpos($enterprise["projects"][$projects[$i]], "=") === false) {
  901. $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
  902. for ($m = 1; $m <= 12; $m++) {
  903. $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
  904. if (in_array($_month, $months)) {
  905. $row[] = "✔";
  906. $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
  907. } else {
  908. $row[] = "";
  909. }
  910. }
  911. } else {
  912. $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
  913. $_months = [];
  914. foreach ($months as $month) {
  915. $kv = explode("=", $month);
  916. $_months[$kv[0]] = $kv[1];
  917. }
  918. for ($m = 1; $m <= 12; $m++) {
  919. $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
  920. $days = $_months[$_month];
  921. if ($days && $days > 0) {
  922. $row[] = $days . "天";
  923. $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
  924. } else {
  925. $row[] = "";
  926. }
  927. }
  928. }
  929. }
  930. $rows[] = $row;
  931. }
  932. }
  933. $cols = $infoCols + count($projects) * 12 - 1;
  934. $settings = [
  935. "width" => [["A", 8], ["C", 12], ["D", 6], ["E", 20], ["F", 12], ["G", 70], ["H", 12], ["I", 15], ["J", 12], ["K", 12], ["P", 30]],
  936. "height" => [18],
  937. "freeze" => "D3",
  938. "color" => $colorset
  939. ];
  940. for ($i = 0; $i < count($projects) * 12; $i++) {
  941. $settings["width"][] = [getExcelColumnByIndex($infoCols + $i), 6]; //批设置项目的宽度
  942. }
  943. $settings["background-color"][] = [sprintf("%s2:%s2", getExcelColumnByIndex($infoCols), getExcelColumnByIndex($cols)), "E1F1DE"];
  944. export($columns, $rows, "津补贴申报名单", $settings);
  945. }
  946. private function getCheckStateName($checkState, $publicState, $allowanceType) {
  947. switch ($checkState) {
  948. case 1:
  949. return "待提交";
  950. case 5:
  951. case 13:
  952. case 15:
  953. case 20:
  954. case 25:
  955. case 35:
  956. return "审核中";
  957. case 10:
  958. return "已驳回";
  959. case - 1:
  960. if ($publicState >= 3) {
  961. return "审核不通过";
  962. } else {
  963. return "审核中";
  964. }
  965. break;
  966. case 30:
  967. if ($publicState == 1) {
  968. return "待核查征信";
  969. } else if ($publicState == 2) {
  970. return "待公示";
  971. } else if ($publicState == 3) {
  972. return "公示中";
  973. } else if ($publicState == 4) {
  974. return $allowanceType != 3 ? "待兑现" : "不予兑现";
  975. } else if ($publicState == 5) {
  976. return "已兑现";
  977. }
  978. default:
  979. return "未知状态";
  980. }
  981. }
  982. }