resumeRepository = $resumeRepository; $this->personalJobsApplyRepository = $personalJobsApplyRepository; $this->categoryJobsRepository = $categoryJobsRepository; } public function getValidResumeNum($where) { return $this->resumeRepository->getResumesCount($where); } public function getResumeNum($where, $member_where = []) { $rst = $this->resumeRepository->getResumeNum($where, $member_where); return $rst; } public function getApplyNumGroup($where, $group_by, $subsite_id) { $rst = $this->personalJobsApplyRepository->getApplyNumGroup($where, $group_by, $subsite_id); return $rst->pluck('count(id)', 'DATE(created_at)')->toArray(); } public function getApplyNum($where, $company_where) { return $this->personalJobsApplyRepository->getApplyNum($where, $company_where); } public function getApplyNumByGroup($where, $company_where, $fields, $group_by, $order_by = '') { return $this->personalJobsApplyRepository->getApplyNumByGroup($where, $company_where, $fields, $group_by, $order_by); } public function getApplyNumByCompanyGroup($where, $company_where, $fields, $group_by, $order_by = '', $limit = '') { $rst = $this->personalJobsApplyRepository->getApplyNumByCompanyGroup($where, $company_where, $fields, $group_by, $order_by, $limit); $list = []; if ($rst->isNotEmpty()) { foreach ($rst as $k => $v) { $list[$k]['count'] = $v->count; $list[$k]['company_id'] = $v->company_id; $company = $v->companys; $list[$k]['company_name'] = $company->companyname; } } return $list; } public function getResumeNumGroup($where, $group_by) { $rst = $this->resumeRepository->getResumeNumGroup($where, $group_by); return $rst->pluck('count(id)', 'DATE(created_at)')->toArray(); } //获取职位分类信息 public function getJobsCategoryInfo() { $result = Cache::get('jobs_cate_list'); if (null === $result) { $result = $this->categoryJobsRepository->jobsCateInfoCache(); Cache::put('jobs_cate_list', $result, '86400'); } return $result; } public function dealJobCategory($data) { $cates = $this->getJobsCategoryInfo(); if ($data) { foreach ($data as $k => $v) { $cate_ids = explode('.', $v['cate']); if (array_has($cates['id'], $cate_ids[1])) { $data[$k]['cate_name'] = $cates['id'][$cate_ids[1]]['name']; } else { $data[$k]['cate_name'] = ''; } } } return $data; } public function getAvgWageByEducation($where, $member_where, $fields, $group_by, $order_by = '', $limit = '') { $rst = $this->resumeRepository->getAvgWageByGroup($where, $member_where, $fields, $group_by, $order_by, $limit); return $rst->toArray(); } public function getResumeNumByClass($where, $member_where, $fields, $group_by, $limit = '', $order_by = '') { $rst = $this->resumeRepository->getNumByClassGroup($where, $member_where, $fields, $group_by, $limit = '', $order_by = ''); return $rst->pluck('num', 'class')->toArray(); } public function getResumeNumByClassGroup($where, $member_where, $fields, $group_by, $order_by = '', $limit = '') { $top_arr = []; $second_arr = []; $top_name_arr = []; $second_name_arr = []; $cates = $this->getJobsCategoryInfo(); $cates = $cates['id']; $rst = $this->resumeRepository->getResumeNumByClassGroup($where, $member_where, $fields, $group_by, $order_by, $limit); if ($rst) { $top_arr = $rst['topClass']; $second_arr = $rst['secondClass']; } if ($top_arr && $cates) { foreach ($top_arr as $k => $v) { if ($limit && count($top_name_arr) < $limit) { if (array_has($cates, $k)) { $top_name_arr[$k] = $cates[$k]['name']; } else { $top_name_arr[$k] = ''; } } else { break; } } } if ($second_arr && $cates) { foreach ($second_arr as $k => $v) { if ($limit && count($second_name_arr) < $limit) { if (array_has($cates, $k)) { $second_name_arr[$k] = $cates[$k]['name']; } else { $second_name_arr[$k] = ''; } } else { break; } } } return ['top_arr'=>$top_arr,'second_arr'=>$second_arr,'top_name_arr'=>$top_name_arr,'second_name_arr'=>$second_name_arr]; } public function getResumeNumsByGroup($where, $member_where, $fields, $group_by, $order_by) { $rst = $this->resumeRepository->getAvgWageByGroup($where, $member_where, $fields, $group_by, $order_by); return $rst->pluck('num', 'create_month')->toArray(); } public function getResumeNumsGroup($where, $member_where, $fields, $group_by, $order_by = '') { $rst = $this->resumeRepository->getAvgWageByGroup($where, $member_where, $fields, $group_by, $order_by); return $rst; } public function getResumeNumsByEducationGroup($start_time, $end_time, $subsite_id) { $resume_where = [ ['r.created_at', '<=', $end_time], ['r.created_at', '>=', $start_time], ]; if (config('aix.personal_set.per_set.show_set.resume_display')=='1') { $resume_where[] = array('r.audit','=','2'); } else { $resume_where[] = array('r.audit','<>','0'); } $member_where = array( ['m.utype','=',2], ['m.status','=',1] ); if ($subsite_id != -1) { $member_where[] = ['m.subsite_id','=',$subsite_id]; } $resume_fields = 'count(r.id) as num, mu.education'; $where = "r.deleted_at is null and m.deleted_at is null"; $rst = $this->resumeRepository->getResumeNumByEducationGroup($where, $resume_where, $member_where, $resume_fields, 'mu.education', 'mu.education asc'); return $rst->pluck('num', 'education')->toArray(); } public function getResumeNumsByAgeGroup($subsite_id, $start_time, $end_time, $ages, $age_text) { //简历查询条件 $resume_where = [ ['r.created_at', '<=', $end_time], ['r.created_at', '>=', $start_time], ]; if (config('aix.personal_set.per_set.show_set.resume_display')=='1') { $resume_where[] = array('r.audit','=','2'); } else { $resume_where[] = array('r.audit','<>','0'); } $member_where = array( ['m.utype','=',2], ['m.status','=',1] ); if ($subsite_id != -1) { $member_where[] = ['m.subsite_id','=',$subsite_id]; } $where = "r.deleted_at is null and m.deleted_at is null AND mu.deleted_at is null"; $resume_fields = 'count(r.id) as num, mu.birthday'; $group = ''; $age_data = []; foreach ($ages as $k => $v) { $map = []; $max_birth = date('Y') - $v['min_age']; $min_birth = 0; if ($v['max_age']) { $min_birth = date('Y') - $v['max_age']; } $map[] = ['mu.birthday', '<=', $max_birth]; if ($min_birth && $max_birth) { $map[] = ['mu.birthday', '>=', $min_birth]; } $resume_count = $this->resumeRepository->getResumeNumsByAgeGroup($where, $resume_where, $member_where, $map, $resume_fields, $group); $age_data[$age_text[$k]] = $resume_count; } return $age_data; } public function getResumeApplyGroup($where, $order_fileds, $apply_group, $apply_order, $limit = '') { return $this->personalJobsApplyRepository->getResumeApplyGroup($where, $order_fileds, $apply_group, $apply_order, $limit); } public function getResumeBySexGroup($subsite_id, $start_time, $end_time) { //简历查询条件 $resume_where = array(); if (config('aix.personal_set.per_set.show_set.resume_display')=='1') { $resume_where[] = array('r.audit','=','2'); } else { $resume_where[] = array('r.audit','<>','0'); } $resume_where[] = ['r.created_at','>=',$start_time]; $resume_where[] = ['r.created_at','<=',$end_time]; $member_where = array(array('m.utype','2',1),); if ($subsite_id != -1) { $member_where[] = array('m.subsite_id','=',$subsite_id); } $info_where = []; $field = 'count(r.id) as num, mu.sex,if (mu.sex=1,"男","女") as sex_cn'; $group = 'mu.sex'; $rst = $this->resumeRepository->getResumeNumByGroup($resume_where, $member_where, $info_where, $field, $group); return $rst; } }