Talent.php 93 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948
  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. return $this->wjSave($info, $this->request, TalentState::FST_SUBMIT);
  580. } else {
  581. return $this->wjSave($info, $this->request, TalentState::SCND_SUBMIT);
  582. }
  583. } 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])) {
  584. $res = ["msg" => "审核不通过,不能再提交审核", "code" => 500];
  585. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  586. exit;
  587. }
  588. $res = ["msg" => "已提交审核,请耐心等待", "code" => 500];
  589. echo sprintf("<script>parent.TalentInfoInfoDlg.submitCallback(%s);</script>", json_encode($res));
  590. exit;
  591. }
  592. /**
  593. * 提交表单:高教
  594. */
  595. private function submitToCheck_GJ() {
  596. $params = $this->request->param();
  597. $id = $params["id"];
  598. if (!$info = TalentApi::chkIsOwner($id, $this->user["uid"])) {
  599. return json(["msg" => "没有对应的人才认定申报信息"]);
  600. }
  601. if ($info) {
  602. $info["real_state"] = TalentLogApi::getLastLog($id, 1)["state"];
  603. }
  604. $checkState = $info["checkState"];
  605. if ($checkState == TalentState::SCND_SAVE) {
  606. $field_dict = \app\common\api\DictApi::getTalentFields_GJ();
  607. $no_empty = ["name", "nation", "card_type", "card_number", "sex", "birthday", "politics", "nationality", "province", "city", "talent_type",
  608. "position", "cur_entry_time", "labor_contract_rangetime", "highest_degree", "graduate_school", "major", "study_abroad", "phone",
  609. "talent_arrange", "talent_condition", "identifyGetTime",
  610. "bank", "bank_account", "bank_number", "bank_branch_name", "experience", "education"];
  611. if ($info["study_abroad"] == 1) {
  612. $no_empty[] = "abroad_school";
  613. $no_empty[] = "abroad_major";
  614. }
  615. $no_empty = array_filter($no_empty);
  616. $return = [];
  617. foreach ($no_empty as $key) {
  618. if (!$info[$key]) {
  619. $return[] = sprintf("请填写“%s”", $field_dict[$key]);
  620. }
  621. }
  622. if (count($return) > 0) {
  623. return json(["msg" => implode("<br>", $return)]);
  624. }
  625. $condition_info = Db::table("new_talent_condition")->findOrEmpty($info["talent_condition"]);
  626. if ($condition_info["bindFileTypes"]) {
  627. $whr[] = ["id", "in", $condition_info["bindFileTypes"]];
  628. $whr[] = ["must", "=", 1];
  629. }
  630. $where = [];
  631. $where[] = ["project", "=", ProjectState::TALENT];
  632. $where[] = ["type", "=", $this->user["type"]];
  633. $where[] = ["must", "=", 1];
  634. $where[] = ["active", "=", 1];
  635. $where[] = ["delete", "=", 0];
  636. $where[] = ["isConditionFile", "<>", 1];
  637. if ($whr) {
  638. $filetypes = Db::table("new_common_filetype")->whereOr([$where, $whr])->select()->toArray();
  639. } else {
  640. $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
  641. }
  642. $ft_ids = array_column($filetypes, "id");
  643. $whr = [];
  644. $whr[] = ["typeId", "in", $ft_ids];
  645. $whr[] = ["mainId", "=", $id];
  646. $distinct_filetypes = Db::table("new_talent_file")->where($whr)->distinct(true)->field("typeId")->select()->toArray();
  647. $upload_type_counts = count($distinct_filetypes);
  648. if ($upload_type_counts != count($ft_ids)) {
  649. return json(["msg" => "请留意附件上传栏中带*号的内容均为必传项,请上传完整再提交审核"]);
  650. }
  651. return $this->gjSave($info, $this->request, TalentState::SCND_SUBMIT);
  652. } 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])) {
  653. return json(["msg" => "审核不通过,不能再提交审核", "code" => 500]);
  654. }
  655. return json(["msg" => "已提交审核,请耐心等待", "code" => 500]);
  656. }
  657. /**
  658. * 保存表单(旧第二步)
  659. * @param type $info talent_info
  660. * @param type $param request->param();
  661. */
  662. private function save($info, \think\Request $request, $checkState) {
  663. try {
  664. $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"], "first_submit_time" => $info["first_submit_time"]], $this->user["type"]);
  665. if ($batch["code"] != 200) {
  666. throw new ValidateException($batch["msg"]);
  667. }
  668. $param = $request->param();
  669. validate(TalentInfo::class)->check($param);
  670. $data["apply_year"] = $batch["batch"];
  671. $all_valid_keys = ["applay_year", "import_way", "cur_entry_time", "position",
  672. "source", "source_batch", "fujian_highcert_pubtime", "fujian_highcert_exptime", "quanzhou_highcert_pubtime", "quanzhou_highcert_exptime", "source_city", "source_county",
  673. "talent_arrange", "talent_condition", "highest_degree", "graduate_school", "major", "professional", "bank", "bank_number", "bank_branch_name", "bank_account",
  674. "study_abroad", "abroad_school", "abroad_major", "phone", "email", "annual_salary", "pro_qua"];
  675. foreach ($all_valid_keys as $key) {
  676. $data[$key] = trim($param[$key]);
  677. }
  678. if ($data["study_abroad"] == 1) {
  679. $data["abroad_school"] = $param["abroad_school"];
  680. $data["abroad_major"] = $param["abroad_major"];
  681. } else {
  682. $data["abroad_school"] = null;
  683. $data["abroad_major"] = null;
  684. }
  685. switch ($data["source"]) {
  686. case 1:
  687. $data["source_batch"] = $param["source_batch"];
  688. $data["fujian_highcert_pubtime"] = $param["fujian_highcert_pubtime"];
  689. $data["fujian_highcert_exptime"] = $param["fujian_highcert_exptime"];
  690. $data["source_city"] = null;
  691. break;
  692. case 2:
  693. $data["source_batch"] = $param["source_batch"];
  694. $data["quanzhou_highcert_pubtime"] = $param["quanzhou_highcert_pubtime"];
  695. $data["quanzhou_highcert_exptime"] = $param["quanzhou_highcert_exptime"];
  696. $data["source_county"] = null;
  697. break;
  698. case 3:
  699. $data["source_batch"] = $param["source_batch"];
  700. $data["fujian_highcert_pubtime"] = $param["fujian_highcert_pubtime"];
  701. $data["fujian_highcert_exptime"] = $param["fujian_highcert_exptime"];
  702. $data["source_city"] = $param["source_city"];
  703. break;
  704. case 4:
  705. $data["source_batch"] = $param["source_batch"];
  706. $data["quanzhou_highcert_pubtime"] = $param["quanzhou_highcert_pubtime"];
  707. $data["quanzhou_highcert_exptime"] = $param["quanzhou_highcert_exptime"];
  708. $data["source_county"] = $param["source_county"];
  709. break;
  710. }
  711. $condition_info = Db::table("new_talent_condition")->findOrEmpty($param["talent_condition"]);
  712. if ($condition_info["isSalary"] == 1) {
  713. $data["annual_salary"] = $param["annual_salary"];
  714. } else {
  715. $data["annual_salary"] = null;
  716. }
  717. if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
  718. //真实状态8是驳回,需要判断什么字段可以提交
  719. $modify_fields = array_filter(explode(",", $info["modify_fields"]));
  720. $tmp_data = $data;
  721. $data = [];
  722. foreach ($modify_fields as $field) {
  723. $data[$field] = $tmp_data[$field];
  724. }
  725. }
  726. $data["checkState"] = $checkState;
  727. $data["id"] = $info["id"];
  728. $success_msg = "提交成功";
  729. $error_msg = "提交失败";
  730. if ($checkState == TalentState::SCND_SAVE) {
  731. $last_log = TalentLogApi::getLastLog($data["id"], 1);
  732. if ($last_log["new_state"] != TalentState::SCND_SAVE) {
  733. TalentLogApi::write(1, $data["id"], $checkState, "保存认定材料未提交", 1);
  734. }
  735. TalentModel::update($data);
  736. } else if ($checkState == TalentState::SCND_SUBMIT) {
  737. $success_msg = "提交成功";
  738. $error_msg = "提交失败";
  739. $data["new_submit_time"] = date("Y-m-d H:i:s");
  740. TalentModel::update($data);
  741. TalentLogApi::write(1, $info["id"], $checkState, "确认提交审核", 1);
  742. } else {
  743. throw new ValidateException($error_msg);
  744. }
  745. $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $info["id"], "checkState" => $checkState]];
  746. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  747. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  748. exit();
  749. } catch (ValidateException $e) {
  750. $res = ["msg" => $e->getMessage()];
  751. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  752. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  753. exit();
  754. }
  755. }
  756. /**
  757. * 保存表单(新:混合基础信息人才申报信息)
  758. * @param type $info talent_info
  759. * @param type $param request->param();
  760. */
  761. private function mixSave($info, \think\Request $request, $checkState) {
  762. try {
  763. $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"], "first_submit_time" => $info["first_submit_time"]], $this->user["type"]);
  764. if ($batch["code"] != 200) {
  765. throw new ValidateException($batch["msg"]);
  766. }
  767. $param = $request->param();
  768. validate(TalentInfo::class)->check($param);
  769. $id = $param["id"];
  770. if ($id) {
  771. if (!$info || $info["id"] != $id || $info["enterprise_id"] != $this->user["uid"]) {
  772. throw new ValidateException("没有对应的人才认定申报信息");
  773. }
  774. }
  775. $files = $param["uploadFiles"];
  776. $data["headimgurl"] = $info["headimgurl"];
  777. if ($request->file()) {
  778. $headimg = $request->file("photo");
  779. $upload = new \app\common\api\UploadApi();
  780. $result = $upload->uploadOne($headimg, "image", "talent/photo");
  781. if ($result->code != 200) {
  782. throw new ValidateException($result->msg);
  783. }
  784. $file = imagecreatefromstring(file_get_contents("storage/" . $result->filepath));
  785. $width = imagesx($file);
  786. $height = imagesy($file);
  787. //免冠二寸照长宽413:579
  788. if ($width * 579 != $height * 413) {
  789. @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
  790. throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  791. }
  792. if ($info && $info["headimgurl"]) {
  793. //如果新照片符合像素要求,则删除旧照片
  794. $old_head_url = "storage/" . $info["headimgurl"];
  795. if (file_exists($old_head_url))
  796. @unlink($old_head_url);
  797. }
  798. $data["headimgurl"] = $result->filepath;
  799. }
  800. if (!$data["headimgurl"] && $checkState == TalentState::SCND_SUBMIT)
  801. throw new ValidateException("请上传头像。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  802. $where = [];
  803. $where[] = ["project", "=", 1];
  804. $where[] = ["type", "=", $this->user["type"]];
  805. $where[] = ["must", "=", 1];
  806. $where[] = ["active", "=", 1];
  807. $where[] = ["delete", "=", 0];
  808. $filetypes = Db::table("new_common_filetype")->where($where)->select()->toArray();
  809. $age = 0;
  810. if ($param["birthday"]) {
  811. $birthday = $param["birthday"];
  812. $birthdayYear = substr($birthday, 0, 4);
  813. $currentYear = date("Y");
  814. $age = $currentYear - $birthdayYear;
  815. }
  816. $ft_ids = [];
  817. $deletes = [];
  818. foreach ($filetypes as $ft) {
  819. if ($ft["option"]) {
  820. if ($ft["rel"] == "birthday") {
  821. if ($age < $ft["option"]) {
  822. $deletes[] = $ft["id"];
  823. continue;
  824. }
  825. } else {
  826. $selectVal = $param[$ft["rel"]];
  827. $conditions = array_filter(explode(",", $ft["option"]));
  828. if (!in_array($selectVal, $conditions)) {
  829. $deletes[] = $ft["id"];
  830. continue;
  831. }
  832. }
  833. }
  834. $ft_ids[] = $ft["id"];
  835. }
  836. $data["apply_year"] = $batch["batch"];
  837. $data["isMatchZhiren"] = $param["isMatchZhiren"] ?: 0;
  838. $all_valid_keys = ["talent_type", "name", "card_type", "card_number", "sex", "birthday", "nationality", "province", "city", "county", "nation", "politics", "experience", "education",
  839. "import_way", "cur_entry_time", "position",
  840. "source", "source_batch", "fujian_highcert_pubtime", "fujian_highcert_exptime", "quanzhou_highcert_pubtime", "quanzhou_highcert_exptime", "source_city", "source_county",
  841. "talent_arrange", "talent_condition", "identifyGetTime", "highest_degree", "graduate_school", "major", "professional", "bank", "bank_number", "bank_branch_name", "bank_account",
  842. "study_abroad", "abroad_school", "abroad_major", "phone", "email", "annual_salary", "pro_qua"];
  843. foreach ($all_valid_keys as $key) {
  844. $data[$key] = trim($param[$key]);
  845. }
  846. $data["return"] = 0; //流出晋江满3年后又返回晋江的,只有talent_type=2时可以填写且非必填
  847. if (in_array($data["talent_type"], [1, 2])) {
  848. $data["tax_insurance_month"] = $param["tax_insurance_month"];
  849. $data["labor_contract_rangetime"] = $param["labor_contract_rangetime"];
  850. $data["salary_pay_way"] = $param["salary_pay_way"];
  851. $data["salary_pay_month"] = $param["salary_pay_month"];
  852. $data["fst_work_time"] = $param["fst_work_time"];
  853. $data['pre_import_type'] = null;
  854. if ($data["talent_type"] == 2) {
  855. $data["return"] = $param["return"];
  856. }
  857. } else {
  858. $data["tax_insurance_month"] = null;
  859. $data["labor_contract_rangetime"] = null;
  860. $data["salary_pay_way"] = null;
  861. $data["salary_pay_month"] = null;
  862. $data["fst_work_time"] = null;
  863. $data['pre_import_type'] = $param["pre_import_type"];
  864. }
  865. if ($data["study_abroad"] == 1) {
  866. $data["abroad_school"] = $param["abroad_school"];
  867. $data["abroad_major"] = $param["abroad_major"];
  868. } else {
  869. $data["abroad_school"] = null;
  870. $data["abroad_major"] = null;
  871. }
  872. switch ($data["source"]) {
  873. case 1:
  874. $data["source_batch"] = $param["source_batch"];
  875. $data["fujian_highcert_pubtime"] = $param["fujian_highcert_pubtime"];
  876. $data["fujian_highcert_exptime"] = $param["fujian_highcert_exptime"];
  877. $data["source_city"] = null;
  878. break;
  879. case 2:
  880. $data["source_batch"] = $param["source_batch"];
  881. $data["quanzhou_highcert_pubtime"] = $param["quanzhou_highcert_pubtime"];
  882. $data["quanzhou_highcert_exptime"] = $param["quanzhou_highcert_exptime"];
  883. $data["source_county"] = null;
  884. break;
  885. case 3:
  886. $data["source_batch"] = $param["source_batch"];
  887. $data["fujian_highcert_pubtime"] = $param["fujian_highcert_pubtime"];
  888. $data["fujian_highcert_exptime"] = $param["fujian_highcert_exptime"];
  889. $data["source_city"] = $param["source_city"];
  890. break;
  891. case 4:
  892. $data["source_batch"] = $param["source_batch"];
  893. $data["quanzhou_highcert_pubtime"] = $param["quanzhou_highcert_pubtime"];
  894. $data["quanzhou_highcert_exptime"] = $param["quanzhou_highcert_exptime"];
  895. $data["source_county"] = $param["source_county"];
  896. break;
  897. }
  898. $condition_info = Db::table("new_talent_condition")->findOrEmpty($param["talent_condition"]);
  899. if ($condition_info["isSalary"] == 1) {
  900. $data["annual_salary"] = $param["annual_salary"];
  901. } else {
  902. $data["annual_salary"] = null;
  903. }
  904. if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
  905. //真实状态11是驳回,需要判断什么字段可以提交
  906. $modify_fields = array_filter(explode(",", $info["modify_fields"]));
  907. $tmp_data = $data;
  908. $data = [];
  909. foreach ($modify_fields as $field) {
  910. $data[$field] = $tmp_data[$field];
  911. }
  912. }
  913. $data["check_companys"] = $condition_info["companyIds"];
  914. $data["checkState"] = $checkState;
  915. $data["id"] = $id;
  916. $success_msg = "提交成功";
  917. $error_msg = "提交失败";
  918. if ($checkState == TalentState::SCND_SAVE) {
  919. $success_msg = "保存成功";
  920. if ($data["id"]) {
  921. //编辑
  922. $data["updateTime"] = date("Y-m-d H:i:s");
  923. TalentModel::update($data);
  924. $last_log = TalentLogApi::getLastLog($data["id"], 1);
  925. if ($last_log["new_state"] != TalentState::SCND_SAVE) {
  926. TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
  927. } else {
  928. if (!$last_log["companyId"]) {
  929. TalentLogApi::setActive($last_log["id"], 1); //更新修改时间
  930. }
  931. }
  932. } else {
  933. //新增
  934. $data["enterprise_id"] = $this->user["uid"];
  935. $data["createTime"] = date("Y-m-d H:i:s");
  936. $id = TalentModel::insertGetId($data);
  937. TalentLogApi::write(1, $id, $checkState, "保存未提交", 1);
  938. $whr = [];
  939. $whr[] = ["fileId", "in", $files];
  940. $upd_checklog["mainId"] = $id;
  941. Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
  942. }
  943. } else if ($checkState == TalentState::SCND_SUBMIT) {
  944. if (!$info["first_submit_time"]) {
  945. $data["first_submit_time"] = date("Y-m-d H:i:s");
  946. } else {
  947. $data["new_submit_time"] = date("Y-m-d H:i:s");
  948. }
  949. if ($data["id"]) {
  950. $data["updateTime"] = date("Y-m-d H:i:s");
  951. TalentModel::update($data);
  952. } else {
  953. //新增
  954. $data["enterprise_id"] = $this->user["uid"];
  955. $data["createTime"] = date("Y-m-d H:i:s");
  956. $id = TalentModel::insertGetId($data);
  957. $whr = [];
  958. $whr[] = ["fileId", "in", $files];
  959. $upd_checklog["mainId"] = $id;
  960. Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
  961. }
  962. TalentLogApi::write(1, $id, $checkState, "确认提交审核", 1);
  963. } else {
  964. throw new ValidateException($error_msg);
  965. }
  966. if ($id) {
  967. if ($deletes) {
  968. //删除多余的附件,一般是选择人才类型留下来的
  969. $whr = [];
  970. $whr[] = ["typeId", "in", $deletes];
  971. $whr[] = ["id", "in", $files];
  972. $_wait_del_files = Db::table("new_talent_file")->where($whr)->select()->toArray();
  973. $_logfileIds[] = [];
  974. foreach ($_wait_del_files as $_del_file) {
  975. $_logfileIds[] = $_del_file["id"];
  976. @unlink("storage/" . $_del_file["url"]);
  977. }
  978. Db::table("new_talent_file")->where($whr)->delete();
  979. if ($_logfileIds) {
  980. $whr = [];
  981. $whr[] = ["fileId", "in", $_logfileIds];
  982. $_upd_checklog["description"] = "删除附件";
  983. $_upd_checklog["updateUser"] = sprintf("%s(%s)", $this->user["account"], $this->user["companyName"] ?: $this->user["rolename"]);
  984. $_upd_checklog["updateTime"] = date("Y-m-d H:i:s");
  985. Db::table("new_talent_checklog")->where($whr)->save($_upd_checklog);
  986. }
  987. }
  988. $whr = [];
  989. $whr[] = ["id", "in", $files];
  990. Db::table("new_talent_file")->where($whr)->save(["mainId" => $id]);
  991. $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  992. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  993. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  994. exit();
  995. } else {
  996. throw new ValidateException($error_msg);
  997. }
  998. } catch (ValidateException $e) {
  999. $res = ["msg" => $e->getMessage()];
  1000. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  1001. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1002. exit();
  1003. } catch (\think\Exception $e) {
  1004. $res = ["msg" => "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()];
  1005. $logInfo = [
  1006. "enterprise_id" => $this->user["uid"],
  1007. "data" => $data,
  1008. "controller" => $this->request->controller(),
  1009. "action" => $this->request->action(),
  1010. "errCode" => $e->getCode(),
  1011. "errMsg" => $e->getMessage()
  1012. ];
  1013. Log::write($logInfo, "error");
  1014. $callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  1015. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1016. exit();
  1017. }
  1018. }
  1019. private function icSave($info, \think\Request $request, $checkState) {
  1020. try {
  1021. $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"], "first_submit_time" => $info["first_submit_time"]], $this->user["type"]);
  1022. if ($batch["code"] != 200) {
  1023. throw new ValidateException($batch["msg"]);
  1024. }
  1025. $param = $request->param();
  1026. validate(TalentInfo::class)->check($param);
  1027. $id = $param["id"];
  1028. if ($id) {
  1029. if (!$info || $info["id"] != $id || $info["enterprise_id"] != $this->user["uid"]) {
  1030. throw new ValidateException("没有对应的人才认定申报信息");
  1031. }
  1032. }
  1033. $files = $param["uploadFiles"];
  1034. $data["headimgurl"] = $info["headimgurl"];
  1035. if ($request->file()) {
  1036. $headimg = $request->file("photo");
  1037. $upload = new \app\common\api\UploadApi();
  1038. $result = $upload->uploadOne($headimg, "image", "talent/photo");
  1039. if ($result->code == 500) {
  1040. throw new ValidateException($result->msg);
  1041. }
  1042. $file = imagecreatefromstring(file_get_contents("storage/" . $result->filepath));
  1043. $width = imagesx($file);
  1044. $height = imagesy($file);
  1045. //免冠二寸照长宽413:579
  1046. if ($width * 579 != $height * 413) {
  1047. @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
  1048. throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  1049. }
  1050. if ($info && $info["headimgurl"]) {
  1051. //如果新照片符合像素要求,则删除旧照片
  1052. $old_head_url = "storage/" . $info["headimgurl"];
  1053. if (file_exists($old_head_url))
  1054. @unlink($old_head_url);
  1055. }
  1056. $data["headimgurl"] = $result->filepath;
  1057. }
  1058. if (!$data["headimgurl"] && $checkState == TalentState::SCND_SUBMIT)
  1059. throw new ValidateException("请上传头像。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  1060. $data["apply_year"] = $batch["batch"];
  1061. $all_valid_keys = ["name", "card_type", "card_number", "sex", "birthday", "nationality", "province", "city", "county", "nation", "politics", "experience", "education", "break_faith",
  1062. "phone", "email", "highest_degree", "graduate_school", "major", "study_abroad",
  1063. "position", "cur_entry_time", "labor_contract_rangetime",
  1064. "talent_arrange", "talent_condition", "identifyConditionName", "identifyGetTime", "title", "pro_qua",
  1065. "bank", "bank_branch_name", "bank_account", "description"];
  1066. foreach ($all_valid_keys as $key) {
  1067. $value = trim($param[$key]);
  1068. if ($value) {
  1069. $data[$key] = $value;
  1070. }
  1071. }
  1072. if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
  1073. //真实状态11是驳回,需要判断什么字段可以提交
  1074. $modify_fields = array_filter(explode(",", $info["modify_fields"]));
  1075. $tmp_data = $data;
  1076. $data = [];
  1077. foreach ($modify_fields as $field) {
  1078. $data[$field] = $tmp_data[$field];
  1079. }
  1080. }
  1081. $success_msg = "提交成功";
  1082. $error_msg = "提交失败";
  1083. if ($checkState == TalentState::SCND_SAVE) {
  1084. $data["checkState"] = $checkState;
  1085. $data["id"] = $id;
  1086. $success_msg = "保存成功";
  1087. if ($data["id"]) {
  1088. //编辑
  1089. $data["updateTime"] = date("Y-m-d H:i:s");
  1090. TalentModel::update($data);
  1091. $last_log = TalentLogApi::getLastLog($data["id"], 1);
  1092. if ($last_log["new_state"] != TalentState::SCND_SAVE) {
  1093. TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
  1094. } else {
  1095. if (!$last_log["companyId"]) {
  1096. TalentLogApi::setActive($last_log["id"], 1); //更新修改时间
  1097. }
  1098. }
  1099. } else {
  1100. //新增
  1101. $data["enterprise_id"] = $this->user["uid"];
  1102. $data["createTime"] = date("Y-m-d H:i:s");
  1103. $id = TalentModel::insertGetId($data);
  1104. TalentLogApi::write(1, $id, $checkState, "保存未提交", 1);
  1105. $whr = [];
  1106. $whr[] = ["fileId", "in", $files];
  1107. $upd_checklog["mainId"] = $id;
  1108. Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
  1109. }
  1110. $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  1111. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  1112. exit();
  1113. } else if ($checkState == TalentState::SCND_SUBMIT) {
  1114. unset($data);
  1115. $data["checkState"] = $checkState;
  1116. $data["id"] = $id;
  1117. if (!$info["first_submit_time"]) {
  1118. $data["first_submit_time"] = date("Y-m-d H:i:s");
  1119. } else {
  1120. $data["new_submit_time"] = date("Y-m-d H:i:s");
  1121. }
  1122. $data["updateTime"] = date("Y-m-d H:i:s");
  1123. TalentModel::update($data);
  1124. TalentLogApi::write(1, $data["id"], $checkState, "确认提交审核", 1);
  1125. return json(["msg" => $success_msg, "code" => 200]);
  1126. } else {
  1127. throw new ValidateException($error_msg);
  1128. }
  1129. } catch (ValidateException $e) {
  1130. if ($checkState == TalentState::SCND_SAVE) {
  1131. $res = ["msg" => $e->getMessage()];
  1132. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  1133. exit();
  1134. } else {
  1135. return json(["msg" => $e->getMessage()]);
  1136. }
  1137. } catch (\think\Exception $e) {
  1138. $res = ["msg" => "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()];
  1139. $logInfo = [
  1140. "enterprise_id" => $this->user["uid"],
  1141. "data" => $data,
  1142. "controller" => $this->request->controller(),
  1143. "action" => $this->request->action(),
  1144. "errCode" => $e->getCode(),
  1145. "errMsg" => $e->getMessage()
  1146. ];
  1147. Log::write($logInfo, "error");
  1148. if ($checkState == TalentState::SCND_SAVE) {
  1149. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  1150. exit();
  1151. } else {
  1152. return json($res);
  1153. }
  1154. }
  1155. }
  1156. /**
  1157. * 卫健保存
  1158. * @param type $info
  1159. * @param \think\Request $request
  1160. * @param type $checkState
  1161. * @return type
  1162. * @throws ValidateException
  1163. */
  1164. private function wjSave($info, \think\Request $request, $checkState) {
  1165. $callback = "infoCallback";
  1166. if (in_array($checkState, [TalentState::FST_SUBMIT, TalentState::SCND_SUBMIT])) {
  1167. $callback = "submitCallback";
  1168. }
  1169. try {
  1170. $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"], "first_submit_time" => $info["first_submit_time"]], $this->user["type"]);
  1171. if ($batch["code"] != 200) {
  1172. throw new ValidateException($batch["msg"]);
  1173. }
  1174. $param = $request->param();
  1175. $i = validate(TalentInfo::class)->check($param);
  1176. $id = $param["id"];
  1177. if ($id) {
  1178. if (!$info || $info["id"] != $id || $info["enterprise_id"] != $this->user["uid"]) {
  1179. throw new ValidateException("没有对应的人才认定申报信息");
  1180. }
  1181. }
  1182. $files = $param["uploadFiles"];
  1183. $data["headimgurl"] = $info["headimgurl"];
  1184. if ($request->file()) {
  1185. $headimg = $request->file("photo");
  1186. $upload = new \app\common\api\UploadApi();
  1187. $result = $upload->uploadOne($headimg, "image", "talent/photo");
  1188. if ($result->code == 500) {
  1189. throw new ValidateException($result->msg);
  1190. }
  1191. $file = imagecreatefromstring(file_get_contents("storage/" . $result->filepath));
  1192. $width = imagesx($file);
  1193. $height = imagesy($file);
  1194. //免冠二寸照长宽413:579
  1195. if ($width * 579 != $height * 413) {
  1196. @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
  1197. throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  1198. }
  1199. if ($info && $info["headimgurl"]) {
  1200. //如果新照片符合像素要求,则删除旧照片
  1201. $old_head_url = "storage/" . $info["headimgurl"];
  1202. if (file_exists($old_head_url))
  1203. @unlink($old_head_url);
  1204. }
  1205. $data["headimgurl"] = $result->filepath;
  1206. }
  1207. if (!$data["headimgurl"] && ($checkState == TalentState::SCND_SUBMIT || $checkState == TalentState::FST_SUBMIT))
  1208. throw new ValidateException("请上传头像。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  1209. $data["apply_year"] = $batch["batch"];
  1210. $all_valid_keys = ["name", "sex", "nation", "politics", "card_type", "card_number", "birthday", "talent_type",
  1211. "highest_degree", "graduate_school", "major", "study_abroad", "abroad_school", "abroad_major",
  1212. "position", "cur_entry_time", "labor_contract_rangetime", "title", "fst_city_work_time",
  1213. "is_fujian_talent", "is_jinjiang_talent", "talent_arrange", "talent_condition",
  1214. "phone", "email", "bank", "bank_account", "bank_number", "bank_branch_name", "experience", "education"];
  1215. foreach ($all_valid_keys as $key) {
  1216. $value = trim($param[$key]);
  1217. if ($value) {
  1218. $data[$key] = $value;
  1219. }
  1220. }
  1221. if ($info["real_state"] == TalentState::FST_VERIFY_REJECT || $info["real_state"] == TalentState::BASE_REJECT) {
  1222. //真实状态11是驳回,需要判断什么字段可以提交
  1223. $modify_fields = array_filter(explode(",", $info["modify_fields"]));
  1224. $tmp_data = $data;
  1225. $data = [];
  1226. foreach ($modify_fields as $field) {
  1227. $data[$field] = $tmp_data[$field];
  1228. }
  1229. }
  1230. $data["checkState"] = $checkState;
  1231. $data["id"] = $id;
  1232. $success_msg = "提交成功";
  1233. $error_msg = "提交失败";
  1234. if ($checkState == TalentState::SCND_SAVE || $checkState == TalentState::FST_SAVE) {
  1235. $success_msg = "保存成功";
  1236. if ($data["id"]) {
  1237. //编辑
  1238. $data["updateTime"] = date("Y-m-d H:i:s");
  1239. TalentModel::update($data);
  1240. $last_log = TalentLogApi::getLastLog($data["id"], 1);
  1241. if ($last_log["new_state"] != TalentState::SCND_SAVE && $last_log["new_state"] != TalentState::FST_SAVE) {
  1242. TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
  1243. } else {
  1244. if (!$last_log["companyId"]) {
  1245. TalentLogApi::setActive($last_log["id"], 1); //更新修改时间
  1246. }
  1247. }
  1248. } else {
  1249. //新增
  1250. $data["enterprise_id"] = $this->user["uid"];
  1251. $data["createTime"] = date("Y-m-d H:i:s");
  1252. $id = TalentModel::insertGetId($data);
  1253. TalentLogApi::write(1, $id, $checkState, "保存未提交", 1);
  1254. $whr = [];
  1255. $whr[] = ["fileId", "in", $files];
  1256. $upd_checklog["mainId"] = $id;
  1257. Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
  1258. }
  1259. //$res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  1260. //echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1261. //exit();
  1262. } else if ($checkState == TalentState::SCND_SUBMIT || $checkState == TalentState::FST_SUBMIT) {
  1263. if (!$info["first_submit_time"]) {
  1264. $data["first_submit_time"] = date("Y-m-d H:i:s");
  1265. } else {
  1266. $data["new_submit_time"] = date("Y-m-d H:i:s");
  1267. }
  1268. $data["updateTime"] = date("Y-m-d H:i:s");
  1269. TalentModel::update($data);
  1270. TalentLogApi::write(1, $data["id"], $checkState, "确认提交审核", 1);
  1271. //$res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  1272. //echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1273. //exit();
  1274. } else {
  1275. throw new ValidateException($error_msg);
  1276. }
  1277. if ($id) {
  1278. $whr = [];
  1279. $whr[] = ["id", "in", $files];
  1280. Db::table("new_talent_file")->where($whr)->save(["mainId" => $id]);
  1281. $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  1282. //$callback = $checkState == TalentState::SCND_SAVE ? "infoCallback" : "submitCallback";
  1283. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1284. exit();
  1285. } else {
  1286. throw new ValidateException($error_msg);
  1287. }
  1288. } catch (ValidateException $e) {
  1289. $res = ["msg" => $e->getMessage()];
  1290. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1291. exit();
  1292. } catch (\think\Exception $e) {
  1293. $res = ["msg" => "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()];
  1294. $logInfo = [
  1295. "enterprise_id" => $this->user["uid"],
  1296. "data" => $data,
  1297. "controller" => $this->request->controller(),
  1298. "action" => $this->request->action(),
  1299. "errCode" => $e->getCode(),
  1300. "errMsg" => $e->getMessage()
  1301. ];
  1302. Log::write($logInfo, "error");
  1303. echo sprintf("<script>parent.TalentInfoInfoDlg.{$callback}(%s);</script>", json_encode($res));
  1304. exit();
  1305. }
  1306. }
  1307. private function gjSave($info, \think\Request $request, $checkState) {
  1308. try {
  1309. $batch = BatchApi::checkBatchValid(["type" => ProjectState::TALENT, "year" => $info["apply_year"], "first_submit_time" => $info["first_submit_time"]], $this->user["type"]);
  1310. if ($batch["code"] != 200) {
  1311. throw new ValidateException($batch["msg"]);
  1312. }
  1313. $param = $request->param();
  1314. validate(TalentInfo::class)->check($param);
  1315. $id = $param["id"];
  1316. if ($id) {
  1317. if (!$info || $info["id"] != $id || $info["enterprise_id"] != $this->user["uid"]) {
  1318. throw new ValidateException("没有对应的人才认定申报信息");
  1319. }
  1320. }
  1321. $files = $param["uploadFiles"];
  1322. $data["headimgurl"] = $info["headimgurl"];
  1323. if ($request->file()) {
  1324. $headimg = $request->file("photo");
  1325. $upload = new \app\common\api\UploadApi();
  1326. $result = $upload->uploadOne($headimg, "image", "talent/photo");
  1327. if ($result->code == 500) {
  1328. throw new ValidateException($result->msg);
  1329. }
  1330. $file = imagecreatefromstring(file_get_contents("storage/" . $result->filepath));
  1331. $width = imagesx($file);
  1332. $height = imagesy($file);
  1333. //免冠二寸照长宽413:579
  1334. if ($width * 579 != $height * 413) {
  1335. @unlink("storage/" . $result->filepath); //像素不符合,删除上传文件
  1336. throw new ValidateException("近期免冠半身彩照(二寸)不符合二寸像素标准。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  1337. }
  1338. if ($info && $info["headimgurl"]) {
  1339. //如果新照片符合像素要求,则删除旧照片
  1340. $old_head_url = "storage/" . $info["headimgurl"];
  1341. if (file_exists($old_head_url))
  1342. @unlink($old_head_url);
  1343. }
  1344. $data["headimgurl"] = $result->filepath;
  1345. }
  1346. if (!$data["headimgurl"] && $checkState == TalentState::SCND_SUBMIT)
  1347. throw new ValidateException("请上传头像。*<span style='color:#ff0000;'>二寸像素标准[413*579]</span>");
  1348. $data["apply_year"] = $batch["batch"];
  1349. $all_valid_keys = ["name", "nation", "card_type", "card_number", "sex", "birthday", "politics", "nationality", "province", "city", "county", "talent_type",
  1350. "position", "cur_entry_time", "labor_contract_rangetime",
  1351. "highest_degree", "graduate_school", "major", "study_abroad", "title", "pro_qua", "phone", "email",
  1352. "is_fujian_talent", "is_jinjiang_talent", "talent_arrange", "talent_condition", "identifyGetTime",
  1353. "bank", "bank_account", "bank_number", "bank_branch_name", "experience", "education"];
  1354. foreach ($all_valid_keys as $key) {
  1355. $value = trim($param[$key]);
  1356. if ($value) {
  1357. $data[$key] = $value;
  1358. }
  1359. }
  1360. if ($data["study_abroad"] == 1) {
  1361. $data["abroad_school"] = $param["abroad_school"];
  1362. $data["abroad_major"] = $param["abroad_major"];
  1363. }
  1364. if ($data["study_abroad"] == 2) {
  1365. $data["abroad_school"] = null;
  1366. $data["abroad_major"] = null;
  1367. }
  1368. if ($info["real_state"] == TalentState::FST_VERIFY_REJECT) {
  1369. //真实状态11是驳回,需要判断什么字段可以提交
  1370. $modify_fields = array_filter(explode(",", $info["modify_fields"]));
  1371. $tmp_data = $data;
  1372. $data = [];
  1373. foreach ($modify_fields as $field) {
  1374. $data[$field] = $tmp_data[$field];
  1375. }
  1376. }
  1377. $success_msg = "提交成功";
  1378. $error_msg = "提交失败";
  1379. if ($checkState == TalentState::SCND_SAVE) {
  1380. $data["checkState"] = $checkState;
  1381. $data["id"] = $id;
  1382. $success_msg = "保存成功";
  1383. if ($data["id"]) {
  1384. //编辑
  1385. $data["updateTime"] = date("Y-m-d H:i:s");
  1386. TalentModel::update($data);
  1387. $last_log = TalentLogApi::getLastLog($data["id"], 1);
  1388. if ($last_log["new_state"] != TalentState::SCND_SAVE) {
  1389. TalentLogApi::write(1, $data["id"], $checkState, "保存未提交", 1);
  1390. } else {
  1391. if (!$last_log["companyId"]) {
  1392. TalentLogApi::setActive($last_log["id"], 1); //更新修改时间
  1393. }
  1394. }
  1395. } else {
  1396. //新增
  1397. $data["enterprise_id"] = $this->user["uid"];
  1398. $data["createTime"] = date("Y-m-d H:i:s");
  1399. $id = TalentModel::insertGetId($data);
  1400. TalentLogApi::write(1, $id, $checkState, "保存未提交", 1);
  1401. $whr = [];
  1402. $whr[] = ["fileId", "in", $files];
  1403. $upd_checklog["mainId"] = $id;
  1404. Db::table("new_talent_checklog")->where($whr)->save($upd_checklog);
  1405. }
  1406. $res = ["code" => 200, "msg" => $success_msg, "obj" => ["id" => $id, "checkState" => $checkState]];
  1407. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  1408. exit();
  1409. } else if ($checkState == TalentState::SCND_SUBMIT) {
  1410. unset($data);
  1411. $data["checkState"] = $checkState;
  1412. $data["id"] = $id;
  1413. if (!$info["first_submit_time"]) {
  1414. $data["first_submit_time"] = date("Y-m-d H:i:s");
  1415. } else {
  1416. $data["new_submit_time"] = date("Y-m-d H:i:s");
  1417. }
  1418. $data["updateTime"] = date("Y-m-d H:i:s");
  1419. TalentModel::update($data);
  1420. TalentLogApi::write(1, $data["id"], $checkState, "确认提交审核", 1);
  1421. return json(["msg" => $success_msg, "code" => 200]);
  1422. } else {
  1423. throw new ValidateException($error_msg);
  1424. }
  1425. } catch (ValidateException $e) {
  1426. if ($checkState == TalentState::SCND_SAVE) {
  1427. $res = ["msg" => $e->getMessage()];
  1428. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  1429. exit();
  1430. } else {
  1431. return json(["msg" => $e->getMessage()]);
  1432. }
  1433. } catch (\think\Exception $e) {
  1434. $res = ["msg" => "发生预料外错误,请联系管理员处理,错误代码:" . $e->getCode()];
  1435. $logInfo = [
  1436. "enterprise_id" => $this->user["uid"],
  1437. "data" => $data,
  1438. "controller" => $this->request->controller(),
  1439. "action" => $this->request->action(),
  1440. "errCode" => $e->getCode(),
  1441. "errMsg" => $e->getMessage()
  1442. ];
  1443. Log::write($logInfo, "error");
  1444. if ($checkState == TalentState::SCND_SAVE) {
  1445. echo sprintf("<script>parent.TalentInfoInfoDlg.infoCallback(%s);</script>", json_encode($res));
  1446. exit();
  1447. } else {
  1448. return json($res);
  1449. }
  1450. }
  1451. }
  1452. public function delete() {
  1453. $id = $this->request->param("talentInfoId");
  1454. $info = Talent::chkIsOwner($id, $this->user["uid"]);
  1455. if (!$info) {
  1456. return json(["msg" => "操作失败"]);
  1457. }
  1458. $checkState = $info["checkState"];
  1459. if (in_array($checkState, [0, 1])) {
  1460. $log = TalentLogApi::getLastLog($id, 1);
  1461. if ($log["state"] > 1) {
  1462. //有提交审核记录
  1463. return json(["msg" => "该申报已提交审核,无法删除"]);
  1464. }
  1465. }
  1466. $data["id"] = $id;
  1467. $data["updateTime"] = date("Y-m-d H:i:s");
  1468. $data["delete"] = 1;
  1469. TalentModel::update($data);
  1470. return json(["msg" => "删除成功"]);
  1471. }
  1472. public function detail() {
  1473. $id = $this->request->param("id");
  1474. $info = $this->getInfoById($id);
  1475. return json($info);
  1476. }
  1477. public function getInfoById($id) {
  1478. $info = \app\common\api\VerifyApi::getTalentInfoById($id);
  1479. if ($info["enterprise_id"] != $this->user["uid"]) {
  1480. return [];
  1481. }
  1482. return $info;
  1483. }
  1484. public function findTalentInfoInLibrary() {
  1485. $where = [];
  1486. $sList = [];
  1487. $type = $this->request->param('type');
  1488. if ($type == ProjectState::QUIT) {
  1489. $_where = [];
  1490. $_where[] = ["checkState", "not in", [3]];
  1491. $idCards = Db::table("un_talent_quit")->where($_where)->column("idCard");
  1492. $sList = array_merge($sList, (array) $idCards);
  1493. $where[] = ["active", "=", 1];
  1494. }
  1495. if ($type == ProjectState::BANKCHANGE) {
  1496. $_where = [];
  1497. $_where[] = ["checkState", "not in", [3]];
  1498. $idCards = Db::table("un_talent_bank_change")->where($_where)->column("idCard");
  1499. $sList = array_merge($sList, (array) $idCards);
  1500. }
  1501. if ($type == ProjectState::LEVELCHANGE) {
  1502. $_where = [];
  1503. $_where[] = ["checkState", "not in", [35, -1]];
  1504. $_where[] = ["isPublic", "<", 5];
  1505. $idCards = Db::table("un_talent_type_change")->where($_where)->column("idCard");
  1506. $sList = array_merge($sList, (array) $idCards);
  1507. }
  1508. $where[] = ["enterprise_id", "=", $this->user["uid"]];
  1509. $where[] = ["checkState", "=", TalentState::CERTIFICATED];
  1510. $where[] = ["isEffect", "<>", 4];
  1511. if ($sList) {
  1512. $where[] = ["card_number", "not in", $sList];
  1513. }
  1514. $result = TalentModel::where($where)->field("id,name")->select()->toArray();
  1515. return json($result);
  1516. }
  1517. public function findTalentInfoByChangeId() {
  1518. $where = [];
  1519. $id = $this->request->param('id');
  1520. $type = $this->request->param('type');
  1521. if ($type == ProjectState::QUIT) {
  1522. $info = Db::table("un_talent_quit")->where("id", $id)->find();
  1523. }
  1524. if ($type == ProjectState::LEVELCHANGE) {
  1525. $info = Db::table("un_talent_type_change")->where("id", $id)->find();
  1526. }
  1527. if ($type == ProjectState::BANKCHANGE) {
  1528. $info = Db::table("un_talent_bank_change")->where("id", $id)->find();
  1529. }
  1530. if (strlen($info["talentId"]) == 19) {
  1531. $where[] = ["enterprise_id", "=", $this->user["uid"]];
  1532. $where[] = ["card_number", "=", $info["idCard"]];
  1533. $where[] = ["delete", "=", 0];
  1534. $where[] = ["checkState", "=", TalentState::CERTIFICATED];
  1535. } else {
  1536. $where[] = ["id", "=", $info["talentId"]];
  1537. }
  1538. $result = TalentModel::where($where)->field("id,name")->select()->toArray();
  1539. return json($result);
  1540. }
  1541. public function getTalentBasicById() {
  1542. $id = $this->request["id"];
  1543. $ti = \app\common\api\VerifyApi::getTalentInfoById($id);
  1544. /* if(FengStringUtil.isNotEmpAndNull(year)){
  1545. StringBuilder sb = new StringBuilder();
  1546. List<TalentAllowancecontractDetail> contractDetailList = new ArrayList<>(); //保存上一年度的工作单位
  1547. TalentAllowanceInfo info = new TalentAllowanceInfo();
  1548. info.setType(ti.getType());
  1549. info.setYear(year);
  1550. info.setFirstInJJTime(ti.getFirstInJJTime());
  1551. ApiTalentAllowanceController.getConcatList(ti,info,year,sb,contractDetailList);
  1552. int active = AllowanceSelectUtil.validMyqy(contractDetailList,ti,info);
  1553. ti.setActive(active);
  1554. } */
  1555. return $ti;
  1556. }
  1557. /**
  1558. *
  1559. */
  1560. public function getTalentInfoFromOldLibrary() {
  1561. $responseObj = new \stdClass();
  1562. $responseObj->code = 500;
  1563. $ep = EnterpriseApi::getOne($this->user["uid"]);
  1564. $pIdCard = \StrUtil::getRequestDecodeParam($this->request, "idCard");
  1565. $eIdCard = $ep->idCard;
  1566. $where = [];
  1567. $where[] = ["e.idCard", "=", $eIdCard];
  1568. $where[] = ["ti.idCard", "=", $pIdCard];
  1569. $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();
  1570. if ($old) {
  1571. $responseObj->code = 200;
  1572. $responseObj->info = $old;
  1573. return $responseObj;
  1574. }
  1575. return $responseObj;
  1576. }
  1577. /**
  1578. * 审核列表页
  1579. */
  1580. public function examineCenter() {
  1581. $tpl = "";
  1582. switch ($this->user["type"]) {
  1583. case CommonConst::ENTERPRISE_WJ:
  1584. $tpl = "/talent/hospital/examine_center"; //卫健医院
  1585. break;
  1586. }
  1587. return view($tpl);
  1588. }
  1589. /**
  1590. * 审核列表页
  1591. */
  1592. public function examineList() {
  1593. $res = TalentApi::getHospitalExamineList($this->request);
  1594. return json($res);
  1595. }
  1596. public function examinePage() {
  1597. $id = $this->request->param("id");
  1598. $info = \app\common\api\VerifyApi::getTalentInfoById($id);
  1599. return view("/talent/hospital/view", ["row" => $info]);
  1600. }
  1601. /**
  1602. * 医院人才申报审核保存
  1603. * @return type
  1604. */
  1605. public function check() {
  1606. $request = $this->request;
  1607. $params = $request->param();
  1608. $check = $params["checkState"];
  1609. $check_msg = trim($params["checkMsg"]);
  1610. $files = $params["files"];
  1611. $fields = $params["fields"];
  1612. $id = $params["id"];
  1613. $talent_info = \app\common\api\VerifyApi::getOne($id);
  1614. if (!$talent_info) {
  1615. return json(["msg" => "数据错误"]);
  1616. }
  1617. $enterprise = EnterpriseApi::getOne($talent_info["enterprise_id"]);
  1618. $checkState = $talent_info["checkState"];
  1619. if ($this->user["isGeneral"] != 1) {
  1620. return json(["msg" => "非总院账号,无法审核"]);
  1621. }
  1622. if ($this->user["medicalCommunityId"] != $enterprise["medicalCommunityId"]) {
  1623. return json(["msg" => "不能审核其它非本医共体医院"]);
  1624. }
  1625. if (!$check) {
  1626. return json(["msg" => "请选择审核状态"]);
  1627. }
  1628. if (!$check_msg) {
  1629. return json(["msg" => "请填写审核说明"]);
  1630. }
  1631. if ($checkState == TalentState::FST_SUBMIT) {
  1632. if ($params["checkState"] == 3) {
  1633. //审核成功
  1634. $log_checkState = $checkState = TalentState::SCND_SUBMIT; //待初审
  1635. } else {
  1636. //审核驳回并记录需要修改的字段和上传文件
  1637. $checkState = TalentState::FST_SAVE; //退回材料编辑状态
  1638. $log_checkState = TalentState::BASE_REJECT; //日志记录拒绝状态
  1639. }
  1640. $log = TalentLogApi::getLastLog($id, 1);
  1641. if (!$log && !$talent_info["oldId"])
  1642. return json(["msg" => "日志数据异常,保存失败"]);
  1643. if ($log["active"] === 0) {
  1644. TalentLogApi::rewrite($log["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  1645. } else {
  1646. TalentLogApi::write(1, $talent_info["id"], [$log_checkState, $checkState], $params["checkMsg"]);
  1647. }
  1648. $data["id"] = $talent_info["id"];
  1649. $data["modify_files"] = $params["files"];
  1650. $data["modify_fields"] = $params["fields"];
  1651. TalentModel::update($data);
  1652. return json(["code" => 200, "msg" => "保存成功"]);
  1653. } else {
  1654. return json(["msg" => "不在审核范围内,保存失败"]);
  1655. }
  1656. }
  1657. /**
  1658. * 医院人才申报审核
  1659. * @return type
  1660. */
  1661. public function submitCheck() {
  1662. $id = $this->request->param("id");
  1663. $talent_info = \app\common\api\VerifyApi::getOne($id);
  1664. if (!$talent_info) {
  1665. return json(["msg" => "数据错误"]);
  1666. }
  1667. $enterprise = EnterpriseApi::getOne($talent_info["enterprise_id"]);
  1668. $checkState = $talent_info["checkState"];
  1669. if ($this->user["isGeneral"] != 1) {
  1670. return json(["msg" => "非总院账号,无法审核"]);
  1671. }
  1672. if ($this->user["medicalCommunityId"] != $enterprise["medicalCommunityId"]) {
  1673. return json(["msg" => "不能审核其它非本医共体医院"]);
  1674. }
  1675. if ($checkState == TalentState::FST_SUBMIT) {
  1676. $nowProcess = 1;
  1677. $log = TalentLogApi::getLastLog($talent_info["id"], 1);
  1678. if (!$log || $log["active"] == 1)
  1679. return json(["msg" => "请先保存审核状态,再提交审核"]);
  1680. if (in_array($log["new_state"], [TalentState::SCND_SUBMIT])) {
  1681. $data["highProcess"] = $nowProcess > $talent_info["highProcess"] ? $nowProcess : $talent_info["highProcess"];
  1682. }
  1683. $data["id"] = $talent_info["id"];
  1684. $data["checkState"] = $log["new_state"];
  1685. TalentModel::update($data);
  1686. TalentLogApi::setActive($log["id"], 1);
  1687. if ($log["state"] == TalentState::BASE_REJECT) {
  1688. $this->sendMsg($enterprise["id"], $log["description"]);
  1689. }
  1690. return json(["code" => 200, "msg" => "审核成功"]);
  1691. } else {
  1692. return json(["msg" => "不在审核范围内,审核失败"]);
  1693. }
  1694. }
  1695. public function findFieldsAndFiles() {
  1696. $id = $this->request["id"];
  1697. $talentInfo = TalentApi::getOne($id);
  1698. $lastLog = TalentLogApi::getLastLog($id, ProjectState::TALENT);
  1699. $responseObj = new \stdClass();
  1700. if ($talentInfo["checkState"] == TalentState::FST_SAVE && $lastLog["state"] == TalentState::BASE_REJECT) {
  1701. $fields = DictApi::getTalentFields_WJ();
  1702. $field_tmp = [];
  1703. if ($fields) {
  1704. foreach ($fields as $key => $field) {
  1705. $field_tmp[] = ["key" => $key, "value" => $field];
  1706. }
  1707. }
  1708. $condition = TalentConditionApi::getOne($talentInfo["talent_condition"]);
  1709. $where = [];
  1710. $whr = [];
  1711. $where[] = ["project", "=", 1];
  1712. $where[] = ["active", "=", 1];
  1713. $where[] = ["type", "=", CommonConst::ENTERPRISE_WJ];
  1714. $where[] = ["isConditionFile", "<>", 1];
  1715. $where[] = ["delete", "=", 0];
  1716. if ($condition && $condition["bindFileTypes"]) {
  1717. $whr[] = ["id", "in", explode(",", $condition["bindFileTypes"])];
  1718. $files = \think\facade\Db::table("new_common_filetype")->whereOr([$where, $whr])->order("sn asc")->select();
  1719. } else {
  1720. $files = \think\facade\Db::table("new_common_filetype")->where($where)->order("sn asc")->select();
  1721. }
  1722. $responseObj->code = 200;
  1723. $responseObj->id = $id;
  1724. $responseObj->fileList = $files;
  1725. $responseObj->fieldList = $field_tmp;
  1726. $responseObj->select = [
  1727. "files" => array_filter(explode(",", $talentInfo["modify_files"])),
  1728. "fields" => array_filter(explode(",", $talentInfo["modify_fields"]))
  1729. ];
  1730. } else {
  1731. $responseObj->msg = "不是驳回状态不可以编辑驳回内容";
  1732. }
  1733. return json($responseObj);
  1734. }
  1735. /**
  1736. * 初审-修改驳回字段
  1737. * @auth {{/talentInfo/updateFieldsAndFiles}}
  1738. */
  1739. public function updateFieldsAndFiles() {
  1740. $id = $this->request["id"];
  1741. $fields = array_filter(explode(",", $this->request["fields"]));
  1742. $files = array_filter(explode(",", $this->request["files"]));
  1743. $talentInfo = TalentApi::getOne($id);
  1744. $lastLog = TalentLogApi::getLastLog($id, ProjectState::TALENT);
  1745. $responseObj = new \stdClass();
  1746. if ($talentInfo["checkState"] == TalentState::FST_SAVE && $lastLog["state"] == TalentState::BASE_REJECT) {
  1747. if (!$fields && !$files) {
  1748. $responseObj->msg = "请选择可修改的字段或附件!";
  1749. return json($responseObj);
  1750. }
  1751. try {
  1752. $data["id"] = $id;
  1753. $data["modify_fields"] = $fields ? implode(",", $fields) : null;
  1754. $data["modify_files"] = $files ? implode(",", $files) : null;
  1755. TalentModel::update($data);
  1756. $responseObj->code = 200;
  1757. $responseObj->msg = "驳回字段修改成功";
  1758. return json($responseObj);
  1759. } catch (\think\db\exception\DbException $e) {
  1760. $responseObj->msg = $e->getMessage();
  1761. return json($responseObj);
  1762. }
  1763. } else {
  1764. $responseObj->msg = "不是驳回状态不可以编辑驳回内容";
  1765. return json($responseObj);
  1766. }
  1767. }
  1768. private function sendMsg($enterprise_id, $description = "") {
  1769. $ep = EnterpriseApi::getOne($enterprise_id);
  1770. if ($ep->agentPhone) {
  1771. $smsapi = new \app\common\api\ChuanglanSmsApi();
  1772. $result = $smsapi->sendSMS($phone, $template);
  1773. $result = json_decode($result, true);
  1774. $id = getStringId();
  1775. $record_data = [
  1776. 'id' => $id,
  1777. 'userId' => $ep->id,
  1778. 'bizId' => $result["msgId"],
  1779. 'type' => 2,
  1780. 'smsType' => 2,
  1781. 'name' => $ep->name,
  1782. 'phone' => $ep->agentPhone,
  1783. 'params' => "总院审核",
  1784. 'templateCode' => "【晋江市人才服务平台】尊敬的用户,您提交的人才认定申报审核驳回,原因是:{$description},请及时登录申报系统修改并重新提交。",
  1785. 'state' => $result['code'] == 0 ? 2 : 3,
  1786. 'sendingDate' => date("Y-m-d H:i:s", time()),
  1787. 'createTime' => date("Y-m-d H:i:s", time()),
  1788. 'msg' => $result['errorMsg']
  1789. ];
  1790. \app\admin\model\MessageRecord::create($record_data);
  1791. }
  1792. }
  1793. public function validateIsCheck() {
  1794. $params = $this->request->param();
  1795. $id = $params["id"];
  1796. $talent_info = \app\common\api\VerifyApi::getTalentInfoById($id);
  1797. $enterprise = EnterpriseApi::getOne($talent_info["enterprise_id"]);
  1798. if ($talent_info) {
  1799. $checkState = $talent_info["checkState"];
  1800. if ($this->user["isGeneral"] != 1) {
  1801. return json(["msg" => "非总院账号,无法审核"]);
  1802. }
  1803. if ($this->user["medicalCommunityId"] != $enterprise["medicalCommunityId"]) {
  1804. return json(["msg" => "不能审核其它非本医共体医院"]);
  1805. }
  1806. if ($checkState != TalentState::FST_SUBMIT) {
  1807. return json(["msg" => "该申报不在审核范围内,无法审核"]);
  1808. }
  1809. $fields = DictApi::getTalentFields_WJ();
  1810. $field_tmp = [];
  1811. if ($fields) {
  1812. foreach ($fields as $key => $field) {
  1813. $field_tmp[] = ["key" => $key, "value" => $field];
  1814. }
  1815. }
  1816. $condition = TalentConditionApi::getOne($talent_info["talent_condition"]);
  1817. $where = [];
  1818. $whr = [];
  1819. $where[] = ["project", "=", 1];
  1820. $where[] = ["active", "=", 1];
  1821. $where[] = ["type", "=", $enterprise["type"]];
  1822. $where[] = ["isConditionFile", "<>", 1];
  1823. $where[] = ["delete", "=", 0];
  1824. if ($condition && $condition["bindFileTypes"]) {
  1825. $whr[] = ["id", "in", explode(",", $condition["bindFileTypes"])];
  1826. $files = \think\facade\Db::table("new_common_filetype")->whereOr([$where, $whr])->order("sn asc")->select();
  1827. } else {
  1828. $files = \think\facade\Db::table("new_common_filetype")->where($where)->order("sn asc")->select();
  1829. }
  1830. $talent_info["files"] = array_filter(explode(",", $talent_info["modify_files"]));
  1831. $talent_info["fields"] = array_filter(explode(",", $talent_info["modify_fields"]));
  1832. /* 保存的审核内容start */
  1833. $last_log = TalentLogApi::getLastLog($id, ProjectState::TALENT, 0, ["active", "=", 0]);
  1834. $check = ["msg" => $last_log["description"]];
  1835. if ($last_log["state"] == TalentState::BASE_VERIFY_PASS) {
  1836. $check["checkState"] = 3;
  1837. }
  1838. if ($last_log["new_state"] == TalentState::FST_SAVE && $last_log["state"] == TalentState::BASE_REJECT) {
  1839. $check["checkState"] = 2;
  1840. }
  1841. /* 保存的审核内容end */
  1842. return json(["code" => 200, "obj" => ["talentInfo" => $talent_info, "check" => $check, "fieldList" => $field_tmp, "fileList" => $files]]);
  1843. }
  1844. }
  1845. // public function mixDelete() {
  1846. // $id = $this->request->param("talentInfoId");
  1847. // $info = TalentApi::chkIsOwner($id, $this->user["uid"]);
  1848. // if (!$info) {
  1849. // return json(["msg" => "操作失败"]);
  1850. // }
  1851. // $checkState = $info["checkState"];
  1852. // if (in_array($checkState, [0, TalentState::SCND_SAVE])) {
  1853. // $data["id"] = $id;
  1854. // $data["delete"] = 1;
  1855. // TalentModel::update($data);
  1856. // return json(["msg" => "删除成功"]);
  1857. // }
  1858. // return json(["msg" => "该申报已提交审核,无法删除"]);
  1859. // }
  1860. }