TalentAllowance.php 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030
  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. $count = 0;
  388. foreach ($contractList as $detail) {
  389. $count++;
  390. $projects = [
  391. //AllowanceProjectEnum::PROJECT_CONTRACT,
  392. AllowanceProjectEnum::PROJECT_TAX,
  393. AllowanceProjectEnum::PROJECT_WAGES,
  394. AllowanceProjectEnum::PROJECT_ATTENDANCE,
  395. AllowanceProjectEnum::PROJECT_SB_PENSION,
  396. AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
  397. AllowanceProjectEnum::PROJECT_SB_MEDICA,
  398. //AllowanceProjectEnum::PROJECT_WORKDAY,
  399. ];
  400. $list = [];
  401. foreach ($projects as $project) {
  402. $months = "";
  403. if ($count == count($contractList) && $info["allowanceType"] == AllowanceTypeEnum::JBT_TALENT)
  404. $months = "01,02,03,04,05,06,07,08,09,10,11,12";
  405. $list[] = [
  406. "mainId" => $info["id"],
  407. "baseId" => $detail["id"],
  408. "enterpriseId" => $detail["enterpriseId"],
  409. "project" => $project,
  410. "months" => $months,
  411. "isLock" => 1,
  412. "createTime" => date("Y-m-d H:i:s")
  413. ];
  414. }
  415. \app\common\model\TalentAllowanceProject::insertAll($list);
  416. }
  417. }
  418. /**
  419. * 查询工作单位
  420. */
  421. public function findAllowanceContractDetail() {
  422. $mainId = $this->request["mainId"];
  423. $offset = $this->request["offset"] ?: 0;
  424. $limit = $this->request["limit"] ?: 1000;
  425. $count = \app\common\model\TalentAllowancecontractDetail::where("mainId", $mainId)->count();
  426. $list = \app\common\model\TalentAllowancecontractDetail::where("mainId", $mainId)->limit($offset, $limit)->select()->toArray();
  427. $enterpriseMap = \app\common\model\Enterprise::column("name", "id");
  428. foreach ($list as &$row) {
  429. $row["enterpriseName"] = $enterpriseMap[$row["enterpriseId"]];
  430. }unset($row);
  431. return json(["rows" => $list, "total" => $count]);
  432. }
  433. /**
  434. * 查询核查项目情况
  435. */
  436. public function findAllowanceProject() {
  437. $mainId = $this->request["mainId"];
  438. $baseId = $this->request["baseId"];
  439. $offset = $this->request["offset"] ?: 0;
  440. $limit = $this->request["limit"] ?: 1000;
  441. $where = [];
  442. $where[] = ["mainId", "=", $mainId];
  443. $where[] = ["baseId", "=", $baseId];
  444. $count = \app\common\model\TalentAllowanceProject::where($where)->count();
  445. $list = \app\common\model\TalentAllowanceProject::where($where)->limit($offset, $limit)->select()->toArray();
  446. $info = TalentAllowanceApi::getInfoById($mainId);
  447. foreach ($list as &$project) {
  448. $project["projectName"] = AllowanceProjectEnum::getProjectName($project["project"]);
  449. if ($info["checkState"] == 1) {
  450. $project["isEdit"] = in_array($project["project"], [
  451. //AllowanceProjectEnum::PROJECT_CONTRACT,
  452. AllowanceProjectEnum::PROJECT_TAX,
  453. AllowanceProjectEnum::PROJECT_WAGES,
  454. AllowanceProjectEnum::PROJECT_ATTENDANCE,
  455. AllowanceProjectEnum::PROJECT_SB_PENSION,
  456. AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
  457. AllowanceProjectEnum::PROJECT_SB_MEDICA,
  458. //AllowanceProjectEnum::PROJECT_WORKDAY
  459. ]) ? 1 : 2;
  460. } else if ($info["checkState"] == 10) {
  461. $projects = explode(",", $info["projects"]);
  462. if (in_array($project["id"], $projects)) {
  463. $project["isEdit"] = 1;
  464. } else {
  465. $project["isEdit"] = 2;
  466. }
  467. } else {
  468. $project["isEdit"] = 2;
  469. }
  470. }unset($project);
  471. return json(["rows" => $list, "total" => $count]);
  472. }
  473. /**
  474. * 查询人才层次变更记录
  475. */
  476. public function findAllowanceArrange() {
  477. $mainId = $this->request["mainId"];
  478. $offset = $this->request["offset"] ?: 0;
  479. $limit = $this->request["limit"] ?: 1000;
  480. $where = [];
  481. $where[] = ["mainId", "=", $mainId];
  482. $count = \app\common\model\TalentAllowanceArrange::where($where)->count();
  483. $list = \app\common\model\TalentAllowanceArrange::where($where)->limit($offset, $limit)->select()->toArray();
  484. foreach ($list as &$arrange) {
  485. $condition = \app\common\api\TalentConditionApi::getOne($arrange["identifyCondition"]);
  486. $arrange["identifyConditionText"] = $condition["name"];
  487. $arrange["talentArrangeName"] = app\common\state\CommonConst::getLayerNameByLayer($arrange["talentArrange"]);
  488. }unset($arrange);
  489. return json(["rows" => $list, "total" => $count]);
  490. }
  491. /**
  492. * 修改合同起止时间
  493. */
  494. public function editContract() {
  495. $response = new \stdClass();
  496. $response->code = 500;
  497. $param = $this->request->param();
  498. if (!$param["id"]) {
  499. $response->msg = "系统错误,请联系管理员";
  500. return $response;
  501. }
  502. $detail = \app\common\model\TalentAllowancecontractDetail::find($param["id"]);
  503. $info = TalentAllowanceApi::getInfoById($detail["mainId"]);
  504. if (\StrUtil::isEmpOrNull($param["startTime"])) {
  505. $response->msg = "请选择合同起始时间";
  506. return $response;
  507. }
  508. if (\StrUtil::isEmpOrNull($param["endTime"])) {
  509. $response->msg = "请选择合同截止时间";
  510. return $response;
  511. }
  512. \app\common\model\TalentAllowancecontractDetail::update($param);
  513. //添加日志
  514. TalentChecklog::create([
  515. 'id' => getStringId(),
  516. 'mainId' => $info['id'],
  517. 'type' => intval(ProjectState::JBT),
  518. 'typeFileId' => $param["id"],
  519. 'active' => 1,
  520. 'state' => null,
  521. 'step' => 0,
  522. 'stateChange' => null,
  523. 'description' => "修改工作单位合同时间为:" . $param["startTime"] . "至" . $param["endTime"],
  524. 'createTime' => date("Y-m-d H:i:s", time()),
  525. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  526. ]);
  527. $response->msg = "修改成功";
  528. $response->code = 200;
  529. return $response;
  530. }
  531. /**
  532. * 修改项目
  533. */
  534. public function editProject() {
  535. $response = new \stdClass();
  536. $response->code = 500;
  537. $param = $this->request->param();
  538. if (!$param["id"]) {
  539. $response->msg = "系统错误,请联系管理员";
  540. return $response;
  541. }
  542. $detail = \app\common\model\TalentAllowanceProject::find($param["id"]);
  543. $info = TalentAllowanceApi::getInfoById($detail["mainId"]);
  544. \app\common\model\TalentAllowanceProject::update($param);
  545. //添加日志
  546. TalentChecklog::create([
  547. 'id' => getStringId(),
  548. 'mainId' => $info['id'],
  549. 'type' => intval(ProjectState::JBT),
  550. 'typeFileId' => $param["id"],
  551. 'active' => 1,
  552. 'state' => null,
  553. 'step' => 0,
  554. 'stateChange' => null,
  555. 'description' => "修改项目名:" . AllowanceProjectEnum::getProjectName($detail["project"]) . "的值为:" . $param["months"] . ";备注为:" . $param["description"],
  556. 'createTime' => date("Y-m-d H:i:s", time()),
  557. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  558. ]);
  559. $response->msg = "修改成功";
  560. $response->code = 200;
  561. return $response;
  562. }
  563. /**
  564. * 判断是否可以修改
  565. */
  566. public function validateIsEdit() {
  567. $id = $this->request["id"];
  568. $type = $this->request["type"];
  569. $info = null;
  570. if ($type == 1) { //编辑合同
  571. $detail = \app\common\model\TalentAllowancecontractDetail::find($id);
  572. } else if ($type == 2) { //编辑项目
  573. $detail = \app\common\model\TalentAllowanceProject::find($id);
  574. }
  575. $info = TalentAllowanceApi::getInfoById($detail["mainId"]);
  576. if ($info["checkState"] != 1 && $info["checkState"] != 10) {
  577. if ($info["checkState"] == -1) {
  578. return new Response(Response::ERROR, "您的申报审核不通过,无法操作");
  579. } else if ($info["checkState"] == 30) {
  580. return new Response(Response::ERROR, "您的申报已审核通过,无法操作");
  581. } else {
  582. return new Response(Response::ERROR, "您的申报正在审核中,请耐心等待");
  583. }
  584. }
  585. return new Response(Response::SUCCESS, "");
  586. }
  587. /**
  588. * 提交审核
  589. */
  590. public function submitToCheck() {
  591. $data = $this->request->param();
  592. $response = new \stdClass();
  593. $response->code = 500;
  594. if (!$data || !$data["id"]) {
  595. $response->msg = "提交审核失败,请先填写基础信息";
  596. return $response;
  597. }
  598. $old = TalentAllowanceApi::getInfoById($data["id"]);
  599. $batch = BatchApi::checkBatchValid(["type" => ProjectState::JBT, "year" => $old["year"], "first_submit_time" => $old["firstSubmitTime"]], $this->user["type"]);
  600. if ($batch["code"] != 200) {
  601. $response->msg = $batch["msg"];
  602. return $response;
  603. }
  604. if ($old["checkState"] != 1 && $old["checkState"] != 10) {
  605. $response->msg = "不能重复提交审核";
  606. return $response;
  607. }
  608. if (!$old["allowanceType"]) {
  609. $response->msg = "没有明确津贴类型";
  610. return $response;
  611. }
  612. //因为工作津贴和交通补贴两者的考勤分别记录的是月份和天数,如果没有手动修改值会导致数据不对口,如修改类型却未修改考勤记录,则手动改为空。
  613. $where = [];
  614. $where[] = ["project", "=", AllowanceProjectEnum::PROJECT_ATTENDANCE];
  615. $where[] = ["mainId", "=", $data["id"]];
  616. $attendanceList = \app\common\model\TalentAllowanceProject::where($where)->select()->toArray();
  617. if ($old["allowanceType"] == AllowanceTypeEnum::JBT_JT) {
  618. //因为天数保存格式为 月份=天数 如 01=31,02=20,03=15,月份保存格式为01,02,03,所以可以从有没有=号判断是否有进行考勤的修改保存操作
  619. foreach ($attendanceList as $a) {
  620. //$a["months"]有值但是没有包含=号则一般可认为是类型修改为交通补贴而未修改考勤,此时的months字段数据是错误的,修改为空。
  621. if ($a["months"] && strpos($a["months"], "=") === false) {
  622. $_updProject["id"] = $a["id"];
  623. $_updProject["months"] = "";
  624. \app\common\model\TalentAllowanceProject::update($_updProject);
  625. }
  626. }
  627. } else {
  628. foreach ($attendanceList as $a) {
  629. //$a["months"]有值但是包含了=号则一般可认为是类型修改为工作津贴而未修改考勤,此时的months字段数据是错误的,修改为空。
  630. if ($a["months"] && strpos($a["months"], "=") !== false) {
  631. $_updProject["id"] = $a["id"];
  632. $_updProject["months"] = "";
  633. \app\common\model\TalentAllowanceProject::update($_updProject);
  634. }
  635. }
  636. }
  637. $where = [];
  638. $where[] = ["type", "=", $old["type"]];
  639. $where[] = ["project", "=", ProjectState::JBT];
  640. $where[] = ["isConditionFile", "in", [0, $old["allowanceType"]]];
  641. $where[] = ["active", "=", 1];
  642. $where[] = ["delete", "=", 0];
  643. $filetypes = Db::table("new_common_filetype")->where($where)->order("sn asc")->select()->toArray();
  644. $sb = [];
  645. $sb[] = "以下为必传附件:";
  646. foreach ($filetypes as $filetype) {
  647. if ($filetype["must"] == 1) {
  648. $where = [];
  649. $where[] = ["mainId", "=", $data["id"]];
  650. $where[] = ["typeId", "=", $filetype["id"]];
  651. $count = Db::table("new_talent_file")->where($where)->count();
  652. if ($count == 0) {
  653. $sb[] = $filetype["name"] . ";";
  654. }
  655. }
  656. }
  657. if (count($sb) > 1) {
  658. $response->msg = implode("<br>", $sb);
  659. return $response;
  660. }
  661. /**
  662. * 初步判断合同是否满两年
  663. */
  664. $detailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $old["id"])->select()->toArray();
  665. foreach ($detailList as $detail) {
  666. if (\StrUtil::isEmpOrNull($detail["startTime"]) || \StrUtil::isEmpOrNull($detail["endTime"])) {
  667. $response->msg = "合同起止时间不能为空";
  668. return $response;
  669. }
  670. }
  671. foreach ($detailList as $detail) {
  672. $contractEndTime = strtotime($detail["endTime"]);
  673. $contractStartTimeAdd2Years = strtotime("+2 years -1 day {$detail['startTime']}");
  674. $where = [];
  675. $where[] = ["mainId", "=", $data["id"]];
  676. $where[] = ["baseId", "=", $detail["id"]];
  677. $where[] = ["project", "=", AllowanceProjectEnum::PROJECT_CONTRACT];
  678. $updProject["months"] = $contractEndTime >= $contractStartTimeAdd2Years ? "是" : "否";
  679. \app\common\model\TalentAllowanceProject::where($where)->update($updProject);
  680. }
  681. $data["checkMsg"] = "";
  682. $data["checkState"] = 5;
  683. $data["files"] = "";
  684. $data["projects"] = "";
  685. $data["concats"] = "";
  686. $data["fields"] = "";
  687. $data["toDep"] = "";
  688. $data["process"] = null;
  689. if (!$old["firstSubmitTime"]) {
  690. $data["firstSubmitTime"] = date("Y-m-d H:i:s");
  691. }
  692. $data["newSubmitTime"] = date("Y-m-d H:i:s");
  693. TaModel::update($data);
  694. //添加日志
  695. TalentChecklog::create([
  696. 'id' => getStringId(),
  697. 'mainId' => $data['id'],
  698. 'type' => intval(ProjectState::JBT),
  699. 'typeFileId' => null,
  700. 'active' => 1,
  701. 'state' => 1,
  702. 'step' => 0,
  703. 'stateChange' => sprintf("%s->%s", MainState::getStateDesc(1), MainState::getStateDesc(7)),
  704. 'description' => "确认提交审核",
  705. 'createTime' => date("Y-m-d H:i:s", time()),
  706. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  707. ]);
  708. $response->msg = "提交审核成功";
  709. $response->code = 200;
  710. $response->obj = 5;
  711. return $response;
  712. }
  713. public function updateSuppleState() {
  714. $id = $this->request["id"];
  715. $response = new \stdClass();
  716. $response->code = 500;
  717. if (\StrUtil::isEmpOrNull($id)) {
  718. $response->msg = "系统错误,请联系管理员";
  719. return $response;
  720. }
  721. $data["id"] = $id;
  722. $data["isSupple"] = 1;
  723. TaModel::update($data);
  724. $response->msg = "状态更新成功";
  725. $response->code = 200;
  726. return $response;
  727. }
  728. public function uploadCommonFile() {
  729. $batchId = $this->request["batch"];
  730. if (!$batchId) {
  731. return json(new Response(Response::ERROR, "没有提交批次信息,无法按批次归档,上传被中止"));
  732. }
  733. $batchInfo = BatchApi::getOne($batchId);
  734. if (!$batchInfo) {
  735. return json(new Response(Response::ERROR, "批次信息不存在,无法按批次归档,上传被中止"));
  736. }
  737. if (!$this->request->file()) {
  738. return json(new Response(Response::ERROR, "没有上传任何材料"));
  739. }
  740. $file = $this->request->file("file");
  741. $upload = new UploadApi();
  742. $result = $upload->uploadOne($file, "system", "talent/TalentAllowanceCommonFile");
  743. if ($result->code != 200) {
  744. return json(new Response(Response::ERROR, $result->msg));
  745. }
  746. $data["id"] = getStringId();
  747. $data["enterpriseId"] = $this->user["uid"];
  748. $data["batchId"] = $batchId;
  749. $data["batch"] = $batchInfo["batch"];
  750. $data["url"] = $result->filepath;
  751. $data["originalName"] = $file->getOriginalName();
  752. $data["createTime"] = date("Y-m-d H:i:s");
  753. $data["createUser"] = $this->user["uid"];
  754. $res = Db::table("un_talent_allowance_common_file")->insert($data);
  755. return json(new Response(Response::SUCCESS, "上传成功"));
  756. }
  757. public function listCommonFile() {
  758. $param = $this->request->param();
  759. $batchId = $param["batch"];
  760. $where = [["batchId", "=", $batchId], ["enterpriseId", "=", $this->user["uid"]]];
  761. $list = Db::table("un_talent_allowance_common_file")->where($where)->select()->toArray();
  762. foreach ($list as $key => $item) {
  763. $list[$key]["ext"] = pathinfo($item["url"])["extension"];
  764. $list[$key]["url"] = getStoragePath($item["url"]);
  765. }
  766. return json(["rows" => $list]);
  767. }
  768. public function deleteCommonFile() {
  769. $id = $this->request["id"];
  770. $where = [];
  771. $where[] = ["id", "=", $id];
  772. $where[] = ["enterpriseId", "=", $this->user["uid"]];
  773. $file = Db::table("un_talent_allowance_common_file")->where($where)->find();
  774. if (!$file) {
  775. return json(new Response(Response::ERROR, "不存在的文件,删除失败"));
  776. }
  777. if (Db::table("un_talent_allowance_common_file")->where($where)->delete()) {
  778. if (!empty($file["url"])) {
  779. $filepath = "storage/" . $file["url"];
  780. if (file_exists($filepath)) {
  781. unlink($filepath);
  782. }
  783. }
  784. return json(new Response(Response::SUCCESS, "删除成功"));
  785. }
  786. }
  787. public function findTalentAllowance() {
  788. $res = [];
  789. $batch = BatchApi::getValidBatch(ProjectState::JBT, $this->user["type"]);
  790. $year = $batch["batch"];
  791. if ($year) {
  792. $ids = null;
  793. //根据申报年度查询当前企业已申报的人才
  794. $where = [];
  795. $where[] = ["year", "=", $year];
  796. $where[] = ["enterpriseId", "=", $this->user["uid"]];
  797. $talentAllowances = TaModel::where($where)->select()->toArray();
  798. $ids = array_unique(array_column($talentAllowances, "talentId"));
  799. $whr = [];
  800. $whr[] = ["ti.checkState", "=", \app\common\api\TalentState::CERTIFICATED];
  801. $whr[] = ["ti.enterprise_id", "=", $this->user["uid"]];
  802. $whr[] = ["e.type", "=", $this->user["type"]];
  803. $whr[] = ["ti.id", "not in", $ids];
  804. $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,ti.cur_entry_time")->where($whr)->select()->toArray();
  805. foreach ($list as $info) {
  806. if (strtotime($year . "-12-31") >= strtotime($info["identifyMonth"])) {
  807. $res[] = $info;
  808. } else {
  809. $whereTypeChange = [];
  810. $whereTypeChange[] = ["idCard", "=", $info["idCard"]];
  811. $whereTypeChange[] = ["checkState", "=", MainState::PASS];
  812. $whereTypeChange[] = ["isPublic", "=", 6];
  813. $typeChanges = TalentTypeChange::where($whereTypeChange)->select()->toArray();
  814. foreach ($typeChanges as $typeChange) {
  815. if (strtotime($year . "-12-31") >= strtotime($typeChange["oldIdentifyMonth"])) {
  816. $res[] = $info;
  817. break;
  818. }
  819. }
  820. }
  821. }
  822. }
  823. return new Response(Response::SUCCESS, "", ["rows" => $res, "total" => count($res)]);
  824. }
  825. public function export() {
  826. $obj["year"] = \StrUtil::getRequestDecodeParam($this->request, "year");
  827. $obj["name"] = \StrUtil::getRequestDecodeParam($this->request, "name");
  828. $obj["talentArrange"] = \StrUtil::getRequestDecodeParam($this->request, "talentArrange");
  829. $obj["address"] = \StrUtil::getRequestDecodeParam($this->request, "address");
  830. $obj["identifyCondition"] = \StrUtil::getRequestDecodeParam($this->request, "identifyCondition");
  831. $where = [];
  832. $where[] = ["ta.enterpriseId", "=", $this->user["uid"]];
  833. if (\StrUtil::isNotEmpAndNull($obj["year"])) {
  834. $where[] = ["ta.year", "like", "%" . $obj["year"] . "%"];
  835. }
  836. if (\StrUtil::isNotEmpAndNull($obj["name"])) {
  837. $where[] = ["ta.name", "like", "%" . $obj["name"] . "%"];
  838. }
  839. if (\StrUtil::isNotEmpAndNull($obj["talentArrange"])) {
  840. $where[] = ["ta.talentArrange", "=", $obj["talentArrange"]];
  841. }
  842. if (\StrUtil::isNotEmpAndNull($obj["address"])) {
  843. $where[] = ["ta.address", "=", $obj["address"]];
  844. }
  845. if (\StrUtil::isNotEmpAndNull($obj["identifyCondition"])) {
  846. $where[] = ["ta.identifyCondition", "=", $obj["identifyCondition"]];
  847. }
  848. $projects = [
  849. AllowanceProjectEnum::PROJECT_TAX,
  850. AllowanceProjectEnum::PROJECT_WAGES,
  851. AllowanceProjectEnum::PROJECT_ATTENDANCE,
  852. AllowanceProjectEnum::PROJECT_SB_PENSION,
  853. AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
  854. AllowanceProjectEnum::PROJECT_SB_MEDICA,
  855. ];
  856. $months = [];
  857. for ($m = 1; $m <= 12; $m++) {
  858. $months[] = $m . "月";
  859. }
  860. $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]]];
  861. $infoCols = count($columns);
  862. for ($i = 0; $i < count($projects); $i++) {
  863. $columns[] = [AllowanceProjectEnum::getProjectName($projects[$i]), $months];
  864. }
  865. $list = \app\common\model\TalentAllowanceProject::alias("pro")
  866. ->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")
  867. ->leftJoin("un_talent_allowance_info ta", "ta.id=pro.mainId")
  868. ->leftJoin("un_talent_allowancecontract_detail con", "pro.baseId=con.id")
  869. ->where($where)
  870. ->order("ta.year desc,ta.createTime desc,pro.project asc")
  871. ->select()->toArray();
  872. $tmpList = [];
  873. $levelMap = DictApi::selectByParentCode("talent_arrange");
  874. $streetMap = DictApi::selectByParentCode("street");
  875. $where = [];
  876. $where[] = ["id", "in", array_column($list, "identifyCondition")];
  877. $icmap = \app\common\model\TalentCondition::where($where)->column("name", "id");
  878. $where = [];
  879. $where[] = ["id", "in", array_column($list, "enterpriseId")];
  880. $enterpriseMap = \app\common\model\Enterprise::where($where)->column("name", "id");
  881. foreach ($list as $item) {
  882. //组装数据
  883. if (!$tmpList[$item["id"]]) {
  884. $tmpList[$item["id"]]["curEnterpriseId"] = $item["curEnterpriseId"];
  885. $tmpList[$item["id"]]["info"] = [$item["year"], $streetMap[$item["address"]], $item["name"], $item["sex"] == 1 ? "男" : "女", $item["idCard"], $levelMap[$item["talentArrange"]],
  886. $icmap[$item["identifyCondition"]], $item["identifyGetTime"], $item["identifyConditionName"], $item["identifyMonth"], AllowanceTypeEnum::getTypeName($item["allowanceType"]), $item["months"], $item["money"],
  887. $item["moneyDesc"], $this->getCheckStateName($item["checkState"], $item["publicState"], $item["allowanceType"])];
  888. }
  889. if (!$tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]) {
  890. $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]] = [
  891. "startTime" => $item["startTime"],
  892. "endTime" => $item["endTime"],
  893. "entryTime" => $item["entryTime"],
  894. "isQuit" => $item["isQuit"]
  895. ];
  896. }
  897. $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]["projects"][$item["project"]] = $item["pre_months"];
  898. }
  899. $rows = [];
  900. $colorset = [];
  901. foreach ($tmpList as $id => $item) {
  902. foreach ($item["enterprise"] as $enterpriseId => $enterprise) {
  903. $row = $item["info"];
  904. $row[] = $this->user["uid"] == $enterpriseId ? "本单位" : $enterpriseMap[$enterpriseId];
  905. for ($i = 0; $i < count($projects); $i++) {
  906. if (strpos($enterprise["projects"][$projects[$i]], "=") === false) {
  907. $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
  908. for ($m = 1; $m <= 12; $m++) {
  909. $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
  910. if (in_array($_month, $months)) {
  911. $row[] = "✔";
  912. $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
  913. } else {
  914. $row[] = "";
  915. }
  916. }
  917. } else {
  918. $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
  919. $_months = [];
  920. foreach ($months as $month) {
  921. $kv = explode("=", $month);
  922. $_months[$kv[0]] = $kv[1];
  923. }
  924. for ($m = 1; $m <= 12; $m++) {
  925. $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
  926. $days = $_months[$_month];
  927. if ($days && $days > 0) {
  928. $row[] = $days . "天";
  929. $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
  930. } else {
  931. $row[] = "";
  932. }
  933. }
  934. }
  935. }
  936. $rows[] = $row;
  937. }
  938. }
  939. $cols = $infoCols + count($projects) * 12 - 1;
  940. $settings = [
  941. "width" => [["A", 8], ["C", 12], ["D", 6], ["E", 20], ["F", 12], ["G", 70], ["H", 12], ["I", 15], ["J", 12], ["K", 12], ["P", 30]],
  942. "height" => [18],
  943. "freeze" => "D3",
  944. "color" => $colorset
  945. ];
  946. for ($i = 0; $i < count($projects) * 12; $i++) {
  947. $settings["width"][] = [getExcelColumnByIndex($infoCols + $i), 6]; //批设置项目的宽度
  948. }
  949. $settings["background-color"][] = [sprintf("%s2:%s2", getExcelColumnByIndex($infoCols), getExcelColumnByIndex($cols)), "E1F1DE"];
  950. export($columns, $rows, "津补贴申报名单", $settings);
  951. }
  952. private function getCheckStateName($checkState, $publicState, $allowanceType) {
  953. switch ($checkState) {
  954. case 1:
  955. return "待提交";
  956. case 5:
  957. case 13:
  958. case 15:
  959. case 20:
  960. case 25:
  961. case 35:
  962. return "审核中";
  963. case 10:
  964. return "已驳回";
  965. case - 1:
  966. if ($publicState >= 3) {
  967. return "审核不通过";
  968. } else {
  969. return "审核中";
  970. }
  971. break;
  972. case 30:
  973. if ($publicState == 1) {
  974. return "待核查征信";
  975. } else if ($publicState == 2) {
  976. return "待公示";
  977. } else if ($publicState == 3) {
  978. return "公示中";
  979. } else if ($publicState == 4) {
  980. return $allowanceType != 3 ? "待兑现" : "不予兑现";
  981. } else if ($publicState == 5) {
  982. return "已兑现";
  983. }
  984. default:
  985. return "未知状态";
  986. }
  987. }
  988. }