TalentAllowance.php 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\common\AdminController;
  4. use think\facade\Db;
  5. use app\common\api\Response;
  6. use app\common\api\DictApi;
  7. use app\common\api\TalentAllowanceApi;
  8. use app\common\api\TalentLogApi;
  9. use app\common\model\TalentAllowance as TaModel;
  10. use app\common\model\TalentChecklog;
  11. use app\common\model\TalentAllowanceArrange;
  12. use app\common\state\ProjectState;
  13. use app\common\state\AllowanceStateEnum;
  14. use app\common\state\AllowanceProjectEnum;
  15. /**
  16. * Description of TalentAllowance
  17. *
  18. * @author sgq
  19. */
  20. class TalentAllowance extends AdminController {
  21. public function index() {
  22. $process = $this->request["process"];
  23. $type = $this->user["type"];
  24. $assigns = ["process" => $process, "type" => $type];
  25. if ($process == 4) {
  26. if ($type == 1) {
  27. $msgBody["typeName"] = "晋江市优秀人才津补贴申报";
  28. $msgBody["address"] = "聚才网/人才晋江微信公众号";
  29. $msgBody["dep"] = "中共晋江市委人才办、晋江市纪委监委驻市人力资源和社会保障局纪检监察组或晋江市公共就业和人才服务中心";
  30. $msgBody["phone"] = "0595-85633128";
  31. $msgBody["email"] = "jjrc85661234@163.com";
  32. }
  33. if ($type == 2) {
  34. $msgBody["typeName"] = "晋江市集成电路产业优秀人才津补贴申报";
  35. $msgBody["address"] = "福建(晋江)集成电路产业园官方网站及微信公众号";
  36. $msgBody["dep"] = "集成电路产业园区";
  37. $msgBody["phone"] = "0595-82250007、0595-82250001";
  38. $msgBody["email"] = "jjjcdr@163.com";
  39. }
  40. $assigns["message"] = $msgBody;
  41. }
  42. return view("", $assigns);
  43. }
  44. /**
  45. * 获取优秀人才津补贴列表
  46. */
  47. public function list() {
  48. $param = $this->request->param();
  49. $offset = $param["offset"] ?: 0;
  50. $limit = $param["limit"] ?: 10;
  51. $process = $param["process"];
  52. $where = [];
  53. $where[] = ["type", "=", $this->user["type"]];
  54. $order = "newSubmitTime desc";
  55. $where = $this->setTalentAllowanceInfo($where, $param, $process);
  56. switch ($process) {
  57. case 1:
  58. $where[] = ["checkState", "in", [1, 5, 10, 13, 15, 20, 25, 30]];
  59. break;
  60. case 2:
  61. $where[] = ["firstPassTime", "EXP", Db::raw("is not null")];
  62. break;
  63. case 3:
  64. $where[] = ["visitPassTime", "EXP", Db::raw("is not null")];
  65. break;
  66. case 4:
  67. if ($param["publicState"]) {
  68. $where[] = ["publicState", "=", $param["publicState"]];
  69. }
  70. $where[] = ["checkState", "in", [-1, 30]];
  71. break;
  72. }
  73. $count = TaModel::where($where)->count();
  74. $list = TaModel::where($where)->limit($offset, $limit)->order($order)->select()->toArray();
  75. $list = $this->translateChinese($list);
  76. return json(["rows" => $list, "total" => $count]);
  77. }
  78. public function toCheckPage() {
  79. $id = $this->request["id"];
  80. $process = $this->request["process"];
  81. $obj = TalentAllowanceApi::getInfoById($id);
  82. $this->translateToChinese($obj);
  83. return view("info", ["row" => $obj, "process" => $process]);
  84. }
  85. /**
  86. * 审核
  87. */
  88. public function check() {
  89. $obj = $this->request->param();
  90. if (!$obj["checkState"]) {
  91. return new Response(Response::ERROR, "请选择审核状态");
  92. }
  93. $oldObj = TalentAllowanceApi::getInfoById($obj["id"]);
  94. if (!$oldObj) {
  95. return new Response(Response::ERROR, "审核对象不存在");
  96. }
  97. $newObj = [];
  98. $newObj["id"] = $obj["id"];
  99. $projectList = [];
  100. $fileList = [];
  101. if ($obj["process"] == 1) {
  102. if (\StrUtil::isNotEmpAndNull($obj["projects"])) {
  103. $projectList = array_filter(explode(",", $obj["projects"]));
  104. $newObj["projects"] = implode(",", $projectList);
  105. }
  106. if (\StrUtil::isNotEmpAndNull($obj["files"])) {
  107. $fileList = array_filter(explode(",", $obj["files"]));
  108. $newObj["files"] = implode(",", $fileList);
  109. }
  110. //if (Const.RSJ.equals(checkCompany.getCode())) {
  111. $newObj["concats"] = $obj["concats"];
  112. $newObj["fields"] = $obj["fields"];
  113. //}
  114. }
  115. if ($obj["process"] == 3) {
  116. $newObj["toProcess"] = $obj["toProcess"];
  117. $newObj["toDep"] = $obj["toDep"];
  118. }
  119. TaModel::update($newObj);
  120. //添加日志
  121. TalentChecklog::create([
  122. 'id' => getStringId(),
  123. 'mainId' => $obj['id'],
  124. 'type' => intval(ProjectState::JBT),
  125. 'typeFileId' => null,
  126. 'active' => 2,
  127. 'state' => $obj["checkState"],
  128. 'step' => $obj["process"],
  129. 'stateChange' => null,
  130. 'description' => $obj["checkMsg"],
  131. 'createTime' => date("Y-m-d H:i:s", time()),
  132. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  133. ]);
  134. return new Response(Response::SUCCESS, "审核成功");
  135. }
  136. public function submitCheck() {
  137. $id = $this->request["id"];
  138. $process = $this->request["process"];
  139. $old = TalentAllowanceApi::getInfoById($id);
  140. if (!$old) {
  141. return new Response(Response::ERROR, "审核对象不存在");
  142. }
  143. $updCheck = [];
  144. $updCheck["id"] = $id;
  145. /* * 查询审核日志 */
  146. $log = TalentLogApi::getLastLogByStep($id, ProjectState::JBT, $process);
  147. if (!$log) {
  148. return new Response(Response::ERROR, "请先审核后再提交");
  149. }
  150. $updCheck["checkMsg"] = $log["description"];
  151. /* * 判断到达的最高流程 */
  152. $updCheck["highProcess"] = !$old["highProcess"] || $old["highProcess"] < $process ? $process : $old["process"];
  153. switch ($process) {
  154. case 1:
  155. switch ($log["state"]) {
  156. case 3:
  157. $updCheck["firstPassTime"] = $old["firstPassTime"];
  158. if (!$old["firstPassTime"]) {
  159. $updCheck["firstPassTime"] = date("Y-m-d H:i:s");
  160. }
  161. $updCheck["submitTime"] = date("Y-m-d H:i:s");
  162. $updCheck["checkState"] = AllowanceStateEnum::NEED_REVIEW;
  163. break;
  164. case 2:
  165. $updCheck["checkState"] = AllowanceStateEnum::FIRST_REJECT;
  166. break;
  167. case -1:
  168. $updCheck["checkState"] = AllowanceStateEnum::NOTPASS;
  169. $updCheck["recommendAllowanceType"] = 3;
  170. $updCheck["recommendMoney"] = 0;
  171. $updCheck["recommendAllowanceMsg"] = "审核不通过,不予兑现";
  172. break;
  173. default:
  174. return new Response(Response::ERROR, "未知的审核状态");
  175. }
  176. //添加日志
  177. TalentChecklog::create([
  178. 'id' => getStringId(),
  179. 'mainId' => $id,
  180. 'type' => intval(ProjectState::JBT),
  181. 'typeFileId' => null,
  182. 'active' => 1,
  183. 'state' => $log["state"],
  184. 'step' => $process,
  185. 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($updCheck["checkState"]),
  186. 'description' => $log["checkMsg"],
  187. 'createTime' => date("Y-m-d H:i:s", time()),
  188. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  189. ]);
  190. break;
  191. case 2:
  192. if ($old["checkState"] != AllowanceStateEnum::NEED_VISIT_CHECK && $old["checkState"] != AllowanceStateEnum::REVIEW_REJECT) {
  193. return new Response(Response::ERROR, "不在审核范围内");
  194. }
  195. $updCheck["checkState"] = AllowanceStateEnum::NEED_REVIEW;
  196. $updCheck["visitPassTime"] = date("Y-m-d H:i:s");
  197. //添加日志
  198. TalentChecklog::create([
  199. 'id' => getStringId(),
  200. 'mainId' => $id,
  201. 'type' => intval(ProjectState::JBT),
  202. 'typeFileId' => null,
  203. 'active' => 1,
  204. 'state' => 3,
  205. 'step' => $process,
  206. 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($updCheck["checkState"]),
  207. 'description' => "走访核查提交审核",
  208. 'createTime' => date("Y-m-d H:i:s", time()),
  209. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  210. ]);
  211. break;
  212. case 3:
  213. switch ($log["state"]) {
  214. case 3:
  215. $updCheck["checkState"] = AllowanceStateEnum::REVIEW_PASS;
  216. $updCheck["reviewPassTime"] = date("Y-m-d H:i:s");
  217. /* * * 在此处需要判断津补贴类型 */
  218. $arrangeList = $this->validateAllowanceType($updCheck);
  219. TalentAllowanceArrange::update($arrangeList);
  220. break;
  221. case 2:
  222. if ($old["toProcess"] == 1) {
  223. $updCheck["checkState"] = AllowanceStateEnum::REJECT_TO_FIRST;
  224. } else if ($old["toProcess"] == 2) {
  225. $updCheck["checkState"] = AllowanceStateEnum::REVIEW_REJECT;
  226. }
  227. $updCheck["toProcess"] = null;
  228. $updCheck["toDep"] = "";
  229. break;
  230. case -1:
  231. $updCheck["checkState"] = AllowanceStateEnum::NOTPASS;
  232. $updCheck["recommendAllowanceType"] = 3;
  233. $updCheck["recommendMoney"] = 0;
  234. $updCheck["recommendAllowanceMsg"] = "审核不通过,不予兑现";
  235. break;
  236. default:
  237. return new Response(Response::ERROR, "未知的审核状态");
  238. }
  239. //添加日志
  240. TalentChecklog::create([
  241. 'id' => getStringId(),
  242. 'mainId' => $id,
  243. 'type' => intval(ProjectState::JBT),
  244. 'typeFileId' => null,
  245. 'active' => 1,
  246. 'state' => $log["state"],
  247. 'step' => $process,
  248. 'stateChange' => AllowanceStateEnum::getStateName($old["checkState"]) . "->" . AllowanceStateEnum::getStateName($updCheck["checkState"]),
  249. 'description' => $log["checkMsg"],
  250. 'createTime' => date("Y-m-d H:i:s", time()),
  251. 'createUser' => sprintf("%s(%s)", $this->user["account"], $this->user["companyName"])
  252. ]);
  253. break;
  254. }
  255. TalentChecklog::delete($log["id"]);
  256. TaModel::update($updCheck);
  257. return new Response(Response::SUCCESS, "提交审核成功");
  258. }
  259. private function validateAllowanceType(&$info) {
  260. $old = TalentAllowanceApi::getInfoById($info["id"]);
  261. $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
  262. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  263. /* * 查询工作单位记录 */
  264. $initDetailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $info["id"])->select()->toArray();
  265. $detaiPdList = []; //用于判定类型
  266. $detailMonthList = []; //用于计算月份
  267. $recommendAllowanceMsg = [];
  268. foreach ($initDetailList as $detail) {
  269. $projectList = \app\common\model\TalentAllowanceProject::where("baseId", $detail["id"])->select()->toArray();
  270. $projectMap = [];
  271. foreach ($projectList as $project) {
  272. $projectMap[$project["project"]] = $project;
  273. }
  274. $detail["list"] = $projectList;
  275. $detail["projectMap"] = $projectMap;
  276. $detail["enterpriseName"] = $enterpriseMap[$detail["enterpriseId"]];
  277. $detail["talentTypeName"] = $talentTypeMap[$detail["talentType"]];
  278. /* * 筛选符合条件的人才标签 */
  279. $detaiPdList[] = $detail;
  280. $detailMonthList[] = $detail;
  281. }
  282. /* * 集成电路优秀人才 */
  283. if ($this->user["type"] == 2) {
  284. /* * 获取各个项目的综合月份 */
  285. $monthMap = $this->mergeMonth($detailMonthList);
  286. $monthAndDayMap = $this->mergeMonthNeedDay($detailMonthList);
  287. $info["recommendAllowanceType"] = 1;
  288. $info["recommendAllowanceMsg"] = "";
  289. $projectList = \app\common\model\TalentAllowanceProject::where("mainId", $info["id"])->select()->toArray();
  290. $set = $this->valideAllowanceType($info, $projectList, $monthMap, $monthAndDayMap);
  291. $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n综合以上所有判断得到最终补贴类型为:";
  292. if ($info["recommendAllowanceType"] == 1) {
  293. $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "工作津贴;可享受月份为:" . implode(",", $set) . "\n";
  294. }
  295. if ($info["recommendAllowanceType"] == 2)
  296. $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "一次性交通补贴;";
  297. if ($info["recommendAllowanceType"] == 3)
  298. $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "不予兑现;";
  299. usort($set, function($a, $b) {
  300. return (int) $a - (int) $b;
  301. });
  302. }
  303. $info["recommendMonths"] = implode(",", $set);
  304. $arrangeList = $this->calculateAllowance($info, $set, $detailMonthList);
  305. return $arrangeList;
  306. }
  307. /**
  308. * 集成电路津补贴总校验
  309. * */
  310. private function valideAllowanceType(&$info, $projectList, $monthMap, $monthAndDayMap) {
  311. $set = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
  312. /* * 2.判定工作月份、五险和个税是否满足重叠6个月要求* */
  313. $workdaySet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_WORKDAY], $info, "上年度工作月份", "①");
  314. $pensionSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_PENSION], $info, "养老保险", "②");
  315. $injurySet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_INJURY], $info, "工伤保险", "③");
  316. $unemploymentSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT], $info, "失业保险", "④");
  317. $medicaSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_MEDICA], $info, "医疗保险", "⑤");
  318. $taxSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_TAX], $info, "个税", "⑥");
  319. $set = array_intersect($set, $workdaySet);
  320. $set = array_intersect($set, $pensionSet);
  321. $set = array_intersect($set, $injurySet);
  322. $set = array_intersect($set, $unemploymentSet);
  323. $set = array_intersect($set, $medicaSet);
  324. $set = array_intersect($set, $taxSet);
  325. if ($info["recommendAllowanceType"] == 1 && count($set) < 6) {
  326. //如果全部满足6个月,但是重叠时间不满足6个月,开始检测是否符合交通补贴要求
  327. $info["recommendAllowanceType"] == 2;
  328. }
  329. if ($info["recommendAllowanceType"] == 2) {
  330. //判断境内工作时间是否大于30天
  331. $totalDays = 0;
  332. $workmonths = $monthAndDayMap[AllowanceProjectEnum::PROJECT_WORKDAY];
  333. foreach ($workmonths as $days) {
  334. $totalDays += $days;
  335. }
  336. if ($totalDays < 30) {
  337. $info["recommendAllowanceType"] == 3;
  338. $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n全年在我市工作仅{$totalDays}天,未达到30天,无法享受一次性交通津贴(×)";
  339. }
  340. }
  341. return $set;
  342. }
  343. /**
  344. * 计算津补贴
  345. */
  346. private function calculateAllowance(&$info, $retainMonths, $detailMonthList) {
  347. /**查询人才层次变更记录*/
  348. List<TalentAllowanceArrange> arrangeList = this.talentAllowanceArrangeService.selectListAndAmount(new EntityWrapper<TalentAllowanceArrange>().eq("mainId", info.getId()).orderBy("talentArrange"));
  349. AmountStandard amountStandard = this.amountStandardService.selectOne(new EntityWrapper<AmountStandard>().eq("type", 1).eq("allowanceType", 1).eq("talentArrange", "4"));
  350. /*** 容器*/
  351. BigDecimal jobMoney = BigDecimal.ZERO; //计算所得工作津贴
  352. BigDecimal jtMoney = BigDecimal.ZERO; //计算所得一次性交通补贴
  353. Set<String> recommendMonths = new TreeSet<>(new Comparator<String>() {
  354. @Override
  355. public int compare(String o1, String o2) {
  356. int o1Int = Integer.parseInt(o1);
  357. int o2Int = Integer.parseInt(o2);
  358. return o1Int - o2Int;
  359. }
  360. }); //推荐月份
  361. String talentArrange = null;
  362. /***********计算**************/
  363. StringBuilder msgBulider = new StringBuilder();
  364. switch (info.getRecommendAllowanceType()) {
  365. case 1:
  366. if (info.getType() == 1) { //晋江市优秀人才
  367. /**判断判定最终月份和人才层次有效月份是否存在共同月份,不存在则为一次性交通补贴*/
  368. Set<String> totalArrangeMonth = new HashSet<>();
  369. for (TalentAllowanceArrange arrange : arrangeList) {
  370. List<String> levelList = new ArrayList<>(Arrays.asList(arrange.getPrepareMonths().split(",")));
  371. //对于2019年度的津补贴申报人才层次可享受月份均在07-12月
  372. if ("2019".equals(info.getYear())) {
  373. levelList.retainAll(new ArrayList<>(Arrays.asList("07", "08", "09", "10", "11", "12")));
  374. }
  375. totalArrangeMonth.addAll(levelList);
  376. }
  377. totalArrangeMonth.retainAll(retainMonths);
  378. /**对于人才标签中存在在站博士后的需要去除在站博士后计算,在站博士后不考虑人才层次(不予人才层次取交集),默认第四层次*/
  379. for (TalentAllowancecontractDetail detail : detailMonthList) {
  380. if (DictValueConst.TALENTTYPE_ZZBSH.equals(detail.getTalentType())) {
  381. String months = detail.getMonths();
  382. if (FengStringUtil.isNotEmpAndNull(months)) {
  383. List<String> monthsList = new ArrayList<>(Arrays.asList(months.split(",")));
  384. BigDecimal total = amountStandard.getMoney().multiply(new BigDecimal(monthsList.size())).setScale(2, BigDecimal.ROUND_HALF_UP);
  385. jobMoney = jobMoney.add(total);
  386. msgBulider.append(monthsList.size() + "(" + StringUtils.join(monthsList.toArray(), ",") + ")x" + amountStandard.getMoney() + "(第" + amountStandard.getTalentArrange() + "层次)+");
  387. recommendMonths.addAll(monthsList);
  388. retainMonths.removeAll(monthsList); //去除在站博士后已计算月份
  389. /**当存在在站博士后时无需计算月份和人才层次的交集,此处在交集内加入月份 数据,防止下面if判断导致津贴类型变更*/
  390. totalArrangeMonth.addAll(monthsList);
  391. }
  392. }
  393. }
  394. if (totalArrangeMonth.size() == 0) {
  395. int tempArrange = Integer.parseInt(arrangeList.get(0).getTalentArrange());
  396. if (tempArrange < 6) {
  397. info.setRecommendAllowanceType(2);
  398. info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "\n由于判定结果月份与人才层次有效月份无交集,因此津贴类型为:一次性交通补贴");
  399. } else {
  400. info.setRecommendAllowanceType(3);
  401. info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "\n由于判定结果月份与人才层次有效月份无交集且为第" + tempArrange + "层次,因此津贴类型为:不予兑现");
  402. }
  403. return calculateAllowance(info, retainMonths, detailMonthList);
  404. }
  405. if (retainMonths.size() > 0) {
  406. for (TalentAllowanceArrange arrange : arrangeList) {
  407. if (FengStringUtil.isNotEmpAndNull(arrange.getPrepareMonths())) {
  408. List<String> levelList = new ArrayList<>(Arrays.asList(arrange.getPrepareMonths().split(",")));
  409. //对于2019年度的津补贴申报人才层次可享受月份均在07-12月
  410. if ("2019".equals(info.getYear())) {
  411. levelList.retainAll(new ArrayList<>(Arrays.asList("07", "08", "09", "10", "11", "12")));
  412. }
  413. levelList.retainAll(retainMonths);
  414. BigDecimal total = arrange.getJobMoney().multiply(new BigDecimal(levelList.size())).setScale(2, BigDecimal.ROUND_HALF_UP);
  415. jobMoney = jobMoney.add(total);
  416. msgBulider.append(levelList.size() + "(" + StringUtils.join(levelList.toArray(), ",") + ")x" + arrange.getJobMoney() + "(第" + arrange.getTalentArrange() + "层次)+");
  417. recommendMonths.addAll(levelList);
  418. arrange.setMonths(StringUtils.join(levelList.toArray(), ","));
  419. arrange.setCount(levelList.size());
  420. arrange.setTotal(total);
  421. } else {
  422. msgBulider.append("0()x" + arrange.getJobMoney() + "(第" + arrange.getTalentArrange() + "层次)+");
  423. arrange.setCount(0);
  424. arrange.setTotal(new BigDecimal(0.00));
  425. }
  426. }
  427. }
  428. info.setRecommendMonths(StringUtils.join(recommendMonths.toArray(), ","));
  429. info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "通过与人才证书有效期取交集得到最终可享受月份:" + StringUtils.join(recommendMonths.toArray(), ",") + "\n经过计算:人才津贴为" + jobMoney + ";");
  430. info.setRecommendMoney(jobMoney);
  431. info.setRecommendMoneyDesc(msgBulider.substring(0, msgBulider.length() - 1));
  432. info.setWorkAllowanceMoney(jobMoney.multiply(new BigDecimal(0.8)).setScale(2, BigDecimal.ROUND_HALF_UP));
  433. info.setDevelopAllowanceMoney(jobMoney.multiply(new BigDecimal(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP));
  434. info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "工作津贴为" + info.getWorkAllowanceMoney() + ";发展津贴为:" + info.getDevelopAllowanceMoney());
  435. this.talentAllowancecontractDetailService.updateBatchById(detailMonthList);
  436. } else if (info.getType() == 2) { //集成电路优秀人才
  437. for (TalentAllowanceArrange arrange : arrangeList) {
  438. if (FengStringUtil.isNotEmpAndNull(arrange.getPrepareMonths())) {
  439. List<String> levelList = new ArrayList<>(Arrays.asList(arrange.getPrepareMonths().split(",")));
  440. levelList.retainAll(retainMonths);
  441. BigDecimal total = arrange.getJobMoney().multiply(new BigDecimal(levelList.size())).setScale(2, BigDecimal.ROUND_HALF_UP);
  442. jobMoney = jobMoney.add(total);
  443. msgBulider.append(levelList.size() + "(" + StringUtils.join(levelList.toArray(), ",") + ")x" + arrange.getJobMoney() + "(第" + arrange.getTalentArrange() + "层次)+");
  444. recommendMonths.addAll(levelList);
  445. arrange.setMonths(StringUtils.join(levelList.toArray(), ","));
  446. arrange.setCount(levelList.size());
  447. arrange.setTotal(total);
  448. } else {
  449. msgBulider.append("0()x" + arrange.getJobMoney() + "(第" + arrange.getTalentArrange() + "层次)+");
  450. arrange.setCount(0);
  451. arrange.setTotal(new BigDecimal(0.00));
  452. }
  453. }
  454. info.setRecommendMonths(StringUtils.join(recommendMonths.toArray(), ","));
  455. info.setRecommendAllowanceMsg(info.getRecommendAllowanceMsg() + "通过与人才证书有效期取交集得到最终可享受月份:" + StringUtils.join(recommendMonths.toArray(), ",") + "\n经过计算:人才津贴为" + jobMoney + ";");
  456. info.setRecommendMoney(jobMoney);
  457. info.setRecommendMoneyDesc(msgBulider.substring(0, msgBulider.length() - 1));
  458. }
  459. break;
  460. case 2:
  461. for (TalentAllowanceArrange arrange : arrangeList) {
  462. Integer intArragnge = Integer.parseInt(arrange.getTalentArrange());
  463. if (FengStringUtil.isNotEmpAndNull(arrange.getPrepareMonths()) && intArragnge <=5) {
  464. if (jtMoney.compareTo(BigDecimal.ZERO) == 0 || arrange.getJtMoney().compareTo(jtMoney) == 1) {
  465. jtMoney = arrange.getJtMoney();
  466. talentArrange = arrange.getTalentArrange();
  467. }
  468. }
  469. }
  470. info.setRecommendMoney(jtMoney);
  471. info.setRecommendMonths("");
  472. info.setRecommendMoneyDesc("一次性交通补贴");
  473. info.setWorkAllowanceMoney(new BigDecimal(0.00));
  474. info.setDevelopAllowanceMoney(new BigDecimal(0.00));
  475. info.setRecommendTalentArrange(talentArrange);
  476. break;
  477. case 3:
  478. info.setRecommendMoney(new BigDecimal(0.00));
  479. info.setRecommendMoneyDesc("不予兑现");
  480. info.setRecommendMonths("");
  481. info.setWorkAllowanceMoney(new BigDecimal(0.00));
  482. info.setDevelopAllowanceMoney(new BigDecimal(0.00));
  483. break;
  484. }
  485. // this.talentAllowanceArrangeService.updateBatchById(arrangeList);
  486. return arrangeList;
  487. }
  488. /**
  489. * 判定是否交足6个月(集成电路)
  490. * @param set
  491. * @param info
  492. * @param name
  493. */
  494. private function chkMonths($set, &$info, $name, $sort) {
  495. if ($info["recommendAllowanceType"] == 1 && (!$set || count($set) < 6)) {
  496. $info["recommendAllowanceType"] = 2;
  497. $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . $sort . $name . "不足6个月,无法享受工作津贴(×)";
  498. }
  499. return set;
  500. }
  501. //合并所有项目的月份
  502. private function mergeMonth($detailList) {
  503. $taxList = [];
  504. $wagesList = [];
  505. $pensionList = [];
  506. $unemploymentList = [];
  507. $medicaList = [];
  508. $attendanceList = [];
  509. $workdayList = [];
  510. foreach ($detailList as $detail) {
  511. $projectMap = $detail["projectMap"];
  512. if ($projectMap[AllowanceProjectEnum::PROJECT_TAX] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_TAX]["months"])) {
  513. $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_TAX]["months"]));
  514. $taxList = array_merge($taxList, $tmp);
  515. }
  516. if ($projectMap[AllowanceProjectEnum::PROJECT_WAGES] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_WAGES]["months"])) {
  517. $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_WAGES]["months"]));
  518. $wagesList = array_merge($wagesList, $tmp);
  519. }
  520. if ($projectMap[AllowanceProjectEnum::PROJECT_SB_PENSION] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_SB_PENSION]["months"])) {
  521. $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_SB_PENSION]["months"]));
  522. $pensionList = array_merge($pensionList, $tmp);
  523. }
  524. if ($projectMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT]["months"])) {
  525. $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT]["months"]));
  526. $unemploymentList = array_merge($unemploymentList, $tmp);
  527. }
  528. if ($projectMap[AllowanceProjectEnum::PROJECT_SB_MEDICA] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_SB_MEDICA]["months"])) {
  529. $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_SB_MEDICA]["months"]));
  530. $medicaList = array_merge($medicaList, $tmp);
  531. }
  532. if ($projectMap[AllowanceProjectEnum::PROJECT_ATTENDANCE] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_ATTENDANCE]["months"])) {
  533. $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_ATTENDANCE]["months"]));
  534. $attendanceList = array_merge($attendanceList, $tmp);
  535. }
  536. if ($projectMap[AllowanceProjectEnum::PROJECT_WORKDAY] && \StrUtil::isNotEmpAndNull($projectMap[AllowanceProjectEnum::PROJECT_WORKDAY]["months"])) {
  537. $tmp = array_filter(explode(",", $projectMap[AllowanceProjectEnum::PROJECT_WORKDAY]["months"]));
  538. $workdayList = array_merge($workdayList, $tmp);
  539. }
  540. }
  541. $map = [
  542. AllowanceProjectEnum::PROJECT_TAX => $taxList,
  543. AllowanceProjectEnum::PROJECT_WAGES => $wagesList,
  544. AllowanceProjectEnum::PROJECT_SB_PENSION => $pensionList,
  545. AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT => $unemploymentList,
  546. AllowanceProjectEnum::PROJECT_SB_MEDICA => $medicaList,
  547. AllowanceProjectEnum::PROJECT_ATTENDANCE => $attendanceList,
  548. AllowanceProjectEnum::PROJECT_WORKDAY => $workdayList,
  549. ];
  550. return $map;
  551. }
  552. /**
  553. * 合并多个单位带有天数的项目的月份如考勤1月30天,
  554. * */
  555. private function mergeMonthNeedDay($detailList) {
  556. $attendMap = [];
  557. $workDayMap = [];
  558. foreach ($detailList as $detail) {
  559. $attendMap = $this->getMergeMonthNeedDayMap($detail["projectMap"][AllowanceProjectEnum::PROJECT_ATTENDANCE], $attendMap);
  560. $workDayMap = $this->getMergeMonthNeedDayMap($detail["projectMap"][AllowanceProjectEnum::PROJECT_WORKDAY], $workDayMap);
  561. }
  562. $res = [
  563. AllowanceProjectEnum::PROJECT_ATTENDANCE => $attendMap,
  564. AllowanceProjectEnum::PROJECT_WORKDAY => $workDayMap
  565. ];
  566. return $res;
  567. }
  568. private function getMergeMonthNeedDayMap($project, $map) {
  569. if (\StrUtil::isNotEmpAndNull($project["months"])) {
  570. $monthAndDayList = array_filter(explode(",", $project["months"]));
  571. for ($i = 0; $i < count($monthAndDayList); $i++) {
  572. $obj = explode("=", $monthAndDayList[$i]);
  573. $month = $obj[0];
  574. $day = $obj[1];
  575. $count = $map[$month];
  576. if ($count == 0) {
  577. $map[$month] = $day;
  578. } else {
  579. $map[$month] = $day + $count;
  580. }
  581. }
  582. }
  583. return $map;
  584. }
  585. /**
  586. * 校验是否在审核范围内
  587. */
  588. public function validateIsCheck() {
  589. $id = $this->request["id"];
  590. $type = $this->request["type"];
  591. $process = $this->request["process"];
  592. $info = null;
  593. switch ($type) {
  594. case 1: //编辑合同
  595. $detail = \app\common\model\TalentAllowancecontractDetail::find($id);
  596. $info = TalentAllowanceApi::getInfoById($detail["mainId"]);
  597. break;
  598. case 2: //编辑项目
  599. $project = \app\common\model\TalentAllowanceProject::find($id);
  600. $info = TalentAllowanceApi::getInfoById($project["mainId"]);
  601. break;
  602. case 3:
  603. $info = TalentAllowanceApi::getInfoById($id);
  604. break;
  605. }
  606. if (!$info) {
  607. return new Response(Response::ERROR, "校验不通过,无法操作");
  608. }
  609. $where = [];
  610. $where[] = ["mainId", "=", $info["id"]];
  611. $where[] = ["step", "=", $process];
  612. $where[] = ["active", "=", 2];
  613. $log = null;
  614. switch ($process) {
  615. case 1:
  616. if ($info["checkState"] != AllowanceStateEnum::NEED_CHECK && $info["checkState"] != AllowanceStateEnum::REJECT_TO_FIRST) {
  617. return new Response(Response::ERROR, "不在审核范围内");
  618. }
  619. //$where[] = ["companyId","=",$this->user["companyId"]];
  620. $log = TalentChecklog::where($where)->order("createTime desc")->find();
  621. break;
  622. case 2:
  623. if ($info["checkState"] != AllowanceStateEnum::NEED_VISIT_CHECK && $info["checkState"] != AllowanceStateEnum::REVIEW_REJECT) {
  624. return new Response(Response::ERROR, "不在审核范围内");
  625. }
  626. break;
  627. case 3:
  628. if ($info["checkState"] != AllowanceStateEnum::NEED_REVIEW && $info["checkState"] != AllowanceStateEnum::PUBLIC_REJECT) {
  629. return new Response(Response::ERROR, "不在审核范围内");
  630. }
  631. $log = TalentChecklog::where($where)->order("createTime desc")->find();
  632. break;
  633. }
  634. if ($log != null) {
  635. $info["checkState"] = $log["state"];
  636. $info["checkMsg"] = $log["description"];
  637. } else {
  638. $info["checkState"] = null;
  639. $info["checkMsg"] = "";
  640. }
  641. $res = [];
  642. $res["info"] = $info;
  643. if ($type == 3) {
  644. $enterpriseMap = \app\common\model\Enterprise::where("type", $this->user["type"])->column("name", "id");
  645. $where = [];
  646. $where[] = ["mainId", "=", $id];
  647. $where[] = ["isLock", "=", 1];
  648. $projectList = \app\common\model\TalentAllowanceProject::where($where)->select()->toArray();
  649. $detailList = \app\common\model\TalentAllowancecontractDetail::where("mainId", $id)->select()->toArray();
  650. $detailMap = array_reduce($detailList, function ($result, $item) {
  651. $key = $item["id"];
  652. $result[$key] = $item;
  653. return $result;
  654. }, []);
  655. foreach ($detailList as &$detail) {
  656. $detail["enterpriseName"] = sprintf("%s(%s至%s)", $enterpriseMap[$detail["enterpriseId"]], $detail["startTime"], $detail["endTime"]);
  657. }unset($detail);
  658. foreach ($projectList as &$project) {
  659. $detail = $detailMap[$project["baseId"]];
  660. $project["projectName"] = sprintf("%s(%s(%s至%s))", AllowanceProjectEnum::getProjectName($project["project"]), $enterpriseMap[$project["enterpriseId"]], $detail["startTime"], $detail["endTime"]);
  661. }
  662. $where = [];
  663. $where[] = ["type", "=", $info["type"]];
  664. $where[] = ["project", "=", \app\common\state\ProjectState::JBT];
  665. $where[] = ["active", "=", 1];
  666. $where[] = ["delete", "=", 0];
  667. $filetypes = Db::table("new_common_filetype")->where($where)->order("sn asc")->select()->toArray();
  668. $res["files"] = $filetypes;
  669. $res["projects"] = $projectList;
  670. $res["concats"] = $detailList;
  671. }
  672. return new Response(Response::SUCCESS, "不在审核范围内", $res);
  673. }
  674. /**
  675. * 查询工作单位
  676. */
  677. public function findAllowanceContractDetail() {
  678. $mainId = $this->request["mainId"];
  679. $offset = $this->request["offset"] ?: 0;
  680. $limit = $this->request["limit"] ?: 1000;
  681. $count = \app\common\model\TalentAllowancecontractDetail::where("mainId", $mainId)->count();
  682. $list = \app\common\model\TalentAllowancecontractDetail::where("mainId", $mainId)->limit($offset, $limit)->select()->toArray();
  683. $enterpriseMap = \app\common\model\Enterprise::column("name", "id");
  684. foreach ($list as &$row) {
  685. $row["enterpriseName"] = $enterpriseMap[$row["enterpriseId"]];
  686. }unset($row);
  687. return json(["rows" => $list, "total" => $count]);
  688. }
  689. /**
  690. * 查询核查项目情况
  691. */
  692. public function findAllowanceProject() {
  693. $mainId = $this->request["mainId"];
  694. $baseId = $this->request["baseId"];
  695. $offset = $this->request["offset"] ?: 0;
  696. $limit = $this->request["limit"] ?: 1000;
  697. $where = [];
  698. $where[] = ["mainId", "=", $mainId];
  699. $where[] = ["baseId", "=", $baseId];
  700. $count = \app\common\model\TalentAllowanceProject::where($where)->count();
  701. $list = \app\common\model\TalentAllowanceProject::where($where)->limit($offset, $limit)->select()->toArray();
  702. $info = TalentAllowanceApi::getInfoById($mainId);
  703. foreach ($list as &$project) {
  704. $project["projectName"] = AllowanceProjectEnum::getProjectName($project["project"]);
  705. if ($info["checkState"] == 1) {
  706. $project["isEdit"] = in_array($project["project"], [
  707. AllowanceProjectEnum::PROJECT_CONTRACT,
  708. AllowanceProjectEnum::PROJECT_TAX,
  709. AllowanceProjectEnum::PROJECT_WAGES,
  710. AllowanceProjectEnum::PROJECT_ATTENDANCE,
  711. AllowanceProjectEnum::PROJECT_SB_PENSION,
  712. AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
  713. AllowanceProjectEnum::PROJECT_SB_MEDICA,
  714. AllowanceProjectEnum::PROJECT_WORKDAY
  715. ]) ? 1 : 2;
  716. } else if ($info["checkState"] == 10) {
  717. $projects = explode(",", $info["projects"]);
  718. if (in_array($project["id"], $projects)) {
  719. $project["isEdit"] = 1;
  720. } else {
  721. $project["isEdit"] = 2;
  722. }
  723. } else {
  724. $project["isEdit"] = 2;
  725. }
  726. }unset($project);
  727. return json(["rows" => $list, "total" => $count]);
  728. }
  729. /**
  730. * 查询人才层次变更记录
  731. */
  732. public function findAllowanceArrange() {
  733. $mainId = $this->request["mainId"];
  734. $offset = $this->request["offset"] ?: 0;
  735. $limit = $this->request["limit"] ?: 1000;
  736. $where = [];
  737. $where[] = ["mainId", "=", $mainId];
  738. $count = \app\common\model\TalentAllowanceArrange::where($where)->count();
  739. $list = \app\common\model\TalentAllowanceArrange::where($where)->limit($offset, $limit)->select()->toArray();
  740. foreach ($list as &$arrange) {
  741. $condition = \app\common\api\TalentConditionApi::getOne($arrange["identifyCondition"]);
  742. $arrange["identifyConditionText"] = $condition["name"];
  743. $arrange["talentArrangeName"] = \app\common\state\CommonConst::getLayerNameByLayer($arrange["talentArrange"]);
  744. }unset($arrange);
  745. return json(["rows" => $list, "total" => $count]);
  746. }
  747. private function setTalentAllowanceInfo($where, $query, $process) {
  748. if (\StrUtil::isNotEmpAndNull($query["year"])) {
  749. $where[] = ["year", "=", $query["year"]];
  750. }
  751. if (\StrUtil::isNotEmpAndNull($query["enterpriseName"])) {
  752. $where[] = ["enterpriseName", "like", "%" . $query["enterpriseName"] . "%"];
  753. }
  754. if (\StrUtil::isNotEmpAndNull($query["name"])) {
  755. $where[] = ["name", "like", "%" . $query["name"] . "%"];
  756. }
  757. if (\StrUtil::isNotEmpAndNull($query["talentType"])) {
  758. $where[] = ["talentType", "=", $query["talentType"]];
  759. }
  760. if (\StrUtil::isNotEmpAndNull($query["talentArrange"])) {
  761. $where[] = ["talentArrange", "=", $query["talentArrange"]];
  762. }
  763. if (\StrUtil::isNotEmpAndNull($query["identifyCondition"])) {
  764. $where[] = ["identifyCondition", "=", $query["identifyCondition"]];
  765. }
  766. if (\StrUtil::isNotEmpAndNull($query["address"])) {
  767. $where[] = ["address", "=", $query["address"]];
  768. }
  769. if ($query["recommendAllowanceType"]) {
  770. $where[] = ["recommendAllowanceType", "=", $query["recommendAllowanceType"]];
  771. }
  772. if ($query["publicState"]) {
  773. $where[] = ["publicState", "=", $query["publicState"]];
  774. }
  775. if (\StrUtil::isNotEmpAndNull($query["introductionMode"])) {
  776. $where[] = ["introductionMode", "=", $query["introductionMode"]];
  777. }
  778. if (\StrUtil::isNotEmpAndNull($query["firstJJStartTime"])) {
  779. $where[] = ["firstInJJTime", ">=", $query["firstJJStartTime"]];
  780. }
  781. if (\StrUtil::isNotEmpAndNull($query["firstJJEndTime"])) {
  782. $where[] = ["firstInJJTime", "<=", $query["firstJJEndTime"]];
  783. }
  784. if ($process == 4) {
  785. if ($query["isSupple"]) {
  786. $where[] = ["isSupple", "=", $query["isSupple"]];
  787. }
  788. if ($query["isPublicCheck"]) {
  789. $where[] = ["isPublicCheck", "=", $query["isPublicCheck"]];
  790. }
  791. }
  792. if ($query["checkState"]) {
  793. if ($query["checkState"] == -1) {
  794. $where[] = ["checkState", "=", $query["checkState"]];
  795. } else {
  796. if ($process == 1) {
  797. switch ($query["checkState"]) {
  798. case 0: //保存未提交
  799. $where[] = ["checkState", "=", 1];
  800. break;
  801. case 1:
  802. $where[] = ["checkState", "=", 5];
  803. break;
  804. case 2: //驳回
  805. $where[] = ["checkState", "=", 10];
  806. break;
  807. case 3: //通过
  808. $where[] = ["checkState", "in", [15, 20, 30, 25]];
  809. break;
  810. case 4: //重新提交
  811. $where[] = ["checkState", "=", 5];
  812. $where[] = ["highProcess", ">=", $process];
  813. break;
  814. case 5: //上级驳回
  815. $where[] = ["checkState", "=", 13];
  816. break;
  817. }
  818. }
  819. if ($process == 2) {
  820. switch ($query["checkState"]) {
  821. case 1:
  822. $where[] = ["checkState", "=", 15];
  823. break;
  824. case 2: //驳回
  825. $where[] = ["checkState", "in", [1, 5, 10]];
  826. $where[] = ["highProcess", ">=", $process];
  827. break;
  828. case 3: //通过
  829. $where[] = ["checkState", "in", [20, 30]];
  830. break;
  831. case 9: //重新提交
  832. $where[] = ["checkState", "=", 15];
  833. $where[] = ["highProcess", ">=", $process];
  834. break;
  835. case 4: //上级驳回
  836. $where[] = ["checkState", "=", 25];
  837. break;
  838. case -1:
  839. $where[] = ["checkState", "=", -1];
  840. break;
  841. }
  842. }
  843. if ($process == 3) {
  844. switch ($query["checkState"]) {
  845. case -1:
  846. $where[] = ["checkState", "=", -1];
  847. break;
  848. case 1:
  849. $where[] = ["checkState", "=", 20];
  850. break;
  851. case 2: //驳回
  852. $where[] = ["checkState", "in", [1, 5, 10, 15, 25]];
  853. $where[] = ["highProcess", ">=", $process];
  854. break;
  855. case 3: //通过
  856. $where[] = ["checkState", "=", 30];
  857. break;
  858. case 9: //重新提交
  859. $where[] = ["checkState", "=", 20];
  860. $where[] = ["highProcess", ">=", $process];
  861. break;
  862. case 4: //上级驳回
  863. $where[] = ["checkState", "=", 35];
  864. break;
  865. }
  866. }
  867. if ($process == 4) {
  868. switch ($query["checkState"]) {
  869. case -1:
  870. $where[] = ["checkState", "=", -1];
  871. break;
  872. case 3: //通过
  873. $where[] = ["checkState", "=", 30];
  874. break;
  875. }
  876. }
  877. }
  878. }
  879. return $where;
  880. }
  881. private function translateToChinese(&$obj) {
  882. if (\StrUtil::isNotEmpAndNull($obj["address"])) {
  883. $obj["addressName"] = DictApi::findByParentCodeAndCode("street", $obj["address"])["name"];
  884. }
  885. if (\StrUtil::isNotEmpAndNull($obj["talentType"])) {
  886. $obj["talentTypeName"] = DictApi::findByParentCodeAndCode("enterprise_tag", $obj["talentType"])["name"];
  887. }
  888. if (\StrUtil::isNotEmpAndNull($obj["talentArrange"])) {
  889. $obj["talentArrangeName"] = DictApi::findByParentCodeAndCode("talent_arrange", $obj["talentArrange"])["name"];
  890. }
  891. if (\StrUtil::isNotEmpAndNull($obj["identifyCondition"])) {
  892. $obj["identifyConditionText"] = \app\common\api\TalentConditionApi::getOne($obj["identifyCondition"])["name"];
  893. }
  894. if (\StrUtil::isNotEmpAndNull($obj["introductionMode"])) {
  895. $obj["introductionModeName"] = DictApi::findByParentCodeAndCode("import_way", $obj["introductionMode"])["name"];
  896. }
  897. }
  898. private function translateChinese($list) {
  899. //获取字典表
  900. $levelMap = DictApi::selectByParentCode("talent_arrange");
  901. $talentTypeMap = DictApi::selectByParentCode("enterprise_tag");
  902. $streetMap = DictApi::selectByParentCode("street");
  903. $cardTypeMap = DictApi::selectByParentCode("card_type");
  904. $modeMap = DictApi::selectByParentCode("import_way");
  905. $where = [];
  906. $where[] = ["type", "=", $this->user["type"]];
  907. $where[] = ["id", "in", array_column($list, "identifyCondition")];
  908. $icmap = \app\common\model\TalentCondition::where($where)->column("name", "id");
  909. foreach ($list as &$info) {
  910. if (\StrUtil::isNotEmpAndNull($info["talentArrange"])) {
  911. $info["talentArrangeName"] = $levelMap[$info["talentArrange"]];
  912. }
  913. $info["talentTypeName"] = $talentTypeMap[$info["talentType"]];
  914. if (\StrUtil::isNotEmpAndNull($info["identifyCondition"])) {
  915. $info["identifyConditionText"] = $icmap[$info["identifyCondition"]];
  916. }
  917. $info["addressName"] = $streetMap[$info["address"]];
  918. $info["sexName"] = $info["sex"] == 1 ? "男" : "女";
  919. $info["checkStateName"] = AllowanceStateEnum::getStateName($info["checkState"]);
  920. $info["cardTypeName"] = $cardTypeMap[$info["cardType"]];
  921. $info["isSuppleName"] = $info["isSupple"] == 1 ? "是" : "否";
  922. $info["isPublicCheckName"] = $info["isPublicCheckName"] == 1 ? "是" : "否";
  923. $info["recomendAllowanceTypeName"] = \app\common\state\AllowanceTypeEnum::getTypeName($info["recomendAllowanceType"]);
  924. $info["allowanceTypeName"] = \app\common\state\AllowanceTypeEnum::getTypeName($info["allowanceType"]);
  925. $info["recommendTalentArrangeName"] = $levelMap[$info["recommendTalentArrange"]];
  926. $info["jtTalentArrangeName"] = $levelMap[$info["jtTalentArrange"]];
  927. $info["introductionModeName"] = $modeMap[$info["introductionMode"]];
  928. }unset($info);
  929. return $list;
  930. }
  931. }