取消岗位企业关注

This commit is contained in:
ljq 2023-12-10 23:37:26 +08:00
parent cdec6945dd
commit 96d26bbd67
16 changed files with 195 additions and 29 deletions

View File

@ -3,6 +3,8 @@ package com.yzdx.AiInterviewer.controller;
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.VxJobDetailDto;
import com.yzdx.AiInterviewer.entity.dto.JobDto;
import com.yzdx.AiInterviewer.entity.dto.JobPostingDto;
import com.yzdx.AiInterviewer.entity.dto.JobSettingDto;
@ -110,7 +112,7 @@ public class RecruitmentController {
if(id==null){
return R.error("获取失败");
}
JobEntity jobById = jobListService.getJobById(id);
VxJobDetailDto jobById = jobListService.getJobById(id);
if(jobById==null){
return R.error("出错了,请联系管理员!");
}
@ -314,7 +316,7 @@ public class RecruitmentController {
return R.error("获取失败");
}
Company companyDetail = companyService.getCompanyDetail(encoding);
VxCompanyDetailDto companyDetail = companyService.getCompanyDetail(encoding);
if(companyDetail==null){
return R.error("获取失败");
}
@ -430,10 +432,16 @@ public class RecruitmentController {
return R.success(jobPostingDtos);
}
/**
* 获取简历申请列表
* @param companyEncoding
* @param jobId
* @return
*/
@GetMapping("/getApplicationList")
public R getApplicationList(String companyEncoding,Integer jobId){
List<VxInterviewApplication> list=vxInterviewApplicationService.getApplicationList(companyEncoding,jobId);
return R.success(list);
}
}

View File

@ -3,6 +3,7 @@ package com.yzdx.AiInterviewer.controller.VxController;
import com.yzdx.AiInterviewer.comment.R;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxCompanyLikeDto;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxJobLikeDto;
import com.yzdx.AiInterviewer.entity.dto.JobDto;
import com.yzdx.AiInterviewer.service.CompanyService;
import com.yzdx.AiInterviewer.service.JobListService;
import com.yzdx.AiInterviewer.service.VxService.VxCompanyLikeService;
@ -74,24 +75,52 @@ public class VxJobController {
}
/**
* 取消岗位关注
* @return
*/
@DeleteMapping("/cancelJobLike")
public R cancelJobLike(Integer jobId,Integer userId){
Integer rows=vxJobLikeService.cancelJobLike(jobId,userId);
if(rows==-1){
return R.error("取消收藏失败");
}
return R.success("取消收藏成功");
}
/**
* 收藏企业关注
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "companyId",required = true),
@ApiImplicitParam(name = "companyEncoding",required = true),
@ApiImplicitParam(name = "userId",required = true),
})
@PostMapping("/addCompanyLike")
public R addCompanyLike(@RequestParam(value = "companyId")Integer companyId,
public R addCompanyLike(@RequestParam(value = "companyEncoding")String companyEncoding,
@RequestParam(value = "userId")Integer userId){
Integer rows=vxCompanyLikeService.addCompanyLike(companyId,userId);
Integer rows=vxCompanyLikeService.addCompanyLike(companyEncoding,userId);
if(rows!=-1){
if(rows!=1){
return R.error("收藏失败");
}
return R.success("收藏成功");
}
/**
* 取消企业关注
* @param
* @return
*/
@DeleteMapping("/cancelCompanyLike")
public R cancelCompanyLike(String companyEncoding,Integer userId){
Integer rows=vxCompanyLikeService.cancelCompanyLike(companyEncoding,userId);
if(rows==-1){
return R.error("取消关注失败");
}
return R.success("取消关注成功");
}
/**
* vx搜索岗位和企业
* @param searchName
@ -120,5 +149,12 @@ public class VxJobController {
return R.success(result);
}
/**
* 获取猜你喜欢
*/
@GetMapping("/getYourLikeJob")
public R getYourLikeJob(Integer jobId){
List<JobDto> list=jobListService.getYourLikeJob(jobId);
return R.success(list);
}
}

View File

@ -47,5 +47,4 @@ public class JobEntity extends BaseEntity {
private Integer status;
@ApiModelProperty("岗位福利")
private String jobWelfale;
}

View File

@ -0,0 +1,10 @@
package com.yzdx.AiInterviewer.entity.VxEntityDto;
import com.yzdx.AiInterviewer.entity.Company;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class VxCompanyDetailDto extends Company {
private Integer isLike;
}

