This commit is contained in:
parent
46ca0b270c
commit
8656146a7e
7
pom.xml
7
pom.xml
|
@ -157,7 +157,12 @@
|
|||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- apache 集合工具类 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
<version>4.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package com.yzdx.AiInterviewer.controller.VxController;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yzdx.AiInterviewer.comment.R;
|
||||
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxCompanyLikeDto;
|
||||
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxJobLikeDto;
|
||||
import com.yzdx.AiInterviewer.entity.vxEntity.VxCompanyLike;
|
||||
import com.yzdx.AiInterviewer.service.CompanyService;
|
||||
import com.yzdx.AiInterviewer.service.JobListService;
|
||||
import com.yzdx.AiInterviewer.service.VxService.VxCompanyLikeService;
|
||||
|
@ -115,5 +113,12 @@ public class VxJobController {
|
|||
|
||||
return R.success(result);
|
||||
}
|
||||
@GetMapping("/getSuggestList")
|
||||
public R getSuggestList(Integer userId){
|
||||
|
||||
Map<String,Object> result= jobListService.getSuggestJob(userId);
|
||||
|
||||
return R.success(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.yzdx.AiInterviewer.entity.dto.JobDto;
|
|||
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxJobLikeDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface JobListService extends IService<JobEntity> {
|
||||
/**
|
||||
|
@ -131,4 +132,13 @@ public interface JobListService extends IService<JobEntity> {
|
|||
* */
|
||||
|
||||
List<VxJobLikeDto> searchJobList(String searchName, String address);
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID进行岗位推荐
|
||||
* @param userId 用户ID
|
||||
* @return jobList
|
||||
*
|
||||
* */
|
||||
Map<String,Object> getSuggestJob(Integer userId);
|
||||
}
|
||||
|
|
|
@ -1,21 +1,31 @@
|
|||
package com.yzdx.AiInterviewer.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yzdx.AiInterviewer.entity.Company;
|
||||
import com.yzdx.AiInterviewer.entity.JobEntity;
|
||||
import com.yzdx.AiInterviewer.entity.Resume;
|
||||
import com.yzdx.AiInterviewer.entity.dto.JobDto;
|
||||
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxJobLikeDto;
|
||||
import com.yzdx.AiInterviewer.mapper.JobMapper;
|
||||
import com.yzdx.AiInterviewer.service.CompanyService;
|
||||
import com.yzdx.AiInterviewer.service.JobListService;
|
||||
import com.yzdx.AiInterviewer.service.ResumeService;
|
||||
import com.yzdx.AiInterviewer.utiles.MyStringUtils;
|
||||
import com.yzdx.AiInterviewer.utiles.TimeUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
|
@ -25,6 +35,8 @@ public class JobListServiceImpl extends ServiceImpl<JobMapper, JobEntity> implem
|
|||
private JobMapper jobMapper;
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
@Autowired
|
||||
private ResumeService resumeService;
|
||||
|
||||
@Override
|
||||
public Integer addJob(List<String> address, String address_detail, String details, String jobName, String startTime, String endTime, List<String> jobTips, Integer jobType, String min_salary, String max_salary, String min_number, String max_number, Integer requirement, Integer userId, String encoding) {
|
||||
|
@ -318,5 +330,92 @@ public class JobListServiceImpl extends ServiceImpl<JobMapper, JobEntity> implem
|
|||
|
||||
}
|
||||
|
||||
///需要改----------------------------------------------------------------
|
||||
@Override
|
||||
public Map<String,Object> getSuggestJob(Integer userId) {
|
||||
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
//先获取用户的岗位期望
|
||||
Resume resume = resumeService.getResume(userId);
|
||||
|
||||
String jobExpectation = resume.getJobExpectation();
|
||||
|
||||
JSONArray jobExpectationJSONs = (JSONArray) JSON.parse(jobExpectation);
|
||||
|
||||
List<String> suggestJobs=new ArrayList<>();
|
||||
|
||||
if(jobExpectationJSONs.size()<=5){
|
||||
LambdaQueryWrapper<JobEntity> addQueryWrapper =new LambdaQueryWrapper<>();
|
||||
|
||||
addQueryWrapper.last("limit 5");
|
||||
|
||||
List<JobEntity> suggestJobEntities = jobMapper.selectList(addQueryWrapper);
|
||||
|
||||
suggestJobs=suggestJobEntities.stream().map(item->{
|
||||
|
||||
String jobName=item.getJobName();
|
||||
|
||||
return jobName ;
|
||||
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < jobExpectationJSONs.size(); i++) {
|
||||
|
||||
String jobExpectationJSON = jobExpectationJSONs.getString(i);
|
||||
|
||||
JSONObject jsonObject=(JSONObject)JSON.parse(jobExpectationJSON);
|
||||
|
||||
suggestJobs.add(jsonObject.getString("jobName"));
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < suggestJobs.size(); i++) {
|
||||
|
||||
String jobName = suggestJobs.get(i);
|
||||
|
||||
LambdaQueryWrapper<JobEntity> queryWrapper=new LambdaQueryWrapper<>();
|
||||
|
||||
queryWrapper.like(JobEntity::getJobName,jobName).or().like(JobEntity::getJobName,jobName.toString().substring(0,2));
|
||||
|
||||
List<JobEntity> jobEntities1 = jobMapper.selectList(queryWrapper);
|
||||
|
||||
if(jobEntities1==null){
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
List<VxJobLikeDto> vxJobLikeDtoList=jobEntities1.stream().map(item->{
|
||||
|
||||
VxJobLikeDto vxJobLikeDto=new VxJobLikeDto();
|
||||
|
||||
BeanUtils.copyProperties(item,vxJobLikeDto);
|
||||
|
||||
vxJobLikeDto.setJobName(item.getJobName());
|
||||
|
||||
vxJobLikeDto.setSalary(item.getMinSalary()+"-"+item.getMaxSalary());
|
||||
|
||||
Company companyDetail = companyService.getCompanyDetail(item.getCompanyEncoding());
|
||||
|
||||
vxJobLikeDto.setCompany(companyDetail.getCompanyName());
|
||||
|
||||
vxJobLikeDto.setStaffNumber(companyDetail.getStaffNumber());
|
||||
|
||||
vxJobLikeDto.setLabel(item.getJobTips());
|
||||
|
||||
vxJobLikeDto.setPosition(item.getAddressDetail());
|
||||
|
||||
return vxJobLikeDto;
|
||||
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
result.put(jobName,vxJobLikeDtoList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue