Api.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <?php
  2. namespace app\admin\controller;
  3. use app\BaseController;
  4. use app\common\model\jucai\RecruitAppointInfoModel;
  5. use app\common\model\jucai\RecruitModel;
  6. use app\common\model\jucai\RecruitPostModel;
  7. use app\common\model\odd_job\BrokerModel;
  8. use app\common\model\odd_job\JobModel;
  9. use app\common\model\odd_job\RensheCodeModel;
  10. use app\common\model\odd_job\UserModel;
  11. use app\common\model\odd_job\WorkerModel;
  12. use app\common\model\SettingModel;
  13. class Api extends BaseController
  14. {
  15. public function talent()
  16. {
  17. $system = SettingModel::getConfigValue(SettingModel::TALENT);
  18. $res = [
  19. 'talent_level' => [
  20. ['name' => '第一层次', 'count' => $system['talent_level_1']],
  21. ['name' => '第二层次', 'count' => $system['talent_level_2']],
  22. ['name' => '第三层次', 'count' => $system['talent_level_3']],
  23. ['name' => '第四层次', 'count' => $system['talent_level_4']],
  24. ['name' => '第五层次', 'count' => $system['talent_level_5']],
  25. ['name' => '第六层次', 'count' => $system['talent_level_6']],
  26. ['name' => '第七层次', 'count' => $system['talent_level_7']],
  27. ],
  28. 'talent_industry' => [
  29. ['name' => '贸易/进出口', 'count' => $system['talent_industry_trade']],
  30. ['name' => '消费品(食/饮/烟酒)', 'count' => $system['talent_industry_goods']],
  31. ['name' => '服装/纺织/皮革', 'count' => $system['talent_industry_clothing']],
  32. ['name' => '制药/生物工程', 'count' => $system['talent_industry_drug']],
  33. ['name' => '医疗设备/器械', 'count' => $system['talent_industry_medical']],
  34. ['name' => '酒店/旅游', 'count' => $system['talent_industry_hotel']],
  35. ['name' => '交通/运输/物流', 'count' => $system['talent_industry_traffic']],
  36. ['name' => '其他', 'count' => $system['talent_industry_other']],
  37. ],
  38. 'talent_age' => [
  39. ['name' => '30岁以下', 'count' => $system['talent_age_1']],
  40. ['name' => '30-39岁', 'count' => $system['talent_age_2']],
  41. ['name' => '40-49岁', 'count' => $system['talent_age_3']],
  42. ['name' => '50岁以上', 'count' => $system['talent_age_4']],
  43. ],
  44. 'talent_education' => [
  45. ['name' => '硕士', 'count' => $system['talent_education_1']],
  46. ['name' => '博士', 'count' => $system['talent_education_2']],
  47. ['name' => '博士后', 'count' => $system['talent_education_3']],
  48. ],
  49. 'total_count' => [
  50. ['name' => '硕博人才数', 'count' => $system['talent_total']],
  51. ],
  52. ];
  53. return json($res);
  54. }
  55. public function odd_job()
  56. {
  57. $res = [];
  58. //街道数据
  59. $comjobs_community = JobModel::field("count(community),community")->group('community')->column('count(community)', 'community');
  60. $community = RensheCodeModel::getList('community')->toArray();
  61. $broker_town = BrokerModel::field("count(town),town")->group('town')->column('count(town)', 'town');
  62. foreach ($community as &$v) {
  63. if (!empty($comjobs_community[$v['code']])) {
  64. $v['count'] = $comjobs_community[$v['code']];
  65. } else {
  66. $v['count'] = 0;
  67. }
  68. if (!empty($broker_town[$v['name']])) {
  69. $v['broker_count'] = $broker_town[$v['name']];
  70. } else {
  71. $v['broker_count'] = 0;
  72. }
  73. unset($v);
  74. }
  75. $community[] = [
  76. 'id' => 0,
  77. 'name' => '其他',
  78. 'code' => '',
  79. 'count' => $comjobs_community[''] ?? 0,
  80. 'broker_count' => $broker_town[''] ?? 0,
  81. ];
  82. $res['community'] = $community;
  83. //数量统计
  84. $comjobs_map = [];
  85. $comjobs_map[] = ['createtime', '<=', time()];
  86. $comjobs_map[] = ['status', 'in', '3,4'];
  87. $res['company_total'] = WorkerModel::where('status', 'in', '4,5')->count();
  88. $res['comjobs_total'] = JobModel::where($comjobs_map)->count();
  89. $res['user_total'] = UserModel::count();
  90. return json($res);
  91. }
  92. public function recruit()
  93. {
  94. $data = [];
  95. //招考数据
  96. $data['recruit_count'] = RecruitModel::count();
  97. $data['recruit_post'] = RecruitPostModel::count();
  98. $data['recruit_apply'] = RecruitAppointInfoModel::count();
  99. //学历和年龄
  100. $recruit_apply_data = RecruitAppointInfoModel::field(['birthday', 'education'])->select();
  101. $recruit_education = [
  102. '专科' => ['name' => '专科', 'count' => 0],
  103. '本科' => ['name' => '本科', 'count' => 0],
  104. '硕士' => ['name' => '硕士', 'count' => 0],
  105. '博士' => ['name' => '博士', 'count' => 0],
  106. '其他' => ['name' => '其他', 'count' => 0],
  107. ];
  108. $recruit_age = [
  109. '30岁及以下' => ['name' => '30岁及以下', 'count' => 0],
  110. '30到35岁' => ['name' => '30到35岁', 'count' => 0],
  111. '35到40岁' => ['name' => '35到40岁', 'count' => 0],
  112. '40岁以上' => ['name' => '40岁以上', 'count' => 0],
  113. ];
  114. $year = date('Y');
  115. foreach ($recruit_apply_data as $v) {
  116. if (!empty($recruit_education[$v['education']])) {
  117. $recruit_education[$v['education']]['count']++;
  118. } else {
  119. $recruit_education['其他']['count']++;
  120. }
  121. $birth = mb_substr($v['birthday'], 0, 4);
  122. if ($birth >= ($year - 30)) {
  123. $recruit_age['30岁及以下']['count']++;
  124. } elseif ($birth >= ($year - 35) && $birth < ($year - 30)) {
  125. $recruit_age['30到35岁']['count']++;
  126. } elseif ($birth >= ($year - 40) && $birth < ($year - 35)) {
  127. $recruit_age['35到40岁']['count']++;
  128. } else {
  129. $recruit_age['40岁以上']['count']++;
  130. }
  131. }
  132. $data['recruit_education'] = array_values($recruit_education);
  133. $data['recruit_age'] = array_values($recruit_age);
  134. return json($data);
  135. }
  136. public function odd_job_other()
  137. {
  138. $setting = SettingModel::getConfigValue(SettingModel::ODD_JOB);
  139. return json($setting);
  140. }
  141. public function bi_talent()
  142. {
  143. $talent = SettingModel::getConfigValue(SettingModel::TALENT);
  144. $industry = SettingModel::getConfigValue(SettingModel::INDUSTRY);
  145. $data = [];
  146. //人才数据
  147. $data['talent_total'] = $talent['talent_total'];
  148. $data['talent_problem_total'] = $talent['talent_problem_total'];
  149. $data['talent_problem_deal'] = $talent['talent_problem_deal'];
  150. //产业园机构
  151. $data['industry_institution_num'] = $industry['industry_institution_num'];
  152. $data['industry_institution_turnover'] = $industry['industry_institution_turnover'];
  153. $data['industry_institution_employee'] = $industry['industry_institution_employee'];
  154. //产业园服务数据
  155. $data['industry_enterprise_num'] = $industry['industry_enterprise_num'];
  156. $data['industry_service_num'] = $industry['industry_service_num'];
  157. //人才问题分类
  158. $data['talent_problem_cate'] = [
  159. ['name' => '人才津贴', 'count' => $talent['talent_problem_talent']],
  160. ['name' => '人才认定', 'count' => $talent['talent_problem_determine']],
  161. ['name' => '交通补贴', 'count' => $talent['talent_problem_traffic']],
  162. ['name' => '购房补贴', 'count' => $talent['talent_problem_house']],
  163. ['name' => '人才活动', 'count' => $talent['talent_problem_activity']],
  164. ['name' => '子女就学', 'count' => $talent['talent_problem_children']],
  165. ['name' => '配偶就业', 'count' => $talent['talent_problem_spouse']],
  166. ['name' => '其他问题', 'count' => $talent['talent_problem_other']],
  167. ];
  168. //人才层次
  169. $data['talent_level'] = [
  170. ['name' => '第一层次', 'count' => $talent['talent_level_1']],
  171. ['name' => '第二层次', 'count' => $talent['talent_level_2']],
  172. ['name' => '第三层次', 'count' => $talent['talent_level_3']],
  173. ['name' => '第四层次', 'count' => $talent['talent_level_4']],
  174. ['name' => '第五层次', 'count' => $talent['talent_level_5']],
  175. ['name' => '第六层次', 'count' => $talent['talent_level_6']],
  176. ['name' => '第七层次', 'count' => $talent['talent_level_7']],
  177. ];
  178. //产业园机构类型
  179. $data['industry_institution_type'] = [
  180. ['name' => '软件技术', 'count' => $industry['industry_institution_type_software']],
  181. ['name' => '管理咨询', 'count' => $industry['industry_institution_type_consult']],
  182. ['name' => '培训教育', 'count' => $industry['industry_institution_type_train']],
  183. ['name' => '灵活用工', 'count' => $industry['industry_institution_type_flexible']],
  184. ['name' => '派遣外包', 'count' => $industry['industry_institution_type_dispatch']],
  185. ['name' => '人才猎聘', 'count' => $industry['industry_institution_type_talent']],
  186. ['name' => '测评背调', 'count' => $industry['industry_institution_type_evaluation']],
  187. ['name' => '劳务输出', 'count' => $industry['industry_institution_type_labor']],
  188. ['name' => '商业保险', 'count' => $industry['industry_institution_type_insurance']],
  189. ['name' => '其他', 'count' => $industry['industry_institution_type_other']],
  190. ];
  191. //人才分布
  192. $data['talent_industry'] = [
  193. ['name' => '贸易/进出口', 'count' => $talent['talent_industry_trade']],
  194. ['name' => '消费品(食/饮/烟酒)', 'count' => $talent['talent_industry_goods']],
  195. ['name' => '服装/纺织/皮革', 'count' => $talent['talent_industry_clothing']],
  196. ['name' => '制药/生物工程', 'count' => $talent['talent_industry_drug']],
  197. ['name' => '医疗设备/器械', 'count' => $talent['talent_industry_medical']],
  198. ['name' => '酒店/旅游', 'count' => $talent['talent_industry_hotel']],
  199. ['name' => '交通/运输/物流', 'count' => $talent['talent_industry_traffic']],
  200. ['name' => '其他', 'count' => $talent['talent_industry_other']],
  201. ];
  202. $data['talent_age'] = [
  203. ['name' => '30岁以下', 'count' => $talent['talent_age_1']],
  204. ['name' => '30-39岁', 'count' => $talent['talent_age_2']],
  205. ['name' => '40-49岁', 'count' => $talent['talent_age_3']],
  206. ['name' => '50岁以上', 'count' => $talent['talent_age_4']],
  207. ];
  208. $data['talent_education'] = [
  209. ['name' => '硕士', 'count' => $talent['talent_education_1']],
  210. ['name' => '博士', 'count' => $talent['talent_education_2']],
  211. ['name' => '博士后', 'count' => $talent['talent_education_3']],
  212. ];
  213. //人才咨询渠道
  214. $data['talent_channel'] = [
  215. ['name' => '来电咨询', 'count' => $talent['talent_channel_call']],
  216. ['name' => '微信咨询', 'count' => $talent['talent_channel_wechat']],
  217. ['name' => '上门拜访', 'count' => $talent['talent_channel_door']],
  218. ['name' => '现场咨询', 'count' => $talent['talent_channel_scene']],
  219. ['name' => '其他渠道', 'count' => $talent['talent_channel_other']],
  220. ];
  221. return json($data);
  222. }
  223. }