View File

@ -0,0 +1,9 @@
package com.yzdx.AiInterviewer.entity.VxEntityDto;
import com.yzdx.AiInterviewer.entity.JobEntity;
import lombok.Data;
@Data
public class VxJobDetailDto extends JobEntity {
private Integer isLike;
}

View File

@ -1,6 +1,7 @@
package com.yzdx.AiInterviewer.entity.dto;
import com.yzdx.AiInterviewer.entity.BaseEntity;
import com.yzdx.AiInterviewer.entity.Company;
import lombok.Data;
@Data
@ -24,4 +25,6 @@ public class JobDto extends BaseEntity {
private Integer status;
private Company company;
}

View File

@ -13,9 +13,8 @@ public class VxCompanyLike extends BaseEntity {
@ApiModelProperty("关注公司id")
@TableId(type = IdType.AUTO)
private Integer id;
@ApiModelProperty("公司id")
private Integer companyId;
@ApiModelProperty("公司编码")
private String companyEncoding;
@ApiModelProperty("用户id")
private Integer userId;
}

View File

@ -2,6 +2,7 @@ package com.yzdx.AiInterviewer.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yzdx.AiInterviewer.entity.Company;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxCompanyDetailDto;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxCompanyLikeDto;
import java.util.List;
@ -14,7 +15,7 @@ public interface CompanyService extends IService<Company> {
* @return 公司详情对象
*
* */
Company getCompanyDetail(String encoding);
VxCompanyDetailDto getCompanyDetail(String encoding);
/**
* 更新公司详情
* @param userId 人的id

View File

@ -2,6 +2,7 @@ package com.yzdx.AiInterviewer.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yzdx.AiInterviewer.entity.JobEntity;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxJobDetailDto;
import com.yzdx.AiInterviewer.entity.dto.JobDto;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxJobLikeDto;
@ -67,7 +68,7 @@ public interface JobListService extends IService<JobEntity> {
* @param id 岗位id
* @return 岗位对象
* */
JobEntity getJobById(Integer id);
VxJobDetailDto getJobById(Integer id);
/**
* 修改岗位
* @param userId 添加人的id
@ -141,4 +142,11 @@ public interface JobListService extends IService<JobEntity> {
*
* */
List<Map<String,Object>> getSuggestJob(Integer userId);
/**
* 根据岗位id查猜你喜欢
* @param jobId
* @return
*/
List<JobDto> getYourLikeJob(Integer jobId);
}

View File

@ -10,5 +10,7 @@ public interface VxCompanyLikeService extends IService<VxCompanyLike> {
List<VxCompanyLikeDto> getCompanyLikeListById(Integer userId);
Integer addCompanyLike(Integer companyId, Integer userId);
Integer addCompanyLike(String companyEncoding, Integer userId);
Integer cancelCompanyLike(String companyEncoding,Integer userId);
}

View File

@ -20,4 +20,5 @@ public interface VxJobLikeService extends IService<VxJobLike> {
Integer addJobLike(Integer jobId, Integer userId);
Integer cancelJobLike(Integer jobId,Integer userId);
}

View File

