邀请面试完善

This commit is contained in:
Unique-Jerry 2023-12-15 01:01:54 +08:00
parent 96d26bbd67
commit 966a5ef1fc
48 changed files with 1497 additions and 225 deletions

View File

@ -9,6 +9,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
@ -44,10 +45,16 @@ public class UserInterceptor implements HandlerInterceptor {
map.put("code", 401);
JSONObject json = new JSONObject(map);
response.setContentType("application/json;charset=UTF-8");
PrintWriter writer = response.getWriter();
writer.print(json);
writer.flush();
writer.close();
PrintWriter writer = null;
try {
writer = response.getWriter();
writer.print(json);
writer.flush();
} catch (IOException e) {
e.printStackTrace();
}finally {
writer.close();
}
return false;
}
}

View File

@ -20,7 +20,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
.addPathPatterns("/**")
// 需要放行的请求
.excludePathPatterns("/admin/login")
.excludePathPatterns("/vxUser/decodeUserInfo")
.excludePathPatterns("/vxUser/decodeUserInfo","/vx_interview/getCarouselChart","/vxJob/getSuggestList","/download_file")
.excludePathPatterns("/vxUser/WxLogin")
// 添加swagger-ui的放行路径
.excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**","/doc.html/**")

View File

@ -5,9 +5,11 @@ 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.InterviewRecordDto;
import com.yzdx.AiInterviewer.entity.dto.InvitePromoteDto;
import com.yzdx.AiInterviewer.mapper.InvitePromoteMapper;
import com.yzdx.AiInterviewer.service.*;
import com.yzdx.AiInterviewer.service.VxService.VxInterviewRecordService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@ -15,6 +17,9 @@ import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
@ -33,6 +38,10 @@ public class InterviewController {
private InvitePromoteService invitePromoteService;
@Autowired
private InterviewNoticeService interviewNoticeService;
@Autowired
private VxInterviewRecordService vxInterviewRecordService;
@Autowired
private JobPostingService jobPostingService;
/**
* 获取公司logo
@ -253,14 +262,24 @@ public class InterviewController {
@PostMapping("/sendInterviewNotice")
public R sendInterviewNotice(@RequestBody Map<String,Object> addInfo){
String encoding=(String) addInfo.get("encoding");
Integer recipient=(Integer) addInfo.get("recipient");
Integer recipient=(Integer) addInfo.get("inviteUser");
Integer jobId=(Integer) addInfo.get("jobId");
Integer postId=(Integer) addInfo.get("postId");
Integer inviteId=(Integer) addInfo.get("inviteId");
Integer userId=(Integer) addInfo.get("userId");
String promote=(String) addInfo.get("promote");
String selectQuestions=(String) addInfo.get("selectQuestions");
Integer applicationId=(Integer)addInfo.get("applicationId");
String endTime=(String)addInfo.get("endTime");
// 解析原始字符串为 LocalDateTime 对象
LocalDateTime dateTime = LocalDateTime.parse(endTime, DateTimeFormatter.ISO_DATE_TIME);
// 格式化 LocalDateTime 对象为所需的日期格式
String dateString = dateTime.format(DateTimeFormatter.ISO_DATE);
Integer rows = interviewNoticeService.addInterviewNotice(encoding,recipient,
jobId, postId, inviteId, userId);
jobId, postId,userId,promote,selectQuestions,applicationId,dateString);
if(rows==-2){
return R.error("您已经邀请过他面试啦");
}
@ -270,6 +289,48 @@ public class InterviewController {
return R.success("邀请成功");
}
@GetMapping("/getInterviewRecordList")
public R getInterviewRecordList(Integer postId,Integer jobId,String encoding,Integer status){
List<InterviewRecordDto> interviewRecordDtoList=vxInterviewRecordService.getInterviewRecords(postId,jobId,encoding,status);
return R.success(interviewRecordDtoList);
}
@GetMapping("/getPostingInfoList")
public R getPostingInfoList(String encoding){
List<Map<String,Object>> postingIfoList=jobPostingService.getPostingInfoList(encoding);
if(postingIfoList==null){
return R.error("暂未找到招聘岗位信息");
}
return R.success(postingIfoList);
}
@PostMapping("/agreeUsersPassInterview")
public R agreeUsersPassInterview(@RequestBody Map<String,Object> updateInfo){
Integer jobId=(Integer)updateInfo.get("jobId");
Integer postId=(Integer)updateInfo.get("postId");
String userList=(String)updateInfo.get("userList");
Integer userId=(Integer)updateInfo.get("userId");
Integer rows= vxInterviewRecordService.agreeUsersPassInterview(jobId,postId,userList,userId);
return R.success("通过成功");
}
}

View File

@ -226,11 +226,11 @@ public class QuestionController {
String title=(String) addInfo.get("title");
Integer bankId=(Integer) addInfo.get("bankId");
String details=(String) addInfo.get("details");
String promote=(String) addInfo.get("promote");
String answer=(String) addInfo.get("answer");
String encoding=(String) addInfo.get("encoding");
Integer userId=(Integer) addInfo.get("userId");
Integer rows = questionService.addQuestion(title, bankId, details, promote, encoding, userId);
Integer rows = questionService.addQuestion(title, bankId, details, answer, encoding, userId);
if(rows==0){
return R.error("添加失败,请检查输入!");
@ -260,11 +260,11 @@ public class QuestionController {
String title=(String) updateInfo.get("title");
Integer bankId=(Integer) updateInfo.get("bankId");
String details=(String) updateInfo.get("details");
String promote=(String) updateInfo.get("promote");
String answer=(String) updateInfo.get("answer");
String encoding=(String) updateInfo.get("encoding");
Integer userId=(Integer) updateInfo.get("userId");
Integer id=(Integer) updateInfo.get("id");
Integer rows = questionService.updateQuestion(id,title, bankId, details, promote, encoding, userId);
Integer rows = questionService.updateQuestion(id,title, bankId, details, answer, encoding, userId);
if(rows==0){
return R.error("修改失败,请检查输入!");
@ -489,7 +489,7 @@ public class QuestionController {
@ApiImplicitParam(name = "id",required = true),
@ApiImplicitParam(name = "title",required = true),
@ApiImplicitParam(name = "details",required = true),
@ApiImplicitParam(name = "promote",required = true),
@ApiImplicitParam(name = "answer",required = true),
@ApiImplicitParam(name = "bankId",required = true),
@ApiImplicitParam(name = "userId",required = true),
})
@ -497,12 +497,12 @@ public class QuestionController {
@ApiOperation(value = "更新我的分享题目",notes = "")
public R updateOurSharedQuestion(@RequestBody Map<String,Object> updateInfo){
Integer userId=(Integer)updateInfo.get("userId");
String promote=(String) updateInfo.get("promote");
String answer=(String) updateInfo.get("answer");
Integer bankId=(Integer) updateInfo.get("bankId");
Integer id=(Integer) updateInfo.get("id");
String details=(String) updateInfo.get("details");
String title=(String) updateInfo.get("title");
Integer rows=sharedQuestionService.updateOurSharedQuestion(id, title, details , promote, bankId , userId);
Integer rows=sharedQuestionService.updateOurSharedQuestion(id, title, details , answer, bankId , userId);
if(rows==1){
return R.success("修改成功");

View File

@ -4,6 +4,7 @@ import com.yzdx.AiInterviewer.comment.R;
import com.yzdx.AiInterviewer.entity.Company;
import com.yzdx.AiInterviewer.entity.JobEntity;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxCompanyDetailDto;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxInterviewApplicationDto;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxJobDetailDto;
import com.yzdx.AiInterviewer.entity.dto.JobDto;
import com.yzdx.AiInterviewer.entity.dto.JobPostingDto;
@ -226,13 +227,21 @@ public class RecruitmentController {
Integer imagesId=(Integer) addInfo.get("imagesId");
Integer backgroundId=(Integer) addInfo.get("backgroundId");
Integer logoId=(Integer) addInfo.get("logoId");
Integer userId=(Integer) addInfo.get("userId");
Integer Professional=(Integer) addInfo.get("Professional");
Integer Comprehensive=(Integer) addInfo.get("Comprehensive");
Integer Psychology=(Integer) addInfo.get("Psychology");
String jobPromote=(String) addInfo.get("jobPromote");
if(Professional==0){
Professional=null;
}
if(Comprehensive==0){
Comprehensive=null;
}
if(Psychology==0){
Psychology=null;
}
Integer rows = interviewSettingService.addJobSetting(jobId, imagesId, backgroundId, logoId, Professional, Comprehensive,
Psychology, userId, jobPromote, encoding);
@ -248,7 +257,14 @@ public class RecruitmentController {
List<JobSettingDto> jobSettingList = interviewSettingService.getJobSettingList(encoding);
return R.success(jobSettingList);
}
@GetMapping("/get_jobSettingByJobId")
@ApiOperation(value = "根据jobid获取面试设置",notes = "")
public R getJobSettingByJobId(@ApiParam("Integer jobId") Integer jobId){
Map<String,Object> result = interviewSettingService.getJobSettingByJobId(jobId);
return R.success(result);
}
@GetMapping("/search_setting")
@ApiOperation(value = "搜索面试设置",notes = "")
public R searchJobSettings(@ApiParam("String jobName,String encoding")String jobName,String encoding){
@ -292,11 +308,19 @@ public class RecruitmentController {
Integer logoId=(Integer) updateInfo.get("logoId");
Integer id=(Integer)updateInfo.get("id");
Integer userId=(Integer) updateInfo.get("userId");
Integer Professional=(Integer) updateInfo.get("Professional");
Integer Comprehensive=(Integer) updateInfo.get("Comprehensive");
Integer Psychology=(Integer) updateInfo.get("Psychology");
Integer Professional=(Integer) updateInfo.get("professional");
Integer Comprehensive=(Integer) updateInfo.get("comprehensive");
Integer Psychology=(Integer) updateInfo.get("psychology");
String jobPromote=(String) updateInfo.get("jobPromote");
if(Professional==0){
Professional=null;
}
if(Comprehensive==0){
Comprehensive=null;
}
if(Psychology==0){
Psychology=null;
}
Integer rows= interviewSettingService.updateJobSetting(id,jobId, imagesId, backgroundId, logoId,
Professional, Comprehensive, Psychology, userId, jobPromote, encoding);
@ -316,7 +340,7 @@ public class RecruitmentController {
return R.error("获取失败");
}
VxCompanyDetailDto companyDetail = companyService.getCompanyDetail(encoding);
Company companyDetail = companyService.getCompanyDetail(encoding);
if(companyDetail==null){
return R.error("获取失败");
}
@ -435,13 +459,33 @@ public class RecruitmentController {
/**
* 获取简历申请列表
* @param companyEncoding
* @param encoding
* @param jobId
* @return
*/
@GetMapping("/getApplicationList")
public R getApplicationList(String companyEncoding,Integer jobId){
List<VxInterviewApplication> list=vxInterviewApplicationService.getApplicationList(companyEncoding,jobId);
public R getApplicationList(String encoding,Integer jobId){
List<VxInterviewApplicationDto> list=vxInterviewApplicationService.getApplicationList(encoding,jobId);
return R.success(list);
}
@GetMapping("/searchApplicationByName")
public R searchApplicationByName(String searchName,String encoding){
List<VxInterviewApplicationDto> list =vxInterviewApplicationService.searchApplicationByName(searchName,encoding);
return R.success(list);
}
@GetMapping("/disagreeApplication")
public R disagreeApplication(Integer id){
Integer rows=vxInterviewApplicationService.disagreeApplication(id);
if(rows!=1){
return R.error("出错了,请联系管理员");
}
return R.success("已拒绝");
}
}

