招聘部分功能完善
This commit is contained in:
parent
84232c9860
commit
cdbc9a4571
|
@ -34,6 +34,16 @@ public class QuestionController {
|
|||
|
||||
return R.success(typeList);
|
||||
}
|
||||
@GetMapping("/search_typeName")
|
||||
public R searchTypeList(String name,String type,String encoding){
|
||||
|
||||
if(name==null&&encoding==null){
|
||||
return R.error("搜索失败,请稍后再试");
|
||||
}
|
||||
List<QuestionBank> questionBanks = questionBankService.searchTypeList(name,type,encoding);
|
||||
return R.success(questionBanks);
|
||||
}
|
||||
|
||||
@GetMapping("/get_typeListByType")
|
||||
public R getTypeListByType(String encoding,Integer type){
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@ package com.yzdx.AiInterviewer.controller;
|
|||
|
||||
|
||||
import com.yzdx.AiInterviewer.comment.R;
|
||||
import com.yzdx.AiInterviewer.entity.CompanyImage;
|
||||
import com.yzdx.AiInterviewer.mapper.CompanyImageMapper;
|
||||
import com.yzdx.AiInterviewer.utiles.ParseResumeUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -17,14 +15,14 @@ import javax.servlet.http.HttpSession;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
public class UploadController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private CompanyImageMapper companyImageMapper;
|
||||
//设置上传文件的最大大小
|
||||
public static final int MAX_SIZE=10*1024*1024;
|
||||
public static final String UPLOAD_AVATAR_PATH = "D:\\vueStudy\\Ai-interviewer-ui\\src\\upload\\picture";//获取上传文件的路径(获取项目中名为‘upload’的文件夹)
|
||||
|
@ -91,14 +89,10 @@ public class UploadController {
|
|||
|
||||
}
|
||||
String RealFilePath="http://localhost:5173/src/upload/picture/"+filename;
|
||||
|
||||
CompanyImage companyImage=new CompanyImage();
|
||||
companyImage.setImage(RealFilePath);
|
||||
companyImage.setFilename(filename);
|
||||
companyImage.setEncoding(encoding);
|
||||
companyImageMapper.insert(companyImage);
|
||||
|
||||
return R.success(companyImage);//返回图片存储在服务器的地址
|
||||
Map<String,Object> data=new HashMap<>();
|
||||
data.put("image",RealFilePath);
|
||||
data.put("filename",filename);
|
||||
return R.success(data);//返回图片存储在服务器的地址
|
||||
}
|
||||
|
||||
@GetMapping("/delete_picture")
|
||||
|
@ -150,9 +144,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 {
|
||||
|
||||
|
@ -163,13 +157,19 @@ public class UploadController {
|
|||
return R.error("文件存储出现异常");
|
||||
|
||||
}
|
||||
String RealFilePath="http://localhost:5173/src/upload/resume/"+filename;
|
||||
String RealFilePath="http://localhost:5173/src/upload/resume/"+fileName;
|
||||
ExecutorService pool= Executors.newCachedThreadPool();
|
||||
pool.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ParseResumeUtil.ParseChineseResume(UPLOAD_RESUME_PATH+"\\"+fileName);
|
||||
}
|
||||
});
|
||||
|
||||
ParseResumeUtil.ParseChineseResume(UPLOAD_RESUME_PATH+"\\"+filename);
|
||||
|
||||
Map<String,Object> data=new HashMap<>();
|
||||
data.put("resume",RealFilePath);
|
||||
data.put("filename",filename);
|
||||
data.put("filename",fileName);
|
||||
|
||||
return R.success(data);//返回图片存储在服务器的地址
|
||||
|
||||
|
|
|
@ -79,6 +79,15 @@ public class UserController {
|
|||
|
||||
return R.success(adminList);
|
||||
}
|
||||
@GetMapping("/search_admin")
|
||||
public R searchAdmin(String name,String encoding){
|
||||
if(name==null&&encoding==null){
|
||||
return R.error("查询失败");
|
||||
}
|
||||
List<User> users = userService.searchAdmin(name, encoding);
|
||||
|
||||
return R.success(users);
|
||||
}
|
||||
@PostMapping("/add_admin")
|
||||
public R addAdmin(@RequestBody @ApiParam("传入的值 addAdminInfo:{encoding,userId,username,phone,role}") Map<String ,Object> addAdminInfo){
|
||||
String encoding=(String) addAdminInfo.get("encoding");
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package com.yzdx.AiInterviewer.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CompanyImage {
|
||||
private Integer id;
|
||||
private String filename;
|
||||
private String image;
|
||||
private String encoding;
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package com.yzdx.AiInterviewer.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yzdx.AiInterviewer.entity.CompanyImage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CompanyImageMapper extends BaseMapper<CompanyImage> {
|
||||
}
|
|
@ -16,7 +16,14 @@ public interface QuestionBankService extends IService<QuestionBank> {
|
|||
* @return List<QuestionBank> 题库列表
|
||||
* */
|
||||
List<QuestionBank> getTypeList(String encoding);
|
||||
/**
|
||||
* 搜索题库类型
|
||||
* @param name 题库名
|
||||
* @param encoding 公司编码
|
||||
* @return 题库类型列表
|
||||
* */
|
||||
|
||||
List<QuestionBank> searchTypeList(String name,String type,String encoding);
|
||||
/**
|
||||
* 获取题库列表
|
||||
* @param encoding 公司编码
|
||||
|
|
|
@ -39,6 +39,13 @@ public interface UserService extends IService<User> {
|
|||
*
|
||||
* */
|
||||
List<User> getAdminList(String encoding);
|
||||
/**
|
||||
* 搜索管理员
|
||||
* @param encoding 公司编码
|
||||
* @param name 搜索管理员的名字
|
||||
* @return 搜索管理员信息
|
||||
* */
|
||||
List<User> searchAdmin(String name,String encoding);
|
||||
/**
|
||||
* 添加管理员
|
||||
* @param encoding 公司编码
|
||||
|
|
|
@ -33,6 +33,48 @@ public class QuestionBankServiceImpl extends ServiceImpl<QuestionBankMapper, Que
|
|||
return questionBanks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuestionBank> searchTypeList(String name, String type,String encoding) {
|
||||
|
||||
if (name!=null) {
|
||||
if (type==null) {
|
||||
LambdaQueryWrapper<QuestionBank> queryWrapper=new LambdaQueryWrapper<>();
|
||||
|
||||
queryWrapper.like(QuestionBank::getTypeName,name).eq(QuestionBank::getCompanyEncoding,encoding);
|
||||
|
||||
List<QuestionBank> questionBanks = questionBankMapper.selectList(queryWrapper);
|
||||
|
||||
return questionBanks;
|
||||
}else{
|
||||
LambdaQueryWrapper<QuestionBank> queryWrapper=new LambdaQueryWrapper<>();
|
||||
|
||||
queryWrapper.like(QuestionBank::getTypeName,name).eq(QuestionBank::getCompanyEncoding,encoding).eq(QuestionBank::getType,type);
|
||||
|
||||
List<QuestionBank> questionBanks = questionBankMapper.selectList(queryWrapper);
|
||||
|
||||
return questionBanks;
|
||||
|
||||
}
|
||||
|
||||
}else {
|
||||
if(type!=null){
|
||||
|
||||
LambdaQueryWrapper<QuestionBank> queryWrapper=new LambdaQueryWrapper<>();
|
||||
|
||||
queryWrapper.eq(QuestionBank::getType,type).eq(QuestionBank::getCompanyEncoding,encoding);
|
||||
|
||||
List<QuestionBank> questionBanks = questionBankMapper.selectList(queryWrapper);
|
||||
|
||||
return questionBanks;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QuestionBank> getTypeListByType(String encoding, Integer type) {
|
||||
if(encoding==null||type==null){
|
||||
|
|
|
@ -126,6 +126,26 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||
return filterUserList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> searchAdmin(String name, String encoding) {
|
||||
LambdaQueryWrapper<User> queryWrapper=new LambdaQueryWrapper<>();
|
||||
|
||||
queryWrapper.like(User::getUsername,name).eq(User::getCompanyEncoding,encoding);
|
||||
|
||||
List<User> userList = userMapper.selectList(queryWrapper);
|
||||
|
||||
List<User> filterUserList = userList.stream().map((item) -> {
|
||||
User user=new User();
|
||||
|
||||
BeanUtils.copyProperties(item,user);
|
||||
|
||||
user.setPassword(null);
|
||||
user.setSalt(null);
|
||||
return user;
|
||||
}).collect(Collectors.toList());
|
||||
return filterUserList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer addAdmin(String encoding, Integer userId, String username, String phone,String role) {
|
||||
User newUser=new User();
|
||||
|
|
Loading…
Reference in New Issue