TalentAllowance.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use app\common\api\Response;
  5. use app\common\model\TalentAllowance as TaModel;
  6. use think\facade\Db;
  7. use app\common\api\DictApi;
  8. use app\common\state\AllowanceStateEnum;
  9. use app\common\state\AllowanceProjectEnum;
  10. use app\common\api\TalentAllowanceApi;
  11. use app\common\model\TalentChecklog;
  12. use app\common\state\ProjectState;
  13. use app\common\api\TalentLogApi;
  14. /**
  15. * Description of TalentAllowance
  16. *
  17. * @author sgq
  18. */
  19. class TalentAllowance extends AdminController {
  20. public function index() {
  21. $process = $this->request["process"];
  22. $type = $this->user["type"];
  23. $assigns = ["process" => $process, "type" => $type];
  24. if ($process == 4) {
  25. if ($type == 1) {
  26. $msgBody["typeName"] = "晋江市优秀人才津补贴申报";
  27. $msgBody["address"] = "聚才网/人才晋江微信公众号";
  28. $msgBody["dep"] = "中共晋江市委人才办、晋江市纪委监委驻市人力资源和社会保障局纪检监察组或晋江市公共就业和人才服务中心";
  29. $msgBody["phone"] = "0595-85633128";
  30. $msgBody["email"] = "jjrc85661234@163.com";
  31. }
  32. if ($type == 2) {
  33. $msgBody["typeName"] = "晋江市集成电路产业优秀人才津补贴申报";
  34. $msgBody["address"] = "福建(晋江)集成电路产业园官方网站及微信公众号";
  35. $msgBody["dep"] = "集成电路产业园区";
  36. $msgBody["phone"] = "0595-82250007、0595-82250001";
  37. $msgBody["email"] = "jjjcdr@163.com";
  38. }
  39. $assigns["message"] = $msgBody;
  40. }
  41. return view("", $assigns);
  42. }
  43. /**
  44. * 获取优秀人才津补贴列表
  45. */
  46. public function list() {
  47. $param = $this->request->param();
  48. $offset = $param["offset"] ?: 0;
  49. $limit = $param["limit"] ?: 10;
  50. $process = $param["process"];
  51. $where = [];
  52. $where[] = ["type", "=", $this->user["type"]];
  53. $order = "newSubmitTime desc";
  54. $where = $this->setTalentAllowanceInfo($where, $param, $process);
  55. switch ($process) {
  56. case 1:
  57. $where[] = ["checkState", "in", [1, 5, 10, 13, 15, 20, 25, 30]];
  58. break;
  59. case 2:
  60. $where[] = ["firstPassTime", "EXP", Db::raw("is not null")];
  61. break;
  62. case 3:
  63. $where[] = ["visitPassTime", "EXP", Db::raw("is not null")];
  64. break;
  65. case 4:
  66. if ($param["publicState"]) {
  67. $where[] = ["publicState", "=", $param["publicState"]];
  68. }
  69. $where[] = ["checkState", "in", [-1, 30]];
  70. break;
  71. }
  72. $count = TaModel::where($where)->count();
  73. $list = TaModel::where($where)->limit($offset, $limit)->order($order)->select()->toArray();
  74. $list = $this->translateChinese($list);
  75. return json(["rows" => $list, "total" => $count]);
  76. }
  77. public function toCheckPage() {
  78. $id = $this->request["id"];
  79. $process = $this->request["process"];
  80. $obj = TalentAllowanceApi::getInfoById($id);
  81. $this->translateToChinese($obj);
  82. return view("info", ["row" => $obj, "process" => $process]);
  83. }
  84. /**
  85. * 审核
  86. */
  87. public function check() {
  88. $obj = $this->request->param();
  89. if (!$obj["checkState"]) {
  90. return new Response(Response::ERROR, "请选择审核状态");
  91. }
  92. $oldObj = TalentAllowanceApi::getInfoById($obj["id"]);
  93. if (!$oldObj) {
  94. return new Response(Response::ERROR, "不存在的申请记录");
  95. }
  96. $newObj = [];
  97. $newObj["id"] = $obj["id"];
  98. $projectList = [];
  99. $fileList = [];
  100. if ($obj["process"] == 1) {
  101. if (\StrUtil::isNotEmpAndNull($obj["projects"])) {
  102. $projectList = array_filter(explode(",", $obj["projects"]));
  103. $newObj["projects"] = implode(",", $projectList);
  104. }
  105. if (\StrUtil::isNotEmpAndNull($obj["files"])) {
  106. $fileList = array_filter(explode(",", $obj["files"]));
  107. $newObj["files"] = implode(",", $fileList);
  108. }
  109. //if (Const.RSJ.equals(checkCompany.getCode())) {
  110. $newObj["concats"] = $obj["concats"];
  111. $newObj["fields"] = $obj["fields"];
  112. //}
  113. }
  114. if ($obj["process"] == 3) {
  115. $newObj["toProcess"] = $obj["toProcess"];
  116. $newObj["toDep"] = $obj["toDep"];
  117. }
  118. TaModel::update($newObj);
  119. //添加日志
  120. TalentChecklog::create([
  121. 'id' => getStringId(),
  122. 'mainId' => $obj['id'],
  123. 'type' => intval(ProjectState::JBT),
  124. 'typeFileId' => null,
  125. 'active' => 2,
  126. 'state' => $obj["checkState"],
  127. 'step' => $obj["process"],
  128. 'stateChange' => null,
  129. 'description' => $obj["checkMsg"],
  130. 'createTime' => date("Y-m-d H:i:s", time()),
  131. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  132. ]);
  133. return new Response(Response::SUCCESS, "审核成功");
  134. }
  135. public function submitCheck(){
  136. $id = $this->request["id"];
  137. $process = $this->request["process"];
  138. $old = TalentAllowanceApi::getInfoById($param["id"]);
  139. $updCheck["id"] = $id;
  140. /**查询审核日志*/
  141. $log = TalentLogApi::getLastLogByStep($id, ProjectState::JBT, $process);
  142. if (!$log) {
  143. return new Response(Response::ERROR, "请先审核后再提交");
  144. }
  145. $updCheck["checkMsg"] = $log["description"];
  146. /**判断到达的最高流程*/
  147. $updCheck["highProcess"] = !$old["highProcess"] || $old["highProcess"] < $process? $process : $old["process"];
  148. $newLog = null;
  149. switch ($process) {
  150. case 1:
  151. Company checkCompany = this.companyService.selectById(info.getCompanyId());
  152. TalentDepcheckstate tds = this.talentDepcheckstateService.selectOne(new EntityWrapper<TalentDepcheckstate>().eq("mainId", info.getId()).eq("companyId", info.getCompanyId()));
  153. tds.setState(log.getState());
  154. if (log.getState() == BasicStateEnum.RCRD_BASIC_PASS.getCode()) {
  155. tds.setSubmitTime(DateUtil.getTime());
  156. }
  157. this.talentDepcheckstateService.updateById(tds);
  158. /**判断所有部门是否全部通过*/
  159. info.setFirstPassTime(old.getFirstPassTime());
  160. Boolean isSuccess = validFirstIsFinish(info);
  161. newLog = new TalentChecklog(ProjectEnum.JBT.getCode(), info.getId(), null, StateConst.ACTIVE_YES, log.getState(),
  162. info.getProcess(), AllowanceStateEnum.valueOf(old.getCheckState()) + "->" + AllowanceStateEnum.valueOf(info.getCheckState()), log.getDescription() + "(" + checkCompany.getName() + ")", DateUtil.getTime(),
  163. ShiroKit.getUser().getAccount() + "(" + company.getName() + ")");
  164. newLog.setCompanyId(info.getCompanyId());
  165. this.talentChecklogService.delete(new EntityWrapper<TalentChecklog>().eq("mainId", info.getId()).eq("active", StateConst.ACTIVE_NO).eq("companyId", info.getCompanyId()));
  166. this.talentChecklogService.insert(newLog);
  167. break;
  168. case 2:
  169. if (old.getCheckState() != AllowanceStateEnum.NEED_VISIT_CHECK.getCode() && old.getCheckState() != AllowanceStateEnum.REVIEW_REJECT.getCode()) {
  170. return new ResponseObj(ResponseObj.FAILD, "不在审核范围内");
  171. }
  172. info.setCheckState(AllowanceStateEnum.NEED_REVIEW.getCode());
  173. info.setVisitPassTime(DateUtil.getTime());
  174. newLog = new TalentChecklog(ProjectEnum.JBT.getCode(), info.getId(), null,
  175. StateConst.ACTIVE_YES, BasicStateEnum.RCRD_BASIC_PASS.getCode(), info.getProcess(),
  176. AllowanceStateEnum.valueOf(old.getCheckState()) + "->" + AllowanceStateEnum.valueOf(info.getCheckState())
  177. , "走访核查提交审核", DateUtil.getTime(), ShiroKit.getUser().getAccount() + "(" + company.getName() + ")");
  178. this.talentChecklogService.insert(newLog);
  179. break;
  180. case 3:
  181. if (log.getState() == BasicStateEnum.RCRD_BASIC_NOTPASS.getCode()) {
  182. info.setCheckState(AllowanceStateEnum.NOTPASS.getCode());
  183. info.setRecommendAllowanceType(3);
  184. info.setRecommendMoney(BigDecimal.ZERO);
  185. info.setRecommendAllowanceMsg("审核不通过,不予兑现");
  186. }
  187. if (log.getState() == BasicStateEnum.RCRD_BASIC_REJECT.getCode()) {
  188. /**设置驳回单位为上级驳回*/
  189. if (old.getToProcess() == 1) {
  190. info.setCheckState(AllowanceStateEnum.REJECT_TO_FIRST.getCode());
  191. if (FengStringUtil.isEmpOrNull(old.getToDep())) {
  192. return new ResponseObj(ResponseObj.FAILD, "请设置驳回单位后再提交 ");
  193. }
  194. List<Company> companies = this.companyService.selectList(new EntityWrapper<Company>().in("code", old.getToDep()));
  195. String ids = companies.stream().map(Company::getId).collect(Collectors.joining(","));
  196. this.talentDepcheckstateService.updateForSet("state=" + BasicStateEnum.RCRD_BASIC_UPREJECT.getCode(), new EntityWrapper<TalentDepcheckstate>().eq("mainId", old.getId()).in("companyId", ids));
  197. } else if (old.getToProcess() == 2) {
  198. info.setCheckState(AllowanceStateEnum.REVIEW_REJECT.getCode());
  199. }
  200. info.setToProcess(null);
  201. info.setToDep("");
  202. }
  203. if (log.getState() == BasicStateEnum.RCRD_BASIC_PASS.getCode()) { //通过,计算金额
  204. info.setCheckState(AllowanceStateEnum.REVIEW_PASS.getCode());
  205. info.setReviewPassTime(DateUtil.getTime());
  206. /*** 在此处需要判断津补贴类型*/
  207. List<TalentAllowanceArrange> arrangeList = validateAllowanceType(info);
  208. this.talentAllowanceArrangeService.updateBatchById(arrangeList);
  209. }
  210. newLog = new TalentChecklog(ProjectEnum.JBT.getCode(), info.getId(), null,
  211. StateConst.ACTIVE_YES, log.getState(), info.getProcess(),
  212. AllowanceStateEnum.valueOf(old.getCheckState()) + "->" + AllowanceStateEnum.valueOf(info.getCheckState())
  213. , log.getDescription(), DateUtil.getTime(), ShiroKit.getUser().getAccount() + "(" + company.getName() + ")");
  214. this.talentChecklogService.delete(new EntityWrapper<TalentChecklog>().eq("mainId", info.getId()).eq("active", StateConst.ACTIVE_NO));
  215. this.talentChecklogService.insert(newLog);
  216. break;
  217. }
  218. this.talentAllowanceInfoService.updateById(info);
  219. return new ResponseObj(ResponseObj.SUCCESS, "提交审核成功");
  220. }
  221. /**
  222. * 校验是否在审核范围内
  223. */
  224. public function validateIsCheck() {
  225. $id = $this->request["id"];
  226. $type = $this->request["type"];
  227. $process = $this->request["process"];
  228. $info = null;
  229. switch ($type) {
  230. case 1: //编辑合同
  231. $detail = \app\common\model\TalentAllowancecontractDetail::find($id);
  232. $info = TalentAllowanceApi::getInfoById($detail["mainId"]);
  233. break;
  234. case 2: //编辑项目
  235. $project = \app\common\model\TalentAllowanceProject::find($id);
  236. $info = TalentAllowanceApi::getInfoById($project["mainId"]);
  237. break;
  238. case 3:
  239. $info = TalentAllowanceApi::getInfoById($id);
  240. break;
  241. }
  242. if (!$info) {
  243. return new Response(Response::ERROR, "校验不通过,无法操作");
  244. }
  245. $where = [];
  246. $where[] = ["mainId", "=", $info["id"]];
  247. $where[] = ["step", "=", $process];
  248. $where[] = ["active", "=", 2];
  249. $log = null;
  250. switch ($process) {
  251. case 1:
  252. if ($info["checkState"] != AllowanceStateEnum::NEED_CHECK && $info["checkState"] != AllowanceStateEnum::REJECT_TO_FIRST) {
  253. return new Response(Response::ERROR, "不在审核范围内");
  254. }
  255. //$where[] = ["companyId","=",$this->user["companyId"]];
  256. $log = TalentChecklog::where($where)->order("createTime desc")->find();
  257. break;
  258. case 2:
  259. if ($info["checkState"] != AllowanceStateEnum::NEED_VISIT_CHECK && $info["checkState"] != AllowanceStateEnum::REVIEW_REJECT) {
  260. return new Response(Response::ERROR, "不在审核范围内");
  261. }
  262. break;
  263. case 3:
  264. if ($info["checkState"] != AllowanceStateEnum::NEED_REVIEW && $info["checkState"] != AllowanceStateEnum::PUBLIC_REJECT) {
  265. return new Response(Response::ERROR, "不在审核范围内");
  266. }
  267. $log = TalentChecklog::where($where)->order("createTime desc")->find();
  268. break;
  269. }
  270. if ($log != null) {
  271. $info["checkState"] = $log["state"];
  272. $info["checkMsg"] = $log["description"];
  273. } else {
  274. $info["checkState"] = null;
  275. $info["checkMsg"] = "";
  276. }
  277. $res = [];
  278. $res["info"] = $info;
  279. if ($type == 3) {
  280. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  281. $where = [];
  282. $where[] = ["mainId", "=", $id];
  283. $where[] = ["isLock", "=", 1];
  284. $projectList = \app\common\model\TalentAllowanceProject::where($where)->select()->toArray();
  285. $detailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $id)->select()->toArray();
  286. $detailMap = array_reduce($detailList, function ($result, $item) {
  287. $key = $item["id"];
  288. $result[$key] = $item;
  289. return $result;
  290. }, []);
  291. foreach ($detailList as &$detail) {
  292. $detail["enterpriseName"] = sprintf("%s(%s至%s)", $enterpriseMap[$detail["enterpriseId"]], $detail["startTime"], $detail["endTime"]);
  293. }unset($detail);
  294. foreach ($projectList as &$project) {
  295. $detail = $detailMap[$project["baseId"]];
  296. $project["projectName"] = sprintf("%s(%s(%s至%s))", AllowanceProjectEnum::getProjectName($project["project"]), $enterpriseMap[$project["enterpriseId"]], $detail["startTime"], $detail["endTime"]);
  297. }
  298. $where = [];
  299. $where[] = ["type", "=", $info["type"]];
  300. $where[] = ["project", "=", \app\common\state\ProjectState::JBT];
  301. $where[] = ["active", "=", 1];
  302. $where[] = ["delete", "=", 0];
  303. $filetypes = Db::table("new_common_filetype")->where($where)->order("sn asc")->select()->toArray();
  304. $res["files"] = $filetypes;
  305. $res["projects"] = $projectList;
  306. $res["concats"] = $detailList;
  307. }
  308. return new Response(Response::SUCCESS, "不在审核范围内", $res);
  309. }
  310. /**
  311. * 查询工作单位
  312. */
  313. public function findAllowanceContractDetail() {
  314. $mainId = $this->request["mainId"];
  315. $offset = $this->request["offset"] ?: 0;
  316. $limit = $this->request["limit"] ?: 1000;
  317. $count = \app\common\model\TalentAllowancecontractDetail::where("mainId", $mainId)->count();
  318. $list = \app\common\model\TalentAllowancecontractDetail::where("mainId", $mainId)->limit($offset, $limit)->select()->toArray();
  319. $enterpriseMap = \app\common\model\Enterprise::column("name", "id");
  320. foreach ($list as &$row) {
  321. $row["enterpriseName"] = $enterpriseMap[$row["enterpriseId"]];
  322. }unset($row);
  323. return json(["rows" => $list, "total" => $count]);
  324. }
  325. /**
  326. * 查询核查项目情况
  327. */
  328. public function findAllowanceProject() {
  329. $mainId = $this->request["mainId"];
  330. $baseId = $this->request["baseId"];
  331. $offset = $this->request["offset"] ?: 0;
  332. $limit = $this->request["limit"] ?: 1000;
  333. $where = [];
  334. $where[] = ["mainId", "=", $mainId];
  335. $where[] = ["baseId", "=", $baseId];
  336. $count = \app\common\model\TalentAllowanceProject::where($where)->count();
  337. $list = \app\common\model\TalentAllowanceProject::where($where)->limit($offset, $limit)->select()->toArray();
  338. $info = TalentAllowanceApi::getInfoById($mainId);
  339. foreach ($list as &$project) {
  340. $project["projectName"] = AllowanceProjectEnum::getProjectName($project["project"]);
  341. if ($info["checkState"] == 1) {
  342. $project["isEdit"] = in_array($project["project"], [
  343. AllowanceProjectEnum::PROJECT_CONTRACT,
  344. AllowanceProjectEnum::PROJECT_TAX,
  345. AllowanceProjectEnum::PROJECT_WAGES,
  346. AllowanceProjectEnum::PROJECT_ATTENDANCE,
  347. AllowanceProjectEnum::PROJECT_SB_PENSION,
  348. AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
  349. AllowanceProjectEnum::PROJECT_SB_MEDICA,
  350. AllowanceProjectEnum::PROJECT_WORKDAY
  351. ]) ? 1 : 2;
  352. } else if ($info["checkState"] == 10) {
  353. $projects = explode(",", $info["projects"]);
  354. if (in_array($project["id"], $projects)) {
  355. $project["isEdit"] = 1;
  356. } else {
  357. $project["isEdit"] = 2;
  358. }
  359. } else {
  360. $project["isEdit"] = 2;
  361. }
  362. }unset($project);
  363. return json(["rows" => $list, "total" => $count]);
  364. }
  365. /**
  366. * 查询人才层次变更记录
  367. */
  368. public function findAllowanceArrange() {
  369. $mainId = $this->request["mainId"];
  370. $offset = $this->request["offset"] ?: 0;
  371. $limit = $this->request["limit"] ?: 1000;
  372. $where = [];
  373. $where[] = ["mainId", "=", $mainId];
  374. $count = \app\common\model\TalentAllowanceArrange::where($where)->count();
  375. $list = \app\common\model\TalentAllowanceArrange::where($where)->limit($offset, $limit)->select()->toArray();
  376. foreach ($list as &$arrange) {
  377. $condition = \app\common\api\TalentConditionApi::getOne($arrange["identifyCondition"]);
  378. $arrange["identifyConditionText"] = $condition["name"];
  379. $arrange["talentArrangeName"] = \app\common\state\CommonConst::getLayerNameByLayer($arrange["talentArrange"]);
  380. }unset($arrange);
  381. return json(["rows" => $list, "total" => $count]);
  382. }
  383. private function setTalentAllowanceInfo($where, $query, $process) {
  384. if (\StrUtil::isNotEmpAndNull($query["year"])) {
  385. $where[] = ["year", "=", $query["year"]];
  386. }
  387. if (\StrUtil::isNotEmpAndNull($query["enterpriseName"])) {
  388. $where[] = ["enterpriseName", "like", "%" . $query["enterpriseName"] . "%"];
  389. }
  390. if (\StrUtil::isNotEmpAndNull($query["name"])) {
  391. $where[] = ["name", "like", "%" . $query["name"] . "%"];
  392. }
  393. if (\StrUtil::isNotEmpAndNull($query["talentType"])) {
  394. $where[] = ["talentType", "=", $query["talentType"]];
  395. }
  396. if (\StrUtil::isNotEmpAndNull($query["talentArrange"])) {
  397. $where[] = ["talentArrange", "=", $query["talentArrange"]];
  398. }
  399. if (\StrUtil::isNotEmpAndNull($query["identifyCondition"])) {
  400. $where[] = ["identifyCondition", "=", $query["identifyCondition"]];
  401. }
  402. if (\StrUtil::isNotEmpAndNull($query["address"])) {
  403. $where[] = ["address", "=", $query["address"]];
  404. }
  405. if ($query["recommendAllowanceType"]) {
  406. $where[] = ["recommendAllowanceType", "=", $query["recommendAllowanceType"]];
  407. }
  408. if ($query["publicState"]) {
  409. $where[] = ["publicState", "=", $query["publicState"]];
  410. }
  411. if (\StrUtil::isNotEmpAndNull($query["introductionMode"])) {
  412. $where[] = ["introductionMode", "=", $query["introductionMode"]];
  413. }
  414. if (\StrUtil::isNotEmpAndNull($query["firstJJStartTime"])) {
  415. $where[] = ["firstInJJTime", ">=", $query["firstJJStartTime"]];
  416. }
  417. if (\StrUtil::isNotEmpAndNull($query["firstJJEndTime"])) {
  418. $where[] = ["firstInJJTime", "<=", $query["firstJJEndTime"]];
  419. }
  420. if ($process == 4) {
  421. if ($query["isSupple"]) {
  422. $where[] = ["isSupple", "=", $query["isSupple"]];
  423. }
  424. if ($query["isPublicCheck"]) {
  425. $where[] = ["isPublicCheck", "=", $query["isPublicCheck"]];
  426. }
  427. }
  428. if ($query["checkState"]) {
  429. if ($query["checkState"] == -1) {
  430. $where[] = ["checkState", "=", $query["checkState"]];
  431. } else {
  432. if ($process == 1) {
  433. switch ($query["checkState"]) {
  434. case 0: //保存未提交
  435. $where[] = ["checkState", "=", 1];
  436. break;
  437. case 1:
  438. $where[] = ["checkState", "=", 5];
  439. break;
  440. case 2: //驳回
  441. $where[] = ["checkState", "=", 10];
  442. break;
  443. case 3: //通过
  444. $where[] = ["checkState", "in", [15, 20, 30, 25]];
  445. break;
  446. case 4: //重新提交
  447. $where[] = ["checkState", "=", 5];
  448. $where[] = ["highProcess", ">=", $process];
  449. break;
  450. case 5: //上级驳回
  451. $where[] = ["checkState", "=", 13];
  452. break;
  453. }
  454. }
  455. if ($process == 2) {
  456. switch ($query["checkState"]) {
  457. case 1:
  458. $where[] = ["checkState", "=", 15];
  459. break;
  460. case 2: //驳回
  461. $where[] = ["checkState", "in", [1, 5, 10]];
  462. $where[] = ["highProcess", ">=", $process];
  463. break;
  464. case 3: //通过
  465. $where[] = ["checkState", "in", [20, 30]];
  466. break;
  467. case 9: //重新提交
  468. $where[] = ["checkState", "=", 15];
  469. $where[] = ["highProcess", ">=", $process];
  470. break;
  471. case 4: //上级驳回
  472. $where[] = ["checkState", "=", 25];
  473. break;
  474. case -1:
  475. $where[] = ["checkState", "=", -1];
  476. break;
  477. }
  478. }
  479. if ($process == 3) {
  480. switch ($query["checkState"]) {
  481. case -1:
  482. $where[] = ["checkState", "=", -1];
  483. break;
  484. case 1:
  485. $where[] = ["checkState", "=", 20];
  486. break;
  487. case 2: //驳回
  488. $where[] = ["checkState", "in", [1, 5, 10, 15, 25]];
  489. $where[] = ["highProcess", ">=", $process];
  490. break;
  491. case 3: //通过
  492. $where[] = ["checkState", "=", 30];
  493. break;
  494. case 9: //重新提交
  495. $where[] = ["checkState", "=", 20];
  496. $where[] = ["highProcess", ">=", $process];
  497. break;
  498. case 4: //上级驳回
  499. $where[] = ["checkState", "=", 35];
  500. break;
  501. }
  502. }
  503. if ($process == 4) {
  504. switch ($query["checkState"]) {
  505. case -1:
  506. $where[] = ["checkState", "=", -1];
  507. break;
  508. case 3: //通过
  509. $where[] = ["checkState", "=", 30];
  510. break;
  511. }
  512. }
  513. }
  514. }
  515. return $where;
  516. }
  517. private function translateToChinese(&$obj) {
  518. if (\StrUtil::isNotEmpAndNull($obj["address"])) {
  519. $obj["addressName"] = DictApi::findByParentCodeAndCode("street", $obj["address"])["name"];
  520. }
  521. if (\StrUtil::isNotEmpAndNull($obj["talentType"])) {
  522. $obj["talentTypeName"] = DictApi::findByParentCodeAndCode("enterprise_tag", $obj["talentType"])["name"];
  523. }
  524. if (\StrUtil::isNotEmpAndNull($obj["talentArrange"])) {
  525. $obj["talentArrangeName"] = DictApi::findByParentCodeAndCode("talent_arrange", $obj["talentArrange"])["name"];
  526. }
  527. if (\StrUtil::isNotEmpAndNull($obj["identifyCondition"])) {
  528. $obj["identifyConditionText"] = \app\common\api\TalentConditionApi::getOne($obj["identifyCondition"])["name"];
  529. }
  530. if (\StrUtil::isNotEmpAndNull($obj["introductionMode"])) {
  531. $obj["introductionModeName"] = DictApi::findByParentCodeAndCode("import_way", $obj["introductionMode"])["name"];
  532. }
  533. }
  534. private function translateChinese($list) {
  535. //获取字典表
  536. $levelMap = DictApi::selectByParentCode("talent_arrange");
  537. $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
  538. $streetMap = DictApi::selectByParentCode("street");
  539. $cardTypeMap = DictApi::selectByParentCode("card_type");
  540. $modeMap = DictApi::selectByParentCode("import_way");
  541. $where = [];
  542. $where[] = ["type", "=", $this->user["type"]];
  543. $where[] = ["id", "in", array_column($list, "identifyCondition")];
  544. $icmap = \app\common\model\TalentCondition::where($where)->column("name", "id");
  545. foreach ($list as &$info) {
  546. if (\StrUtil::isNotEmpAndNull($info["talentArrange"])) {
  547. $info["talentArrangeName"] = $levelMap[$info["talentArrange"]];
  548. }
  549. $info["talentTypeName"] = $talentTypeMap[$info["talentType"]];
  550. if (\StrUtil::isNotEmpAndNull($info["identifyCondition"])) {
  551. $info["identifyConditionText"] = $icmap[$info["identifyCondition"]];
  552. }
  553. $info["addressName"] = $streetMap[$info["address"]];
  554. $info["sexName"] = $info["sex"] == 1 ? "男" : "女";
  555. $info["checkStateName"] = AllowanceStateEnum::getStateName($info["checkState"]);
  556. $info["cardTypeName"] = $cardTypeMap[$info["cardType"]];
  557. $info["isSuppleName"] = $info["isSupple"] == 1 ? "是" : "否";
  558. $info["isPublicCheckName"] = $info["isPublicCheckName"] == 1 ? "是" : "否";
  559. $info["recomendAllowanceTypeName"] = \app\common\state\AllowanceTypeEnum::getTypeName($info["recomendAllowanceType"]);
  560. $info["allowanceTypeName"] = \app\common\state\AllowanceTypeEnum::getTypeName($info["allowanceType"]);
  561. $info["recommendTalentArrangeName"] = $levelMap[$info["recommendTalentArrange"]];
  562. $info["jtTalentArrangeName"] = $levelMap[$info["jtTalentArrange"]];
  563. $info["introductionModeName"] = $modeMap[$info["introductionMode"]];
  564. }unset($info);
  565. return $list;
  566. }
  567. }