EnterpriseApi.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507
  1. <?php
  2. namespace app\common\api;
  3. use app\admin\controller\EnterpriseChangeRecord;
  4. use app\common\api\CompanyApi;
  5. use app\enterprise\model\EnterpriseRecord;
  6. use think\facade\Db;
  7. use app\admin\model\Enterprise;
  8. class EnterpriseApi {
  9. public static function getOne($id) {
  10. return Enterprise::findOrEmpty($id);
  11. }
  12. public static function getSimpleList() {
  13. $where[] = ["active", "=", 1];
  14. return $list = Enterprise::where($where)->order("name", 'asc')->field("name,id")->select()->toArray();
  15. }
  16. public static function getList($request) {
  17. $companyId = session('user')['companyId'];
  18. $company_info = CompanyApi::getOne($companyId);
  19. $where = [];
  20. $whereRaw = "";
  21. if ($company_info['code'] != 'super') {
  22. $where[] = ['type', '=', session('user')['type']];
  23. if (session('user')['type'] == 1) {
  24. $whr[] = ["companyId", "=", $companyId];
  25. $whr[] = ["delete", "=", 0];
  26. $list = \app\common\model\EnterpriseVerifyMgr::where($whr)->select()->toArray();
  27. $talentType = []; //查找单位对应标签
  28. $org = [];
  29. $ins = [];
  30. $uniCodes = []; //查找单位对应例外
  31. foreach ($list as $k => $v) {
  32. if (!empty($v['enterpriseTag'])) {
  33. array_push($talentType, $v['enterpriseTag']);
  34. }
  35. if (!empty($v['organizationTag'])) {
  36. array_push($org, $v['organizationTag']);
  37. }
  38. if (!empty($v['institutionTag'])) {
  39. array_push($ins, $v['institutionTag']);
  40. }
  41. if (!empty($v["uniCode"])) {
  42. $codes = explode(",", $v["uniCode"]);
  43. $uniCodes = array_merge($uniCodes, (array) $codes);
  44. }
  45. }
  46. $_whr[] = ["uniCode", "<>", ""];
  47. $_whr[] = ["delete", "=", 0];
  48. $_whr[] = ["companyId", "<>", $companyId];
  49. $_list = \app\common\model\EnterpriseVerifyMgr::where($_whr)->select()->toArray();
  50. $expUniCodes = []; //排除其它单位的例外
  51. foreach ($_list as $_v) {
  52. $codes = explode(",", $_v["uniCode"]);
  53. $expUniCodes = array_merge($expUniCodes, (array) $codes);
  54. }
  55. if (($talentType || $org || $ins) && $uniCodes) {
  56. if ($expUniCodes) {
  57. $whereRaw = sprintf('(enterpriseTag in ("%s") or organizationTag in ("%s") or institutionTag in ("%s") and idCard not in ("%s")) or idCard in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $expUniCodes), implode('","', $uniCodes));
  58. } else {
  59. $whereRaw = sprintf('enterpriseTag in ("%s") or organizationTag in ("%s") or institutionTag in ("%s") or idCard in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $uniCodes));
  60. }
  61. }
  62. if (($talentType || $org || $ins) && !$uniCodes) {
  63. if ($expUniCodes) {
  64. $whereRaw = sprintf('enterpriseTag in ("%s") or organizationTag in ("%s") or institutionTag in ("%s") and idCard not in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $expUniCodes));
  65. } else {
  66. $whereRaw = sprintf('enterpriseTag in ("%s") or organizationTag in ("%s") or institutionTag in ("%s") ', implode('","', $talentType), implode('","', $org), implode('","', $ins));
  67. }
  68. }
  69. if (!$talentType && !$org && !$ins && $uniCodes) {
  70. $where[] = ["idCard", "in", $uniCodes];
  71. }
  72. }
  73. }
  74. $offset = trim($request->param("offset")) ?: 0;
  75. $limit = trim($request->param("limit")) ?: 10;
  76. $name = trim($request->param("name"));
  77. $idCard = trim($request->param("idCard"));
  78. $legal = trim($request->param("legal"));
  79. $ephone = trim($request->param("ephone"));
  80. $agentName = trim($request->param("agentName"));
  81. $agentPhone = trim($request->param("agentPhone"));
  82. $checkState = trim($request->param("checkState"));
  83. $active = trim($request->param("active"));
  84. $street = trim($request->param("street"));
  85. $enterpriseTag = trim($request->param("enterpriseTag"));
  86. $industryFieldNew = trim($request->param("industryFieldNew"));
  87. if ($name) {
  88. $where[] = ["name", "like", "%{$name}%"];
  89. }
  90. if ($idCard) {
  91. $where[] = ["idCard", "like", "%{$idCard}%"];
  92. }
  93. if ($legal) {
  94. $where[] = ["legal", "like", "%{$legal}%"];
  95. }
  96. if ($ephone) {
  97. $where[] = ["ephone", "like", "%{$ephone}%"];
  98. }
  99. if ($agentName) {
  100. $where[] = ["agentName", "like", "%{$agentName}%"];
  101. }
  102. if ($agentPhone) {
  103. $where[] = ["agentPhone", "like", "%{$agentPhone}%"];
  104. }
  105. if ($checkState) {
  106. $where[] = ["checkState", "=", "{$checkState}"];
  107. }
  108. if ($active) {
  109. $where[] = ["active", "=", "{$active}"];
  110. }
  111. if ($street) {
  112. $where[] = ["street", "=", "{$street}"];
  113. }
  114. if ($enterpriseTag) {
  115. $where[] = ["enterpriseTag", "=", "{$enterpriseTag}"];
  116. }
  117. if ($industryFieldNew) {
  118. $where[] = ["industryFieldNew", "=", "{$industryFieldNew}"];
  119. }
  120. if ($whereRaw) {
  121. $count = Enterprise::where($where)->whereRaw($whereRaw)->count();
  122. } else {
  123. $count = Enterprise::where($where)->count();
  124. }
  125. if ($count > 0) {
  126. $talentTypeList = DictApi::selectByParentCode("enterprise_tag");
  127. $orgList = DictApi::selectByParentCode("organization_tag");
  128. $insList = DictApi::selectByParentCode("institution_tag");
  129. $industryFieldNewList = DictApi::selectByParentCode("industry_field");
  130. $streetList = DictApi::selectByParentCode("street");
  131. //dd($talentTypeList);
  132. if ($whereRaw) {
  133. $list = Enterprise::where($where)->whereRaw($whereRaw)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
  134. } else {
  135. $list = Enterprise::where($where)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
  136. }
  137. foreach ($list as $k => &$v) {
  138. unset($v['password']);
  139. $v['enterpriseTagName'] = array_key_exists($v['enterpriseTag'], $talentTypeList) ? $talentTypeList[$v['enterpriseTag']] : ''; //此处旧字段为talentType,新字段为enterpriseTag,为防止数据污染与丢失,因而这样写
  140. $v['organizationTagName'] = array_key_exists($v['organizationTag'], $orgList) ? $orgList[$v['organizationTag']] : '';
  141. $v['institutionTagName'] = array_key_exists($v['institutionTag'], $orgList) ? $orgList[$v['institutionTag']] : '';
  142. $v['industryFieldNewName'] = $industryFieldNewList[$v['industryFieldNew']];
  143. $v['streetName'] = $streetList[$v['street']];
  144. }
  145. } else {
  146. $list = [];
  147. }
  148. return ["total" => $count, "rows" => $list];
  149. }
  150. public static function getRecordList($request) {
  151. $companyId = session('user')['companyId'];
  152. $company_info = CompanyApi::getOne($companyId);
  153. $where = [];
  154. $whereRaw = "";
  155. if ($company_info['code'] != 'super') {
  156. $where[] = ['type', '=', session('user')['type']];
  157. if (session('user')['type'] == 1) {
  158. $whr[] = ["companyId", "=", $companyId];
  159. $whr[] = ["delete", "=", 0];
  160. $list = \app\common\model\EnterpriseVerifyMgr::where($whr)->select()->toArray();
  161. $talentType = []; //查找单位对应标签
  162. $org = [];
  163. $ins = [];
  164. $uniCodes = [];
  165. foreach ($list as $k => $v) {
  166. if (!empty($v['enterpriseTag'])) {
  167. array_push($talentType, $v['enterpriseTag']);
  168. }
  169. if (!empty($v['organizationTag'])) {
  170. array_push($org, $v['organizationTag']);
  171. }
  172. if (!empty($v['institutionTag'])) {
  173. array_push($ins, $v['institutionTag']);
  174. }
  175. if (!empty($v["uniCode"])) {
  176. $codes = explode(",", $v["uniCode"]);
  177. $uniCodes = array_merge($uniCodes, (array) $codes);
  178. }
  179. }
  180. $_whr[] = ["uniCode", "<>", ""];
  181. $_whr[] = ["delete", "=", 0];
  182. $_whr[] = ["companyId", "<>", $companyId];
  183. $_list = \app\common\model\EnterpriseVerifyMgr::where($_whr)->select()->toArray();
  184. $expUniCodes = []; //排除其它单位的例外
  185. foreach ($_list as $_v) {
  186. $codes = explode(",", $_v["uniCode"]);
  187. $expUniCodes = array_merge($expUniCodes, (array) $codes);
  188. }
  189. if (($talentType || $org || $ins) && $uniCodes) {
  190. if ($expUniCodes) {
  191. $whereRaw = sprintf('(newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") and newIdCard not in ("%s")) or newIdCard in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $expUniCodes), implode('","', $uniCodes));
  192. } else {
  193. $whereRaw = sprintf('newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") or newIdCard in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $uniCodes));
  194. }
  195. }
  196. if (($talentType || $org || $ins) && !$uniCodes) {
  197. if ($expUniCodes) {
  198. $whereRaw = sprintf('newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") and newIdCard not in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $expUniCodes));
  199. } else {
  200. $whereRaw = sprintf('newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") ', implode('","', $talentType), implode('","', $org), implode('","', $ins));
  201. }
  202. }
  203. }
  204. }
  205. $offset = trim($request->param("offset")) ?: 0;
  206. $limit = trim($request->param("limit")) ?: 10;
  207. $oldName = trim($request->param("oldName"));
  208. $oldIdCard = trim($request->param("oldIdCard"));
  209. $oldLegal = trim($request->param("oldLegal"));
  210. $oldStreet = trim($request->param("oldStreet"));
  211. $oldEnterpriseTag = trim($request->param("oldEnterpriseTag"));
  212. $oldIndustryFieldNew = trim($request->param("oldIndustryFieldNew"));
  213. $newName = trim($request->param("newName"));
  214. $newIdCard = trim($request->param("newIdCard"));
  215. $newAgentName = trim($request->param("newAgentName"));
  216. $newStreet = trim($request->param("newStreet"));
  217. $newEnterpriseTag = trim($request->param("newEnterpriseTag"));
  218. $newIndustryFieldNew = trim($request->param("newIndustryFieldNew"));
  219. $checkState = trim($request->param("checkState"));
  220. if ($oldName) {
  221. $where[] = ["oldName", "like", "%{$oldName}%"];
  222. }
  223. if ($oldIdCard) {
  224. $where[] = ["oldIdCard", "like", "%{$oldIdCard}%"];
  225. }
  226. if ($oldLegal) {
  227. $where[] = ["oldLegal", "like", "%{$oldLegal}%"];
  228. }
  229. if ($oldStreet) {
  230. $where[] = ["oldStreet", "=", "{$oldStreet}"];
  231. }
  232. if ($oldEnterpriseTag) {
  233. $where[] = ["oldEnterpriseTag", "=", "{$oldEnterpriseTag}"];
  234. }
  235. if ($oldIndustryFieldNew) {
  236. $where[] = ["oldIndustryFieldNew", "=", "{$oldIndustryFieldNew}"];
  237. }
  238. if ($newName) {
  239. $where[] = ["newName", "like", "%{$newName}%"];
  240. }
  241. if ($newIdCard) {
  242. $where[] = ["newIdCard", "like", "%{$newIdCard}%"];
  243. }
  244. if ($newAgentName) {
  245. $where[] = ["newAgentName", "like", "%{$newAgentName}%"];
  246. }
  247. if ($checkState) {
  248. $where[] = ["checkState", "=", "{$checkState}"];
  249. } else {
  250. $where[] = ['checkState', '>', 1];
  251. }
  252. if ($newStreet) {
  253. $where[] = ["newStreet", "=", "{$newStreet}"];
  254. }
  255. if ($newEnterpriseTag) {
  256. $where[] = ["newEnterpriseTag", "=", "{$newEnterpriseTag}"];
  257. }
  258. if ($newIndustryFieldNew) {
  259. $where[] = ["newIndustryFieldNew", "=", "{$newIndustryFieldNew}"];
  260. }
  261. if ($whereRaw) {
  262. $count = EnterpriseRecord::where($where)->whereRaw($whereRaw)->count();
  263. } else {
  264. $count = EnterpriseRecord::where($where)->count();
  265. }
  266. if ($count > 0) {
  267. $talentTypeList = DictApi::selectByParentCode("enterprise_tag");
  268. $industryFieldNewList = DictApi::selectByParentCode("industry_field");
  269. $streetList = DictApi::selectByParentCode("street");
  270. if ($whereRaw) {
  271. $list = EnterpriseRecord::where($where)->whereRaw($whereRaw)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
  272. } else {
  273. $list = EnterpriseRecord::where($where)->limit($offset, $limit)->order("createTime", 'desc')->select()->toArray();
  274. }
  275. foreach ($list as $k => &$v) {
  276. $v['oldStreetName'] = $streetList[$v['oldStreet']];
  277. $v['newStreetName'] = $streetList[$v['newStreet']];
  278. $v['oldEnterpriseTagName'] = $talentTypeList[$v['oldEnterpriseTag']];
  279. $v['newEnterpriseTagName'] = $talentTypeList[$v['newEnterpriseTag']]; //此处旧字段为talentType,新字段为enterpriseTag,为防止数据污染与丢失,因而这样写
  280. $v['oldIndustryFieldNewName'] = $industryFieldNewList[$v['oldIndustryFieldNew']];
  281. $v['newIndustryFieldNewName'] = $industryFieldNewList[$v['newIndustryFieldNew']];
  282. }
  283. } else {
  284. $list = [];
  285. }
  286. return ["total" => $count, "rows" => $list];
  287. }
  288. public static function getExportList($request) {
  289. $companyId = session('user')['companyId'];
  290. $company_info = CompanyApi::getOne($companyId);
  291. $where = [];
  292. $whereRaw = "";
  293. if ($company_info['code'] != 'super') {
  294. $where[] = ['type', '=', session('user')['type']];
  295. if (session('user')['type'] == 1) {
  296. $whr[] = ["companyId", "=", $companyId];
  297. $whr[] = ["delete", "=", 0];
  298. $list = \app\common\model\EnterpriseVerifyMgr::where($whr)->select()->toArray();
  299. $talentType = []; //查找单位对应标签
  300. $org = [];
  301. $ins = [];
  302. $uniCodes = [];
  303. foreach ($list as $k => $v) {
  304. if (!empty($v['enterpriseTag'])) {
  305. array_push($talentType, $v['enterpriseTag']);
  306. }
  307. if (!empty($v['organizationTag'])) {
  308. array_push($org, $v['organizationTag']);
  309. }
  310. if (!empty($v['institutionTag'])) {
  311. array_push($ins, $v['institutionTag']);
  312. }
  313. if (!empty($v["uniCode"])) {
  314. $codes = explode(",", $v["uniCode"]);
  315. $uniCodes = array_merge($uniCodes, (array) $codes);
  316. }
  317. }
  318. $_whr[] = ["uniCode", "<>", ""];
  319. $_whr[] = ["delete", "=", 0];
  320. $_whr[] = ["companyId", "<>", $companyId];
  321. $_list = \app\common\model\EnterpriseVerifyMgr::where($_whr)->select()->toArray();
  322. $expUniCodes = []; //排除其它单位的例外
  323. foreach ($_list as $_v) {
  324. $codes = explode(",", $_v["uniCode"]);
  325. $expUniCodes = array_merge($expUniCodes, (array) $codes);
  326. }
  327. if (($talentType || $org || $ins) && $uniCodes) {
  328. if ($expUniCodes) {
  329. $whereRaw = sprintf('(newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") and newIdCard not in ("%s")) or newIdCard in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $expUniCodes), implode('","', $uniCodes));
  330. } else {
  331. $whereRaw = sprintf('newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") or newIdCard in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $uniCodes));
  332. }
  333. }
  334. if (($talentType || $org || $ins) && !$uniCodes) {
  335. if ($expUniCodes) {
  336. $whereRaw = sprintf('newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") and newIdCard not in ("%s")', implode('","', $talentType), implode('","', $org), implode('","', $ins), implode('","', $expUniCodes));
  337. } else {
  338. $whereRaw = sprintf('newEnterpriseTag in ("%s") or newOrganizationTag in ("%s") or newInstitutionTag in ("%s") ', implode('","', $talentType), implode('","', $org), implode('","', $ins));
  339. }
  340. }
  341. }
  342. }
  343. $offset = trim($request->param("offset")) ?: 0;
  344. $limit = trim($request->param("limit")) ?: 10;
  345. $oldName = trim($request->param("oldName"));
  346. $oldIdCard = trim($request->param("oldIdCard"));
  347. $oldLegal = trim($request->param("oldLegal"));
  348. $oldStreet = trim($request->param("oldStreet"));
  349. $oldEnterpriseTag = trim($request->param("oldEnterpriseTag"));
  350. $oldIndustryFieldNew = trim($request->param("oldIndustryFieldNew"));
  351. $newName = trim($request->param("newName"));
  352. $newIdCard = trim($request->param("newIdCard"));
  353. $newAgentName = trim($request->param("newAgentName"));
  354. $newStreet = trim($request->param("newStreet"));
  355. $newEnterpriseTag = trim($request->param("newEnterpriseTag"));
  356. $newIndustryFieldNew = trim($request->param("newIndustryFieldNew"));
  357. $checkState = trim($request->param("checkState"));
  358. if ($oldName) {
  359. $where[] = ["oldName", "like", "%{$oldName}%"];
  360. }
  361. if ($oldIdCard) {
  362. $where[] = ["oldIdCard", "like", "%{$oldIdCard}%"];
  363. }
  364. if ($oldLegal) {
  365. $where[] = ["oldLegal", "like", "%{$oldLegal}%"];
  366. }
  367. if ($oldStreet) {
  368. $where[] = ["oldStreet", "=", "{$oldStreet}"];
  369. }
  370. if ($oldEnterpriseTag) {
  371. $where[] = ["oldEnterpriseTag", "=", "{$oldEnterpriseTag}"];
  372. }
  373. if ($oldIndustryFieldNew) {
  374. $where[] = ["oldIndustryFieldNew", "=", "{$oldIndustryFieldNew}"];
  375. }
  376. if ($newName) {
  377. $where[] = ["newName", "like", "%{$newName}%"];
  378. }
  379. if ($newIdCard) {
  380. $where[] = ["newIdCard", "like", "%{$newIdCard}%"];
  381. }
  382. if ($newAgentName) {
  383. $where[] = ["newAgentName", "like", "%{$newAgentName}%"];
  384. }
  385. if ($checkState) {
  386. $where[] = ["checkState", "=", "{$checkState}"];
  387. } else {
  388. $where[] = ['checkState', '>', 1];
  389. }
  390. if ($newStreet) {
  391. $where[] = ["newStreet", "=", "{$newStreet}"];
  392. }
  393. if ($newEnterpriseTag) {
  394. $where[] = ["newEnterpriseTag", "=", "{$newEnterpriseTag}"];
  395. }
  396. if ($newIndustryFieldNew) {
  397. $where[] = ["newIndustryFieldNew", "=", "{$newIndustryFieldNew}"];
  398. }
  399. if ($whereRaw) {
  400. $count = EnterpriseRecord::where($where)->whereRaw($whereRaw)->count();
  401. } else {
  402. $count = EnterpriseRecord::where($where)->count();
  403. }
  404. if ($count > 0) {
  405. $organizationTagList = DictApi::selectByParentCode("organization_tag");
  406. $institutionTag = DictApi::selectByParentCode("institution_tag");
  407. $talentTypeList = DictApi::selectByParentCode("enterprise_tag");
  408. $enterpriseTypeList = DictApi::selectByParentCode("enterprise_type");
  409. $industryFieldNewList = DictApi::selectByParentCode("industry_field");
  410. $streetList = DictApi::selectByParentCode("street");
  411. $agencyTypeList = DictApi::selectByParentCode("agency_type");
  412. if ($whereRaw) {
  413. $list = EnterpriseRecord::where($where)->whereRaw($whereRaw)->order("createTime", 'desc')->select()->toArray();
  414. } else {
  415. $list = EnterpriseRecord::where($where)->order("createTime", 'desc')->select()->toArray();
  416. }
  417. foreach ($list as $k => &$v) {
  418. if ($v["special"] == 1) {
  419. $v["typeName"] = "事业单位";
  420. $v["oldAgencyTagName"] = $institutionTag[$v["oldInstitutionTag"]];
  421. $v["newAgencyTagName"] = $institutionTag[$v["newInstitutionTag"]];
  422. } else if ($v["special"] == 2) {
  423. $v["typeName"] = "民办非企业";
  424. $v["oldAgencyTagName"] = $organizationTagList[$v["oldOrganizationTag"]];
  425. $v["newAgencyTagName"] = $organizationTagList[$v["newOrganizationTag"]];
  426. } else {
  427. $v["typeName"] = "企业用户";
  428. if ($v["type"] == 1) {
  429. $v["typeName"] .= "(晋江市现代产业体系人才)";
  430. } else if ($v["type"] == 2) {
  431. $v["typeName"] .= "(集成电路优秀人才)";
  432. }
  433. }
  434. $v['oldStreetName'] = $streetList[$v['oldStreet']];
  435. $v['newStreetName'] = $streetList[$v['newStreet']];
  436. $v['oldEnterpriseTagName'] = $talentTypeList[$v['oldEnterpriseTag']];
  437. $v['newEnterpriseTagName'] = $talentTypeList[$v['newEnterpriseTag']]; //此处旧字段为talentType,新字段为enterpriseTag,为防止数据污染与丢失,因而这样写
  438. $v['oldIndustryFieldNewName'] = $industryFieldNewList[$v['oldIndustryFieldNew']];
  439. $v['newIndustryFieldNewName'] = $industryFieldNewList[$v['newIndustryFieldNew']];
  440. $v["oldIndustryFieldOldName"] = DictApi::findDictByCode($v['oldIndustryFieldOld'])["name"];
  441. $v["newIndustryFieldOldName"] = DictApi::findDictByCode($v['newIndustryFieldOld'])["name"];
  442. $v["oldEnterpriseTypeName"] = $enterpriseTypeList[$v["oldEnterpriseType"]];
  443. $v["newEnterpriseTypeName"] = $enterpriseTypeList[$v["newEnterpriseType"]];
  444. $v["oldAgencyTypeName"] = $agencyTypeList[$v["oldAgencyType"]];
  445. $v["newAgencyTypeName"] = $agencyTypeList[$v["newAgencyType"]];
  446. switch ($v["checkState"]) {
  447. case 1:
  448. $v['checkStateName'] = '保存未提交审核';
  449. break;
  450. case 2:
  451. $v['checkStateName'] = '待审核';
  452. break;
  453. case 3:
  454. $v['checkStateName'] = '审核驳回';
  455. break;
  456. case 4:
  457. $v['checkStateName'] = '审核通过';
  458. break;
  459. case 5:
  460. $v['checkStateName'] = '重新提交';
  461. break;
  462. }
  463. }
  464. } else {
  465. $list = [];
  466. }
  467. return $list;
  468. }
  469. public static function updateById($data) {
  470. return Enterprise::update($data);
  471. }
  472. public static function getOneRecord($id) {
  473. return EnterpriseRecord::findOrEmpty($id);
  474. }
  475. }