House.php 77 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use think\facade\Db;
  5. use app\common\api\Response;
  6. use app\common\api\DictApi;
  7. use app\common\api\TalentAllowanceApi;
  8. use app\common\api\TalentLogApi;
  9. use app\common\model\TalentAllowance as TaModel;
  10. use app\common\model\TalentChecklog;
  11. use app\common\model\TalentAllowanceArrange;
  12. use app\common\state\ProjectState;
  13. use app\common\state\AllowanceStateEnum;
  14. use app\common\state\AllowanceProjectEnum;
  15. use app\common\state\AllowanceTypeEnum;
  16. use app\common\state\CommonConst;
  17. use app\common\state\HouseStateEnum;
  18. use app\common\model\HousePurchase as houseModel;
  19. /**
  20. * Description of House
  21. *
  22. * @author sgq
  23. */
  24. class House extends AdminController {
  25. public function index() {
  26. $process = $this->request["process"];
  27. $type = $this->user["type"];
  28. $assigns = ["process" => $process, "type" => $type];
  29. if ($process == 4) {
  30. if ($type == CommonConst::ENTERPRISE_NORMAL) {
  31. $msgBody["typeName"] = "晋江市现代产业体系人才津补贴申报";
  32. $msgBody["address"] = "聚才网/人才晋江微信公众号";
  33. $msgBody["dep"] = "中共晋江市委人才办、晋江市纪委监委驻市人力资源和社会保障局纪检监察组或晋江市公共就业和人才服务中心";
  34. $msgBody["phone"] = "0595-85633128";
  35. $msgBody["email"] = "jjrc85661234@163.com";
  36. }
  37. if ($type == CommonConst::ENTERPRISE_JC) {
  38. $msgBody["typeName"] = "晋江市集成电路产业优秀人才津补贴申报";
  39. $msgBody["address"] = "福建(晋江)集成电路产业园官方网站及微信公众号";
  40. $msgBody["dep"] = "集成电路产业园区";
  41. $msgBody["phone"] = "0595-82250007、0595-82250001";
  42. $msgBody["email"] = "jjjcdr@163.com";
  43. }
  44. if ($type == CommonConst::ENTERPRISE_WJ) {
  45. $msgBody["typeName"] = "晋江市医疗卫生人才津补贴申报";
  46. $msgBody["address"] = "“健康晋江”微信公众号";
  47. $msgBody["dep"] = "晋江市卫生健康局";
  48. $msgBody["phone"] = "0595-85636159";
  49. $msgBody["email"] = "jjswjjrsk@163.com";
  50. }
  51. if ($type == CommonConst::ENTERPRISE_GJ) {
  52. $msgBody["typeName"] = "晋江市高等教育人才津补贴申报";
  53. $msgBody["address"] = "“泉州市高教发展中心”微信公众号";
  54. $msgBody["dep"] = "泉州市高教发展中心";
  55. $msgBody["phone"] = "0595-85002588";
  56. $msgBody["email"] = "jjsgjrc@126.com";
  57. }
  58. $assigns["message"] = $msgBody;
  59. }
  60. return view("", $assigns);
  61. }
  62. /**
  63. * 获取优秀人才津补贴列表
  64. */
  65. public function list($process) {
  66. $param = $this->request->param();
  67. $offset = $param["offset"] ?: 0;
  68. $limit = $param["limit"] ?: 10;
  69. $param["process"] = $process;
  70. $param["type"] = $this->user["type"];
  71. $where = [];
  72. $where[] = ["type", "=", $this->user["type"]];
  73. $where[] = ["delete", "=", 0];
  74. $order = "createTime desc";
  75. $this->setCondition($where, $param);
  76. switch ($process) {
  77. case 1:
  78. break;
  79. case 2:
  80. break;
  81. case 3:
  82. $where[] = ["depPassTime", "EXP", Db::raw("is not null")];
  83. break;
  84. case 4:
  85. $where[] = ["checkState", "in", [HouseStateEnum::NOTPASS, HouseStateEnum::REVIEW_PASS]];
  86. $where[] = ["reviewPassTime", "EXP", Db::raw("is not null")];
  87. break;
  88. }
  89. if (in_array($process, [1, 3, 4])) {
  90. $count = houseModel::where($where)->count();
  91. $list = houseModel::where($where)->limit($offset, $limit)->order($order)->select()->toArray();
  92. } else {
  93. /*SELECT
  94. t1.companyId,
  95. t1.state,
  96. t3.`name` AS companyName,
  97. t5.description AS checkMsg,
  98. t2.id,
  99. t2.talentId,
  100. t2.enterpriseId,
  101. t2.type,
  102. t2.declareType,
  103. t2.declareObject,
  104. t2.`year`,
  105. t2.`name`,
  106. t2.cardType,
  107. t2.idCard,
  108. t2.provinceCode,
  109. t2.provinceName,
  110. t2.cityCode,
  111. t2.cityName,
  112. t2.countyCode,
  113. t2.countyName,
  114. t2.street,
  115. t2.talentType,
  116. t2.talentArrange,
  117. t2.identifyCondition,
  118. t2.idenfityConditionName,
  119. t2.identifyGetTime,
  120. t2.phone,
  121. t2.marryStatus,
  122. t2.spouseName,
  123. t2.spouseCardType,
  124. t2.spouseIdcard,
  125. t2.childName,
  126. t2.childCardType,
  127. t2.childIdCard,
  128. t2.number,
  129. t2.houseAddress,
  130. t2.houseArea,
  131. t2.recordTime,
  132. t2.houseMoney,
  133. t2.realEstateNo,
  134. t2.recordNo,
  135. t2.isEnjoyOther,
  136. t2.bank,
  137. t2.bankNumber,
  138. t2.bankNetwork,
  139. t2.bankAccount,
  140. t2.sbPayDetail,
  141. t2.taxPayDetail,
  142. t2.letterDetail,
  143. t2.attendDetail,
  144. t2.mzjCheckDetail,
  145. t2.checkIsTradeRecord,
  146. t2.checkRecordTime,
  147. t2.zjjCheckDetail,
  148. t2.isHasBdcCard,
  149. t2.bdcRegistTime,
  150. t2.isOwner,
  151. t2.transferMethod,
  152. t2.transferTime,
  153. t2.zrzzjCheckDetail,
  154. t2.shouldEnjoyMoney,
  155. t2.realEnjoyMoney,
  156. t2.talentArrangeMonths,
  157. t2.monthCount,
  158. t2.firstSubmitTime,
  159. t2.newSubmitTime,
  160. t2.firstPassTime,
  161. t2.depPassTime,
  162. t2.reviewPassTime,
  163. t2.isConflict,
  164. t2.checkState,
  165. t2.checkMsg,
  166. t2.publicState,
  167. t2.cashType,
  168. t2.cashIdCards,
  169. t2.`fields`,
  170. t2.files,
  171. t2.highProcess
  172. FROM
  173. un_talent_depcheckstate t1
  174. LEFT JOIN un_housepurchase t2 ON t2.id = t1.mainId
  175. LEFT JOIN sys_company t3 ON t3.id = t1.companyId
  176. LEFT JOIN (
  177. SELECT
  178. t4.mainId,
  179. t4.createTime,
  180. t4.companyId,
  181. t4.description
  182. FROM
  183. (
  184. SELECT
  185. *
  186. FROM
  187. un_talent_checklog
  188. WHERE
  189. type = #{type}
  190. AND step = 2
  191. AND state != 8
  192. ORDER BY
  193. createTime DESC
  194. LIMIT 100000
  195. ) t4
  196. GROUP BY
  197. t4.mainId,
  198. t4.companyId
  199. ORDER BY
  200. t4.createTime DESC
  201. ) t5 ON t1.mainId = t5.mainId
  202. AND t1.companyId = t5.companyId
  203. WHERE t1.type=#{type}
  204. and t2.type = #{obj.type}
  205. <include refid="housePurchase_condition"></include>
  206. ORDER BY t1.createTime DESC
  207. LIMIT #{current},#{limit}*/
  208. /*
  209. * SELECT
  210. count(0)
  211. FROM
  212. un_talent_depcheckstate t1
  213. LEFT JOIN un_housepurchase t2 ON t2.id = t1.mainId
  214. LEFT JOIN sys_company t3 ON t3.id = t1.companyId
  215. WHERE t1.type=#{type}
  216. and t2.type = #{obj.type}
  217. <include refid="housePurchase_condition"></include>
  218. */
  219. }
  220. $list = $this->translateChinese($list, $process);
  221. return json(["rows" => $list, "total" => $count]);
  222. }
  223. /**
  224. * 审核页面
  225. * @return type
  226. */
  227. public function toCheckPage() {
  228. $id = $this->request["id"];
  229. $process = $this->request["process"];
  230. $obj = TalentAllowanceApi::getInfoById($id);
  231. $this->translateToChinese($obj);
  232. if ($this->user["type"] == CommonConst::ENTERPRISE_GJ) {
  233. $need_choose_post_type = getJsonConfig("../sys_config.json", "talent_allowance_need_choose_post_type");
  234. $need_choose_institution = getJsonConfig("../sys_config.json", "talent_allowance_need_choose_institution");
  235. if ($need_choose_post_type[$obj["enterpriseId"]]) {
  236. $postTypes = DictApi::findChildDictByCode("PostType");
  237. foreach ($postTypes as $key => $pt) {
  238. if (!in_array($pt["code"], $need_choose_post_type[$obj["enterpriseId"]])) {
  239. unset($postTypes[$key]);
  240. }
  241. }
  242. }
  243. if (in_array($obj["enterpriseId"], $need_choose_institution)) {
  244. $institutions = DictApi::findChildDictByCode("Institution");
  245. }
  246. }
  247. return view("info", ["row" => $obj, "process" => $process, "postTypes" => $postTypes, "institutions" => $institutions]);
  248. }
  249. /**
  250. * 查看详情
  251. * @return type
  252. */
  253. public function toSelectPage() {
  254. $id = $this->request["id"];
  255. $process = $this->request["process"];
  256. $obj = TalentAllowanceApi::getInfoById($id);
  257. $this->translateToChinese($obj);
  258. if ($this->user["type"] == CommonConst::ENTERPRISE_GJ) {
  259. $need_choose_post_type = getJsonConfig("../sys_config.json", "talent_allowance_need_choose_post_type");
  260. $need_choose_institution = getJsonConfig("../sys_config.json", "talent_allowance_need_choose_institution");
  261. if ($need_choose_post_type[$obj["enterpriseId"]]) {
  262. $postTypes = DictApi::findChildDictByCode("PostType");
  263. foreach ($postTypes as $key => $pt) {
  264. if (!in_array($pt["code"], $need_choose_post_type[$obj["enterpriseId"]])) {
  265. unset($postTypes[$key]);
  266. }
  267. }
  268. }
  269. if (in_array($obj["enterpriseId"], $need_choose_institution)) {
  270. $institutions = DictApi::findChildDictByCode("Institution");
  271. }
  272. }
  273. return view("select", ["row" => $obj, "process" => $process, "postTypes" => $postTypes, "institutions" => $institutions]);
  274. }
  275. /**
  276. * 审核保存
  277. */
  278. public function check() {
  279. $obj = $this->request->param();
  280. if (!$obj["checkState"]) {
  281. return new Response(Response::ERROR, "请选择审核状态");
  282. }
  283. $oldObj = TalentAllowanceApi::getInfoById($obj["id"]);
  284. if (!$oldObj) {
  285. return new Response(Response::ERROR, "审核对象不存在");
  286. }
  287. $newObj = [];
  288. $newObj["id"] = $obj["id"];
  289. $projectList = [];
  290. $fileList = [];
  291. if ($obj["process"] == 1) {
  292. if (\StrUtil::isNotEmpAndNull($obj["projects"])) {
  293. $projectList = array_filter(explode(",", $obj["projects"]));
  294. $newObj["projects"] = implode(",", $projectList);
  295. }
  296. if (\StrUtil::isNotEmpAndNull($obj["files"])) {
  297. $fileList = array_filter(explode(",", $obj["files"]));
  298. $newObj["files"] = implode(",", $fileList);
  299. }
  300. //if (Const.RSJ.equals(checkCompany.getCode())) {
  301. $newObj["concats"] = $obj["concats"];
  302. $newObj["fields"] = $obj["fields"];
  303. //}
  304. }
  305. if ($obj["process"] == 3) {
  306. $newObj["toProcess"] = $obj["toProcess"];
  307. $newObj["toDep"] = $obj["toDep"];
  308. }
  309. TaModel::update($newObj);
  310. //添加日志
  311. TalentChecklog::create([
  312. 'id' => getStringId(),
  313. 'mainId' => $obj['id'],
  314. 'type' => intval(ProjectState::JBT),
  315. 'typeFileId' => null,
  316. 'active' => 2,
  317. 'state' => $obj["checkState"],
  318. 'step' => $obj["process"],
  319. 'stateChange' => null,
  320. 'description' => $obj["checkMsg"],
  321. 'createTime' => date("Y-m-d H:i:s", time()),
  322. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  323. ]);
  324. return new Response(Response::SUCCESS, "审核成功");
  325. }
  326. /**
  327. * 提交审核
  328. * @return Response
  329. */
  330. public function submitCheck() {
  331. $id = $this->request["id"];
  332. $process = $this->request["process"];
  333. $old = TalentAllowanceApi::getInfoById($id);
  334. if (!$old) {
  335. return new Response(Response::ERROR, "审核对象不存在");
  336. }
  337. $updCheck = [];
  338. $updCheck["id"] = $id;
  339. $updCheck["type"] = $old["type"];
  340. /* * 查询审核日志 */
  341. $log = TalentLogApi::getLastLogByStep($id, ProjectState::JBT, $process);
  342. if (!$log) {
  343. return new Response(Response::ERROR, "请先审核后再提交");
  344. }
  345. $updCheck["checkMsg"] = $log["description"];
  346. /* * 判断到达的最高流程 */
  347. $updCheck["highProcess"] = !$old["highProcess"] || $old["highProcess"] < $process ? $process : $old["process"];
  348. switch ($process) {
  349. case 1:
  350. switch ($log["state"]) {
  351. case 3:
  352. $updCheck["firstPassTime"] = $old["firstPassTime"];
  353. if (!$old["firstPassTime"]) {
  354. $updCheck["firstPassTime"] = date("Y-m-d H:i:s");
  355. }
  356. if (!$old["visitPassTime"]) {
  357. $updCheck["visitPassTime"] = date("Y-m-d H:i:s");
  358. }
  359. $updCheck["submitTime"] = date("Y-m-d H:i:s");
  360. $updCheck["checkState"] = AllowanceStateEnum::NEED_REVIEW;
  361. break;
  362. case 2:
  363. $updCheck["checkState"] = AllowanceStateEnum::FIRST_REJECT;
  364. break;
  365. case -2:
  366. $updCheck["checkState"] = AllowanceStateEnum::FIRST_REJECT_BRANCH;
  367. break;
  368. case -1:
  369. $updCheck["checkState"] = AllowanceStateEnum::NOTPASS;
  370. $updCheck["recommendAllowanceType"] = 3;
  371. $updCheck["recommendMoney"] = 0;
  372. $updCheck["recommendAllowanceMsg"] = "审核不通过,不予兑现";
  373. break;
  374. default:
  375. return new Response(Response::ERROR, "未知的审核状态");
  376. }
  377. //添加日志
  378. TalentChecklog::create([
  379. 'id' => getStringId(),
  380. 'mainId' => $id,
  381. 'type' => intval(ProjectState::JBT),
  382. 'typeFileId' => null,
  383. 'active' => 1,
  384. 'state' => $log["state"],
  385. 'step' => $process,
  386. 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($updCheck["checkState"]),
  387. 'description' => $log["description"],
  388. 'createTime' => date("Y-m-d H:i:s", time()),
  389. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  390. ]);
  391. break;
  392. case 2:
  393. if ($old["checkState"] != AllowanceStateEnum::NEED_VISIT_CHECK && $old["checkState"] != AllowanceStateEnum::REVIEW_REJECT) {
  394. return new Response(Response::ERROR, "不在审核范围内");
  395. }
  396. $updCheck["checkState"] = AllowanceStateEnum::NEED_REVIEW;
  397. $updCheck["visitPassTime"] = date("Y-m-d H:i:s");
  398. //添加日志
  399. TalentChecklog::create([
  400. 'id' => getStringId(),
  401. 'mainId' => $id,
  402. 'type' => intval(ProjectState::JBT),
  403. 'typeFileId' => null,
  404. 'active' => 1,
  405. 'state' => 3,
  406. 'step' => $process,
  407. 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($updCheck["checkState"]),
  408. 'description' => "走访核查提交审核",
  409. 'createTime' => date("Y-m-d H:i:s", time()),
  410. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  411. ]);
  412. break;
  413. case 3:
  414. switch ($log["state"]) {
  415. case 3:
  416. $updCheck["checkState"] = AllowanceStateEnum::REVIEW_PASS;
  417. $updCheck["reviewPassTime"] = date("Y-m-d H:i:s");
  418. /* * * 在此处需要判断津补贴类型 */
  419. $arrangeList = $this->validateAllowanceType($updCheck);
  420. $taaModel = new TalentAllowanceArrange();
  421. $taaModel->saveAll($arrangeList);
  422. break;
  423. case 2:
  424. $updCheck["checkState"] = AllowanceStateEnum::REJECT_TO_FIRST;
  425. $updCheck["toProcess"] = null;
  426. $updCheck["toDep"] = "";
  427. break;
  428. case -1:
  429. $updCheck["checkState"] = AllowanceStateEnum::NOTPASS;
  430. $updCheck["recommendAllowanceType"] = 3;
  431. $updCheck["recommendMoney"] = 0;
  432. $updCheck["recommendAllowanceMsg"] = "审核不通过,不予兑现";
  433. break;
  434. default:
  435. return new Response(Response::ERROR, "未知的审核状态");
  436. }
  437. //添加日志
  438. TalentChecklog::create([
  439. 'id' => getStringId(),
  440. 'mainId' => $id,
  441. 'type' => intval(ProjectState::JBT),
  442. 'typeFileId' => null,
  443. 'active' => 1,
  444. 'state' => $log["state"],
  445. 'step' => $process,
  446. 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($updCheck["checkState"]),
  447. 'description' => $log["description"],
  448. 'createTime' => date("Y-m-d H:i:s", time()),
  449. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  450. ]);
  451. break;
  452. }
  453. TalentChecklog::where("id", $log["id"])->delete();
  454. TaModel::update($updCheck);
  455. return new Response(Response::SUCCESS, "提交审核成功");
  456. }
  457. /**
  458. * 初审撤销
  459. * @return Response
  460. */
  461. public function cancleFirstCheck() {
  462. $obj = $this->request->param();
  463. $id = $obj["id"];
  464. $checkMsg = $obj["checkMsg"];
  465. if (!$id) {
  466. return new Response(Response::ERROR, "请选择需要撤销的对象");
  467. }
  468. $old = TalentAllowanceApi::getInfoById($id);
  469. if ($old["checkState"] != AllowanceStateEnum::NEED_REVIEW && $old["checkState"] != AllowanceStateEnum::NOTPASS) {
  470. return new Response(Response::ERROR, "当前对象的审核无法撤销");
  471. }
  472. $data["id"] = $id;
  473. $data["checkMsg"] = $checkMsg;
  474. $data["checkState"] = AllowanceStateEnum::NEED_CHECK;
  475. //添加日志
  476. TalentChecklog::create([
  477. 'id' => getStringId(),
  478. 'mainId' => $id,
  479. 'type' => intval(ProjectState::JBT),
  480. 'typeFileId' => null,
  481. 'active' => 1,
  482. 'state' => 11, //撤销审核
  483. 'step' => 1,
  484. 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($data["checkState"]),
  485. 'description' => "撤销原因:" . $checkMsg,
  486. 'createTime' => date("Y-m-d H:i:s", time()),
  487. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  488. ]);
  489. TaModel::update($data);
  490. return new Response(Response::SUCCESS, "撤销成功");
  491. }
  492. /**
  493. * 复核撤销
  494. * @return Response|\app\admin\controller\ResponseObj
  495. */
  496. public function reviewCancleCheck() {
  497. $obj = $this->request->param();
  498. $id = $obj["id"];
  499. $checkMsg = $obj["checkMsg"];
  500. if (!$id) {
  501. return new Response(Response::ERROR, "请选择需要撤销的对象");
  502. }
  503. $old = TalentAllowanceApi::getInfoById($id);
  504. if ($old["checkState"] != AllowanceStateEnum::REVIEW_PASS || $old["publicState"] != 1) {
  505. return new Response(Response::ERROR, "当前对象的审核无法撤销");
  506. }
  507. $data["id"] = $id;
  508. $data["checkMsg"] = $checkMsg;
  509. $data["checkState"] = AllowanceStateEnum::NEED_REVIEW;
  510. //添加日志
  511. TalentChecklog::create([
  512. 'id' => getStringId(),
  513. 'mainId' => $id,
  514. 'type' => intval(ProjectState::JBT),
  515. 'typeFileId' => null,
  516. 'active' => 1,
  517. 'state' => 11, //撤销审核
  518. 'step' => 3,
  519. 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($data["checkState"]),
  520. 'description' => "撤销原因:" . $checkMsg,
  521. 'createTime' => date("Y-m-d H:i:s", time()),
  522. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  523. ]);
  524. TaModel::update($data);
  525. return new Response(Response::SUCCESS, "撤销成功");
  526. }
  527. /**
  528. * 查询需要导出的数据
  529. *
  530. */
  531. public function findTalentAllowanceByPage() {
  532. $param = $this->request->param();
  533. $where = [];
  534. $where[] = ["type", "=", $this->user["type"]];
  535. if ($param != null) {
  536. if (\StrUtil::isNotEmpAndNull($param["name"])) {
  537. $where[] = ["name", "like", "%" . $param["name"] . "%"];
  538. }
  539. if (\StrUtil::isNotEmpAndNull($param["idCard"])) {
  540. $where[] = ["idCard", "like", "%" . $param["idCard"] . "%"];
  541. }
  542. }
  543. $error = null;
  544. switch ($param["type"]) {
  545. case 1:
  546. case 2:
  547. $where[] = ["publicState", "=", 1];
  548. $where[] = ["checkState", "in", [-1, 30]];
  549. $error = "暂无可核查征信的数据";
  550. break;
  551. case 3:
  552. case 7:
  553. $where[] = ["publicState", "=", 2];
  554. $where[] = ["checkState", "in", [-1, 30]];
  555. $where[] = ["recommendAllowanceType", "=", 3];
  556. $error = "暂无可公示(不予兑现)的数据";
  557. break;
  558. case 4: //需要兑现
  559. case 8:
  560. $where[] = ["publicState", "=", 2];
  561. $where[] = ["checkState", "in", [30]];
  562. $where[] = ["recommendAllowanceType", "in", [1, 2]];
  563. $error = "暂无需要公示(兑现)的数据";
  564. break;
  565. case 5:
  566. $where[] = ["publicState", "=", 3];
  567. $where[] = ["checkState", "in", [-1, 30]];
  568. $error = "暂无可公示通过的数据";
  569. break;
  570. case 6:
  571. $where[] = ["publicState", "=", 4];
  572. $where[] = ["checkState", "in", [30]];
  573. $where[] = ["allowanceType", "in", [1, 2]];
  574. $error = "暂无可兑现的数据";
  575. break;
  576. }
  577. $list = TaModel::where($where)->select()->toArray();
  578. //查询企业信息
  579. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  580. foreach ($list as $key => $item) {
  581. $list[$key]["enterpriseName"] = $enterpriseMap[$item["enterpriseId"]];
  582. }
  583. $res = [
  584. "rows" => $list,
  585. "total" => count($list)
  586. ];
  587. return new Response(Response::SUCCESS, "", $res);
  588. }
  589. public function exportHczx() {
  590. $response = new \stdClass();
  591. $response->code = 500;
  592. $ids = $this->request->param("ids");
  593. $ids_arr = array_filter(explode(",", $ids));
  594. if (!$ids_arr) {
  595. $response->msg = "没有选择导出的名单";
  596. return \StrUtil::back($response, "TalentAllowanceInfo.hczxCallBack");
  597. }
  598. $where = [];
  599. $where[] = ["id", "in", $ids_arr];
  600. $list = TaModel::field("id,cardType,idCard,name,enterpriseId,year")->where($where)->select()->toArray();
  601. if (!$list) {
  602. $response->msg = "暂无可核查征信的数据";
  603. return \StrUtil::back($response, "TalentAllowanceInfo.hczxCallBack");
  604. }
  605. $columns = ["序号", "姓名", "证件类型", "证件号码", "工作单位", "备注"];
  606. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  607. $cardTypeName = DictApi::selectByParentCode("card_type");
  608. $rows = [];
  609. for ($i = 0; $i < count($list); $i++) {
  610. $item = $list[$i];
  611. $row = [
  612. $i + 1, $item["name"], $cardTypeName[$item["cardType"]], $item["idCard"], $enterpriseMap[$item["enterpriseId"]], $item["description"]
  613. ];
  614. $rows[] = $row;
  615. }
  616. $filename = "津补贴待核查征信名单导出";
  617. if ($rows) {
  618. export($columns, $rows, $filename);
  619. exit();
  620. } else {
  621. $response->msg = "没有选择导出的名单";
  622. return \StrUtil::back($response, "TalentTypeChange.callBack");
  623. }
  624. }
  625. /**
  626. * 核查征信驳回
  627. */
  628. public function hczxReject() {
  629. $param = $this->request->param();
  630. if (!$param) {
  631. return new Response(Response::ERROR, "系统错误,请联系管理员");
  632. }
  633. $old = TalentAllowanceApi::getInfoById($param["id"]);
  634. if ($old["publicState"] != 1) {
  635. return new Response(Response::ERROR, "当前记录不是待核查征信状态,无法核查");
  636. }
  637. $data["id"] = $param["id"];
  638. $data["publicState"] = 2;
  639. $data["checkState"] = AllowanceStateEnum::NOTPASS;
  640. $data["recommendAllowanceType"] = 3;
  641. $data["recommendAllowanceMsg"] = "征信失信,不予兑现,失信原因:" . $param["outMsg"];
  642. $data["recommendMonths"] = "";
  643. $data["recommendMoney"] = 0.00;
  644. $data["workAllowanceMoney"] = null;
  645. $data["developAllowanceMoney"] = null;
  646. //添加日志
  647. TalentChecklog::create([
  648. 'id' => getStringId(),
  649. 'mainId' => $param["id"],
  650. 'type' => intval(ProjectState::JBT),
  651. 'typeFileId' => null,
  652. 'active' => 1,
  653. 'state' => 2,
  654. 'step' => 4,
  655. 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "-><span class='label label-primary'>审核不通过</span>" . "公示状态:<span class='label label-success'>待核查</span>-><span class='label label-primary'>待公示</span>",
  656. 'description' => $param["outMsg"],
  657. 'createTime' => date("Y-m-d H:i:s", time()),
  658. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  659. ]);
  660. TaModel::update($data);
  661. return new Response(Response::SUCCESS, "核查征信成功");
  662. }
  663. /**
  664. * 核查征信批量通过
  665. */
  666. public function hczxPass() {
  667. $ids = $this->request["ids"];
  668. if (\StrUtil::isEmpOrNull($ids)) {
  669. return new Response(Response::ERROR, "请选择核查征信通过的数据");
  670. }
  671. $where = [];
  672. $where[] = ["id", "in", $ids];
  673. $list = TaModel::where($where)->select()->toArray();
  674. $logList = [];
  675. $upds = [];
  676. foreach ($list as $obj) {
  677. $upds[] = [
  678. "id" => $obj["id"],
  679. "publicState" => 2,
  680. ];
  681. $logList[] = [
  682. "id" => getStringId(),
  683. "type" => ProjectState::JBT,
  684. "mainId" => $obj["id"],
  685. "active" => 1,
  686. "state" => 3,
  687. "step" => 4,
  688. "stateChange" => "<span class='label label-success'>待核查</span>-><span class='label label-primary'>待公示</span>",
  689. "description" => "核查征信通过",
  690. "createTime" => date("Y-m-d H:i:s"),
  691. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  692. ];
  693. }
  694. $taModel = new TaModel();
  695. $taModel->saveAll($upds);
  696. Db::table("new_talent_checklog")->insertAll($logList);
  697. return new Response(Response::SUCCESS, "核查征信通过成功");
  698. }
  699. /**
  700. * 公示
  701. * */
  702. public function publicBatch() {
  703. $params = $this->request->param();
  704. $ids = $params["ids"];
  705. $ids = array_filter(explode(",", $ids));
  706. if (!$ids) {
  707. return new Response(Response::ERROR, "请至少选择一行数据");
  708. }
  709. $isMessage = $params["isMessage"] == 1 ? true : false;
  710. if ($isMessage && (!$params["typeName"] || !$params["address"] || !$params["publicStartTime"] || !$params["publicEndTime"] || !$params["dep"] || !$params["phone"] || !$params["email"])) {
  711. return new Response(Response::ERROR, "短信参数不能为空");
  712. }
  713. $where = [];
  714. $where[] = ["id", "in", $ids];
  715. $list = TaModel::where($where)->select()->toArray();
  716. Db::startTrans();
  717. try {
  718. $logList = [];
  719. $phones = [];
  720. foreach ($list as $info) {
  721. $data["id"] = $info["id"];
  722. $data["publicState"] = 3;
  723. Db::table("un_talent_allowance_info")->update($data);
  724. /* * 添加日志 */
  725. $logList[] = [
  726. "id" => getStringId(),
  727. "type" => ProjectState::JBT,
  728. "mainId" => $info["id"],
  729. "active" => 1,
  730. "state" => 3,
  731. "step" => 5,
  732. "stateChange" => "<span class='label label-success'>待公示</span>-><span class='label label-primary'>公示中</span>",
  733. "description" => "批量公示",
  734. "createTime" => date("Y-m-d H:i:s"),
  735. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  736. ];
  737. $phones[] = $info["phone"];
  738. }
  739. $effect = Db::table("new_talent_checklog")->insertAll($logList);
  740. Db::commit();
  741. if ($phones && $isMessage && $effect) {
  742. $tpl_content = sprintf("【晋江市人才服务平台】您好!您提交申请的%s已完成初步审核,现通过%s将审核结果予以公示,公示时间%s至%s。公示期间如有异议,请及时向%s反映。电话%s,电子邮箱%s。",
  743. $params["typeName"], $params["address"], $params["publicStartTime"], $params["publicEndTime"], $params["dep"], $params["phone"], $params["email"]);
  744. $phones = array_filter($phones);
  745. foreach ($phones as $phone) {
  746. queue("app\job\Messenger", ["type" => 6, "userId" => 0, "phone" => $phone, "template" => $tpl_content, "processName" => "津补贴-批量公示", "userType" => 3]);
  747. }
  748. }
  749. return new Response(Response::SUCCESS, "公示成功");
  750. } catch (\think\db\exception\DbException $e) {
  751. Db::rollback();
  752. return new Response(Response::SUCCESS, "公示失败:" . $e->getMessage());
  753. }
  754. }
  755. /**
  756. * 跳转到公示再审核页面
  757. * */
  758. public function toSupplePage() {
  759. $id = $this->request["id"];
  760. $process = $this->request["process"];
  761. $obj = TalentAllowanceApi::getInfoById($id);
  762. $this->translateToChinese($obj);
  763. if ($this->user["type"] == CommonConst::ENTERPRISE_GJ) {
  764. $need_choose_post_type = getJsonConfig("../sys_config.json", "talent_allowance_need_choose_post_type");
  765. $need_choose_institution = getJsonConfig("../sys_config.json", "talent_allowance_need_choose_institution");
  766. if ($need_choose_post_type[$obj["enterpriseId"]]) {
  767. $postTypes = DictApi::findChildDictByCode("PostType");
  768. foreach ($postTypes as $key => $pt) {
  769. if (!in_array($pt["code"], $need_choose_post_type[$obj["enterpriseId"]])) {
  770. unset($postTypes[$key]);
  771. }
  772. }
  773. }
  774. if (in_array($obj["enterpriseId"], $need_choose_institution)) {
  775. $institutions = DictApi::findChildDictByCode("Institution");
  776. }
  777. }
  778. return view("public_check", ["row" => $obj, "process" => $process, "postTypes" => $postTypes, "institutions" => $institutions]);
  779. }
  780. /**
  781. * 公示再审核计算津补贴
  782. * */
  783. public function suppleCheckCalculate() {
  784. $id = $this->request["id"];
  785. try {
  786. $info = TalentAllowanceApi::getInfoById($id);
  787. $arrangeList = $this->validateAllowanceType($info);
  788. $detailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $id)->select()->toArray();
  789. $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
  790. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  791. foreach ($detailList as &$detail) {
  792. $detail["enterpriseName"] = $enterpriseMap[$detail["enterpriseId"]];
  793. if (\StrUtil::isNotEmpAndNull($detail["talentType"])) {
  794. $detail["talentTypeName"] = $talentTypeMap[$detail["talentType"]];
  795. }
  796. }
  797. $res = [
  798. "info" => $info,
  799. "detailList" => $detailList
  800. ];
  801. return new Response(Response::SUCCESS, "计算成功", $res);
  802. } catch (\think\Exception $e) {
  803. return new Response(Response::ERROR, "系统异常,请联系管理员");
  804. }
  805. }
  806. /**
  807. * 公示后审核
  808. */
  809. public function afterCheck() {
  810. $param = $this->request->param();
  811. if (!$param["id"]) {
  812. return new Response(Response::ERROR, "系统错误,请联系管理员");
  813. }
  814. $old = TalentAllowanceApi::getInfoById($param["id"]);
  815. if ($old["publicState"] != 3) {
  816. return new Response(Response::ERROR, "当前记录不是公示中状态,无法审核");
  817. }
  818. try {
  819. $arrangeList = null;
  820. $desc = "审核意见:" . $param["checkMsg"] . ";\n";
  821. $desc .= "征信:" . ($param["zxState"] == 1 ? "征信通过" : $param["zxMsg"] . ";\n");
  822. $data["id"] = $param["id"];
  823. if ($param["checkState"] == -1) {
  824. $data["checkState"] = -1;
  825. $data["checkMsg"] = $param["checkMsg"];
  826. $data["allowanceType"] = 3;
  827. $data["allowanceMsg"] = "审核不通过,原因:" . $param["checkMsg"];
  828. $data["outMsg"] = $param["zxState"] == 1 ? "" : $param["zxMsg"];
  829. } else if ($param["checkState"] == 3) {
  830. if ($param["zxState"] == 1) {
  831. $typeName = "";
  832. $old["recommendAllowanceMsg"] = "";
  833. if ($param["source"] == 1) { //遵循系统结果
  834. $arrangeList = $this->validateAllowanceType($old);
  835. $typeName = "系统判定:津补贴类型(" . (\app\common\state\AllowanceTypeEnum::getTypeName($old["allowanceType"])) . ");享受月份:" . $old["recommendMonths"] . ";\n";
  836. $old["recommendAllowanceMsg"] = $typeName . "判定说明:\n" . $old["recommendAllowanceMsg"] . ";";
  837. } else if ($param["source"] == 2) {
  838. $detailIds = array_column($param["details"], "id");
  839. $where = [];
  840. $where[] = ["id", "in", $detailIds];
  841. $detailList = \app\common\model\TalentAllowancecontractDetail::where($where)->select()->toArray();
  842. $set = [];
  843. if ($params["resAllowanceType"] == 1) {
  844. $monthsMap = [];
  845. for ($i = 0; $i < count($param["details"]); $i++) {
  846. $monthsMap[$param["details"][$i]["id"]] = $param["details"][$i]["months"];
  847. }
  848. foreach ($detailList as &$detail) {
  849. $months = $monthdsMap[$detail["id"]];
  850. if (\StrUtil::isNotEmpAndNull($months)) {
  851. $detail["months"] = $months;
  852. $set = array_merge($set, explode(",", $months));
  853. }
  854. }unset($detail);
  855. }
  856. $set = array_filter($set);
  857. usort($set, function($a, $b) {
  858. return (int) $a - (int) $b;
  859. });
  860. $old["recommendAllowanceType"] = $param["resAllowanceType"];
  861. $old["recommendMonths"] = implode(",", $set);
  862. $typeName = "人工判定:津补贴类型(" . (\app\common\state\AllowanceTypeEnum::getTypeName($old["recommendAllowanceType"])) . ");享受月份:" . $old["recommendMonths"] . ";\n";
  863. $old["recommendAllowanceMsg"] = $typeName . "判定说明:\n" . $obj["resAllowanceMsg"] . ";";
  864. $arrangeList = $this->calculateAllowance($old, $set, $detailList);
  865. }
  866. $desc .= "判定结果:" . $typeName;
  867. $data["checkState"] = 30;
  868. $data["outMsg"] = "";
  869. $data["allowanceType"] = $old["recommendAllowanceType"];
  870. $data["allowanceMsg"] = $old["recommendAllowanceMsg"];
  871. $data["months"] = $old["recommendMonths"];
  872. $data["money"] = $old["recommendMoney"];
  873. $data["moneyDesc"] = $old["recommendMoneyDesc"];
  874. $data["jtTalentArrange"] = $old["recommendTalentArrange"];
  875. $data["workAllowanceMoney"] = $old["workAllowanceMoney"];
  876. $data["developAllowanceMoney"] = $old["developAllowanceMoney"];
  877. } else {
  878. $data["checkState"] = -1;
  879. $data["outMsg"] = $param["zxMsg"];
  880. $data["allowanceType"] = 3;
  881. $data["allowanceMsg"] = "征信失信(不予兑现),原因:" . $param["zxMsg"];
  882. }
  883. }
  884. if ($param["allowanceType"] == 3) {
  885. $data["months"] = "";
  886. $data["money"] = 0;
  887. $data["moneyDesc"] = "";
  888. $data["jtTalentArrange"] = "";
  889. $data["workAllowanceMoney"] = null;
  890. $data["developAllowanceMoney"] = null;
  891. }
  892. $data["isPublicCheck"] = 1;
  893. $data["publicState"] = 4;
  894. //添加日志
  895. TalentChecklog::create([
  896. 'id' => getStringId(),
  897. 'mainId' => $old['id'],
  898. 'type' => intval(ProjectState::JBT),
  899. 'typeFileId' => null,
  900. 'active' => 1,
  901. 'state' => $param["checkState"] == AllowanceStateEnum::REVIEW_PASS ? 3 : $param["checkState"],
  902. 'step' => 6,
  903. 'stateChange' => "<span class='label label-success'>公示中</span>-><span class='label label-primary'>待兑现</span>",
  904. 'description' => $desc,
  905. 'createTime' => date("Y-m-d H:i:s", time()),
  906. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  907. ]);
  908. TaModel::update($data);
  909. if ($arrangeList != null) {
  910. $taaModel = new TalentAllowanceArrange();
  911. $taaModel->saveAll($arrangeList);
  912. }
  913. return new Response(Response::SUCCESS, "审核成功");
  914. } catch (\think\Exception $e) {
  915. return new Response(Response::ERROR, "系统异常,请联系管理员");
  916. }
  917. }
  918. /**
  919. * 批量公示通过
  920. */
  921. public function publicPass() {
  922. $ids = $this->request["ids"];
  923. $ids = explode(",", $ids);
  924. if (!$ids) {
  925. return new Response(Response::ERROR, "请至少选择一行数据");
  926. }
  927. $where = [];
  928. $where[] = ["id", "in", $ids];
  929. $list = TaModel::where($where)->select()->toArray();
  930. $logList = [];
  931. try {
  932. Db::startTrans();
  933. for ($i = 0; $i < count($list); $i++) {
  934. $obj = $list[$i];
  935. $upd["id"] = $obj["id"];
  936. $upd["publicState"] = 4;
  937. $upd["allowanceType"] = $obj["recommendAllowanceType"];
  938. $upd["allowanceMsg"] = $obj["recommendAllowanceMsg"];
  939. if ($upd["allowanceType"] == 1) {
  940. $upd["months"] = $obj["recommendMonths"];
  941. $upd["money"] = $obj["recommendMoney"];
  942. $upd["moneyDesc"] = $obj["recommendMoneyDesc"];
  943. } else if ($upd["allowanceType"] == 2) {
  944. $upd["months"] = "";
  945. $upd["jtTalentArrange"] = $obj["recommendTalentArrange"];
  946. $upd["money"] = $obj["recommendMoney"];
  947. $upd["moneyDesc"] = $obj["recommendMoneyDesc"];
  948. $upd["workAllowanceMoney"] = null;
  949. $upd["developAllowanceMoney"] = null;
  950. } else {
  951. $upd["months"] = "";
  952. $upd["money"] = 0.00;
  953. $upd["workAllowanceMoney"] = null;
  954. $upd["developAllowanceMoney"] = null;
  955. }
  956. Db::table("un_talent_allowance_info")->update($upd);
  957. //添加日志
  958. $stateChange = null;
  959. $desc = null;
  960. if ($obj["checkState"] == AllowanceStateEnum::NOTPASS) {
  961. $stateChange = "<span class='label label-success'>公示中</span>-><span class='label label-danger'>审核不通过</span>";
  962. $desc = "审核不通过";
  963. } else {
  964. $stateChange = "<span class='label label-success'>公示中</span>-><span class='label label-primary'>待兑现</span>";
  965. $desc = "批量公示";
  966. }
  967. $logList[] = [
  968. "id" => getStringId(),
  969. "type" => ProjectState::JBT,
  970. "mainId" => $obj["id"],
  971. "active" => 1,
  972. "state" => 3,
  973. "step" => 6,
  974. "stateChange" => $stateChange,
  975. "description" => $desc,
  976. "createTime" => date("Y-m-d H:i:s"),
  977. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  978. ];
  979. }
  980. Db::table("new_talent_checklog")->insertAll($logList);
  981. Db::commit();
  982. return new Response(Response::SUCCESS, "批量公示通过成功");
  983. } catch (\think\db\exception\DbException $e) {
  984. Db::rollback();
  985. return new Response(Response::ERROR, "批量公示失败:" . $e->getCode());
  986. }
  987. }
  988. /**
  989. * 兑现
  990. */
  991. public function cash() {
  992. $ids = $this->request["ids"];
  993. $ids = array_filter(explode(",", $ids));
  994. if (!$ids) {
  995. return new Response(Response::ERROR, "请至少选择一行数据");
  996. }
  997. $where = [];
  998. $where[] = ["id", "in", $ids];
  999. $list = TaModel::where($where)->select()->toArray();
  1000. //添加日志
  1001. $logList = [];
  1002. try {
  1003. Db::startTrans();
  1004. for ($i = 0; $i < count($list); $i++) {
  1005. $obj = $list[$i];
  1006. $upd["id"] = $obj["id"];
  1007. $upd["publicState"] = 5;
  1008. Db::table("un_talent_allowance_info")->update($upd);
  1009. $logList[] = [
  1010. "id" => getStringId(),
  1011. "type" => ProjectState::JBT,
  1012. "mainId" => $obj["id"],
  1013. "active" => 1,
  1014. "state" => 3,
  1015. "step" => 50,
  1016. "stateChange" => "<span class='label label-success'>待兑现</span>-><span class='label label-primary'>已兑现</span>;",
  1017. "description" => "批量兑现",
  1018. "createTime" => date("Y-m-d H:i:s"),
  1019. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  1020. ];
  1021. }
  1022. Db::table("new_talent_checklog")->insertAll($logList);
  1023. Db::commit();
  1024. return new Response(Response::SUCCESS, "批量兑现成功");
  1025. } catch (\think\db\exception\DbException $e) {
  1026. Db::rollback();
  1027. return new Response(Response::ERROR, "批量兑现失败:" . $e->getCode());
  1028. }
  1029. }
  1030. /**
  1031. * 公示预览(不予兑现)
  1032. */
  1033. public function exportPublicNotCash() {
  1034. $response = new \stdClass();
  1035. $response->code = 500;
  1036. //获取字典表人才层次+
  1037. $levelMap = DictApi::selectByParentCode("talent_arrange");
  1038. $streetMap = DictApi::selectByParentCode("street");
  1039. //查询企业信息
  1040. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  1041. //查询所有
  1042. $where = [];
  1043. $where[] = ["id", "in", explode(",", $this->request["ids"])];
  1044. $list = TaModel::where($where)->select()->toArray();
  1045. $rows = [];
  1046. for ($i = 0; $i < count($list); $i++) {
  1047. $item = $list[$i];
  1048. $rows[] = [
  1049. $i + 1, $item["name"], $enterpriseMap[$item["enterpriseId"]], $streetMap[$item["address"]], $levelMap[$item["talentArrange"]], $item["description"]
  1050. ];
  1051. }
  1052. $filename = CommonConst::getTypeName($this->user["type"]) . $allList[0]["year"] . "年度津补贴不予兑现对象名单";
  1053. $columns = ["序号", "姓名", "工作单位", "镇(街道)", "人才层次", "备注"];
  1054. if ($rows) {
  1055. export($columns, $rows, $filename);
  1056. exit();
  1057. } else {
  1058. $response->msg = "没有选择导出的名单";
  1059. return \StrUtil::back($response, "TalentTypeChange.callBack");
  1060. }
  1061. }
  1062. /**
  1063. * 导出公示名单(需要兑现)
  1064. */
  1065. public function exportPublic() {
  1066. //获取字典表人才层次+
  1067. $levelMap = DictApi::selectByParentCode("talent_arrange");
  1068. $streetMap = DictApi::selectByParentCode("street");
  1069. //查询企业信息
  1070. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  1071. /* * 查询需要公示的数据 */
  1072. $where = [];
  1073. $where[] = ["id", "in", explode(",", $this->request["ids"])];
  1074. $list = TaModel::where($where)->select()->toArray();
  1075. /* * 查询相关的津补贴人才层次 */
  1076. $where = [];
  1077. $where[] = ["mainId", "in", explode(",", $this->request["ids"])];
  1078. $arrangeList = TalentAllowanceArrange::where($where)->select()->toArray();
  1079. foreach ($arrangeList as &$arrange) {
  1080. $arrange["talentArrangeName"] = $levelMap[$arrange["talentArrange"]];
  1081. }unset($arrange);
  1082. /* Map<String,List<TalentAllowanceArrange>> arrangeMap = arrangeList.stream().collect(Collectors.groupingBy(TalentAllowanceArrange::getMainId));
  1083. Integer sheetSize = 0;
  1084. for(TalentAllowanceInfo info:allList){
  1085. info.setEnterpriseName(enterpriseMap.get(info.getEnterpriseId()));
  1086. info.setAddressName(streetMap.get(info.getAddress()));
  1087. info.setTalentArrangeName(levelMap.get(info.getTalentArrange()));
  1088. if(info.getRecommendAllowanceType() == 1){
  1089. info.setArrangeList(arrangeMap.get(info.getId()));
  1090. sheetSize = sheetSize + info.getArrangeList().size();
  1091. }else if(info.getRecommendAllowanceType() == 1){
  1092. sheetSize++;
  1093. }
  1094. } */
  1095. $filename = CommonConst::getTypeName($this->user["type"]) . $list[0]["year"] . "年度津补贴拟发放对象名单";
  1096. $columns = ["序号", "姓名", "工作单位", "镇(街道)", "人才层次", "津补贴享受月份数", "每月享受津贴标准(元)", $list[0]["year"] . "年度累计应享受津补贴金额(元)", "备注"];
  1097. }
  1098. /**
  1099. * 导出基本信息
  1100. */
  1101. public function exportBasicInfo() {
  1102. $obj["year"] = \StrUtil::getRequestDecodeParam($this->request, "year");
  1103. $obj["enterpriseName"] = \StrUtil::getRequestDecodeParam($this->request, "enterpriseName");
  1104. $obj["name"] = \StrUtil::getRequestDecodeParam($this->request, "name");
  1105. $obj["idCard"] = \StrUtil::getRequestDecodeParam($this->request, "idCard");
  1106. $obj["talentType"] = \StrUtil::getRequestDecodeParam($this->request, "talentType");
  1107. $obj["talentArrange"] = \StrUtil::getRequestDecodeParam($this->request, "talentArrange");
  1108. $obj["address"] = \StrUtil::getRequestDecodeParam($this->request, "address");
  1109. $obj["identifyCondition"] = \StrUtil::getRequestDecodeParam($this->request, "identifyCondition");
  1110. $obj["isSupple"] = \StrUtil::getRequestDecodeParam($this->request, "isSupple");
  1111. $obj["checkState"] = \StrUtil::getRequestDecodeParam($this->request, "checkState");
  1112. $obj["publicState"] = \StrUtil::getRequestDecodeParam($this->request, "publicState");
  1113. $obj["companyName"] = \StrUtil::getRequestDecodeParam($this->request, "companyName");
  1114. $obj["allowanceType"] = \StrUtil::getRequestDecodeParam($this->request, "allowanceType");
  1115. $obj["recommendAllowanceType"] = \StrUtil::getRequestDecodeParam($this->request, "recommendAllowanceType");
  1116. $obj["introductionMode"] = \StrUtil::getRequestDecodeParam($this->request, "introductionMode");
  1117. $obj["firstJJStartTime"] = \StrUtil::getRequestDecodeParam($this->request, "firstJJStartTime");
  1118. $obj["firstJJEndTime"] = \StrUtil::getRequestDecodeParam($this->request, "firstJJEndTime");
  1119. $obj["process"] = intval(\StrUtil::getRequestDecodeParam($this->request, "process"));
  1120. $obj["type"] = $this->user["type"];
  1121. $where = [];
  1122. $where[] = ["ta.delete", "=", 0];
  1123. $where[] = ["ta.type", "=", $this->user["type"]];
  1124. $this->setTalentAllowanceInfoForExport($where, $obj, $obj["process"]);
  1125. switch ($obj["process"]) {
  1126. case 1:
  1127. $where[] = ["ta.checkState", "in", [1, 5, 10, 13, 15, 20, 25, 30]];
  1128. break;
  1129. case 2:
  1130. $where[] = ["ta.firstPassTime", "EXP", Db::raw("is not null")];
  1131. break;
  1132. case 3:
  1133. $where[] = ["ta.visitPassTime", "EXP", Db::raw("is not null")];
  1134. break;
  1135. case 4:
  1136. if ($obj["publicState"]) {
  1137. $where[] = ["publicState", "=", $param["publicState"]];
  1138. }
  1139. $where[] = ["ta.checkState", "in", [-1, 30]];
  1140. break;
  1141. }
  1142. $projects = [
  1143. AllowanceProjectEnum::PROJECT_TAX,
  1144. AllowanceProjectEnum::PROJECT_WAGES,
  1145. AllowanceProjectEnum::PROJECT_ATTENDANCE,
  1146. AllowanceProjectEnum::PROJECT_SB_PENSION,
  1147. AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
  1148. AllowanceProjectEnum::PROJECT_SB_MEDICA,
  1149. ];
  1150. $months = [];
  1151. for ($m = 1; $m <= 12; $m++) {
  1152. $months[] = $m . "月";
  1153. }
  1154. $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]], ["兑现金额", [1, 2]], ["金额说明", [1, 2]], ["审核状态", [1, 2]], ["缴纳单位", [1, 2]]];
  1155. $infoCols = count($columns);
  1156. for ($i = 0; $i < count($projects); $i++) {
  1157. $columns[] = [AllowanceProjectEnum::getProjectName($projects[$i]), $months];
  1158. }
  1159. $list = \app\common\model\TalentAllowanceProject::alias("pro")
  1160. ->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.recommendAllowanceType,ta.recommendMonths,ta.recommendMoney,ta.recommendMoneyDesc,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")
  1161. ->leftJoin("un_talent_allowance_info ta", "ta.id=pro.mainId")
  1162. ->leftJoin("un_talent_allowancecontract_detail con", "pro.baseId=con.id")
  1163. ->where($where)
  1164. ->order("ta.year desc,ta.createTime desc,pro.project asc")
  1165. ->select()->toArray();
  1166. $tmpList = [];
  1167. $levelMap = DictApi::selectByParentCode("talent_arrange");
  1168. $streetMap = DictApi::selectByParentCode("street");
  1169. $where = [];
  1170. $where[] = ["id", "in", array_column($list, "identifyCondition")];
  1171. $icmap = \app\common\model\TalentCondition::where($where)->column("name", "id");
  1172. $where = [];
  1173. $where[] = ["id", "in", array_column($list, "enterpriseId")];
  1174. $enterpriseMap = \app\common\model\Enterprise::where($where)->column("name", "id");
  1175. foreach ($list as $item) {
  1176. //组装数据
  1177. if (!$tmpList[$item["id"]]) {
  1178. $tmpList[$item["id"]]["curEnterpriseId"] = $item["curEnterpriseId"];
  1179. $tmpList[$item["id"]]["info"] = [$item["year"], $streetMap[$item["address"]], $item["name"], $item["sex"] == 1 ? "男" : "女", $item["idCard"], $levelMap[$item["talentArrange"]],
  1180. $icmap[$item["identifyCondition"]], $item["identifyGetTime"], $item["identifyConditionName"], $item["identifyMonth"], AllowanceTypeEnum::getTypeName($item["recommendAllowanceType"]), $item["recommendMonths"], $item["recommendMoney"],
  1181. $item["recommendMoneyDesc"], AllowanceTypeEnum::getTypeName($item["allowanceType"]), $item["months"], $item["money"],
  1182. $item["moneyDesc"], $this->getCheckStateName($item["checkState"], $item["publicState"], $item["allowanceType"])];
  1183. }
  1184. if (!$tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]) {
  1185. $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]] = [
  1186. "startTime" => $item["startTime"],
  1187. "endTime" => $item["endTime"],
  1188. "entryTime" => $item["entryTime"],
  1189. "isQuit" => $item["isQuit"]
  1190. ];
  1191. }
  1192. $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]["projects"][$item["project"]] = $item["pre_months"];
  1193. }
  1194. $rows = [];
  1195. $colorset = [];
  1196. foreach ($tmpList as $id => $item) {
  1197. foreach ($item["enterprise"] as $enterpriseId => $enterprise) {
  1198. $row = $item["info"];
  1199. $row[] = $this->user["uid"] == $enterpriseId ? "本单位" : $enterpriseMap[$enterpriseId];
  1200. for ($i = 0; $i < count($projects); $i++) {
  1201. if (strpos($enterprise["projects"][$projects[$i]], "=") === false) {
  1202. $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
  1203. for ($m = 1; $m <= 12; $m++) {
  1204. $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
  1205. if (in_array($_month, $months)) {
  1206. $row[] = "✔";
  1207. $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
  1208. } else {
  1209. $row[] = "";
  1210. }
  1211. }
  1212. } else {
  1213. $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
  1214. $_months = [];
  1215. foreach ($months as $month) {
  1216. $kv = explode("=", $month);
  1217. $_months[$kv[0]] = $kv[1];
  1218. }
  1219. for ($m = 1; $m <= 12; $m++) {
  1220. $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
  1221. $days = $_months[$_month];
  1222. if ($days && $days > 0) {
  1223. $row[] = $days . "天";
  1224. $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
  1225. } else {
  1226. $row[] = "";
  1227. }
  1228. }
  1229. }
  1230. }
  1231. $rows[] = $row;
  1232. }
  1233. }
  1234. $cols = $infoCols + count($projects) * 12 - 1;
  1235. $settings = [
  1236. "width" => [["A", 8], ["C", 12], ["D", 6], ["E", 20], ["F", 12], ["G", 70], ["H", 12], ["I", 15], ["J", 12], ["K", 12], ["P", 30]],
  1237. "height" => [18],
  1238. "freeze" => "D3",
  1239. "color" => $colorset
  1240. ];
  1241. for ($i = 0; $i < count($projects) * 12; $i++) {
  1242. $settings["width"][] = [getExcelColumnByIndex($infoCols + $i), 6]; //批设置项目的宽度
  1243. }
  1244. $settings["background-color"][] = [sprintf("%s2:%s2", getExcelColumnByIndex($infoCols), getExcelColumnByIndex($cols)), "E1F1DE"];
  1245. export($columns, $rows, "津补贴申报名单", $settings);
  1246. }
  1247. /**
  1248. * 校验是否在审核范围内
  1249. */
  1250. public function validateIsCheck() {
  1251. $id = $this->request["id"];
  1252. $type = $this->request["type"];
  1253. $process = $this->request["process"];
  1254. $info = null;
  1255. switch ($type) {
  1256. case 1: //编辑合同
  1257. $detail = \app\common\model\TalentAllowancecontractDetail::find($id);
  1258. $info = TalentAllowanceApi::getInfoById($detail["mainId"]);
  1259. break;
  1260. case 2: //编辑项目
  1261. $project = \app\common\model\TalentAllowanceProject::find($id);
  1262. $info = TalentAllowanceApi::getInfoById($project["mainId"]);
  1263. break;
  1264. case 3:
  1265. $info = TalentAllowanceApi::getInfoById($id);
  1266. break;
  1267. }
  1268. if (!$info) {
  1269. return new Response(Response::ERROR, "校验不通过,无法操作");
  1270. }
  1271. $where = [];
  1272. $where[] = ["mainId", "=", $info["id"]];
  1273. $where[] = ["step", "=", $process];
  1274. $where[] = ["active", "=", 2];
  1275. $log = null;
  1276. switch ($process) {
  1277. case 1:
  1278. if ($info["checkState"] != AllowanceStateEnum::NEED_CHECK && $info["checkState"] != AllowanceStateEnum::REJECT_TO_FIRST) {
  1279. return new Response(Response::ERROR, "不在审核范围内");
  1280. }
  1281. //$where[] = ["companyId","=",$this->user["companyId"]];
  1282. $log = TalentChecklog::where($where)->order("createTime desc")->find();
  1283. break;
  1284. case 2:
  1285. if ($info["checkState"] != AllowanceStateEnum::NEED_VISIT_CHECK && $info["checkState"] != AllowanceStateEnum::REVIEW_REJECT) {
  1286. return new Response(Response::ERROR, "不在审核范围内");
  1287. }
  1288. break;
  1289. case 3:
  1290. if ($info["checkState"] != AllowanceStateEnum::NEED_REVIEW && $info["checkState"] != AllowanceStateEnum::PUBLIC_REJECT) {
  1291. return new Response(Response::ERROR, "不在审核范围内");
  1292. }
  1293. $log = TalentChecklog::where($where)->order("createTime desc")->find();
  1294. break;
  1295. }
  1296. if ($log != null) {
  1297. $info["checkState"] = $log["state"];
  1298. $info["checkMsg"] = $log["description"];
  1299. } else {
  1300. $info["checkState"] = null;
  1301. $info["checkMsg"] = "";
  1302. }
  1303. $res = [];
  1304. $res["info"] = $info;
  1305. if ($type == 3) {
  1306. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  1307. $where = [];
  1308. $where[] = ["mainId", "=", $id];
  1309. $where[] = ["isLock", "=", 1];
  1310. $projectList = \app\common\model\TalentAllowanceProject::where($where)->select()->toArray();
  1311. $detailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $id)->select()->toArray();
  1312. $detailMap = array_reduce($detailList, function ($result, $item) {
  1313. $key = $item["id"];
  1314. $result[$key] = $item;
  1315. return $result;
  1316. }, []);
  1317. foreach ($detailList as &$detail) {
  1318. $detail["enterpriseName"] = sprintf("%s(%s至%s)", $enterpriseMap[$detail["enterpriseId"]], $detail["startTime"], $detail["endTime"]);
  1319. }unset($detail);
  1320. foreach ($projectList as &$project) {
  1321. $detail = $detailMap[$project["baseId"]];
  1322. $project["projectName"] = sprintf("%s(%s(%s至%s))", AllowanceProjectEnum::getProjectName($project["project"]), $enterpriseMap[$project["enterpriseId"]], $detail["startTime"], $detail["endTime"]);
  1323. }
  1324. $where = [];
  1325. $where[] = ["type", "=", $info["type"]];
  1326. $where[] = ["project", "=", \app\common\state\ProjectState::JBT];
  1327. $where[] = ["active", "=", 1];
  1328. $where[] = ["isConditionFile", "=", $info["allowanceType"]];
  1329. $where[] = ["delete", "=", 0];
  1330. $filetypes = Db::table("new_common_filetype")->where($where)->order("sn asc")->select()->toArray();
  1331. $res["files"] = $filetypes;
  1332. $res["projects"] = $projectList;
  1333. $res["concats"] = $detailList;
  1334. }
  1335. return new Response(Response::SUCCESS, "不在审核范围内", $res);
  1336. }
  1337. /**
  1338. * 初始化可修改的项目/附件/合同
  1339. * */
  1340. public function findFieldsAndFiles() {
  1341. $id = $this->request["id"];
  1342. if (\StrUtil::isEmpOrNull($id)) {
  1343. return new Response(Response::ERROR, "请选择需要修改的对象");
  1344. }
  1345. $info = TalentAllowanceApi::getInfoById($id);
  1346. if (!$info) {
  1347. return new Response(Response::ERROR, "系统错误,请联系管理员");
  1348. }
  1349. if ($info["checkState"] != AllowanceStateEnum::FIRST_REJECT) {
  1350. return new Response(Response::ERROR, "只能修改初审驳回的数据");
  1351. }
  1352. $res = [];
  1353. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  1354. $where = [];
  1355. $where[] = ["mainId", "=", $id];
  1356. $where[] = ["isLock", "=", 1];
  1357. $projectList = \app\common\model\TalentAllowanceProject::where($where)->select()->toArray();
  1358. $detailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $id)->select()->toArray();
  1359. foreach ($detailList as &$detail) {
  1360. $detail["enterpriseName"] = $enterpriseMap[$detail["enterpriseId"]];
  1361. }unset($detail);
  1362. foreach ($projectList as &$project) {
  1363. $detail = $detailMap[$project["baseId"]];
  1364. $project["projectName"] = sprintf("%s(%s)", AllowanceProjectEnum::getProjectName($project["project"]), $enterpriseMap[$project["enterpriseId"]]);
  1365. }unset($project);
  1366. $where = [];
  1367. $where[] = ["type", "=", $info["type"]];
  1368. $where[] = ["project", "=", \app\common\state\ProjectState::JBT];
  1369. $where[] = ["active", "=", 1];
  1370. $where[] = ["isConditionFile", "=", $info["allowanceType"]];
  1371. $where[] = ["delete", "=", 0];
  1372. $filetypes = Db::table("new_common_filetype")->where($where)->order("sn asc")->select()->toArray();
  1373. $res["files"] = $filetypes;
  1374. $res["projects"] = $projectList;
  1375. $res["concats"] = $detailList;
  1376. $res["info"] = $info;
  1377. return new Response(Response::SUCCESS, "", $res);
  1378. }
  1379. /**
  1380. * 修改驳回项目/附件/合同
  1381. * */
  1382. public function updateFieldsAndFiles() {
  1383. $data = $this->request->param();
  1384. if (!$data["id"]) {
  1385. return new Response(Response::ERROR, "系统错误,请联系管理员");
  1386. }
  1387. TaModel::update($data);
  1388. return new Response(Response::SUCCESS, "修改成功");
  1389. }
  1390. private function setCondition(&$where, &$query) {
  1391. if (\StrUtil::isNotEmpAndNull($query["year"])) {
  1392. $where[] = ["year", "=", $query["year"]];
  1393. }
  1394. if (\StrUtil::isNotEmpAndNull($query["name"])) {
  1395. $where[] = ["name", "like", "%" . $query["name"] . "%"];
  1396. }
  1397. if (\StrUtil::isNotEmpAndNull($query["idCard"])) {
  1398. $where[] = ["idCard", "like", "%" . $query["idCard"] . "%"];
  1399. }
  1400. if (\StrUtil::isNotEmpAndNull($query["talentArrange"])) {
  1401. $where[] = ["talentArrange", "=", $query["talentArrange"]];
  1402. }
  1403. if (\StrUtil::isNotEmpAndNull($query["spouseName"])) {
  1404. $where[] = ["spouseName", "like", "%" . $query["spouseName"] . "%"];
  1405. }
  1406. if (\StrUtil::isNotEmpAndNull($query["spouseIdcard"])) {
  1407. $where[] = ["spouseIdcard", "like", "%" . $query["spouseIdcard"] . "%"];
  1408. }
  1409. if (\StrUtil::isNotEmpAndNull($query["childName"])) {
  1410. $where[] = ["childName", "like", "%" . $query["childName"] . "%"];
  1411. }
  1412. if (\StrUtil::isNotEmpAndNull($query["childIdCard"])) {
  1413. $where[] = ["childIdCard", "like", "%" . $query["childIdCard"] . "%"];
  1414. }
  1415. if (\StrUtil::isNotEmpAndNull($query["marryStatus"])) {
  1416. $where[] = ["marryStatus", "=", $query["marryStatus"]];
  1417. }
  1418. if ($query["isConflict"]) {
  1419. $where[] = ["isConflict", "=", $query["isConflict"]];
  1420. }
  1421. if ($query["isRecover"]) {
  1422. $where[] = ["isRecover", "=", $query["isRecover"]];
  1423. }
  1424. if ($query["checkState"]) {
  1425. switch ($query["checkState"]) {
  1426. case -1:
  1427. $where[] = ["checkState", "=", HouseStateEnum::NOTPASS];
  1428. break;
  1429. case 1:
  1430. $where[] = ["checkState", "=", HouseStateEnum::SAVE];
  1431. break;
  1432. case 2:
  1433. switch ($query["process"]) {
  1434. case 1:
  1435. $where[] = ["checkState", "=", HouseStateEnum::NEED_CHECK];
  1436. $where[] = ["highProcess", "<", $query["process"]];
  1437. break;
  1438. case 2:
  1439. $query["state"] = 1;
  1440. break;
  1441. case 3:
  1442. $where[] = ["checkState", "=", HouseStateEnum::NEED_REVIEW_CHECK];
  1443. $where[] = ["highProcess", "<", $query["process"]];
  1444. break;
  1445. }
  1446. break;
  1447. case 3:
  1448. switch ($query["process"]) {
  1449. case 1:
  1450. $where[] = ["checkState", "=", HouseStateEnum::FIRST_REJECT];
  1451. break;
  1452. case 2:
  1453. $query["state"] = 2;
  1454. break;
  1455. case 3:
  1456. $where[] = ["checkState", "<=", HouseStateEnum::REJECT_TO_DEP];
  1457. break;
  1458. }
  1459. break;
  1460. case 4:
  1461. switch ($query["process"]) {
  1462. case 1:
  1463. $where[] = ["checkState", "in", [HouseStateEnum::NEED_DEP_CHECK, HouseStateEnum::REJECT_TO_DEP, HouseStateEnum::NEED_REVIEW_CHECK, HouseStateEnum::REVIEW_PASS]];
  1464. break;
  1465. case 2:
  1466. $query["state"] = 3;
  1467. break;
  1468. case 3:
  1469. case 4:
  1470. $where[] = ["checkState", "=", HouseStateEnum::REVIEW_PASS];
  1471. break;
  1472. }
  1473. break;
  1474. case 5:
  1475. switch ($query["process"]) {
  1476. case 1:
  1477. $where[] = ["checkState", "in", [HouseStateEnum::REJECT_TO_FIRST, HouseStateEnum::DEP_REJECT]];
  1478. break;
  1479. case 2:
  1480. $query["state"] = 4;
  1481. break;
  1482. case 3:
  1483. $where[] = ["checkState", "=", HouseStateEnum::REJECT_TO_REVIEW];
  1484. break;
  1485. }
  1486. break;
  1487. case 6:
  1488. switch ($query["process"]) {
  1489. case 1:
  1490. $where[] = ["checkState", "=", HouseStateEnum::NEED_CHECK];
  1491. $where[] = ["highProcess", ">=", $query["process"]];
  1492. break;
  1493. case 2:
  1494. $query["state"] = 9;
  1495. break;
  1496. case 3:
  1497. $where[] = ["checkState", "=", HouseStateEnum::NEED_REVIEW_CHECK];
  1498. $where[] = ["highProcess", ">=", $query["process"]];
  1499. break;
  1500. }
  1501. break;
  1502. }
  1503. }
  1504. }
  1505. private function translateToChinese(&$obj) {
  1506. if (\StrUtil::isNotEmpAndNull($obj["address"])) {
  1507. $obj["addressName"] = DictApi::findByParentCodeAndCode("street", $obj["address"])["name"];
  1508. }
  1509. if (\StrUtil::isNotEmpAndNull($obj["talentType"])) {
  1510. $obj["talentTypeName"] = DictApi::findByParentCodeAndCode("enterprise_tag", $obj["talentType"])["name"];
  1511. }
  1512. if (\StrUtil::isNotEmpAndNull($obj["talentArrange"])) {
  1513. $obj["talentArrangeName"] = DictApi::findByParentCodeAndCode("talent_arrange", $obj["talentArrange"])["name"];
  1514. }
  1515. if (\StrUtil::isNotEmpAndNull($obj["identifyCondition"])) {
  1516. $obj["identifyConditionText"] = \app\common\api\TalentConditionApi::getOne($obj["identifyCondition"])["name"];
  1517. }
  1518. if (\StrUtil::isNotEmpAndNull($obj["introductionMode"])) {
  1519. $obj["introductionModeName"] = DictApi::findByParentCodeAndCode("import_way", $obj["introductionMode"])["name"];
  1520. }
  1521. }
  1522. private function translateChinese($list, $process) {
  1523. //获取字典表
  1524. $marryMap = DictApi::selectByParentCode("marry_status");
  1525. $cardTypeMap = DictApi::selectByParentCode("card_type");
  1526. $streetMap = DictApi::selectByParentCode("street");
  1527. $levelMap = DictApi::selectByParentCode("talent_arrange");
  1528. $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
  1529. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  1530. $where = [];
  1531. $where[] = ["type", "=", $this->user["type"]];
  1532. $conditionMap = \app\common\model\TalentCondition::where($where)->column("name", "id");
  1533. $where = [];
  1534. $where[] = ["pId", "in", array_column($list, "id")];
  1535. $childrens = \app\common\model\HousePurchaseChildren::where($where)->select()->toArray();
  1536. $childMap = [];
  1537. foreach ($childrens as $child) {
  1538. $childMap[$child["pId"]][] = $child;
  1539. }
  1540. foreach ($list as &$info) {
  1541. $info["marryStatusName"] = $marryMap[$info["marryStatus"]];
  1542. $info["cardTypeName"] = $cardTypeMap[$info["cardType"]];
  1543. $info["spouseCardTypeName"] = $cardTypeMap[$info["spouseCardType"]];
  1544. $info["childCardTypeName"] = $cardTypeMap[$info["childCardType"]];
  1545. $info["streetName"] = $streetMap[$info["street"]];
  1546. $info["talentArrangeName"] = $levelMap[$info["talentArrange"]];
  1547. $info["identifyConditionCH"] = $conditionMap[$info["identifyCondition"]];
  1548. $info["talentTypeName"] = $talentTypeMap[$info["talentType"]];
  1549. $info["declareTypeName"] = $info["declareType"] == 1 ? "购房补贴" : "免租入住";
  1550. $info["enterpriseName"] = $enterpriseMap[$info["enterpriseId"]];
  1551. $info["isEnjoyOtherName"] = $info["isEnjoyOther"] == 1 ? "是" : "否";
  1552. $info["spouseIsLibraryName"] = $info["spouseIsLibrary"] == 1 ? "是" : "否";
  1553. $childs = $childMap[$info["id"]];
  1554. $childStr = "";
  1555. if ($childs) {
  1556. for ($i = 0; $i < count($childs); $i++) {
  1557. $childStr .= $childs[$i]["name"] . "-" . $childs[$i]["idCard"] . ";";
  1558. }
  1559. }
  1560. $info["childs"] = $childStr;
  1561. switch ($process) {
  1562. case 1:
  1563. if ($info["checkState"] == HouseStateEnum::NOTPASS) {
  1564. $info["checkStateName"] = "审核不通过";
  1565. }
  1566. if ($info["checkState"] == HouseStateEnum::SAVE) {
  1567. $info["checkStateName"] = "待提交";
  1568. }
  1569. if ($info["checkState"] == HouseStateEnum::NEED_CHECK) {
  1570. $info["checkStateName"] = $info["highProcess"] != null && $info["highProcess"] >= $process ? "重新提交" : "待审核";
  1571. }
  1572. if ($info["checkState"] == HouseStateEnum::FIRST_REJECT) {
  1573. $info["checkStateName"] = "已驳回";
  1574. }
  1575. if ($info["checkState"] == HouseStateEnum::REJECT_TO_FIRST || $info["checkState"] == HouseStateEnum::DEP_REJECT) {
  1576. $info["checkStateName"] = "上级驳回";
  1577. }
  1578. if ($info["checkState"] == HouseStateEnum::NEED_DEP_CHECK || $info["checkState"] >= HouseStateEnum::REJECT_TO_DEP) {
  1579. $info["checkStateName"] = "已通过";
  1580. }
  1581. break;
  1582. case 2:
  1583. if ($info["state"] == 1) {
  1584. $info["checkStateName"] = "待审核";
  1585. }
  1586. if ($info["state"] == 2) {
  1587. $info["checkStateName"] = "已驳回";
  1588. }
  1589. if ($info["state"] == 3) {
  1590. $info["checkStateName"] = "已通过";
  1591. }
  1592. if ($info["state"] == 4) {
  1593. $info["checkStateName"] = "上级驳回";
  1594. }
  1595. if ($info["state"] == 9) {
  1596. $info["checkStateName"] = "重新提交";
  1597. }
  1598. break;
  1599. case 3:
  1600. if ($info["checkState"] <= HouseStateEnum::REJECT_TO_DEP) {
  1601. $info["checkStateName"] = "已驳回";
  1602. } else if ($info["checkState"] == HouseStateEnum::NEED_REVIEW_CHECK) {
  1603. $info["checkStateName"] = $info["highProcess"] != null && $info["highProcess"] >= $process ? "重新提交" : "待审核";
  1604. } else if ($info["checkState"] == HouseStateEnum::REVIEW_PASS) {
  1605. $info["checkStateName"] = "已通过";
  1606. }
  1607. break;
  1608. case 4:
  1609. if ($info["checkState"] == HouseStateEnum::NOTPASS) {
  1610. $info["checkStateName"] = "审核不通过";
  1611. } else if ($info["checkState"] == HouseStateEnum::REVIEW_PASS) {
  1612. $info["checkStateName"] = "已通过";
  1613. }
  1614. break;
  1615. }
  1616. }unset($info);
  1617. return $list;
  1618. }
  1619. private function getCheckStateName($checkState, $publicState, $allowanceType) {
  1620. switch ($checkState) {
  1621. case 1:
  1622. return "待提交";
  1623. case 5:
  1624. case 13:
  1625. case 15:
  1626. case 20:
  1627. case 25:
  1628. case 35:
  1629. return "审核中";
  1630. case 10:
  1631. return "已驳回";
  1632. case - 1:
  1633. if ($publicState >= 3) {
  1634. return "审核不通过";
  1635. } else {
  1636. return "审核中";
  1637. }
  1638. break;
  1639. case 30:
  1640. if ($publicState == 1) {
  1641. return "待核查征信";
  1642. } else if ($publicState == 2) {
  1643. return "待公示";
  1644. } else if ($publicState == 3) {
  1645. return "公示中";
  1646. } else if ($publicState == 4) {
  1647. return $allowanceType != 3 ? "待兑现" : "不予兑现";
  1648. } else if ($publicState == 5) {
  1649. return "已兑现";
  1650. }
  1651. default:
  1652. return "未知状态";
  1653. }
  1654. }
  1655. }