diff --git a/src/main/java/com/yzdx/AiInterviewer/controller/InterviewController.java b/src/main/java/com/yzdx/AiInterviewer/controller/InterviewController.java index 11ebb1c..f342858 100644 --- a/src/main/java/com/yzdx/AiInterviewer/controller/InterviewController.java +++ b/src/main/java/com/yzdx/AiInterviewer/controller/InterviewController.java @@ -7,10 +7,7 @@ import com.yzdx.AiInterviewer.entity.InvitePromote; import com.yzdx.AiInterviewer.entity.LogoEntity; import com.yzdx.AiInterviewer.entity.dto.InvitePromoteDto; import com.yzdx.AiInterviewer.mapper.InvitePromoteMapper; -import com.yzdx.AiInterviewer.service.InterviewBackgroundService; -import com.yzdx.AiInterviewer.service.InterviewImagesService; -import com.yzdx.AiInterviewer.service.InterviewLogoService; -import com.yzdx.AiInterviewer.service.InvitePromoteService; +import com.yzdx.AiInterviewer.service.*; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; @@ -34,6 +31,8 @@ public class InterviewController { private InterviewBackgroundService backgroundService; @Autowired private InvitePromoteService invitePromoteService; + @Autowired + private InterviewNoticeService interviewNoticeService; /** * 获取公司logo @@ -250,6 +249,27 @@ public class InterviewController { return R.success(invitePromote); } + + @PostMapping("/sendInterviewNotice") + public R sendInterviewNotice(@RequestBody Map addInfo){ + String encoding=(String) addInfo.get("encoding"); + Integer recipient=(Integer) addInfo.get("recipient"); + Integer jobId=(Integer) addInfo.get("jobId"); + Integer postId=(Integer) addInfo.get("postId"); + Integer inviteId=(Integer) addInfo.get("inviteId"); + Integer userId=(Integer) addInfo.get("userId"); + + Integer rows = interviewNoticeService.addInterviewNotice(encoding,recipient, + jobId, postId, inviteId, userId); + if(rows==-2){ + return R.error("您已经邀请过他面试啦"); + } + if(rows==-3){ + return R.error("邀请失败,请联系管理员"); + } + return R.success("邀请成功"); + + } } diff --git a/src/main/java/com/yzdx/AiInterviewer/controller/VxController/VxInterviewController.java b/src/main/java/com/yzdx/AiInterviewer/controller/VxController/VxInterviewController.java index b9b06fd..604f22b 100644 --- a/src/main/java/com/yzdx/AiInterviewer/controller/VxController/VxInterviewController.java +++ b/src/main/java/com/yzdx/AiInterviewer/controller/VxController/VxInterviewController.java @@ -1,10 +1,11 @@ package com.yzdx.AiInterviewer.controller.VxController; import com.yzdx.AiInterviewer.comment.R; -import com.yzdx.AiInterviewer.entity.VxEntityDto.VxInterviewRecordDto; +import com.yzdx.AiInterviewer.entity.VxEntityDto.VxNoticeDto; +import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewNotice; +import com.yzdx.AiInterviewer.service.InterviewNoticeService; import com.yzdx.AiInterviewer.service.VxService.VxCarouselChartService; import com.yzdx.AiInterviewer.service.VxService.VxInterviewApplicationService; -import com.yzdx.AiInterviewer.service.VxService.VxInterviewRecordService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -19,7 +20,7 @@ public class VxInterviewController { @Autowired private VxInterviewApplicationService vxInterviewApplicationService; @Autowired - private VxInterviewRecordService vxInterviewRecordService; + private InterviewNoticeService interviewNoticeService; @GetMapping("/getCarouselChart") public R getCarouselChart(){ @@ -37,15 +38,13 @@ public class VxInterviewController { } return R.success("申请成功"); } - @GetMapping("getInterviewRecord") - public R getInterviewRecordList(Integer userId,Integer noticeId){ - List list=vxInterviewRecordService.getInterviewRecordList(userId,noticeId); - return R.success(list); - } - @GetMapping("/searchInterviewRecord") - public R searchInterviewRecordList(String searchCompany,Integer noticeId){ - List list=vxInterviewRecordService.searchInterviewRecordList(searchCompany,noticeId); - return R.success(list); + @GetMapping("/getInterviewNotice") + public R getInterviewNotice(Integer userId){ + + List VxNoticeDtoList = interviewNoticeService.getInterviewNoticeByUserId(userId); + + return R.success(VxNoticeDtoList); + } } diff --git a/src/main/java/com/yzdx/AiInterviewer/entity/InterviewNotice.java b/src/main/java/com/yzdx/AiInterviewer/entity/InterviewNotice.java deleted file mode 100644 index b35f59a..0000000 --- a/src/main/java/com/yzdx/AiInterviewer/entity/InterviewNotice.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.yzdx.AiInterviewer.entity; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -@ApiModel("面试通知实体类") -public class InterviewNotice extends BaseEntity{ - @ApiModelProperty("面试通知id") - private Integer id; - @ApiModelProperty("公司编码") - private String companyEncoding; - @ApiModelProperty("通知内容") - private String detail; - @ApiModelProperty("注意事项") - private String attention; - @ApiModelProperty("收件人") - private String recipient; -} diff --git a/src/main/java/com/yzdx/AiInterviewer/entity/VxEntityDto/VxNoticeDto.java b/src/main/java/com/yzdx/AiInterviewer/entity/VxEntityDto/VxNoticeDto.java new file mode 100644 index 0000000..12d49b9 --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/entity/VxEntityDto/VxNoticeDto.java @@ -0,0 +1,21 @@ +package com.yzdx.AiInterviewer.entity.VxEntityDto; + +import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewNotice; +import lombok.Data; + +@Data +public class VxNoticeDto extends VxInterviewNotice { + + private String companyEncoding; + + private String companyName; + + private String interviewSendTime; + + private String companyLogoUrl; + + private String interviewer; + + private String job; + +} diff --git a/src/main/java/com/yzdx/AiInterviewer/entity/vxEntity/VxInterviewNotice.java b/src/main/java/com/yzdx/AiInterviewer/entity/vxEntity/VxInterviewNotice.java index ccd76b8..6d8ead4 100644 --- a/src/main/java/com/yzdx/AiInterviewer/entity/vxEntity/VxInterviewNotice.java +++ b/src/main/java/com/yzdx/AiInterviewer/entity/vxEntity/VxInterviewNotice.java @@ -27,4 +27,6 @@ public class VxInterviewNotice extends BaseEntity { private Integer jobId; @ApiModelProperty("招聘面试id") private Integer postId; + + private Integer inviteId; } diff --git a/src/main/java/com/yzdx/AiInterviewer/mapper/InterviewNoticeMapper.java b/src/main/java/com/yzdx/AiInterviewer/mapper/InterviewNoticeMapper.java deleted file mode 100644 index 5e65d17..0000000 --- a/src/main/java/com/yzdx/AiInterviewer/mapper/InterviewNoticeMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.yzdx.AiInterviewer.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.yzdx.AiInterviewer.entity.InterviewNotice; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface InterviewNoticeMapper extends BaseMapper{ - -} diff --git a/src/main/java/com/yzdx/AiInterviewer/service/InterviewNoticeService.java b/src/main/java/com/yzdx/AiInterviewer/service/InterviewNoticeService.java new file mode 100644 index 0000000..872af17 --- /dev/null +++ b/src/main/java/com/yzdx/AiInterviewer/service/InterviewNoticeService.java @@ -0,0 +1,33 @@ +package com.yzdx.AiInterviewer.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.yzdx.AiInterviewer.entity.VxEntityDto.VxNoticeDto; +import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewNotice; + +import java.util.List; + +public interface InterviewNoticeService extends IService { +/** + * 添加面试通知 + * @param encoding 发起通知的公司编码 + * @param detail 通知主体内容 + * @param attention 面试注意事项 + * @param recipient 接收人id + * @param jobId 面试的岗位id + * @param postId 投递时的招聘id + * @param inviteId 面试设置的promoteId + * @param userId 操作人的id + * @return 影响的行数 + * + * */ + Integer addInterviewNotice(String encoding,Integer recipient,Integer jobId,Integer postId,Integer inviteId,Integer userId); + + + /** + * 求职者查看面试通知 + * @param userId 查询的用户ID + * + * */ + List getInterviewNoticeByUserId(Integer userId); + +} diff --git a/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxInterviewApplicationService.java b/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxInterviewApplicationService.java index 2321953..a72132f 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxInterviewApplicationService.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/VxService/VxInterviewApplicationService.java @@ -4,5 +4,24 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.yzdx.AiInterviewer.entity.vxEntity.VxInterviewApplication; public interface VxInterviewApplicationService extends IService { + /** + * vx投递简历 + * @param userId 用户ID + * @param jobId 投递岗位id + * @param postingId 招聘的id + * @param companyEncoding 投递的公司 + * + * */ + Integer addInterviewApplication(Integer jobId, Integer userId, Integer postingId, String companyEncoding); + + + /** + * Hr端获取面试申请 + * + * + * */ + + + } diff --git a/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxInterviewApplicationServiceImpl.java b/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxInterviewApplicationServiceImpl.java index 1e269b6..1a8653a 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxInterviewApplicationServiceImpl.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/VxService/impl/VxInterviewApplicationServiceImpl.java @@ -42,7 +42,7 @@ public class VxInterviewApplicationServiceImpl extends ServiceImpl implements InterviewNoticeService { + + @Autowired + private InterviewNoticeMapper interviewNoticeMapper; + @Autowired + private UserMapper userMapper; + @Autowired + private CompanyService companyService; + + @Autowired + private JobMapper jobMapper; + + @Override + public Integer addInterviewNotice(String encoding, Integer recipient, Integer jobId, Integer postId, + Integer inviteId,Integer userId) { + + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + + queryWrapper.eq(VxInterviewNotice::getCompanyEncoding,encoding).eq(VxInterviewNotice::getJobId,jobId) + .eq(VxInterviewNotice::getPostId,postId).eq(VxInterviewNotice::getInviteId,inviteId); + + VxInterviewNotice vxInterviewNotice = interviewNoticeMapper.selectOne(queryWrapper); + + if(vxInterviewNotice!=null){ + + return -2; + } + + VxInterviewNotice newVxInterviewNotice=new VxInterviewNotice(); + + newVxInterviewNotice.setCompanyEncoding(encoding); + + newVxInterviewNotice.setRecipient(recipient); + + newVxInterviewNotice.setJobId(jobId); + + newVxInterviewNotice.setPostId(postId); + + newVxInterviewNotice.setInviteId(inviteId); + + newVxInterviewNotice.setCreateTime(TimeUtil.getTime()); + + newVxInterviewNotice.setUpdateTime(TimeUtil.getTime()); + + newVxInterviewNotice.setCreateUser(userId); + + newVxInterviewNotice.setUpdateUser(userId); + + //查询用户的信息 + User user = userMapper.selectById(recipient); + + //查询公司信息 + Company companyDetail = companyService.getCompanyDetail(encoding); + + //查询岗位信息 + JobEntity jobEntity = jobMapper.selectById(jobId); + + + String companyName=companyDetail.getCompanyName(); + + String email=user.getEmail(); + + String userName=user.getUsername(); + + String jobName=jobEntity.getJobName(); + if(email==null||userName==null||companyName==null||jobName==null){ + return -3; + } + + try { + EmailUtil.sendEmail(email,userName,companyName,jobName); + } catch (Exception e) { + e.printStackTrace(); + return -3; + } + + Integer rows = interviewNoticeMapper.insert(newVxInterviewNotice); + + return rows; + } + + @Override + public List getInterviewNoticeByUserId(Integer userId) { + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + + queryWrapper.eq(VxInterviewNotice::getRecipient,userId); + + List vxInterviewNotices = interviewNoticeMapper.selectList(queryWrapper); + + List VxNoticeDtoList=vxInterviewNotices.stream().map(item->{ + + VxNoticeDto vxNoticeDto=new VxNoticeDto(); + + BeanUtils.copyProperties(item,vxNoticeDto); + + vxNoticeDto.setCompanyEncoding(item.getCompanyEncoding()); + + Company companyDetail = companyService.getCompanyDetail(item.getCompanyEncoding()); + + vxNoticeDto.setCompanyName(companyDetail.getCompanyName()); + + vxNoticeDto.setInterviewSendTime(item.getCreateTime()); + + vxNoticeDto.setCompanyLogoUrl(companyDetail.getCompanyLogo()); + + User user = userMapper.selectById(item.getRecipient()); + + vxNoticeDto.setInterviewer(user.getUsername()); + + JobEntity jobEntity = jobMapper.selectById(item.getJobId()); + + vxNoticeDto.setJob(jobEntity.getJobName()); + + return vxNoticeDto; + + }).collect(Collectors.toList()); + + return VxNoticeDtoList; + } + + +} diff --git a/src/main/java/com/yzdx/AiInterviewer/service/impl/ResumeServiceImpl.java b/src/main/java/com/yzdx/AiInterviewer/service/impl/ResumeServiceImpl.java index a786bd3..740d5c5 100644 --- a/src/main/java/com/yzdx/AiInterviewer/service/impl/ResumeServiceImpl.java +++ b/src/main/java/com/yzdx/AiInterviewer/service/impl/ResumeServiceImpl.java @@ -47,7 +47,7 @@ public class ResumeServiceImpl extends ServiceImpl impleme return null; } - if(avatar!=null){ + if(avatar!=null||email!=null){ LambdaQueryWrapper queryWrapper1=new LambdaQueryWrapper(); @@ -55,7 +55,19 @@ public class ResumeServiceImpl extends ServiceImpl impleme User findUser = userMapper.selectOne(queryWrapper1); + findUser.setUsername(name); + findUser.setAvatar(avatar); + + findUser.setEmail(email); + + findUser.setPhone(phone); + + Integer rows = userMapper.updateById(findUser); + + if(rows!=1){ + return null; + } } Resume resume=new Resume(); @@ -262,13 +274,21 @@ public class ResumeServiceImpl extends ServiceImpl impleme Map result=new HashMap<>(); if(avatar!=null){ - LambdaQueryWrapper queryWrapper1=new LambdaQueryWrapper<>(); + LambdaQueryWrapper queryWrapper1=new LambdaQueryWrapper(); queryWrapper1.eq(User::getId,userId); User findUser = userMapper.selectOne(queryWrapper1); + findUser.setUsername(name); + findUser.setAvatar(avatar); + + findUser.setEmail(email); + + findUser.setPhone(phone); + + Integer rows = userMapper.updateById(findUser); } Resume resume=new Resume(); diff --git a/src/main/java/com/yzdx/AiInterviewer/utiles/EmailUtil.java b/src/main/java/com/yzdx/AiInterviewer/utiles/EmailUtil.java index 123afba..c1f1d07 100644 --- a/src/main/java/com/yzdx/AiInterviewer/utiles/EmailUtil.java +++ b/src/main/java/com/yzdx/AiInterviewer/utiles/EmailUtil.java @@ -31,9 +31,7 @@ public class EmailUtil { * @throws Exception */ - public static String sendEmail(String email) { - String code=RandomCodeUtil.random(6); - log.info(code); + public static String sendEmail(String email,String userName,String companyName,String jobName) { Transport ts = null; try { @@ -63,7 +61,7 @@ public class EmailUtil { }); //开启Session的debug模式,这样就可以查看到程序发送Email的运行状态 - session.setDebug(true); + session.setDebug(false); //2、通过session得到transport对象 ts = session.getTransport(); @@ -82,24 +80,24 @@ public class EmailUtil { message.setRecipient(Message.RecipientType.TO, new InternetAddress(email)); //4-4,邮件标题 - message.setSubject("扬城直聘:"); + message.setSubject("扬城直聘:"+companyName); //4-5,邮件文本内容 - message.setContent("我是测试!", "text/html;charset=UTF-8"); + message.setContent("

"+userName+"先生,你好!

您已获得本公司"+"["+jobName+"]AI面试资格,请打开微信小程序,点击面试通知查看详情","text/html;charset=UTF-8"); //4-6,发送邮件 ts.sendMessage(message, message.getAllRecipients()); //5,关闭连接 ts.close(); - return code; } catch (Exception e) { return "发送邮件失败"; } - + return "发送成功"; } public static void main(String[] args) { - sendEmail("2660820526@qq.com"); + sendEmail("2209176490@qq.com","Jerry","小米有限责任公司","java程序员"); } + }