@ -6,6 +6,7 @@ import com.yzdx.AiInterviewer.entity.Company;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxCompanyLikeDto;
import com.yzdx.AiInterviewer.entity.dto.JobDto;
import com.yzdx.AiInterviewer.entity.vxEntity.VxCompanyLike;
import com.yzdx.AiInterviewer.entity.vxEntity.VxJobLike;
import com.yzdx.AiInterviewer.mapper.CompanyMapper;
import com.yzdx.AiInterviewer.mapper.VxMapper.VxCompanyLikeMapper;
import com.yzdx.AiInterviewer.service.JobListService;
@ -42,14 +43,14 @@ public class VxCompanyLikeServiceImpl extends ServiceImpl<VxCompanyLikeMapper, V
VxCompanyLikeDto vxCompanyLikeDto=new VxCompanyLikeDto();
BeanUtils.copyProperties(item,vxCompanyLikeDto);
// 得到公司id
// 得到公司编码
LambdaQueryWrapper<Company> queryWrapper1=new LambdaQueryWrapper<>();
queryWrapper1.eq(Company::getId,vxCompanyLikeDto.getCompanyId());
queryWrapper1.eq(Company::getEncoding,vxCompanyLikeDto.getCompanyEncoding());
Company company = companyMapper.selectOne(queryWrapper1);
vxCompanyLikeDto.setCompanyId(company.getId());
vxCompanyLikeDto.setCompanyEncoding(company.getEncoding());
vxCompanyLikeDto.setCompanyName(company.getCompanyName());
//得到公司类型
@ -79,19 +80,31 @@ public class VxCompanyLikeServiceImpl extends ServiceImpl<VxCompanyLikeMapper, V
}
@Override
public Integer addCompanyLike(Integer companyId, Integer userId) {
public Integer addCompanyLike(String companyEncoding, Integer userId) {
LambdaQueryWrapper<VxCompanyLike> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(VxCompanyLike::getCompanyId,companyId);
queryWrapper.eq(VxCompanyLike::getCompanyEncoding,companyEncoding);
VxCompanyLike vxCompanyLike = vxCompanyLikeMapper.selectOne(queryWrapper);
if(vxCompanyLike!=null){
return -1;
}
VxCompanyLike vxCompanyLike1=new VxCompanyLike();
vxCompanyLike1.setCompanyId(companyId);
vxCompanyLike1.setCompanyEncoding(companyEncoding);
vxCompanyLike1.setUserId(userId);
vxCompanyLike1.setCreateTime(TimeUtil.getTime());
vxCompanyLike1.setCreateUser(userId);
Integer row = vxCompanyLikeMapper.insert(vxCompanyLike1);
return row;
}
@Override
public Integer cancelCompanyLike(String companyEncoding,Integer userId) {
LambdaQueryWrapper<VxCompanyLike> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(VxCompanyLike::getCompanyEncoding,companyEncoding).eq(VxCompanyLike::getUserId,userId);
VxCompanyLike vxJobLike = vxCompanyLikeMapper.selectOne(queryWrapper);
if(vxJobLike==null){
return -1;
}
Integer row = vxCompanyLikeMapper.delete(queryWrapper);
return row;
}
}

View File

@ -47,7 +47,6 @@ public class VxInterviewApplicationServiceImpl extends ServiceImpl<VxInterviewAp
Integer insert = vxInterviewApplicationMapper.insert(vxInterviewApplication1);
return insert;
}
@Override
public List<VxInterviewApplication> getApplicationList(String companyEncoding, Integer jobId) {
LambdaQueryWrapper<VxInterviewApplication> queryWrapper=new LambdaQueryWrapper<>();

View File

@ -96,4 +96,16 @@ public class VxJobLikeServiceImpl extends ServiceImpl<VxJobLikeMapper, VxJobLike
return rows;
}
@Override
public Integer cancelJobLike(Integer jobId,Integer userId) {
LambdaQueryWrapper<VxJobLike> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(VxJobLike::getJobId,jobId).eq(VxJobLike::getUserId,userId);
VxJobLike vxJobLike = vxJobLikeMapper.selectOne(queryWrapper);
if(vxJobLike==null){
return -1;
}
Integer row = vxJobLikeMapper.delete(queryWrapper);
return row;
}
}

View File

