Talent.php 93 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952
  1. <?php
  2. namespace app\enterprise\controller;
  3. use app\common\api\EducationApi;
  4. use app\enterprise\common\EnterpriseController;
  5. use app\enterprise\api\TalentApi;
  6. use app\enterprise\model\Talent as TalentModel;
  7. use think\facade\Db;
  8. use think\facade\Log;
  9. use app\common\api\EnterpriseApi;
  10. use app\common\api\DictApi;
  11. use app\common\api\TalentLogApi;
  12. use app\common\api\TalentState;
  13. use think\exception\ValidateException;
  14. use app\enterprise\validate\TalentInfo;
  15. use app\common\state\ProjectState;
  16. use app\common\api\BatchApi;
  17. use app\common\state\CommonConst;
  18. use app\common\api\TalentConditionApi;
  19. // 0正在填写 1保存未提交 2已提交未审核 3已审核 4驳回 5保存补充材料未提交 6提交补充材料进入初审 7初审通过 8初审驳回 9部门审核通过 10部门审核驳回 11复核通过 12复核驳回 13复核失败
  20. /**
  21. * Description of Talent
  22. *
  23. * @author sgq
  24. */
  25. class Talent extends EnterpriseController {
  26. public function index() {
  27. $isMix = $this->request->param("isMix");
  28. $tpl = "";
  29. if ($isMix == 1) {
  30. $tpl = "newIndex";
  31. }
  32. switch ($this->user["type"]) {
  33. case CommonConst::ENTERPRISE_WJ:
  34. $tpl = "/talent/hospital/index";
  35. break;
  36. }
  37. return view($tpl, ['type' => $this->user["type"]]);
  38. }
  39. public function list() {
  40. $step = 2;
  41. $res = TalentApi::getList($this->request, $step);
  42. return json($res);
  43. }
  44. public function zrIndex() {
  45. return view();
  46. }
  47. /**
  48. * 新人才申报企业端统一申报入口,混合基础信息及人才信息
  49. */
  50. public function apply(\think\Request $request) {
  51. $type = $this->user["type"];
  52. $tpl = "";
  53. switch ($type) {
  54. case CommonConst::ENTERPRISE_NORMAL:
  55. $tpl = "apply"; //晋江人才
  56. break;
  57. case CommonConst::ENTERPRISE_JC:
  58. $tpl = "ic_apply"; //集成电路
  59. break;
  60. case CommonConst::ENTERPRISE_WJ:
  61. $tpl = "/talent/hospital/apply"; //卫健医院
  62. break;
  63. case CommonConst::ENTERPRISE_GJ:
  64. $tpl = "/talent/school/apply"; //高教学校
  65. break;
  66. }
  67. $param = $request->param();
  68. $id = isset($param["id"]) ? $param["id"] : 0;
  69. $info = \app\common\api\VerifyApi::getTalentInfoById($id);
  70. if ($info["isImport"]) {
  71. //$tpl = "no_file_apply"; //晋江人才
  72. }
  73. $ep = EnterpriseApi::getOne($this->user["uid"]);
  74. if (!chkEnterpriseFull($ep))
  75. return;
  76. $tagList = DictApi::selectByParentCode('enterprise_tag');
  77. $streetList = DictApi::selectByParentCode('street');
  78. $industryFieldNew = DictApi::selectByParentCode('industry_field');
  79. $ep->enterpristTagName = $tagList[$ep->enterpriseTag];
  80. $ep->streetName = $streetList[$ep->street];
  81. $ep->industryFieldNewName = $industryFieldNew[$ep->industryFieldNew];
  82. if ($info) {
  83. $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
  84. }
  85. if ($info && in_array($info["checkState"], [TalentState::FST_VERIFY_PASS, TalentState::DEPT_VERIFY_PASS, TalentState::REVERIFY_PASS, TalentState::REVERIFY_FAIL])) {
  86. return $this->view($request);
  87. exit();
  88. }
  89. if ($request->isPost()) {
  90. $checkState = $info["checkState"] ?: 0;
  91. if ($checkState == TalentState::SCND_SAVE || $checkState == TalentState::FST_SAVE || $checkState == 0) {
  92. switch ($type) {
  93. case CommonConst::ENTERPRISE_NORMAL:
  94. $this->mixSave($info, $request, TalentState::SCND_SAVE);
  95. exit();
  96. break;
  97. case CommonConst::ENTERPRISE_JC:
  98. $this->icSave($info, $request, TalentState::SCND_SAVE);
  99. exit();
  100. break;
  101. case CommonConst::ENTERPRISE_WJ:
  102. if ($ep->isGeneral == 1 || ($ep->isGeneral == 2 && !\app\common\api\Nhc::hasGeneralHospital($ep->medicalCommunityId))) {
  103. $this->wjSave($info, $request, TalentState::SCND_SAVE);
  104. } else {
  105. $this->wjSave($info, $request, TalentState::FST_SAVE);
  106. }
  107. exit();
  108. break;
  109. case CommonConst::ENTERPRISE_GJ:
  110. $this->gjSave($info, $request, TalentState::SCND_SAVE);
  111. exit();
  112. break;
  113. }
  114. } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL])) {
  115. $res = ["msg" => "审核不通过,不能再保存"];
  116. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  117. exit;
  118. }
  119. $res = ["msg" => "已提交审核,请耐心等待"];
  120. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  121. exit;
  122. }
  123. $checkState = $info["checkState"] ?: 0;
  124. $batch = $info["apply_year"] ?: BatchApi::getValidBatch(ProjectState::TALENT, $this->user["type"])["batch"];
  125. $info["enterprise"] = $ep;
  126. if ($type == CommonConst::ENTERPRISE_WJ) {
  127. $info["talent_type_list"] = DictApi::findChildDictByCode("wj_talent_type");
  128. } else {
  129. $info["talent_type_list"] = DictApi::findChildDictByCode("talent_type");
  130. }
  131. if ($info["talent_condition"]) {
  132. $info["isSalary"] = TalentConditionApi::getOne($info["talent_condition"])["isSalary"] ?: 0;
  133. }
  134. return view($tpl, ["year" => $batch, "checkState" => $checkState, "row" => $info]);
  135. }
  136. /**
  137. * 旧第二步
  138. * @param \think\Request $request
  139. * @return type
  140. */
  141. public function second(\think\Request $request) {
  142. if ($this->user["type"] != 1)
  143. return "此入口仅供晋江市人才申报,晋江集成电路人才请使用新统一申报入口";
  144. $params = $request->param();
  145. $id = $params["id"];
  146. $info = \app\common\api\VerifyApi::getTalentInfoById($id);
  147. $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
  148. if ($request->isPost()) {
  149. if (!$info || $info["enterprise_id"] != $this->user["uid"]) {
  150. $res = ["msg" => "没有对应的人才认定申报信息"];
  151. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  152. exit;
  153. }
  154. $checkState = $info["checkState"];
  155. if ($checkState == TalentState::SCND_SAVE || $checkState == TalentState::BASE_REVERIFY_PASS) {
  156. $this->save($info, $request, TalentState::SCND_SAVE);
  157. exit();
  158. } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL])) {
  159. $res = ["msg" => "审核不通过,不能再保存"];
  160. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  161. exit;
  162. }
  163. $res = ["msg" => "已提交审核,请耐心等待"];
  164. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  165. exit;
  166. }
  167. $enterprise_info = \app\common\model\Enterprise::find($this->user["uid"]);
  168. $info["enterprise"] = $enterprise_info;
  169. $batch = $info["apply_year"] ?: BatchApi::getValidBatch(ProjectState::TALENT, $enterprise_info["type"])["batch"];
  170. return view("second", ["year" => $batch, "row" => $info]);
  171. }
  172. public function view(\think\Request $request) {
  173. switch ($this->user["type"]) {
  174. case CommonConst::ENTERPRISE_NORMAL:
  175. $tpl = "view"; //晋江人才
  176. break;
  177. case CommonConst::ENTERPRISE_JC:
  178. $tpl = "ic_view"; //集成电路
  179. break;
  180. case CommonConst::ENTERPRISE_WJ:
  181. $tpl = "/talent/hospital/view"; //卫健医院
  182. break;
  183. case CommonConst::ENTERPRISE_GJ:
  184. $tpl = "/talent/school/view"; //高教学校
  185. break;
  186. }
  187. $id = $request->param("id");
  188. $info = \app\common\api\VerifyApi::getTalentInfoById($id);
  189. if ($info["isImport"]) {
  190. //$tpl = "no_file_view";
  191. }
  192. return view($tpl, ["row" => $info]);
  193. }
  194. /**
  195. * 提交表单(旧第二步)
  196. */
  197. public function submit() {
  198. $params = $this->request->param();
  199. $id = $params["id"];
  200. if (!$info = TalentApi::chkIsOwner($id, $this->user["uid"])) {
  201. $res = ["msg" => "没有对应的人才认定申报信息"];
  202. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  203. exit;
  204. }
  205. if ($info) {
  206. $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
  207. }
  208. $checkState = $info["checkState"];
  209. if ($checkState == TalentState::SCND_SAVE || $checkState == TalentState::BASE_REVERIFY_PASS) {
  210. $field_dict = \app\common\api\DictApi::getTalentFields(2);
  211. $no_empty = ["talent_arrange", "talent_condition", "highest_degree", "graduate_school", "major", "bank", "bank_number", "bank_branch_name",
  212. "bank_account", "study_abroad", "phone", "email", "import_way", "cur_entry_time", "cur_entry_time", "position", "source"];
  213. $where = [];
  214. $where[] = ["rel", "=", "study_abroad"];
  215. $where[] = ["step", "=", 2];
  216. $where[] = ["project", "=", 1];
  217. $where[] = ["active", "=", 1];
  218. $where[] = ["delete", "=", 0];
  219. $where[] = ["type", "=", $this->user["type"]];
  220. $where[] = ["isConditionFile", "<>", 1];
  221. $abroad_files = Db::table("new_common_filetype")->where($where)->select()->toArray(); //留学的附件
  222. $abroad_file_ids = null;
  223. if ($abroad_files)
  224. $abroad_file_ids = array_column($abroad_files, "id");
  225. if ($params["study_abroad"] == 1) {
  226. $no_empty[] = "abroad_school";
  227. $no_empty[] = "abroad_major";
  228. }
  229. if (in_array($params["source"], [1, 3])) {
  230. $no_empty[] = "source_batch";
  231. $no_empty[] = "fujian_highcert_pubtime";
  232. $no_empty[] = "fujian_highcert_exptime";
  233. if ($params["source"] == 3) {
  234. $no_empty[] = "source_city";
  235. }
  236. }
  237. if (in_array($params["source"], [2, 4])) {
  238. $no_empty[] = "source_batch";
  239. $no_empty[] = "quanzhou_highcert_pubtime";
  240. $no_empty[] = "quanzhou_highcert_exptime";
  241. if ($params["source"] == 4) {
  242. $no_empty[] = "source_county";
  243. }
  244. }
  245. $condition_info = Db::table("new_talent_condition")->findOrEmpty($params["talent_condition"]);
  246. if ($condition_info["isSalary"] == 1) {
  247. $no_empty[] = "annual_salary";
  248. }
  249. $no_empty = array_filter($no_empty);
  250. $return = [];
  251. foreach ($no_empty as $key) {
  252. if (!$params[$key]) {
  253. $return[] = sprintf("请填写“%s”", $field_dict[$key]);
  254. }
  255. }
  256. if (count($return) > 0) {
  257. $res = ["msg" => implode("<br>", $return)];
  258. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  259. exit;
  260. }
  261. if ($condition_info["bindFileTypes"] && in_array($info["source"], [3, 4, 5])) {
  262. $whr[] = ["id", "in", $condition_info["bindFileTypes"]];
  263. $whr[] = ["must", "=", 1];
  264. }
  265. $where = [];
  266. $where[] = ["step", "=", 2];
  267. $where[] = ["project", "=", 1];
  268. $where[] = ["type", "=", $this->user["type"]];
  269. $where[] = ["must", "=", 1];
  270. $where[] = ["active", "=", 1];
  271. $where[] = ["delete", "=", 0];
  272. $where[] = ["isConditionFile", "<>", 1];
  273. if ($whr) {
  274. $filetypes = Db::table("new_common_filetype")->whereOr([$where, $whr])->select()->toArray();
  275. } else {
  276. $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
  277. }
  278. $ft_ids = array_column($filetypes, "id");
  279. if ($params["study_abroad"] == 1) {
  280. //选中留学,如果存在留学附件变成必传
  281. $ft_ids = array_unique(array_merge($ft_ids, (array) $abroad_file_ids));
  282. } else {
  283. //没选中,留学附件就算设成必传也不用验证
  284. $ft_ids = array_diff($ft_ids, (array) $abroad_file_ids);
  285. }
  286. $whr = [];
  287. $whr[] = ["typeId", "in", $ft_ids];
  288. $whr[] = ["mainId", "=", $id];
  289. $distinct_filetypes = Db::table("new_talent_file")->where($whr)->distinct(true)->field("typeId")->select();
  290. $upload_type_counts = count($distinct_filetypes);
  291. if ($upload_type_counts != count($ft_ids)) {
  292. $res = ["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"];
  293. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  294. exit;
  295. }
  296. $this->save($info, $this->request, TalentState::SCND_SUBMIT);
  297. } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL])) {
  298. $res = ["msg" => "审核不通过,不能再提交审核"];
  299. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  300. exit;
  301. }
  302. $res = ["msg" => "已提交审核,请耐心等待"];
  303. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  304. exit;
  305. }
  306. public function submitToCheck() {
  307. switch ($this->user["type"]) {
  308. case CommonConst::ENTERPRISE_NORMAL:
  309. return $this->submitToCheck_JJRC();
  310. case CommonConst::ENTERPRISE_JC:
  311. return $this->submitToCheck_IC();
  312. case CommonConst::ENTERPRISE_WJ:
  313. return $this->submitToCheck_WJ();
  314. case CommonConst::ENTERPRISE_GJ:
  315. return $this->submitToCheck_GJ();
  316. }
  317. }
  318. /**
  319. * 提交表单(新:混合基础信息人才申报信息)晋江人才
  320. */
  321. private function submitToCheck_JJRC() {
  322. $params = $this->request->param();
  323. $id = $params["id"];
  324. $info = TalentApi::chkIsOwner($id, $this->user["uid"]);
  325. if ($info) {
  326. $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
  327. }
  328. $checkState = $info["checkState"];
  329. if ($checkState == TalentState::SCND_SAVE || !$id) {
  330. $field_dict = \app\common\api\DictApi::getTalentFields(4, $info["isImport"]);
  331. $no_empty = ["name", "nation", "card_type", "card_number", "sex", "birthday", "politics", "nationality", "province", "city", "talent_type", "experience", "education",
  332. "talent_arrange", "talent_condition", "identifyGetTime", "bank", "bank_number", "bank_branch_name",
  333. "bank_account", "study_abroad", "phone", "email", "import_way", "cur_entry_time", "cur_entry_time", "position", "source"]; //"highest_degree", "graduate_school", "major",
  334. $where = [];
  335. $where[] = ["rel", "=", "study_abroad"];
  336. $where[] = ["project", "=", 1];
  337. $where[] = ["active", "=", 1];
  338. $where[] = ["delete", "=", 0];
  339. $where[] = ["type", "=", $this->user["type"]];
  340. $where[] = ["isConditionFile", "<>", 1];
  341. $abroad_files = Db::table("new_common_filetype")->where($where)->select()->toArray(); //留学的附件
  342. $abroad_file_ids = null;
  343. if ($abroad_files)
  344. $abroad_file_ids = array_column($abroad_files, "id");
  345. if (in_array($params["talent_type"], [1, 2])) {
  346. $no_empty[] = "tax_insurance_month";
  347. $no_empty[] = "labor_contract_rangetime";
  348. }
  349. if ($params["talent_type"] == 3) {
  350. $no_empty[] = "pre_import_type";
  351. }
  352. if ($params["study_abroad"] == 1) {
  353. $no_empty[] = "abroad_school";
  354. $no_empty[] = "abroad_major";
  355. }
  356. if (in_array($params["source"], [1, 3])) {
  357. //$no_empty[] = "source_batch";
  358. //$no_empty[] = "fujian_highcert_pubtime";
  359. //$no_empty[] = "fujian_highcert_exptime";
  360. if ($params["source"] == 3) {
  361. $no_empty[] = "source_city";
  362. }
  363. }
  364. if (in_array($params["source"], [2, 4])) {
  365. //$no_empty[] = "source_batch";
  366. //$no_empty[] = "quanzhou_highcert_pubtime";
  367. //$no_empty[] = "quanzhou_highcert_exptime";
  368. if ($params["source"] == 4) {
  369. $no_empty[] = "source_county";
  370. }
  371. }
  372. $condition_info = Db::table("new_talent_condition")->findOrEmpty($params["talent_condition"]);
  373. if ($condition_info["isSalary"] == 1) {
  374. $no_empty[] = "annual_salary";
  375. }
  376. $no_empty = array_filter($no_empty);
  377. $return = [];
  378. foreach ($no_empty as $key) {
  379. if (!$params[$key]) {
  380. $return[] = sprintf("请填写“%s”", $field_dict[$key]);
  381. }
  382. }
  383. if (count($return) > 0) {
  384. $res = ["msg" => implode("<br>", $return)];
  385. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  386. exit;
  387. }
  388. $isMatchZhiren = $info["isImport"] && $params["isMatchZhiren"] == 1 ? true : false;
  389. if ($condition_info["bindFileTypes"] && in_array($info["source"], [3, 4, 5]) && !$isMatchZhiren) {
  390. $whr[] = ["id", "in", $condition_info["bindFileTypes"]];
  391. $whr[] = ["must", "=", 1];
  392. }
  393. $where = [];
  394. $where[] = ["project", "=", 1];
  395. $where[] = ["type", "=", $this->user["type"]];
  396. $where[] = ["must", "=", 1];
  397. $where[] = ["active", "=", 1];
  398. $where[] = ["delete", "=", 0];
  399. $where[] = ["isConditionFile", "<>", 1];
  400. if ($whr) {
  401. $filetypes = Db::table("new_common_filetype")->whereOr([$where, $whr])->select()->toArray();
  402. } else {
  403. $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
  404. }
  405. $age = 0;
  406. if ($params["birthday"]) {
  407. $birthtime = strtotime($params["birthday"]);
  408. $currentYear = date("Y");
  409. $currentMonth = date("n");
  410. $birthdayYear = date("Y", $birthtime);
  411. $birthdayMonth = date("n", $birthtime);
  412. $age = ($currentYear * 12 + $currentMonth - $birthdayYear * 12 - $birthdayMonth) / 12;
  413. }
  414. $ft_ids = [];
  415. $deletes = [];
  416. foreach ($filetypes as $ft) {
  417. if ($ft["option"]) {
  418. if ($ft["rel"] == "birthday") {
  419. if ($age < $ft["option"]) {
  420. $deletes[] = $ft["id"];
  421. continue;
  422. }
  423. } else {
  424. $selectVal = $params[$ft["rel"]];
  425. $conditions = array_filter(explode(",", $ft["option"]));
  426. if (!in_array($selectVal, $conditions)) {
  427. $deletes[] = $ft["id"];
  428. continue;
  429. }
  430. }
  431. }
  432. $ft_ids[] = $ft["id"];
  433. }
  434. if ($params["study_abroad"] == 1) {
  435. //选中留学,如果存在留学附件变成必传
  436. $ft_ids = array_unique(array_merge($ft_ids, (array) $abroad_file_ids));
  437. } else {
  438. //没选中,留学附件就算设成必传也不用验证
  439. $ft_ids = array_diff($ft_ids, (array) $abroad_file_ids);
  440. }
  441. $whr = [];
  442. if ($id) {
  443. $whr[] = ["mainId", "=", $id];
  444. } else {
  445. if ($params["uploadFiles"])
  446. $whr[] = ["id", "in", $params["uploadFiles"]];
  447. }
  448. $whr[] = ["typeId", "in", $ft_ids];
  449. $distinct_filetypes = Db::table("new_talent_file")->where($whr)->distinct(true)->field("typeId")->select();
  450. $upload_type_counts = count($distinct_filetypes);
  451. if ($upload_type_counts != count($ft_ids)) {
  452. $res = ["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"];
  453. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  454. exit;
  455. }
  456. return $this->mixSave($info, $this->request, TalentState::SCND_SUBMIT);
  457. } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL, TalentState::ZX_FAIL, TalentState::ANNOUNCED_REVERIFY_FAIL, TalentState::PUBLISH_FAIL])) {
  458. $res = ["msg" => "审核不通过,不能再提交审核"];
  459. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  460. exit;
  461. }
  462. $res = ["msg" => "已提交审核,请耐心等待"];
  463. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  464. exit;
  465. }
  466. /**
  467. * 提交表单(新:混合基础信息人才申报信息)晋江电路
  468. */
  469. private function submitToCheck_IC() {
  470. $params = $this->request->param();
  471. $id = $params["id"];
  472. if (!$info = TalentApi::chkIsOwner($id, $this->user["uid"])) {
  473. return json(["msg" => "没有对应的人才认定申报信息"]);
  474. }
  475. if ($info) {
  476. $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
  477. }
  478. $checkState = $info["checkState"];
  479. if ($checkState == TalentState::SCND_SAVE) {
  480. $field_dict = \app\common\api\DictApi::getTalentFields_IC();
  481. $no_empty = ["name", "card_type", "card_number", "sex", "birthday", "nationality", "province", "city", "nation", "politics", "break_faith",
  482. "phone", "email", "highest_degree", "graduate_school", "major", "study_abroad", "position", "cur_entry_time", "labor_contract_rangetime",
  483. "talent_arrange", "talent_condition", "identifyConditionName", "identifyGetTime",
  484. "bank", "bank_branch_name", "bank_account", "experience", "education"];
  485. $no_empty = array_filter($no_empty);
  486. $return = [];
  487. foreach ($no_empty as $key) {
  488. if (!$info[$key]) {
  489. $return[] = sprintf("请填写“%s”", $field_dict[$key]);
  490. }
  491. }
  492. if (count($return) > 0) {
  493. return json(["msg" => implode("<br>", $return)]);
  494. }
  495. $where = [];
  496. $where[] = ["project", "=", 1];
  497. $where[] = ["type", "=", $this->user["type"]];
  498. $where[] = ["must", "=", 1];
  499. $where[] = ["active", "=", 1];
  500. $where[] = ["delete", "=", 0];
  501. $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
  502. $ft_ids = array_column($filetypes, "id");
  503. $whr = [];
  504. $whr[] = ["typeId", "in", $ft_ids];
  505. $whr[] = ["mainId", "=", $id];
  506. $distinct_filetypes = Db::table("new_talent_file")->where($whr)->distinct(true)->field("typeId")->select()->toArray();
  507. $upload_type_counts = count($distinct_filetypes);
  508. if ($upload_type_counts != count($ft_ids)) {
  509. return json(["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"]);
  510. }
  511. return $this->icSave($info, $this->request, TalentState::SCND_SUBMIT);
  512. } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL, TalentState::ZX_FAIL, TalentState::ANNOUNCED_REVERIFY_FAIL, TalentState::PUBLISH_FAIL])) {
  513. return json(["msg" => "审核不通过,不能再提交审核", "code" => 500]);
  514. }
  515. return json(["msg" => "已提交审核,请耐心等待", "code" => 500]);
  516. }
  517. /**
  518. * 提交表单:卫健
  519. */
  520. private function submitToCheck_WJ() {
  521. $params = $this->request->param();
  522. $id = $params["id"];
  523. if (!$info = TalentApi::chkIsOwner($id, $this->user["uid"])) {
  524. $res = ["msg" => "没有对应的人才认定申报信息"];
  525. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  526. exit;
  527. }
  528. if ($info) {
  529. $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
  530. }
  531. $checkState = $info["checkState"];
  532. if ($checkState == TalentState::SCND_SAVE || $checkState == TalentState::FST_SAVE) {
  533. $field_dict = \app\common\api\DictApi::getTalentFields_WJ();
  534. $no_empty = ["name", "sex", "nation", "politics", "card_type", "card_number", "birthday", "talent_type",
  535. "highest_degree", "graduate_school", "major", "position", "cur_entry_time", "labor_contract_rangetime",
  536. "talent_arrange", "talent_condition",
  537. "bank", "bank_account", "bank_number", "bank_branch_name"];
  538. $no_empty = array_filter($no_empty);
  539. $return = [];
  540. foreach ($no_empty as $key) {
  541. if (!$params[$key]) {
  542. $return[] = sprintf("请填写“%s”", $field_dict[$key]);
  543. }
  544. }
  545. if (count($return) > 0) {
  546. $res = ["msg" => implode("<br>", $return)];
  547. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  548. exit;
  549. }
  550. $condition_info = Db::table("new_talent_condition")->findOrEmpty($params["talent_condition"]);
  551. if ($condition_info["bindFileTypes"]) {
  552. $whr[] = ["id", "in", $condition_info["bindFileTypes"]];
  553. $whr[] = ["must", "=", 1];
  554. }
  555. $where = [];
  556. $where[] = ["project", "=", ProjectState::TALENT];
  557. $where[] = ["type", "=", $this->user["type"]];
  558. $where[] = ["must", "=", 1];
  559. $where[] = ["active", "=", 1];
  560. $where[] = ["delete", "=", 0];
  561. $where[] = ["isConditionFile", "<>", 1];
  562. if ($whr) {
  563. $filetypes = Db::table("new_common_filetype")->whereOr([$where, $whr])->select()->toArray();
  564. } else {
  565. $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
  566. }
  567. $ft_ids = array_column($filetypes, "id");
  568. $whr = [];
  569. $whr[] = ["typeId", "in", $ft_ids];
  570. $whr[] = ["mainId", "=", $id];
  571. $distinct_filetypes = Db::table("new_talent_file")->where($whr)->distinct(true)->field("typeId")->select()->toArray();
  572. $upload_type_counts = count($distinct_filetypes);
  573. if ($upload_type_counts != count($ft_ids)) {
  574. $res = ["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"];
  575. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  576. exit;
  577. }
  578. if ($checkState == TalentState::FST_SAVE) {
  579. $ep = EnterpriseApi::getOne($this->user["uid"]);
  580. if ($ep->isGeneral == 2 && !\app\common\api\Nhc::hasGeneralHospital($ep->medicalCommunityId)) {
  581. return $this->wjSave($info, $this->request, TalentState::SCND_SUBMIT);
  582. }
  583. return $this->wjSave($info, $this->request, TalentState::FST_SUBMIT);
  584. } else {
  585. return $this->wjSave($info, $this->request, TalentState::SCND_SUBMIT);
  586. }
  587. } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL, TalentState::ZX_FAIL, TalentState::ANNOUNCED_REVERIFY_FAIL, TalentState::PUBLISH_FAIL])) {
  588. $res = ["msg" => "审核不通过,不能再提交审核", "code" => 500];
  589. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  590. exit;
  591. }
  592. $res = ["msg" => "已提交审核,请耐心等待", "code" => 500];
  593. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  594. exit;
  595. }
  596. /**
  597. * 提交表单:高教
  598. */
  599. private function submitToCheck_GJ() {
  600. $params = $this->request->param();
  601. $id = $params["id"];
  602. if (!$info = TalentApi::chkIsOwner($id, $this->user["uid"])) {
  603. return json(["msg" => "没有对应的人才认定申报信息"]);
  604. }
  605. if ($info) {
  606. $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
  607. }
  608. $checkState = $info["checkState"];
  609. if ($checkState == TalentState::SCND_SAVE) {
  610. $field_dict = \app\common\api\DictApi::getTalentFields_GJ();
  611. $no_empty = ["name", "nation", "card_type", "card_number", "sex", "birthday", "politics", "nationality", "province", "city", "talent_type",
  612. "position", "cur_entry_time", "labor_contract_rangetime", "highest_degree", "graduate_school", "major", "study_abroad", "phone",
  613. "talent_arrange", "talent_condition", "identifyGetTime",
  614. "bank", "bank_account", "bank_number", "bank_branch_name", "experience", "education"];
  615. if ($info["study_abroad"] == 1) {
  616. $no_empty[] = "abroad_school";
  617. $no_empty[] = "abroad_major";
  618. }
  619. $no_empty = array_filter($no_empty);
  620. $return = [];
  621. foreach ($no_empty as $key) {
  622. if (!$info[$key]) {
  623. $return[] = sprintf("请填写“%s”", $field_dict[$key]);
  624. }
  625. }
  626. if (count($return) > 0) {
  627. return json(["msg" => implode("<br>", $return)]);
  628. }
  629. $condition_info = Db::table("new_talent_condition")->findOrEmpty($info["talent_condition"]);
  630. if ($condition_info["bindFileTypes"]) {
  631. $whr[] = ["id", "in", $condition_info["bindFileTypes"]];
  632. $whr[] = ["must", "=", 1];
  633. }
  634. $where = [];
  635. $where[] = ["project", "=", ProjectState::TALENT];
  636. $where[] = ["type", "=", $this->user["type"]];
  637. $where[] = ["must", "=", 1];
  638. $where[] = ["active", "=", 1];
  639. $where[] = ["delete", "=", 0];
  640. $where[] = ["isConditionFile", "<>", 1];
  641. if ($whr) {
  642. $filetypes = Db::table("new_common_filetype")->whereOr([$where, $whr])->select()->toArray();
  643. } else {
  644. $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
  645. }
  646. $ft_ids = array_column($filetypes, "id");
  647. $whr = [];
  648. $whr[] = ["typeId", "in", $ft_ids];
  649. $whr[] = ["mainId", "=", $id];
  650. $distinct_filetypes = Db::table("new_talent_file")->where($whr)->distinct(true)->field("typeId")->select()->toArray();
  651. $upload_type_counts = count($distinct_filetypes);
  652. if ($upload_type_counts != count($ft_ids)) {
  653. return json(["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"]);
  654. }
  655. return $this->gjSave($info, $this->request, TalentState::SCND_SUBMIT);
  656. } else if (in_array($checkState, [TalentState::BASE_VERIFY_FAIL, TalentState::BASE_REVERIFY_FAIL, TalentState::FST_VERIFY_FAIL, TalentState::REVERIFY_FAIL, TalentState::ZX_FAIL, TalentState::ANNOUNCED_REVERIFY_FAIL, TalentState::PUBLISH_FAIL])) {
  657. return json(["msg" => "审核不通过,不能再提交审核", "code" => 500]);
  658. }
  659. return json(["msg" => "已提交审核,请耐心等待", "code" => 500]);
  660. }
  661. /**
  662. * 保存表单(旧第二步)
  663. * @param type $info talent_info
  664. * @param type $param request->param();
  665. */
  666. private function save($info, \think\Request $request, $checkState) {
  667. try {
  668. $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"], "first_submit_time" => $info["first_submit_time"]], $this->user["type"]);
  669. if ($batch["code"] != 200) {
  670. throw new ValidateException($batch["msg"]);
  671. }
  672. $param = $request->param();
  673. validate(TalentInfo::class)->check($param);
  674. $data["apply_year"] = $batch["batch"];
  675. $all_valid_keys = ["applay_year", "import_way", "cur_entry_time", "position",
  676. "source", "source_batch", "fujian_highcert_pubtime", "fujian_highcert_exptime", "quanzhou_highcert_pubtime", "quanzhou_highcert_exptime", "source_city", "source_county",
  677. "talent_arrange", "talent_condition", "highest_degree", "graduate_school", "major", "professional", "bank", "bank_number", "bank_branch_name", "bank_account",
  678. "study_abroad", "abroad_school", "abroad_major", "phone", "email", "annual_salary", "pro_qua"];
  679. foreach ($all_valid_keys as $key) {
  680. $data[$key] = trim($param[$key]);
  681. }
  682. if ($data["study_abroad"] == 1) {
  683. $data["abroad_school"] = $param["abroad_school"];
  684. $data["abroad_major"] = $param["abroad_major"];
  685. } else {
  686. $data["abroad_school"] = null;
  687. $data["abroad_major"] = null;
  688. }
  689. switch ($data["source"]) {
  690. case 1:
  691. $data["source_batch"] = $param["source_batch"];
  692. $data["fujian_highcert_pubtime"] = $param["fujian_highcert_pubtime"];
  693. $data["fujian_highcert_exptime"] = $param["fujian_highcert_exptime"];
  694. $data["source_city"] = null;
  695. break;
  696. case 2:
  697. $data["source_batch"] = $param["source_batch"];
  698. $data["quanzhou_highcert_pubtime"] = $param["quanzhou_highcert_pubtime"];
  699. $data["quanzhou_highcert_exptime"] = $param["quanzhou_highcert_exptime"];
  700. $data["source_county"] = null;
  701. break;
  702. case 3:
  703. $data["source_batch"] = $param["source_batch"];
  704. $data["fujian_highcert_pubtime"] = $param["fujian_highcert_pubtime"];
  705. $data["fujian_highcert_exptime"] = $param["fujian_highcert_exptime"];
  706. $data["source_city"] = $param["source_city"];
  707. break;
  708. case 4:
  709. $data["source_batch"] = $param["source_batch"];
  710. $data["quanzhou_highcert_pubtime"] = $param["quanzhou_highcert_pubtime"];
  711. $data["quanzhou_highcert_exptime"] = $param["quanzhou_highcert_exptime"];
  712. $data["source_county"] = $param["source_county"];
  713. break;
  714. }
  715. $condition_info = Db::table("new_talent_condition")->findOrEmpty($param["talent_condition"]);
  716. if ($condition_info["isSalary"] == 1) {
  717. $data["annual_salary"] = $param["annual_salary"];
  718. } else {
  719. $data["annual_salary"] = null;
  720. }
  721. if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
  722. //真实状态8是驳回,需要判断什么字段可以提交
  723. $modify_fields = array_filter(explode(",", $info["modify_fields"]));
  724. $tmp_data = $data;
  725. $data = [];
  726. foreach ($modify_fields as $field) {
  727. $data[$field] = $tmp_data[$field];
  728. }
  729. }
  730. $data["checkState"] = $checkState;
  731. $data["id"] = $info["id"];
  732. $success_msg = "提交成功";
  733. $error_msg = "提交失败";
  734. if ($checkState == TalentState::SCND_SAVE) {
  735. $last_log = TalentLogApi::getLastLog($data["id"], 1);
  736. if ($last_log["new_state"] != TalentState::SCND_SAVE) {
  737. TalentLogApi::write(1, $data["id"], $checkState, "保存认定材料未提交", 1);
  738. }
  739. TalentModel::update($data);
  740. } else if ($checkState == TalentState::SCND_SUBMIT) {
  741. $success_msg = "提交成功";
  742. $error_msg = "提交失败";
  743. $data["new_submit_time"] = date("Y-m-d H:i:s");
  744. TalentModel::update($data);
  745. TalentLogApi::write(1, $info["id"], $checkState, "确认提交审核", 1);
  746. } else {
  747. throw new ValidateException($error_msg);
  748. }
  749. $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $info["id"], "checkState" => $checkState]];
  750. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  751. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  752. exit();
  753. } catch (ValidateException $e) {
  754. $res = ["msg" => $e->getMessage()];
  755. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  756. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  757. exit();
  758. }
  759. }
  760. /**
  761. * 保存表单(新:混合基础信息人才申报信息)
  762. * @param type $info talent_info
  763. * @param type $param request->param();
  764. */
  765. private function mixSave($info, \think\Request $request, $checkState) {
  766. try {
  767. $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"], "first_submit_time" => $info["first_submit_time"]], $this->user["type"]);
  768. if ($batch["code"] != 200) {
  769. throw new ValidateException($batch["msg"]);
  770. }
  771. $param = $request->param();
  772. validate(TalentInfo::class)->check($param);
  773. $id = $param["id"];
  774. if ($id) {
  775. if (!$info || $info["id"] != $id || $info["enterprise_id"] != $this->user["uid"]) {
  776. throw new ValidateException("没有对应的人才认定申报信息");
  777. }
  778. }
  779. $files = $param["uploadFiles"];
  780. $data["headimgurl"] = $info["headimgurl"];
  781. if ($request->file()) {
  782. $headimg = $request->file("photo");
  783. $upload = new \app\common\api\UploadApi();
  784. $result = $upload->uploadOne($headimg, "image", "talent/photo");
  785. if ($result->code != 200) {
  786. throw new ValidateException($result->msg);
  787. }
  788. $file = imagecreatefromstring(file_get_contents("storage/" . $result->filepath));
  789. $width = imagesx($file);
  790. $height = imagesy($file);
  791. //免冠二寸照长宽413:579
  792. if ($width * 579 != $height * 413) {
  793. @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
  794. throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  795. }
  796. if ($info && $info["headimgurl"]) {
  797. //如果新照片符合像素要求,则删除旧照片
  798. $old_head_url = "storage/" . $info["headimgurl"];
  799. if (file_exists($old_head_url))
  800. @unlink($old_head_url);
  801. }
  802. $data["headimgurl"] = $result->filepath;
  803. }
  804. if (!$data["headimgurl"] && $checkState == TalentState::SCND_SUBMIT)
  805. throw new ValidateException("请上传头像。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  806. $where = [];
  807. $where[] = ["project", "=", 1];
  808. $where[] = ["type", "=", $this->user["type"]];
  809. $where[] = ["must", "=", 1];
  810. $where[] = ["active", "=", 1];
  811. $where[] = ["delete", "=", 0];
  812. $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
  813. $age = 0;
  814. if ($param["birthday"]) {
  815. $birthday = $param["birthday"];
  816. $birthdayYear = substr($birthday, 0, 4);
  817. $currentYear = date("Y");
  818. $age = $currentYear - $birthdayYear;
  819. }
  820. $ft_ids = [];
  821. $deletes = [];
  822. foreach ($filetypes as $ft) {
  823. if ($ft["option"]) {
  824. if ($ft["rel"] == "birthday") {
  825. if ($age < $ft["option"]) {
  826. $deletes[] = $ft["id"];
  827. continue;
  828. }
  829. } else {
  830. $selectVal = $param[$ft["rel"]];
  831. $conditions = array_filter(explode(",", $ft["option"]));
  832. if (!in_array($selectVal, $conditions)) {
  833. $deletes[] = $ft["id"];
  834. continue;
  835. }
  836. }
  837. }
  838. $ft_ids[] = $ft["id"];
  839. }
  840. $data["apply_year"] = $batch["batch"];
  841. $data["isMatchZhiren"] = $param["isMatchZhiren"] ?: 0;
  842. $all_valid_keys = ["talent_type", "name", "card_type", "card_number", "sex", "birthday", "nationality", "province", "city", "county", "nation", "politics", "experience", "education",
  843. "import_way", "cur_entry_time", "position",
  844. "source", "source_batch", "fujian_highcert_pubtime", "fujian_highcert_exptime", "quanzhou_highcert_pubtime", "quanzhou_highcert_exptime", "source_city", "source_county",
  845. "talent_arrange", "talent_condition", "identifyGetTime", "highest_degree", "graduate_school", "major", "professional", "bank", "bank_number", "bank_branch_name", "bank_account",
  846. "study_abroad", "abroad_school", "abroad_major", "phone", "email", "annual_salary", "pro_qua"];
  847. foreach ($all_valid_keys as $key) {
  848. $data[$key] = trim($param[$key]);
  849. }
  850. $data["return"] = 0; //流出晋江满3年后又返回晋江的,只有talent_type=2时可以填写且非必填
  851. if (in_array($data["talent_type"], [1, 2])) {
  852. $data["tax_insurance_month"] = $param["tax_insurance_month"];
  853. $data["labor_contract_rangetime"] = $param["labor_contract_rangetime"];
  854. $data["salary_pay_way"] = $param["salary_pay_way"];
  855. $data["salary_pay_month"] = $param["salary_pay_month"];
  856. $data["fst_work_time"] = $param["fst_work_time"];
  857. $data['pre_import_type'] = null;
  858. if ($data["talent_type"] == 2) {
  859. $data["return"] = $param["return"];
  860. }
  861. } else {
  862. $data["tax_insurance_month"] = null;
  863. $data["labor_contract_rangetime"] = null;
  864. $data["salary_pay_way"] = null;
  865. $data["salary_pay_month"] = null;
  866. $data["fst_work_time"] = null;
  867. $data['pre_import_type'] = $param["pre_import_type"];
  868. }
  869. if ($data["study_abroad"] == 1) {
  870. $data["abroad_school"] = $param["abroad_school"];
  871. $data["abroad_major"] = $param["abroad_major"];
  872. } else {
  873. $data["abroad_school"] = null;
  874. $data["abroad_major"] = null;
  875. }
  876. switch ($data["source"]) {
  877. case 1:
  878. $data["source_batch"] = $param["source_batch"];
  879. $data["fujian_highcert_pubtime"] = $param["fujian_highcert_pubtime"];
  880. $data["fujian_highcert_exptime"] = $param["fujian_highcert_exptime"];
  881. $data["source_city"] = null;
  882. break;
  883. case 2:
  884. $data["source_batch"] = $param["source_batch"];
  885. $data["quanzhou_highcert_pubtime"] = $param["quanzhou_highcert_pubtime"];
  886. $data["quanzhou_highcert_exptime"] = $param["quanzhou_highcert_exptime"];
  887. $data["source_county"] = null;
  888. break;
  889. case 3:
  890. $data["source_batch"] = $param["source_batch"];
  891. $data["fujian_highcert_pubtime"] = $param["fujian_highcert_pubtime"];
  892. $data["fujian_highcert_exptime"] = $param["fujian_highcert_exptime"];
  893. $data["source_city"] = $param["source_city"];
  894. break;
  895. case 4:
  896. $data["source_batch"] = $param["source_batch"];
  897. $data["quanzhou_highcert_pubtime"] = $param["quanzhou_highcert_pubtime"];
  898. $data["quanzhou_highcert_exptime"] = $param["quanzhou_highcert_exptime"];
  899. $data["source_county"] = $param["source_county"];
  900. break;
  901. }
  902. $condition_info = Db::table("new_talent_condition")->findOrEmpty($param["talent_condition"]);
  903. if ($condition_info["isSalary"] == 1) {
  904. $data["annual_salary"] = $param["annual_salary"];
  905. } else {
  906. $data["annual_salary"] = null;
  907. }
  908. if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
  909. //真实状态11是驳回,需要判断什么字段可以提交
  910. $modify_fields = array_filter(explode(",", $info["modify_fields"]));
  911. $tmp_data = $data;
  912. $data = [];
  913. foreach ($modify_fields as $field) {
  914. $data[$field] = $tmp_data[$field];
  915. }
  916. }
  917. $data["check_companys"] = $condition_info["companyIds"];
  918. $data["checkState"] = $checkState;
  919. $data["id"] = $id;
  920. $success_msg = "提交成功";
  921. $error_msg = "提交失败";
  922. if ($checkState == TalentState::SCND_SAVE) {
  923. $success_msg = "保存成功";
  924. if ($data["id"]) {
  925. //编辑
  926. $data["updateTime"] = date("Y-m-d H:i:s");
  927. TalentModel::update($data);
  928. $last_log = TalentLogApi::getLastLog($data["id"], 1);
  929. if ($last_log["new_state"] != TalentState::SCND_SAVE) {
  930. TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
  931. } else {
  932. if (!$last_log["companyId"]) {
  933. TalentLogApi::setActive($last_log["id"], 1); //更新修改时间
  934. }
  935. }
  936. } else {
  937. //新增
  938. $data["enterprise_id"] = $this->user["uid"];
  939. $data["createTime"] = date("Y-m-d H:i:s");
  940. $id = TalentModel::insertGetId($data);
  941. TalentLogApi::write(1, $id, $checkState, "保存未提交", 1);
  942. $whr = [];
  943. $whr[] = ["fileId", "in", $files];
  944. $upd_checklog["mainId"] = $id;
  945. Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
  946. }
  947. } else if ($checkState == TalentState::SCND_SUBMIT) {
  948. if (!$info["first_submit_time"]) {
  949. $data["first_submit_time"] = date("Y-m-d H:i:s");
  950. } else {
  951. $data["new_submit_time"] = date("Y-m-d H:i:s");
  952. }
  953. if ($data["id"]) {
  954. $data["updateTime"] = date("Y-m-d H:i:s");
  955. TalentModel::update($data);
  956. } else {
  957. //新增
  958. $data["enterprise_id"] = $this->user["uid"];
  959. $data["createTime"] = date("Y-m-d H:i:s");
  960. $id = TalentModel::insertGetId($data);
  961. $whr = [];
  962. $whr[] = ["fileId", "in", $files];
  963. $upd_checklog["mainId"] = $id;
  964. Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
  965. }
  966. TalentLogApi::write(1, $id, $checkState, "确认提交审核", 1);
  967. } else {
  968. throw new ValidateException($error_msg);
  969. }
  970. if ($id) {
  971. if ($deletes) {
  972. //删除多余的附件,一般是选择人才类型留下来的
  973. $whr = [];
  974. $whr[] = ["typeId", "in", $deletes];
  975. $whr[] = ["id", "in", $files];
  976. $_wait_del_files = Db::table("new_talent_file")->where($whr)->select()->toArray();
  977. $_logfileIds[] = [];
  978. foreach ($_wait_del_files as $_del_file) {
  979. $_logfileIds[] = $_del_file["id"];
  980. @unlink("storage/" . $_del_file["url"]);
  981. }
  982. Db::table("new_talent_file")->where($whr)->delete();
  983. if ($_logfileIds) {
  984. $whr = [];
  985. $whr[] = ["fileId", "in", $_logfileIds];
  986. $_upd_checklog["description"] = "删除附件";
  987. $_upd_checklog["updateUser"] = sprintf("%s(%s)", $this->user["account"], $this->user["companyName"] ?: $this->user["rolename"]);
  988. $_upd_checklog["updateTime"] = date("Y-m-d H:i:s");
  989. Db::table("new_talent_checklog")->where($whr)->save($_upd_checklog);
  990. }
  991. }
  992. $whr = [];
  993. $whr[] = ["id", "in", $files];
  994. Db::table("new_talent_file")->where($whr)->save(["mainId" => $id]);
  995. $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  996. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  997. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  998. exit();
  999. } else {
  1000. throw new ValidateException($error_msg);
  1001. }
  1002. } catch (ValidateException $e) {
  1003. $res = ["msg" => $e->getMessage()];
  1004. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  1005. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1006. exit();
  1007. } catch (\think\Exception $e) {
  1008. $res = ["msg" => "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()];
  1009. $logInfo = [
  1010. "enterprise_id" => $this->user["uid"],
  1011. "data" => $data,
  1012. "controller" => $this->request->controller(),
  1013. "action" => $this->request->action(),
  1014. "errCode" => $e->getCode(),
  1015. "errMsg" => $e->getMessage()
  1016. ];
  1017. Log::write($logInfo, "error");
  1018. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  1019. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1020. exit();
  1021. }
  1022. }
  1023. private function icSave($info, \think\Request $request, $checkState) {
  1024. try {
  1025. $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"], "first_submit_time" => $info["first_submit_time"]], $this->user["type"]);
  1026. if ($batch["code"] != 200) {
  1027. throw new ValidateException($batch["msg"]);
  1028. }
  1029. $param = $request->param();
  1030. validate(TalentInfo::class)->check($param);
  1031. $id = $param["id"];
  1032. if ($id) {
  1033. if (!$info || $info["id"] != $id || $info["enterprise_id"] != $this->user["uid"]) {
  1034. throw new ValidateException("没有对应的人才认定申报信息");
  1035. }
  1036. }
  1037. $files = $param["uploadFiles"];
  1038. $data["headimgurl"] = $info["headimgurl"];
  1039. if ($request->file()) {
  1040. $headimg = $request->file("photo");
  1041. $upload = new \app\common\api\UploadApi();
  1042. $result = $upload->uploadOne($headimg, "image", "talent/photo");
  1043. if ($result->code == 500) {
  1044. throw new ValidateException($result->msg);
  1045. }
  1046. $file = imagecreatefromstring(file_get_contents("storage/" . $result->filepath));
  1047. $width = imagesx($file);
  1048. $height = imagesy($file);
  1049. //免冠二寸照长宽413:579
  1050. if ($width * 579 != $height * 413) {
  1051. @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
  1052. throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  1053. }
  1054. if ($info && $info["headimgurl"]) {
  1055. //如果新照片符合像素要求,则删除旧照片
  1056. $old_head_url = "storage/" . $info["headimgurl"];
  1057. if (file_exists($old_head_url))
  1058. @unlink($old_head_url);
  1059. }
  1060. $data["headimgurl"] = $result->filepath;
  1061. }
  1062. if (!$data["headimgurl"] && $checkState == TalentState::SCND_SUBMIT)
  1063. throw new ValidateException("请上传头像。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  1064. $data["apply_year"] = $batch["batch"];
  1065. $all_valid_keys = ["name", "card_type", "card_number", "sex", "birthday", "nationality", "province", "city", "county", "nation", "politics", "experience", "education", "break_faith",
  1066. "phone", "email", "highest_degree", "graduate_school", "major", "study_abroad",
  1067. "position", "cur_entry_time", "labor_contract_rangetime",
  1068. "talent_arrange", "talent_condition", "identifyConditionName", "identifyGetTime", "title", "pro_qua",
  1069. "bank", "bank_branch_name", "bank_account", "description"];
  1070. foreach ($all_valid_keys as $key) {
  1071. $value = trim($param[$key]);
  1072. if ($value) {
  1073. $data[$key] = $value;
  1074. }
  1075. }
  1076. if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
  1077. //真实状态11是驳回,需要判断什么字段可以提交
  1078. $modify_fields = array_filter(explode(",", $info["modify_fields"]));
  1079. $tmp_data = $data;
  1080. $data = [];
  1081. foreach ($modify_fields as $field) {
  1082. $data[$field] = $tmp_data[$field];
  1083. }
  1084. }
  1085. $success_msg = "提交成功";
  1086. $error_msg = "提交失败";
  1087. if ($checkState == TalentState::SCND_SAVE) {
  1088. $data["checkState"] = $checkState;
  1089. $data["id"] = $id;
  1090. $success_msg = "保存成功";
  1091. if ($data["id"]) {
  1092. //编辑
  1093. $data["updateTime"] = date("Y-m-d H:i:s");
  1094. TalentModel::update($data);
  1095. $last_log = TalentLogApi::getLastLog($data["id"], 1);
  1096. if ($last_log["new_state"] != TalentState::SCND_SAVE) {
  1097. TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
  1098. } else {
  1099. if (!$last_log["companyId"]) {
  1100. TalentLogApi::setActive($last_log["id"], 1); //更新修改时间
  1101. }
  1102. }
  1103. } else {
  1104. //新增
  1105. $data["enterprise_id"] = $this->user["uid"];
  1106. $data["createTime"] = date("Y-m-d H:i:s");
  1107. $id = TalentModel::insertGetId($data);
  1108. TalentLogApi::write(1, $id, $checkState, "保存未提交", 1);
  1109. $whr = [];
  1110. $whr[] = ["fileId", "in", $files];
  1111. $upd_checklog["mainId"] = $id;
  1112. Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
  1113. }
  1114. $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  1115. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  1116. exit();
  1117. } else if ($checkState == TalentState::SCND_SUBMIT) {
  1118. unset($data);
  1119. $data["checkState"] = $checkState;
  1120. $data["id"] = $id;
  1121. if (!$info["first_submit_time"]) {
  1122. $data["first_submit_time"] = date("Y-m-d H:i:s");
  1123. } else {
  1124. $data["new_submit_time"] = date("Y-m-d H:i:s");
  1125. }
  1126. $data["updateTime"] = date("Y-m-d H:i:s");
  1127. TalentModel::update($data);
  1128. TalentLogApi::write(1, $data["id"], $checkState, "确认提交审核", 1);
  1129. return json(["msg" => $success_msg, "code" => 200]);
  1130. } else {
  1131. throw new ValidateException($error_msg);
  1132. }
  1133. } catch (ValidateException $e) {
  1134. if ($checkState == TalentState::SCND_SAVE) {
  1135. $res = ["msg" => $e->getMessage()];
  1136. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  1137. exit();
  1138. } else {
  1139. return json(["msg" => $e->getMessage()]);
  1140. }
  1141. } catch (\think\Exception $e) {
  1142. $res = ["msg" => "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()];
  1143. $logInfo = [
  1144. "enterprise_id" => $this->user["uid"],
  1145. "data" => $data,
  1146. "controller" => $this->request->controller(),
  1147. "action" => $this->request->action(),
  1148. "errCode" => $e->getCode(),
  1149. "errMsg" => $e->getMessage()
  1150. ];
  1151. Log::write($logInfo, "error");
  1152. if ($checkState == TalentState::SCND_SAVE) {
  1153. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  1154. exit();
  1155. } else {
  1156. return json($res);
  1157. }
  1158. }
  1159. }
  1160. /**
  1161. * 卫健保存
  1162. * @param type $info
  1163. * @param \think\Request $request
  1164. * @param type $checkState
  1165. * @return type
  1166. * @throws ValidateException
  1167. */
  1168. private function wjSave($info, \think\Request $request, $checkState) {
  1169. $callback = "infoCallback";
  1170. if (in_array($checkState, [TalentState::FST_SUBMIT, TalentState::SCND_SUBMIT])) {
  1171. $callback = "submitCallback";
  1172. }
  1173. try {
  1174. $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"], "first_submit_time" => $info["first_submit_time"]], $this->user["type"]);
  1175. if ($batch["code"] != 200) {
  1176. throw new ValidateException($batch["msg"]);
  1177. }
  1178. $param = $request->param();
  1179. validate(TalentInfo::class)->check($param);
  1180. $id = $param["id"];
  1181. if ($id) {
  1182. if (!$info || $info["id"] != $id || $info["enterprise_id"] != $this->user["uid"]) {
  1183. throw new ValidateException("没有对应的人才认定申报信息");
  1184. }
  1185. }
  1186. $files = $param["uploadFiles"];
  1187. $data["headimgurl"] = $info["headimgurl"];
  1188. if ($request->file()) {
  1189. $headimg = $request->file("photo");
  1190. $upload = new \app\common\api\UploadApi();
  1191. $result = $upload->uploadOne($headimg, "image", "talent/photo");
  1192. if ($result->code == 500) {
  1193. throw new ValidateException($result->msg);
  1194. }
  1195. $file = imagecreatefromstring(file_get_contents("storage/" . $result->filepath));
  1196. $width = imagesx($file);
  1197. $height = imagesy($file);
  1198. //免冠二寸照长宽413:579
  1199. if ($width * 579 != $height * 413) {
  1200. @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
  1201. throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  1202. }
  1203. if ($info && $info["headimgurl"]) {
  1204. //如果新照片符合像素要求,则删除旧照片
  1205. $old_head_url = "storage/" . $info["headimgurl"];
  1206. if (file_exists($old_head_url))
  1207. @unlink($old_head_url);
  1208. }
  1209. $data["headimgurl"] = $result->filepath;
  1210. }
  1211. if (!$data["headimgurl"] && ($checkState == TalentState::SCND_SUBMIT || $checkState == TalentState::FST_SUBMIT))
  1212. throw new ValidateException("请上传头像。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  1213. $data["apply_year"] = $batch["batch"];
  1214. $all_valid_keys = ["name", "sex", "nation", "politics", "card_type", "card_number", "birthday", "talent_type",
  1215. "highest_degree", "graduate_school", "major", "study_abroad", "abroad_school", "abroad_major",
  1216. "position", "cur_entry_time", "labor_contract_rangetime", "title", "fst_city_work_time",
  1217. "is_fujian_talent", "is_jinjiang_talent", "talent_arrange", "talent_condition",
  1218. "phone", "email", "bank", "bank_account", "bank_number", "bank_branch_name", "experience", "education"];
  1219. foreach ($all_valid_keys as $key) {
  1220. $value = trim($param[$key]);
  1221. if ($value) {
  1222. $data[$key] = $value;
  1223. }
  1224. }
  1225. if ($info["real_state"] == TalentState::FST_VERIFY_REJECT || $info["real_state"] == TalentState::BASE_REJECT) {
  1226. //真实状态11是驳回,需要判断什么字段可以提交
  1227. $modify_fields = array_filter(explode(",", $info["modify_fields"]));
  1228. $tmp_data = $data;
  1229. $data = [];
  1230. foreach ($modify_fields as $field) {
  1231. $data[$field] = $tmp_data[$field];
  1232. }
  1233. }
  1234. $data["checkState"] = $checkState;
  1235. $data["id"] = $id;
  1236. $success_msg = "提交成功";
  1237. $error_msg = "提交失败";
  1238. if ($checkState == TalentState::SCND_SAVE || $checkState == TalentState::FST_SAVE) {
  1239. $success_msg = "保存成功";
  1240. if ($data["id"]) {
  1241. //编辑
  1242. $data["updateTime"] = date("Y-m-d H:i:s");
  1243. TalentModel::update($data);
  1244. $last_log = TalentLogApi::getLastLog($data["id"], 1);
  1245. if ($last_log["new_state"] != TalentState::SCND_SAVE && $last_log["new_state"] != TalentState::FST_SAVE) {
  1246. TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
  1247. } else {
  1248. if (!$last_log["companyId"]) {
  1249. TalentLogApi::setActive($last_log["id"], 1); //更新修改时间
  1250. }
  1251. }
  1252. } else {
  1253. //新增
  1254. $data["enterprise_id"] = $this->user["uid"];
  1255. $data["createTime"] = date("Y-m-d H:i:s");
  1256. $id = TalentModel::insertGetId($data);
  1257. TalentLogApi::write(1, $id, $checkState, "保存未提交", 1);
  1258. $whr = [];
  1259. $whr[] = ["fileId", "in", $files];
  1260. $upd_checklog["mainId"] = $id;
  1261. Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
  1262. }
  1263. //$res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  1264. //echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1265. //exit();
  1266. } else if ($checkState == TalentState::SCND_SUBMIT || $checkState == TalentState::FST_SUBMIT) {
  1267. if (!$info["first_submit_time"]) {
  1268. $data["first_submit_time"] = date("Y-m-d H:i:s");
  1269. } else {
  1270. $data["new_submit_time"] = date("Y-m-d H:i:s");
  1271. }
  1272. $data["updateTime"] = date("Y-m-d H:i:s");
  1273. TalentModel::update($data);
  1274. TalentLogApi::write(1, $data["id"], $checkState, "确认提交审核", 1);
  1275. //$res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  1276. //echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1277. //exit();
  1278. } else {
  1279. throw new ValidateException($error_msg);
  1280. }
  1281. if ($id) {
  1282. $whr = [];
  1283. $whr[] = ["id", "in", $files];
  1284. Db::table("new_talent_file")->where($whr)->save(["mainId" => $id]);
  1285. $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  1286. //$callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  1287. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1288. exit();
  1289. } else {
  1290. throw new ValidateException($error_msg);
  1291. }
  1292. } catch (ValidateException $e) {
  1293. $res = ["msg" => $e->getMessage()];
  1294. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1295. exit();
  1296. } catch (\think\Exception $e) {
  1297. $res = ["msg" => "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()];
  1298. $logInfo = [
  1299. "enterprise_id" => $this->user["uid"],
  1300. "data" => $data,
  1301. "controller" => $this->request->controller(),
  1302. "action" => $this->request->action(),
  1303. "errCode" => $e->getCode(),
  1304. "errMsg" => $e->getMessage()
  1305. ];
  1306. Log::write($logInfo, "error");
  1307. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1308. exit();
  1309. }
  1310. }
  1311. private function gjSave($info, \think\Request $request, $checkState) {
  1312. try {
  1313. $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"], "first_submit_time" => $info["first_submit_time"]], $this->user["type"]);
  1314. if ($batch["code"] != 200) {
  1315. throw new ValidateException($batch["msg"]);
  1316. }
  1317. $param = $request->param();
  1318. validate(TalentInfo::class)->check($param);
  1319. $id = $param["id"];
  1320. if ($id) {
  1321. if (!$info || $info["id"] != $id || $info["enterprise_id"] != $this->user["uid"]) {
  1322. throw new ValidateException("没有对应的人才认定申报信息");
  1323. }
  1324. }
  1325. $files = $param["uploadFiles"];
  1326. $data["headimgurl"] = $info["headimgurl"];
  1327. if ($request->file()) {
  1328. $headimg = $request->file("photo");
  1329. $upload = new \app\common\api\UploadApi();
  1330. $result = $upload->uploadOne($headimg, "image", "talent/photo");
  1331. if ($result->code == 500) {
  1332. throw new ValidateException($result->msg);
  1333. }
  1334. $file = imagecreatefromstring(file_get_contents("storage/" . $result->filepath));
  1335. $width = imagesx($file);
  1336. $height = imagesy($file);
  1337. //免冠二寸照长宽413:579
  1338. if ($width * 579 != $height * 413) {
  1339. @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
  1340. throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  1341. }
  1342. if ($info && $info["headimgurl"]) {
  1343. //如果新照片符合像素要求,则删除旧照片
  1344. $old_head_url = "storage/" . $info["headimgurl"];
  1345. if (file_exists($old_head_url))
  1346. @unlink($old_head_url);
  1347. }
  1348. $data["headimgurl"] = $result->filepath;
  1349. }
  1350. if (!$data["headimgurl"] && $checkState == TalentState::SCND_SUBMIT)
  1351. throw new ValidateException("请上传头像。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  1352. $data["apply_year"] = $batch["batch"];
  1353. $all_valid_keys = ["name", "nation", "card_type", "card_number", "sex", "birthday", "politics", "nationality", "province", "city", "county", "talent_type",
  1354. "position", "cur_entry_time", "labor_contract_rangetime",
  1355. "highest_degree", "graduate_school", "major", "study_abroad", "title", "pro_qua", "phone", "email",
  1356. "is_fujian_talent", "is_jinjiang_talent", "talent_arrange", "talent_condition", "identifyGetTime",
  1357. "bank", "bank_account", "bank_number", "bank_branch_name", "experience", "education"];
  1358. foreach ($all_valid_keys as $key) {
  1359. $value = trim($param[$key]);
  1360. if ($value) {
  1361. $data[$key] = $value;
  1362. }
  1363. }
  1364. if ($data["study_abroad"] == 1) {
  1365. $data["abroad_school"] = $param["abroad_school"];
  1366. $data["abroad_major"] = $param["abroad_major"];
  1367. }
  1368. if ($data["study_abroad"] == 2) {
  1369. $data["abroad_school"] = null;
  1370. $data["abroad_major"] = null;
  1371. }
  1372. if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
  1373. //真实状态11是驳回,需要判断什么字段可以提交
  1374. $modify_fields = array_filter(explode(",", $info["modify_fields"]));
  1375. $tmp_data = $data;
  1376. $data = [];
  1377. foreach ($modify_fields as $field) {
  1378. $data[$field] = $tmp_data[$field];
  1379. }
  1380. }
  1381. $success_msg = "提交成功";
  1382. $error_msg = "提交失败";
  1383. if ($checkState == TalentState::SCND_SAVE) {
  1384. $data["checkState"] = $checkState;
  1385. $data["id"] = $id;
  1386. $success_msg = "保存成功";
  1387. if ($data["id"]) {
  1388. //编辑
  1389. $data["updateTime"] = date("Y-m-d H:i:s");
  1390. TalentModel::update($data);
  1391. $last_log = TalentLogApi::getLastLog($data["id"], 1);
  1392. if ($last_log["new_state"] != TalentState::SCND_SAVE) {
  1393. TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
  1394. } else {
  1395. if (!$last_log["companyId"]) {
  1396. TalentLogApi::setActive($last_log["id"], 1); //更新修改时间
  1397. }
  1398. }
  1399. } else {
  1400. //新增
  1401. $data["enterprise_id"] = $this->user["uid"];
  1402. $data["createTime"] = date("Y-m-d H:i:s");
  1403. $id = TalentModel::insertGetId($data);
  1404. TalentLogApi::write(1, $id, $checkState, "保存未提交", 1);
  1405. $whr = [];
  1406. $whr[] = ["fileId", "in", $files];
  1407. $upd_checklog["mainId"] = $id;
  1408. Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
  1409. }
  1410. $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  1411. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  1412. exit();
  1413. } else if ($checkState == TalentState::SCND_SUBMIT) {
  1414. unset($data);
  1415. $data["checkState"] = $checkState;
  1416. $data["id"] = $id;
  1417. if (!$info["first_submit_time"]) {
  1418. $data["first_submit_time"] = date("Y-m-d H:i:s");
  1419. } else {
  1420. $data["new_submit_time"] = date("Y-m-d H:i:s");
  1421. }
  1422. $data["updateTime"] = date("Y-m-d H:i:s");
  1423. TalentModel::update($data);
  1424. TalentLogApi::write(1, $data["id"], $checkState, "确认提交审核", 1);
  1425. return json(["msg" => $success_msg, "code" => 200]);
  1426. } else {
  1427. throw new ValidateException($error_msg);
  1428. }
  1429. } catch (ValidateException $e) {
  1430. if ($checkState == TalentState::SCND_SAVE) {
  1431. $res = ["msg" => $e->getMessage()];
  1432. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  1433. exit();
  1434. } else {
  1435. return json(["msg" => $e->getMessage()]);
  1436. }
  1437. } catch (\think\Exception $e) {
  1438. $res = ["msg" => "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()];
  1439. $logInfo = [
  1440. "enterprise_id" => $this->user["uid"],
  1441. "data" => $data,
  1442. "controller" => $this->request->controller(),
  1443. "action" => $this->request->action(),
  1444. "errCode" => $e->getCode(),
  1445. "errMsg" => $e->getMessage()
  1446. ];
  1447. Log::write($logInfo, "error");
  1448. if ($checkState == TalentState::SCND_SAVE) {
  1449. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  1450. exit();
  1451. } else {
  1452. return json($res);
  1453. }
  1454. }
  1455. }
  1456. public function delete() {
  1457. $id = $this->request->param("talentInfoId");
  1458. $info = Talent::chkIsOwner($id, $this->user["uid"]);
  1459. if (!$info) {
  1460. return json(["msg" => "操作失败"]);
  1461. }
  1462. $checkState = $info["checkState"];
  1463. if (in_array($checkState, [0, 1])) {
  1464. $log = TalentLogApi::getLastLog($id, 1);
  1465. if ($log["state"] > 1) {
  1466. //有提交审核记录
  1467. return json(["msg" => "该申报已提交审核,无法删除"]);
  1468. }
  1469. }
  1470. $data["id"] = $id;
  1471. $data["updateTime"] = date("Y-m-d H:i:s");
  1472. $data["delete"] = 1;
  1473. TalentModel::update($data);
  1474. return json(["msg" => "删除成功"]);
  1475. }
  1476. public function detail() {
  1477. $id = $this->request->param("id");
  1478. $info = $this->getInfoById($id);
  1479. return json($info);
  1480. }
  1481. public function getInfoById($id) {
  1482. $info = \app\common\api\VerifyApi::getTalentInfoById($id);
  1483. if ($info["enterprise_id"] != $this->user["uid"]) {
  1484. return [];
  1485. }
  1486. return $info;
  1487. }
  1488. public function findTalentInfoInLibrary() {
  1489. $where = [];
  1490. $sList = [];
  1491. $type = $this->request->param('type');
  1492. if ($type == ProjectState::QUIT) {
  1493. $_where = [];
  1494. $_where[] = ["checkState", "not in", [3]];
  1495. $idCards = Db::table("un_talent_quit")->where($_where)->column("idCard");
  1496. $sList = array_merge($sList, (array) $idCards);
  1497. $where[] = ["active", "=", 1];
  1498. }
  1499. if ($type == ProjectState::BANKCHANGE) {
  1500. $_where = [];
  1501. $_where[] = ["checkState", "not in", [3]];
  1502. $idCards = Db::table("un_talent_bank_change")->where($_where)->column("idCard");
  1503. $sList = array_merge($sList, (array) $idCards);
  1504. }
  1505. if ($type == ProjectState::LEVELCHANGE) {
  1506. $_where = [];
  1507. $_where[] = ["checkState", "not in", [35, -1]];
  1508. $_where[] = ["isPublic", "<", 5];
  1509. $idCards = Db::table("un_talent_type_change")->where($_where)->column("idCard");
  1510. $sList = array_merge($sList, (array) $idCards);
  1511. }
  1512. $where[] = ["enterprise_id", "=", $this->user["uid"]];
  1513. $where[] = ["checkState", "=", TalentState::CERTIFICATED];
  1514. $where[] = ["isEffect", "<>", 4];
  1515. if ($sList) {
  1516. $where[] = ["card_number", "not in", $sList];
  1517. }
  1518. $result = TalentModel::where($where)->field("id,name")->select()->toArray();
  1519. return json($result);
  1520. }
  1521. public function findTalentInfoByChangeId() {
  1522. $where = [];
  1523. $id = $this->request->param('id');
  1524. $type = $this->request->param('type');
  1525. if ($type == ProjectState::QUIT) {
  1526. $info = Db::table("un_talent_quit")->where("id", $id)->find();
  1527. }
  1528. if ($type == ProjectState::LEVELCHANGE) {
  1529. $info = Db::table("un_talent_type_change")->where("id", $id)->find();
  1530. }
  1531. if ($type == ProjectState::BANKCHANGE) {
  1532. $info = Db::table("un_talent_bank_change")->where("id", $id)->find();
  1533. }
  1534. if (strlen($info["talentId"]) == 19) {
  1535. $where[] = ["enterprise_id", "=", $this->user["uid"]];
  1536. $where[] = ["card_number", "=", $info["idCard"]];
  1537. $where[] = ["delete", "=", 0];
  1538. $where[] = ["checkState", "=", TalentState::CERTIFICATED];
  1539. } else {
  1540. $where[] = ["id", "=", $info["talentId"]];
  1541. }
  1542. $result = TalentModel::where($where)->field("id,name")->select()->toArray();
  1543. return json($result);
  1544. }
  1545. public function getTalentBasicById() {
  1546. $id = $this->request["id"];
  1547. $ti = \app\common\api\VerifyApi::getTalentInfoById($id);
  1548. /* if(FengStringUtil.isNotEmpAndNull(year)){
  1549. StringBuilder sb = new StringBuilder();
  1550. List<TalentAllowancecontractDetail> contractDetailList = new ArrayList<>(); //保存上一年度的工作单位
  1551. TalentAllowanceInfo info = new TalentAllowanceInfo();
  1552. info.setType(ti.getType());
  1553. info.setYear(year);
  1554. info.setFirstInJJTime(ti.getFirstInJJTime());
  1555. ApiTalentAllowanceController.getConcatList(ti,info,year,sb,contractDetailList);
  1556. int active = AllowanceSelectUtil.validMyqy(contractDetailList,ti,info);
  1557. ti.setActive(active);
  1558. } */
  1559. return $ti;
  1560. }
  1561. /**
  1562. *
  1563. */
  1564. public function getTalentInfoFromOldLibrary() {
  1565. $responseObj = new \stdClass();
  1566. $responseObj->code = 500;
  1567. $ep = EnterpriseApi::getOne($this->user["uid"]);
  1568. $pIdCard = \StrUtil::getRequestDecodeParam($this->request, "idCard");
  1569. $eIdCard = $ep->idCard;
  1570. $where = [];
  1571. $where[] = ["e.idCard", "=", $eIdCard];
  1572. $where[] = ["ti.idCard", "=", $pIdCard];
  1573. $old = Db::table("un_talent_info")->alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterpriseId")->field("ti.*")->where($where)->order("ti.createTime desc")->find();
  1574. if ($old) {
  1575. $responseObj->code = 200;
  1576. $responseObj->info = $old;
  1577. return $responseObj;
  1578. }
  1579. return $responseObj;
  1580. }
  1581. /**
  1582. * 审核列表页
  1583. */
  1584. public function examineCenter() {
  1585. $tpl = "";
  1586. switch ($this->user["type"]) {
  1587. case CommonConst::ENTERPRISE_WJ:
  1588. $tpl = "/talent/hospital/examine_center"; //卫健医院
  1589. break;
  1590. }
  1591. return view($tpl);
  1592. }
  1593. /**
  1594. * 审核列表页
  1595. */
  1596. public function examineList() {
  1597. $res = TalentApi::getHospitalExamineList($this->request);
  1598. return json($res);
  1599. }
  1600. public function examinePage() {
  1601. $id = $this->request->param("id");
  1602. $info = \app\common\api\VerifyApi::getTalentInfoById($id);
  1603. return view("/talent/hospital/view", ["row" => $info]);
  1604. }
  1605. /**
  1606. * 医院人才申报审核保存
  1607. * @return type
  1608. */
  1609. public function check() {
  1610. $request = $this->request;
  1611. $params = $request->param();
  1612. $check = $params["checkState"];
  1613. $check_msg = trim($params["checkMsg"]);
  1614. $files = $params["files"];
  1615. $fields = $params["fields"];
  1616. $id = $params["id"];
  1617. $talent_info = \app\common\api\VerifyApi::getOne($id);
  1618. if (!$talent_info) {
  1619. return json(["msg" => "数据错误"]);
  1620. }
  1621. $enterprise = EnterpriseApi::getOne($talent_info["enterprise_id"]);
  1622. $checkState = $talent_info["checkState"];
  1623. if ($this->user["isGeneral"] != 1) {
  1624. return json(["msg" => "非总院账号,无法审核"]);
  1625. }
  1626. if ($this->user["medicalCommunityId"] != $enterprise["medicalCommunityId"]) {
  1627. return json(["msg" => "不能审核其它非本医共体医院"]);
  1628. }
  1629. if (!$check) {
  1630. return json(["msg" => "请选择审核状态"]);
  1631. }
  1632. if (!$check_msg) {
  1633. return json(["msg" => "请填写审核说明"]);
  1634. }
  1635. if ($checkState == TalentState::FST_SUBMIT) {
  1636. if ($params["checkState"] == 3) {
  1637. //审核成功
  1638. $log_checkState = $checkState = TalentState::SCND_SUBMIT; //待初审
  1639. } else {
  1640. //审核驳回并记录需要修改的字段和上传文件
  1641. $checkState = TalentState::FST_SAVE; //退回材料编辑状态
  1642. $log_checkState = TalentState::BASE_REJECT; //日志记录拒绝状态
  1643. }
  1644. $log = TalentLogApi::getLastLog($id, 1);
  1645. if (!$log && !$talent_info["oldId"])
  1646. return json(["msg" => "日志数据异常,保存失败"]);
  1647. if ($log["active"] === 0) {
  1648. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  1649. } else {
  1650. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  1651. }
  1652. $data["id"] = $talent_info["id"];
  1653. $data["modify_files"] = $params["files"];
  1654. $data["modify_fields"] = $params["fields"];
  1655. TalentModel::update($data);
  1656. return json(["code" => 200, "msg" => "保存成功"]);
  1657. } else {
  1658. return json(["msg" => "不在审核范围内,保存失败"]);
  1659. }
  1660. }
  1661. /**
  1662. * 医院人才申报审核
  1663. * @return type
  1664. */
  1665. public function submitCheck() {
  1666. $id = $this->request->param("id");
  1667. $talent_info = \app\common\api\VerifyApi::getOne($id);
  1668. if (!$talent_info) {
  1669. return json(["msg" => "数据错误"]);
  1670. }
  1671. $enterprise = EnterpriseApi::getOne($talent_info["enterprise_id"]);
  1672. $checkState = $talent_info["checkState"];
  1673. if ($this->user["isGeneral"] != 1) {
  1674. return json(["msg" => "非总院账号,无法审核"]);
  1675. }
  1676. if ($this->user["medicalCommunityId"] != $enterprise["medicalCommunityId"]) {
  1677. return json(["msg" => "不能审核其它非本医共体医院"]);
  1678. }
  1679. if ($checkState == TalentState::FST_SUBMIT) {
  1680. $nowProcess = 1;
  1681. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  1682. if (!$log || $log["active"] == 1)
  1683. return json(["msg" => "请先保存审核状态,再提交审核"]);
  1684. if (in_array($log["new_state"], [TalentState::SCND_SUBMIT])) {
  1685. $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
  1686. }
  1687. $data["id"] = $talent_info["id"];
  1688. $data["checkState"] = $log["new_state"];
  1689. TalentModel::update($data);
  1690. TalentLogApi::setActive($log["id"], 1);
  1691. if ($log["state"] == TalentState::BASE_REJECT) {
  1692. $this->sendMsg($enterprise["id"], $log["description"]);
  1693. }
  1694. return json(["code" => 200, "msg" => "审核成功"]);
  1695. } else {
  1696. return json(["msg" => "不在审核范围内,审核失败"]);
  1697. }
  1698. }
  1699. public function findFieldsAndFiles() {
  1700. $id = $this->request["id"];
  1701. $talentInfo = TalentApi::getOne($id);
  1702. $lastLog = TalentLogApi::getLastLog($id, ProjectState::TALENT);
  1703. $responseObj = new \stdClass();
  1704. if ($talentInfo["checkState"] == TalentState::FST_SAVE && $lastLog["state"] == TalentState::BASE_REJECT) {
  1705. $fields = DictApi::getTalentFields_WJ();
  1706. $field_tmp = [];
  1707. if ($fields) {
  1708. foreach ($fields as $key => $field) {
  1709. $field_tmp[] = ["key" => $key, "value" => $field];
  1710. }
  1711. }
  1712. $condition = TalentConditionApi::getOne($talentInfo["talent_condition"]);
  1713. $where = [];
  1714. $whr = [];
  1715. $where[] = ["project", "=", 1];
  1716. $where[] = ["active", "=", 1];
  1717. $where[] = ["type", "=", CommonConst::ENTERPRISE_WJ];
  1718. $where[] = ["isConditionFile", "<>", 1];
  1719. $where[] = ["delete", "=", 0];
  1720. if ($condition && $condition["bindFileTypes"]) {
  1721. $whr[] = ["id", "in", explode(",", $condition["bindFileTypes"])];
  1722. $files = \think\facade\Db::table("new_common_filetype")->whereOr([$where, $whr])->order("sn asc")->select();
  1723. } else {
  1724. $files = \think\facade\Db::table("new_common_filetype")->where($where)->order("sn asc")->select();
  1725. }
  1726. $responseObj->code = 200;
  1727. $responseObj->id = $id;
  1728. $responseObj->fileList = $files;
  1729. $responseObj->fieldList = $field_tmp;
  1730. $responseObj->select = [
  1731. "files" => array_filter(explode(",", $talentInfo["modify_files"])),
  1732. "fields" => array_filter(explode(",", $talentInfo["modify_fields"]))
  1733. ];
  1734. } else {
  1735. $responseObj->msg = "不是驳回状态不可以编辑驳回内容";
  1736. }
  1737. return json($responseObj);
  1738. }
  1739. /**
  1740. * 初审-修改驳回字段
  1741. * @auth {{/talentInfo/updateFieldsAndFiles}}
  1742. */
  1743. public function updateFieldsAndFiles() {
  1744. $id = $this->request["id"];
  1745. $fields = array_filter(explode(",", $this->request["fields"]));
  1746. $files = array_filter(explode(",", $this->request["files"]));
  1747. $talentInfo = TalentApi::getOne($id);
  1748. $lastLog = TalentLogApi::getLastLog($id, ProjectState::TALENT);
  1749. $responseObj = new \stdClass();
  1750. if ($talentInfo["checkState"] == TalentState::FST_SAVE && $lastLog["state"] == TalentState::BASE_REJECT) {
  1751. if (!$fields && !$files) {
  1752. $responseObj->msg = "请选择可修改的字段或附件!";
  1753. return json($responseObj);
  1754. }
  1755. try {
  1756. $data["id"] = $id;
  1757. $data["modify_fields"] = $fields ? implode(",", $fields) : null;
  1758. $data["modify_files"] = $files ? implode(",", $files) : null;
  1759. TalentModel::update($data);
  1760. $responseObj->code = 200;
  1761. $responseObj->msg = "驳回字段修改成功";
  1762. return json($responseObj);
  1763. } catch (\think\db\exception\DbException $e) {
  1764. $responseObj->msg = $e->getMessage();
  1765. return json($responseObj);
  1766. }
  1767. } else {
  1768. $responseObj->msg = "不是驳回状态不可以编辑驳回内容";
  1769. return json($responseObj);
  1770. }
  1771. }
  1772. private function sendMsg($enterprise_id, $description = "") {
  1773. $ep = EnterpriseApi::getOne($enterprise_id);
  1774. if ($ep->agentPhone) {
  1775. $smsapi = new \app\common\api\ChuanglanSmsApi();
  1776. $result = $smsapi->sendSMS($phone, $template);
  1777. $result = json_decode($result, true);
  1778. $id = getStringId();
  1779. $record_data = [
  1780. 'id' => $id,
  1781. 'userId' => $ep->id,
  1782. 'bizId' => $result["msgId"],
  1783. 'type' => 2,
  1784. 'smsType' => 2,
  1785. 'name' => $ep->name,
  1786. 'phone' => $ep->agentPhone,
  1787. 'params' => "总院审核",
  1788. 'templateCode' => "【晋江市人才服务平台】尊敬的用户,您提交的人才认定申报审核驳回,原因是:{$description},请及时登录申报系统修改并重新提交。",
  1789. 'state' => $result['code'] == 0 ? 2 : 3,
  1790. 'sendingDate' => date("Y-m-d H:i:s", time()),
  1791. 'createTime' => date("Y-m-d H:i:s", time()),
  1792. 'msg' => $result['errorMsg']
  1793. ];
  1794. \app\admin\model\MessageRecord::create($record_data);
  1795. }
  1796. }
  1797. public function validateIsCheck() {
  1798. $params = $this->request->param();
  1799. $id = $params["id"];
  1800. $talent_info = \app\common\api\VerifyApi::getTalentInfoById($id);
  1801. $enterprise = EnterpriseApi::getOne($talent_info["enterprise_id"]);
  1802. if ($talent_info) {
  1803. $checkState = $talent_info["checkState"];
  1804. if ($this->user["isGeneral"] != 1) {
  1805. return json(["msg" => "非总院账号,无法审核"]);
  1806. }
  1807. if ($this->user["medicalCommunityId"] != $enterprise["medicalCommunityId"]) {
  1808. return json(["msg" => "不能审核其它非本医共体医院"]);
  1809. }
  1810. if ($checkState != TalentState::FST_SUBMIT) {
  1811. return json(["msg" => "该申报不在审核范围内,无法审核"]);
  1812. }
  1813. $fields = DictApi::getTalentFields_WJ();
  1814. $field_tmp = [];
  1815. if ($fields) {
  1816. foreach ($fields as $key => $field) {
  1817. $field_tmp[] = ["key" => $key, "value" => $field];
  1818. }
  1819. }
  1820. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1821. $where = [];
  1822. $whr = [];
  1823. $where[] = ["project", "=", 1];
  1824. $where[] = ["active", "=", 1];
  1825. $where[] = ["type", "=", $enterprise["type"]];
  1826. $where[] = ["isConditionFile", "<>", 1];
  1827. $where[] = ["delete", "=", 0];
  1828. if ($condition && $condition["bindFileTypes"]) {
  1829. $whr[] = ["id", "in", explode(",", $condition["bindFileTypes"])];
  1830. $files = \think\facade\Db::table("new_common_filetype")->whereOr([$where, $whr])->order("sn asc")->select();
  1831. } else {
  1832. $files = \think\facade\Db::table("new_common_filetype")->where($where)->order("sn asc")->select();
  1833. }
  1834. $talent_info["files"] = array_filter(explode(",", $talent_info["modify_files"]));
  1835. $talent_info["fields"] = array_filter(explode(",", $talent_info["modify_fields"]));
  1836. /* 保存的审核内容start */
  1837. $last_log = TalentLogApi::getLastLog($id, ProjectState::TALENT, 0, ["active", "=", 0]);
  1838. $check = ["msg" => $last_log["description"]];
  1839. if ($last_log["state"] == TalentState::BASE_VERIFY_PASS) {
  1840. $check["checkState"] = 3;
  1841. }
  1842. if ($last_log["new_state"] == TalentState::FST_SAVE && $last_log["state"] == TalentState::BASE_REJECT) {
  1843. $check["checkState"] = 2;
  1844. }
  1845. /* 保存的审核内容end */
  1846. return json(["code" => 200, "obj" => ["talentInfo" => $talent_info, "check" => $check, "fieldList" => $field_tmp, "fileList" => $files]]);
  1847. }
  1848. }
  1849. // public function mixDelete() {
  1850. // $id = $this->request->param("talentInfoId");
  1851. // $info = TalentApi::chkIsOwner($id, $this->user["uid"]);
  1852. // if (!$info) {
  1853. // return json(["msg" => "操作失败"]);
  1854. // }
  1855. // $checkState = $info["checkState"];
  1856. // if (in_array($checkState, [0, TalentState::SCND_SAVE])) {
  1857. // $data["id"] = $id;
  1858. // $data["delete"] = 1;
  1859. // TalentModel::update($data);
  1860. // return json(["msg" => "删除成功"]);
  1861. // }
  1862. // return json(["msg" => "该申报已提交审核,无法删除"]);
  1863. // }
  1864. }