View File

@ -2,16 +2,19 @@ package com.yzdx.AiInterviewer.controller;
import com.yzdx.AiInterviewer.comment.R;
import com.yzdx.AiInterviewer.utiles.FileDownloadUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.util.*;
@ -20,10 +23,11 @@ import java.util.*;
@Slf4j
public class UploadController {
//设置上传文件的最大大小
public static final int MAX_SIZE=10*1024*1024;
public static final int MAX_SIZE = 10 * 1024 * 1024;
//设置文件的类型
public static final List<String> AVATAR_TYPE=new ArrayList<>();
public static final List<String> AVATAR_TYPE = new ArrayList<>();
static {
AVATAR_TYPE.add("image/png");
@ -33,34 +37,37 @@ public class UploadController {
AVATAR_TYPE.add("image/jpeg");
}
//http://aiinterviewersystem.kooldns.cn
private static final String BASE_URL="http://117.88.94.226:5380";
// http://117.88.94.226:5380
//http://101.43.255.47/8080
private static final String BASE_URL = "http://117.88.94.226:5380";
/**
* 上传图片
*
* @param request
*/
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(name = "file",required = true),
@ApiImplicitParam(name = "file", required = true),
})
@PostMapping("/upload_picture")
@ApiOperation(value = "上传图片",notes = "")
@ApiOperation(value = "上传图片", notes = "")
public R upLoadPicture(HttpServletRequest request, @RequestParam("file") MultipartFile file){
public R upLoadPicture(HttpServletRequest request, @RequestParam("file") MultipartFile file) {
//MultipartFile是spring提供的类可以接收所有的文件的类
log.info(file.getContentType());
if(file.isEmpty()){
if (file.isEmpty()) {
return R.error("请选择文件");
}
if (file.getSize() >MAX_SIZE){//file.getSize()获取接收文件的大小
if (file.getSize() > MAX_SIZE) {//file.getSize()获取接收文件的大小
return R.error("文件大小超出最大限制");
}
if(!AVATAR_TYPE.contains(file.getContentType())){//自定义接收文件的类型
if (!AVATAR_TYPE.contains(file.getContentType())) {//自定义接收文件的类型
return R.error("文件类型不匹配");
}
@ -71,9 +78,9 @@ public class UploadController {
//指向名为upload文件夹
File dir= new File(uploadPath);
File dir = new File(uploadPath);
if(!dir.exists()){
if (!dir.exists()) {
dir.mkdirs();//若不存在则创建该文件夹
}
@ -83,9 +90,9 @@ public class UploadController {
String substring = originalFilename.substring(index);//返回文件类型名 例如.jpg
String filename = UUID.randomUUID().toString().toUpperCase()+substring;//新创建的文件名
String filename = UUID.randomUUID().toString().toUpperCase() + substring;//新创建的文件名
File dest=new File(dir,filename);//创建一个空的文件
File dest = new File(dir, filename);//创建一个空的文件
try {
@ -96,34 +103,35 @@ public class UploadController {
return R.error("文件存储出现异常");
}
String RealFilePath=BASE_URL+"/upload/picture/"+filename;
Map<String,Object> data=new HashMap<>();
data.put("image",RealFilePath);
data.put("filename",filename);
String RealFilePath = BASE_URL + "/upload/picture/" + filename;
Map<String, Object> data = new HashMap<>();
data.put("image", RealFilePath);
data.put("filename", filename);
return R.success(data);//返回图片存储在服务器的地址
}
/**
* 上传视频
*
* @param request
* @param file
* @return R
*/
@PostMapping("/upload_video")
@ApiOperation(value = "上传视频",notes = "")
@ApiOperation(value = "上传视频", notes = "")
public R upLoadVideo(HttpServletRequest request, @RequestParam("file") MultipartFile file ){
public R upLoadVideo(HttpServletRequest request, @RequestParam("file") MultipartFile file) {
//MultipartFile是spring提供的类可以接收所有的文件的类
log.info(file.getContentType());
if(file.isEmpty()){
if (file.isEmpty()) {
return R.error("请选择文件");
}
if (file.getSize() >MAX_SIZE){//file.getSize()获取接收文件的大小
if (file.getSize() > MAX_SIZE) {//file.getSize()获取接收文件的大小
return R.error("文件大小超出最大限制");
}
@ -131,9 +139,9 @@ public class UploadController {
String uploadPath = request.getSession().getServletContext().getRealPath("/upload/video/");//获取上传文件的路径获取项目中名为upload的文件夹
File dir= new File(uploadPath);//指向名为upload文件夹
File dir = new File(uploadPath);//指向名为upload文件夹
if(!dir.exists()){
if (!dir.exists()) {
dir.mkdirs();//若不存在则创建该文件夹
}
@ -143,9 +151,9 @@ public class UploadController {
String substring = originalFilename.substring(index);//返回文件类型名 例如.jpg
String filename = UUID.randomUUID().toString().toUpperCase()+substring;//新创建的文件名
String filename = UUID.randomUUID().toString().toUpperCase() + substring;//新创建的文件名
File dest=new File(dir,filename);//创建一个空的文件
File dest = new File(dir, filename);//创建一个空的文件
try {
@ -157,32 +165,33 @@ public class UploadController {
}
String RealFilePath=BASE_URL+"/upload/video/"+filename;
Map<String,Object> data=new HashMap<>();
data.put("video",RealFilePath);
data.put("filename",filename);
String RealFilePath = BASE_URL + "/upload/video/" + filename;
Map<String, Object> data = new HashMap<>();
data.put("video", RealFilePath);
data.put("filename", filename);
return R.success(data);//返回图片存储在服务器的地址
}
/**
* 删除照片
*
* @param request
* @param imagePath
* @return R
*/
@DeleteMapping("/delete_picture")
@ApiOperation(value = "删除图片",notes = "")
@ApiOperation(value = "删除图片", notes = "")
public R deletePicture(@ApiParam("String imagePath") HttpServletRequest request, String imagePath){
if(imagePath==null||imagePath.equals("")){
public R deletePicture(@ApiParam("String imagePath") HttpServletRequest request, String imagePath) {
if (imagePath == null || imagePath.equals("")) {
return R.error("删除失败!");
}
String uploadPath = request.getSession().getServletContext().getRealPath("/upload/picture/");
try {
File folder = new File(uploadPath);
File[] files = folder.listFiles();
for(File file:files){
if(file.getName().equals(imagePath)){
for (File file : files) {
if (file.getName().equals(imagePath)) {
file.delete();
}
}
@ -196,23 +205,24 @@ public class UploadController {
/**
* 删除视频
*
* @param request
* @param videoPath
* @return R
*/
@DeleteMapping("/delete_video")
@ApiOperation(value = "删除图片",notes = "")
@ApiOperation(value = "删除图片", notes = "")
public R deleteVideo(@ApiParam("String videoPath") HttpServletRequest request,String videoPath){
if(videoPath==null||videoPath.equals("")){
public R deleteVideo(@ApiParam("String videoPath") HttpServletRequest request, String videoPath) {
if (videoPath == null || videoPath.equals("")) {
return R.error("删除失败!");
}
String uploadPath = request.getSession().getServletContext().getRealPath("/upload/video/");
try {
File folder = new File(uploadPath);
File[] files = folder.listFiles();
for(File file:files){
if(file.getName().equals(videoPath)){
for (File file : files) {
if (file.getName().equals(videoPath)) {
file.delete();
}
}
@ -226,28 +236,29 @@ public class UploadController {
/**
* 上传简历
*
* @param request
* @param file
* @return R
*/
@ResponseBody
@PostMapping("/upload_resume")
@ApiOperation(value = "上传简历",notes = "")
public R uploadResume(HttpServletRequest request, @RequestParam("file") MultipartFile file){
if(file.isEmpty()){
@PostMapping("/upload_resume")
@ApiOperation(value = "上传简历", notes = "")
public R uploadResume(HttpServletRequest request, @RequestParam("file") MultipartFile file) {
if (file.isEmpty()) {
return R.error("请选择文件");
}
if (file.getSize() >50*1024*1024){//file.getSize()获取接收文件的大小
if (file.getSize() > 50 * 1024 * 1024) {//file.getSize()获取接收文件的大小
return R.error("文件大小超出最大限制");
}
String uploadPath = request.getSession().getServletContext().getRealPath("/upload/resume/");
File dir= new File(uploadPath);
File dir = new File(uploadPath);
if(!dir.exists()){
if (!dir.exists()) {
dir.mkdirs();//若不存在则创建该文件夹
}
@ -257,9 +268,9 @@ public class UploadController {
String substring = originalFilename.substring(index);//返回文件类型名 例如.jpg
String fileName = UUID.randomUUID().toString().toUpperCase()+substring;//新创建的文件名
String fileName = UUID.randomUUID().toString().toUpperCase() + substring;//新创建的文件名
File dest=new File(dir,fileName);//创建一个空的文件
File dest = new File(dir, fileName);//创建一个空的文件
try {
@ -270,7 +281,7 @@ public class UploadController {
return R.error("文件存储出现异常");
}
String RealFilePath=BASE_URL+"/upload/resume/"+fileName;
String RealFilePath = BASE_URL + "/upload/resume/" + fileName;
// ExecutorService pool= Executors.newCachedThreadPool();
// pool.submit(new Runnable() {
// @Override
@ -280,27 +291,26 @@ public class UploadController {
// }
// });
Map<String,Object> data=new HashMap<>();
data.put("resume",RealFilePath);
data.put("filename",fileName);
Map<String, Object> data = new HashMap<>();
data.put("resume", RealFilePath);
data.put("filename", fileName);
return R.success(data);//返回图片存储在服务器的地址
}
/**
* 删除简历
*
* @param request
* @param resumePath
* @return R
*/
@DeleteMapping("/delete_resume")
@ApiOperation(value = "删除简历",notes = "")
@ApiOperation(value = "删除简历", notes = "")
public R deleteResume(@ApiParam("String resumePath") HttpServletRequest request,String resumePath){
if(resumePath==null||resumePath.equals("")){
public R deleteResume(@ApiParam("String resumePath") HttpServletRequest request, String resumePath) {
if (resumePath == null || resumePath.equals("")) {
return R.error("删除失败!");
}
String uploadPath = request.getSession().getServletContext().getRealPath("/upload/resume/");
@ -308,8 +318,8 @@ public class UploadController {
try {
File folder = new File(uploadPath);
File[] files = folder.listFiles();
for(File file:files){
if(file.getName().equals(resumePath)){
for (File file : files) {
if (file.getName().equals(resumePath)) {
file.delete();
}
}
@ -318,7 +328,121 @@ public class UploadController {
return R.error("删除失败");
}
}
@PostMapping("/upload_file")
@ApiOperation(value = "上传文件", notes = "")
public R uploadFile(HttpServletRequest request, @RequestParam("file") MultipartFile file) {
if (file.isEmpty()) {
return R.error("请选择文件");
}
if (file.getSize() > 50 * 1024 * 1024) {//file.getSize()获取接收文件的大小
return R.error("文件大小超出最大限制");
}
String uploadPath = request.getSession().getServletContext().getRealPath("/upload/files/");
File dir = new File(uploadPath);
if (!dir.exists()) {
dir.mkdirs();//若不存在则创建该文件夹
}
String originalFilename = file.getOriginalFilename();//获取文件的真实文件名
int index = originalFilename.lastIndexOf(".");//获取文件的后缀名.的位置
String substring = originalFilename.substring(index);//返回文件类型名 例如.jpg
String fileName = UUID.randomUUID().toString().toUpperCase() + substring;//新创建的文件名
File dest = new File(dir, fileName);//创建一个空的文件
try {
file.transferTo(dest);
} catch (IOException e) {
return R.error("文件存储出现异常");
}
String RealFilePath = BASE_URL + "/upload/files/" + fileName;
Map<String, Object> data = new HashMap<>();
data.put("resume", RealFilePath);
data.put("filename", fileName);
return R.success(data);//返回文件存储在服务器的地址
}
@GetMapping("/download_file")
@ApiOperation(value = "下载文件", notes = "")
public R downLoadFile(HttpServletRequest request, String downloadFilename, HttpServletResponse response) {
String filePath = request.getSession().getServletContext().getRealPath("/upload/files/");
String filePathName = filePath + File.separator + downloadFilename;
BufferedInputStream bins = null;
BufferedOutputStream bouts = null;
try {
//同一个窗口下载多次清除空白流
response.reset();
File file = new File(filePathName);
if (!file.exists()) {
log.error("要下载的文件不存在:{}", filePathName);
return R.error("要下载的文件不存在:"+filePathName );
}
bins = new BufferedInputStream(new FileInputStream(filePathName));
bouts = new BufferedOutputStream(response.getOutputStream());
String userAgent = request.getHeader("USER-AGENT").toLowerCase();
// 如果是火狐浏览器
if (userAgent.contains("firefox")) {
downloadFilename = new String(downloadFilename.getBytes(), "ISO8859-1");
} else {
downloadFilename = URLEncoder.encode(downloadFilename, "UTF-8");
}
//设置发送到客户端的响应的内容类型
response.setContentType("application/download");
//指定客户端下载的文件的名称
response.setHeader("Content-disposition", "attachment;filename=" + downloadFilename);
int len;
byte[] bytes = new byte[1024];
while ((len = bins.read(bytes)) != -1) {
bouts.write(bytes, 0, len);
}
//刷新流
bouts.flush();
log.info("下载完成");
} catch (IOException e) {
log.error("下载文件异常:{}", e.getMessage());
e.printStackTrace();
return R.error(e.getMessage());
} finally {
try {
if (bouts != null) {
bouts.close();
}
if (bins != null) {
bins.close();
}
} catch (IOException e) {
log.error("关闭流异常", e);
e.printStackTrace();
return R.error("关闭流异常");
}
}
return R.success("下载完成");
}
}
//-------------------------------------vxUpLoad-----------------------

View File

@ -149,8 +149,11 @@ public class UserController {
return R.error("添加人的账号存在,请检查输入!");
}
if(rows==0){
if(rows==-3){
return R.error("您没有权限!");
}
if(rows==0){
return R.error("添加失败,请联系管理员!");
}
return R.success("添加管理员成功!");
@ -261,4 +264,21 @@ public class UserController {
return R.success(user);
}
}
@PostMapping("/adminEditPassword")
public R adminEditPassword(@RequestBody Map<String,Object> updateInfo){
Integer userId= (Integer)updateInfo.get("userId");
Integer updateUserId= (Integer)updateInfo.get("updateUserId");
String password= (String)updateInfo.get("password");
Integer rows=userService.adminEditPassword(userId,updateUserId,password);
if(rows==-2){
return R.error("权限不足,请联系系统管理员进行修改");
}
if(rows==-3){
return R.error("权限不足,请联系公司管理员");
}
return R.success("修改成功");
}
}

View File

@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/vx_interview")
@ -59,5 +60,42 @@ public class VxInterviewController {
List<VxInterviewRecordDto> list=vxInterviewRecordService.searchInterviewRecordList(searchCompany,userId);
return R.success(list);
}
@PostMapping("/addInterviewRecord")
public R addInterviewRecord(@RequestBody Map<String,Object> addInfo){
String encoding=(String)addInfo.get("encoding");
String comments=(String) addInfo.get("comments");
Integer interviewer=(Integer) addInfo.get("interviewer");
Integer noticeId=(Integer) addInfo.get("noticeId");
Integer talentId=(Integer) addInfo.get("talentId") ;
String detail=(String) addInfo.get("detail");
Integer rows=vxInterviewRecordService.addInterviewRecord(encoding,comments,interviewer,noticeId,talentId,detail);
if(rows!=1){
return R.error("出错啦");
}
return R.success("面试成功");
}
@GetMapping("/getInterviewPromote")
public R getInterviewPromote(Integer noticeId){
String interviewPromote=interviewNoticeService.getInterviewPromote(noticeId);
if(interviewPromote==null){
return R.error("获取失败");
}
return R.success(interviewPromote);
}
}

View File

@ -193,6 +193,10 @@ public R getResume(Integer userId){
Map<String,Object> result= resumeService.getResume(userId);
if(result==null){
return R.error("未填写简历,请先填写简历");
}
return R.success(result);
}

View File

@ -26,12 +26,6 @@ public class InterviewSetting extends BaseEntity {
private Integer professional;
@ApiModelProperty("综合面试题库")
private Integer comprehensive;
@ApiModelProperty("公司介绍promote")
private String companyPromote;
@ApiModelProperty("系统promote")
private String SystemPromote;
@ApiModelProperty("面试题目")
private String questions;
@ApiModelProperty("心理测试题库")
private Integer psychology;
@ApiModelProperty("岗位promote")

View File

@ -18,8 +18,8 @@ public class Question extends BaseEntity {
private String title;
@ApiModelProperty("题目详情")
private String details;
@ApiModelProperty("题目对应的promote")
private String promote;
@ApiModelProperty("题目的预设答案")
private String answer;
@ApiModelProperty("题库id")
private Integer bankId;
@ApiModelProperty("公司编码")

View File

@ -19,7 +19,7 @@ public class SharedQuestion extends BaseEntity {
@ApiModelProperty("题目详情")
private String details;
@ApiModelProperty("题目对应的promote")
private String promote;
private String answer;
@ApiModelProperty("题库id")
private Integer bankId;
@ApiModelProperty("创建公司编码")

View File

@ -0,0 +1,24 @@
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("tanlent_profile")
public class Talent extends BaseEntity{
@TableId(type = IdType.AUTO)
private Integer id;
private Double execution;
private Double internalDrive;
private Double pressureResistance;
private String matchRate;
}

View File

@ -0,0 +1,19 @@
package com.yzdx.AiInterviewer.entity.VxEntityDto;
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewApplication;
import lombok.Data;
import java.util.Map;
@Data
public class VxInterviewApplicationDto extends VxInterviewApplication {
private String userName;
private Map<String,Object> resume;
private String jobName;
private String createTime;
}

View File

@ -15,5 +15,8 @@ public class VxInterviewRecordDto extends VxInterviewRecord {
private String interviewTime;
@ApiModelProperty("岗位")
private String job;
@ApiModelProperty("面试结束时间")
private String interviewEndTime;
}

View File

@ -18,4 +18,6 @@ public class VxNoticeDto extends VxInterviewNotice {
private String job;
private String interviewEndTime;
}

View File

@ -0,0 +1,18 @@
package com.yzdx.AiInterviewer.entity.dto;
import com.yzdx.AiInterviewer.entity.User;
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewRecord;
import lombok.Data;
import java.util.Map;
@Data
public class InterviewRecordDto extends VxInterviewRecord {
private Map<String ,Object> postInfo;
private Map<String ,Object> talentInfo;
private User userInfo;
}

View File

@ -29,4 +29,7 @@ public class VxInterviewNotice extends BaseEntity {
private Integer postId;
private Integer inviteId;
@ApiModelProperty("面试结束时间")
private String interviewEndTime;
}

View File

@ -32,4 +32,9 @@ public class VxInterviewRecord {
private Integer updateUser;
@ApiModelProperty("面试通知id")
private Integer noticeId;
@ApiModelProperty("面试详情")
private String detail;
@ApiModelProperty("人才画像id")
private Integer talentId;
}

View File

@ -0,0 +1,9 @@
package com.yzdx.AiInterviewer.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yzdx.AiInterviewer.entity.Talent;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TalentMapper extends BaseMapper<Talent> {
}

View File

@ -13,12 +13,12 @@ public interface InterviewNoticeService extends IService<VxInterviewNotice> {
* @param recipient 接收人id
* @param jobId 面试的岗位id
* @param postId 投递时的招聘id
* @param inviteId 面试设置的promoteId
* @param userId 操作人的id
* @param endTime 结束时间
* @return 影响的行数
*
* */
Integer addInterviewNotice(String encoding,Integer recipient,Integer jobId,Integer postId,Integer inviteId,Integer userId);
Integer addInterviewNotice(String encoding,Integer recipient,Integer jobId,Integer postId,Integer userId,String promote,String selectQuestions,Integer applicationId,String endTime);
/**
@ -28,4 +28,10 @@ public interface InterviewNoticeService extends IService<VxInterviewNotice> {
* */
List<VxNoticeDto> getInterviewNoticeByUserId(Integer userId);
/**
* 获取面试的promote
* @param noticeId 面试通知id
* @return promote
* */
String getInterviewPromote(Integer noticeId);
}

View File

@ -5,6 +5,7 @@ import com.yzdx.AiInterviewer.entity.InterviewSetting;
import com.yzdx.AiInterviewer.entity.dto.JobSettingDto;
import java.util.List;
import java.util.Map;
public interface InterviewSettingService extends IService<InterviewSetting> {
@ -83,4 +84,14 @@ public interface InterviewSettingService extends IService<InterviewSetting> {
Integer userId,
String jobPromote,
String encoding);
/**
* 根据jobid获取面试信息
* @param jobId 岗位id
* @return 面试设置信息
*
* */
Map<String, Object> getJobSettingByJobId(Integer jobId);
}

View File

@ -6,6 +6,7 @@ import com.yzdx.AiInterviewer.entity.dto.JobPostingDto;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface JobPostingService extends IService<JobPosting> {
@ -51,4 +52,7 @@ public interface JobPostingService extends IService<JobPosting> {
*
* */
List<JobPostingDto> getJobPostingList(String encoding);
List<Map<String, Object>> getPostingInfoList(String encoding);
}

View File

@ -29,24 +29,24 @@ public interface QuestionService extends IService<Question> {
* @param encoding 公司编码
* @param bankId 题库类型id
* @param details 题目详情
* @param promote 题目promote
* @param answer 题目的预设答案
* @param title 题目标题
* @param userId 用户id
* @return 改变的行数
* */
Integer addQuestion(String title,Integer bankId,String details,String promote,String encoding,Integer userId);
Integer addQuestion(String title,Integer bankId,String details,String answer,String encoding,Integer userId);
/**
* 修改题目
* @param id 题目ID
* @param encoding 公司编码
* @param bankId 题库类型id
* @param details 题目详情
* @param promote 题目promote
* @param answer 题目预设答案
* @param title 题目标题
* @param userId 用户id
* @return 改变的行数
* */
Integer updateQuestion(Integer id,String title,Integer bankId,String details,String promote,String encoding,Integer userId);
Integer updateQuestion(Integer id,String title,Integer bankId,String details,String answer,String encoding,Integer userId);

View File

@ -70,7 +70,7 @@ public interface SharedQuestionService extends IService<SharedQuestion> {
* @param id 分享题目ID
* @param title 题目标题
* @param details 题目详情
* @param promote 题目promote
* @param answer 题目预设答案
* @param bankId 分享题库ID
* @param userId 修改人ID
*
@ -78,7 +78,7 @@ public interface SharedQuestionService extends IService<SharedQuestion> {
Integer updateOurSharedQuestion(Integer id,
String title,
String details ,
String promote,
String answer,
Integer bankId ,
Integer userId );

View File

@ -0,0 +1,7 @@
package com.yzdx.AiInterviewer.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yzdx.AiInterviewer.entity.Talent;
public interface TalentService extends IService<Talent> {
}

View File

@ -100,6 +100,13 @@ public interface UserService extends IService<User> {
R vxLogin(String phone);
/**
* 管理员修改属下密码
* @param userId 操作人id
* @param password 修改的密码
* @param updateUserId 被更新人的id
* */
Integer adminEditPassword(Integer userId, Integer updateUserId, String password);
}

View File

@ -1,8 +0,0 @@
package com.yzdx.AiInterviewer.service.VxService;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yzdx.AiInterviewer.entity.vxEntity.VxFeedBack;
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewNotice;
public interface InterviewNoticeService extends IService<VxInterviewNotice> {
}

View File

@ -1,6 +1,7 @@
package com.yzdx.AiInterviewer.service.VxService;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxInterviewApplicationDto;
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewApplication;
import java.util.List;
@ -17,15 +18,28 @@ public interface VxInterviewApplicationService extends IService<VxInterviewAppli
Integer addInterviewApplication(Integer jobId, Integer userId, Integer postingId, String companyEncoding);
List<VxInterviewApplication> getApplicationList(String companyEncoding, Integer jobId);
/**
* Hr端获取面试申请
*
* @param jobId 岗位id
* @param companyEncoding 公司编码
* @return List<VxInterviewApplicationDto>
* */
List<VxInterviewApplicationDto> getApplicationList(String companyEncoding, Integer jobId);
/**
* 拒绝面试申请
* @param id 申请表id
* @return 影响的行数
* */
Integer disagreeApplication(Integer id);
/**
* @param searchName 搜索人的名称
* @param encoding 所搜人投递的公司编码
* @return List<VxInterviewApplicationDto>
*
* */
List<VxInterviewApplicationDto> searchApplicationByName(String searchName, String encoding);
}

View File

@ -2,13 +2,52 @@ package com.yzdx.AiInterviewer.service.VxService;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxInterviewRecordDto;
import com.yzdx.AiInterviewer.entity.dto.InterviewRecordDto;
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewRecord;
import java.util.List;
import java.util.Map;
public interface VxInterviewRecordService extends IService<VxInterviewRecord> {
List<VxInterviewRecordDto> getInterviewRecordList(Integer userId);
List<VxInterviewRecordDto> searchInterviewRecordList(String searchCompany,Integer userId);
/**
* 添加面试巨鹿
* @param encoding 公司编码
* @param interviewer 面试者id
* @param comments 面试评语
* @param noticeId 面试通知id
* @param detail 面试详情
* @param talentId 人才画像id
* @return 影响的行数
*
* */
Integer addInterviewRecord(String encoding, String comments, Integer interviewer, Integer noticeId,Integer talentId,String detail);
/**
* 后台网页或取
* @param jobId 岗位id
* @param encoding 公司编码
* @param postId 招聘ID
* @return List<InterviewRecordDto>
*
* */
List<InterviewRecordDto> getInterviewRecords(Integer postId, Integer jobId, String encoding,Integer status);
/**
* 通过面试
* @param postId 招聘Id
* @param jobId 岗位id
* @param userList 通过人的id
* @return 影线的行数
*
* */
Integer agreeUsersPassInterview(Integer jobId, Integer postId, String userList,Integer userId);
}

View File

@ -1,17 +1,29 @@
package com.yzdx.AiInterviewer.service.VxService.impl;
import com.alibaba.fastjson.JSON;
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.BaseEntity;
import com.yzdx.AiInterviewer.entity.JobEntity;
import com.yzdx.AiInterviewer.entity.Resume;
import com.yzdx.AiInterviewer.entity.User;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxInterviewApplicationDto;
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewApplication;
import com.yzdx.AiInterviewer.mapper.JobMapper;
import com.yzdx.AiInterviewer.mapper.ResumeMapper;
import com.yzdx.AiInterviewer.mapper.UserMapper;
import com.yzdx.AiInterviewer.mapper.VxMapper.VxInterviewApplicationMapper;
import com.yzdx.AiInterviewer.service.VxService.VxInterviewApplicationService;
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.List;
import java.time.LocalDate;
import java.time.Period;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class VxInterviewApplicationServiceImpl extends ServiceImpl<VxInterviewApplicationMapper, VxInterviewApplication> implements VxInterviewApplicationService {
@ -19,14 +31,20 @@ public class VxInterviewApplicationServiceImpl extends ServiceImpl<VxInterviewAp
private VxInterviewApplicationMapper vxInterviewApplicationMapper;
@Autowired
private ResumeMapper resumeMapper;
@Autowired
private JobMapper jobMapper;
@Autowired
private UserMapper userMapper;
@Override
public Integer addInterviewApplication(Integer jobId, Integer userId, Integer postingId, String companyEncoding) {
LambdaQueryWrapper<VxInterviewApplication> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(VxInterviewApplication::getJobId,jobId).eq(VxInterviewApplication::getPostingId,postingId);
queryWrapper.eq(VxInterviewApplication::getJobId,jobId).eq(VxInterviewApplication::getPostingId,postingId)
.eq(VxInterviewApplication::getUserId,userId).eq(BaseEntity::getCreateTime,TimeUtil.getTime());
VxInterviewApplication vxInterviewApplication = vxInterviewApplicationMapper.selectOne(queryWrapper);
if(vxInterviewApplication!=null){
return -2;
vxInterviewApplication.setCreateTime(TimeUtil.getTime());
vxInterviewApplicationMapper.updateById(vxInterviewApplication);
}
VxInterviewApplication vxInterviewApplication1=new VxInterviewApplication();
vxInterviewApplication1.setJobId(jobId);
@ -48,10 +66,285 @@ public class VxInterviewApplicationServiceImpl extends ServiceImpl<VxInterviewAp
return insert;
}
@Override
public List<VxInterviewApplication> getApplicationList(String companyEncoding, Integer jobId) {
public List<VxInterviewApplicationDto> getApplicationList(String companyEncoding, Integer jobId) {
LambdaQueryWrapper<VxInterviewApplication> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(VxInterviewApplication::getCompanyEncoding,companyEncoding).eq(VxInterviewApplication::getJobId,jobId);
List<VxInterviewApplication> list = vxInterviewApplicationMapper.selectList(queryWrapper);
return list;
List<VxInterviewApplication> VxInterviewApplicationList = vxInterviewApplicationMapper.selectList(queryWrapper);
List<VxInterviewApplicationDto>VxInterviewApplicationDtoList =VxInterviewApplicationList.stream().map(item->{
VxInterviewApplicationDto newVxInterviewApplicationDto=new VxInterviewApplicationDto();
BeanUtils.copyProperties(item,newVxInterviewApplicationDto);
JobEntity jobEntity = jobMapper.selectById(item.getJobId());
newVxInterviewApplicationDto.setJobName(jobEntity.getJobName());
User user = userMapper.selectById(item.getUserId());
newVxInterviewApplicationDto.setUserName(user.getUsername());
Resume resume = resumeMapper.selectById(item.getResumeId());
//解析在校经历计算出学历
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);
newVxInterviewApplicationDto.setResume(result);
newVxInterviewApplicationDto.setCreateTime(item.getCreateTime());
return newVxInterviewApplicationDto;
}).collect(Collectors.toList());
return VxInterviewApplicationDtoList;
}
@Override
public Integer disagreeApplication(Integer id) {
VxInterviewApplication vxInterviewApplication = vxInterviewApplicationMapper.selectById(id);
vxInterviewApplication.setStatus(3);
return vxInterviewApplicationMapper.updateById(vxInterviewApplication);
}
@Override
public List<VxInterviewApplicationDto> searchApplicationByName(String searchName, String encoding) {
LambdaQueryWrapper<User> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.like(User::getUsername,searchName);
List<User> users = userMapper.selectList(queryWrapper);
List<VxInterviewApplication> vxInterviewApplicationList=new ArrayList<>();
for (User user:users) {
LambdaQueryWrapper<VxInterviewApplication> queryWrapper1=new LambdaQueryWrapper<>();
queryWrapper1.eq(VxInterviewApplication::getCompanyEncoding,encoding).eq(VxInterviewApplication::getUserId,user.getId());
List<VxInterviewApplication> vxInterviewApplications = vxInterviewApplicationMapper.selectList(queryWrapper1);
vxInterviewApplicationList.addAll(vxInterviewApplications);
}
List<VxInterviewApplicationDto>VxInterviewApplicationDtoList =vxInterviewApplicationList.stream().map(item->{
VxInterviewApplicationDto newVxInterviewApplicationDto=new VxInterviewApplicationDto();
BeanUtils.copyProperties(item,newVxInterviewApplicationDto);
JobEntity jobEntity = jobMapper.selectById(item.getJobId());
newVxInterviewApplicationDto.setJobName(jobEntity.getJobName());
User user = userMapper.selectById(item.getUserId());
newVxInterviewApplicationDto.setUserName(user.getUsername());
Resume resume = resumeMapper.selectById(item.getResumeId());
//解析在校经历计算出学历
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);
newVxInterviewApplicationDto.setResume(result);
return newVxInterviewApplicationDto;
}).collect(Collectors.toList());
return VxInterviewApplicationDtoList;
}
}

View File

@ -1,11 +0,0 @@
package com.yzdx.AiInterviewer.service.VxService.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewNotice;
import com.yzdx.AiInterviewer.mapper.VxMapper.VxInterviewNoticeMapper;
import com.yzdx.AiInterviewer.service.VxService.InterviewNoticeService;
import org.springframework.stereotype.Service;
@Service
public class VxInterviewNoticeImpl extends ServiceImpl<VxInterviewNoticeMapper, VxInterviewNotice> implements InterviewNoticeService {
}

View File

@ -1,24 +1,29 @@
package com.yzdx.AiInterviewer.service.VxService.impl;
import com.alibaba.fastjson.JSON;
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.Company;
import com.yzdx.AiInterviewer.entity.JobEntity;
import com.yzdx.AiInterviewer.entity.*;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxInterviewRecordDto;
import com.yzdx.AiInterviewer.entity.dto.InterviewRecordDto;
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewNotice;
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewRecord;
import com.yzdx.AiInterviewer.mapper.CompanyMapper;
import com.yzdx.AiInterviewer.mapper.JobMapper;
import com.yzdx.AiInterviewer.mapper.*;
import com.yzdx.AiInterviewer.mapper.VxMapper.VxInterviewNoticeMapper;
import com.yzdx.AiInterviewer.mapper.VxMapper.VxInterviewRecordMapper;
import com.yzdx.AiInterviewer.service.CompanyService;
import com.yzdx.AiInterviewer.service.VxService.VxInterviewRecordService;
import com.yzdx.AiInterviewer.utiles.EmailUtil;
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;
import java.util.stream.Collectors;
@Service
public class VxInterviewRecordServiceImpl extends ServiceImpl<VxInterviewRecordMapper, VxInterviewRecord> implements VxInterviewRecordService {
@ -34,6 +39,14 @@ public class VxInterviewRecordServiceImpl extends ServiceImpl<VxInterviewRecordM
@Autowired
private CompanyService companyService;
@Autowired
private JobPostingMapper jobPostingMapper;
@Autowired
private TalentMapper talentMapper;
@Autowired
private UserMapper userMapper;
@Override
public List<VxInterviewRecordDto> getInterviewRecordList(Integer userId) {
LambdaQueryWrapper<VxInterviewRecord> queryWrapper=new LambdaQueryWrapper<>();
@ -58,6 +71,7 @@ public class VxInterviewRecordServiceImpl extends ServiceImpl<VxInterviewRecordM
vxInterviewRecordDto.setJob(jobEntity.getJobName());
return vxInterviewRecordDto;
}).collect(Collectors.toList());
return vxInterviewRecordDtos;
@ -116,4 +130,166 @@ public class VxInterviewRecordServiceImpl extends ServiceImpl<VxInterviewRecordM
return vxInterviewRecordDtoList;
}
@Override
public Integer addInterviewRecord(String encoding, String comments, Integer interviewer, Integer noticeId,Integer talentId,String detail) {
LambdaQueryWrapper<VxInterviewRecord> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(VxInterviewRecord::getInterviewer,interviewer).eq(VxInterviewRecord::getNoticeId,noticeId);
VxInterviewRecord vxInterviewRecord = vxInterviewRecordMapper.selectOne(queryWrapper);
if(vxInterviewRecord!=null){
return -1;
}
VxInterviewRecord vxInterviewRecord1=new VxInterviewRecord();
vxInterviewRecord1.setCompanyEncoding(encoding);
vxInterviewRecord1.setComments(comments);
vxInterviewRecord1.setInterviewer(interviewer);
vxInterviewRecord1.setNoticeId(noticeId);
vxInterviewRecord1.setCreateUser(interviewer);
vxInterviewRecord1.setCreateTime(TimeUtil.getTime());
vxInterviewRecord1.setDetail(detail);
return vxInterviewRecordMapper.insert(vxInterviewRecord1);
}
@Override
public List<InterviewRecordDto> getInterviewRecords(Integer postId, Integer jobId, String encoding,Integer status) {
LambdaQueryWrapper<VxInterviewRecord> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(VxInterviewRecord::getCompanyEncoding,encoding).eq(VxInterviewRecord::getStatus,status);
List<VxInterviewRecord> vxInterviewRecords = vxInterviewRecordMapper.selectList(queryWrapper);
vxInterviewRecords= vxInterviewRecords.stream().map(item->{
VxInterviewNotice vxInterviewNotice = vxInterviewNoticeMapper.selectById(item.getNoticeId());
if(vxInterviewNotice.getJobId()==jobId&&vxInterviewNotice.getPostId()==postId){
return item;
}
return null;
}).collect(Collectors.toList());
if(vxInterviewRecords.size()==0){
return null;
}
List<InterviewRecordDto> interviewRecordDtoList=vxInterviewRecords.stream().map(item->{
InterviewRecordDto interviewRecordDto=new InterviewRecordDto();
BeanUtils.copyProperties(item,interviewRecordDto);
Map<String,Object> postInfo=new HashMap<>();
VxInterviewRecord vxInterviewRecord = vxInterviewRecordMapper.selectById(item.getId());
VxInterviewNotice vxInterviewNotice = vxInterviewNoticeMapper.selectById(vxInterviewRecord.getNoticeId());
postInfo.put("postId",vxInterviewNotice.getPostId());
postInfo.put("jobId",vxInterviewNotice.getJobId());
interviewRecordDto.setPostInfo(postInfo);
Map<String,Object> talentInfo=new HashMap<>();
Talent talent = talentMapper.selectById(item.getTalentId());
talentInfo.put("talentInfo",talent);
interviewRecordDto.setPostInfo(talentInfo);
User userInfo=userMapper.selectById(item.getInterviewer());
userInfo.setPassword(null);
userInfo.setSalt(null);
interviewRecordDto.setUserInfo(userInfo);
return interviewRecordDto;
}).collect(Collectors.toList());
return interviewRecordDtoList;
}
@Override
public Integer agreeUsersPassInterview(Integer jobId, Integer postId, String userList,Integer Id) {
JSONArray userIDS=JSON.parseArray(userList);
for (int i = 0; i <userIDS.size() ; i++) {
Integer userId =(Integer) userIDS.get(i);
LambdaQueryWrapper<VxInterviewNotice> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(VxInterviewNotice::getJobId,jobId).eq(VxInterviewNotice::getPostId,postId)
.eq(VxInterviewNotice::getRecipient,userId);
VxInterviewNotice vxInterviewNotice = vxInterviewNoticeMapper.selectOne(queryWrapper);
LambdaQueryWrapper<VxInterviewRecord> queryWrapper1=new LambdaQueryWrapper<>();
queryWrapper1.eq(VxInterviewRecord::getInterviewer,userId).eq(VxInterviewRecord::getNoticeId,vxInterviewNotice.getId());
VxInterviewRecord vxInterviewRecord = vxInterviewRecordMapper.selectOne(queryWrapper1);
vxInterviewRecord.setStatus(2);
vxInterviewRecord.setUpdateUser(Id);
vxInterviewRecord.setUpdateTime(TimeUtil.getTime());
User user = userMapper.selectById(vxInterviewRecord.getInterviewer());
LambdaQueryWrapper<Company> queryWrapper2=new LambdaQueryWrapper<>();
queryWrapper2.eq(Company::getEncoding,vxInterviewRecord.getCompanyEncoding());
Company company = companyMapper.selectOne(queryWrapper2);
try {
// "<h1>"+userName+"先生,你好!</h1> 您已获得本公司"+"["+jobName+"]AI面试资格请打开微信小程序点击面试通知查看详情"
//"扬城直聘:"+companyName
String detail= "<h1>"+user.getUsername()+(user.getSex().equals("")?"先生":"女士")+"你好!</h1> 感谢您参加我们的面试,我们很高兴地通知您,您已经通过了面试,成为我们团队的一员。\n" +
"\n" +
"您在面试中展示了出色的专业技能和沟通能力,我们对您的表现印象深刻。我们相信您能够为我们的项目做出重要的贡献,并与我们的同事们建立良好的合作关系。\n" +
"\n" +
"您的入职日期是2024年1月1日您的工作地点是江苏省扬州市邗江区扬子江中路760号。您的岗位是java开发工程师您的月薪是10000元。您的直属上司是李经理他将在您入职后为您安排工作和培训。\n" +
"\n" +
"请在收到本邮件后,尽快回复确认您是否接受我们的录用,并告知您的联系方式。如果您有任何问题或疑虑,请随时与我们联系。\n" +
"\n" +
"我们期待着您的加入,祝您一切顺利!\n";
String title="扬城直聘:"+company.getCompanyName();
EmailUtil.sendEmail(user.getEmail(),title,detail);
} catch (Exception e) {
e.printStackTrace();
return -3;
}
vxInterviewRecordMapper.updateById(vxInterviewRecord);
}
return 1;
}
}

View File

@ -3,12 +3,16 @@ package com.yzdx.AiInterviewer.service.impl;
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.InvitePromote;
import com.yzdx.AiInterviewer.entity.JobEntity;
import com.yzdx.AiInterviewer.entity.User;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxNoticeDto;
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewApplication;
import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewNotice;
import com.yzdx.AiInterviewer.mapper.InvitePromoteMapper;
import com.yzdx.AiInterviewer.mapper.JobMapper;
import com.yzdx.AiInterviewer.mapper.UserMapper;
import com.yzdx.AiInterviewer.mapper.VxMapper.VxInterviewApplicationMapper;
import com.yzdx.AiInterviewer.mapper.VxMapper.VxInterviewNoticeMapper;
import com.yzdx.AiInterviewer.service.CompanyService;
import com.yzdx.AiInterviewer.service.InterviewNoticeService;
@ -33,15 +37,19 @@ public class InterviewNoticeServiceImpl extends ServiceImpl<VxInterviewNoticeMap
@Autowired
private JobMapper jobMapper;
@Autowired
private InvitePromoteMapper invitePromoteMapper;
@Autowired
private VxInterviewApplicationMapper vxInterviewApplicationMapper;
@Override
public Integer addInterviewNotice(String encoding, Integer recipient, Integer jobId, Integer postId,
Integer inviteId,Integer userId) {
Integer userId,String promote,String selectQuestions,Integer applicationId,String endTime) {
LambdaQueryWrapper<VxInterviewNotice> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(VxInterviewNotice::getCompanyEncoding,encoding).eq(VxInterviewNotice::getJobId,jobId)
.eq(VxInterviewNotice::getPostId,postId).eq(VxInterviewNotice::getInviteId,inviteId);
.eq(VxInterviewNotice::getPostId,postId);
VxInterviewNotice vxInterviewNotice = vxInterviewNoticeMapper.selectOne(queryWrapper);
@ -58,9 +66,68 @@ public class InterviewNoticeServiceImpl extends ServiceImpl<VxInterviewNoticeMap
newVxInterviewNotice.setJobId(jobId);
newVxInterviewNotice.setInterviewEndTime(endTime);
newVxInterviewNotice.setPostId(postId);
newVxInterviewNotice.setInviteId(inviteId);
LambdaQueryWrapper<InvitePromote> queryWrapper1=new LambdaQueryWrapper<>();
queryWrapper1.eq(InvitePromote::getJobId,jobId).eq(InvitePromote::getPostId,postId).eq(InvitePromote::getInviteUser,recipient);
InvitePromote invitePromote1 = invitePromoteMapper.selectOne(queryWrapper1);
if(invitePromote1==null){
//添加promote表
InvitePromote invitePromote=new InvitePromote();
invitePromote.setEncoding(encoding);
invitePromote.setJobId(jobId);
invitePromote.setPostId(postId);
invitePromote.setQuestion(selectQuestions);
invitePromote.setPromote(promote);
invitePromote.setInviteUser(recipient);
invitePromote.setCreateUser(userId);
invitePromote.setCreateTime(TimeUtil.getTime());
invitePromoteMapper.insert(invitePromote);
LambdaQueryWrapper<InvitePromote> queryWrapper2=new LambdaQueryWrapper<>();
queryWrapper2.eq(InvitePromote::getJobId,jobId).eq(InvitePromote::getPostId,postId).eq(InvitePromote::getInviteUser,recipient);
invitePromote1=invitePromoteMapper.selectOne(queryWrapper2);
}else{
invitePromote1.setEncoding(encoding);
invitePromote1.setJobId(jobId);
invitePromote1.setPostId(postId);
invitePromote1.setQuestion(selectQuestions);
invitePromote1.setPromote(promote);
invitePromote1.setInviteUser(recipient);
invitePromote1.setUpdateUser(userId);
invitePromote1.setUpdateTime(TimeUtil.getTime());
invitePromoteMapper.updateById(invitePromote1);
}
newVxInterviewNotice.setInviteId(invitePromote1.getId());
newVxInterviewNotice.setCreateTime(TimeUtil.getTime());
@ -90,21 +157,32 @@ public class InterviewNoticeServiceImpl extends ServiceImpl<VxInterviewNoticeMap
if(email==null||userName==null||companyName==null||jobName==null){
return -3;
}
try {
EmailUtil.sendEmail(email,userName,companyName,jobName);
// "<h1>"+userName+"先生,你好!</h1> 您已获得本公司"+"["+jobName+"]AI面试资格请打开微信小程序点击面试通知查看详情"
//"扬城直聘:"+companyName
String detail= "<h1>"+userName+(user.getSex().equals("")?"先生":"女士")+"你好!</h1> 您已获得本公司"+"["+jobName+"]AI面试资格请打开微信小程序点击面试通知查看详情";
String title="扬城直聘:"+companyName;
EmailUtil.sendEmail(email,title,detail);
} catch (Exception e) {
e.printStackTrace();
return -3;
}
VxInterviewApplication vxInterviewApplication = vxInterviewApplicationMapper.selectById(applicationId);
vxInterviewApplication.setStatus(2);
vxInterviewApplicationMapper.updateById(vxInterviewApplication);
Integer rows = vxInterviewNoticeMapper.insert(newVxInterviewNotice);
return rows;
}
@Override
public List<VxNoticeDto> getInterviewNoticeByUserId(Integer userId) {
LambdaQueryWrapper<VxInterviewNotice> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(VxInterviewNotice::getRecipient,userId);
@ -135,6 +213,8 @@ public class InterviewNoticeServiceImpl extends ServiceImpl<VxInterviewNoticeMap
vxNoticeDto.setJob(jobEntity.getJobName());
vxNoticeDto.setInterviewEndTime(item.getInterviewEndTime());
return vxNoticeDto;
}).collect(Collectors.toList());
@ -142,5 +222,19 @@ public class InterviewNoticeServiceImpl extends ServiceImpl<VxInterviewNoticeMap
return VxNoticeDtoList;
}
@Override
public String getInterviewPromote(Integer noticeId) {
VxInterviewNotice vxInterviewNotice = vxInterviewNoticeMapper.selectById(noticeId);
if(vxInterviewNotice==null){
return null;
}
InvitePromote invitePromote = invitePromoteMapper.selectById(vxInterviewNotice.getInviteId());
if(invitePromote==null){
return null;
}
return invitePromote.getPromote();
}
}

View File

@ -12,7 +12,9 @@ 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
@ -30,6 +32,9 @@ public class InterviewSettingServiceImpl extends ServiceImpl<InterviewSettingMap
private InterviewLogoMapper logoMapper;
@Autowired
private QuestionBankMapper bankMapper;
@Autowired
private QuestionMapper questionMapper;
@Override
public Integer addJobSetting(Integer jobId, Integer imagesId, Integer backgroundId,
@ -310,4 +315,77 @@ public class InterviewSettingServiceImpl extends ServiceImpl<InterviewSettingMap
return interviewSettingMapper.updateById(findSetting);
}
@Override
public Map<String, Object> getJobSettingByJobId(Integer jobId) {
Map<String,Object> result=new HashMap<>();
LambdaQueryWrapper<InterviewSetting> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(InterviewSetting::getJobId,jobId);
InterviewSetting interviewSetting = interviewSettingMapper.selectOne(queryWrapper);
if(interviewSetting.getProfessional()!=0){
Map<String ,Object> Professional=new HashMap<>();
LambdaQueryWrapper<Question> questionQueryWrapper=new LambdaQueryWrapper<>();
questionQueryWrapper.eq(Question::getBankId,interviewSetting.getProfessional());
List<Question> ProfessionalQuestionList = questionMapper.selectList(questionQueryWrapper);
QuestionBank questionBank = bankMapper.selectById(interviewSetting.getProfessional());
Professional.put("ProfessionalName",questionBank.getTypeName());
Professional.put("ProfessionalQuestionList",ProfessionalQuestionList);
result.put("Professional",Professional);
}
if(interviewSetting.getComprehensive()!=0){
Map<String ,Object> Comprehensive=new HashMap<>();
LambdaQueryWrapper<Question> questionQueryWrapper=new LambdaQueryWrapper<>();
questionQueryWrapper.eq(Question::getBankId,interviewSetting.getComprehensive());
List<Question> ComprehensiveQuestionList = questionMapper.selectList(questionQueryWrapper);
QuestionBank questionBank = bankMapper.selectById(interviewSetting.getComprehensive());
Comprehensive.put("ComprehensiveName",questionBank.getTypeName());
Comprehensive.put("ComprehensiveQuestionList",ComprehensiveQuestionList);
result.put("Comprehensive",Comprehensive);
}
if(interviewSetting.getPsychology()!=0){
Map<String ,Object> Psychology=new HashMap<>();
LambdaQueryWrapper<Question> questionQueryWrapper=new LambdaQueryWrapper<>();
questionQueryWrapper.eq(Question::getBankId,interviewSetting.getPsychology());
List<Question> PsychologyQuestionList = questionMapper.selectList(questionQueryWrapper);
QuestionBank questionBank = bankMapper.selectById(interviewSetting.getPsychology());
Psychology.put("PsychologyName",questionBank.getTypeName());
Psychology.put("PsychologyQuestionList",PsychologyQuestionList);
result.put("Psychology",Psychology);
}
return result;
}
}

View File

@ -358,13 +358,30 @@ public class JobListServiceImpl extends ServiceImpl<JobMapper, JobEntity> implem
List<Map<String,Object>> result=new ArrayList<>();
//先获取用户的岗位期望
Map<String,Object> resultResume = resumeService.getResume(userId);
List<String> suggestJobs=new ArrayList<>();
JSONArray jobExpectationJSONs =null;
if(resultResume==null||userId==null){
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());
}
Resume resume=(Resume) resultResume.get("resume");
String jobExpectation = resume.getJobExpectation();
JSONArray jobExpectationJSONs = (JSONArray) JSON.parse(jobExpectation);
jobExpectationJSONs = (JSONArray) JSON.parse(jobExpectation);
List<String> suggestJobs=new ArrayList<>();
if(jobExpectationJSONs.size()<=5){
LambdaQueryWrapper<JobEntity> addQueryWrapper =new LambdaQueryWrapper<>();

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yzdx.AiInterviewer.entity.JobEntity;
import com.yzdx.AiInterviewer.entity.JobPosting;
import com.yzdx.AiInterviewer.entity.dto.JobPostingDto;
import com.yzdx.AiInterviewer.mapper.JobMapper;
import com.yzdx.AiInterviewer.mapper.JobPostingMapper;
import com.yzdx.AiInterviewer.service.JobListService;
import com.yzdx.AiInterviewer.service.JobPostingService;
@ -15,12 +16,11 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.jws.Oneway;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@Service
@ -32,6 +32,9 @@ public class JobPostingServiceImpl extends ServiceImpl<JobPostingMapper, JobPost
@Autowired
private JobListService jobListService;
@Autowired
private JobMapper jobMapper;
@Override
public Integer addJobPosting(String name, String startTime, String endTime, String checkList, Integer userId, String encoding) {
@ -188,4 +191,55 @@ public class JobPostingServiceImpl extends ServiceImpl<JobPostingMapper, JobPost
return JobPostingDtoList;
}
@Override
public List<Map<String, Object>> getPostingInfoList(String encoding) {
List<Map<String, Object>> result=new ArrayList<>();
LambdaQueryWrapper<JobPosting> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(JobPosting::getCompanyEncoding,encoding);
List<JobPosting> jobPostings = jobPostingMapper.selectList(queryWrapper);
jobPostings.stream().map(item->{
Map<String,Object> postInfo=new HashMap<>();
JobPosting jobPosting = jobPostingMapper.selectById(item.getId());
postInfo.put("postId",item.getId());
postInfo.put("postName",item.getRecruitmentName());
JSONArray jobListJSON=JSON.parseArray(jobPosting.getJobId());
List<Map<String,Object>> jobList=new ArrayList<>();
for (int i = 0; i <jobListJSON.size() ; i++) {
Integer jobId= (Integer) jobListJSON.get(i);
JobEntity jobEntity = jobMapper.selectById(jobId);
Map<String, Object> jobItem=new HashMap<>();
jobItem.put("jobId",jobEntity.getId());
jobItem.put("jobName",jobEntity.getJobName());
jobList.add(jobItem);
}
postInfo.put("jobList",jobList);
result.add(postInfo);
return null;
}).collect(Collectors.toList());
return result;
}
}

View File

@ -93,7 +93,7 @@ public class QuestionBankServiceImpl extends ServiceImpl<QuestionBankMapper, Que
//判断题库名是否存在
LambdaQueryWrapper<QuestionBank> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(QuestionBank::getTypeName,typeName);
queryWrapper.eq(QuestionBank::getTypeName,typeName).eq(QuestionBank::getCompanyEncoding,encoding);
QuestionBank findQuestionBank=questionBankMapper.selectOne(queryWrapper);
if(findQuestionBank!=null){
//存在返回-2

View File

@ -191,31 +191,30 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
}
@Override
public Integer addQuestion(String title, Integer bankId, String details, String promote, String encoding, Integer userId) {
public Integer addQuestion(String title, Integer bankId, String details, String answer, String encoding, Integer userId) {
//判断题目标题是否重复
Question question=new Question();
question.setTitle(title);
question.setBankId(bankId);
question.setDetails(details);
question.setPromote(promote);
question.setCompanyEncoding(encoding);
question.setCreateUser(userId);
question.setCreateTime(TimeUtil.getTime());
question.setUpdateTime(TimeUtil.getTime());
question.setUpdateUser(userId);
LambdaQueryWrapper<Question> questionLambdaQueryWrapper=new LambdaQueryWrapper<>();
questionLambdaQueryWrapper
.eq(Question::getTitle,question.getTitle())
.eq(Question::getBankId,question.getBankId())
.eq(Question::getCompanyEncoding,question.getCompanyEncoding());
.eq(Question::getTitle,title)
.eq(Question::getBankId,bankId)
.eq(Question::getCompanyEncoding,encoding);
Question selectQuestion = questionMapper.selectOne(questionLambdaQueryWrapper);
if(selectQuestion!=null){
return -2;
}
Question question=new Question();
question.setTitle(title);
question.setBankId(bankId);
question.setDetails(details);
question.setAnswer(answer);
question.setCompanyEncoding(encoding);
question.setCreateUser(userId);
question.setCreateTime(TimeUtil.getTime());
question.setUpdateTime(TimeUtil.getTime());
question.setUpdateUser(userId);
Integer rows = questionMapper.insert(question);
@ -223,14 +222,14 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
}
@Override
public Integer updateQuestion(Integer id,String title, Integer bankId, String details, String promote, String encoding, Integer userId) {
public Integer updateQuestion(Integer id,String title, Integer bankId, String details, String answer, String encoding, Integer userId) {
//判断题目标题是否重复
Question question=new Question();
question.setId(id);
question.setTitle(title);
question.setBankId(bankId);
question.setDetails(details);
question.setPromote(promote);
question.setAnswer(answer);
question.setCompanyEncoding(encoding);
question.setUpdateTime(TimeUtil.getTime());
question.setUpdateUser(userId);

View File

@ -61,7 +61,20 @@ public class ResumeServiceImpl extends ServiceImpl<ResumeMapper, Resume> impleme
findUser.setEmail(email);
findUser.setPhone(phone);
findUser.setSex((sex.equals("0")?"":""));
// 获取当前日期
LocalDate currentDate = LocalDate.now();
// 解析生日日期
LocalDate birthDate = LocalDate.parse(birthday + "-01");
// 计算年龄
Period age = Period.between(birthDate, currentDate);
findUser.setAge(String.valueOf(age.getYears()));
Integer rows = userMapper.updateById(findUser);
@ -272,7 +285,7 @@ public class ResumeServiceImpl extends ServiceImpl<ResumeMapper, Resume> impleme
String projectExperience, Integer userId) {
Map<String,Object> result=new HashMap<>();
if(avatar!=null){
if(avatar!=null&&name!=null&&email!=null&&phone!=null){
LambdaQueryWrapper<User> queryWrapper1=new LambdaQueryWrapper<User>();
@ -286,9 +299,8 @@ public class ResumeServiceImpl extends ServiceImpl<ResumeMapper, Resume> impleme
findUser.setEmail(email);
findUser.setPhone(phone);
Integer rows = userMapper.updateById(findUser);
}
Resume resume=new Resume();
@ -399,6 +411,8 @@ public class ResumeServiceImpl extends ServiceImpl<ResumeMapper, Resume> impleme
result.put("school",school);
result.put("major",major);
result.put("phone",phone);
result.put("resumeId",resume.getId());
return result;
}
@ -412,6 +426,10 @@ public class ResumeServiceImpl extends ServiceImpl<ResumeMapper, Resume> impleme
Resume resume = resumeMapper.selectOne(queryWrapper);
if(resume==null){
return null;
}
//解析在校经历计算出学历
JSONArray educationJSONArray= JSON.parseArray(resume.getEducationBackground());

View File

@ -204,7 +204,7 @@ public class SharedQuestionBankServiceImpl extends ServiceImpl<SharedQuestionBan
Question question=new Question();
question.setDetails(sharedQuestion.getDetails());
question.setBankId(bankId);
question.setPromote(sharedQuestion.getPromote());
question.setAnswer(sharedQuestion.getAnswer());
question.setCompanyEncoding(encoding);
question.setTitle(sharedQuestion.getTitle());
question.setCreateTime(TimeUtil.getTime());

View File

@ -70,7 +70,7 @@ public class SharedQuestionServiceImpl extends ServiceImpl<SharedQuestionMapper,
sharedQuestion.setDetails(question.getDetails());
sharedQuestion.setTitle(question.getTitle());
sharedQuestion.setPromote(question.getPromote());
sharedQuestion.setAnswer(question.getAnswer());
sharedQuestion.setCreateUser(userId);
sharedQuestion.setCreateTime(TimeUtil.getTime());
sharedQuestion.setUpdateUser(userId);
@ -205,7 +205,7 @@ public class SharedQuestionServiceImpl extends ServiceImpl<SharedQuestionMapper,
}
Question question1=new Question();
question1.setTitle(sharedQuestion.getTitle());
question1.setPromote(sharedQuestion.getPromote());
question1.setAnswer(sharedQuestion.getAnswer());
question1.setCompanyEncoding(encoding);
question1.setBankId(bankId);
question1.setCreateUser(userId);
@ -297,7 +297,7 @@ public class SharedQuestionServiceImpl extends ServiceImpl<SharedQuestionMapper,
}
@Override
public Integer updateOurSharedQuestion(Integer id, String title, String details, String promote, Integer bankId, Integer userId) {
public Integer updateOurSharedQuestion(Integer id, String title, String details, String answer, Integer bankId, Integer userId) {
LambdaQueryWrapper<SharedQuestion> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(SharedQuestion::getId,id);
@ -308,7 +308,7 @@ public class SharedQuestionServiceImpl extends ServiceImpl<SharedQuestionMapper,
findSharedQuestion.setDetails(details);
findSharedQuestion.setPromote(promote);
findSharedQuestion.setAnswer(answer);
findSharedQuestion.setBankId(bankId);

View File

@ -0,0 +1,12 @@
package com.yzdx.AiInterviewer.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yzdx.AiInterviewer.entity.Talent;
import com.yzdx.AiInterviewer.mapper.TalentMapper;
import com.yzdx.AiInterviewer.service.TalentService;
import org.springframework.stereotype.Service;
@Service
public class TalentServiceImpl extends ServiceImpl<TalentMapper, Talent> implements TalentService {
}

View File

@ -57,7 +57,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
return R.error("账号或密码有误,请检查输入!");
}
if(selectUser.getRole().equals("3")||selectUser.getRole().equals("4")){
if(selectUser.getRole().equals("4")){
return R.error("账号权限不足,请联系管理员");
}
//均正确返回token密钥
@ -157,24 +157,20 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
}).collect(Collectors.toList());
return filterUserList;
}
//系统管理添加HR
@Override
public Integer addAdmin(String encoding, Integer userId, String username, String phone,String role) {
User newUser=new User();
newUser.setUsername(username);
newUser.setPhone(phone);
String salt=MD5Util.getSalt();
newUser.setSalt(salt);
String password=phone.substring(phone.length()-6);
System.out.println(password);
newUser.setPassword(MD5Util.GetMD5Password(password,salt));
newUser.setRole(role);
newUser.setCompanyEncoding(encoding);
newUser.setCreateUser(userId);
newUser.setCreateTime(TimeUtil.getTime());
newUser.setUpdateUser(userId);
newUser.setUpdateTime(TimeUtil.getTime());
//查询操作人的权限(添加管理员的权限应该是公司管理员)
//公司管理员-公司管理员, HR
User user = userMapper.selectById(userId);
String userRole =user.getRole();
if(!(userRole.equals("2"))){
return -3;
}
LambdaQueryWrapper<User> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(User::getPhone,phone);
@ -183,13 +179,27 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
if(findUser!=null){
//用户转hr
if(findUser.getRole().equals("4")){
findUser.setRole(role);
findUser.setCompanyEncoding(encoding);
return userMapper.updateById(findUser);
}
return -2;
if(findUser.getRole().equals("4")){
findUser.setRole(role);
findUser.setCompanyEncoding(encoding);
return userMapper.updateById(findUser);
}
return -2;
}
User newUser=new User();
newUser.setUsername(username);
newUser.setPhone(phone);
String salt=MD5Util.getSalt();
newUser.setSalt(salt);
String password=phone.substring(phone.length()-6);
newUser.setPassword(MD5Util.GetMD5Password(password,salt));
newUser.setRole(role);
newUser.setCompanyEncoding(encoding);
newUser.setCreateUser(userId);
newUser.setCreateTime(TimeUtil.getTime());
newUser.setUpdateUser(userId);
newUser.setUpdateTime(TimeUtil.getTime());
Integer rows = userMapper.insert(newUser);
return rows;
@ -202,25 +212,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
return -3;
}
//判断有误越权
LambdaQueryWrapper<User> userLambdaQueryWrapper=new LambdaQueryWrapper<>();
User user = userMapper.selectById(userId);
userLambdaQueryWrapper.eq(User::getId,userId);
User fixUser = userMapper.selectOne(userLambdaQueryWrapper);
LambdaQueryWrapper<User> deleteLambdaQueryWrapper=new LambdaQueryWrapper<>();
deleteLambdaQueryWrapper.eq(User::getId,deleteId);
User deleteUser = userMapper.selectOne(deleteLambdaQueryWrapper);
Integer fixRole=Integer.valueOf(fixUser.getRole());
Integer deleteRole=Integer.valueOf(deleteUser.getRole());
if(deleteRole<fixRole){
if(user.getRole().equals("3")||user.getRole().equals("4")){
return -2;
}
Integer rows = userMapper.deleteById(deleteId);
@ -362,6 +357,32 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
}
@Override
public Integer adminEditPassword(Integer userId, Integer updateUserId, String password) {
//判断权限是否越界
User user = userMapper.selectById(userId);
User updateUser = userMapper.selectById(updateUserId);
if(user.getRole().equals(updateUser.getRole())&&userId!=updateUserId){
return -2;
}
if(user.getRole().equals("3")||user.getRole().equals("4")){
return -3;
}
String salt = updateUser.getSalt();
String newPassword = MD5Util.GetMD5Password(password, salt);
updateUser.setPassword(newPassword);
updateUser.setUpdateUser(userId);
updateUser.setUpdateTime(TimeUtil.getTime());
return userMapper.updateById(updateUser);
}
}

View File

@ -31,7 +31,7 @@ public class EmailUtil {
* @throws Exception
*/
public static String sendEmail(String email,String userName,String companyName,String jobName) {
public static String sendEmail(String email,String title,String detail) {
Transport ts = null;
try {
@ -80,10 +80,10 @@ public class EmailUtil {
message.setRecipient(Message.RecipientType.TO, new InternetAddress(email));
//4-4邮件标题
message.setSubject("扬城直聘:"+companyName);
message.setSubject(title);
//4-5邮件文本内容
message.setContent("<h1>"+userName+"先生,你好!</h1> 您已获得本公司"+"["+jobName+"]AI面试资格请打开微信小程序点击面试通知查看详情","text/html;charset=UTF-8");
message.setContent(detail,"text/html;charset=UTF-8");
//4-6发送邮件
ts.sendMessage(message, message.getAllRecipients());
@ -96,8 +96,4 @@ public class EmailUtil {
return "发送成功";
}
public static void main(String[] args) {
sendEmail("2209176490@qq.com","Jerry","小米有限责任公司","java程序员");
}
}

View File

@ -0,0 +1,69 @@
package com.yzdx.AiInterviewer.utiles;
import lombok.extern.slf4j.Slf4j;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
@Slf4j
public class FileDownloadUtil {
/**
* 下载文件到服务器
*
* @param downloadUrl 要下载的文件的地址
* @param downloadPath 服务器上存储的文件路径
* @param downloadFileName 服务器上存储的文件名称
* @return
*/
public static boolean downloadToServer(String downloadUrl, String downloadPath, String downloadFileName) {
FileOutputStream fos = null;
BufferedInputStream bis = null;
boolean flag = false;
try {
URL url = new URL(downloadUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
bis = new BufferedInputStream(connection.getInputStream());
File file = new File(downloadPath);
if (!file.exists()) {
boolean mkdirs = file.mkdirs();
if (!mkdirs) {
log.error("创建文件目录失败");
return false;
}
}
String filePathName = downloadPath + File.separator + downloadFileName;
byte[] buf = new byte[1024];
int size;
fos = new FileOutputStream(filePathName);
while ((size = bis.read(buf)) != -1) {
fos.write(buf, 0, size);
}
flag = true;
log.info("文件下载成功,文件路径[" + filePathName + "]");
flag = true;
} catch (Exception e) {
log.error("下载文件异常", e);
} finally {
try {
if (bis != null) {
bis.close();
}
if (fos != null) {
fos.close();
}
} catch (IOException e) {
log.error("关流异常", e);
e.printStackTrace();
}
}
return flag;
}
}

View File

@ -1,5 +1,5 @@
server:
port: 8080
port: 5380
spring:
datasource:

View File

@ -0,0 +1 @@
你好啊