@ -4,10 +4,14 @@ 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.VxEntityDto.VxCompanyDetailDto;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxCompanyLikeDto;
import com.yzdx.AiInterviewer.entity.dto.JobDto;
import com.yzdx.AiInterviewer.entity.vxEntity.VxCompanyLike;
import com.yzdx.AiInterviewer.mapper.CompanyMapper;
import com.yzdx.AiInterviewer.mapper.JobMapper;
import com.yzdx.AiInterviewer.mapper.VxMapper.VxCompanyLikeMapper;
import com.yzdx.AiInterviewer.mapper.VxMapper.VxJobLikeMapper;
import com.yzdx.AiInterviewer.service.CompanyService;
import com.yzdx.AiInterviewer.service.JobListService;
import com.yzdx.AiInterviewer.utiles.TimeUtil;
@ -28,16 +32,34 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
@Autowired
private JobMapper jobMapper;
@Autowired
private VxCompanyLikeMapper vxCompanyLikeMapper;
@Override
public Company getCompanyDetail(String encoding) {
public VxCompanyDetailDto getCompanyDetail(String encoding) {
LambdaQueryWrapper<Company> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(Company::getEncoding,encoding);
Company company = companyMapper.selectOne(queryWrapper);
return company;
VxCompanyDetailDto vxCompanyDetailDto=new VxCompanyDetailDto();
BeanUtils.copyProperties(company,vxCompanyDetailDto);
LambdaQueryWrapper<VxCompanyLike> queryWrapper1=new LambdaQueryWrapper<>();
queryWrapper1.eq(VxCompanyLike::getCompanyEncoding,company.getEncoding());
VxCompanyLike vxCompanyLike = vxCompanyLikeMapper.selectOne(queryWrapper1);
if(vxCompanyLike!=null){
vxCompanyDetailDto.setIsLike(1);
return vxCompanyDetailDto;
}
vxCompanyDetailDto.setIsLike(0);
return vxCompanyDetailDto;
}
@Override

View File

@ -9,9 +9,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yzdx.AiInterviewer.entity.Company;
import com.yzdx.AiInterviewer.entity.JobEntity;
import com.yzdx.AiInterviewer.entity.Resume;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxJobDetailDto;
import com.yzdx.AiInterviewer.entity.dto.JobDto;
import com.yzdx.AiInterviewer.entity.VxEntityDto.VxJobLikeDto;
import com.yzdx.AiInterviewer.entity.vxEntity.VxJobLike;
import com.yzdx.AiInterviewer.mapper.JobMapper;
import com.yzdx.AiInterviewer.mapper.VxMapper.VxJobLikeMapper;
import com.yzdx.AiInterviewer.service.CompanyService;
import com.yzdx.AiInterviewer.service.JobListService;
import com.yzdx.AiInterviewer.service.ResumeService;
@ -37,7 +40,8 @@ public class JobListServiceImpl extends ServiceImpl<JobMapper, JobEntity> implem
private CompanyService companyService;
@Autowired
private ResumeService resumeService;
@Autowired
private VxJobLikeMapper vxJobLikeMapper;
@Override
public Integer addJob(List<String> address, String address_detail, String details, String jobName, String startTime, String endTime, List<String> jobTips, Integer jobType, String min_salary, String max_salary, String min_number, String max_number, Integer requirement, Integer userId, String encoding) {
//查看岗位名称是否存在
@ -204,12 +208,30 @@ public class JobListServiceImpl extends ServiceImpl<JobMapper, JobEntity> implem
}
@Override
public JobEntity getJobById(Integer id) {
public VxJobDetailDto getJobById(Integer id) {
LambdaQueryWrapper<JobEntity> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.eq(JobEntity::getId,id);
return jobMapper.selectOne(queryWrapper);
JobEntity jobEntity = jobMapper.selectOne(queryWrapper);
VxJobDetailDto vxJobDetailDto=new VxJobDetailDto();
BeanUtils.copyProperties(jobEntity,vxJobDetailDto);
LambdaQueryWrapper<VxJobLike> queryWrapper1=new LambdaQueryWrapper<>();
queryWrapper1.eq(VxJobLike::getJobId,jobEntity.getId());
VxJobLike vxJobLike = vxJobLikeMapper.selectOne(queryWrapper1);
if(vxJobLike!=null){
vxJobDetailDto.setIsLike(1);
return vxJobDetailDto;
}
vxJobDetailDto.setIsLike(0);
return vxJobDetailDto;
}
@Override
@ -422,8 +444,30 @@ public class JobListServiceImpl extends ServiceImpl<JobMapper, JobEntity> implem
result.add(jobEntitys);
}
return result;
}
@Override
public List<JobDto> getYourLikeJob(Integer jobId) {
LambdaQueryWrapper<JobEntity> queryWrapper=new LambdaQueryWrapper<>();
queryWrapper.like(JobEntity::getId,jobId);
List<JobEntity> vxJobLikes = jobMapper.selectList(queryWrapper);
List<JobDto> jobDtos=vxJobLikes.stream().map(item->{
JobDto vxJobLikeDto=new JobDto();
BeanUtils.copyProperties(item,vxJobLikeDto);
//获取岗位名称
LambdaQueryWrapper<JobEntity> queryWrapper1=new LambdaQueryWrapper<>();
queryWrapper1.eq(JobEntity::getId,item.getId());
JobEntity jobById = jobMapper.selectOne(queryWrapper1);
vxJobLikeDto.setJobName(jobById.getJobName());
//获取薪水
vxJobLikeDto.setSalary(jobById.getMinSalary()+"-"+jobById.getMaxSalary());
//获取公司名称
Company company=companyService.getCompanyDetail(item.getCompanyEncoding());
vxJobLikeDto.setCompany(company);
//获取员工人数
//获取公司位置
return vxJobLikeDto;
}).collect(Collectors.toList());
return jobDtos;
}
}