House.php 113 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355
  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\TalentLogApi;
  8. use app\common\model\TalentChecklog;
  9. use app\common\state\ProjectState;
  10. use app\common\state\CommonConst;
  11. use app\common\state\HouseStateEnum;
  12. use app\common\model\HousePurchase as houseModel;
  13. use app\common\api\HouseApi;
  14. use app\common\model\HousePurchaseHouseInfo as houseInfoModel;
  15. /**
  16. * Description of House
  17. *
  18. * @author sgq
  19. */
  20. class House extends AdminController {
  21. public function index() {
  22. $process = $this->request["process"];
  23. $type = $this->user["type"];
  24. $assigns = ["process" => $process, "type" => $type];
  25. if ($process == 4) {
  26. if ($type == CommonConst::ENTERPRISE_NORMAL) {
  27. $msgBody["typeName"] = "晋江市现代产业体系人才津补贴申报";
  28. $msgBody["address"] = "聚才网/人才晋江微信公众号";
  29. $msgBody["dep"] = "中共晋江市委人才办、晋江市纪委监委驻市人力资源和社会保障局纪检监察组或晋江市公共就业和人才服务中心";
  30. $msgBody["phone"] = "0595-85633128";
  31. $msgBody["email"] = "jjrc85661234@163.com";
  32. }
  33. if ($type == CommonConst::ENTERPRISE_JC) {
  34. $msgBody["typeName"] = "晋江市集成电路产业优秀人才津补贴申报";
  35. $msgBody["address"] = "福建(晋江)集成电路产业园官方网站及微信公众号";
  36. $msgBody["dep"] = "集成电路产业园区";
  37. $msgBody["phone"] = "0595-82250007、0595-82250001";
  38. $msgBody["email"] = "jjjcdr@163.com";
  39. }
  40. if ($type == CommonConst::ENTERPRISE_WJ) {
  41. $msgBody["typeName"] = "晋江市医疗卫生人才津补贴申报";
  42. $msgBody["address"] = "“健康晋江”微信公众号";
  43. $msgBody["dep"] = "晋江市卫生健康局";
  44. $msgBody["phone"] = "0595-85636159";
  45. $msgBody["email"] = "jjswjjrsk@163.com";
  46. }
  47. if ($type == CommonConst::ENTERPRISE_GJ) {
  48. $msgBody["typeName"] = "晋江市高等教育人才津补贴申报";
  49. $msgBody["address"] = "“泉州市高教发展中心”微信公众号";
  50. $msgBody["dep"] = "泉州市高教发展中心";
  51. $msgBody["phone"] = "0595-85002588";
  52. $msgBody["email"] = "jjsgjrc@126.com";
  53. }
  54. $assigns["message"] = $msgBody;
  55. }
  56. return view("", $assigns);
  57. }
  58. /**
  59. * 获取优秀人才津补贴列表
  60. */
  61. public function list($process) {
  62. $param = $this->request->param();
  63. $offset = $param["offset"] ?: 0;
  64. $limit = $param["limit"] ?: 10;
  65. $param["process"] = $process;
  66. $param["type"] = $this->user["type"];
  67. $where = [];
  68. $where[] = ["type", "=", $this->user["type"]];
  69. $where[] = ["delete", "=", 0];
  70. $order = "createTime desc";
  71. $this->setCondition($where, $param);
  72. switch ($process) {
  73. case 1:
  74. break;
  75. case 2:
  76. break;
  77. case 3:
  78. $where[] = ["depPassTime", "EXP", Db::raw("is not null")];
  79. break;
  80. case 4:
  81. $where[] = ["checkState", "in", [HouseStateEnum::NOTPASS, HouseStateEnum::REVIEW_PASS]];
  82. $where[] = ["reviewPassTime", "EXP", Db::raw("is not null")];
  83. break;
  84. }
  85. if (in_array($process, [1, 3, 4])) {
  86. $count = houseModel::where($where)->count();
  87. $list = houseModel::where($where)->limit($offset, $limit)->order($order)->select()->toArray();
  88. } else {
  89. $company = getCacheById("Company", $this->user["companyId"]);
  90. $result = HouseApi::selectForHousePurchase($param, $company, ProjectState::HOUSE, $offset, $limit);
  91. $count = $result["total"];
  92. $list = $result["rows"];
  93. }
  94. $list = $this->translateChinese($list, $process);
  95. return json(["rows" => $list, "total" => $count]);
  96. }
  97. /**
  98. * 审核页面
  99. * @return type
  100. */
  101. public function toCheckPage() {
  102. $id = $this->request["id"];
  103. $process = $this->request["process"];
  104. $companyId = $this->request["companyId"];
  105. $hand = $this->request["hand"];
  106. $housepurchase = HouseApi::getInfoById($id);
  107. $company = getCacheById("Company", $this->user["companyId"]);
  108. $enterprise = \app\common\api\EnterpriseApi::getOne($housepurchase["enterpriseId"]);
  109. $housepurchase["enterpriseName"] = $enterprise["name"];
  110. $housepurchase["process"] = $process;
  111. $housepurchase["companyId"] = $companyId;
  112. $housepurchase["talentArrangeName"] = DictApi::findByParentCodeAndCode("talent_arrange", $housepurchase["talentArrange"])["name"];
  113. $housepurchase["marryStatusName"] = DictApi::findByParentCodeAndCode("marry_status", $housepurchase["marryStatus"])["name"];
  114. $housepurchase["cardTypeName"] = DictApi::findByParentCodeAndCode("card_type", $housepurchase["cardType"])["name"];
  115. if (\StrUtil::isNotEmpAndNull($housepurchase["spouseCardType"])) {
  116. $housepurchase["spouseCardTypeName"] = DictApi::findByParentCodeAndCode("card_type", $housepurchase["spouseCardType"])["name"];
  117. }
  118. if (\StrUtil::isNotEmpAndNull($housepurchase["childCardType"])) {
  119. $housepurchase["childCardTypeName"] = DictApi::findByParentCodeAndCode("card_type", $housepurchase["childCardType"])["name"];
  120. }
  121. $housepurchase["streetName"] = DictApi::findByParentCodeAndCode("street", $housepurchase["street"])["name"];
  122. if ($housepurchase["type"] == 1) {
  123. $housepurchase["talentTypeName"] = DictApi::findByParentCodeAndCode("enterprise_tag", $housepurchase["talentType"])["name"];
  124. }
  125. $housepurchase["identifyConditionCH"] = \app\common\api\TalentConditionApi::getOne($housepurchase["identifyCondition"])["name"];
  126. /* * 历史申报享受其他政策数据* */
  127. $historyOtherList = HouseApi::getHistoryEnjoyOtherList($id, $housepurchase["idCard"], $housepurchase["spouseIdcard"]);
  128. /* * 当前申报录入的享受其他政策数据 */
  129. $nowOtherList = HouseApi::getEnjoyOtherList($id);
  130. /* * 其他房产信息 */
  131. $zzjOtherHouseList = HouseApi::getOtherHouseList($id, 1);
  132. $zrzyOtherHouseList = HouseApi::getOtherHouseList($id, 2);
  133. /* * 未成年子女信息 */
  134. $childrenList = HouseApi::getChildren($id);
  135. /* * 配偶信息 */
  136. $spouseList = HouseApi::getSpouse($id);
  137. $dicts = DictApi::findChildDictByCode("card_type");
  138. $vars = [
  139. "dicts" => $dicts,
  140. "row" => $housepurchase,
  141. "company" => $company,
  142. "historyOtherList" => $historyOtherList,
  143. "nowOtherList" => $nowOtherList,
  144. "zzjOtherHouseList" => $zzjOtherHouseList,
  145. "zrzyOtherHouseList" => $zrzyOtherHouseList,
  146. "childrenList" => $childrenList,
  147. "spouseList" => $spouseList
  148. ];
  149. $template = $hand == 1 ? "info" : "select";
  150. return view($template, $vars);
  151. }
  152. /**
  153. * 审核保存
  154. */
  155. public function check() {
  156. $id = $this->request["id"];
  157. $process = $this->request["process"];
  158. $toProcess = $this->request["toProcess"];
  159. $toDep = $this->request["toDep"];
  160. $checkState = $this->request["checkState"];
  161. $checkMsg = $this->request["checkMsg"];
  162. $cashType = $this->request["cashType"];
  163. $fields = $this->request["fields"];
  164. $files = $this->request["files"];
  165. if (!$checkState) {
  166. return new Response(Response::ERROR, "请选择审核状态");
  167. }
  168. if ($process == 1) {
  169. $old = HouseApi::getInfoById($id);
  170. $old["fields"] = $fields;
  171. $old["files"] = $files;
  172. houseModel::update($old);
  173. }
  174. if ($process == 3) {
  175. $data["id"] = $id;
  176. if ($checkState == 2) {
  177. if ($toProcess == 2) {
  178. $depCodes = getJsonConfig("../sys_config.json", "housepurchase_dep_list")[$old["type"]];
  179. if (!$depCodes || count($depCodes) == 0) {
  180. return new Response(Response::ERROR, "没有配置部门审核,不能选择驳回至部门审核");
  181. }
  182. $where = [];
  183. $where[] = ["code", "in", $toDep];
  184. $companyIds = \app\common\model\Company::where($where)->column("id");
  185. $data["toDep"] = implode(",", $companyIds);
  186. }
  187. $data["toProcess"] = $toProcess;
  188. }
  189. if ($checkState == 3) {
  190. $data["cashType"] = $cashType;
  191. }
  192. houseModel::update($data);
  193. }
  194. //添加日志
  195. TalentChecklog::create([
  196. 'id' => getStringId(),
  197. 'mainId' => $id,
  198. 'type' => intval(ProjectState::HOUSE),
  199. 'typeFileId' => null,
  200. 'active' => 2,
  201. 'state' => $checkState,
  202. 'step' => $process,
  203. 'stateChange' => "保存未提交",
  204. 'description' => $checkMsg,
  205. 'createTime' => date("Y-m-d H:i:s", time()),
  206. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  207. ]);
  208. return new Response(Response::SUCCESS, "审核成功");
  209. }
  210. /**
  211. * @param obj
  212. * @description 住建局审核
  213. * */
  214. public function zjjCheck() {
  215. $obj = [
  216. "id" => \StrUtil::getRequestDecodeParam($this->request, "id"),
  217. "companyId" => \StrUtil::getRequestDecodeParam($this->request, "companyId"),
  218. "checkIsTradeRecord" => \StrUtil::getRequestDecodeParam($this->request, "checkIsTradeRecord"),
  219. "checkRecordTime" => \StrUtil::getRequestDecodeParam($this->request, "checkRecordTime"),
  220. "zjjCheckDetail" => \StrUtil::getRequestDecodeParam($this->request, "zjjCheckDetail"),
  221. "otherList" => $this->request["otherList"],
  222. "houseList" => $this->request["houseList"]
  223. ];
  224. if (!$obj) {
  225. return new Response(Response::ERROR, "请填写信息后保存");
  226. }
  227. $mzj = \app\common\model\Company::where("code", CommonConst::MZJ)->find();
  228. $where = [];
  229. $where[] = ["mainId", "=", $obj["id"]];
  230. $where[] = ["companyId", "=", $mzj["id"]];
  231. $depcheckstate = Db::table("un_talent_depcheckstate")->where($where)->find();
  232. if ($depcheckstate["state"] != 3) {
  233. return new Response(Response::ERROR, "请等待民政局录入婚姻信息后,根据婚姻信息查询!");
  234. }
  235. $where = [];
  236. $where[] = ["mainId", "=", $obj["id"]];
  237. $where[] = ["companyId", "=", $obj["companyId"]];
  238. $oldDep = Db::table("un_talent_depcheckstate")->where($where)->find();
  239. if ($oldDep["state"] != 1 && $oldDep["state"] != 4 && $oldDep["state"] != 9) {
  240. return new Response(Response::ERROR, "不在审核范围内!");
  241. }
  242. $old = HouseApi::getInfoById($obj["id"]);
  243. if ($old["declareType"] == 1) {
  244. if ($obj["checkIsTradeRecord"] == 1 && \StrUtil::isEmpOrNull($obj["checkRecordTime"])) {
  245. return new Response(Response::ERROR, "请填写交易备案时间");
  246. }
  247. } else {
  248. $obj["checkIsTradeRecord"] = null;
  249. $obj["checkRecordTime"] = "";
  250. }
  251. if ($obj["otherList"] && count($obj["otherList"]) > 0) {
  252. foreach ($obj["otherList"] as $other) {
  253. if ($other["id"]) {
  254. $other["updateTime"] = date("Y-m-d H:i:s");
  255. $other["updateUser"] = $this->user["name"];
  256. \app\common\model\HousePurchaseEnjoyOther::update($other);
  257. } else {
  258. $other["id"] = getStringId();
  259. $other["pId"] = $obj["id"];
  260. $other["createTime"] = date("Y-m-d H:i:s");
  261. $other["createUser"] = $this->user["name"];
  262. \app\common\model\HousePurchaseEnjoyOther::insert($other);
  263. }
  264. }
  265. }
  266. if ($obj["houseList"] && count($obj["houseList"]) > 0) {
  267. foreach ($obj["houseList"] as $house) {
  268. if ($house["id"]) {
  269. $house["updateTime"] = date("Y-m-d H:i:s");
  270. $house["updateUser"] = $this->user["name"];
  271. \app\common\model\HousePurchaseOtherHouse::update($house);
  272. } else {
  273. $house["id"] = getStringId();
  274. $house["pId"] = $obj["id"];
  275. $house["createTime"] = date("Y-m-d H:i:s");
  276. $house["createUser"] = $this->user["name"];
  277. \app\common\model\HousePurchaseOtherHouse::insert($house);
  278. }
  279. }
  280. }
  281. houseModel::update($obj);
  282. TalentChecklog::create([
  283. 'id' => getStringId(),
  284. "companyId" => $obj["companyId"],
  285. 'mainId' => $obj["id"],
  286. 'type' => intval(ProjectState::HOUSE),
  287. 'typeFileId' => null,
  288. 'active' => 2,
  289. 'state' => 3,
  290. 'step' => 2,
  291. 'stateChange' => "保存未提交",
  292. 'description' => $obj["zjjCheckDetail"] ? "录入核查数据:" . $obj["zjjCheckDetail"] : "录入核查数据:",
  293. 'createTime' => date("Y-m-d H:i:s", time()),
  294. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  295. ]);
  296. return new Response(Response::SUCCESS, "审核成功", $obj);
  297. }
  298. /**
  299. * @param obj
  300. * @description 自然资源局核查
  301. * */
  302. public function zrzyjCheck() {
  303. $obj = [
  304. "id" => \StrUtil::getRequestDecodeParam($this->request, "id"),
  305. "companyId" => \StrUtil::getRequestDecodeParam($this->request, "companyId"),
  306. "isHasBdcCard" => \StrUtil::getRequestDecodeParam($this->request, "isHasBdcCard"),
  307. "bdcRegistTime" => \StrUtil::getRequestDecodeParam($this->request, "bdcRegistTime"),
  308. "isOwner" => \StrUtil::getRequestDecodeParam($this->request, "isOwner"),
  309. "transferMethod" => \StrUtil::getRequestDecodeParam($this->request, "transferMethod"),
  310. "transferTime" => \StrUtil::getRequestDecodeParam($this->request, "transferTime"),
  311. "zrzzjCheckDetail" => \StrUtil::getRequestDecodeParam($this->request, "zrzzjCheckDetail"),
  312. "houseList" => $this->request["houseList"]
  313. ];
  314. if (!$obj) {
  315. return new Response(Response::ERROR, "请填写信息后保存");
  316. }
  317. $mzj = \app\common\model\Company::where("code", CommonConst::MZJ)->find();
  318. $where = [];
  319. $where[] = ["mainId", "=", $obj["id"]];
  320. $where[] = ["companyId", "=", $mzj["id"]];
  321. $depcheckstate = Db::table("un_talent_depcheckstate")->where($where)->find();
  322. if ($depcheckstate["state"] != 3) {
  323. return new Response(Response::ERROR, "请等待民政局录入婚姻信息后,根据婚姻信息查询!");
  324. }
  325. $where = [];
  326. $where[] = ["mainId", "=", $obj["id"]];
  327. $where[] = ["companyId", "=", $obj["companyId"]];
  328. $oldDep = Db::table("un_talent_depcheckstate")->where($where)->find();
  329. if ($oldDep["state"] != 1 && $oldDep["state"] != 4 && $oldDep["state"] != 9) {
  330. return new Response(Response::ERROR, "不在审核范围内!");
  331. }
  332. $old = HouseApi::getInfoById($obj["id"]);
  333. if ($old["declareType"] == 1) {
  334. if ($obj["isHasBdcCard"] == 1 && \StrUtil::isEmpOrNull($obj["bdcRegistTime"])) {
  335. return new Response(Response::ERROR, "请填写不动产权证书登记时间");
  336. }
  337. if (!$obj["isOwner"]) {
  338. return new Response(Response::ERROR, "请选择其购置的房屋是否还在名下");
  339. }
  340. if ($obj["isOwner"] == 2 && \StrUtil::isEmpOrNull($obj["transferMethod"])) {
  341. return new Response(Response::ERROR, "请填写过户方式");
  342. }
  343. if ($obj["isOwner"] == 2 && \StrUtil::isEmpOrNull($obj["transferTime"])) {
  344. return new Response(Response::ERROR, "请填写过户时间");
  345. }
  346. } else {
  347. $obj["isHasBdcCard"] = null;
  348. $obj["bdcRegistTime"] = "";
  349. $obj["isOwner"] = null;
  350. $obj["transferMethod"] = "";
  351. $obj["transferTime"] = "";
  352. }
  353. if ($obj["houseList"] && count($obj["houseList"]) > 0) {
  354. foreach ($obj["houseList"] as $house) {
  355. if ($house["id"]) {
  356. $house["updateTime"] = date("Y-m-d H:i:s");
  357. $house["updateUser"] = $this->user["name"];
  358. \app\common\model\HousePurchaseOtherHouse::update($house);
  359. } else {
  360. $house["id"] = getStringId();
  361. $house["pId"] = $obj["id"];
  362. $house["createTime"] = date("Y-m-d H:i:s");
  363. $house["createUser"] = $this->user["name"];
  364. \app\common\model\HousePurchaseOtherHouse::insert($house);
  365. }
  366. }
  367. }
  368. houseModel::update($obj);
  369. TalentChecklog::create([
  370. 'id' => getStringId(),
  371. "companyId" => $obj["companyId"],
  372. 'mainId' => $obj["id"],
  373. 'type' => intval(ProjectState::HOUSE),
  374. 'typeFileId' => null,
  375. 'active' => 2,
  376. 'state' => 3,
  377. 'step' => 2,
  378. 'stateChange' => "保存未提交",
  379. 'description' => $obj["zrzzjCheckDetail"] ? "录入核查数据:" . $obj["zrzzjCheckDetail"] : "录入核查数据",
  380. 'createTime' => date("Y-m-d H:i:s", time()),
  381. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  382. ]);
  383. return new Response(Response::SUCCESS, "审核成功", $obj);
  384. }
  385. /**
  386. * @param obj
  387. * @description 民政局核查
  388. * */
  389. public function mzjCheck() {
  390. $obj = [
  391. "id" => \StrUtil::getRequestDecodeParam($this->request, "id"),
  392. "companyId" => \StrUtil::getRequestDecodeParam($this->request, "companyId"),
  393. "mzjCheckDetail" => \StrUtil::getRequestDecodeParam($this->request, "mzjCheckDetail"),
  394. "spouseList" => $this->request["spouseList"]
  395. ];
  396. if (!$obj) {
  397. return new Response(Response::ERROR, "请填写信息后保存");
  398. }
  399. $where = [];
  400. $where[] = ["mainId", "=", $obj["id"]];
  401. $where[] = ["companyId", "=", $obj["companyId"]];
  402. $oldDep = Db::table("un_talent_depcheckstate")->where($where)->find();
  403. if ($oldDep["state"] != 1 && $oldDep["state"] != 4 && $oldDep["state"] != 9) {
  404. return new Response(Response::ERROR, "不在审核范围内!");
  405. }
  406. if ($obj["spouseList"] && count($obj["spouseList"]) > 0) {
  407. foreach ($obj["spouseList"] as $spouse) {
  408. if ($spouse["id"]) {
  409. $spouse["updateTime"] = date("Y-m-d H:i:s");
  410. $spouse["updateUser"] = $this->user["name"];
  411. \app\common\model\HousePurchaseSpouse::update($spouse);
  412. } else {
  413. $spouse["id"] = getStringId();
  414. $spouse["pId"] = $obj["id"];
  415. $spouse["createTime"] = date("Y-m-d H:i:s");
  416. $spouse["createUser"] = $this->user["name"];
  417. \app\common\model\HousePurchaseSpouse::insert($spouse);
  418. }
  419. }
  420. }
  421. houseModel::update($obj);
  422. TalentChecklog::create([
  423. 'id' => getStringId(),
  424. "companyId" => $obj["companyId"],
  425. 'mainId' => $obj["id"],
  426. 'type' => intval(ProjectState::HOUSE),
  427. 'typeFileId' => null,
  428. 'active' => 2,
  429. 'state' => 3,
  430. 'step' => 2,
  431. 'stateChange' => "保存未提交",
  432. 'description' => $obj["mzjCheckDetail"] ? "录入核查数据:" . $obj["mzjCheckDetail"] : "录入核查数据:",
  433. 'createTime' => date("Y-m-d H:i:s", time()),
  434. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  435. ]);
  436. return new Response(Response::SUCCESS, "审核成功", $obj);
  437. }
  438. /**
  439. * @param obj
  440. * @description 部门审核
  441. * */
  442. public function depCheck() {
  443. $obj = [
  444. "id" => \StrUtil::getRequestDecodeParam($this->request, "id"),
  445. "companyId" => \StrUtil::getRequestDecodeParam($this->request, "companyId"),
  446. "description" => \StrUtil::getRequestDecodeParam($this->request, "description")
  447. ];
  448. $desc = $obj["description"];
  449. $company = getCacheById("Company", $obj["companyId"]);
  450. switch ($company["code"]) {
  451. case CommonConst::ZJJ:
  452. $obj["zjjCheckDetail"] = $obj["description"];
  453. break;
  454. case CommonConst::ZRZYJ:
  455. $obj["zrzzjCheckDetail"] = $obj["description"];
  456. break;
  457. case CommonConst::MZJ:
  458. $obj["mzjCheckDetail"] = $obj["description"];
  459. break;
  460. }
  461. $obj["description"] = "";
  462. houseModel::update($obj);
  463. TalentChecklog::create([
  464. 'id' => getStringId(),
  465. "companyId" => $obj["companyId"],
  466. 'mainId' => $obj["id"],
  467. 'type' => intval(ProjectState::HOUSE),
  468. 'typeFileId' => null,
  469. 'active' => 2,
  470. 'state' => 3,
  471. 'step' => 2,
  472. 'stateChange' => "保存未提交",
  473. 'description' => sprintf("录入核查数据(%s):%s", $company["name"], $desc),
  474. 'createTime' => date("Y-m-d H:i:s", time()),
  475. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  476. ]);
  477. return new Response(Response::SUCCESS, "审核成功");
  478. }
  479. /**
  480. * @param id
  481. * @param type
  482. * @description 删除享受其他政策记录/历年享受记录
  483. * */
  484. public function deleteOtherOrHouse($id, $type) {
  485. if (\StrUtil::isEmpOrNull($id)) {
  486. return new Response(Response::ERROR, "系统错误");
  487. }
  488. if ($type == 1) { //享受其他政策
  489. \app\common\model\HousePurchaseEnjoyOther::where("id", $id)->delete();
  490. } else if (type == 2) { //其他房产信息
  491. \app\common\model\HousePurchaseOtherHouse::where("id", $id)->delete();
  492. }
  493. return new Response(Response::SUCCESS, "删除成功");
  494. }
  495. /**
  496. * @param id
  497. * @description 删除配偶信息
  498. * */
  499. public function deleteSpouse($id) {
  500. if (\StrUtil::isEmpOrNull($id)) {
  501. return new Response(Response::ERROR, "系统错误");
  502. }
  503. \app\common\model\HousePurchaseSpouse::where("id", $id)->delete();
  504. return new Response(Response::SUCCESS, "删除成功");
  505. }
  506. /**
  507. * 提交审核
  508. * @return Response
  509. */
  510. public function submitCheck() {
  511. $id = $this->request["id"];
  512. $process = $this->request["process"];
  513. $companyId = $this->request["companyId"];
  514. if ($process != 2) {
  515. $companyId = null;
  516. }
  517. $log = TalentLogApi::getLastLogByStep($id, ProjectState::HOUSE, $process, 2, $companyId);
  518. if (!$log) {
  519. return new Response(Response::ERROR, "请先审核后再提交");
  520. }
  521. $checkState = $log["state"];
  522. $housepurchase = [];
  523. $housepurchase["id"] = $id;
  524. $housepurchase["checkMsg"] = $log["description"];
  525. $old = HouseApi::getInfoById($id);
  526. //判断到达的最高流程
  527. $housepurchase["highProcess"] = $old["highProcess"] == null ? $process : ($old["highProcess"] < $process ? $process : $old["highProcess"]);
  528. switch ($process) {
  529. case 1:
  530. if ($checkState == -1) {
  531. $housepurchase["checkState"] = HouseStateEnum::NOTPASS;
  532. $housepurchase["realEnjoyMoney"] = 0;
  533. }
  534. if ($checkState == 2) {
  535. $housepurchase["checkState"] = HouseStateEnum::FIRST_REJECT;
  536. }
  537. if ($checkState == 3) { //审核通过
  538. $depCount = Db::table("un_talent_depcheckstate")->where("mainId", $id)->count();
  539. if ($depCount > 0) {
  540. $where = [];
  541. $where[] = ["mainId", "=", $id];
  542. $where[] = ["state", "=", 2];
  543. $rejectCount = Db::table("un_talent_depcheckstate")->where($where)->count();
  544. if ($rejectCount > 0) {
  545. $updDep["state"] = 9;
  546. $updDep["updateTime"] = date("Y-m-d H:i:s");
  547. $updDep["updateUser"] = $this->user["name"];
  548. Db::table("un_talent_depcheckstate")->where($where)->update($updDep);
  549. $housepurchase["checkState"] = HouseStateEnum::NEED_DEP_CHECK;
  550. } else {
  551. $housepurchase["checkState"] = HouseStateEnum::NEED_REVIEW_CHECK;
  552. }
  553. } else {
  554. /* * 生成各部门数据审核 */
  555. $depList = [];
  556. $depCodes = getJsonConfig("../sys_config.json", "housepurchase_dep_list")[$old["type"]];
  557. if ($depCodes && count($depCodes) > 0) {
  558. $where = [];
  559. $where[] = ["code", "in", $depCodes];
  560. $companies = \app\common\model\Company::where($where)->select()->toArray();
  561. foreach ($companies as $company) {
  562. $depList[] = [
  563. "id" => getStringId(),
  564. "type" => ProjectState::HOUSE,
  565. "mainId" => $id,
  566. "companyId" => $company["id"],
  567. "state" => 1,
  568. "createTime" => date("Y-m-d H:i:s"),
  569. "createUser" => $this->user["name"]
  570. ];
  571. }
  572. Db::table("un_talent_depcheckstate")->insertAll($depList);
  573. $housepurchase["checkState"] = HouseStateEnum::NEED_DEP_CHECK;
  574. } else {
  575. if (\StrUtil::isEmpOrNull($old["depPassTime"])) {
  576. $housepurchase["depPassTime"] = date("Y-m-d H:i:s");
  577. }
  578. $housepurchase["checkState"] = HouseStateEnum::NEED_REVIEW_CHECK;
  579. }
  580. }
  581. if (\StrUtil::isEmpOrNull($old["firstPassTime"])) {
  582. $housepurchase["firstPassTime"] = date("Y-m-d H:i:s");
  583. }
  584. /* * 判断夫妻是否同时申报 */
  585. if (\StrUtil::isNotEmpAndNull($old["spouseIdcard"])) {
  586. $where = [];
  587. $where[] = ["idCard", "=", $old["spouseIdcard"]];
  588. $where[] = ["year", "=", $old["year"]];
  589. $where[] = ["delete", "=", 0];
  590. $count = houseModel::where($where)->count();
  591. $housepurchase["isConflict"] = $count > 0 ? 1 : 2;
  592. }
  593. }
  594. //添加日志
  595. TalentChecklog::create([
  596. 'id' => getStringId(),
  597. 'mainId' => $id,
  598. 'type' => intval(ProjectState::HOUSE),
  599. 'typeFileId' => null,
  600. 'active' => 1,
  601. 'state' => $checkState,
  602. 'step' => $process,
  603. 'stateChange' => sprintf("%s->%s", HouseStateEnum::getStateName($old["checkState"]), HouseStateEnum::getStateName($housepurchase["checkState"])),
  604. 'description' => $log["description"],
  605. 'createTime' => date("Y-m-d H:i:s", time()),
  606. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  607. ]);
  608. $where = [];
  609. $where[] = ["mainId", "=", $id];
  610. $where[] = ["active", "=", 2];
  611. TalentChecklog::where($where)->delete();
  612. houseModel::update($housepurchase);
  613. break;
  614. case 2:
  615. $where = [];
  616. $where[] = ["mainId", "=", $id];
  617. $where[] = ["companyId", "=", $companyId];
  618. $tds = Db::table("un_talent_depcheckstate")->where($where)->find();
  619. $tds["state"] = 3;
  620. $tds["submitTime"] = date("Y-m-d H:i:s");
  621. Db::table("un_talent_depcheckstate")->update($tds);
  622. //判断所有部门是否全部通过
  623. $where = [];
  624. $where[] = ["mainId", "=", $id];
  625. $where[] = ["state", "in", [1, 4, 9]];
  626. $needCount = Db::table("un_talent_depcheckstate")->where($where)->count();
  627. if ($needCount == 0) {
  628. $where = [];
  629. $where[] = ["mainId", "=", $id];
  630. $where[] = ["state", "=", 2];
  631. $rejectCount = Db::table("un_talent_depcheckstate")->where($where)->count();
  632. if ($rejectCount > 0) {
  633. $housepurchase["checkState"] = HouseStateEnum::DEP_REJECT;
  634. } else {
  635. if (\StrUtil::isEmpOrNull($old["depPassTime"])) {
  636. $housepurchase["depPassTime"] = date("Y-m-d H:i:s");
  637. }
  638. $housepurchase["checkState"] = HouseStateEnum::NEED_REVIEW_CHECK;
  639. }
  640. houseModel::update($housepurchase);
  641. }
  642. //添加日志
  643. TalentChecklog::create([
  644. 'id' => getStringId(),
  645. 'mainId' => $id,
  646. 'type' => intval(ProjectState::HOUSE),
  647. "companyId" => $companyId,
  648. 'typeFileId' => null,
  649. 'active' => 1,
  650. 'state' => 3,
  651. 'step' => $process,
  652. 'stateChange' => sprintf("%s->%s", HouseStateEnum::getStateName($old["checkState"]), HouseStateEnum::getStateName($housepurchase["checkState"])),
  653. 'description' => $log["description"],
  654. 'createTime' => date("Y-m-d H:i:s", time()),
  655. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  656. ]);
  657. $where = [];
  658. $where[] = ["mainId", "=", $id];
  659. $where[] = ["active", "=", 2];
  660. $where[] = ["companyId", "=", $companyId];
  661. TalentChecklog::where($where)->delete();
  662. break;
  663. case 3:
  664. if ($checkState == -1) {
  665. $housepurchase["checkState"] = HouseStateEnum::NOTPASS;
  666. $housepurchase["cashType"] = 2;
  667. $housepurchase["realEnjoyMoney"] = 0;
  668. }
  669. if ($checkState == 2) {
  670. $where = [];
  671. $where[] = ["mainId", "=", $id];
  672. $where[] = ["companyId", "in", $old["toDep"]];
  673. if ($old["toProcess"] == -1) {
  674. $housepurchase["checkState"] = HouseStateEnum::FIRST_REJECT;
  675. if (\StrUtil::isNotEmpAndNull($old["toDep"])) {
  676. $updTds["state"] = 2;
  677. Db::table("un_talent_depcheckstate")->where($where)->update($updTds);
  678. }
  679. }
  680. if ($old["toProcess"] == 1) {
  681. $housepurchase["checkState"] = HouseStateEnum::REJECT_TO_FIRST;
  682. if (\StrUtil::isNotEmpAndNull($old["toDep"])) {
  683. $updTds["state"] = 2;
  684. Db::table("un_talent_depcheckstate")->where($where)->update($updTds);
  685. }
  686. } else if ($old["toProcess"] == 2) {
  687. $housepurchase["checkState"] = HouseStateEnum::REJECT_TO_DEP;
  688. if (\StrUtil::isNotEmpAndNull($old["toDep"])) {
  689. $updTds["state"] = 4;
  690. Db::table("un_talent_depcheckstate")->where($where)->update($updTds);
  691. }
  692. }
  693. }
  694. if ($checkState == 3) {
  695. /**
  696. * 通过需要判定补贴类型及享受金额
  697. * */
  698. $where = [];
  699. $where[] = ["idCard", "=", $old["idCard"]];
  700. $where[] = ["year", "=", $old["year"]];
  701. $where[] = ["delete", "=", 0];
  702. $info = \app\common\model\TalentAllowance::where($where)->find();
  703. if ($info["checkState"] == \app\common\state\AllowanceStateEnum::REVIEW_PASS && $info["publicState"] == 4) {
  704. $housepurchase["allowanceType"] = $info["allowanceType"];
  705. }
  706. $housepurchase["cashType"] = $old["cashType"];
  707. $descideDesc[] = "审核意见:" . $log["description"] . ";";
  708. $housepurchase["checkState"] = HouseStateEnum::REVIEW_PASS;
  709. if ($old["declareType"] == 1) { //购房补贴
  710. /* * 对需要兑现的计算享受金额 */
  711. if ($housepurchase["cashType"] == 1) {
  712. $result = $this->calculate($old, $housepurchase, $descideDesc, 1);
  713. if ($result->code == 500) {
  714. return $result;
  715. }
  716. }
  717. }
  718. $housepurchase["decideDetail"] = implode("", $descideDesc);
  719. if (\StrUtil::isEmpOrNull($old["reviewPassTime"])) {
  720. $housepurchase["reviewPassTime"] = date("Y-m-d H:i:s");
  721. }
  722. }
  723. //添加日志
  724. TalentChecklog::create([
  725. 'id' => getStringId(),
  726. 'mainId' => $id,
  727. 'type' => intval(ProjectState::HOUSE),
  728. 'typeFileId' => null,
  729. 'active' => 1,
  730. 'state' => $checkState,
  731. 'step' => $process,
  732. 'stateChange' => sprintf("%s->%s", HouseStateEnum::getStateName($old["checkState"]), HouseStateEnum::getStateName($housepurchase["checkState"])),
  733. 'description' => $log["description"],
  734. 'createTime' => date("Y-m-d H:i:s", time()),
  735. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  736. ]);
  737. $where = [];
  738. $where[] = ["mainId", "=", $id];
  739. $where[] = ["active", "=", 2];
  740. TalentChecklog::where($where)->delete();
  741. houseModel::update($housepurchase);
  742. break;
  743. }
  744. return new Response(Response::SUCCESS, "提交审核成功");
  745. }
  746. /**
  747. * 撤销审核
  748. * @return \app\admin\controller\ResponseObj
  749. */
  750. public function cancleThirdCheck() {
  751. $id = $this->request["id"];
  752. $checkMsg = $this->request["checkMsg"];
  753. if (\StrUtil::isEmpOrNull($id)) {
  754. return new Response(Response::ERROR, "请选择需要撤销的对象");
  755. }
  756. $old = HouseApi::getInfoById($id);
  757. if ($old["checkState"] != HouseStateEnum::REVIEW_PASS) {
  758. return new Response(Response::ERROR, "当前对象不是复核通过状态,无法撤销");
  759. }
  760. if ($old["publicState"] != 1) {
  761. return new Response(Response::ERROR, "当前对象不是待公示状态,无法撤销");
  762. }
  763. $data["id"] = $id;
  764. $data["checkMsg"] = $checkMsg;
  765. $data["checkState"] = HouseStateEnum::NEED_REVIEW_CHECK;
  766. $data["cashIdCards"] = "";
  767. $data["cashType"] = null;
  768. $data["decideMoneyDetail"] = "";
  769. $data["decideDetail"] = "";
  770. $where = [];
  771. $where[] = ["mainId", "=", $id];
  772. $count = Db::table("un_talent_depcheckstate")->where($where)->count();
  773. $data["highProcess"] = $count > 0 ? 2 : 1;
  774. //添加日志
  775. TalentChecklog::create([
  776. 'id' => getStringId(),
  777. 'mainId' => $id,
  778. 'type' => intval(ProjectState::HOUSE),
  779. 'typeFileId' => null,
  780. 'active' => 1,
  781. 'state' => 11,
  782. 'step' => 3,
  783. 'stateChange' => HouseStateEnum::getStateName($old["checkState"]) . "->" . HouseStateEnum::getStateName($data["checkState"]),
  784. 'description' => "撤销原因:" . $checkMsg,
  785. 'createTime' => date("Y-m-d H:i:s", time()),
  786. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  787. ]);
  788. houseModel::update($data);
  789. return new Response(Response::SUCCESS, "撤销成功");
  790. }
  791. /**
  792. * @param type
  793. * @description 查询需要审核的数据(待核查征信 /待公示 / 待公示通过 / 待兑现)
  794. * */
  795. public function selectNeedCheckData() {
  796. $type = $this->request["type"];
  797. $name = $this->request["name"];
  798. $idCard = $this->request["idCard"];
  799. $where = [];
  800. if (\StrUtil::isNotEmpAndNull($name)) {
  801. $where[] = ["name", "like", "%$name%"];
  802. }
  803. if (\StrUtil::isNotEmpAndNull($idCard)) {
  804. $where[] = ["idCard", "like", "%$idCard%"];
  805. }
  806. $where[] = ["type", "=", $this->user["type"]];
  807. $field = "id,year,idCard,name,enterpriseId";
  808. $error = null;
  809. switch ($type) {
  810. case -1:
  811. case 0:
  812. $where[] = ["publicState", "=", 1];
  813. $where[] = ["checkState", "in", [HouseStateEnum::NOTPASS, HouseStateEnum::REVIEW_PASS]];
  814. $error = "暂无可核查征信的数据";
  815. break;
  816. case 1:
  817. case 5:
  818. $where[] = ["publicState", "=", 2];
  819. $where[] = ["checkState", "in", [HouseStateEnum::NOTPASS, HouseStateEnum::REVIEW_PASS]];
  820. $where[] = ["cashType", "=", 1];
  821. $error = "暂无可公示(兑现)的数据";
  822. break;
  823. case 2:
  824. case 6:
  825. $where[] = ["publicState", "=", 2];
  826. $where[] = ["checkState", "in", [HouseStateEnum::NOTPASS, HouseStateEnum::REVIEW_PASS]];
  827. $where[] = ["cashType", "=", 2];
  828. $error = "暂无可公示(不予兑现)的数据";
  829. break;
  830. case 3:
  831. $where[] = ["publicState", "=", 3];
  832. $where[] = ["checkState", "in", [HouseStateEnum::NOTPASS, HouseStateEnum::REVIEW_PASS]];
  833. $error = "暂无需要公示通过的数据";
  834. break;
  835. case 4:
  836. $where[] = ["publicState", "=", 4];
  837. $where[] = ["checkState", "in", [HouseStateEnum::REVIEW_PASS]];
  838. $where[] = ["cashType", "=", 1];
  839. $error = "暂无待兑现的数据";
  840. break;
  841. }
  842. $list = HouseApi::getList($where, $field);
  843. //查询企业信息
  844. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  845. foreach ($list as &$row) {
  846. $row["enterpriseName"] = $enterpriseMap[$row["enterpriseId"]];
  847. }
  848. $res = ["rows" => $list, "total" => count($list)];
  849. return new Response(Response::SUCCESS, "", $res);
  850. }
  851. public function exportHczx() {
  852. $response = new \stdClass();
  853. $response->code = 500;
  854. $ids = $this->request->param("ids");
  855. $ids_arr = array_filter(explode(",", $ids));
  856. if (!$ids_arr) {
  857. $response->msg = "没有选择导出的名单";
  858. return \StrUtil::back($response, "Housepurchase.callBack");
  859. }
  860. $where = [];
  861. $where[] = ["id", "in", $ids_arr];
  862. $list = houseModel::field("id,cardType,idCard,name,enterpriseId,year")->where($where)->select()->toArray();
  863. if (!$list) {
  864. $response->msg = "暂无可核查征信的数据";
  865. return \StrUtil::back($response, "Housepurchase.callBack");
  866. }
  867. $columns = ["序号", "姓名", "证件类型", "证件号码", "工作单位", "年度"];
  868. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  869. $cardTypeName = DictApi::selectByParentCode("card_type");
  870. $rows = [];
  871. for ($i = 0; $i < count($list); $i++) {
  872. $item = $list[$i];
  873. $row = [
  874. $i + 1, $item["name"], $cardTypeName[$item["cardType"]], $item["idCard"], $enterpriseMap[$item["enterpriseId"]], $item["year"]
  875. ];
  876. $rows[] = $row;
  877. }
  878. $filename = "购房补贴待核查征信名单导出";
  879. if ($rows) {
  880. export($columns, $rows, $filename);
  881. exit();
  882. } else {
  883. $response->msg = "没有选择导出的名单";
  884. return \StrUtil::back($response, "Housepurchase.callBack");
  885. }
  886. }
  887. /**
  888. * 核查征信驳回
  889. */
  890. public function hczxReject() {
  891. $param = $this->request->param();
  892. if (!$param) {
  893. return new Response(Response::ERROR, "系统错误,请联系管理员");
  894. }
  895. $old = HouseApi::getInfoById($param["id"]);
  896. if ($old["publicState"] != 1) {
  897. return new Response(Response::ERROR, "当前记录不是待核查征信状态,无法核查");
  898. }
  899. $data["id"] = $param["id"];
  900. $data["checkState"] = HouseStateEnum::NOTPASS;
  901. $data["publicState"] = 2;
  902. $data["zxMsg"] = $param["outMsg"];
  903. $data["cashType"] = 2;
  904. $data["descideDesc"] = $old . "(1)核查征信结果:" . $param["outMsg"] . ";无法享受";
  905. //添加日志
  906. TalentChecklog::create([
  907. 'id' => getStringId(),
  908. 'mainId' => $param["id"],
  909. 'type' => intval(ProjectState::HOUSE),
  910. 'typeFileId' => null,
  911. 'active' => 1,
  912. 'state' => 2,
  913. 'step' => 4,
  914. 'stateChange' => HouseStateEnum::getStateName($old["checkState"]) . "->" . HouseStateEnum::getStateName($data["checkState"]) . "<br>公示状态:<span class='label label-success'>待核查</span>-><span class='label label-primary'>待公示</span>",
  915. 'description' => $param["outMsg"],
  916. 'createTime' => date("Y-m-d H:i:s", time()),
  917. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  918. ]);
  919. houseModel::update($data);
  920. return new Response(Response::SUCCESS, "核查征信成功");
  921. }
  922. /**
  923. * 核查征信批量通过
  924. */
  925. public function hczxPass() {
  926. $ids = $this->request["ids"];
  927. if (\StrUtil::isEmpOrNull($ids)) {
  928. return new Response(Response::ERROR, "请选择核查征信通过的数据");
  929. }
  930. $where = [];
  931. $where[] = ["id", "in", $ids];
  932. $list = houseModel::where($where)->select()->toArray();
  933. $logList = [];
  934. $upds = [];
  935. $new_ids = [];
  936. foreach ($list as $obj) {
  937. if ($obj["checkState"] == HouseStateEnum::REVIEW_PASS && $obj["publicState"] == 1) {
  938. $new_ids[] = $obj["id"];
  939. $logList[] = [
  940. "id" => getStringId(),
  941. "type" => ProjectState::HOUSE,
  942. "mainId" => $obj["id"],
  943. "active" => 1,
  944. "state" => 3,
  945. "step" => 4,
  946. "stateChange" => "<span class='label label-success'>待核查</span>-><span class='label label-primary'>待公示</span>",
  947. "description" => "核查征信通过",
  948. "createTime" => date("Y-m-d H:i:s"),
  949. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  950. ];
  951. }
  952. }
  953. $upd = [
  954. "publicState" => 2,
  955. ];
  956. if ($new_ids) {
  957. $where = [];
  958. $where[] = ["id", "in", $new_ids];
  959. houseModel::where($where)->update($upd);
  960. Db::table("new_talent_checklog")->insertAll($logList);
  961. return new Response(Response::SUCCESS, "核查征信通过成功");
  962. }
  963. return new Response(Response::ERROR, "没有待核查的列表");
  964. }
  965. /**
  966. * 公示
  967. * */
  968. public function publicBatch() {
  969. $params = $this->request->param();
  970. $ids = $params["ids"];
  971. $ids = array_filter(explode(",", $ids));
  972. if (!$ids) {
  973. return new Response(Response::ERROR, "请至少选择一行数据");
  974. }
  975. $isMessage = $params["isMessage"] == 1 ? true : false;
  976. if ($isMessage && (!$params["typeName"] || !$params["address"] || !$params["publicStartTime"] || !$params["publicEndTime"] || !$params["dep"] || !$params["phone"] || !$params["email"])) {
  977. return new Response(Response::ERROR, "短信参数不能为空");
  978. }
  979. $where = [];
  980. $where[] = ["id", "in", $ids];
  981. $list = houseModel::where($where)->select()->toArray();
  982. Db::startTrans();
  983. try {
  984. $logList = [];
  985. $phones = [];
  986. $newIds = [];
  987. foreach ($list as $info) {
  988. if ($info["checkState"] == HouseStateEnum::REVIEW_PASS && $info["publicState"] == 2) {
  989. /* * 添加日志 */
  990. $newIds[] = $info["id"];
  991. $logList[] = [
  992. "id" => getStringId(),
  993. "type" => ProjectState::HOUSE,
  994. "mainId" => $info["id"],
  995. "active" => 1,
  996. "state" => 3,
  997. "step" => 5,
  998. "stateChange" => "<span class='label label-success'>待公示</span>-><span class='label label-primary'>公示中</span>",
  999. "description" => "批量公示",
  1000. "createTime" => date("Y-m-d H:i:s"),
  1001. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  1002. ];
  1003. $phones[] = $info["phone"];
  1004. }
  1005. }
  1006. if ($newIds) {
  1007. $where = [];
  1008. $where[] = ["id", "in", $newIds];
  1009. $data["publicState"] = 3;
  1010. Db::table("un_housepurchase")->where($where)->update($data);
  1011. $effect = Db::table("new_talent_checklog")->insertAll($logList);
  1012. Db::commit();
  1013. if ($phones && $isMessage && $effect) {
  1014. $tpl_content = sprintf("【晋江市人才服务平台】您好!您提交申请的%s已完成初步审核,现通过%s将审核结果予以公示,公示时间%s至%s。公示期间如有异议,请及时向%s反映。电话%s,电子邮箱%s。",
  1015. $params["typeName"], $params["address"], $params["publicStartTime"], $params["publicEndTime"], $params["dep"], $params["phone"], $params["email"]);
  1016. $phones = array_filter($phones);
  1017. foreach ($phones as $phone) {
  1018. queue("app\job\Messenger", ["type" => 6, "userId" => 0, "phone" => $phone, "template" => $tpl_content, "processName" => "购房补贴-批量公示", "userType" => 3]);
  1019. }
  1020. }
  1021. return new Response(Response::SUCCESS, "公示成功");
  1022. }
  1023. return new Response(Response::ERROR, "没有待公示的列表");
  1024. } catch (\think\db\exception\DbException $e) {
  1025. Db::rollback();
  1026. return new Response(Response::SUCCESS, "公示失败:" . $e->getMessage());
  1027. }
  1028. }
  1029. /**
  1030. * @param obj
  1031. * @description 公示再审核修改住建局、自然资源局数据
  1032. * */
  1033. public function afterCheckEdit() {
  1034. $obj = [
  1035. "id" => \StrUtil::getRequestDecodeParam($this->request, "id"),
  1036. "checkIsTradeRecord" => \StrUtil::getRequestDecodeParam($this->request, "checkIsTradeRecord"),
  1037. "checkRecordTime" => \StrUtil::getRequestDecodeParam($this->request, "checkRecordTime"),
  1038. "mzjCheckDetail" => \StrUtil::getRequestDecodeParam($this->request, "mzjCheckDetail"),
  1039. "mzjSpouseList" => $this->request["mzjSpouseList"],
  1040. "zjjCheckDetail" => \StrUtil::getRequestDecodeParam($this->request, "zjjCheckDetail"),
  1041. "isHasBdcCard" => \StrUtil::getRequestDecodeParam($this->request, "isHasBdcCard"),
  1042. "bdcRegistTime" => \StrUtil::getRequestDecodeParam($this->request, "bdcRegistTime"),
  1043. "isOwner" => \StrUtil::getRequestDecodeParam($this->request, "isOwner"),
  1044. "transferMethod" => \StrUtil::getRequestDecodeParam($this->request, "transferMethod"),
  1045. "transferTime" => \StrUtil::getRequestDecodeParam($this->request, "transferTime"),
  1046. "zrzzjCheckDetail" => \StrUtil::getRequestDecodeParam($this->request, "zrzzjCheckDetail"),
  1047. "zjjHouseList" => $this->request["zjjHouseList"],
  1048. "zrzyjHouseList" => $this->request["zrzyjHouseList"],
  1049. "otherList" => $this->request["otherList"]
  1050. ];
  1051. if (!$obj) {
  1052. return new Response(Response::ERROR, "系统错误,请联系管理员");
  1053. }
  1054. $old = HouseApi::getInfoById($obj["id"]);
  1055. if ($old["checkState"] != HouseStateEnum::REVIEW_PASS || $old["publicState"] != 3) {
  1056. return new Response(Response::ERROR, "不在审核范围内,无法操作");
  1057. }
  1058. if ($old["declareType"] == 1) {
  1059. if ($obj["isHasBdcCard"] == 1 && \StrUtil::isEmpOrNull($obj["bdcRegistTime"])) {
  1060. return new Response(Response::ERROR, "请填写不动产权证书登记时间");
  1061. }
  1062. if (!$obj["isOwner"]) {
  1063. return new Response(Response::ERROR, "请选择其购置的房屋是否还在名下");
  1064. }
  1065. if ($obj["isOwner"] == 2 && \StrUtil::isEmpOrNull($obj["transferMethod"])) {
  1066. return new Response(Response::ERROR, "请填写过户方式");
  1067. }
  1068. if ($obj["isOwner"] == 2 && \StrUtil::isEmpOrNull($obj["transferTime"])) {
  1069. return new Response(Response::ERROR, "请填写过户时间");
  1070. }
  1071. if ($obj["checkIsTradeRecord"] == 1 && \StrUtil::isEmpOrNull($obj["checkRecordTime"])) {
  1072. return new Response(Response::ERROR, "请填写交易备案时间");
  1073. }
  1074. } else {
  1075. $obj["isHasBdcCard"] = null;
  1076. $obj["bdcRegistTime"] = "";
  1077. $obj["isOwner"] = null;
  1078. $obj["transferMethod"] = "";
  1079. $obj["transferTime"] = "";
  1080. $obj["checkIsTradeRecord"] = null;
  1081. $obj["checkRecordTime"] = "";
  1082. }
  1083. if ($obj["mzjSpouseList"] && count($obj["mzjSpouseList"]) > 0) {
  1084. foreach ($obj["mzjSpouseList"] as $spouse) {
  1085. if ($spouse["id"]) {
  1086. $spouse["updateTime"] = date("Y-m-d H:i:s");
  1087. $spouse["updateUser"] = $this->user["name"];
  1088. \app\common\model\HousePurchaseSpouse::update($spouse);
  1089. } else {
  1090. $spouse["id"] = getStringId();
  1091. $spouse["pId"] = $obj["id"];
  1092. $spouse["createTime"] = date("Y-m-d H:i:s");
  1093. $spouse["createUser"] = $this->user["name"];
  1094. \app\common\model\HousePurchaseSpouse::insert($spouse);
  1095. }
  1096. }
  1097. }
  1098. if ($obj["zrzyjHouseList"] && count($obj["zrzyjHouseList"]) > 0) {
  1099. foreach ($obj["zrzyjHouseList"] as $other) {
  1100. if ($other["id"]) {
  1101. $other["updateTime"] = date("Y-m-d H:i:s");
  1102. $other["updateUser"] = $this->user["name"];
  1103. \app\common\model\HousePurchaseOtherHouse::update($other);
  1104. } else {
  1105. $other["id"] = getStringId();
  1106. $other["pId"] = $obj["id"];
  1107. $other["createTime"] = date("Y-m-d H:i:s");
  1108. $other["createUser"] = $this->user["name"];
  1109. \app\common\model\HousePurchaseOtherHouse::insert($other);
  1110. }
  1111. }
  1112. }
  1113. if ($obj["otherList"] && count($obj["otherList"]) > 0) {
  1114. foreach ($obj["otherList"] as $other) {
  1115. if ($other["id"]) {
  1116. $other["updateTime"] = date("Y-m-d H:i:s");
  1117. $other["updateUser"] = $this->user["name"];
  1118. \app\common\model\HousePurchaseEnjoyOther::update($other);
  1119. } else {
  1120. $other["id"] = getStringId();
  1121. $other["pId"] = $obj["id"];
  1122. $other["createTime"] = date("Y-m-d H:i:s");
  1123. $other["createUser"] = $this->user["name"];
  1124. \app\common\model\HousePurchaseEnjoyOther::insert($other);
  1125. }
  1126. }
  1127. }
  1128. if ($obj["zjjHouseList"] && count($obj["zjjHouseList"]) > 0) {
  1129. foreach ($obj["zjjHouseList"] as $other) {
  1130. if ($other["id"]) {
  1131. $other["updateTime"] = date("Y-m-d H:i:s");
  1132. $other["updateUser"] = $this->user["name"];
  1133. \app\common\model\HousePurchaseOtherHouse::update($other);
  1134. } else {
  1135. $other["id"] = getStringId();
  1136. $other["pId"] = $obj["id"];
  1137. $other["createTime"] = date("Y-m-d H:i:s");
  1138. $other["createUser"] = $this->user["name"];
  1139. \app\common\model\HousePurchaseOtherHouse::insert($other);
  1140. }
  1141. }
  1142. }
  1143. houseModel::update($obj);
  1144. return new Response(Response::SUCCESS, "审核成功", $obj);
  1145. }
  1146. /**
  1147. * 公示后审核
  1148. */
  1149. public function afterCheck() {
  1150. try {
  1151. $data = [
  1152. "id" => \StrUtil::getRequestDecodeParam($this->request, "id"),
  1153. "checkState" => \StrUtil::getRequestDecodeParam($this->request, "checkState"),
  1154. "checkMsg" => \StrUtil::getRequestDecodeParam($this->request, "checkMsg"),
  1155. "cashType" => \StrUtil::getRequestDecodeParam($this->request, "cashType"),
  1156. "decideMoneyDetail" => \StrUtil::getRequestDecodeParam($this->request, "decideMoneyDetail"),
  1157. "shouldEnjoyMoney" => \StrUtil::getRequestDecodeParam($this->request, "shouldEnjoyMoney"),
  1158. ];
  1159. $old = HouseApi::getInfoById($data["id"]);
  1160. if (!$old) {
  1161. return new Response(Response::ERROR, "系统错误,请联系管理员");
  1162. }
  1163. if ($old["publicState"] != 3) {
  1164. return new Response(Response::ERROR, "当前记录不是公示中状态,无法审核");
  1165. }
  1166. if ($data["checkState"] == 3) {
  1167. $data["checkState"] = HouseStateEnum::REVIEW_PASS;
  1168. if ($data["cashType"] == 1 && $old["declareType"] == 1) {
  1169. $houseBalanceMoney = $old["houseBalanceMoney"] ?: 0;
  1170. $balanceMoney = $old["balanceMoney"] ?: 0;
  1171. $talentArrangeMoney = $old["talentArrangeMoney"] ?: 0;
  1172. $minMoney = $houseBalanceMoney >= $balanceMoney ? ($balanceMoney >= $talentArrangeMoney ? $talentArrangeMoney : $balanceMoney) : ($houseBalanceMoney >= $talentArrangeMoney ? $talentArrangeMoney : $houseBalanceMoney);
  1173. if ($data["shouldEnjoyMoney"] > $minMoney) {
  1174. return new Response(Response::ERROR, "当前申报的最高可享受金额为:" . $minMoney . "元!请重新计算并填写");
  1175. }
  1176. $result = $this->calculate($old, $data, $decideDetail, 2);
  1177. if ($result->code == 500) {
  1178. return $result;
  1179. }
  1180. }
  1181. if ($data["cashType"] != 1) {
  1182. $data["shouldEnjoyMoney"] = 0;
  1183. $data["nowSubOtherMoney"] = 0;
  1184. }
  1185. } else if ($data["checkState"] == -1) {
  1186. $data["isRecover"] = 2;
  1187. $data["shouldEnjoyMoney"] = null;
  1188. $data["realEnjoyMoney"] = null;
  1189. $data["decideMoneyDetail"] = null;
  1190. $data["decideDetail"] = null;
  1191. }
  1192. $data["publicState"] = 4;
  1193. houseModel::update($data);
  1194. //添加日志
  1195. TalentChecklog::create([
  1196. 'id' => getStringId(),
  1197. 'mainId' => $data['id'],
  1198. 'type' => intval(ProjectState::HOUSE),
  1199. 'typeFileId' => null,
  1200. 'active' => 1,
  1201. 'state' => $old["checkState"],
  1202. 'step' => 6,
  1203. 'stateChange' => "<span class='label label-success'>公示中</span>-><span class='label label-primary'>待兑现</span>",
  1204. 'description' => "公示再审核",
  1205. 'createTime' => date("Y-m-d H:i:s", time()),
  1206. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  1207. ]);
  1208. return new Response(Response::SUCCESS, "审核成功");
  1209. } catch (\think\Exception $e) {
  1210. return new Response(Response::ERROR, "系统异常,请联系管理员");
  1211. }
  1212. }
  1213. /**
  1214. * 批量公示通过
  1215. */
  1216. public function publicPass() {
  1217. $ids = $this->request["ids"];
  1218. $ids = explode(",", $ids);
  1219. if (!$ids) {
  1220. return new Response(Response::ERROR, "请至少选择一行数据");
  1221. }
  1222. $where = [];
  1223. $where[] = ["id", "in", $ids];
  1224. $list = houseModel::where($where)->select()->toArray();
  1225. $houseInfoList = houseInfoModel::where(null)->select()->toArray();
  1226. $houseInfoMap = [];
  1227. foreach ($houseInfoList as $houseInfo) {
  1228. $houseInfoMap[$houseInfo["idCard"]] = $houseInfo;
  1229. }
  1230. $logList = [];
  1231. $insertHouseInfoList = [];
  1232. try {
  1233. Db::startTrans();
  1234. for ($i = 0; $i < count($list); $i++) {
  1235. $obj = $list[$i];
  1236. if ($obj["cashType"] == 1 && $obj["declareType"] == 1) {
  1237. $houseInfo = $houseInfoMap[$obj["idCard"]];
  1238. $spouseHouseInfo = $houseInfoMap[$obj["spouseIdcard"]];
  1239. if (!$houseInfo) {
  1240. $houseInfo = [
  1241. "idCard" => $obj["idCard"],
  1242. "spouseIdCard" => null,
  1243. "houseAddress" => $obj["houseAddress"],
  1244. "houseArea" => $obj["houseArea"],
  1245. "houseMoney" => $obj["houseMoney"],
  1246. "recordTime" => $obj["recordTime"],
  1247. "realEstateNo" => $obj["realEstateNo"],
  1248. "recordNo" => $obj["recordNo"],
  1249. "balanceMoney" => $obj["houseMoney"],
  1250. "count" => 0,
  1251. "lastYearArrears" => 0,
  1252. ];
  1253. }
  1254. $houseInfo["count"] = $houseInfo["count"] + 1;
  1255. $houseInfo["balanceMoney"] = $houseInfo["balanceMoney"] - $obj["shouldEnjoyMoney"];
  1256. $houseInfo["lastYearArrears"] = $obj["nowNotSubOtherMoney"];
  1257. if (\StrUtil::isNotEmpAndNull($obj["spouseIdcard"])) {
  1258. if (!$spouseHouseInfo) {
  1259. $spouseHouseInfo = [
  1260. "idCard" => $obj["spouseIdcard"],
  1261. "spouseIdCard" => null,
  1262. "houseAddress" => $obj["houseAddress"],
  1263. "houseArea" => $obj["houseArea"],
  1264. "houseMoney" => $obj["houseMoney"],
  1265. "recordTime" => $obj["recordTime"],
  1266. "realEstateNo" => $obj["realEstateNo"],
  1267. "recordNo" => $obj["recordNo"],
  1268. "balanceMoney" => $houseInfo["balanceMoney"],
  1269. "count" => $houseInfo["count"],
  1270. "lastYearArrears" => $houseInfo["lastYearArrears"],
  1271. ];
  1272. } else {
  1273. $spouseHouseInfo["count"] = $spouseHouseInfo["count"] + 1;
  1274. $spouseHouseInfo["lastYearArrears"] = $houseInfo["lastYearArrears"];
  1275. $spouseHouseInfo["balanceMoney"] = $spouseHouseInfo["balanceMoney"] - $obj["shouldEnjoyMoney"];
  1276. }
  1277. if ($spouseHouseInfo["id"]) {
  1278. $spouseHouseInfo["updateTime"] = date("Y-m-d H:i:s");
  1279. $spouseHouseInfo["updateUser"] = $this->user["uid"];
  1280. Db::table("un_housepurchase_house_info")->update($spouseHouseInfo);
  1281. } else {
  1282. $spouseHouseInfo["id"] = getStringId();
  1283. $spouseHouseInfo["createTime"] = date("Y-m-d H:i:s");
  1284. $spouseHouseInfo["createUser"] = $this->user["uid"];
  1285. $insertHouseInfoList[] = $spouseHouseInfo;
  1286. }
  1287. }
  1288. if ($houseInfo["id"]) {
  1289. $houseInfo["updateTime"] = date("Y-m-d H:i:s");
  1290. $houseInfo["updateUser"] = $this->user["uid"];
  1291. Db::table("un_housepurchase_house_info")->update($houseInfo);
  1292. } else {
  1293. $houseInfo["id"] = getStringId();
  1294. $houseInfo["createTime"] = date("Y-m-d H:i:s");
  1295. $houseInfo["createUser"] = $this->user["uid"];
  1296. $insertHouseInfoList[] = $houseInfo;
  1297. }
  1298. }
  1299. //添加日志
  1300. $logList[] = [
  1301. "id" => getStringId(),
  1302. "type" => ProjectState::HOUSE,
  1303. "mainId" => $obj["id"],
  1304. "active" => 1,
  1305. "state" => 3,
  1306. "step" => 6,
  1307. "stateChange" => "<span class='label label-success'>公示中</span>-><span class='label label-primary'>待公布</span>;",
  1308. "description" => "批量公示通过",
  1309. "createTime" => date("Y-m-d H:i:s"),
  1310. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  1311. ];
  1312. }
  1313. $upd["publicState"] = 4;
  1314. Db::table("un_housepurchase")->where($where)->update($upd);
  1315. if ($insertHouseInfoList) {
  1316. Db::table("un_housepurchase_house_info")->insertAll($insertHouseInfoList);
  1317. }
  1318. Db::table("new_talent_checklog")->insertAll($logList);
  1319. Db::commit();
  1320. return new Response(Response::SUCCESS, "批量公示通过成功");
  1321. } catch (\think\db\exception\DbException $e) {
  1322. Db::rollback();
  1323. return new Response(Response::ERROR, "批量公示失败:" . $e->getCode());
  1324. }
  1325. }
  1326. /**
  1327. * 兑现
  1328. */
  1329. public function cash() {
  1330. $ids = $this->request["ids"];
  1331. $ids = array_filter(explode(",", $ids));
  1332. if (!$ids) {
  1333. return new Response(Response::ERROR, "请至少选择一行数据");
  1334. }
  1335. $where = [];
  1336. $where[] = ["id", "in", $ids];
  1337. $list = houseModel::where($where)->select()->toArray();
  1338. //添加日志
  1339. $logList = [];
  1340. try {
  1341. Db::startTrans();
  1342. for ($i = 0; $i < count($list); $i++) {
  1343. $obj = $list[$i];
  1344. $logList[] = [
  1345. "id" => getStringId(),
  1346. "type" => ProjectState::HOUSE,
  1347. "mainId" => $obj["id"],
  1348. "active" => 1,
  1349. "state" => 3,
  1350. "step" => 50,
  1351. "stateChange" => "<span class='label label-success'>待兑现</span>-><span class='label label-primary'>已兑现</span>;",
  1352. "description" => "批量兑现",
  1353. "createTime" => date("Y-m-d H:i:s"),
  1354. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  1355. ];
  1356. }
  1357. $upd["publicState"] = 5;
  1358. Db::table("un_housepurchase")->where($where)->update($upd);
  1359. Db::table("new_talent_checklog")->insertAll($logList);
  1360. Db::commit();
  1361. return new Response(Response::SUCCESS, "批量兑现成功");
  1362. } catch (\think\db\exception\DbException $e) {
  1363. Db::rollback();
  1364. return new Response(Response::ERROR, "批量兑现失败:" . $e->getCode());
  1365. }
  1366. }
  1367. /**
  1368. * 公示预览(不予兑现)
  1369. */
  1370. public function exportPublicNotCash() {
  1371. $response = new \stdClass();
  1372. $response->code = 500;
  1373. //获取字典表人才层次+
  1374. $levelMap = DictApi::selectByParentCode("talent_arrange");
  1375. $streetMap = DictApi::selectByParentCode("street");
  1376. //查询企业信息
  1377. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  1378. //查询所有
  1379. $where = [];
  1380. $where[] = ["id", "in", explode(",", $this->request["ids"])];
  1381. $list = TaModel::where($where)->select()->toArray();
  1382. $rows = [];
  1383. for ($i = 0; $i < count($list); $i++) {
  1384. $item = $list[$i];
  1385. $rows[] = [
  1386. $i + 1, $item["name"], $enterpriseMap[$item["enterpriseId"]], $streetMap[$item["address"]], $levelMap[$item["talentArrange"]], $item["description"]
  1387. ];
  1388. }
  1389. $filename = CommonConst::getTypeName($this->user["type"]) . $allList[0]["year"] . "年度津补贴不予兑现对象名单";
  1390. $columns = ["序号", "姓名", "工作单位", "镇(街道)", "人才层次", "备注"];
  1391. if ($rows) {
  1392. export($columns, $rows, $filename);
  1393. exit();
  1394. } else {
  1395. $response->msg = "没有选择导出的名单";
  1396. return \StrUtil::back($response, "TalentTypeChange.callBack");
  1397. }
  1398. }
  1399. /**
  1400. * @param ids
  1401. * @param type 1-需要兑现,2-不予兑现
  1402. * @description 公示预览
  1403. * */
  1404. public function exportPublic() {
  1405. /* * 查询需要公示的数据 */
  1406. $ids = array_filter(explode(",", $this->request["ids"]));
  1407. if (!$ids) {
  1408. return new Response(Response::ERROR, "请至少选择一行数据");
  1409. }
  1410. $type = $this->request["type"];
  1411. $where = [];
  1412. $where[] = ["id", "in", $ids];
  1413. $list = houseModel::where($where)->select()->toArray();
  1414. $where = [];
  1415. $where[] = ["pId", "in", $ids];
  1416. $otherList = \app\common\model\HousePurchaseEnjoyOther::where($where)->select()->toArray();
  1417. $otherMap = [];
  1418. foreach ($otherList as $ol) {
  1419. $otherMap[$ol["pId"]][] = $ol;
  1420. }
  1421. //查询企业信息
  1422. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  1423. $levelMap = DictApi::selectByParentCode("talent_arrange");
  1424. $year = $list[0]["year"];
  1425. foreach ($list as $key => &$obj) {
  1426. $obj["talentArrangeName"] = $levelMap[$obj["talentArrange"]];
  1427. $obj["enterpriseName"] = $enterpriseMap[$obj["enterpriseId"]];
  1428. $obj["sn"] = $key + 1;
  1429. if ($obj["declareType"] == 1) {
  1430. $obj["declareTypeName"] = "购房补贴";
  1431. $otherHouses = $otherMap[$obj["id"]];
  1432. $desc = [];
  1433. if ($otherHouses) {
  1434. foreach ($otherHouses as $house) {
  1435. $desc[] = $house["enjoyPolicyName"];
  1436. }
  1437. }
  1438. $obj["description"] = $desc ? "扣除已享受" . implode(";\n", $desc) . "部分" : "";
  1439. } else if ($obj["declareType"] == 2) {
  1440. $obj["declareTypeName"] = "免租入住";
  1441. $obj["description"] = $year . "年度取得免租入住资格";
  1442. }
  1443. }unset($obj);
  1444. $userTypeName = CommonConst::getTypeName($this->user["type"]);
  1445. if ($type == 1) {
  1446. //兑现
  1447. $title = ["序号", "申报类型", "姓名", "工作单位", "人才层次", $year . "年度拟发放购房补贴金额(元)", "备注"];
  1448. $value = ["sn", "declareTypeName", "name", "enterpriseName", "talentArrangeName", "realEnjoyMoney", "description"];
  1449. $fileName = sprintf("%s%s年度购房补贴拟发放对象名单", $userTypeName, $year);
  1450. } else {
  1451. //不予兑现
  1452. $title = ["序号", "申报类型", "姓名", "工作单位", "人才层次", "备注"];
  1453. $value = ["sn", "declareTypeName", "name", "enterpriseName", "talentArrangeName", "description"];
  1454. $fileName = sprintf("%s%s年度购房补贴不予兑现对象名单", $userTypeName, $year);
  1455. }
  1456. $rows = [];
  1457. foreach ($list as $row) {
  1458. $newRow = [];
  1459. for ($i = 0; $i < count($value); $i++) {
  1460. $newRow[] = $row[$value[$i]];
  1461. }
  1462. $rows[] = $newRow;
  1463. }
  1464. export($title, $rows, $fileName);
  1465. }
  1466. /**
  1467. * 导出基本信息
  1468. */
  1469. public function exportBasicInfo() {
  1470. $obj["year"] = \StrUtil::getRequestDecodeParam($this->request, "year");
  1471. $obj["enterpriseName"] = \StrUtil::getRequestDecodeParam($this->request, "enterpriseName");
  1472. $obj["name"] = \StrUtil::getRequestDecodeParam($this->request, "name");
  1473. $obj["idCard"] = \StrUtil::getRequestDecodeParam($this->request, "idCard");
  1474. $obj["talentType"] = \StrUtil::getRequestDecodeParam($this->request, "talentType");
  1475. $obj["talentArrange"] = \StrUtil::getRequestDecodeParam($this->request, "talentArrange");
  1476. $obj["address"] = \StrUtil::getRequestDecodeParam($this->request, "address");
  1477. $obj["identifyCondition"] = \StrUtil::getRequestDecodeParam($this->request, "identifyCondition");
  1478. $obj["isSupple"] = \StrUtil::getRequestDecodeParam($this->request, "isSupple");
  1479. $obj["checkState"] = \StrUtil::getRequestDecodeParam($this->request, "checkState");
  1480. $obj["publicState"] = \StrUtil::getRequestDecodeParam($this->request, "publicState");
  1481. $obj["companyName"] = \StrUtil::getRequestDecodeParam($this->request, "companyName");
  1482. $obj["allowanceType"] = \StrUtil::getRequestDecodeParam($this->request, "allowanceType");
  1483. $obj["recommendAllowanceType"] = \StrUtil::getRequestDecodeParam($this->request, "recommendAllowanceType");
  1484. $obj["introductionMode"] = \StrUtil::getRequestDecodeParam($this->request, "introductionMode");
  1485. $obj["firstJJStartTime"] = \StrUtil::getRequestDecodeParam($this->request, "firstJJStartTime");
  1486. $obj["firstJJEndTime"] = \StrUtil::getRequestDecodeParam($this->request, "firstJJEndTime");
  1487. $obj["process"] = intval(\StrUtil::getRequestDecodeParam($this->request, "process"));
  1488. $obj["type"] = $this->user["type"];
  1489. $where = [];
  1490. $where[] = ["ta.delete", "=", 0];
  1491. $where[] = ["ta.type", "=", $this->user["type"]];
  1492. $this->setTalentAllowanceInfoForExport($where, $obj, $obj["process"]);
  1493. switch ($obj["process"]) {
  1494. case 1:
  1495. $where[] = ["ta.checkState", "in", [1, 5, 10, 13, 15, 20, 25, 30]];
  1496. break;
  1497. case 2:
  1498. $where[] = ["ta.firstPassTime", "EXP", Db::raw("is not null")];
  1499. break;
  1500. case 3:
  1501. $where[] = ["ta.visitPassTime", "EXP", Db::raw("is not null")];
  1502. break;
  1503. case 4:
  1504. if ($obj["publicState"]) {
  1505. $where[] = ["publicState", "=", $obj["publicState"]];
  1506. }
  1507. $where[] = ["ta.checkState", "in", [-1, 30]];
  1508. break;
  1509. }
  1510. $projects = [
  1511. AllowanceProjectEnum::PROJECT_TAX,
  1512. AllowanceProjectEnum::PROJECT_WAGES,
  1513. AllowanceProjectEnum::PROJECT_ATTENDANCE,
  1514. AllowanceProjectEnum::PROJECT_SB_PENSION,
  1515. AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
  1516. AllowanceProjectEnum::PROJECT_SB_MEDICA,
  1517. ];
  1518. $months = [];
  1519. for ($m = 1; $m <= 12; $m++) {
  1520. $months[] = $m . "月";
  1521. }
  1522. $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]]];
  1523. $infoCols = count($columns);
  1524. for ($i = 0; $i < count($projects); $i++) {
  1525. $columns[] = [AllowanceProjectEnum::getProjectName($projects[$i]), $months];
  1526. }
  1527. $list = \app\common\model\TalentAllowanceProject::alias("pro")
  1528. ->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")
  1529. ->leftJoin("un_talent_allowance_info ta", "ta.id=pro.mainId")
  1530. ->leftJoin("un_talent_allowancecontract_detail con", "pro.baseId=con.id")
  1531. ->where($where)
  1532. ->order("ta.year desc,ta.createTime desc,pro.project asc")
  1533. ->select()->toArray();
  1534. $tmpList = [];
  1535. $levelMap = DictApi::selectByParentCode("talent_arrange");
  1536. $streetMap = DictApi::selectByParentCode("street");
  1537. $where = [];
  1538. $where[] = ["id", "in", array_column($list, "identifyCondition")];
  1539. $icmap = \app\common\model\TalentCondition::where($where)->column("name", "id");
  1540. $where = [];
  1541. $where[] = ["id", "in", array_column($list, "enterpriseId")];
  1542. $enterpriseMap = \app\common\model\Enterprise::where($where)->column("name", "id");
  1543. foreach ($list as $item) {
  1544. //组装数据
  1545. if (!$tmpList[$item["id"]]) {
  1546. $tmpList[$item["id"]]["curEnterpriseId"] = $item["curEnterpriseId"];
  1547. $tmpList[$item["id"]]["info"] = [$item["year"], $streetMap[$item["address"]], $item["name"], $item["sex"] == 1 ? "男" : "女", $item["idCard"], $levelMap[$item["talentArrange"]],
  1548. $icmap[$item["identifyCondition"]], $item["identifyGetTime"], $item["identifyConditionName"], $item["identifyMonth"], AllowanceTypeEnum::getTypeName($item["recommendAllowanceType"]), $item["recommendMonths"], $item["recommendMoney"],
  1549. $item["recommendMoneyDesc"], AllowanceTypeEnum::getTypeName($item["allowanceType"]), $item["months"], $item["money"],
  1550. $item["moneyDesc"], $this->getCheckStateName($item["checkState"], $item["publicState"], $item["allowanceType"])];
  1551. }
  1552. if (!$tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]) {
  1553. $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]] = [
  1554. "startTime" => $item["startTime"],
  1555. "endTime" => $item["endTime"],
  1556. "entryTime" => $item["entryTime"],
  1557. "isQuit" => $item["isQuit"]
  1558. ];
  1559. }
  1560. $tmpList[$item["id"]]["enterprise"][$item["enterpriseId"]]["projects"][$item["project"]] = $item["pre_months"];
  1561. }
  1562. $rows = [];
  1563. $colorset = [];
  1564. foreach ($tmpList as $id => $item) {
  1565. foreach ($item["enterprise"] as $enterpriseId => $enterprise) {
  1566. $row = $item["info"];
  1567. $row[] = $this->user["uid"] == $enterpriseId ? "本单位" : $enterpriseMap[$enterpriseId];
  1568. for ($i = 0; $i < count($projects); $i++) {
  1569. if (strpos($enterprise["projects"][$projects[$i]], "=") === false) {
  1570. $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
  1571. for ($m = 1; $m <= 12; $m++) {
  1572. $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
  1573. if (in_array($_month, $months)) {
  1574. $row[] = "✔";
  1575. $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
  1576. } else {
  1577. $row[] = "";
  1578. }
  1579. }
  1580. } else {
  1581. $months = array_filter(explode(",", $enterprise["projects"][$projects[$i]]));
  1582. $_months = [];
  1583. foreach ($months as $month) {
  1584. $kv = explode("=", $month);
  1585. $_months[$kv[0]] = $kv[1];
  1586. }
  1587. for ($m = 1; $m <= 12; $m++) {
  1588. $_month = str_pad($m, 2, "0", STR_PAD_LEFT);
  1589. $days = $_months[$_month];
  1590. if ($days && $days > 0) {
  1591. $row[] = $days . "天";
  1592. $colorset[] = [sprintf("%s%d", getExcelColumnByIndex($infoCols + $i * 12 + $m - 1), count($rows) + 3), "29dd23"];
  1593. } else {
  1594. $row[] = "";
  1595. }
  1596. }
  1597. }
  1598. }
  1599. $rows[] = $row;
  1600. }
  1601. }
  1602. $cols = $infoCols + count($projects) * 12 - 1;
  1603. $settings = [
  1604. "width" => [["A", 8], ["C", 12], ["D", 6], ["E", 20], ["F", 12], ["G", 70], ["H", 12], ["I", 15], ["J", 12], ["K", 12], ["P", 30]],
  1605. "height" => [18],
  1606. "freeze" => "D3",
  1607. "color" => $colorset
  1608. ];
  1609. for ($i = 0; $i < count($projects) * 12; $i++) {
  1610. $settings["width"][] = [getExcelColumnByIndex($infoCols + $i), 6]; //批设置项目的宽度
  1611. }
  1612. $settings["background-color"][] = [sprintf("%s2:%s2", getExcelColumnByIndex($infoCols), getExcelColumnByIndex($cols)), "E1F1DE"];
  1613. export($columns, $rows, "津补贴申报名单", $settings);
  1614. }
  1615. /**
  1616. * 校验是否在审核范围内
  1617. */
  1618. public function validateIsCheck() {
  1619. $id = $this->request["id"];
  1620. $process = $this->request["process"];
  1621. $compnayId = $this->request["companyId"];
  1622. $old = HouseApi::getInfoById($id);
  1623. $checkState = $old["checkState"];
  1624. $res = null;
  1625. switch ($process) {
  1626. case 1:
  1627. if ($checkState != HouseStateEnum::NEED_CHECK && $checkState != HouseStateEnum::REJECT_TO_FIRST && $checkState != HouseStateEnum::DEP_REJECT) {
  1628. return new Response(Response::ERROR, "该申报不在审核范围内,无法审核");
  1629. } else {
  1630. $log = TalentLogApi::getLastLogByStep($id, ProjectState::HOUSE, $process, 2);
  1631. if ($log) {
  1632. $old["checkState"] = $log["state"];
  1633. $old["checkMsg"] = $log["description"];
  1634. } else {
  1635. $old["checkState"] = null;
  1636. $old["checkMsg"] = "";
  1637. }
  1638. }
  1639. break;
  1640. case 2:
  1641. if ($checkState != HouseStateEnum::NEED_DEP_CHECK && $checkState != HouseStateEnum::REJECT_TO_DEP) {
  1642. return new Response(Response::ERROR, "该申报不在审核范围内,无法审核");
  1643. } else {
  1644. $where = [];
  1645. $where[] = ["mainId", "=", $id];
  1646. $where[] = ["companyId", "=", $compnayId];
  1647. $where[] = ["type", "=", ProjectState::HOUSE];
  1648. $depcheckstate = Db::table("un_talent_depcheckstate")->where($where)->find();
  1649. if ($depcheckstate["state"] != 1 && $depcheckstate["state"] != 4 && $depcheckstate["state"] != 9) {
  1650. return new Response(Response::ERROR, "该申报不在审核范围内,无法审核");
  1651. } else {
  1652. $log = TalentLogApi::getLastLogByStep($id, ProjectState::HOUSE, $process, 2, $compnayId);
  1653. if ($log) {
  1654. $old["checkState"] = $log["state"];
  1655. $old["checkMsg"] = $log["description"];
  1656. } else {
  1657. $old["checkState"] = null;
  1658. $old["checkMsg"] = "";
  1659. }
  1660. $res["company"] = getCacheById("Company", $compnayId);
  1661. }
  1662. }
  1663. break;
  1664. case 3:
  1665. if ($checkState != HouseStateEnum::NEED_REVIEW_CHECK && $checkState != HouseStateEnum::REJECT_TO_REVIEW) {
  1666. return new Response(Response::ERROR, "该申报不在审核范围内,无法审核");
  1667. } else {
  1668. $log = TalentLogApi::getLastLogByStep($id, ProjectState::HOUSE, $process, 2);
  1669. if ($log) {
  1670. $old["checkState"] = $log["state"];
  1671. $old["checkMsg"] = $log["description"];
  1672. } else {
  1673. $old["checkState"] = null;
  1674. $old["checkMsg"] = "";
  1675. }
  1676. }
  1677. break;
  1678. case 4:
  1679. if ($checkState != HouseStateEnum::REVIEW_PASS && $checkState != HouseStateEnum::NOTPASS) {
  1680. return new Response(Response::ERROR, "该申报不在审核范围内,无法审核");
  1681. } else if ($old["publicState"] != 3) {
  1682. return new Response(Response::ERROR, "该申报不在审核范围内,无法审核");
  1683. } else {
  1684. $log = TalentLogApi::getLastLogByStep($id, ProjectState::HOUSE, $process, 2);
  1685. if ($log) {
  1686. $old["checkState"] = $log["state"];
  1687. $old["checkMsg"] = $log["description"];
  1688. } else {
  1689. $old["checkState"] = null;
  1690. $old["checkMsg"] = "";
  1691. }
  1692. $housepurchase = [];
  1693. $this->calculate($old, $housepurchase, $decideDesc, 1);
  1694. if ($res->code == 500) {
  1695. return $res;
  1696. }
  1697. $res["housepurchase"] = $housepurchase;
  1698. }
  1699. break;
  1700. }
  1701. $where = [];
  1702. $where[] = ["type", "=", $old["type"]];
  1703. $where[] = ["project", "=", ProjectState::HOUSE];
  1704. $where[] = ["active", "=", 1];
  1705. $where[] = ["delete", "=", 0];
  1706. $filetypeList = Db::table("new_common_filetype")->where($where)->order("sn asc")->select()->toArray();
  1707. /* * 查询之前是否享受过 */
  1708. $count = HouseApi::getEnjoyTimesByIdCard($old["idCard"]);
  1709. $res["number"] = $count;
  1710. $res["obj"] = $old;
  1711. $res["fileTypeList"] = $filetypeList;
  1712. return new Response(Response::SUCCESS, "", $res);
  1713. }
  1714. /**
  1715. * 初始化可修改的项目/附件/合同
  1716. * */
  1717. public function findFieldsAndFiles() {
  1718. $id = $this->request["id"];
  1719. if (\StrUtil::isEmpOrNull($id)) {
  1720. return new Response(Response::ERROR, "请选择需要修改的对象");
  1721. }
  1722. $info = HouseApi::getInfoById($id);
  1723. if (!$info) {
  1724. return new Response(Response::ERROR, "系统错误,请联系管理员");
  1725. }
  1726. if ($info["checkState"] != HouseStateEnum::FIRST_REJECT) {
  1727. return new Response(Response::ERROR, "只能修改初审驳回的数据");
  1728. }
  1729. $res = [];
  1730. $where = [];
  1731. $where[] = ["type", "=", $info["type"]];
  1732. $where[] = ["project", "=", ProjectState::HOUSE];
  1733. $where[] = ["active", "=", 1];
  1734. $where[] = ["delete", "=", 0];
  1735. $filetypes = Db::table("new_common_filetype")->where($where)->order("sn asc")->select()->toArray();
  1736. $res["files"] = $filetypes;
  1737. $res["obj"] = $info;
  1738. return new Response(Response::SUCCESS, "", $res);
  1739. }
  1740. /**
  1741. * 修改驳回项目/附件/合同
  1742. * */
  1743. public function updateFieldsAndFiles() {
  1744. $data = $this->request->param();
  1745. if (!$data["id"]) {
  1746. return new Response(Response::ERROR, "系统错误,请联系管理员");
  1747. }
  1748. houseModel::update($data);
  1749. return new Response(Response::SUCCESS, "修改成功");
  1750. }
  1751. public function basicDataExport() {
  1752. $names = \StrUtil::getRequestDecodeParam($this->request, "names");
  1753. $values = \StrUtil::getRequestDecodeParam($this->request, "values");
  1754. $process = \StrUtil::getRequestDecodeParam($this->request, "process");
  1755. $where = [];
  1756. $obj = $this->setHousepurchase($this->request);
  1757. $obj["process"] = $process;
  1758. $obj["type"] = $this->user["type"];
  1759. $this->setCondition($where, $obj);
  1760. switch ($process) {
  1761. case 1:
  1762. break;
  1763. case 2:
  1764. break;
  1765. case 3:
  1766. $where[] = ["depPassTime", "EXP", Db::raw("is not null")];
  1767. break;
  1768. case 4:
  1769. $where[] = ["checkState", "in", [HouseStateEnum::NOTPASS, HouseStateEnum::REVIEW_PASS]];
  1770. $where[] = ["reviewPassTime", "EXP", Db::raw("is not null")];
  1771. break;
  1772. }
  1773. if (in_array($process, [1, 3, 4])) {
  1774. $list = houseModel::where($where)->order($order)->select()->toArray();
  1775. } else {
  1776. $company = getCacheById("Company", $this->user["companyId"]);
  1777. $result = HouseApi::selectForHousePurchase($obj, $company, ProjectState::HOUSE, 0, 99999);
  1778. $list = $result["rows"];
  1779. }
  1780. $list = $this->translateChinese($list, $process);
  1781. if ($list) {
  1782. $filename = "购房补贴导出";
  1783. $columns = array_filter(explode(",", $names));
  1784. $keys = array_filter(explode(",", $values));
  1785. $rows = [];
  1786. foreach ($list as $item) {
  1787. $row = [];
  1788. foreach ($keys as $key) {
  1789. $row[] = $item[$key];
  1790. }
  1791. $rows[] = $row;
  1792. }
  1793. export($columns, $rows, $filename);
  1794. exit();
  1795. } else {
  1796. $response = new Response(Response::ERROR, "没有可导出的内容");
  1797. return \StrUtil::back($response, "Housepurchase.callBack");
  1798. }
  1799. }
  1800. private function setCondition(&$where, &$query) {
  1801. if (\StrUtil::isNotEmpAndNull($query["year"])) {
  1802. $where[] = ["year", "=", $query["year"]];
  1803. }
  1804. if (\StrUtil::isNotEmpAndNull($query["name"])) {
  1805. $where[] = ["name", "like", "%" . $query["name"] . "%"];
  1806. }
  1807. if (\StrUtil::isNotEmpAndNull($query["idCard"])) {
  1808. $where[] = ["idCard", "like", "%" . $query["idCard"] . "%"];
  1809. }
  1810. if (\StrUtil::isNotEmpAndNull($query["talentArrange"])) {
  1811. $where[] = ["talentArrange", "=", $query["talentArrange"]];
  1812. }
  1813. if (\StrUtil::isNotEmpAndNull($query["spouseName"])) {
  1814. $where[] = ["spouseName", "like", "%" . $query["spouseName"] . "%"];
  1815. }
  1816. if (\StrUtil::isNotEmpAndNull($query["spouseIdcard"])) {
  1817. $where[] = ["spouseIdcard", "like", "%" . $query["spouseIdcard"] . "%"];
  1818. }
  1819. if (\StrUtil::isNotEmpAndNull($query["childName"])) {
  1820. $where[] = ["childName", "like", "%" . $query["childName"] . "%"];
  1821. }
  1822. if (\StrUtil::isNotEmpAndNull($query["childIdCard"])) {
  1823. $where[] = ["childIdCard", "like", "%" . $query["childIdCard"] . "%"];
  1824. }
  1825. if (\StrUtil::isNotEmpAndNull($query["marryStatus"])) {
  1826. $where[] = ["marryStatus", "=", $query["marryStatus"]];
  1827. }
  1828. if ($query["isConflict"]) {
  1829. $where[] = ["isConflict", "=", $query["isConflict"]];
  1830. }
  1831. if ($query["isRecover"]) {
  1832. $where[] = ["isRecover", "=", $query["isRecover"]];
  1833. }
  1834. if ($query["checkState"]) {
  1835. switch ($query["checkState"]) {
  1836. case -1:
  1837. $where[] = ["checkState", "=", HouseStateEnum::NOTPASS];
  1838. break;
  1839. case 1:
  1840. $where[] = ["checkState", "=", HouseStateEnum::SAVE];
  1841. break;
  1842. case 2:
  1843. switch ($query["process"]) {
  1844. case 1:
  1845. $where[] = ["checkState", "=", HouseStateEnum::NEED_CHECK];
  1846. $where[] = ["highProcess", "<", $query["process"]];
  1847. break;
  1848. case 2:
  1849. $query["state"] = 1;
  1850. break;
  1851. case 3:
  1852. $where[] = ["checkState", "=", HouseStateEnum::NEED_REVIEW_CHECK];
  1853. $where[] = ["highProcess", "<", $query["process"]];
  1854. break;
  1855. }
  1856. break;
  1857. case 3:
  1858. switch ($query["process"]) {
  1859. case 1:
  1860. $where[] = ["checkState", "=", HouseStateEnum::FIRST_REJECT];
  1861. break;
  1862. case 2:
  1863. $query["state"] = 2;
  1864. break;
  1865. case 3:
  1866. $where[] = ["checkState", "<=", HouseStateEnum::REJECT_TO_DEP];
  1867. break;
  1868. }
  1869. break;
  1870. case 4:
  1871. switch ($query["process"]) {
  1872. case 1:
  1873. $where[] = ["checkState", "in", [HouseStateEnum::NEED_DEP_CHECK, HouseStateEnum::REJECT_TO_DEP, HouseStateEnum::NEED_REVIEW_CHECK, HouseStateEnum::REVIEW_PASS]];
  1874. break;
  1875. case 2:
  1876. $query["state"] = 3;
  1877. break;
  1878. case 3:
  1879. case 4:
  1880. $where[] = ["checkState", "=", HouseStateEnum::REVIEW_PASS];
  1881. break;
  1882. }
  1883. break;
  1884. case 5:
  1885. switch ($query["process"]) {
  1886. case 1:
  1887. $where[] = ["checkState", "in", [HouseStateEnum::REJECT_TO_FIRST, HouseStateEnum::DEP_REJECT]];
  1888. break;
  1889. case 2:
  1890. $query["state"] = 4;
  1891. break;
  1892. case 3:
  1893. $where[] = ["checkState", "=", HouseStateEnum::REJECT_TO_REVIEW];
  1894. break;
  1895. }
  1896. break;
  1897. case 6:
  1898. switch ($query["process"]) {
  1899. case 1:
  1900. $where[] = ["checkState", "=", HouseStateEnum::NEED_CHECK];
  1901. $where[] = ["highProcess", ">=", $query["process"]];
  1902. break;
  1903. case 2:
  1904. $query["state"] = 9;
  1905. break;
  1906. case 3:
  1907. $where[] = ["checkState", "=", HouseStateEnum::NEED_REVIEW_CHECK];
  1908. $where[] = ["highProcess", ">=", $query["process"]];
  1909. break;
  1910. }
  1911. break;
  1912. }
  1913. }
  1914. }
  1915. private function translateToChinese(&$obj) {
  1916. if (\StrUtil::isNotEmpAndNull($obj["address"])) {
  1917. $obj["addressName"] = DictApi::findByParentCodeAndCode("street", $obj["address"])["name"];
  1918. }
  1919. if (\StrUtil::isNotEmpAndNull($obj["talentType"])) {
  1920. $obj["talentTypeName"] = DictApi::findByParentCodeAndCode("enterprise_tag", $obj["talentType"])["name"];
  1921. }
  1922. if (\StrUtil::isNotEmpAndNull($obj["talentArrange"])) {
  1923. $obj["talentArrangeName"] = DictApi::findByParentCodeAndCode("talent_arrange", $obj["talentArrange"])["name"];
  1924. }
  1925. if (\StrUtil::isNotEmpAndNull($obj["identifyCondition"])) {
  1926. $obj["identifyConditionText"] = \app\common\api\TalentConditionApi::getOne($obj["identifyCondition"])["name"];
  1927. }
  1928. if (\StrUtil::isNotEmpAndNull($obj["introductionMode"])) {
  1929. $obj["introductionModeName"] = DictApi::findByParentCodeAndCode("import_way", $obj["introductionMode"])["name"];
  1930. }
  1931. }
  1932. private function translateChinese($list, $process) {
  1933. //获取字典表
  1934. $marryMap = DictApi::selectByParentCode("marry_status");
  1935. $cardTypeMap = DictApi::selectByParentCode("card_type");
  1936. $streetMap = DictApi::selectByParentCode("street");
  1937. $levelMap = DictApi::selectByParentCode("talent_arrange");
  1938. $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
  1939. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  1940. $where = [];
  1941. $where[] = ["type", "=", $this->user["type"]];
  1942. $conditionMap = \app\common\model\TalentCondition::where($where)->column("name", "id");
  1943. $where = [];
  1944. $where[] = ["pId", "in", array_column($list, "id")];
  1945. $childrens = \app\common\model\HousePurchaseChildren::where($where)->select()->toArray();
  1946. $childMap = [];
  1947. foreach ($childrens as $child) {
  1948. $childMap[$child["pId"]][] = $child;
  1949. }
  1950. foreach ($list as &$info) {
  1951. $info["marryStatusName"] = $marryMap[$info["marryStatus"]];
  1952. $info["cardTypeName"] = $cardTypeMap[$info["cardType"]];
  1953. $info["spouseCardTypeName"] = $cardTypeMap[$info["spouseCardType"]];
  1954. $info["childCardTypeName"] = $cardTypeMap[$info["childCardType"]];
  1955. $info["streetName"] = $streetMap[$info["street"]];
  1956. $info["talentArrangeName"] = $levelMap[$info["talentArrange"]];
  1957. $info["identifyConditionCH"] = $conditionMap[$info["identifyCondition"]];
  1958. $info["talentTypeName"] = $talentTypeMap[$info["talentType"]];
  1959. $info["declareTypeName"] = $info["declareType"] == 1 ? "购房补贴" : "免租入住";
  1960. $info["enterpriseName"] = $enterpriseMap[$info["enterpriseId"]];
  1961. $info["isEnjoyOtherName"] = $info["isEnjoyOther"] == 1 ? "是" : "否";
  1962. $info["spouseIsLibraryName"] = $info["spouseIsLibrary"] == 1 ? "是" : "否";
  1963. $childs = $childMap[$info["id"]];
  1964. $childStr = "";
  1965. if ($childs) {
  1966. for ($i = 0; $i < count($childs); $i++) {
  1967. $childStr .= $childs[$i]["name"] . "-" . $childs[$i]["idCard"] . ";";
  1968. }
  1969. }
  1970. $info["childs"] = $childStr;
  1971. switch ($process) {
  1972. case 1:
  1973. if ($info["checkState"] == HouseStateEnum::NOTPASS) {
  1974. $info["checkStateName"] = "审核不通过";
  1975. }
  1976. if ($info["checkState"] == HouseStateEnum::SAVE) {
  1977. $info["checkStateName"] = "待提交";
  1978. }
  1979. if ($info["checkState"] == HouseStateEnum::NEED_CHECK) {
  1980. $info["checkStateName"] = $info["highProcess"] != null && $info["highProcess"] >= $process ? "重新提交" : "待审核";
  1981. }
  1982. if ($info["checkState"] == HouseStateEnum::FIRST_REJECT) {
  1983. $info["checkStateName"] = "已驳回";
  1984. }
  1985. if ($info["checkState"] == HouseStateEnum::REJECT_TO_FIRST || $info["checkState"] == HouseStateEnum::DEP_REJECT) {
  1986. $info["checkStateName"] = "上级驳回";
  1987. }
  1988. if ($info["checkState"] == HouseStateEnum::NEED_DEP_CHECK || $info["checkState"] >= HouseStateEnum::REJECT_TO_DEP) {
  1989. $info["checkStateName"] = "已通过";
  1990. }
  1991. break;
  1992. case 2:
  1993. if ($info["state"] == 1) {
  1994. $info["checkStateName"] = "待审核";
  1995. }
  1996. if ($info["state"] == 2) {
  1997. $info["checkStateName"] = "已驳回";
  1998. }
  1999. if ($info["state"] == 3) {
  2000. $info["checkStateName"] = "已通过";
  2001. }
  2002. if ($info["state"] == 4) {
  2003. $info["checkStateName"] = "上级驳回";
  2004. }
  2005. if ($info["state"] == 9) {
  2006. $info["checkStateName"] = "重新提交";
  2007. }
  2008. break;
  2009. case 3:
  2010. if ($info["checkState"] <= HouseStateEnum::REJECT_TO_DEP) {
  2011. $info["checkStateName"] = "已驳回";
  2012. } else if ($info["checkState"] == HouseStateEnum::NEED_REVIEW_CHECK) {
  2013. $info["checkStateName"] = $info["highProcess"] != null && $info["highProcess"] >= $process ? "重新提交" : "待审核";
  2014. } else if ($info["checkState"] == HouseStateEnum::REVIEW_PASS) {
  2015. $info["checkStateName"] = "已通过";
  2016. }
  2017. break;
  2018. case 4:
  2019. if ($info["checkState"] == HouseStateEnum::NOTPASS) {
  2020. $info["checkStateName"] = "审核不通过";
  2021. } else if ($info["checkState"] == HouseStateEnum::REVIEW_PASS) {
  2022. $info["checkStateName"] = "已通过";
  2023. }
  2024. break;
  2025. }
  2026. }unset($info);
  2027. return $list;
  2028. }
  2029. private function getCheckStateName($checkState, $publicState, $allowanceType) {
  2030. switch ($checkState) {
  2031. case 1:
  2032. return "待提交";
  2033. case 5:
  2034. case 13:
  2035. case 15:
  2036. case 20:
  2037. case 25:
  2038. case 35:
  2039. return "审核中";
  2040. case 10:
  2041. return "已驳回";
  2042. case - 1:
  2043. if ($publicState >= 3) {
  2044. return "审核不通过";
  2045. } else {
  2046. return "审核中";
  2047. }
  2048. break;
  2049. case 30:
  2050. if ($publicState == 1) {
  2051. return "待核查征信";
  2052. } else if ($publicState == 2) {
  2053. return "待公示";
  2054. } else if ($publicState == 3) {
  2055. return "公示中";
  2056. } else if ($publicState == 4) {
  2057. return $allowanceType != 3 ? "待兑现" : "不予兑现";
  2058. } else if ($publicState == 5) {
  2059. return "已兑现";
  2060. }
  2061. default:
  2062. return "未知状态";
  2063. }
  2064. }
  2065. /**
  2066. * @param $old 原来的记录
  2067. * @param $housepurchase 新的记录
  2068. * @param $descideDesc 记录文本
  2069. * @param $type 1-复核阶段,不生成享受人的剩余享受金额记录,2-公示再审核阶段,生成享受记录
  2070. * @description 计算购房补贴金额
  2071. * */
  2072. private function calculate($old, &$housepurchase = [], &$descideDesc = [], $type = 1) {
  2073. /* * 1、查询申报人和配偶的房产信息 */
  2074. $houseInfo = HouseApi::getHouseInfo($old["idCard"]);
  2075. $spouseHouseInfo = HouseApi::getHouseInfo($old["spouseIdCard"]);
  2076. if (!$houseInfo) {
  2077. $houseInfo = [
  2078. "idCard" => $old["idCard"],
  2079. "spouseIdCard" => null,
  2080. "houseAddress" => $old["houseAddress"],
  2081. "houseArea" => $old["houseArea"],
  2082. "houseMoney" => $old["houseMoney"],
  2083. "recordTime" => $old["recordTime"],
  2084. "realEstateNo" => $old["realEstateNo"],
  2085. "recordNo" => $old["recordNo"],
  2086. "balanceMoney" => $old["houseMoney"],
  2087. "count" => 0,
  2088. "lastYearArrears" => 0
  2089. ];
  2090. }
  2091. //判断是否超过五次申报
  2092. if ($houseInfo["balanceMoney"] <= 0) {
  2093. return new Response(Response::ERROR, "申报房产可享受余额不足,无法享受");
  2094. }
  2095. /* * 2.查询购房补贴费用标准,根据人才层次计算可享受金额 */
  2096. $amountStandard = \app\common\api\AmountStandardApi::getStandard($this->user["type"], 3, $old["talentArrange"]);
  2097. if (!$amountStandard)
  2098. return new Response(Response::ERROR, "系统暂未设置该人才层次的购房补贴享受金额,请设置后再提交");
  2099. $code = "housepurchase_percentage_";
  2100. switch ($old["type"]) {
  2101. case CommonConst::ENTERPRISE_NORMAL:
  2102. $code .= "normal";
  2103. break;
  2104. case CommonConst::ENTERPRISE_JC:
  2105. $code .= "ic";
  2106. break;
  2107. case CommonConst::ENTERPRISE_WJ:
  2108. $code .= "wj";
  2109. break;
  2110. case CommonConst::ENTERPRISE_GJ:
  2111. $code .= "gj";
  2112. break;
  2113. }
  2114. $dic = DictApi::findByParentCodeAndCode($code, $houseInfo["count"] + 1);
  2115. if (!$dic)
  2116. return new Response(Response::ERROR, "系统字典中暂未设置购房补贴年度比例,请设置后再提交。");
  2117. $count = count(DictApi::findChildDictByCode($code));
  2118. if ($houseInfo["count"] >= $count) {
  2119. return new Response(Response::ERROR, "申报人已享受五次购房补贴,无法再次享受");
  2120. }
  2121. if (!is_numeric($dic["name"]) || $dic["name"] > 1 || $dic["name"] < 0)
  2122. return new Response(Response::ERROR, "系统字典中设置的购房补贴年度比例应该是介于0~1之间的数字");
  2123. $housepurchase["talentArrangeMoney"] = round($dic["name"] * $amountStandard["money"], 2);
  2124. /* * 3.计算当年度录入享受其他政策的金额 */
  2125. $otherList = HouseApi::getEnjoyOtherList($old["id"]);
  2126. $housepurchase["nowOtherMoney"] = 0;
  2127. foreach ($otherList as $other) {
  2128. $housepurchase["nowOtherMoney"] += $other["money"];
  2129. }
  2130. $lastOtherMoney = $spouseHouseInfo ? $houseInfo["lastYearArrears"] + $spouseHouseInfo["lastYearArrears"] : $houseInfo["lastYearArrears"];
  2131. $housepurchase["lastOtherMoney"] = round($lastOtherMoney, 2);
  2132. $totalOtherMoney = round($housepurchase["nowOtherMoney"] + $housepurchase["lastOtherMoney"], 2);
  2133. /* * 计算当前人才层次可享受金额 */
  2134. $balanceMoney = round($amountStandard["money"] - ($houseInfo["houseMoney"] - $houseInfo["balanceMoney"]), 2);
  2135. /* * 判断余额 */
  2136. $balanceMoney = $balanceMoney >= $houseInfo["balanceMoney"] ? $houseInfo["balanceMoney"] : $balanceMoney;
  2137. if ($balanceMoney <= 0) {
  2138. $descideDesc[] = "可享受余额为:" . $balanceMoney . "元;";
  2139. /* * 判断享受其他政策是否大于0 */
  2140. if ($totalOtherMoney > 0) {
  2141. $housepurchase["isRecover"] = 1;
  2142. $descideDesc[] = "需要追讨金额为:" . $totalOtherMoney . "元;";
  2143. }
  2144. $housepurchase["shouldEnjoyMoney"] = 0;
  2145. $housepurchase["realEnjoyMoney"] = 0;
  2146. $housepurchase["nowSubOtherMoney"] = 0;
  2147. $housepurchase["nowNotSubOtherMoney"] = $totalOtherMoney;
  2148. } else {
  2149. /* * 比较余额和人才层次金额的20% */
  2150. $housepurchase["shouldEnjoyMoney"] = $balanceMoney >= $housepurchase["talentArrangeMoney"] ? $housepurchase["talentArrangeMoney"] : $balanceMoney;
  2151. /* * 计算可享受金额 */
  2152. $realEnjoyMoney = $housepurchase["shouldEnjoyMoney"] - $totalOtherMoney;
  2153. if ($realEnjoyMoney == 0) {
  2154. $housepurchase["realEnjoyMoney"] = $realEnjoyMoney;
  2155. $housepurchase["nowSubOtherMoney"] = $totalOtherMoney;
  2156. $housepurchase["nowNotSubOtherMoney"] = $realEnjoyMoney;
  2157. /* * 扣除个人剩余金额 ,扣除房产享受金额 ,删除申报人为扣除其他政策记录(因为本次已扣完) */
  2158. } else if ($realEnjoyMoney > 0) {
  2159. $housepurchase["realEnjoyMoney"] = $realEnjoyMoney;
  2160. $housepurchase["nowSubOtherMoney"] = $totalOtherMoney;
  2161. $housepurchase["nowNotSubOtherMoney"] = 0;
  2162. /* * 扣除个人剩余金额 ,扣除房产享受金额 ,删除申报人为扣除其他政策记录(因为本次已扣完) */
  2163. } else if ($realEnjoyMoney < 0) {
  2164. $housepurchase["isRecover"] = 1;
  2165. $descideDesc[] = "需要追讨金额为:" . abs($realEnjoyMoney) . "元;";
  2166. $housepurchase["realEnjoyMoney"] = 0;
  2167. $housepurchase["nowSubOtherMoney"] = $housepurchase["shouldEnjoyMoney"];
  2168. $housepurchase["nowNotSubOtherMoney"] = abs($realEnjoyMoney);
  2169. /* * 扣除个人剩余金额 ,扣除房产享受金额 ,删除申报人为扣除其他政策记录并生成新的未扣除记录 */
  2170. }
  2171. if ($type == 2) {
  2172. $houseInfo["count"] = $houseInfo["count"] + 1;
  2173. $houseInfo["balanceMoney"] = round($houseInfo["balanceMoney"] - $housepurchase["shouldEnjoyMoney"], 2);
  2174. $houseInfo["lastYearArrears"] = $housepurchase["nowSubOtherMoney"];
  2175. if (\StrUtil::isNotEmpAndNull($housepurchase["spouseIdcard"])) {
  2176. if (!$spouseHouseInfo) {
  2177. $spouseHouseInfo = [
  2178. "idCard" => $old["spouseIdcard"],
  2179. "spouseIdCard" => null,
  2180. "houseAddress" => $old["houseAddress"],
  2181. "houseArea" => $old["houseArea"],
  2182. "houseMoney" => $old["houseMoney"],
  2183. "recordTime" => $old["recordTime"],
  2184. "realEstateNo" => $old["realEstateNo"],
  2185. "recordNo" => $old["recordNo"],
  2186. "balanceMoney" => $houseInfo["balanceMoney"],
  2187. "count" => $houseInfo["count"],
  2188. "lastYearArrears" => $houseInfo["lastYearArrears"]
  2189. ];
  2190. } else {
  2191. $spouseHouseInfo["count"] = $spouseHouseInfo["count"] + 1;
  2192. $spouseHouseInfo["lastYearArrears"] = $houseInfo["lastYearArrears"];
  2193. $spouseHouseInfo["balanceMoney"] = $spouseHouseInfo["balanceMoney"] - $housepurchase["shouldEnjoyMoney"];
  2194. }
  2195. if ($spouseHouseInfo["id"]) {
  2196. $spouseHouseInfo["updateTime"] = date("Y-m-d H:i:s");
  2197. $spouseHouseInfo["updateUser"] = $this->user["uid"];
  2198. houseInfoModel::update($spouseHouseInfo);
  2199. } else {
  2200. $spouseHouseInfo["id"] = getStringId();
  2201. $spouseHouseInfo["createTime"] = date("Y-m-d H:i:s");
  2202. $spouseHouseInfo["createUser"] = $this->user["uid"];
  2203. houseInfoModel::insert($spouseHouseInfo);
  2204. }
  2205. }
  2206. if ($houseInfo["id"]) {
  2207. $houseInfo["updateTime"] = date("Y-m-d H:i:s");
  2208. $houseInfo["updateUser"] = $this->user["uid"];
  2209. houseInfoModel::update($houseInfo);
  2210. } else {
  2211. $houseInfo["id"] = getStringId();
  2212. $houseInfo["createTime"] = date("Y-m-d H:i:s");
  2213. $houseInfo["createUser"] = $this->user["uid"];
  2214. houseInfoModel::insert($houseInfo);
  2215. }
  2216. }
  2217. }
  2218. $housepurchase["decideDetail"] = $old["decideDetail"] . ($descideDesc ? implode("", $descideDesc) : "");
  2219. return new Response(Response::SUCCESS, "", $housepurchase);
  2220. }
  2221. private function calculateOld($old, &$housepurchase = [], &$descideDesc = [], $type = 1) {
  2222. $count = $old["type"] == 1 ? 5 : 3; //最大申报数
  2223. /* * 1、查询享受人可享受的金额(可能存在多人),无记录则生成数据,并判断是否超过申报次数 */
  2224. $cashIdCard = explode(",", $old["cashIdCards"]);
  2225. $personMoneyDict = [];
  2226. foreach ($cashIdCard as $idCard) {
  2227. $where = [];
  2228. $where[] = ["code", "=", $idCard];
  2229. $where[] = ["type", "=", 1];
  2230. $dict = Db::table("un_house_money_dict")->where($where)->find();
  2231. if (!$dict) {
  2232. $dict = [
  2233. "id" => getStringId(),
  2234. "type" => 1,
  2235. "code" => $idCard,
  2236. "total" => $old["houseMoney"],
  2237. "balance" => $old["houseMoney"],
  2238. "count" => 0,
  2239. "createTime" => date("Y-m-d H:i:s"),
  2240. "createUser" => $this->user["uid"]
  2241. ];
  2242. }
  2243. $personMoneyDict[] = $dict;
  2244. }
  2245. $personMoneyMap = [];
  2246. foreach ($personMoneyDict as $hmd) {
  2247. $personMoneyMap[$hmd["code"]] = $hmd;
  2248. }
  2249. $personDict = $personMoneyMap[$old["idCard"]];
  2250. if ($personDict && $personDict[$old["idCard"]] >= $count) {
  2251. return new Response(Response::ERROR, "申报人已享受" . $count . "次购房补贴,无法再次享受");
  2252. }
  2253. $housepurchase["totalMoney"] = $personDict["total"];
  2254. }
  2255. private function setHousepurchase($request) {
  2256. $name = \StrUtil::getRequestDecodeParam($request, "name");
  2257. $idCard = \StrUtil::getRequestDecodeParam($request, "idCard");
  2258. $yearStr = \StrUtil::getRequestDecodeParam($request, "year");
  2259. $talentArrangeStr = \StrUtil::getRequestDecodeParam($request, "talentArrange");
  2260. $spouseName = \StrUtil::getRequestDecodeParam($request, "spouseName");
  2261. $spouseIdcard = \StrUtil::getRequestDecodeParam($request, "spouseIdcard");
  2262. $childName = \StrUtil::getRequestDecodeParam($request, "childName");
  2263. $childIdCard = \StrUtil::getRequestDecodeParam($request, "childIdCard");
  2264. $marryStatus = \StrUtil::getRequestDecodeParam($request, "marryStatus");
  2265. $checkStateStr = \StrUtil::getRequestDecodeParam($request, "checkState");
  2266. $isConflictStr = \StrUtil::getRequestDecodeParam($request, "isConflict");
  2267. $isRecoverStr = \StrUtil::getRequestDecodeParam($request, "isRecover");
  2268. $talentArrange = null;
  2269. $year = null;
  2270. $checkState = null;
  2271. $isRecover = null;
  2272. $isConflict = null;
  2273. if (\StrUtil::isNotEmpAndNull($talentArrangeStr)) {
  2274. $talentArrange = intval($talentArrangeStr);
  2275. }
  2276. if (\StrUtil::isNotEmpAndNull($yearStr)) {
  2277. $year = intval($yearStr);
  2278. }
  2279. if (\StrUtil::isNotEmpAndNull($checkStateStr)) {
  2280. $checkState = intval($checkStateStr);
  2281. }
  2282. if (\StrUtil::isNotEmpAndNull($isConflictStr)) {
  2283. $isConflict = intval($isConflictStr);
  2284. }
  2285. if (\StrUtil::isNotEmpAndNull($isRecoverStr)) {
  2286. $isRecover = intval($isRecoverStr);
  2287. }
  2288. $obj = ["year" => $year,
  2289. "name" => $name, "cardType" => null, "idCard" => $idCard, "talentArrange" => $talentArrange,
  2290. "spouseName" => $spouseName, "spouseIdcard" => $spouseIdcard, "childName" => $childName, "childIdCard" => $childIdCard,
  2291. "marryStatus" => $marryStatus, "checkState" => $checkState, "publicState" => null, "cashType" => null, "isRecover" => $isRecover, "isConflict" => $isConflict];
  2292. return $obj;
  2293. }
  2294. }