邀请面试完善
This commit is contained in:
parent
e6406e7234
commit
53f4756e60
|
@ -3,10 +3,14 @@ package com.yzdx.AiInterviewer.controller;
|
|||
import com.yzdx.AiInterviewer.comment.R;
|
||||
import com.yzdx.AiInterviewer.entity.BackgroundEntity;
|
||||
import com.yzdx.AiInterviewer.entity.ImagesEntity;
|
||||
import com.yzdx.AiInterviewer.entity.InvitePromote;
|
||||
import com.yzdx.AiInterviewer.entity.LogoEntity;
|
||||
import com.yzdx.AiInterviewer.entity.dto.InvitePromoteDto;
|
||||
import com.yzdx.AiInterviewer.mapper.InvitePromoteMapper;
|
||||
import com.yzdx.AiInterviewer.service.InterviewBackgroundService;
|
||||
import com.yzdx.AiInterviewer.service.InterviewImagesService;
|
||||
import com.yzdx.AiInterviewer.service.InterviewLogoService;
|
||||
import com.yzdx.AiInterviewer.service.InvitePromoteService;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -28,6 +32,8 @@ public class InterviewController {
|
|||
private InterviewImagesService imagesService;
|
||||
@Autowired
|
||||
private InterviewBackgroundService backgroundService;
|
||||
@Autowired
|
||||
private InvitePromoteService invitePromoteService;
|
||||
|
||||
/**
|
||||
* 获取公司logo
|
||||
|
@ -236,7 +242,14 @@ public class InterviewController {
|
|||
|
||||
}
|
||||
|
||||
@GetMapping("/getInvitePromote")
|
||||
public R getInvitePromoteDto(Integer id){
|
||||
|
||||
InvitePromoteDto invitePromote = invitePromoteService.getInvitePromote(id);
|
||||
|
||||
return R.success(invitePromote);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -191,9 +191,9 @@ public class VxUserController {
|
|||
@GetMapping("/getResume")
|
||||
public R getResume(Integer userId){
|
||||
|
||||
Resume resume= resumeService.getResume(userId);
|
||||
Map<String,Object> result= resumeService.getResume(userId);
|
||||
|
||||
return R.success(resume);
|
||||
return R.success(result);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.yzdx.AiInterviewer.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("invite_promote")
|
||||
public class InvitePromote extends BaseEntity{
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
private String encoding;
|
||||
|
||||
private Integer postId;
|
||||
|
||||
private Integer jobId;
|
||||
|
||||
private String startTime;
|
||||
|
||||
private String endTime;
|
||||
|
||||
private String question;
|
||||
|
||||
private String promote;
|
||||
|
||||
private Integer inviteUser;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.yzdx.AiInterviewer.entity.dto;
|
||||
|
||||
import com.yzdx.AiInterviewer.entity.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class InvitePromoteDto extends InvitePromote {
|
||||
|
||||
private Company company;
|
||||
|
||||
private JobEntity job;
|
||||
|
||||
private List<Map<String,Object>> questions;
|
||||
|
||||
private JobPosting jobPost;
|
||||
|
||||
}
|
|
@ -23,4 +23,5 @@ public class JobDto extends BaseEntity {
|
|||
private String address;
|
||||
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.yzdx.AiInterviewer.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yzdx.AiInterviewer.entity.InvitePromote;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface InvitePromoteMapper extends BaseMapper<InvitePromote> {
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.yzdx.AiInterviewer.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yzdx.AiInterviewer.entity.InvitePromote;
|
||||
import com.yzdx.AiInterviewer.entity.dto.InvitePromoteDto;
|
||||
|
||||
public interface InvitePromoteService extends IService<InvitePromote> {
|
||||
|
||||
/**
|
||||
* 添加邀请面试岗位promote
|
||||
*
|
||||
*
|
||||
* */
|
||||
|
||||
Integer addInvitePromote(String encoding,Integer postId,String startTime,String endTime,
|
||||
String question,String promote,Integer inviteUser,Integer userId,Integer jobId);
|
||||
|
||||
|
||||
InvitePromoteDto getInvitePromote(Integer id);
|
||||
|
||||
}
|
|
@ -40,7 +40,7 @@ public interface ResumeService extends IService<Resume> {
|
|||
String personalAdvantage, String other,String education,String jobExpectation, String workExperience,
|
||||
String projectExperience, Integer userId);
|
||||
|
||||
Resume getResume(Integer userId);
|
||||
Map<String,Object> getResume(Integer userId);
|
||||
|
||||
|
||||
// /**
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
package com.yzdx.AiInterviewer.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yzdx.AiInterviewer.entity.*;
|
||||
import com.yzdx.AiInterviewer.entity.dto.InvitePromoteDto;
|
||||
import com.yzdx.AiInterviewer.mapper.InvitePromoteMapper;
|
||||
import com.yzdx.AiInterviewer.mapper.JobPostingMapper;
|
||||
import com.yzdx.AiInterviewer.mapper.QuestionBankMapper;
|
||||
import com.yzdx.AiInterviewer.mapper.QuestionMapper;
|
||||
import com.yzdx.AiInterviewer.service.CompanyService;
|
||||
import com.yzdx.AiInterviewer.service.InvitePromoteService;
|
||||
import com.yzdx.AiInterviewer.service.JobListService;
|
||||
import com.yzdx.AiInterviewer.utiles.TimeUtil;
|
||||
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;
|
||||
|
||||
@Service
|
||||
public class InvitePromoteServiceImpl extends ServiceImpl<InvitePromoteMapper, InvitePromote> implements InvitePromoteService {
|
||||
|
||||
@Autowired
|
||||
private InvitePromoteMapper invitePromoteMapper;
|
||||
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
@Autowired
|
||||
private JobListService jobListService;
|
||||
@Autowired
|
||||
private JobPostingMapper jobPostingMapper;
|
||||
@Autowired
|
||||
private QuestionMapper questionMapper;
|
||||
@Autowired
|
||||
private QuestionBankMapper questionBankMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Integer addInvitePromote(String encoding, Integer postId, String startTime,
|
||||
String endTime, String question, String promote,
|
||||
Integer inviteUser,Integer userId,Integer jobId) {
|
||||
|
||||
|
||||
LambdaQueryWrapper<InvitePromote> queryWrapper=new LambdaQueryWrapper<>();
|
||||
|
||||
queryWrapper.eq(InvitePromote::getJobId,jobId).eq(InvitePromote::getPostId,postId)
|
||||
.eq(InvitePromote::getEncoding,encoding).eq(InvitePromote::getInviteUser,inviteUser);
|
||||
|
||||
InvitePromote invitePromote = invitePromoteMapper.selectOne(queryWrapper);
|
||||
|
||||
if(invitePromote!=null){
|
||||
return -1;
|
||||
}
|
||||
|
||||
InvitePromote addInvitePromote=new InvitePromote();
|
||||
|
||||
addInvitePromote.setEncoding(encoding);
|
||||
|
||||
addInvitePromote.setPostId(postId);
|
||||
|
||||
addInvitePromote.setStartTime(startTime);
|
||||
|
||||
addInvitePromote.setEndTime(endTime);
|
||||
|
||||
addInvitePromote.setQuestion(question);
|
||||
|
||||
addInvitePromote.setPromote(promote);
|
||||
|
||||
addInvitePromote.setInviteUser(inviteUser);
|
||||
|
||||
addInvitePromote.setCreateUser(userId);
|
||||
|
||||
addInvitePromote.setUpdateUser(userId);
|
||||
|
||||
addInvitePromote.setCreateTime(TimeUtil.getTime());
|
||||
|
||||
addInvitePromote.setUpdateTime(TimeUtil.getTime());
|
||||
|
||||
addInvitePromote.setJobId(jobId);
|
||||
|
||||
Integer rows = invitePromoteMapper.insert(addInvitePromote);
|
||||
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InvitePromoteDto getInvitePromote(Integer id) {
|
||||
LambdaQueryWrapper<InvitePromote> queryWrapper=new LambdaQueryWrapper<>();
|
||||
|
||||
queryWrapper.eq(InvitePromote::getId,id);
|
||||
|
||||
InvitePromote invitePromote = invitePromoteMapper.selectOne(queryWrapper);
|
||||
|
||||
InvitePromoteDto invitePromoteDto=new InvitePromoteDto();
|
||||
|
||||
BeanUtils.copyProperties(invitePromote,invitePromoteDto);
|
||||
|
||||
//获取公司详情
|
||||
Company companyDetail = companyService.getCompanyDetail(invitePromoteDto.getEncoding());
|
||||
|
||||
invitePromoteDto.setCompany(companyDetail);
|
||||
|
||||
//获取岗位详情
|
||||
JobEntity jobById = jobListService.getJobById(invitePromoteDto.getJobId());
|
||||
|
||||
invitePromoteDto.setJob(jobById);
|
||||
|
||||
//获取招聘信息
|
||||
JobPosting jobPosting = jobPostingMapper.selectById(invitePromoteDto.getPostId());
|
||||
|
||||
invitePromoteDto.setJobPost(jobPosting);
|
||||
|
||||
//获取题目详情
|
||||
JSONArray questionJSONArray=JSONArray.parseArray(invitePromoteDto.getQuestion());
|
||||
|
||||
List<Map<String,Object>> questions=new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < questionJSONArray.size(); i++) {
|
||||
|
||||
Map<String,Object> getQuestion=new HashMap<>();
|
||||
|
||||
Integer getQuestionId=(Integer)questionJSONArray.get(i);
|
||||
|
||||
Question question = questionMapper.selectById(getQuestionId);
|
||||
|
||||
QuestionBank questionBank = questionBankMapper.selectById(question.getBankId());
|
||||
|
||||
getQuestion.put("questionBankName",questionBank.getTypeName());
|
||||
|
||||
getQuestion.put("QuestionDetail",question);
|
||||
|
||||
questions.add(getQuestion);
|
||||
|
||||
}
|
||||
|
||||
invitePromoteDto.setQuestions(questions);
|
||||
|
||||
return invitePromoteDto;
|
||||
|
||||
}
|
||||
}
|
|
@ -335,8 +335,9 @@ public class JobListServiceImpl extends ServiceImpl<JobMapper, JobEntity> implem
|
|||
public List<Map<String,Object>> getSuggestJob(Integer userId) {
|
||||
List<Map<String,Object>> result=new ArrayList<>();
|
||||
//先获取用户的岗位期望
|
||||
Resume resume = resumeService.getResume(userId);
|
||||
Map<String,Object> resultResume = resumeService.getResume(userId);
|
||||
|
||||
Resume resume=(Resume) resultResume.get("resume");
|
||||
String jobExpectation = resume.getJobExpectation();
|
||||
|
||||
JSONArray jobExpectationJSONs = (JSONArray) JSON.parse(jobExpectation);
|
||||
|
|
|
@ -199,7 +199,7 @@ public class ResumeServiceImpl extends ServiceImpl<ResumeMapper, Resume> impleme
|
|||
result.put("gender",sex);
|
||||
result.put("school",school);
|
||||
result.put("major",major);
|
||||
result.put("phone",phone);
|
||||
result.put("phone",phone);
|
||||
|
||||
|
||||
return result;
|
||||
|
@ -379,13 +379,12 @@ public class ResumeServiceImpl extends ServiceImpl<ResumeMapper, Resume> impleme
|
|||
result.put("school",school);
|
||||
result.put("major",major);
|
||||
result.put("phone",phone);
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resume getResume(Integer userId) {
|
||||
public Map<String,Object> getResume(Integer userId) {
|
||||
|
||||
|
||||
LambdaQueryWrapper<Resume> queryWrapper=new LambdaQueryWrapper<>();
|
||||
|
||||
|
@ -393,6 +392,100 @@ public class ResumeServiceImpl extends ServiceImpl<ResumeMapper, Resume> impleme
|
|||
|
||||
Resume resume = resumeMapper.selectOne(queryWrapper);
|
||||
|
||||
return resume;
|
||||
//解析在校经历,计算出学历
|
||||
|
||||
JSONArray educationJSONArray= JSON.parseArray(resume.getEducationBackground());
|
||||
|
||||
long difference =0;
|
||||
|
||||
String eduBack="";
|
||||
|
||||
String school="";
|
||||
|
||||
String major="";
|
||||
for (int i = 0; i < educationJSONArray.size(); i++) {
|
||||
|
||||
Map<String,Object> educationMap= (Map<String,Object>)educationJSONArray.get(i);
|
||||
|
||||
String lastEndTime= (String)educationMap.get("endTime");
|
||||
|
||||
// 将字符串转换为日期对象
|
||||
Date date = new Date(Integer.valueOf(lastEndTime) - 1900, 0, 1); // 注意:年份需减去1900
|
||||
|
||||
// 获取日期对象的时间戳(毫秒数)
|
||||
|
||||
long timestamp = date.getTime();
|
||||
|
||||
// 获取当前时间的时间戳
|
||||
long currentTimestamp = System.currentTimeMillis();
|
||||
|
||||
// 计算时间戳差值
|
||||
long differenceTime = currentTimestamp - timestamp;
|
||||
|
||||
//初始化值
|
||||
if(i==0){
|
||||
difference=differenceTime;
|
||||
eduBack=(String)educationMap.get("eduDegree");
|
||||
school=(String)educationMap.get("school");
|
||||
major=(String)educationMap.get("major");
|
||||
|
||||
continue;
|
||||
}
|
||||
//判断最近的毕业年份
|
||||
if(differenceTime<difference){
|
||||
difference=differenceTime;
|
||||
eduBack=(String)educationMap.get("eduDegree");
|
||||
school=(String)educationMap.get("school");
|
||||
major=(String)educationMap.get("major");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
resume.setEducation(eduBack);
|
||||
|
||||
Integer rows= resumeMapper.updateById(resume);
|
||||
|
||||
Map<String,Object> result=new HashMap<>();
|
||||
|
||||
if(rows!=1){
|
||||
return null;
|
||||
}
|
||||
int experience=0;
|
||||
//计算工作时间
|
||||
JSONArray jobJSONArray=JSON.parseArray(resume.getWorkExperience());
|
||||
|
||||
if(jobJSONArray.size()==0) {
|
||||
//放入工作时间
|
||||
result.put("experience", experience);
|
||||
}else{
|
||||
for (int i = 0; i < jobJSONArray.size(); i++) {
|
||||
|
||||
Map<String,Object> jobJSON=(Map<String, Object>) jobJSONArray.get(i);
|
||||
|
||||
// 将字符串日期转换为LocalDate对象
|
||||
LocalDate startDate = LocalDate.parse(jobJSON.get("startTime")+ "-01");
|
||||
LocalDate endDate = LocalDate.parse(jobJSON.get("endTime") + "-01");
|
||||
|
||||
// 计算年份差异
|
||||
Period period = Period.between(startDate, endDate);
|
||||
int yearDifference = period.getYears();
|
||||
experience+=yearDifference;
|
||||
}
|
||||
//放入工作时间
|
||||
result.put("experience", experience);
|
||||
}
|
||||
result.put("userName",resume.getName());
|
||||
result.put("userImgUrl",resume.getAvatar());
|
||||
result.put("eduBack",eduBack);
|
||||
result.put("gender",resume.getSex());
|
||||
result.put("school",school);
|
||||
result.put("major",major);
|
||||
result.put("phone",resume.getPhone());
|
||||
result.put("resume",resume);
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue